better-sqlite3-multiple-ciphers 12.2.0 → 12.4.1
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/README.md +4 -4
- package/deps/sqlite3/sqlite3.c +6722 -6519
- package/deps/sqlite3/sqlite3.h +47 -47
- package/deps/update-sqlite3mc.sh +2 -2
- package/lib/database.js +1 -1
- package/package.json +3 -6
- package/src/addon.cpp +47 -0
- package/src/better_sqlite3.cpp +44 -2208
- package/src/objects/backup.cpp +120 -0
- package/src/objects/backup.hpp +36 -0
- package/src/objects/database.cpp +457 -0
- package/src/objects/database.hpp +105 -0
- package/src/objects/statement-iterator.cpp +113 -0
- package/src/objects/statement-iterator.hpp +50 -0
- package/src/objects/statement.cpp +383 -0
- package/src/objects/statement.hpp +58 -0
- package/src/util/bind-map.cpp +73 -0
- package/src/util/binder.cpp +193 -0
- package/src/util/constants.cpp +172 -0
- package/src/util/custom-aggregate.cpp +121 -0
- package/src/util/custom-function.cpp +59 -0
- package/src/util/custom-table.cpp +409 -0
- package/src/util/data-converter.cpp +17 -0
- package/src/util/data.cpp +194 -0
- package/src/util/helpers.cpp +109 -0
- package/src/util/macros.cpp +63 -0
- package/src/util/query-macros.cpp +71 -0
- package/src/util/row-builder.cpp +49 -0
- package/src/better_sqlite3.hpp +0 -1040
package/deps/sqlite3/sqlite3.h
CHANGED
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
|
|
32
32
|
#define SQLITE3MC_VERSION_MAJOR 2
|
|
33
33
|
#define SQLITE3MC_VERSION_MINOR 2
|
|
34
|
-
#define SQLITE3MC_VERSION_RELEASE
|
|
34
|
+
#define SQLITE3MC_VERSION_RELEASE 4
|
|
35
35
|
#define SQLITE3MC_VERSION_SUBRELEASE 0
|
|
36
|
-
#define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 2.2.
|
|
36
|
+
#define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 2.2.4"
|
|
37
37
|
|
|
38
38
|
#endif /* SQLITE3MC_VERSION_H_ */
|
|
39
39
|
/*** End of #include "sqlite3mc_version.h" ***/
|
|
@@ -192,9 +192,9 @@ extern "C" {
|
|
|
192
192
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
|
193
193
|
** [sqlite_version()] and [sqlite_source_id()].
|
|
194
194
|
*/
|
|
195
|
-
#define SQLITE_VERSION "3.50.
|
|
196
|
-
#define SQLITE_VERSION_NUMBER
|
|
197
|
-
#define SQLITE_SOURCE_ID "2025-
|
|
195
|
+
#define SQLITE_VERSION "3.50.4"
|
|
196
|
+
#define SQLITE_VERSION_NUMBER 3050004
|
|
197
|
+
#define SQLITE_SOURCE_ID "2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45e20a3"
|
|
198
198
|
|
|
199
199
|
/*
|
|
200
200
|
** CAPI3REF: Run-Time Library Version Numbers
|
|
@@ -9104,13 +9104,13 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
|
|
|
9104
9104
|
** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>
|
|
9105
9105
|
** <dd>^This is the number of sort operations that have occurred.
|
|
9106
9106
|
** A non-zero value in this counter may indicate an opportunity to
|
|
9107
|
-
**
|
|
9107
|
+
** improve performance through careful use of indices.</dd>
|
|
9108
9108
|
**
|
|
9109
9109
|
** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>
|
|
9110
9110
|
** <dd>^This is the number of rows inserted into transient indices that
|
|
9111
9111
|
** were created automatically in order to help joins run faster.
|
|
9112
9112
|
** A non-zero value in this counter may indicate an opportunity to
|
|
9113
|
-
**
|
|
9113
|
+
** improve performance by adding permanent indices that do not
|
|
9114
9114
|
** need to be reinitialized each time the statement is run.</dd>
|
|
9115
9115
|
**
|
|
9116
9116
|
** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>
|
|
@@ -9119,19 +9119,19 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
|
|
|
9119
9119
|
** to 2147483647. The number of virtual machine operations can be
|
|
9120
9120
|
** used as a proxy for the total work done by the prepared statement.
|
|
9121
9121
|
** If the number of virtual machine operations exceeds 2147483647
|
|
9122
|
-
** then the value returned by this statement status code is undefined
|
|
9122
|
+
** then the value returned by this statement status code is undefined.</dd>
|
|
9123
9123
|
**
|
|
9124
9124
|
** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
|
|
9125
9125
|
** <dd>^This is the number of times that the prepare statement has been
|
|
9126
9126
|
** automatically regenerated due to schema changes or changes to
|
|
9127
|
-
** [bound parameters] that might affect the query plan
|
|
9127
|
+
** [bound parameters] that might affect the query plan.</dd>
|
|
9128
9128
|
**
|
|
9129
9129
|
** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
|
|
9130
9130
|
** <dd>^This is the number of times that the prepared statement has
|
|
9131
9131
|
** been run. A single "run" for the purposes of this counter is one
|
|
9132
9132
|
** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
|
|
9133
9133
|
** The counter is incremented on the first [sqlite3_step()] call of each
|
|
9134
|
-
** cycle
|
|
9134
|
+
** cycle.</dd>
|
|
9135
9135
|
**
|
|
9136
9136
|
** [[SQLITE_STMTSTATUS_FILTER_MISS]]
|
|
9137
9137
|
** [[SQLITE_STMTSTATUS_FILTER HIT]]
|
|
@@ -9141,7 +9141,7 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
|
|
|
9141
9141
|
** step was bypassed because a Bloom filter returned not-found. The
|
|
9142
9142
|
** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
|
|
9143
9143
|
** times that the Bloom filter returned a find, and thus the join step
|
|
9144
|
-
** had to be processed as normal
|
|
9144
|
+
** had to be processed as normal.</dd>
|
|
9145
9145
|
**
|
|
9146
9146
|
** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
|
|
9147
9147
|
** <dd>^This is the approximate number of bytes of heap memory
|
|
@@ -9246,9 +9246,9 @@ struct sqlite3_pcache_page {
|
|
|
9246
9246
|
** SQLite will typically create one cache instance for each open database file,
|
|
9247
9247
|
** though this is not guaranteed. ^The
|
|
9248
9248
|
** first parameter, szPage, is the size in bytes of the pages that must
|
|
9249
|
-
** be allocated by the cache. ^szPage will always a power of two. ^The
|
|
9249
|
+
** be allocated by the cache. ^szPage will always be a power of two. ^The
|
|
9250
9250
|
** second parameter szExtra is a number of bytes of extra storage
|
|
9251
|
-
** associated with each page cache entry. ^The szExtra parameter will
|
|
9251
|
+
** associated with each page cache entry. ^The szExtra parameter will be
|
|
9252
9252
|
** a number less than 250. SQLite will use the
|
|
9253
9253
|
** extra szExtra bytes on each page to store metadata about the underlying
|
|
9254
9254
|
** database page on disk. The value passed into szExtra depends
|
|
@@ -9256,17 +9256,17 @@ struct sqlite3_pcache_page {
|
|
|
9256
9256
|
** ^The third argument to xCreate(), bPurgeable, is true if the cache being
|
|
9257
9257
|
** created will be used to cache database pages of a file stored on disk, or
|
|
9258
9258
|
** false if it is used for an in-memory database. The cache implementation
|
|
9259
|
-
** does not have to do anything special based
|
|
9259
|
+
** does not have to do anything special based upon the value of bPurgeable;
|
|
9260
9260
|
** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
|
|
9261
9261
|
** never invoke xUnpin() except to deliberately delete a page.
|
|
9262
9262
|
** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
|
|
9263
9263
|
** false will always have the "discard" flag set to true.
|
|
9264
|
-
** ^Hence, a cache created with bPurgeable false will
|
|
9264
|
+
** ^Hence, a cache created with bPurgeable set to false will
|
|
9265
9265
|
** never contain any unpinned pages.
|
|
9266
9266
|
**
|
|
9267
9267
|
** [[the xCachesize() page cache method]]
|
|
9268
9268
|
** ^(The xCachesize() method may be called at any time by SQLite to set the
|
|
9269
|
-
** suggested maximum cache-size (number of pages stored
|
|
9269
|
+
** suggested maximum cache-size (number of pages stored) for the cache
|
|
9270
9270
|
** instance passed as the first argument. This is the value configured using
|
|
9271
9271
|
** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable
|
|
9272
9272
|
** parameter, the implementation is not required to do anything with this
|
|
@@ -9293,12 +9293,12 @@ struct sqlite3_pcache_page {
|
|
|
9293
9293
|
** implementation must return a pointer to the page buffer with its content
|
|
9294
9294
|
** intact. If the requested page is not already in the cache, then the
|
|
9295
9295
|
** cache implementation should use the value of the createFlag
|
|
9296
|
-
** parameter to help it
|
|
9296
|
+
** parameter to help it determine what action to take:
|
|
9297
9297
|
**
|
|
9298
9298
|
** <table border=1 width=85% align=center>
|
|
9299
9299
|
** <tr><th> createFlag <th> Behavior when page is not already in cache
|
|
9300
9300
|
** <tr><td> 0 <td> Do not allocate a new page. Return NULL.
|
|
9301
|
-
** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
|
|
9301
|
+
** <tr><td> 1 <td> Allocate a new page if it is easy and convenient to do so.
|
|
9302
9302
|
** Otherwise return NULL.
|
|
9303
9303
|
** <tr><td> 2 <td> Make every effort to allocate a new page. Only return
|
|
9304
9304
|
** NULL if allocating a new page is effectively impossible.
|
|
@@ -9315,7 +9315,7 @@ struct sqlite3_pcache_page {
|
|
|
9315
9315
|
** as its second argument. If the third parameter, discard, is non-zero,
|
|
9316
9316
|
** then the page must be evicted from the cache.
|
|
9317
9317
|
** ^If the discard parameter is
|
|
9318
|
-
** zero, then the page may be discarded or retained at the discretion of
|
|
9318
|
+
** zero, then the page may be discarded or retained at the discretion of the
|
|
9319
9319
|
** page cache implementation. ^The page cache implementation
|
|
9320
9320
|
** may choose to evict unpinned pages at any time.
|
|
9321
9321
|
**
|
|
@@ -9333,7 +9333,7 @@ struct sqlite3_pcache_page {
|
|
|
9333
9333
|
** When SQLite calls the xTruncate() method, the cache must discard all
|
|
9334
9334
|
** existing cache entries with page numbers (keys) greater than or equal
|
|
9335
9335
|
** to the value of the iLimit parameter passed to xTruncate(). If any
|
|
9336
|
-
** of these pages are pinned, they
|
|
9336
|
+
** of these pages are pinned, they become implicitly unpinned, meaning that
|
|
9337
9337
|
** they can be safely discarded.
|
|
9338
9338
|
**
|
|
9339
9339
|
** [[the xDestroy() page cache method]]
|
|
@@ -9632,7 +9632,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
|
|
|
9632
9632
|
** application receives an SQLITE_LOCKED error, it may call the
|
|
9633
9633
|
** sqlite3_unlock_notify() method with the blocked connection handle as
|
|
9634
9634
|
** the first argument to register for a callback that will be invoked
|
|
9635
|
-
** when the blocking
|
|
9635
|
+
** when the blocking connection's current transaction is concluded. ^The
|
|
9636
9636
|
** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
|
|
9637
9637
|
** call that concludes the blocking connection's transaction.
|
|
9638
9638
|
**
|
|
@@ -9652,7 +9652,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
|
|
|
9652
9652
|
** blocked connection already has a registered unlock-notify callback,
|
|
9653
9653
|
** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
|
|
9654
9654
|
** called with a NULL pointer as its second argument, then any existing
|
|
9655
|
-
** unlock-notify callback is canceled. ^The blocked
|
|
9655
|
+
** unlock-notify callback is canceled. ^The blocked connection's
|
|
9656
9656
|
** unlock-notify callback may also be canceled by closing the blocked
|
|
9657
9657
|
** connection using [sqlite3_close()].
|
|
9658
9658
|
**
|
|
@@ -10050,7 +10050,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
|
|
|
10050
10050
|
** support constraints. In this configuration (which is the default) if
|
|
10051
10051
|
** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
|
|
10052
10052
|
** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
|
|
10053
|
-
** specified as part of the
|
|
10053
|
+
** specified as part of the user's SQL statement, regardless of the actual
|
|
10054
10054
|
** ON CONFLICT mode specified.
|
|
10055
10055
|
**
|
|
10056
10056
|
** If X is non-zero, then the virtual table implementation guarantees
|
|
@@ -10084,7 +10084,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
|
|
|
10084
10084
|
** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
|
|
10085
10085
|
** <dd>Calls of the form
|
|
10086
10086
|
** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
|
|
10087
|
-
**
|
|
10087
|
+
** [xConnect] or [xCreate] methods of a [virtual table] implementation
|
|
10088
10088
|
** identify that virtual table as being safe to use from within triggers
|
|
10089
10089
|
** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
|
|
10090
10090
|
** virtual table can do no serious harm even if it is controlled by a
|
|
@@ -10252,7 +10252,7 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
|
|
|
10252
10252
|
** </table>
|
|
10253
10253
|
**
|
|
10254
10254
|
** ^For the purposes of comparing virtual table output values to see if the
|
|
10255
|
-
** values are same value for sorting purposes, two NULL values are considered
|
|
10255
|
+
** values are the same value for sorting purposes, two NULL values are considered
|
|
10256
10256
|
** to be the same. In other words, the comparison operator is "IS"
|
|
10257
10257
|
** (or "IS NOT DISTINCT FROM") and not "==".
|
|
10258
10258
|
**
|
|
@@ -10262,7 +10262,7 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
|
|
|
10262
10262
|
**
|
|
10263
10263
|
** ^A virtual table implementation is always free to return rows in any order
|
|
10264
10264
|
** it wants, as long as the "orderByConsumed" flag is not set. ^When the
|
|
10265
|
-
**
|
|
10265
|
+
** "orderByConsumed" flag is unset, the query planner will add extra
|
|
10266
10266
|
** [bytecode] to ensure that the final results returned by the SQL query are
|
|
10267
10267
|
** ordered correctly. The use of the "orderByConsumed" flag and the
|
|
10268
10268
|
** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful
|
|
@@ -10359,7 +10359,7 @@ SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
|
|
|
10359
10359
|
** sqlite3_vtab_in_next(X,P) should be one of the parameters to the
|
|
10360
10360
|
** xFilter method which invokes these routines, and specifically
|
|
10361
10361
|
** a parameter that was previously selected for all-at-once IN constraint
|
|
10362
|
-
** processing
|
|
10362
|
+
** processing using the [sqlite3_vtab_in()] interface in the
|
|
10363
10363
|
** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
|
|
10364
10364
|
** an xFilter argument that was selected for all-at-once IN constraint
|
|
10365
10365
|
** processing, then these routines return [SQLITE_ERROR].)^
|
|
@@ -10414,7 +10414,7 @@ SQLITE_API int sqlite3_vtab_in_next(sqlite3_value *pVal, sqlite3_value **ppOut);
|
|
|
10414
10414
|
** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V)
|
|
10415
10415
|
** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
|
|
10416
10416
|
** constraint is not available. ^The sqlite3_vtab_rhs_value() interface
|
|
10417
|
-
** can return
|
|
10417
|
+
** can return a result code other than SQLITE_OK or SQLITE_NOTFOUND if
|
|
10418
10418
|
** something goes wrong.
|
|
10419
10419
|
**
|
|
10420
10420
|
** The sqlite3_vtab_rhs_value() interface is usually only successful if
|
|
@@ -10442,8 +10442,8 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
|
|
|
10442
10442
|
** KEYWORDS: {conflict resolution mode}
|
|
10443
10443
|
**
|
|
10444
10444
|
** These constants are returned by [sqlite3_vtab_on_conflict()] to
|
|
10445
|
-
** inform a [virtual table] implementation
|
|
10446
|
-
**
|
|
10445
|
+
** inform a [virtual table] implementation of the [ON CONFLICT] mode
|
|
10446
|
+
** for the SQL statement being evaluated.
|
|
10447
10447
|
**
|
|
10448
10448
|
** Note that the [SQLITE_IGNORE] constant is also used as a potential
|
|
10449
10449
|
** return value from the [sqlite3_set_authorizer()] callback and that
|
|
@@ -10483,39 +10483,39 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
|
|
|
10483
10483
|
** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
|
|
10484
10484
|
** <dd>^The "double" variable pointed to by the V parameter will be set to the
|
|
10485
10485
|
** query planner's estimate for the average number of rows output from each
|
|
10486
|
-
** iteration of the X-th loop. If the query planner's
|
|
10486
|
+
** iteration of the X-th loop. If the query planner's estimate was accurate,
|
|
10487
10487
|
** then this value will approximate the quotient NVISIT/NLOOP and the
|
|
10488
10488
|
** product of this value for all prior loops with the same SELECTID will
|
|
10489
|
-
** be the NLOOP value for the current loop
|
|
10489
|
+
** be the NLOOP value for the current loop.</dd>
|
|
10490
10490
|
**
|
|
10491
10491
|
** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
|
|
10492
10492
|
** <dd>^The "const char *" variable pointed to by the V parameter will be set
|
|
10493
10493
|
** to a zero-terminated UTF-8 string containing the name of the index or table
|
|
10494
|
-
** used for the X-th loop
|
|
10494
|
+
** used for the X-th loop.</dd>
|
|
10495
10495
|
**
|
|
10496
10496
|
** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
|
|
10497
10497
|
** <dd>^The "const char *" variable pointed to by the V parameter will be set
|
|
10498
10498
|
** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
|
|
10499
|
-
** description for the X-th loop
|
|
10499
|
+
** description for the X-th loop.</dd>
|
|
10500
10500
|
**
|
|
10501
10501
|
** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt>
|
|
10502
10502
|
** <dd>^The "int" variable pointed to by the V parameter will be set to the
|
|
10503
10503
|
** id for the X-th query plan element. The id value is unique within the
|
|
10504
10504
|
** statement. The select-id is the same value as is output in the first
|
|
10505
|
-
** column of an [EXPLAIN QUERY PLAN] query
|
|
10505
|
+
** column of an [EXPLAIN QUERY PLAN] query.</dd>
|
|
10506
10506
|
**
|
|
10507
10507
|
** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt>
|
|
10508
10508
|
** <dd>The "int" variable pointed to by the V parameter will be set to the
|
|
10509
|
-
**
|
|
10509
|
+
** id of the parent of the current query element, if applicable, or
|
|
10510
10510
|
** to zero if the query element has no parent. This is the same value as
|
|
10511
|
-
** returned in the second column of an [EXPLAIN QUERY PLAN] query
|
|
10511
|
+
** returned in the second column of an [EXPLAIN QUERY PLAN] query.</dd>
|
|
10512
10512
|
**
|
|
10513
10513
|
** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt>
|
|
10514
10514
|
** <dd>The sqlite3_int64 output value is set to the number of cycles,
|
|
10515
10515
|
** according to the processor time-stamp counter, that elapsed while the
|
|
10516
10516
|
** query element was being processed. This value is not available for
|
|
10517
10517
|
** all query elements - if it is unavailable the output variable is
|
|
10518
|
-
** set to -1
|
|
10518
|
+
** set to -1.</dd>
|
|
10519
10519
|
** </dl>
|
|
10520
10520
|
*/
|
|
10521
10521
|
#define SQLITE_SCANSTAT_NLOOP 0
|
|
@@ -10556,8 +10556,8 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
|
|
|
10556
10556
|
** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter.
|
|
10557
10557
|
**
|
|
10558
10558
|
** Parameter "idx" identifies the specific query element to retrieve statistics
|
|
10559
|
-
** for. Query elements are numbered starting from zero. A value of -1 may
|
|
10560
|
-
**
|
|
10559
|
+
** for. Query elements are numbered starting from zero. A value of -1 may
|
|
10560
|
+
** retrieve statistics for the entire query. ^If idx is out of range
|
|
10561
10561
|
** - less than -1 or greater than or equal to the total number of query
|
|
10562
10562
|
** elements used to implement the statement - a non-zero value is returned and
|
|
10563
10563
|
** the variable that pOut points to is unchanged.
|
|
@@ -10714,8 +10714,8 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
|
|
|
10714
10714
|
** triggers; and so forth.
|
|
10715
10715
|
**
|
|
10716
10716
|
** When the [sqlite3_blob_write()] API is used to update a blob column,
|
|
10717
|
-
** the pre-update hook is invoked with SQLITE_DELETE
|
|
10718
|
-
**
|
|
10717
|
+
** the pre-update hook is invoked with SQLITE_DELETE, because
|
|
10718
|
+
** the new values are not yet available. In this case, when a
|
|
10719
10719
|
** callback made with op==SQLITE_DELETE is actually a write using the
|
|
10720
10720
|
** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
|
|
10721
10721
|
** the index of the column being written. In other cases, where the
|
|
@@ -10968,7 +10968,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
|
|
|
10968
10968
|
** For an ordinary on-disk database file, the serialization is just a
|
|
10969
10969
|
** copy of the disk file. For an in-memory database or a "TEMP" database,
|
|
10970
10970
|
** the serialization is the same sequence of bytes which would be written
|
|
10971
|
-
** to disk if that database
|
|
10971
|
+
** to disk if that database were backed up to disk.
|
|
10972
10972
|
**
|
|
10973
10973
|
** The usual case is that sqlite3_serialize() copies the serialization of
|
|
10974
10974
|
** the database into memory obtained from [sqlite3_malloc64()] and returns
|
|
@@ -10977,7 +10977,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
|
|
|
10977
10977
|
** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations
|
|
10978
10978
|
** are made, and the sqlite3_serialize() function will return a pointer
|
|
10979
10979
|
** to the contiguous memory representation of the database that SQLite
|
|
10980
|
-
** is currently using for that database, or NULL if
|
|
10980
|
+
** is currently using for that database, or NULL if no such contiguous
|
|
10981
10981
|
** memory representation of the database exists. A contiguous memory
|
|
10982
10982
|
** representation of the database will usually only exist if there has
|
|
10983
10983
|
** been a prior call to [sqlite3_deserialize(D,S,...)] with the same
|
|
@@ -11048,7 +11048,7 @@ SQLITE_API unsigned char *sqlite3_serialize(
|
|
|
11048
11048
|
** database is currently in a read transaction or is involved in a backup
|
|
11049
11049
|
** operation.
|
|
11050
11050
|
**
|
|
11051
|
-
** It is not possible to
|
|
11051
|
+
** It is not possible to deserialize into the TEMP database. If the
|
|
11052
11052
|
** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the
|
|
11053
11053
|
** function returns SQLITE_ERROR.
|
|
11054
11054
|
**
|
|
@@ -11070,7 +11070,7 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
11070
11070
|
sqlite3 *db, /* The database connection */
|
|
11071
11071
|
const char *zSchema, /* Which DB to reopen with the deserialization */
|
|
11072
11072
|
unsigned char *pData, /* The serialized database content */
|
|
11073
|
-
sqlite3_int64 szDb, /* Number bytes in the deserialization */
|
|
11073
|
+
sqlite3_int64 szDb, /* Number of bytes in the deserialization */
|
|
11074
11074
|
sqlite3_int64 szBuf, /* Total size of buffer pData[] */
|
|
11075
11075
|
unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */
|
|
11076
11076
|
);
|
|
@@ -11078,7 +11078,7 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
11078
11078
|
/*
|
|
11079
11079
|
** CAPI3REF: Flags for sqlite3_deserialize()
|
|
11080
11080
|
**
|
|
11081
|
-
** The following are allowed values for 6th argument (the F argument) to
|
|
11081
|
+
** The following are allowed values for the 6th argument (the F argument) to
|
|
11082
11082
|
** the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
|
|
11083
11083
|
**
|
|
11084
11084
|
** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
|
package/deps/update-sqlite3mc.sh
CHANGED
package/lib/database.js
CHANGED
|
@@ -61,7 +61,7 @@ function Database(filenameGiven, options) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
// Make sure the specified directory exists
|
|
64
|
-
if (!anonymous && !fs.existsSync(path.dirname(filename))) {
|
|
64
|
+
if (!anonymous && !filename.startsWith('file:') && !fs.existsSync(path.dirname(filename))) {
|
|
65
65
|
throw new TypeError('Cannot open database because the directory does not exist');
|
|
66
66
|
}
|
|
67
67
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-sqlite3-multiple-ciphers",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.4.1",
|
|
4
4
|
"description": "better-sqlite3 with multiple-cipher encryption support",
|
|
5
5
|
"homepage": "https://github.com/m4heshd/better-sqlite3-multiple-ciphers",
|
|
6
6
|
"author": "Mahesh Bandara Wijerathna (m4heshd) <m4heshd@gmail.com>",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"files": [
|
|
14
14
|
"index.d.ts",
|
|
15
15
|
"binding.gyp",
|
|
16
|
-
"src
|
|
16
|
+
"src/**/*.[ch]pp",
|
|
17
17
|
"lib/**",
|
|
18
18
|
"deps/**"
|
|
19
19
|
],
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"overrides": {
|
|
28
28
|
"prebuild": {
|
|
29
|
-
"node-abi": "4.
|
|
29
|
+
"node-abi": "4.13.1"
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -44,13 +44,10 @@
|
|
|
44
44
|
"install": "prebuild-install || node-gyp rebuild --release",
|
|
45
45
|
"build-release": "node-gyp rebuild --release",
|
|
46
46
|
"build-debug": "node-gyp rebuild --debug",
|
|
47
|
-
"rebuild-release": "npm run lzz && npm run build-release",
|
|
48
|
-
"rebuild-debug": "npm run lzz && npm run build-debug",
|
|
49
47
|
"test": "mocha --exit --slow=75 --timeout=30000",
|
|
50
48
|
"test:container": "docker-compose up --detach --build",
|
|
51
49
|
"benchmark": "node benchmark",
|
|
52
50
|
"update-sqlite3mc": "bash ./deps/update-sqlite3mc.sh",
|
|
53
|
-
"lzz": "lzz -hx hpp -sx cpp -k BETTER_SQLITE3 -d -hl -sl -e ./src/better_sqlite3.lzz",
|
|
54
51
|
"bump:patch": "npm --no-git-tag-version version patch",
|
|
55
52
|
"bump:minor": "npm --no-git-tag-version version minor",
|
|
56
53
|
"bump:major": "npm --no-git-tag-version version major",
|
package/src/addon.cpp
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
struct Addon {
|
|
2
|
+
explicit Addon(v8::Isolate* isolate) :
|
|
3
|
+
privileged_info(NULL),
|
|
4
|
+
next_id(0),
|
|
5
|
+
cs(isolate) {}
|
|
6
|
+
|
|
7
|
+
static void Cleanup(void* ptr) {
|
|
8
|
+
Addon* addon = static_cast<Addon*>(ptr);
|
|
9
|
+
for (Database* db : addon->dbs) db->CloseHandles();
|
|
10
|
+
addon->dbs.clear();
|
|
11
|
+
delete addon;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
inline sqlite3_uint64 NextId() {
|
|
15
|
+
return next_id++;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static void ConfigureURI() {
|
|
19
|
+
static std::once_flag init_flag;
|
|
20
|
+
std::call_once(init_flag, [](){
|
|
21
|
+
const char* env = getenv("SQLITE_USE_URI");
|
|
22
|
+
if (env != NULL) {
|
|
23
|
+
if (strcmp(env, "1") == 0) {
|
|
24
|
+
int status = sqlite3_config(SQLITE_CONFIG_URI, 1);
|
|
25
|
+
assert(status == SQLITE_OK); ((void)status);
|
|
26
|
+
} else if (strcmp(env, "0") == 0) {
|
|
27
|
+
int status = sqlite3_config(SQLITE_CONFIG_URI, 0);
|
|
28
|
+
assert(status == SQLITE_OK); ((void)status);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static NODE_METHOD(JS_setErrorConstructor) {
|
|
35
|
+
REQUIRE_ARGUMENT_FUNCTION(first, v8::Local<v8::Function> SqliteError);
|
|
36
|
+
OnlyAddon->SqliteError.Reset(OnlyIsolate, SqliteError);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
v8::Global<v8::Function> Statement;
|
|
40
|
+
v8::Global<v8::Function> StatementIterator;
|
|
41
|
+
v8::Global<v8::Function> Backup;
|
|
42
|
+
v8::Global<v8::Function> SqliteError;
|
|
43
|
+
NODE_ARGUMENTS_POINTER privileged_info;
|
|
44
|
+
sqlite3_uint64 next_id;
|
|
45
|
+
CS cs;
|
|
46
|
+
std::set<Database*, Database::CompareDatabase> dbs;
|
|
47
|
+
};
|