better-sqlite3-multiple-ciphers 12.2.0 → 12.4.6
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 +12079 -9160
- package/deps/sqlite3/sqlite3.h +347 -154
- package/deps/sqlite3/sqlite3ext.h +7 -0
- 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 +74 -2233
- 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 +70 -0
- package/src/util/query-macros.cpp +71 -0
- package/src/util/row-builder.cpp +49 -0
- package/src/better_sqlite3.hpp +0 -1040
|
@@ -368,6 +368,10 @@ struct sqlite3_api_routines {
|
|
|
368
368
|
int (*set_clientdata)(sqlite3*, const char*, void*, void(*)(void*));
|
|
369
369
|
/* Version 3.50.0 and later */
|
|
370
370
|
int (*setlk_timeout)(sqlite3*,int,int);
|
|
371
|
+
/* Version 3.51.0 and later */
|
|
372
|
+
int (*set_errmsg)(sqlite3*,int,const char*);
|
|
373
|
+
int (*db_status64)(sqlite3*,int,sqlite3_int64*,sqlite3_int64*,int);
|
|
374
|
+
|
|
371
375
|
};
|
|
372
376
|
|
|
373
377
|
/*
|
|
@@ -703,6 +707,9 @@ typedef int (*sqlite3_loadext_entry)(
|
|
|
703
707
|
#define sqlite3_set_clientdata sqlite3_api->set_clientdata
|
|
704
708
|
/* Version 3.50.0 and later */
|
|
705
709
|
#define sqlite3_setlk_timeout sqlite3_api->setlk_timeout
|
|
710
|
+
/* Version 3.51.0 and later */
|
|
711
|
+
#define sqlite3_set_errmsg sqlite3_api->set_errmsg
|
|
712
|
+
#define sqlite3_db_status64 sqlite3_api->db_status64
|
|
706
713
|
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
|
|
707
714
|
|
|
708
715
|
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
|
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.6",
|
|
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.15.0"
|
|
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
|
+
};
|