Skip to content

Commit 702211c

Browse files
committed
Merge remote-tracking branch 'upstream/master'
# Conflicts: # README.md # package.json
2 parents 39a31c2 + 8598a9d commit 702211c

File tree

13 files changed

+64
-41
lines changed

13 files changed

+64
-41
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
matrix:
2121
os:
2222
- macos-latest
23-
- ubuntu-latest
23+
- ubuntu-20.04
2424
- windows-latest
2525
host:
2626
- x64
@@ -57,7 +57,7 @@ jobs:
5757
run: npm install -g yarn
5858

5959
- name: Add msbuild to PATH
60-
uses: microsoft/setup-msbuild@v1.1
60+
uses: microsoft/setup-msbuild@v1.3
6161
if: contains(matrix.os, 'windows')
6262
with:
6363
msbuild-architecture: ${{ matrix.target }}

binding.gyp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
"libraries": [
2626
"-l<(sqlite_libname)"
2727
],
28-
"conditions": [ [ "OS=='linux'", {"libraries+":["-Wl,-rpath=<@(sqlite)/lib"]} ] ],
29-
"conditions": [ [ "OS!='win'", {"libraries+":["-L<@(sqlite)/lib"]} ] ],
28+
"conditions": [
29+
[ "OS=='linux'", {"libraries+":["-Wl,-rpath=<@(sqlite)/lib"]} ],
30+
[ "OS!='win'", {"libraries+":["-L<@(sqlite)/lib"]} ]
31+
],
3032
'msvs_settings': {
3133
'VCLinkerTool': {
3234
'AdditionalLibraryDirectories': [

deps/common-sqlite.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
'variables': {
3-
'sqlite_version%':'3390400',
3+
'sqlite_version%':'3410100',
44
"toolset%":'',
55
},
66
'target_defaults': {
-2.92 MB
Binary file not shown.
2.98 MB
Binary file not shown.

lib/sqlite3.d.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,16 @@ export class Statement extends events.EventEmitter {
8080
run(params: any, callback?: (this: RunResult, err: Error | null) => void): this;
8181
run(...params: any[]): this;
8282

83-
get(callback?: (err: Error | null, row?: any) => void): this;
84-
get(params: any, callback?: (this: RunResult, err: Error | null, row?: any) => void): this;
83+
get<T>(callback?: (err: Error | null, row?: T) => void): this;
84+
get<T>(params: any, callback?: (this: RunResult, err: Error | null, row?: T) => void): this;
8585
get(...params: any[]): this;
8686

87-
all(callback?: (err: Error | null, rows: any[]) => void): this;
88-
all(params: any, callback?: (this: RunResult, err: Error | null, rows: any[]) => void): this;
87+
all<T>(callback?: (err: Error | null, rows: T[]) => void): this;
88+
all<T>(params: any, callback?: (this: RunResult, err: Error | null, rows: T[]) => void): this;
8989
all(...params: any[]): this;
9090

91-
each(callback?: (err: Error | null, row: any) => void, complete?: (err: Error | null, count: number) => void): this;
92-
each(params: any, callback?: (this: RunResult, err: Error | null, row: any) => void, complete?: (err: Error | null, count: number) => void): this;
91+
each<T>(callback?: (err: Error | null, row: T) => void, complete?: (err: Error | null, count: number) => void): this;
92+
each<T>(params: any, callback?: (this: RunResult, err: Error | null, row: T) => void, complete?: (err: Error | null, count: number) => void): this;
9393
each(...params: any[]): this;
9494
}
9595

@@ -103,16 +103,16 @@ export class Database extends events.EventEmitter {
103103
run(sql: string, params: any, callback?: (this: RunResult, err: Error | null) => void): this;
104104
run(sql: string, ...params: any[]): this;
105105

106-
get(sql: string, callback?: (this: Statement, err: Error | null, row: any) => void): this;
107-
get(sql: string, params: any, callback?: (this: Statement, err: Error | null, row: any) => void): this;
106+
get<T>(sql: string, callback?: (this: Statement, err: Error | null, row: T) => void): this;
107+
get<T>(sql: string, params: any, callback?: (this: Statement, err: Error | null, row: T) => void): this;
108108
get(sql: string, ...params: any[]): this;
109109

110-
all(sql: string, callback?: (this: Statement, err: Error | null, rows: any[]) => void): this;
111-
all(sql: string, params: any, callback?: (this: Statement, err: Error | null, rows: any[]) => void): this;
110+
all<T>(sql: string, callback?: (this: Statement, err: Error | null, rows: T[]) => void): this;
111+
all<T>(sql: string, params: any, callback?: (this: Statement, err: Error | null, rows: T[]) => void): this;
112112
all(sql: string, ...params: any[]): this;
113113

114-
each(sql: string, callback?: (this: Statement, err: Error | null, row: any) => void, complete?: (err: Error | null, count: number) => void): this;
115-
each(sql: string, params: any, callback?: (this: Statement, err: Error | null, row: any) => void, complete?: (err: Error | null, count: number) => void): this;
114+
each<T>(sql: string, callback?: (this: Statement, err: Error | null, row: T) => void, complete?: (err: Error | null, count: number) => void): this;
115+
each<T>(sql: string, params: any, callback?: (this: Statement, err: Error | null, row: T) => void, complete?: (err: Error | null, count: number) => void): this;
116116
each(sql: string, ...params: any[]): this;
117117

118118
exec(sql: string, callback?: (this: Statement, err: Error | null) => void): this;

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "@louislam/sqlite3",
33
"description": "Asynchronous, non-blocking SQLite3 bindings",
4-
"version": "15.1.2",
5-
"homepage": "https://github.com/louislam/node-sqlite3",
4+
"version": "15.1.6",
5+
"homepage": "https://github.com/TryGhost/node-sqlite3",
66
"author": {
77
"name": "Mapbox",
88
"url": "https://mapbox.com/"
@@ -57,15 +57,15 @@
5757
"node-pre-gyp-github": "1.4.4"
5858
},
5959
"peerDependencies": {
60-
"node-gyp": "7.x"
60+
"node-gyp": "8.x"
6161
},
6262
"peerDependenciesMeta": {
6363
"node-gyp": {
6464
"optional": true
6565
}
6666
},
6767
"optionalDependencies": {
68-
"node-gyp": "^7.1.2"
68+
"node-gyp": "8.x"
6969
},
7070
"scripts": {
7171
"build": "node-pre-gyp build",

src/database.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void Database::Process() {
5656
queue.pop();
5757
std::unique_ptr<Baton> baton(call->baton);
5858
Napi::Function cb = baton->callback.Value();
59-
if (!cb.IsUndefined() && cb.IsFunction()) {
59+
if (IS_FUNCTION(cb)) {
6060
TRY_CATCH_CALL(this->Value(), cb, 1, argv);
6161
called = true;
6262
}
@@ -97,7 +97,7 @@ void Database::Schedule(Work_Callback callback, Baton* baton, bool exclusive) {
9797
// We don't call the actual callback, so we have to make sure that
9898
// the baton gets destroyed.
9999
delete baton;
100-
if (!cb.IsUndefined() && cb.IsFunction()) {
100+
if (IS_FUNCTION(cb)) {
101101
Napi::Value argv[] = { exception };
102102
TRY_CATCH_CALL(Value(), cb, 1, argv);
103103
}
@@ -202,7 +202,7 @@ void Database::Work_AfterOpen(napi_env e, napi_status status, void* data) {
202202

203203
Napi::Function cb = baton->callback.Value();
204204

205-
if (!cb.IsUndefined() && cb.IsFunction()) {
205+
if (IS_FUNCTION(cb)) {
206206
TRY_CATCH_CALL(db->Value(), cb, 1, argv);
207207
}
208208
else if (!db->open) {
@@ -294,7 +294,7 @@ void Database::Work_AfterClose(napi_env e, napi_status status, void* data) {
294294
Napi::Function cb = baton->callback.Value();
295295

296296
// Fire callbacks.
297-
if (!cb.IsUndefined() && cb.IsFunction()) {
297+
if (IS_FUNCTION(cb)) {
298298
TRY_CATCH_CALL(db->Value(), cb, 1, argv);
299299
}
300300
else if (db->open) {
@@ -630,7 +630,7 @@ void Database::Work_AfterExec(napi_env e, napi_status status, void* data) {
630630
if (baton->status != SQLITE_OK) {
631631
EXCEPTION(Napi::String::New(env, baton->message.c_str()), baton->status, exception);
632632

633-
if (!cb.IsUndefined() && cb.IsFunction()) {
633+
if (IS_FUNCTION(cb)) {
634634
Napi::Value argv[] = { exception };
635635
TRY_CATCH_CALL(db->Value(), cb, 1, argv);
636636
}
@@ -639,7 +639,7 @@ void Database::Work_AfterExec(napi_env e, napi_status status, void* data) {
639639
EMIT_EVENT(db->Value(), 2, info);
640640
}
641641
}
642-
else if (!cb.IsUndefined() && cb.IsFunction()) {
642+
else if (IS_FUNCTION(cb)) {
643643
Napi::Value argv[] = { env.Null() };
644644
TRY_CATCH_CALL(db->Value(), cb, 1, argv);
645645
}
@@ -671,7 +671,7 @@ void Database::Work_Wait(Baton* b) {
671671
assert(baton->db->pending == 0);
672672

673673
Napi::Function cb = baton->callback.Value();
674-
if (!cb.IsUndefined() && cb.IsFunction()) {
674+
if (IS_FUNCTION(cb)) {
675675
Napi::Value argv[] = { env.Null() };
676676
TRY_CATCH_CALL(baton->db->Value(), cb, 1, argv);
677677
}
@@ -742,7 +742,7 @@ void Database::Work_AfterLoadExtension(napi_env e, napi_status status, void* dat
742742
if (baton->status != SQLITE_OK) {
743743
EXCEPTION(Napi::String::New(env, baton->message.c_str()), baton->status, exception);
744744

745-
if (!cb.IsUndefined() && cb.IsFunction()) {
745+
if (IS_FUNCTION(cb)) {
746746
Napi::Value argv[] = { exception };
747747
TRY_CATCH_CALL(db->Value(), cb, 1, argv);
748748
}
@@ -751,7 +751,7 @@ void Database::Work_AfterLoadExtension(napi_env e, napi_status status, void* dat
751751
EMIT_EVENT(db->Value(), 2, info);
752752
}
753753
}
754-
else if (!cb.IsUndefined() && cb.IsFunction()) {
754+
else if (IS_FUNCTION(cb)) {
755755
Napi::Value argv[] = { env.Null() };
756756
TRY_CATCH_CALL(db->Value(), cb, 1, argv);
757757
}

src/gcc-preinclude.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
1313
__asm__(".symver exp,exp@GLIBC_2.2.5");
1414
__asm__(".symver log,log@GLIBC_2.2.5");
15+
__asm__(".symver log2,log2@GLIBC_2.2.5");
1516
__asm__(".symver pow,pow@GLIBC_2.2.5");
1617
__asm__(".symver fcntl64,fcntl@GLIBC_2.2.5");
1718
#endif
@@ -20,6 +21,7 @@ __asm__(".symver fcntl64,fcntl@GLIBC_2.2.5");
2021
__asm__(".symver memcpy,memcpy@GLIBC_2.17");
2122
__asm__(".symver exp,exp@GLIBC_2.17");
2223
__asm__(".symver log,log@GLIBC_2.17");
24+
__asm__(".symver log2,log2@GLIBC_2.17");
2325
__asm__(".symver pow,pow@GLIBC_2.17");
2426
__asm__(".symver fcntl64,fcntl@GLIBC_2.17");
2527
#endif

src/macros.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ inline bool OtherIsInt(Napi::Number source) {
2323
}
2424
}
2525

26+
#define IS_FUNCTION(cb) \
27+
!cb.IsUndefined() && cb.IsFunction()
28+
2629
#define REQUIRE_ARGUMENTS(n) \
2730
if (info.Length() < (n)) { \
2831
Napi::TypeError::New(env, "Expected " #n "arguments").ThrowAsJavaScriptException(); \

0 commit comments

Comments
 (0)