@rocicorp/zero-sqlite3 1.0.14 → 1.0.16
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/binding.gyp +1 -1
- package/deps/defines.gypi +1 -2
- package/deps/download.sh +2 -3
- package/deps/sqlite3/shell.c +1205 -1337
- package/deps/sqlite3/sqlite3.c +4540 -1435
- package/deps/sqlite3/sqlite3.h +389 -194
- package/deps/sqlite3/sqlite3ext.h +7 -0
- package/package.json +5 -5
- package/shell.js +25 -0
- package/src/better_sqlite3.cpp +6 -1
- package/src/objects/database.cpp +2 -2
- package/src/objects/statement.cpp +2 -2
- package/src/util/binder.cpp +2 -2
- package/src/util/data.cpp +1 -1
- package/src/util/macros.cpp +20 -0
- package/src/util/row-builder.cpp +1 -1
- package/deps/patches/1208.patch +0 -15
- package/shell.ps1 +0 -20
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rocicorp/zero-sqlite3",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"description": "better-sqlite3 on bedrock",
|
|
5
5
|
"homepage": "https://github.com/rocicorp/zero-sqlite3",
|
|
6
6
|
"author": "Rocicorp",
|
|
@@ -10,17 +10,17 @@
|
|
|
10
10
|
},
|
|
11
11
|
"main": "lib/index.js",
|
|
12
12
|
"bin": {
|
|
13
|
-
"zero-sqlite3": "./shell.
|
|
13
|
+
"zero-sqlite3": "./shell.js"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"binding.gyp",
|
|
17
17
|
"src/**/*.[ch]pp",
|
|
18
18
|
"lib/**",
|
|
19
19
|
"deps/**",
|
|
20
|
-
"shell.
|
|
20
|
+
"shell.js"
|
|
21
21
|
],
|
|
22
22
|
"engines": {
|
|
23
|
-
"node": "20.x || 22.x || 23.x || 24.x",
|
|
23
|
+
"node": "20.x || 22.x || 23.x || 24.x || 25.x",
|
|
24
24
|
"bun": ">=1.1.0"
|
|
25
25
|
},
|
|
26
26
|
"types": "lib/index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"overrides": {
|
|
32
32
|
"prebuild": {
|
|
33
|
-
"node-abi": "4.
|
|
33
|
+
"node-abi": "^4.25.0"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
package/shell.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawnSync } = require('child_process');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
|
|
6
|
+
const binaryName = process.platform === 'win32' ? 'zero_sqlite3.exe' : 'zero_sqlite3';
|
|
7
|
+
const binary = path.join(__dirname, 'build', 'Release', binaryName);
|
|
8
|
+
|
|
9
|
+
if (!fs.existsSync(binary)) {
|
|
10
|
+
console.error(`Error: Binary not found at ${binary}`);
|
|
11
|
+
console.error('Please run: npm run build-release');
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const result = spawnSync(binary, process.argv.slice(2), { stdio: 'inherit' });
|
|
16
|
+
|
|
17
|
+
if (result.error) {
|
|
18
|
+
console.error(`Error executing binary: ${result.error.message}`);
|
|
19
|
+
if (result.error.code === 'ENOEXEC') {
|
|
20
|
+
console.error('The binary may be built for a different platform. Please rebuild with: npm run build-release');
|
|
21
|
+
}
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
process.exit(result.status ?? 1);
|
package/src/better_sqlite3.cpp
CHANGED
|
@@ -46,7 +46,12 @@ class Backup;
|
|
|
46
46
|
#include "objects/statement-iterator.cpp"
|
|
47
47
|
|
|
48
48
|
NODE_MODULE_INIT(/* exports, context */) {
|
|
49
|
+
#if defined(NODE_MODULE_VERSION) && NODE_MODULE_VERSION >= 140
|
|
50
|
+
// Use Isolate::GetCurrent as stated in deprecation message within v8_context.h 13.9.72320122
|
|
51
|
+
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
|
52
|
+
#else
|
|
49
53
|
v8::Isolate* isolate = context->GetIsolate();
|
|
54
|
+
#endif
|
|
50
55
|
v8::HandleScope scope(isolate);
|
|
51
56
|
Addon::ConfigureURI();
|
|
52
57
|
|
|
@@ -62,7 +67,7 @@ NODE_MODULE_INIT(/* exports, context */) {
|
|
|
62
67
|
exports->Set(context, InternalizedFromLatin1(isolate, "Backup"), Backup::Init(isolate, data)).FromJust();
|
|
63
68
|
exports->Set(context, InternalizedFromLatin1(isolate, "setErrorConstructor"), v8::FunctionTemplate::New(isolate, Addon::JS_setErrorConstructor, data)->GetFunction(context).ToLocalChecked()).FromJust();
|
|
64
69
|
|
|
65
|
-
|
|
70
|
+
// Export SQLITE_SCANSTAT_* constants
|
|
66
71
|
exports->Set(context, InternalizedFromLatin1(isolate, "SQLITE_SCANSTAT_NLOOP"), v8::Int32::New(isolate, SQLITE_SCANSTAT_NLOOP)).FromJust();
|
|
67
72
|
exports->Set(context, InternalizedFromLatin1(isolate, "SQLITE_SCANSTAT_NVISIT"), v8::Int32::New(isolate, SQLITE_SCANSTAT_NVISIT)).FromJust();
|
|
68
73
|
exports->Set(context, InternalizedFromLatin1(isolate, "SQLITE_SCANSTAT_EST"), v8::Int32::New(isolate, SQLITE_SCANSTAT_EST)).FromJust();
|
package/src/objects/database.cpp
CHANGED
|
@@ -383,10 +383,10 @@ NODE_METHOD(Database::JS_unsafeMode) {
|
|
|
383
383
|
}
|
|
384
384
|
|
|
385
385
|
NODE_GETTER(Database::JS_open) {
|
|
386
|
-
info.GetReturnValue().Set(Unwrap<Database>(info
|
|
386
|
+
info.GetReturnValue().Set(Unwrap<Database>(PROPERTY_HOLDER(info))->open);
|
|
387
387
|
}
|
|
388
388
|
|
|
389
389
|
NODE_GETTER(Database::JS_inTransaction) {
|
|
390
|
-
Database* db = Unwrap<Database>(info
|
|
390
|
+
Database* db = Unwrap<Database>(PROPERTY_HOLDER(info));
|
|
391
391
|
info.GetReturnValue().Set(db->open && !static_cast<bool>(sqlite3_get_autocommit(db->db_handle)));
|
|
392
392
|
}
|
|
@@ -450,7 +450,7 @@ NODE_METHOD(Statement::JS_columns) {
|
|
|
450
450
|
);
|
|
451
451
|
columns.emplace_back(
|
|
452
452
|
v8::Object::New(isolate,
|
|
453
|
-
v8::Object::New(isolate)
|
|
453
|
+
GET_PROTOTYPE(v8::Object::New(isolate)),
|
|
454
454
|
keys.data(),
|
|
455
455
|
values.data(),
|
|
456
456
|
keys.size()
|
|
@@ -546,6 +546,6 @@ NODE_METHOD(Statement::JS_scanStatusReset) {
|
|
|
546
546
|
}
|
|
547
547
|
|
|
548
548
|
NODE_GETTER(Statement::JS_busy) {
|
|
549
|
-
Statement* stmt = Unwrap<Statement>(info
|
|
549
|
+
Statement* stmt = Unwrap<Statement>(PROPERTY_HOLDER(info));
|
|
550
550
|
info.GetReturnValue().Set(stmt->alive && stmt->locked);
|
|
551
551
|
}
|
package/src/util/binder.cpp
CHANGED
|
@@ -33,10 +33,10 @@ private:
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
static bool IsPlainObject(v8::Isolate* isolate, v8::Local<v8::Object> obj) {
|
|
36
|
-
v8::Local<v8::Value> proto = obj
|
|
36
|
+
v8::Local<v8::Value> proto = GET_PROTOTYPE(obj);
|
|
37
37
|
v8::Local<v8::Context> ctx = obj->GetCreationContext().ToLocalChecked();
|
|
38
38
|
ctx->Enter();
|
|
39
|
-
v8::Local<v8::Value> baseProto = v8::Object::New(isolate)
|
|
39
|
+
v8::Local<v8::Value> baseProto = GET_PROTOTYPE(v8::Object::New(isolate));
|
|
40
40
|
ctx->Exit();
|
|
41
41
|
return proto->StrictEquals(baseProto) || proto->StrictEquals(v8::Null(isolate));
|
|
42
42
|
}
|
package/src/util/data.cpp
CHANGED
package/src/util/macros.cpp
CHANGED
|
@@ -4,6 +4,26 @@
|
|
|
4
4
|
#define NODE_GETTER(name) void name(v8::Local<v8::Name> _, const v8::PropertyCallbackInfo<v8::Value>& info)
|
|
5
5
|
#define INIT(name) v8::Local<v8::Function> name(v8::Isolate* isolate, v8::Local<v8::External> data)
|
|
6
6
|
|
|
7
|
+
#if defined(V8_MAJOR_VERSION) && V8_MAJOR_VERSION >= 13
|
|
8
|
+
// v8::Object::GetPrototype has been deprecated. See http://crbug.com/333672197
|
|
9
|
+
#define GET_PROTOTYPE(obj) ((obj)->GetPrototypeV2())
|
|
10
|
+
#else
|
|
11
|
+
#define GET_PROTOTYPE(obj) ((obj)->GetPrototype())
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
// PropertyCallbackInfo::This() and Holder() were removed; use HolderV2().
|
|
15
|
+
// Tracking bug for V8 API removals: http://crbug.com/333672197
|
|
16
|
+
// V8 head has since restored Holder() and deprecated HolderV2():
|
|
17
|
+
// https://chromium.googlesource.com/v8/v8/+/main/include/v8-function-callback.h
|
|
18
|
+
// V8_INLINE Local<Object> Holder() const;
|
|
19
|
+
// V8_DEPRECATE_SOON("Use Holder().")
|
|
20
|
+
// V8_INLINE Local<Object> HolderV2() const;
|
|
21
|
+
#if defined(V8_MAJOR_VERSION) && V8_MAJOR_VERSION >= 13
|
|
22
|
+
#define PROPERTY_HOLDER(info) (info).HolderV2()
|
|
23
|
+
#else
|
|
24
|
+
#define PROPERTY_HOLDER(info) (info).This()
|
|
25
|
+
#endif
|
|
26
|
+
|
|
7
27
|
#define EasyIsolate v8::Isolate* isolate = v8::Isolate::GetCurrent()
|
|
8
28
|
#define OnlyIsolate info.GetIsolate()
|
|
9
29
|
#define OnlyContext isolate->GetCurrentContext()
|
package/src/util/row-builder.cpp
CHANGED
package/deps/patches/1208.patch
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
diff --git a/deps/sqlite3/sqlite3.c b/deps/sqlite3/sqlite3.c
|
|
2
|
-
index b1a807f..38bd1e6 100644
|
|
3
|
-
--- a/deps/sqlite3/sqlite3.c
|
|
4
|
-
+++ b/deps/sqlite3/sqlite3.c
|
|
5
|
-
@@ -24887,8 +24887,8 @@ static const struct {
|
|
6
|
-
/* 1 */ { 6, "minute", 7.7379e+12, 60.0 },
|
|
7
|
-
/* 2 */ { 4, "hour", 1.2897e+11, 3600.0 },
|
|
8
|
-
/* 3 */ { 3, "day", 5373485.0, 86400.0 },
|
|
9
|
-
- /* 4 */ { 5, "month", 176546.0, 30.0*86400.0 },
|
|
10
|
-
- /* 5 */ { 4, "year", 14713.0, 365.0*86400.0 },
|
|
11
|
-
+ /* 4 */ { 5, "month", 176546.0, 2592000.0 },
|
|
12
|
-
+ /* 5 */ { 4, "year", 14713.0, 31536000.0 },
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
/*
|
package/shell.ps1
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env sh
|
|
2
|
-
echo --% >/dev/null;: ' | out-null
|
|
3
|
-
<#'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
#
|
|
7
|
-
# sh part
|
|
8
|
-
#
|
|
9
|
-
"$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/build/Release/zero_sqlite3" "$@"
|
|
10
|
-
# end bash part
|
|
11
|
-
|
|
12
|
-
exit #>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
#
|
|
16
|
-
# powershell part
|
|
17
|
-
#
|
|
18
|
-
$scriptDir = (Get-Item -Path $MyInvocation.MyCommand.Definition).DirectoryName
|
|
19
|
-
& (Join-Path $scriptDir "build" "Release" "zero_sqlite3.exe") @args
|
|
20
|
-
|