@photostructure/sqlite 0.5.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +4 -2
- package/binding.gyp +2 -0
- package/dist/index.cjs +65 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +60 -1
- package/dist/index.d.mts +60 -1
- package/dist/index.d.ts +60 -1
- package/dist/index.mjs +65 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
- package/prebuilds/darwin-arm64/@photostructure+sqlite.glibc.node +0 -0
- package/prebuilds/darwin-x64/@photostructure+sqlite.glibc.node +0 -0
- package/prebuilds/linux-arm64/@photostructure+sqlite.glibc.node +0 -0
- package/prebuilds/linux-arm64/@photostructure+sqlite.musl.node +0 -0
- package/prebuilds/linux-x64/@photostructure+sqlite.glibc.node +0 -0
- package/prebuilds/linux-x64/@photostructure+sqlite.musl.node +0 -0
- package/prebuilds/test_extension.so +0 -0
- package/prebuilds/win32-arm64/@photostructure+sqlite.glibc.node +0 -0
- package/prebuilds/win32-x64/@photostructure+sqlite.glibc.node +0 -0
- package/src/enhance.ts +7 -4
- package/src/index.ts +84 -2
- package/src/sqlite_impl.cpp +133 -10
- package/src/sqlite_impl.h +19 -0
- package/src/types/database-sync-instance.ts +43 -0
- package/src/types/database-sync-options.ts +19 -0
- package/src/upstream/node_sqlite.cc +312 -17
- package/src/upstream/node_sqlite.h +80 -0
- package/src/upstream/sqlite.js +0 -3
- package/src/upstream/sqlite3.c +5027 -3518
- package/src/upstream/sqlite3.h +195 -58
- package/src/upstream/sqlite3ext.h +10 -1
package/src/upstream/sqlite3.h
CHANGED
|
@@ -146,12 +146,12 @@ extern "C" {
|
|
|
146
146
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
|
147
147
|
** [sqlite_version()] and [sqlite_source_id()].
|
|
148
148
|
*/
|
|
149
|
-
#define SQLITE_VERSION "3.
|
|
150
|
-
#define SQLITE_VERSION_NUMBER
|
|
151
|
-
#define SQLITE_SOURCE_ID "2026-
|
|
152
|
-
#define SQLITE_SCM_BRANCH "
|
|
153
|
-
#define SQLITE_SCM_TAGS "release version-3.
|
|
154
|
-
#define SQLITE_SCM_DATETIME "2026-
|
|
149
|
+
#define SQLITE_VERSION "3.52.0"
|
|
150
|
+
#define SQLITE_VERSION_NUMBER 3052000
|
|
151
|
+
#define SQLITE_SOURCE_ID "2026-03-06 16:01:44 557aeb43869d3585137b17690cb3b64f7de6921774daae9e56403c3717dceab6"
|
|
152
|
+
#define SQLITE_SCM_BRANCH "trunk"
|
|
153
|
+
#define SQLITE_SCM_TAGS "release major-release version-3.52.0"
|
|
154
|
+
#define SQLITE_SCM_DATETIME "2026-03-06T16:01:44.367Z"
|
|
155
155
|
|
|
156
156
|
/*
|
|
157
157
|
** CAPI3REF: Run-Time Library Version Numbers
|
|
@@ -1490,7 +1490,7 @@ typedef const char *sqlite3_filename;
|
|
|
1490
1490
|
** greater and the function pointer is not NULL) and will fall back
|
|
1491
1491
|
** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
|
|
1492
1492
|
**
|
|
1493
|
-
** ^The xSetSystemCall(), xGetSystemCall(), and
|
|
1493
|
+
** ^The xSetSystemCall(), xGetSystemCall(), and xNextSystemCall() interfaces
|
|
1494
1494
|
** are not used by the SQLite core. These optional interfaces are provided
|
|
1495
1495
|
** by some VFSes to facilitate testing of the VFS code. By overriding
|
|
1496
1496
|
** system calls with functions under its control, a test program can
|
|
@@ -2567,12 +2567,15 @@ struct sqlite3_mem_methods {
|
|
|
2567
2567
|
** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]]
|
|
2568
2568
|
** <dt>SQLITE_DBCONFIG_STMT_SCANSTATUS</dt>
|
|
2569
2569
|
** <dd>The SQLITE_DBCONFIG_STMT_SCANSTATUS option is only useful in
|
|
2570
|
-
** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears
|
|
2571
|
-
** a flag that enables collection of
|
|
2572
|
-
**
|
|
2573
|
-
**
|
|
2574
|
-
**
|
|
2575
|
-
**
|
|
2570
|
+
** [SQLITE_ENABLE_STMT_SCANSTATUS] builds. In this case, it sets or clears
|
|
2571
|
+
** a flag that enables collection of run-time performance statistics
|
|
2572
|
+
** used by [sqlite3_stmt_scanstatus_v2()] and the [nexec and ncycle]
|
|
2573
|
+
** columns of the [bytecode virtual table].
|
|
2574
|
+
** For statistics to be collected, the flag must be set on
|
|
2575
|
+
** the database handle both when the SQL statement is
|
|
2576
|
+
** [sqlite3_prepare|prepared] and when it is [sqlite3_step|stepped].
|
|
2577
|
+
** The flag is set (collection of statistics is enabled) by default.
|
|
2578
|
+
** <p>This option takes two arguments: an integer and a pointer to
|
|
2576
2579
|
** an integer. The first argument is 1, 0, or -1 to enable, disable, or
|
|
2577
2580
|
** leave unchanged the statement scanstatus option. If the second argument
|
|
2578
2581
|
** is not NULL, then the value of the statement scanstatus setting after
|
|
@@ -2645,6 +2648,22 @@ struct sqlite3_mem_methods {
|
|
|
2645
2648
|
** comments are allowed in SQL text after processing the first argument.
|
|
2646
2649
|
** </dd>
|
|
2647
2650
|
**
|
|
2651
|
+
** [[SQLITE_DBCONFIG_FP_DIGITS]]
|
|
2652
|
+
** <dt>SQLITE_DBCONFIG_FP_DIGITS</dt>
|
|
2653
|
+
** <dd>The SQLITE_DBCONFIG_FP_DIGITS setting is a small integer that determines
|
|
2654
|
+
** the number of significant digits that SQLite will attempt to preserve when
|
|
2655
|
+
** converting floating point numbers (IEEE 754 "doubles") into text. The
|
|
2656
|
+
** default value 17, as of SQLite version 3.52.0. The value was 15 in all
|
|
2657
|
+
** prior versions.<p>
|
|
2658
|
+
** This option takes two arguments which are an integer and a pointer
|
|
2659
|
+
** to an integer. The first argument is a small integer, between 3 and 23, or
|
|
2660
|
+
** zero. The FP_DIGITS setting is changed to that small integer, or left
|
|
2661
|
+
** altered if the first argument is zero or out of range. The second argument
|
|
2662
|
+
** is a pointer to an integer. If the pointer is not NULL, then the value of
|
|
2663
|
+
** the FP_DIGITS setting, after possibly being modified by the first
|
|
2664
|
+
** arguments, is written into the integer to which the second argument points.
|
|
2665
|
+
** </dd>
|
|
2666
|
+
**
|
|
2648
2667
|
** </dl>
|
|
2649
2668
|
**
|
|
2650
2669
|
** [[DBCONFIG arguments]] <h3>Arguments To SQLITE_DBCONFIG Options</h3>
|
|
@@ -2662,9 +2681,10 @@ struct sqlite3_mem_methods {
|
|
|
2662
2681
|
** the first argument.
|
|
2663
2682
|
**
|
|
2664
2683
|
** <p>While most SQLITE_DBCONFIG options use the argument format
|
|
2665
|
-
** described in the previous paragraph, the [SQLITE_DBCONFIG_MAINDBNAME]
|
|
2666
|
-
** and [
|
|
2667
|
-
** documentation of those exceptional options for
|
|
2684
|
+
** described in the previous paragraph, the [SQLITE_DBCONFIG_MAINDBNAME],
|
|
2685
|
+
** [SQLITE_DBCONFIG_LOOKASIDE], and [SQLITE_DBCONFIG_FP_DIGITS] options
|
|
2686
|
+
** are different. See the documentation of those exceptional options for
|
|
2687
|
+
** details.
|
|
2668
2688
|
*/
|
|
2669
2689
|
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
|
|
2670
2690
|
#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
|
|
@@ -2689,7 +2709,8 @@ struct sqlite3_mem_methods {
|
|
|
2689
2709
|
#define SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE 1020 /* int int* */
|
|
2690
2710
|
#define SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE 1021 /* int int* */
|
|
2691
2711
|
#define SQLITE_DBCONFIG_ENABLE_COMMENTS 1022 /* int int* */
|
|
2692
|
-
#define
|
|
2712
|
+
#define SQLITE_DBCONFIG_FP_DIGITS 1023 /* int int* */
|
|
2713
|
+
#define SQLITE_DBCONFIG_MAX 1023 /* Largest DBCONFIG */
|
|
2693
2714
|
|
|
2694
2715
|
/*
|
|
2695
2716
|
** CAPI3REF: Enable Or Disable Extended Result Codes
|
|
@@ -4171,6 +4192,7 @@ SQLITE_API void sqlite3_free_filename(sqlite3_filename);
|
|
|
4171
4192
|
** <li> sqlite3_errmsg()
|
|
4172
4193
|
** <li> sqlite3_errmsg16()
|
|
4173
4194
|
** <li> sqlite3_error_offset()
|
|
4195
|
+
** <li> sqlite3_db_handle()
|
|
4174
4196
|
** </ul>
|
|
4175
4197
|
**
|
|
4176
4198
|
** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
|
|
@@ -4217,7 +4239,7 @@ SQLITE_API const char *sqlite3_errstr(int);
|
|
|
4217
4239
|
SQLITE_API int sqlite3_error_offset(sqlite3 *db);
|
|
4218
4240
|
|
|
4219
4241
|
/*
|
|
4220
|
-
** CAPI3REF: Set Error
|
|
4242
|
+
** CAPI3REF: Set Error Code And Message
|
|
4221
4243
|
** METHOD: sqlite3
|
|
4222
4244
|
**
|
|
4223
4245
|
** Set the error code of the database handle passed as the first argument
|
|
@@ -4336,6 +4358,10 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4336
4358
|
** [[SQLITE_LIMIT_EXPR_DEPTH]] ^(<dt>SQLITE_LIMIT_EXPR_DEPTH</dt>
|
|
4337
4359
|
** <dd>The maximum depth of the parse tree on any expression.</dd>)^
|
|
4338
4360
|
**
|
|
4361
|
+
** [[SQLITE_LIMIT_PARSER_DEPTH]] ^(<dt>SQLITE_LIMIT_PARSER_DEPTH</dt>
|
|
4362
|
+
** <dd>The maximum depth of the LALR(1) parser stack used to analyze
|
|
4363
|
+
** input SQL statements.</dd>)^
|
|
4364
|
+
**
|
|
4339
4365
|
** [[SQLITE_LIMIT_COMPOUND_SELECT]] ^(<dt>SQLITE_LIMIT_COMPOUND_SELECT</dt>
|
|
4340
4366
|
** <dd>The maximum number of terms in a compound SELECT statement.</dd>)^
|
|
4341
4367
|
**
|
|
@@ -4380,6 +4406,7 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4380
4406
|
#define SQLITE_LIMIT_VARIABLE_NUMBER 9
|
|
4381
4407
|
#define SQLITE_LIMIT_TRIGGER_DEPTH 10
|
|
4382
4408
|
#define SQLITE_LIMIT_WORKER_THREADS 11
|
|
4409
|
+
#define SQLITE_LIMIT_PARSER_DEPTH 12
|
|
4383
4410
|
|
|
4384
4411
|
/*
|
|
4385
4412
|
** CAPI3REF: Prepare Flags
|
|
@@ -4424,12 +4451,29 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4424
4451
|
** fails, the sqlite3_prepare_v3() call returns the same error indications
|
|
4425
4452
|
** with or without this flag; it just omits the call to [sqlite3_log()] that
|
|
4426
4453
|
** logs the error.
|
|
4454
|
+
**
|
|
4455
|
+
** [[SQLITE_PREPARE_FROM_DDL]] <dt>SQLITE_PREPARE_FROM_DDL</dt>
|
|
4456
|
+
** <dd>The SQLITE_PREPARE_FROM_DDL flag causes the SQL compiler to enforce
|
|
4457
|
+
** security constraints that would otherwise only be enforced when parsing
|
|
4458
|
+
** the database schema. In other words, the SQLITE_PREPARE_FROM_DDL flag
|
|
4459
|
+
** causes the SQL compiler to treat the SQL statement being prepared as if
|
|
4460
|
+
** it had come from an attacker. When SQLITE_PREPARE_FROM_DDL is used and
|
|
4461
|
+
** [SQLITE_DBCONFIG_TRUSTED_SCHEMA] is off, SQL functions may only be called
|
|
4462
|
+
** if they are tagged with [SQLITE_INNOCUOUS] and virtual tables may only
|
|
4463
|
+
** be used if they are tagged with [SQLITE_VTAB_INNOCUOUS]. Best practice
|
|
4464
|
+
** is to use the SQLITE_PREPARE_FROM_DDL option when preparing any SQL that
|
|
4465
|
+
** is derived from parts of the database schema. In particular, virtual
|
|
4466
|
+
** table implementations that run SQL statements that are derived from
|
|
4467
|
+
** arguments to their CREATE VIRTUAL TABLE statement should always use
|
|
4468
|
+
** [sqlite3_prepare_v3()] and set the SQLITE_PREPARE_FROM_DDL flag to
|
|
4469
|
+
** prevent bypass of the [SQLITE_DBCONFIG_TRUSTED_SCHEMA] security checks.
|
|
4427
4470
|
** </dl>
|
|
4428
4471
|
*/
|
|
4429
4472
|
#define SQLITE_PREPARE_PERSISTENT 0x01
|
|
4430
4473
|
#define SQLITE_PREPARE_NORMALIZE 0x02
|
|
4431
4474
|
#define SQLITE_PREPARE_NO_VTAB 0x04
|
|
4432
4475
|
#define SQLITE_PREPARE_DONT_LOG 0x10
|
|
4476
|
+
#define SQLITE_PREPARE_FROM_DDL 0x20
|
|
4433
4477
|
|
|
4434
4478
|
/*
|
|
4435
4479
|
** CAPI3REF: Compiling An SQL Statement
|
|
@@ -4443,8 +4487,9 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4443
4487
|
**
|
|
4444
4488
|
** The preferred routine to use is [sqlite3_prepare_v2()]. The
|
|
4445
4489
|
** [sqlite3_prepare()] interface is legacy and should be avoided.
|
|
4446
|
-
** [sqlite3_prepare_v3()] has an extra
|
|
4447
|
-
**
|
|
4490
|
+
** [sqlite3_prepare_v3()] has an extra
|
|
4491
|
+
** [SQLITE_PREPARE_FROM_DDL|"prepFlags" option] that is some times
|
|
4492
|
+
** needed for special purpose or to pass along security restrictions.
|
|
4448
4493
|
**
|
|
4449
4494
|
** The use of the UTF-8 interfaces is preferred, as SQLite currently
|
|
4450
4495
|
** does all parsing using UTF-8. The UTF-16 interfaces are provided
|
|
@@ -4849,8 +4894,8 @@ typedef struct sqlite3_context sqlite3_context;
|
|
|
4849
4894
|
** it should be a pointer to well-formed UTF16 text.
|
|
4850
4895
|
** ^If the third parameter to sqlite3_bind_text64() is not NULL, then
|
|
4851
4896
|
** it should be a pointer to a well-formed unicode string that is
|
|
4852
|
-
** either UTF8 if the sixth parameter is SQLITE_UTF8
|
|
4853
|
-
** otherwise.
|
|
4897
|
+
** either UTF8 if the sixth parameter is SQLITE_UTF8 or SQLITE_UTF8_ZT,
|
|
4898
|
+
** or UTF16 otherwise.
|
|
4854
4899
|
**
|
|
4855
4900
|
** [[byte-order determination rules]] ^The byte-order of
|
|
4856
4901
|
** UTF16 input text is determined by the byte-order mark (BOM, U+FEFF)
|
|
@@ -4896,10 +4941,15 @@ typedef struct sqlite3_context sqlite3_context;
|
|
|
4896
4941
|
** object and pointer to it must remain valid until then. ^SQLite will then
|
|
4897
4942
|
** manage the lifetime of its private copy.
|
|
4898
4943
|
**
|
|
4899
|
-
** ^The sixth argument
|
|
4900
|
-
**
|
|
4901
|
-
**
|
|
4902
|
-
**
|
|
4944
|
+
** ^The sixth argument (the E argument)
|
|
4945
|
+
** to sqlite3_bind_text64(S,K,Z,N,D,E) must be one of
|
|
4946
|
+
** [SQLITE_UTF8], [SQLITE_UTF8_ZT], [SQLITE_UTF16], [SQLITE_UTF16BE],
|
|
4947
|
+
** or [SQLITE_UTF16LE] to specify the encoding of the text in the
|
|
4948
|
+
** third parameter, Z. The special value [SQLITE_UTF8_ZT] means that the
|
|
4949
|
+
** string argument is both UTF-8 encoded and is zero-terminated. In other
|
|
4950
|
+
** words, SQLITE_UTF8_ZT means that the Z array is allocated to hold at
|
|
4951
|
+
** least N+1 bytes and that the Z[N] byte is zero. If
|
|
4952
|
+
** the E argument to sqlite3_bind_text64(S,K,Z,N,D,E) is not one of the
|
|
4903
4953
|
** allowed values shown above, or if the text encoding is different
|
|
4904
4954
|
** from the encoding specified by the sixth parameter, then the behavior
|
|
4905
4955
|
** is undefined.
|
|
@@ -5766,6 +5816,51 @@ SQLITE_API int sqlite3_create_window_function(
|
|
|
5766
5816
|
**
|
|
5767
5817
|
** These constants define integer codes that represent the various
|
|
5768
5818
|
** text encodings supported by SQLite.
|
|
5819
|
+
**
|
|
5820
|
+
** <dl>
|
|
5821
|
+
** [[SQLITE_UTF8]] <dt>SQLITE_UTF8</dt><dd>Text is encoding as UTF-8</dd>
|
|
5822
|
+
**
|
|
5823
|
+
** [[SQLITE_UTF16LE]] <dt>SQLITE_UTF16LE</dt><dd>Text is encoding as UTF-16
|
|
5824
|
+
** with each code point being expressed "little endian" - the least significant
|
|
5825
|
+
** byte first. This is the usual encoding, for example on Windows.</dd>
|
|
5826
|
+
**
|
|
5827
|
+
** [[SQLITE_UTF16BE]] <dt>SQLITE_UTF16BE</dt><dd>Text is encoding as UTF-16
|
|
5828
|
+
** with each code point being expressed "big endian" - the most significant
|
|
5829
|
+
** byte first. This encoding is less common, but is still sometimes seen,
|
|
5830
|
+
** specially on older systems.
|
|
5831
|
+
**
|
|
5832
|
+
** [[SQLITE_UTF16]] <dt>SQLITE_UTF16</dt><dd>Text is encoding as UTF-16
|
|
5833
|
+
** with each code point being expressed either little endian or as big
|
|
5834
|
+
** endian, according to the native endianness of the host computer.
|
|
5835
|
+
**
|
|
5836
|
+
** [[SQLITE_ANY]] <dt>SQLITE_ANY</dt><dd>This encoding value may only be used
|
|
5837
|
+
** to declare the preferred text for [application-defined SQL functions]
|
|
5838
|
+
** created using [sqlite3_create_function()] and similar. If the preferred
|
|
5839
|
+
** encoding (the 4th parameter to sqlite3_create_function() - the eTextRep
|
|
5840
|
+
** parameter) is SQLITE_ANY, that indicates that the function does not have
|
|
5841
|
+
** a preference regarding the text encoding of its parameters and can take
|
|
5842
|
+
** any text encoding that the SQLite core find convenient to supply. This
|
|
5843
|
+
** option is deprecated. Please do not use it in new applications.
|
|
5844
|
+
**
|
|
5845
|
+
** [[SQLITE_UTF16_ALIGNED]] <dt>SQLITE_UTF16_ALIGNED</dt><dd>This encoding
|
|
5846
|
+
** value may be used as the 3rd parameter (the eTextRep parameter) to
|
|
5847
|
+
** [sqlite3_create_collation()] and similar. This encoding value means
|
|
5848
|
+
** that the application-defined collating sequence created expects its
|
|
5849
|
+
** input strings to be in UTF16 in native byte order, and that the start
|
|
5850
|
+
** of the strings must be aligned to a 2-byte boundary.
|
|
5851
|
+
**
|
|
5852
|
+
** [[SQLITE_UTF8_ZT]] <dt>SQLITE_UTF8_ZT</dt><dd>This option can only be
|
|
5853
|
+
** used to specify the text encoding to strings input to [sqlite3_result_text64()]
|
|
5854
|
+
** and [sqlite3_bind_text64()]. It means that the input string (call it "z")
|
|
5855
|
+
** is UTF-8 encoded and that it is zero-terminated. If the length parameter
|
|
5856
|
+
** (call it "n") is non-negative, this encoding option means that the caller
|
|
5857
|
+
** guarantees that z array contains at least n+1 bytes and that the z[n]
|
|
5858
|
+
** byte has a value of zero.
|
|
5859
|
+
** This option gives the same output as SQLITE_UTF8, but can be more efficient
|
|
5860
|
+
** by avoiding the need to make a copy of the input string, in some cases.
|
|
5861
|
+
** However, if z is allocated to hold fewer than n+1 bytes or if the
|
|
5862
|
+
** z[n] byte is not zero, undefined behavior may result.
|
|
5863
|
+
** </dl>
|
|
5769
5864
|
*/
|
|
5770
5865
|
#define SQLITE_UTF8 1 /* IMP: R-37514-35566 */
|
|
5771
5866
|
#define SQLITE_UTF16LE 2 /* IMP: R-03371-37637 */
|
|
@@ -5773,6 +5868,7 @@ SQLITE_API int sqlite3_create_window_function(
|
|
|
5773
5868
|
#define SQLITE_UTF16 4 /* Use native byte order */
|
|
5774
5869
|
#define SQLITE_ANY 5 /* Deprecated */
|
|
5775
5870
|
#define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */
|
|
5871
|
+
#define SQLITE_UTF8_ZT 16 /* Zero-terminated UTF8 */
|
|
5776
5872
|
|
|
5777
5873
|
/*
|
|
5778
5874
|
** CAPI3REF: Function Flags
|
|
@@ -6278,10 +6374,14 @@ SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(voi
|
|
|
6278
6374
|
**
|
|
6279
6375
|
** There is no limit (other than available memory) on the number of different
|
|
6280
6376
|
** client data pointers (with different names) that can be attached to a
|
|
6281
|
-
** single database connection. However, the implementation
|
|
6282
|
-
**
|
|
6283
|
-
**
|
|
6284
|
-
**
|
|
6377
|
+
** single database connection. However, the current implementation stores
|
|
6378
|
+
** the content on a linked list. Insert and retrieval performance will
|
|
6379
|
+
** be proportional to the number of entries. The design use case, and
|
|
6380
|
+
** the use case for which the implementation is optimized, is
|
|
6381
|
+
** that an application will store only small number of client data names,
|
|
6382
|
+
** typically just one or two. This interface is not intended to be a
|
|
6383
|
+
** generalized key/value store for thousands or millions of keys. It
|
|
6384
|
+
** will work for that, but performance might be disappointing.
|
|
6285
6385
|
**
|
|
6286
6386
|
** There is no way to enumerate the client data pointers
|
|
6287
6387
|
** associated with a database connection. The N parameter can be thought
|
|
@@ -6389,10 +6489,14 @@ typedef void (*sqlite3_destructor_type)(void*);
|
|
|
6389
6489
|
** set the return value of the application-defined function to be
|
|
6390
6490
|
** a text string which is represented as UTF-8, UTF-16 native byte order,
|
|
6391
6491
|
** UTF-16 little endian, or UTF-16 big endian, respectively.
|
|
6392
|
-
** ^The sqlite3_result_text64() interface sets the return value of an
|
|
6492
|
+
** ^The sqlite3_result_text64(C,Z,N,D,E) interface sets the return value of an
|
|
6393
6493
|
** application-defined function to be a text string in an encoding
|
|
6394
|
-
** specified
|
|
6395
|
-
** of [SQLITE_UTF8], [
|
|
6494
|
+
** specified the E parameter, which must be one
|
|
6495
|
+
** of [SQLITE_UTF8], [SQLITE_UTF8_ZT], [SQLITE_UTF16], [SQLITE_UTF16BE],
|
|
6496
|
+
** or [SQLITE_UTF16LE]. ^The special value [SQLITE_UTF8_ZT] means that
|
|
6497
|
+
** the result text is both UTF-8 and zero-terminated. In other words,
|
|
6498
|
+
** SQLITE_UTF8_ZT means that the Z array holds at least N+1 byes and that
|
|
6499
|
+
** the Z[N] is zero.
|
|
6396
6500
|
** ^SQLite takes the text result from the application from
|
|
6397
6501
|
** the 2nd parameter of the sqlite3_result_text* interfaces.
|
|
6398
6502
|
** ^If the 3rd parameter to any of the sqlite3_result_text* interfaces
|
|
@@ -6479,7 +6583,7 @@ SQLITE_API void sqlite3_result_int(sqlite3_context*, int);
|
|
|
6479
6583
|
SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
|
|
6480
6584
|
SQLITE_API void sqlite3_result_null(sqlite3_context*);
|
|
6481
6585
|
SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
|
|
6482
|
-
SQLITE_API void sqlite3_result_text64(sqlite3_context*, const char
|
|
6586
|
+
SQLITE_API void sqlite3_result_text64(sqlite3_context*, const char *z, sqlite3_uint64 n,
|
|
6483
6587
|
void(*)(void*), unsigned char encoding);
|
|
6484
6588
|
SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
|
|
6485
6589
|
SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
|
|
@@ -7418,7 +7522,7 @@ SQLITE_API int sqlite3_table_column_metadata(
|
|
|
7418
7522
|
** ^The sqlite3_load_extension() interface attempts to load an
|
|
7419
7523
|
** [SQLite extension] library contained in the file zFile. If
|
|
7420
7524
|
** the file cannot be loaded directly, attempts are made to load
|
|
7421
|
-
** with various operating-system specific extensions added.
|
|
7525
|
+
** with various operating-system specific filename extensions added.
|
|
7422
7526
|
** So for example, if "samplelib" cannot be loaded, then names like
|
|
7423
7527
|
** "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might
|
|
7424
7528
|
** be tried also.
|
|
@@ -7426,10 +7530,10 @@ SQLITE_API int sqlite3_table_column_metadata(
|
|
|
7426
7530
|
** ^The entry point is zProc.
|
|
7427
7531
|
** ^(zProc may be 0, in which case SQLite will try to come up with an
|
|
7428
7532
|
** entry point name on its own. It first tries "sqlite3_extension_init".
|
|
7429
|
-
** If that does not work, it
|
|
7430
|
-
** X consists of the lower-case equivalent of all ASCII alphabetic
|
|
7431
|
-
** characters
|
|
7432
|
-
** "." and omitting any initial "lib".)^
|
|
7533
|
+
** If that does not work, it tries names of the form "sqlite3_X_init"
|
|
7534
|
+
** where X consists of the lower-case equivalent of all ASCII alphabetic
|
|
7535
|
+
** characters or all ASCII alphanumeric characters in the filename from
|
|
7536
|
+
** the last "/" to the first following "." and omitting any initial "lib".)^
|
|
7433
7537
|
** ^The sqlite3_load_extension() interface returns
|
|
7434
7538
|
** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
|
|
7435
7539
|
** ^If an error occurs and pzErrMsg is not 0, then the
|
|
@@ -8722,17 +8826,22 @@ SQLITE_API sqlite3_str *sqlite3_str_new(sqlite3*);
|
|
|
8722
8826
|
** pass the returned value to [sqlite3_free()] to avoid a memory leak.
|
|
8723
8827
|
** ^The [sqlite3_str_finish(X)] interface may return a NULL pointer if any
|
|
8724
8828
|
** errors were encountered during construction of the string. ^The
|
|
8725
|
-
** [sqlite3_str_finish(X)] interface
|
|
8829
|
+
** [sqlite3_str_finish(X)] interface might also return a NULL pointer if the
|
|
8726
8830
|
** string in [sqlite3_str] object X is zero bytes long.
|
|
8831
|
+
**
|
|
8832
|
+
** ^The [sqlite3_str_free(X)] interface destroys both the sqlite3_str object
|
|
8833
|
+
** X and the string content it contains. Calling sqlite3_str_free(X) is
|
|
8834
|
+
** the equivalent of calling [sqlite3_free](sqlite3_str_finish(X)).
|
|
8727
8835
|
*/
|
|
8728
8836
|
SQLITE_API char *sqlite3_str_finish(sqlite3_str*);
|
|
8837
|
+
SQLITE_API void sqlite3_str_free(sqlite3_str*);
|
|
8729
8838
|
|
|
8730
8839
|
/*
|
|
8731
8840
|
** CAPI3REF: Add Content To A Dynamic String
|
|
8732
8841
|
** METHOD: sqlite3_str
|
|
8733
8842
|
**
|
|
8734
|
-
** These interfaces add content to an sqlite3_str object
|
|
8735
|
-
** from [sqlite3_str_new()].
|
|
8843
|
+
** These interfaces add or remove content to an sqlite3_str object
|
|
8844
|
+
** previously obtained from [sqlite3_str_new()].
|
|
8736
8845
|
**
|
|
8737
8846
|
** ^The [sqlite3_str_appendf(X,F,...)] and
|
|
8738
8847
|
** [sqlite3_str_vappendf(X,F,V)] interfaces uses the [built-in printf]
|
|
@@ -8755,6 +8864,10 @@ SQLITE_API char *sqlite3_str_finish(sqlite3_str*);
|
|
|
8755
8864
|
** ^The [sqlite3_str_reset(X)] method resets the string under construction
|
|
8756
8865
|
** inside [sqlite3_str] object X back to zero bytes in length.
|
|
8757
8866
|
**
|
|
8867
|
+
** ^The [sqlite3_str_truncate(X,N)] method changes the length of the string
|
|
8868
|
+
** under construction to be N bytes are less. This routine is a no-op if
|
|
8869
|
+
** N is negative or if the string is already N bytes or smaller in size.
|
|
8870
|
+
**
|
|
8758
8871
|
** These methods do not return a result code. ^If an error occurs, that fact
|
|
8759
8872
|
** is recorded in the [sqlite3_str] object and can be recovered by a
|
|
8760
8873
|
** subsequent call to [sqlite3_str_errcode(X)].
|
|
@@ -8765,6 +8878,7 @@ SQLITE_API void sqlite3_str_append(sqlite3_str*, const char *zIn, int N);
|
|
|
8765
8878
|
SQLITE_API void sqlite3_str_appendall(sqlite3_str*, const char *zIn);
|
|
8766
8879
|
SQLITE_API void sqlite3_str_appendchar(sqlite3_str*, int N, char C);
|
|
8767
8880
|
SQLITE_API void sqlite3_str_reset(sqlite3_str*);
|
|
8881
|
+
SQLITE_API void sqlite3_str_truncate(sqlite3_str*,int N);
|
|
8768
8882
|
|
|
8769
8883
|
/*
|
|
8770
8884
|
** CAPI3REF: Status Of A Dynamic String
|
|
@@ -10598,9 +10712,9 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
|
|
|
10598
10712
|
** a variable pointed to by the "pOut" parameter.
|
|
10599
10713
|
**
|
|
10600
10714
|
** The "flags" parameter must be passed a mask of flags. At present only
|
|
10601
|
-
** one flag is defined - SQLITE_SCANSTAT_COMPLEX. If SQLITE_SCANSTAT_COMPLEX
|
|
10715
|
+
** one flag is defined - [SQLITE_SCANSTAT_COMPLEX]. If SQLITE_SCANSTAT_COMPLEX
|
|
10602
10716
|
** is specified, then status information is available for all elements
|
|
10603
|
-
** of a query plan that are reported by "EXPLAIN QUERY PLAN" output. If
|
|
10717
|
+
** of a query plan that are reported by "[EXPLAIN QUERY PLAN]" output. If
|
|
10604
10718
|
** SQLITE_SCANSTAT_COMPLEX is not specified, then only query plan elements
|
|
10605
10719
|
** that correspond to query loops (the "SCAN..." and "SEARCH..." elements of
|
|
10606
10720
|
** the EXPLAIN QUERY PLAN output) are available. Invoking API
|
|
@@ -10614,7 +10728,8 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
|
|
|
10614
10728
|
** elements used to implement the statement - a non-zero value is returned and
|
|
10615
10729
|
** the variable that pOut points to is unchanged.
|
|
10616
10730
|
**
|
|
10617
|
-
** See also: [sqlite3_stmt_scanstatus_reset()]
|
|
10731
|
+
** See also: [sqlite3_stmt_scanstatus_reset()] and the
|
|
10732
|
+
** [nexec and ncycle] columnes of the [bytecode virtual table].
|
|
10618
10733
|
*/
|
|
10619
10734
|
SQLITE_API int sqlite3_stmt_scanstatus(
|
|
10620
10735
|
sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
|
|
@@ -11156,19 +11271,41 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
11156
11271
|
/*
|
|
11157
11272
|
** CAPI3REF: Bind array values to the CARRAY table-valued function
|
|
11158
11273
|
**
|
|
11159
|
-
** The
|
|
11160
|
-
**
|
|
11161
|
-
** S parameter is a pointer to the [prepared statement] that uses the carray()
|
|
11162
|
-
** functions. I is the parameter index to be bound.
|
|
11163
|
-
**
|
|
11164
|
-
**
|
|
11165
|
-
**
|
|
11166
|
-
**
|
|
11167
|
-
**
|
|
11168
|
-
**
|
|
11169
|
-
**
|
|
11170
|
-
** SQLITE_TRANSIENT
|
|
11171
|
-
|
|
11274
|
+
** The sqlite3_carray_bind_v2(S,I,P,N,F,X,D) interface binds an array value to
|
|
11275
|
+
** parameter that is the first argument of the [carray() table-valued function].
|
|
11276
|
+
** The S parameter is a pointer to the [prepared statement] that uses the carray()
|
|
11277
|
+
** functions. I is the parameter index to be bound. I must be the index of the
|
|
11278
|
+
** parameter that is the first argument to the carray() table-valued function.
|
|
11279
|
+
** P is a pointer to the array to be bound, and N is the number of elements in
|
|
11280
|
+
** the array. The F argument is one of constants [SQLITE_CARRAY_INT32],
|
|
11281
|
+
** [SQLITE_CARRAY_INT64], [SQLITE_CARRAY_DOUBLE], [SQLITE_CARRAY_TEXT],
|
|
11282
|
+
** or [SQLITE_CARRAY_BLOB] to indicate the datatype of the array P.
|
|
11283
|
+
**
|
|
11284
|
+
** If the X argument is not a NULL pointer or one of the special
|
|
11285
|
+
** values [SQLITE_STATIC] or [SQLITE_TRANSIENT], then SQLite will invoke
|
|
11286
|
+
** the function X with argument D when it is finished using the data in P.
|
|
11287
|
+
** The call to X(D) is a destructor for the array P. The destructor X(D)
|
|
11288
|
+
** is invoked even if the call to sqlite3_carray_bind() fails. If the X
|
|
11289
|
+
** parameter is the special-case value [SQLITE_STATIC], then SQLite assumes
|
|
11290
|
+
** that the data static and the destructor is never invoked. If the X
|
|
11291
|
+
** parameter is the special-case value [SQLITE_TRANSIENT], then
|
|
11292
|
+
** sqlite3_carray_bind_v2() makes its own private copy of the data prior
|
|
11293
|
+
** to returning and never invokes the destructor X.
|
|
11294
|
+
**
|
|
11295
|
+
** The sqlite3_carray_bind() function works the same as sqlite_carray_bind_v2()
|
|
11296
|
+
** with a D parameter set to P. In other words,
|
|
11297
|
+
** sqlite3_carray_bind(S,I,P,N,F,X) is same as
|
|
11298
|
+
** sqlite3_carray_bind(S,I,P,N,F,X,P).
|
|
11299
|
+
*/
|
|
11300
|
+
SQLITE_API int sqlite3_carray_bind_v2(
|
|
11301
|
+
sqlite3_stmt *pStmt, /* Statement to be bound */
|
|
11302
|
+
int i, /* Parameter index */
|
|
11303
|
+
void *aData, /* Pointer to array data */
|
|
11304
|
+
int nData, /* Number of data elements */
|
|
11305
|
+
int mFlags, /* CARRAY flags */
|
|
11306
|
+
void (*xDel)(void*), /* Destructor for aData */
|
|
11307
|
+
void *pDel /* Optional argument to xDel() */
|
|
11308
|
+
);
|
|
11172
11309
|
SQLITE_API int sqlite3_carray_bind(
|
|
11173
11310
|
sqlite3_stmt *pStmt, /* Statement to be bound */
|
|
11174
11311
|
int i, /* Parameter index */
|
|
@@ -371,7 +371,11 @@ struct sqlite3_api_routines {
|
|
|
371
371
|
/* Version 3.51.0 and later */
|
|
372
372
|
int (*set_errmsg)(sqlite3*,int,const char*);
|
|
373
373
|
int (*db_status64)(sqlite3*,int,sqlite3_int64*,sqlite3_int64*,int);
|
|
374
|
-
|
|
374
|
+
/* Version 3.52.0 and later */
|
|
375
|
+
void (*str_truncate)(sqlite3_str*,int);
|
|
376
|
+
void (*str_free)(sqlite3_str*);
|
|
377
|
+
int (*carray_bind)(sqlite3_stmt*,int,void*,int,int,void(*)(void*));
|
|
378
|
+
int (*carray_bind_v2)(sqlite3_stmt*,int,void*,int,int,void(*)(void*),void*);
|
|
375
379
|
};
|
|
376
380
|
|
|
377
381
|
/*
|
|
@@ -710,6 +714,11 @@ typedef int (*sqlite3_loadext_entry)(
|
|
|
710
714
|
/* Version 3.51.0 and later */
|
|
711
715
|
#define sqlite3_set_errmsg sqlite3_api->set_errmsg
|
|
712
716
|
#define sqlite3_db_status64 sqlite3_api->db_status64
|
|
717
|
+
/* Version 3.52.0 and later */
|
|
718
|
+
#define sqlite3_str_truncate sqlite3_api->str_truncate
|
|
719
|
+
#define sqlite3_str_free sqlite3_api->str_free
|
|
720
|
+
#define sqlite3_carray_bind sqlite3_api->carray_bind
|
|
721
|
+
#define sqlite3_carray_bind_v2 sqlite3_api->carray_bind_v2
|
|
713
722
|
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
|
|
714
723
|
|
|
715
724
|
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
|