@homeofthings/sqlite3 6.4.0 → 7.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/README.md +75 -31
- package/binding.gyp +4 -3
- package/deps/sqlite-amalgamation-3530000/shell.c +37279 -0
- package/deps/sqlite-amalgamation-3530000/sqlite3.c +268826 -0
- package/deps/sqlite-amalgamation-3530000/sqlite3.h +14335 -0
- package/deps/sqlite-amalgamation-3530000/sqlite3ext.h +739 -0
- package/deps/sqlite3.gyp +4 -32
- package/lib/promise/database.js +1 -1
- package/lib/promise/index.d.ts +1 -0
- package/lib/promise/index.mjs +9 -0
- package/lib/sqlite3-binding.js +1 -1
- package/lib/sqlite3-callback.js +207 -0
- package/lib/sqlite3.d.ts +5 -0
- package/lib/sqlite3.js +6 -206
- package/lib/sqlite3.mjs +78 -0
- package/package.json +26 -17
- package/prebuilds/darwin-arm64/@homeofthings+sqlite3.glibc.node +0 -0
- package/prebuilds/darwin-x64/@homeofthings+sqlite3.glibc.node +0 -0
- package/prebuilds/linux-arm64/@homeofthings+sqlite3.glibc.node +0 -0
- package/prebuilds/linux-arm64/@homeofthings+sqlite3.musl.node +0 -0
- package/prebuilds/linux-x64/@homeofthings+sqlite3.glibc.node +0 -0
- package/prebuilds/linux-x64/@homeofthings+sqlite3.musl.node +0 -0
- package/prebuilds/win32-x64/@homeofthings+sqlite3.glibc.node +0 -0
- package/src/backup.cc +8 -0
- package/src/macros.h +2 -19
- package/src/node_sqlite3.cc +0 -11
- package/deps/extract.js +0 -19
- package/deps/sqlite-autoconf-3530000.tar.gz +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/backup.cc
CHANGED
|
@@ -173,6 +173,14 @@ Backup::Backup(const Napi::CallbackInfo& info) : Napi::ObjectWrap<Backup>(info)
|
|
|
173
173
|
baton->filenameIsDest = filenameIsDest.Value();
|
|
174
174
|
|
|
175
175
|
this->db->Schedule(Work_BeginInitialize, baton);
|
|
176
|
+
|
|
177
|
+
// Initialize retryErrors with default values so GetRetryErrors() never
|
|
178
|
+
// crashes on an empty Napi::Reference, even if the JS wrapper that sets
|
|
179
|
+
// backup.retryErrors is bypassed (i.e. direct new sqlite3.Backup(...)).
|
|
180
|
+
Napi::Array defaultRetryErrors = Napi::Array::New(env, 2);
|
|
181
|
+
defaultRetryErrors.Set(static_cast<uint32_t>(0), Napi::Number::New(env, SQLITE_BUSY));
|
|
182
|
+
defaultRetryErrors.Set(static_cast<uint32_t>(1), Napi::Number::New(env, SQLITE_LOCKED));
|
|
183
|
+
retryErrors.Reset(defaultRetryErrors, 1);
|
|
176
184
|
}
|
|
177
185
|
|
|
178
186
|
void Backup::Work_BeginInitialize(Database::Baton* baton) {
|
package/src/macros.h
CHANGED
|
@@ -4,14 +4,10 @@
|
|
|
4
4
|
const char* sqlite_code_string(int code);
|
|
5
5
|
const char* sqlite_authorizer_string(int type);
|
|
6
6
|
#include <vector>
|
|
7
|
-
#include <atomic>
|
|
8
7
|
|
|
9
8
|
// TODO: better way to work around StringConcat?
|
|
10
9
|
#include <napi.h>
|
|
11
10
|
|
|
12
|
-
// Forward declaration of shutdown flag from node_sqlite3.cc
|
|
13
|
-
extern std::atomic<bool> g_env_shutting_down;
|
|
14
|
-
|
|
15
11
|
inline Napi::String StringConcat(Napi::Value str1, Napi::Value str2) {
|
|
16
12
|
return Napi::String::New(str1.Env(), str1.As<Napi::String>().Utf8Value() +
|
|
17
13
|
str2.As<Napi::String>().Utf8Value() );
|
|
@@ -133,21 +129,8 @@ inline bool OtherIsInt(Napi::Number source) {
|
|
|
133
129
|
if ((argc != 0) && (passed_argv != NULL)) {\
|
|
134
130
|
args.assign(passed_argv, passed_argv + argc);\
|
|
135
131
|
}\
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (res.IsEmpty()) return __VA_ARGS__;\
|
|
139
|
-
} catch (const Napi::Error&) {\
|
|
140
|
-
/* During Node.js/Electron shutdown, when using NAPI_CPP_EXCEPTIONS,*/\
|
|
141
|
-
/* we must take care to not throw any exceptions. */\
|
|
142
|
-
/* But when napi_call_function returns napi_cannot_run_js */\
|
|
143
|
-
/* this throws a C++ exception, when NAPI_CPP_EXCEPTIONS is enabled. */\
|
|
144
|
-
if (g_env_shutting_down.load()) {\
|
|
145
|
-
/* We need to silently ignore exceptions during shutdown. */\
|
|
146
|
-
return __VA_ARGS__;\
|
|
147
|
-
}\
|
|
148
|
-
/* Real rror - re-throw to propagate it */\
|
|
149
|
-
throw;\
|
|
150
|
-
}
|
|
132
|
+
Napi::Value res = (callback).Call(Napi::Value(context), args);\
|
|
133
|
+
if (res.IsEmpty()) return __VA_ARGS__;
|
|
151
134
|
|
|
152
135
|
#define WORK_DEFINITION(name) \
|
|
153
136
|
Napi::Value name(const Napi::CallbackInfo& info); \
|
package/src/node_sqlite3.cc
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
#include <sstream>
|
|
3
3
|
#include <cstring>
|
|
4
4
|
#include <string>
|
|
5
|
-
#include <atomic>
|
|
6
5
|
#include <sqlite3.h>
|
|
7
6
|
|
|
8
7
|
#include "macros.h"
|
|
@@ -12,21 +11,11 @@
|
|
|
12
11
|
|
|
13
12
|
using namespace node_sqlite3;
|
|
14
13
|
|
|
15
|
-
// Global flag set when the environment is shutting down.
|
|
16
|
-
std::atomic<bool> g_env_shutting_down{false};
|
|
17
|
-
|
|
18
|
-
static void EnvCleanupHook(void* /*data*/) {
|
|
19
|
-
g_env_shutting_down.store(true);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
14
|
namespace {
|
|
23
15
|
|
|
24
16
|
Napi::Object RegisterModule(Napi::Env env, Napi::Object exports) {
|
|
25
17
|
Napi::HandleScope scope(env);
|
|
26
18
|
|
|
27
|
-
// Register cleanup hook to detect shutdown
|
|
28
|
-
napi_add_env_cleanup_hook(env, EnvCleanupHook, nullptr);
|
|
29
|
-
|
|
30
19
|
Database::Init(env, exports);
|
|
31
20
|
Statement::Init(env, exports);
|
|
32
21
|
Backup::Init(env, exports);
|
package/deps/extract.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const tar = require("tar");
|
|
2
|
-
const fs = require("fs");
|
|
3
|
-
const path = require("path");
|
|
4
|
-
const tarball = path.resolve(process.argv[2]);
|
|
5
|
-
const dirname = path.resolve(process.argv[3]);
|
|
6
|
-
|
|
7
|
-
tar.extract({
|
|
8
|
-
sync: true,
|
|
9
|
-
file: tarball,
|
|
10
|
-
cwd: dirname,
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
// SQLite >= 3.49 ships a VERSION file that conflicts with the C++20 <version>
|
|
14
|
-
// header on case-insensitive filesystems (macOS/Windows).
|
|
15
|
-
const base = path.basename(tarball, ".tar.gz");
|
|
16
|
-
const versionFile = path.join(dirname, base, "VERSION");
|
|
17
|
-
if (fs.existsSync(versionFile)) {
|
|
18
|
-
fs.unlinkSync(versionFile);
|
|
19
|
-
}
|
|
Binary file
|