better-sqlite3-multiple-ciphers 9.5.0 → 11.1.1
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 +8 -8
- package/deps/setup.ps1 +1 -1
- package/deps/sqlite3/sqlite3.c +6123 -3987
- package/deps/sqlite3/sqlite3.h +95 -26
- package/package.json +1 -1
- package/src/better_sqlite3.cpp +29 -29
- package/src/better_sqlite3.hpp +75 -77
package/src/better_sqlite3.hpp
CHANGED
|
@@ -16,9 +16,7 @@
|
|
|
16
16
|
#include <node.h>
|
|
17
17
|
#include <node_object_wrap.h>
|
|
18
18
|
#include <node_buffer.h>
|
|
19
|
-
#line
|
|
20
|
-
template <class T> using CopyablePersistent = v8::Persistent<T, v8::CopyablePersistentTraits<T>>;
|
|
21
|
-
#line 144 "./src/util/macros.lzz"
|
|
19
|
+
#line 141 "./src/util/macros.lzz"
|
|
22
20
|
void SetPrototypeGetter(
|
|
23
21
|
v8::Isolate* isolate,
|
|
24
22
|
v8::Local<v8::External> data,
|
|
@@ -37,29 +35,29 @@ v8::Local <v8::String> InternalizedFromUtf8 (v8::Isolate * isolate, char const *
|
|
|
37
35
|
v8::Local <v8::Value> InternalizedFromUtf8OrNull (v8::Isolate * isolate, char const * data, int length);
|
|
38
36
|
#line 26 "./src/util/macros.lzz"
|
|
39
37
|
v8::Local <v8::String> InternalizedFromLatin1 (v8::Isolate * isolate, char const * str);
|
|
40
|
-
#line
|
|
41
|
-
void SetFrozen (v8::Isolate * isolate, v8::Local <v8::Context> ctx, v8::Local <v8::Object> obj,
|
|
42
|
-
#line
|
|
38
|
+
#line 30 "./src/util/macros.lzz"
|
|
39
|
+
void SetFrozen (v8::Isolate * isolate, v8::Local <v8::Context> ctx, v8::Local <v8::Object> obj, v8::Global <v8::String> & key, v8::Local <v8::Value> value);
|
|
40
|
+
#line 34 "./src/util/macros.lzz"
|
|
43
41
|
void ThrowError (char const * message);
|
|
44
|
-
#line
|
|
42
|
+
#line 35 "./src/util/macros.lzz"
|
|
45
43
|
void ThrowTypeError (char const * message);
|
|
46
|
-
#line
|
|
44
|
+
#line 36 "./src/util/macros.lzz"
|
|
47
45
|
void ThrowRangeError (char const * message);
|
|
48
|
-
#line
|
|
46
|
+
#line 88 "./src/util/macros.lzz"
|
|
49
47
|
bool IS_SKIPPED (char c);
|
|
50
|
-
#line
|
|
48
|
+
#line 93 "./src/util/macros.lzz"
|
|
51
49
|
template <typename T>
|
|
52
|
-
#line
|
|
50
|
+
#line 93 "./src/util/macros.lzz"
|
|
53
51
|
T * ALLOC_ARRAY (size_t count);
|
|
54
|
-
#line
|
|
52
|
+
#line 98 "./src/util/macros.lzz"
|
|
55
53
|
template <typename T>
|
|
56
|
-
#line
|
|
54
|
+
#line 98 "./src/util/macros.lzz"
|
|
57
55
|
void FREE_ARRAY (T * array_pointer);
|
|
58
|
-
#line
|
|
56
|
+
#line 102 "./src/util/macros.lzz"
|
|
59
57
|
v8::Local <v8::FunctionTemplate> NewConstructorTemplate (v8::Isolate * isolate, v8::Local <v8::External> data, v8::FunctionCallback func, char const * name);
|
|
60
|
-
#line
|
|
58
|
+
#line 113 "./src/util/macros.lzz"
|
|
61
59
|
void SetPrototypeMethod (v8::Isolate * isolate, v8::Local <v8::External> data, v8::Local <v8::FunctionTemplate> recv, char const * name, v8::FunctionCallback func);
|
|
62
|
-
#line
|
|
60
|
+
#line 126 "./src/util/macros.lzz"
|
|
63
61
|
void SetPrototypeSymbolMethod (v8::Isolate * isolate, v8::Local <v8::External> data, v8::Local <v8::FunctionTemplate> recv, v8::Local <v8::Symbol> symbol, v8::FunctionCallback func);
|
|
64
62
|
#line 1 "./src/util/constants.lzz"
|
|
65
63
|
class CS
|
|
@@ -71,49 +69,49 @@ public:
|
|
|
71
69
|
#line 10 "./src/util/constants.lzz"
|
|
72
70
|
explicit CS (v8::Isolate * isolate);
|
|
73
71
|
#line 119 "./src/util/constants.lzz"
|
|
74
|
-
|
|
72
|
+
v8::Global <v8::String> database;
|
|
75
73
|
#line 120 "./src/util/constants.lzz"
|
|
76
|
-
|
|
74
|
+
v8::Global <v8::String> reader;
|
|
77
75
|
#line 121 "./src/util/constants.lzz"
|
|
78
|
-
|
|
76
|
+
v8::Global <v8::String> source;
|
|
79
77
|
#line 122 "./src/util/constants.lzz"
|
|
80
|
-
|
|
78
|
+
v8::Global <v8::String> memory;
|
|
81
79
|
#line 123 "./src/util/constants.lzz"
|
|
82
|
-
|
|
80
|
+
v8::Global <v8::String> readonly;
|
|
83
81
|
#line 124 "./src/util/constants.lzz"
|
|
84
|
-
|
|
82
|
+
v8::Global <v8::String> name;
|
|
85
83
|
#line 125 "./src/util/constants.lzz"
|
|
86
|
-
|
|
84
|
+
v8::Global <v8::String> next;
|
|
87
85
|
#line 126 "./src/util/constants.lzz"
|
|
88
|
-
|
|
86
|
+
v8::Global <v8::String> length;
|
|
89
87
|
#line 127 "./src/util/constants.lzz"
|
|
90
|
-
|
|
88
|
+
v8::Global <v8::String> done;
|
|
91
89
|
#line 128 "./src/util/constants.lzz"
|
|
92
|
-
|
|
90
|
+
v8::Global <v8::String> value;
|
|
93
91
|
#line 129 "./src/util/constants.lzz"
|
|
94
|
-
|
|
92
|
+
v8::Global <v8::String> changes;
|
|
95
93
|
#line 130 "./src/util/constants.lzz"
|
|
96
|
-
|
|
94
|
+
v8::Global <v8::String> lastInsertRowid;
|
|
97
95
|
#line 131 "./src/util/constants.lzz"
|
|
98
|
-
|
|
96
|
+
v8::Global <v8::String> statement;
|
|
99
97
|
#line 132 "./src/util/constants.lzz"
|
|
100
|
-
|
|
98
|
+
v8::Global <v8::String> column;
|
|
101
99
|
#line 133 "./src/util/constants.lzz"
|
|
102
|
-
|
|
100
|
+
v8::Global <v8::String> table;
|
|
103
101
|
#line 134 "./src/util/constants.lzz"
|
|
104
|
-
|
|
102
|
+
v8::Global <v8::String> type;
|
|
105
103
|
#line 135 "./src/util/constants.lzz"
|
|
106
|
-
|
|
104
|
+
v8::Global <v8::String> totalPages;
|
|
107
105
|
#line 136 "./src/util/constants.lzz"
|
|
108
|
-
|
|
106
|
+
v8::Global <v8::String> remainingPages;
|
|
109
107
|
#line 138 "./src/util/constants.lzz"
|
|
110
108
|
private:
|
|
111
109
|
#line 140 "./src/util/constants.lzz"
|
|
112
|
-
static void SetString (v8::Isolate * isolate,
|
|
110
|
+
static void SetString (v8::Isolate * isolate, v8::Global <v8::String> & constant, char const * str);
|
|
113
111
|
#line 144 "./src/util/constants.lzz"
|
|
114
112
|
void SetCode (v8::Isolate * isolate, int code, char const * str);
|
|
115
113
|
#line 150 "./src/util/constants.lzz"
|
|
116
|
-
std::unordered_map <int,
|
|
114
|
+
std::unordered_map <int, v8::Global<v8::String> > codes;
|
|
117
115
|
};
|
|
118
116
|
#line 1 "./src/util/bind-map.lzz"
|
|
119
117
|
class BindMap
|
|
@@ -138,7 +136,7 @@ public:
|
|
|
138
136
|
#line 22 "./src/util/bind-map.lzz"
|
|
139
137
|
explicit Pair (v8::Isolate * isolate, Pair * pair);
|
|
140
138
|
#line 25 "./src/util/bind-map.lzz"
|
|
141
|
-
|
|
139
|
+
v8::Global <v8::String> const name;
|
|
142
140
|
#line 26 "./src/util/bind-map.lzz"
|
|
143
141
|
int const index;
|
|
144
142
|
};
|
|
@@ -309,7 +307,7 @@ private:
|
|
|
309
307
|
#line 504 "./src/objects/database.lzz"
|
|
310
308
|
Addon * const addon;
|
|
311
309
|
#line 505 "./src/objects/database.lzz"
|
|
312
|
-
|
|
310
|
+
v8::Global <v8::Value> const logger;
|
|
313
311
|
#line 506 "./src/objects/database.lzz"
|
|
314
312
|
std::set <Statement*, CompareStatement> stmts;
|
|
315
313
|
#line 507 "./src/objects/database.lzz"
|
|
@@ -523,7 +521,7 @@ protected:
|
|
|
523
521
|
#line 56 "./src/util/custom-function.lzz"
|
|
524
522
|
v8::Isolate * const isolate;
|
|
525
523
|
#line 57 "./src/util/custom-function.lzz"
|
|
526
|
-
|
|
524
|
+
v8::Global <v8::Function> const fn;
|
|
527
525
|
#line 58 "./src/util/custom-function.lzz"
|
|
528
526
|
bool const safe_ints;
|
|
529
527
|
};
|
|
@@ -545,7 +543,7 @@ public:
|
|
|
545
543
|
#line 37 "./src/util/custom-aggregate.lzz"
|
|
546
544
|
private:
|
|
547
545
|
#line 39 "./src/util/custom-aggregate.lzz"
|
|
548
|
-
static void xStepBase (sqlite3_context * invocation, int argc, sqlite3_value * * argv,
|
|
546
|
+
static void xStepBase (sqlite3_context * invocation, int argc, sqlite3_value * * argv, v8::Global <v8::Function> const CustomAggregate::* ptrtm);
|
|
549
547
|
#line 58 "./src/util/custom-aggregate.lzz"
|
|
550
548
|
static void xValueBase (sqlite3_context * invocation, bool is_final);
|
|
551
549
|
#line 82 "./src/util/custom-aggregate.lzz"
|
|
@@ -554,7 +552,7 @@ private:
|
|
|
554
552
|
#line 82 "./src/util/custom-aggregate.lzz"
|
|
555
553
|
public:
|
|
556
554
|
#line 83 "./src/util/custom-aggregate.lzz"
|
|
557
|
-
|
|
555
|
+
v8::Global <v8::Value> value;
|
|
558
556
|
#line 84 "./src/util/custom-aggregate.lzz"
|
|
559
557
|
bool initialized;
|
|
560
558
|
#line 85 "./src/util/custom-aggregate.lzz"
|
|
@@ -571,11 +569,11 @@ private:
|
|
|
571
569
|
#line 117 "./src/util/custom-aggregate.lzz"
|
|
572
570
|
bool const invoke_start;
|
|
573
571
|
#line 118 "./src/util/custom-aggregate.lzz"
|
|
574
|
-
|
|
572
|
+
v8::Global <v8::Function> const inverse;
|
|
575
573
|
#line 119 "./src/util/custom-aggregate.lzz"
|
|
576
|
-
|
|
574
|
+
v8::Global <v8::Function> const result;
|
|
577
575
|
#line 120 "./src/util/custom-aggregate.lzz"
|
|
578
|
-
|
|
576
|
+
v8::Global <v8::Value> const start;
|
|
579
577
|
};
|
|
580
578
|
#line 1 "./src/util/custom-table.lzz"
|
|
581
579
|
class CustomTable
|
|
@@ -612,7 +610,7 @@ private:
|
|
|
612
610
|
#line 103 "./src/util/custom-table.lzz"
|
|
613
611
|
bool const safe_ints;
|
|
614
612
|
#line 104 "./src/util/custom-table.lzz"
|
|
615
|
-
|
|
613
|
+
v8::Global <v8::Function> const generator;
|
|
616
614
|
#line 105 "./src/util/custom-table.lzz"
|
|
617
615
|
std::vector <std::string> const parameter_names;
|
|
618
616
|
};
|
|
@@ -630,11 +628,11 @@ private:
|
|
|
630
628
|
#line 122 "./src/util/custom-table.lzz"
|
|
631
629
|
sqlite3_vtab_cursor base;
|
|
632
630
|
#line 123 "./src/util/custom-table.lzz"
|
|
633
|
-
|
|
631
|
+
v8::Global <v8::Object> iterator;
|
|
634
632
|
#line 124 "./src/util/custom-table.lzz"
|
|
635
|
-
|
|
633
|
+
v8::Global <v8::Function> next;
|
|
636
634
|
#line 125 "./src/util/custom-table.lzz"
|
|
637
|
-
|
|
635
|
+
v8::Global <v8::Array> row;
|
|
638
636
|
#line 126 "./src/util/custom-table.lzz"
|
|
639
637
|
bool done;
|
|
640
638
|
#line 127 "./src/util/custom-table.lzz"
|
|
@@ -689,7 +687,7 @@ private:
|
|
|
689
687
|
#line 402 "./src/util/custom-table.lzz"
|
|
690
688
|
std::string const name;
|
|
691
689
|
#line 403 "./src/util/custom-table.lzz"
|
|
692
|
-
|
|
690
|
+
v8::Global <v8::Function> const factory;
|
|
693
691
|
};
|
|
694
692
|
#line 65 "./src/util/data.lzz"
|
|
695
693
|
namespace Data
|
|
@@ -764,25 +762,25 @@ private:
|
|
|
764
762
|
#line 32 "./src/util/binder.lzz"
|
|
765
763
|
bool bound_object;
|
|
766
764
|
};
|
|
767
|
-
#line
|
|
765
|
+
#line 55 "./src/util/binder.lzz"
|
|
768
766
|
void Fail (void (* Throw) (char const *), char const * message);
|
|
769
|
-
#line
|
|
767
|
+
#line 63 "./src/util/binder.lzz"
|
|
770
768
|
int NextAnonIndex ();
|
|
771
|
-
#line
|
|
769
|
+
#line 69 "./src/util/binder.lzz"
|
|
772
770
|
void BindValue (v8::Isolate * isolate, v8::Local <v8::Value> value, int index);
|
|
773
|
-
#line
|
|
771
|
+
#line 90 "./src/util/binder.lzz"
|
|
774
772
|
int BindArray (v8::Isolate * isolate, v8::Local <v8::Array> arr);
|
|
775
|
-
#line
|
|
773
|
+
#line 116 "./src/util/binder.lzz"
|
|
776
774
|
int BindObject (v8::Isolate * isolate, v8::Local <v8::Object> obj, Statement * stmt);
|
|
777
|
-
#line
|
|
775
|
+
#line 160 "./src/util/binder.lzz"
|
|
778
776
|
Result BindArgs (v8::FunctionCallbackInfo <v8 :: Value> const & info, int argc, Statement * stmt);
|
|
779
|
-
#line 199 "./src/util/binder.lzz"
|
|
780
|
-
sqlite3_stmt * handle;
|
|
781
777
|
#line 200 "./src/util/binder.lzz"
|
|
782
|
-
|
|
778
|
+
sqlite3_stmt * handle;
|
|
783
779
|
#line 201 "./src/util/binder.lzz"
|
|
784
|
-
int
|
|
780
|
+
int param_count;
|
|
785
781
|
#line 202 "./src/util/binder.lzz"
|
|
782
|
+
int anon_index;
|
|
783
|
+
#line 203 "./src/util/binder.lzz"
|
|
786
784
|
bool success;
|
|
787
785
|
};
|
|
788
786
|
#line 34 "./src/better_sqlite3.lzz"
|
|
@@ -797,13 +795,13 @@ struct Addon
|
|
|
797
795
|
#line 52 "./src/better_sqlite3.lzz"
|
|
798
796
|
sqlite3_uint64 NextId ();
|
|
799
797
|
#line 56 "./src/better_sqlite3.lzz"
|
|
800
|
-
|
|
798
|
+
v8::Global <v8::Function> Statement;
|
|
801
799
|
#line 57 "./src/better_sqlite3.lzz"
|
|
802
|
-
|
|
800
|
+
v8::Global <v8::Function> StatementIterator;
|
|
803
801
|
#line 58 "./src/better_sqlite3.lzz"
|
|
804
|
-
|
|
802
|
+
v8::Global <v8::Function> Backup;
|
|
805
803
|
#line 59 "./src/better_sqlite3.lzz"
|
|
806
|
-
|
|
804
|
+
v8::Global <v8::Function> SqliteError;
|
|
807
805
|
#line 60 "./src/better_sqlite3.lzz"
|
|
808
806
|
v8::FunctionCallbackInfo <v8 :: Value> const * privileged_info;
|
|
809
807
|
#line 61 "./src/better_sqlite3.lzz"
|
|
@@ -838,31 +836,31 @@ LZZ_INLINE v8::Local <v8::String> InternalizedFromLatin1 (v8::Isolate * isolate,
|
|
|
838
836
|
{
|
|
839
837
|
return v8::String::NewFromOneByte(isolate, reinterpret_cast<const uint8_t*>(str), v8::NewStringType::kInternalized).ToLocalChecked();
|
|
840
838
|
}
|
|
841
|
-
#line
|
|
842
|
-
LZZ_INLINE void SetFrozen (v8::Isolate * isolate, v8::Local <v8::Context> ctx, v8::Local <v8::Object> obj,
|
|
843
|
-
#line
|
|
844
|
-
|
|
839
|
+
#line 30 "./src/util/macros.lzz"
|
|
840
|
+
LZZ_INLINE void SetFrozen (v8::Isolate * isolate, v8::Local <v8::Context> ctx, v8::Local <v8::Object> obj, v8::Global <v8::String> & key, v8::Local <v8::Value> value)
|
|
841
|
+
#line 30 "./src/util/macros.lzz"
|
|
842
|
+
{
|
|
845
843
|
obj->DefineOwnProperty(ctx, key.Get(isolate), value, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly)).FromJust();
|
|
846
844
|
}
|
|
847
|
-
#line
|
|
845
|
+
#line 88 "./src/util/macros.lzz"
|
|
848
846
|
LZZ_INLINE bool IS_SKIPPED (char c)
|
|
849
|
-
#line
|
|
847
|
+
#line 88 "./src/util/macros.lzz"
|
|
850
848
|
{
|
|
851
849
|
return c == ' ' || c == ';' || (c >= '\t' && c <= '\r');
|
|
852
850
|
}
|
|
853
|
-
#line
|
|
851
|
+
#line 93 "./src/util/macros.lzz"
|
|
854
852
|
template <typename T>
|
|
855
|
-
#line
|
|
853
|
+
#line 93 "./src/util/macros.lzz"
|
|
856
854
|
LZZ_INLINE T * ALLOC_ARRAY (size_t count)
|
|
857
|
-
#line
|
|
855
|
+
#line 93 "./src/util/macros.lzz"
|
|
858
856
|
{
|
|
859
857
|
return static_cast<T*>(::operator new[](count * sizeof(T)));
|
|
860
858
|
}
|
|
861
|
-
#line
|
|
859
|
+
#line 98 "./src/util/macros.lzz"
|
|
862
860
|
template <typename T>
|
|
863
|
-
#line
|
|
861
|
+
#line 98 "./src/util/macros.lzz"
|
|
864
862
|
LZZ_INLINE void FREE_ARRAY (T * array_pointer)
|
|
865
|
-
#line
|
|
863
|
+
#line 98 "./src/util/macros.lzz"
|
|
866
864
|
{
|
|
867
865
|
::operator delete[](array_pointer);
|
|
868
866
|
}
|
|
@@ -956,9 +954,9 @@ LZZ_INLINE bool Backup::Compare (Backup const * const a, Backup const * const b)
|
|
|
956
954
|
return a->id < b->id;
|
|
957
955
|
}
|
|
958
956
|
#line 39 "./src/util/custom-aggregate.lzz"
|
|
959
|
-
LZZ_INLINE void CustomAggregate::xStepBase (sqlite3_context * invocation, int argc, sqlite3_value * * argv,
|
|
957
|
+
LZZ_INLINE void CustomAggregate::xStepBase (sqlite3_context * invocation, int argc, sqlite3_value * * argv, v8::Global <v8::Function> const CustomAggregate::* ptrtm)
|
|
960
958
|
#line 39 "./src/util/custom-aggregate.lzz"
|
|
961
|
-
|
|
959
|
+
{
|
|
962
960
|
CustomAggregate * self = static_cast < CustomAggregate * > ( sqlite3_user_data ( invocation ) ) ; v8 :: Isolate * isolate = self -> isolate ; v8 :: HandleScope scope ( isolate ) ; Accumulator * acc = self -> GetAccumulator ( invocation ) ; if ( acc -> value . IsEmpty ( ) ) return ;
|
|
963
961
|
|
|
964
962
|
v8::Local<v8::Value> args_fast[5];
|