Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 4adaebe

Browse files
committed
Clean better-sqlite3 patch
Signed-off-by: Ovenoboyo <[email protected]>
1 parent e0a1dc3 commit 4adaebe

File tree

1 file changed

+154
-14
lines changed

1 file changed

+154
-14
lines changed

patches/better-sqlite3+7.6.2.patch

Lines changed: 154 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,33 @@ index 59fa0a8..fe8d144 100644
1515
},
1616
'conditions': [
1717
['OS=="linux"', {
18-
diff --git a/node_modules/better-sqlite3/build/Release/better_sqlite3.node b/node_modules/better-sqlite3/build/Release/better_sqlite3.node
19-
deleted file mode 100755
20-
index 5df7544..0000000
21-
Binary files a/node_modules/better-sqlite3/build/Release/better_sqlite3.node and /dev/null differ
2218
diff --git a/node_modules/better-sqlite3/src/better_sqlite3.cpp b/node_modules/better-sqlite3/src/better_sqlite3.cpp
23-
index 777c8b8..0cfaf51 100644
19+
index 777c8b8..e11e432 100644
2420
--- a/node_modules/better-sqlite3/src/better_sqlite3.cpp
2521
+++ b/node_modules/better-sqlite3/src/better_sqlite3.cpp
26-
@@ -104,8 +104,7 @@ void SetPrototypeGetter (v8::Isolate * isolate, v8::Local <v8::External> data, v
22+
@@ -2,6 +2,21 @@
23+
//
24+
25+
#include "better_sqlite3.hpp"
26+
+#line 39 "./src/util/binder.lzz"
27+
+ static bool IsPlainObject(v8::Isolate* isolate, v8::Local<v8::Object> obj) {
28+
+ v8::Local<v8::Value> proto = obj->GetPrototype();
29+
+
30+
+ #if defined NODE_MODULE_VERSION && NODE_MODULE_VERSION < 93
31+
+ v8::Local<v8::Context> ctx = obj->CreationContext();
32+
+ #else
33+
+ v8::Local<v8::Context> ctx = obj->GetCreationContext().ToLocalChecked();
34+
+ #endif
35+
+
36+
+ ctx->Enter();
37+
+ v8::Local<v8::Value> baseProto = v8::Object::New(isolate)->GetPrototype();
38+
+ ctx->Exit();
39+
+ return proto->StrictEquals(baseProto) || proto->StrictEquals(v8::Null(isolate));
40+
+ }
41+
#line 67 "./src/better_sqlite3.lzz"
42+
NODE_MODULE_INIT(/* exports, context */) {
43+
v8::Isolate* isolate = context->GetIsolate();
44+
@@ -104,8 +119,7 @@ void SetPrototypeGetter (v8::Isolate * isolate, v8::Local <v8::External> data, v
2745
0,
2846
data,
2947
v8::AccessControl::DEFAULT,
@@ -33,12 +51,134 @@ index 777c8b8..0cfaf51 100644
3351
);
3452
}
3553
#line 4 "./src/util/constants.lzz"
36-
@@ -1949,7 +1948,7 @@ bool Binder::IsPlainObject (v8::Isolate * isolate, v8::Local <v8::Object> obj)
37-
#line 35 "./src/util/binder.lzz"
38-
{
39-
v8::Local<v8::Value> proto = obj->GetPrototype();
54+
@@ -1944,20 +1958,9 @@ bool Binder::Bind (v8::FunctionCallbackInfo <v8 :: Value> const & info, int argc
55+
}
56+
return success;
57+
}
58+
-#line 35 "./src/util/binder.lzz"
59+
-bool Binder::IsPlainObject (v8::Isolate * isolate, v8::Local <v8::Object> obj)
60+
-#line 35 "./src/util/binder.lzz"
61+
- {
62+
- v8::Local<v8::Value> proto = obj->GetPrototype();
4063
- v8::Local<v8::Context> ctx = obj->CreationContext();
41-
+ v8::Local<v8::Context> ctx = obj->GetCreationContext().ToLocalChecked();
42-
ctx->Enter();
43-
v8::Local<v8::Value> baseProto = v8::Object::New(isolate)->GetPrototype();
44-
ctx->Exit();
64+
- ctx->Enter();
65+
- v8::Local<v8::Value> baseProto = v8::Object::New(isolate)->GetPrototype();
66+
- ctx->Exit();
67+
- return proto->StrictEquals(baseProto) || proto->StrictEquals(v8::Null(isolate));
68+
-}
69+
-#line 44 "./src/util/binder.lzz"
70+
+#line 54 "./src/util/binder.lzz"
71+
void Binder::Fail (void (* Throw) (char const *), char const * message)
72+
-#line 44 "./src/util/binder.lzz"
73+
+#line 54 "./src/util/binder.lzz"
74+
{
75+
assert(success == true);
76+
assert((Throw == NULL) == (message == NULL));
77+
@@ -1965,16 +1968,16 @@ void Binder::Fail (void (* Throw) (char const *), char const * message)
78+
if (Throw) Throw(message);
79+
success = false;
80+
}
81+
-#line 52 "./src/util/binder.lzz"
82+
+#line 62 "./src/util/binder.lzz"
83+
int Binder::NextAnonIndex ()
84+
-#line 52 "./src/util/binder.lzz"
85+
+#line 62 "./src/util/binder.lzz"
86+
{
87+
while (sqlite3_bind_parameter_name(handle, ++anon_index) != NULL) {}
88+
return anon_index;
89+
}
90+
-#line 58 "./src/util/binder.lzz"
91+
+#line 68 "./src/util/binder.lzz"
92+
void Binder::BindValue (v8::Isolate * isolate, v8::Local <v8::Value> value, int index)
93+
-#line 58 "./src/util/binder.lzz"
94+
+#line 68 "./src/util/binder.lzz"
95+
{
96+
int status = Data::BindValueFromJS(isolate, handle, index, value);
97+
if (status != SQLITE_OK) {
98+
@@ -1993,9 +1996,9 @@ void Binder::BindValue (v8::Isolate * isolate, v8::Local <v8::Value> value, int
99+
assert(false);
100+
}
101+
}
102+
-#line 79 "./src/util/binder.lzz"
103+
+#line 89 "./src/util/binder.lzz"
104+
int Binder::BindArray (v8::Isolate * isolate, v8::Local <v8::Array> arr)
105+
-#line 79 "./src/util/binder.lzz"
106+
+#line 89 "./src/util/binder.lzz"
107+
{
108+
v8 :: Local < v8 :: Context > ctx = isolate -> GetCurrentContext ( ) ;
109+
uint32_t length = arr->Length();
110+
@@ -2017,9 +2020,9 @@ int Binder::BindArray (v8::Isolate * isolate, v8::Local <v8::Array> arr)
111+
}
112+
return len;
113+
}
114+
-#line 105 "./src/util/binder.lzz"
115+
+#line 115 "./src/util/binder.lzz"
116+
int Binder::BindObject (v8::Isolate * isolate, v8::Local <v8::Object> obj, Statement * stmt)
117+
-#line 105 "./src/util/binder.lzz"
118+
+#line 115 "./src/util/binder.lzz"
119+
{
120+
v8 :: Local < v8 :: Context > ctx = isolate -> GetCurrentContext ( ) ;
121+
BindMap* bind_map = stmt->GetBindMap(isolate);
122+
@@ -2056,9 +2059,9 @@ int Binder::BindObject (v8::Isolate * isolate, v8::Local <v8::Object> obj, State
123+
124+
return len;
125+
}
126+
-#line 149 "./src/util/binder.lzz"
127+
+#line 159 "./src/util/binder.lzz"
128+
Binder::Result Binder::BindArgs (v8::FunctionCallbackInfo <v8 :: Value> const & info, int argc, Statement * stmt)
129+
-#line 149 "./src/util/binder.lzz"
130+
+#line 159 "./src/util/binder.lzz"
131+
{
132+
v8 :: Isolate * isolate = info . GetIsolate ( ) ;
133+
int count = 0;
134+
diff --git a/node_modules/better-sqlite3/src/better_sqlite3.hpp b/node_modules/better-sqlite3/src/better_sqlite3.hpp
135+
index 5d25ee9..1e7cd19 100644
136+
--- a/node_modules/better-sqlite3/src/better_sqlite3.hpp
137+
+++ b/node_modules/better-sqlite3/src/better_sqlite3.hpp
138+
@@ -18,6 +18,8 @@
139+
#include <node_buffer.h>
140+
#line 31 "./src/util/macros.lzz"
141+
template <class T> using CopyablePersistent = v8::Persistent<T, v8::CopyablePersistentTraits<T>>;
142+
+#line 36 "./src/util/binder.lzz"
143+
+ static bool IsPlainObject(v8::Isolate* isolate, v8::Local<v8::Object> obj);
144+
#define LZZ_INLINE inline
145+
#line 16 "./src/util/macros.lzz"
146+
v8::Local <v8::String> StringFromUtf8 (v8::Isolate * isolate, char const * data, int length);
147+
@@ -752,27 +754,25 @@ private:
148+
#line 32 "./src/util/binder.lzz"
149+
bool bound_object;
150+
};
151+
-#line 35 "./src/util/binder.lzz"
152+
- static bool IsPlainObject (v8::Isolate * isolate, v8::Local <v8::Object> obj);
153+
-#line 44 "./src/util/binder.lzz"
154+
+#line 54 "./src/util/binder.lzz"
155+
void Fail (void (* Throw) (char const *), char const * message);
156+
-#line 52 "./src/util/binder.lzz"
157+
+#line 62 "./src/util/binder.lzz"
158+
int NextAnonIndex ();
159+
-#line 58 "./src/util/binder.lzz"
160+
+#line 68 "./src/util/binder.lzz"
161+
void BindValue (v8::Isolate * isolate, v8::Local <v8::Value> value, int index);
162+
-#line 79 "./src/util/binder.lzz"
163+
+#line 89 "./src/util/binder.lzz"
164+
int BindArray (v8::Isolate * isolate, v8::Local <v8::Array> arr);
165+
-#line 105 "./src/util/binder.lzz"
166+
+#line 115 "./src/util/binder.lzz"
167+
int BindObject (v8::Isolate * isolate, v8::Local <v8::Object> obj, Statement * stmt);
168+
-#line 149 "./src/util/binder.lzz"
169+
+#line 159 "./src/util/binder.lzz"
170+
Result BindArgs (v8::FunctionCallbackInfo <v8 :: Value> const & info, int argc, Statement * stmt);
171+
-#line 189 "./src/util/binder.lzz"
172+
+#line 199 "./src/util/binder.lzz"
173+
sqlite3_stmt * handle;
174+
-#line 190 "./src/util/binder.lzz"
175+
+#line 200 "./src/util/binder.lzz"
176+
int param_count;
177+
-#line 191 "./src/util/binder.lzz"
178+
+#line 201 "./src/util/binder.lzz"
179+
int anon_index;
180+
-#line 192 "./src/util/binder.lzz"
181+
+#line 202 "./src/util/binder.lzz"
182+
bool success;
183+
};
184+
#line 34 "./src/better_sqlite3.lzz"

0 commit comments

Comments
 (0)