better-sqlite3-multiple-ciphers 12.1.1 → 12.4.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.
@@ -1,1040 +0,0 @@
1
- // better_sqlite3.hpp
2
- //
3
-
4
- #ifndef LZZ_BETTER_SQLITE3_better_sqlite3_hpp
5
- #define LZZ_BETTER_SQLITE3_better_sqlite3_hpp
6
- #line 2 "./src/better_sqlite3.lzz"
7
- #include <climits>
8
- #include <cstdio>
9
- #include <cstring>
10
- #include <string>
11
- #include <vector>
12
- #include <set>
13
- #include <unordered_map>
14
- #include <algorithm>
15
- #include <sqlite3.h>
16
- #include <node.h>
17
- #include <node_object_wrap.h>
18
- #include <node_buffer.h>
19
- #line 145 "./src/util/macros.lzz"
20
- void SetPrototypeGetter(
21
- v8::Isolate* isolate,
22
- v8::Local<v8::External> data,
23
- v8::Local<v8::FunctionTemplate> recv,
24
- const char* name,
25
- v8::AccessorNameGetterCallback func
26
- );
27
- #line 36 "./src/util/binder.lzz"
28
- static bool IsPlainObject(v8::Isolate* isolate, v8::Local<v8::Object> obj);
29
- #define LZZ_INLINE inline
30
- #line 20 "./src/util/macros.lzz"
31
- v8::Local <v8::String> StringFromUtf8 (v8::Isolate * isolate, char const * data, int length);
32
- #line 23 "./src/util/macros.lzz"
33
- v8::Local <v8::String> InternalizedFromUtf8 (v8::Isolate * isolate, char const * data, int length);
34
- #line 26 "./src/util/macros.lzz"
35
- v8::Local <v8::Value> InternalizedFromUtf8OrNull (v8::Isolate * isolate, char const * data, int length);
36
- #line 30 "./src/util/macros.lzz"
37
- v8::Local <v8::String> InternalizedFromLatin1 (v8::Isolate * isolate, char const * str);
38
- #line 34 "./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 38 "./src/util/macros.lzz"
41
- void ThrowError (char const * message);
42
- #line 39 "./src/util/macros.lzz"
43
- void ThrowTypeError (char const * message);
44
- #line 40 "./src/util/macros.lzz"
45
- void ThrowRangeError (char const * message);
46
- #line 92 "./src/util/macros.lzz"
47
- bool IS_SKIPPED (char c);
48
- #line 97 "./src/util/macros.lzz"
49
- template <typename T>
50
- #line 97 "./src/util/macros.lzz"
51
- T * ALLOC_ARRAY (size_t count);
52
- #line 102 "./src/util/macros.lzz"
53
- template <typename T>
54
- #line 102 "./src/util/macros.lzz"
55
- void FREE_ARRAY (T * array_pointer);
56
- #line 106 "./src/util/macros.lzz"
57
- v8::Local <v8::FunctionTemplate> NewConstructorTemplate (v8::Isolate * isolate, v8::Local <v8::External> data, v8::FunctionCallback func, char const * name);
58
- #line 117 "./src/util/macros.lzz"
59
- void SetPrototypeMethod (v8::Isolate * isolate, v8::Local <v8::External> data, v8::Local <v8::FunctionTemplate> recv, char const * name, v8::FunctionCallback func);
60
- #line 130 "./src/util/macros.lzz"
61
- void SetPrototypeSymbolMethod (v8::Isolate * isolate, v8::Local <v8::External> data, v8::Local <v8::FunctionTemplate> recv, v8::Local <v8::Symbol> symbol, v8::FunctionCallback func);
62
- #line 1 "./src/util/constants.lzz"
63
- class CS
64
- {
65
- #line 2 "./src/util/constants.lzz"
66
- public:
67
- #line 4 "./src/util/constants.lzz"
68
- v8::Local <v8::String> Code (v8::Isolate * isolate, int code);
69
- #line 10 "./src/util/constants.lzz"
70
- explicit CS (v8::Isolate * isolate);
71
- #line 140 "./src/util/constants.lzz"
72
- v8::Global <v8::String> database;
73
- #line 141 "./src/util/constants.lzz"
74
- v8::Global <v8::String> reader;
75
- #line 142 "./src/util/constants.lzz"
76
- v8::Global <v8::String> source;
77
- #line 143 "./src/util/constants.lzz"
78
- v8::Global <v8::String> memory;
79
- #line 144 "./src/util/constants.lzz"
80
- v8::Global <v8::String> readonly;
81
- #line 145 "./src/util/constants.lzz"
82
- v8::Global <v8::String> name;
83
- #line 146 "./src/util/constants.lzz"
84
- v8::Global <v8::String> next;
85
- #line 147 "./src/util/constants.lzz"
86
- v8::Global <v8::String> length;
87
- #line 148 "./src/util/constants.lzz"
88
- v8::Global <v8::String> done;
89
- #line 149 "./src/util/constants.lzz"
90
- v8::Global <v8::String> value;
91
- #line 150 "./src/util/constants.lzz"
92
- v8::Global <v8::String> changes;
93
- #line 151 "./src/util/constants.lzz"
94
- v8::Global <v8::String> lastInsertRowid;
95
- #line 152 "./src/util/constants.lzz"
96
- v8::Global <v8::String> statement;
97
- #line 153 "./src/util/constants.lzz"
98
- v8::Global <v8::String> column;
99
- #line 154 "./src/util/constants.lzz"
100
- v8::Global <v8::String> table;
101
- #line 155 "./src/util/constants.lzz"
102
- v8::Global <v8::String> type;
103
- #line 156 "./src/util/constants.lzz"
104
- v8::Global <v8::String> totalPages;
105
- #line 157 "./src/util/constants.lzz"
106
- v8::Global <v8::String> remainingPages;
107
- #line 159 "./src/util/constants.lzz"
108
- private:
109
- #line 161 "./src/util/constants.lzz"
110
- static void SetString (v8::Isolate * isolate, v8::Global <v8::String> & constant, char const * str);
111
- #line 165 "./src/util/constants.lzz"
112
- void SetCode (v8::Isolate * isolate, int code, char const * str);
113
- #line 171 "./src/util/constants.lzz"
114
- std::unordered_map <int, v8::Global<v8::String> > codes;
115
- };
116
- #line 1 "./src/util/bind-map.lzz"
117
- class BindMap
118
- {
119
- #line 2 "./src/util/bind-map.lzz"
120
- public:
121
- #line 6 "./src/util/bind-map.lzz"
122
- class Pair
123
- {
124
- #line 6 "./src/util/bind-map.lzz"
125
- friend class BindMap;
126
- #line 7 "./src/util/bind-map.lzz"
127
- public:
128
- #line 9 "./src/util/bind-map.lzz"
129
- int GetIndex ();
130
- #line 13 "./src/util/bind-map.lzz"
131
- v8::Local <v8::String> GetName (v8::Isolate * isolate);
132
- #line 17 "./src/util/bind-map.lzz"
133
- private:
134
- #line 19 "./src/util/bind-map.lzz"
135
- explicit Pair (v8::Isolate * isolate, char const * name, int index);
136
- #line 22 "./src/util/bind-map.lzz"
137
- explicit Pair (v8::Isolate * isolate, Pair * pair);
138
- #line 25 "./src/util/bind-map.lzz"
139
- v8::Global <v8::String> const name;
140
- #line 26 "./src/util/bind-map.lzz"
141
- int const index;
142
- };
143
- #line 29 "./src/util/bind-map.lzz"
144
- explicit BindMap (char _);
145
- #line 36 "./src/util/bind-map.lzz"
146
- ~ BindMap ();
147
- #line 41 "./src/util/bind-map.lzz"
148
- Pair * GetPairs ();
149
- #line 45 "./src/util/bind-map.lzz"
150
- int GetSize ();
151
- #line 50 "./src/util/bind-map.lzz"
152
- void Add (v8::Isolate * isolate, char const * name, int index);
153
- #line 56 "./src/util/bind-map.lzz"
154
- private:
155
- #line 58 "./src/util/bind-map.lzz"
156
- void Grow (v8::Isolate * isolate);
157
- #line 70 "./src/util/bind-map.lzz"
158
- Pair * pairs;
159
- #line 71 "./src/util/bind-map.lzz"
160
- int capacity;
161
- #line 72 "./src/util/bind-map.lzz"
162
- int length;
163
- };
164
- #line 20 "./src/better_sqlite3.lzz"
165
- struct Addon;
166
- #line 21 "./src/better_sqlite3.lzz"
167
- class Statement;
168
- #line 22 "./src/better_sqlite3.lzz"
169
- class Backup;
170
- #line 1 "./src/objects/database.lzz"
171
- class Database : public node::ObjectWrap
172
- {
173
- #line 2 "./src/objects/database.lzz"
174
- public:
175
- #line 4 "./src/objects/database.lzz"
176
- static v8::Local <v8 :: Function> Init (v8::Isolate * isolate, v8::Local <v8 :: External> data);
177
- #line 25 "./src/objects/database.lzz"
178
- class CompareDatabase
179
- {
180
- #line 25 "./src/objects/database.lzz"
181
- public:
182
- #line 26 "./src/objects/database.lzz"
183
- bool operator () (Database const * const a, Database const * const b) const;
184
- };
185
- #line 30 "./src/objects/database.lzz"
186
- class CompareStatement
187
- {
188
- #line 30 "./src/objects/database.lzz"
189
- public:
190
- #line 31 "./src/objects/database.lzz"
191
- bool operator () (Statement const * const a, Statement const * const b) const;
192
- };
193
- #line 35 "./src/objects/database.lzz"
194
- class CompareBackup
195
- {
196
- #line 35 "./src/objects/database.lzz"
197
- public:
198
- #line 36 "./src/objects/database.lzz"
199
- bool operator () (Backup const * const a, Backup const * const b) const;
200
- };
201
- #line 42 "./src/objects/database.lzz"
202
- void ThrowDatabaseError ();
203
- #line 46 "./src/objects/database.lzz"
204
- static void ThrowSqliteError (Addon * addon, sqlite3 * db_handle);
205
- #line 50 "./src/objects/database.lzz"
206
- static void ThrowSqliteError (Addon * addon, char const * message, int code);
207
- #line 66 "./src/objects/database.lzz"
208
- bool Log (v8::Isolate * isolate, sqlite3_stmt * handle);
209
- #line 79 "./src/objects/database.lzz"
210
- void AddStatement (Statement * stmt);
211
- #line 80 "./src/objects/database.lzz"
212
- void RemoveStatement (Statement * stmt);
213
- #line 83 "./src/objects/database.lzz"
214
- void AddBackup (Backup * backup);
215
- #line 84 "./src/objects/database.lzz"
216
- void RemoveBackup (Backup * backup);
217
- #line 88 "./src/objects/database.lzz"
218
- struct State
219
- {
220
- #line 89 "./src/objects/database.lzz"
221
- bool const open;
222
- #line 90 "./src/objects/database.lzz"
223
- bool busy;
224
- #line 91 "./src/objects/database.lzz"
225
- bool const safe_ints;
226
- #line 92 "./src/objects/database.lzz"
227
- bool const unsafe_mode;
228
- #line 93 "./src/objects/database.lzz"
229
- bool was_js_error;
230
- #line 94 "./src/objects/database.lzz"
231
- bool const has_logger;
232
- #line 95 "./src/objects/database.lzz"
233
- unsigned short int iterators;
234
- #line 96 "./src/objects/database.lzz"
235
- Addon * const addon;
236
- };
237
- #line 98 "./src/objects/database.lzz"
238
- State * GetState ();
239
- #line 101 "./src/objects/database.lzz"
240
- sqlite3 * GetHandle ();
241
- #line 104 "./src/objects/database.lzz"
242
- Addon * GetAddon ();
243
- #line 109 "./src/objects/database.lzz"
244
- void CloseHandles ();
245
- #line 121 "./src/objects/database.lzz"
246
- ~ Database ();
247
- #line 126 "./src/objects/database.lzz"
248
- private:
249
- #line 128 "./src/objects/database.lzz"
250
- explicit Database (v8::Isolate * isolate, Addon * addon, sqlite3 * db_handle, v8::Local <v8::Value> logger);
251
- #line 151 "./src/objects/database.lzz"
252
- static void JS_new (v8::FunctionCallbackInfo <v8 :: Value> const & info);
253
- #line 203 "./src/objects/database.lzz"
254
- static void JS_prepare (v8::FunctionCallbackInfo <v8 :: Value> const & info);
255
- #line 219 "./src/objects/database.lzz"
256
- static void JS_key (v8::FunctionCallbackInfo <v8 :: Value> const & info);
257
- #line 238 "./src/objects/database.lzz"
258
- static void JS_rekey (v8::FunctionCallbackInfo <v8 :: Value> const & info);
259
- #line 257 "./src/objects/database.lzz"
260
- static void JS_exec (v8::FunctionCallbackInfo <v8 :: Value> const & info);
261
- #line 297 "./src/objects/database.lzz"
262
- static void JS_backup (v8::FunctionCallbackInfo <v8 :: Value> const & info);
263
- #line 315 "./src/objects/database.lzz"
264
- static void JS_serialize (v8::FunctionCallbackInfo <v8 :: Value> const & info);
265
- #line 337 "./src/objects/database.lzz"
266
- static void JS_function (v8::FunctionCallbackInfo <v8 :: Value> const & info);
267
- #line 361 "./src/objects/database.lzz"
268
- static void JS_aggregate (v8::FunctionCallbackInfo <v8 :: Value> const & info);
269
- #line 390 "./src/objects/database.lzz"
270
- static void JS_table (v8::FunctionCallbackInfo <v8 :: Value> const & info);
271
- #line 410 "./src/objects/database.lzz"
272
- static void JS_loadExtension (v8::FunctionCallbackInfo <v8 :: Value> const & info);
273
- #line 432 "./src/objects/database.lzz"
274
- static void JS_close (v8::FunctionCallbackInfo <v8 :: Value> const & info);
275
- #line 442 "./src/objects/database.lzz"
276
- static void JS_defaultSafeIntegers (v8::FunctionCallbackInfo <v8 :: Value> const & info);
277
- #line 448 "./src/objects/database.lzz"
278
- static void JS_unsafeMode (v8::FunctionCallbackInfo <v8 :: Value> const & info);
279
- #line 455 "./src/objects/database.lzz"
280
- static void JS_open (v8::Local <v8 :: Name> _, v8::PropertyCallbackInfo <v8 :: Value> const & info);
281
- #line 459 "./src/objects/database.lzz"
282
- static void JS_inTransaction (v8::Local <v8 :: Name> _, v8::PropertyCallbackInfo <v8 :: Value> const & info);
283
- #line 464 "./src/objects/database.lzz"
284
- static bool Deserialize (v8::Local <v8::Object> buffer, Addon * addon, sqlite3 * db_handle, bool readonly);
285
- #line 489 "./src/objects/database.lzz"
286
- static void FreeSerialization (char * data, void * _);
287
- #line 493 "./src/objects/database.lzz"
288
- static int const MAX_BUFFER_SIZE = node::Buffer::kMaxLength > INT_MAX ? INT_MAX : static_cast<int>(node::Buffer::kMaxLength);
289
- #line 494 "./src/objects/database.lzz"
290
- static int const MAX_STRING_SIZE = v8::String::kMaxLength > INT_MAX ? INT_MAX : static_cast<int>(v8::String::kMaxLength);
291
- #line 496 "./src/objects/database.lzz"
292
- sqlite3 * const db_handle;
293
- #line 497 "./src/objects/database.lzz"
294
- bool open;
295
- #line 498 "./src/objects/database.lzz"
296
- bool busy;
297
- #line 499 "./src/objects/database.lzz"
298
- bool safe_ints;
299
- #line 500 "./src/objects/database.lzz"
300
- bool unsafe_mode;
301
- #line 501 "./src/objects/database.lzz"
302
- bool was_js_error;
303
- #line 502 "./src/objects/database.lzz"
304
- bool const has_logger;
305
- #line 503 "./src/objects/database.lzz"
306
- unsigned short int iterators;
307
- #line 504 "./src/objects/database.lzz"
308
- Addon * const addon;
309
- #line 505 "./src/objects/database.lzz"
310
- v8::Global <v8::Value> const logger;
311
- #line 506 "./src/objects/database.lzz"
312
- std::set <Statement*, CompareStatement> stmts;
313
- #line 507 "./src/objects/database.lzz"
314
- std::set <Backup*, CompareBackup> backups;
315
- };
316
- #line 1 "./src/objects/statement.lzz"
317
- class Statement : public node::ObjectWrap
318
- {
319
- #line 1 "./src/objects/statement.lzz"
320
- friend class StatementIterator;
321
- #line 2 "./src/objects/statement.lzz"
322
- public:
323
- #line 4 "./src/objects/statement.lzz"
324
- static v8::Local <v8 :: Function> Init (v8::Isolate * isolate, v8::Local <v8 :: External> data);
325
- #line 21 "./src/objects/statement.lzz"
326
- static bool Compare (Statement const * const a, Statement const * const b);
327
- #line 26 "./src/objects/statement.lzz"
328
- BindMap * GetBindMap (v8::Isolate * isolate);
329
- #line 39 "./src/objects/statement.lzz"
330
- void CloseHandles ();
331
- #line 46 "./src/objects/statement.lzz"
332
- ~ Statement ();
333
- #line 52 "./src/objects/statement.lzz"
334
- private:
335
- #line 55 "./src/objects/statement.lzz"
336
- class Extras
337
- {
338
- #line 55 "./src/objects/statement.lzz"
339
- friend class Statement;
340
- #line 56 "./src/objects/statement.lzz"
341
- explicit Extras (sqlite3_uint64 id);
342
- #line 57 "./src/objects/statement.lzz"
343
- BindMap bind_map;
344
- #line 58 "./src/objects/statement.lzz"
345
- sqlite3_uint64 const id;
346
- };
347
- #line 61 "./src/objects/statement.lzz"
348
- explicit Statement (Database * db, sqlite3_stmt * handle, sqlite3_uint64 id, bool returns_data);
349
- #line 85 "./src/objects/statement.lzz"
350
- static void JS_new (v8::FunctionCallbackInfo <v8 :: Value> const & info);
351
- #line 156 "./src/objects/statement.lzz"
352
- static void JS_run (v8::FunctionCallbackInfo <v8 :: Value> const & info);
353
- #line 179 "./src/objects/statement.lzz"
354
- static void JS_get (v8::FunctionCallbackInfo <v8 :: Value> const & info);
355
- #line 194 "./src/objects/statement.lzz"
356
- static void JS_all (v8::FunctionCallbackInfo <v8 :: Value> const & info);
357
- #line 215 "./src/objects/statement.lzz"
358
- static void JS_iterate (v8::FunctionCallbackInfo <v8 :: Value> const & info);
359
- #line 225 "./src/objects/statement.lzz"
360
- static void JS_bind (v8::FunctionCallbackInfo <v8 :: Value> const & info);
361
- #line 236 "./src/objects/statement.lzz"
362
- static void JS_pluck (v8::FunctionCallbackInfo <v8 :: Value> const & info);
363
- #line 247 "./src/objects/statement.lzz"
364
- static void JS_expand (v8::FunctionCallbackInfo <v8 :: Value> const & info);
365
- #line 258 "./src/objects/statement.lzz"
366
- static void JS_raw (v8::FunctionCallbackInfo <v8 :: Value> const & info);
367
- #line 269 "./src/objects/statement.lzz"
368
- static void JS_safeIntegers (v8::FunctionCallbackInfo <v8 :: Value> const & info);
369
- #line 278 "./src/objects/statement.lzz"
370
- static void JS_columns (v8::FunctionCallbackInfo <v8 :: Value> const & info);
371
- #line 321 "./src/objects/statement.lzz"
372
- static void JS_busy (v8::Local <v8 :: Name> _, v8::PropertyCallbackInfo <v8 :: Value> const & info);
373
- #line 326 "./src/objects/statement.lzz"
374
- Database * const db;
375
- #line 327 "./src/objects/statement.lzz"
376
- sqlite3_stmt * const handle;
377
- #line 328 "./src/objects/statement.lzz"
378
- Extras * const extras;
379
- #line 329 "./src/objects/statement.lzz"
380
- bool alive;
381
- #line 330 "./src/objects/statement.lzz"
382
- bool locked;
383
- #line 331 "./src/objects/statement.lzz"
384
- bool bound;
385
- #line 332 "./src/objects/statement.lzz"
386
- bool has_bind_map;
387
- #line 333 "./src/objects/statement.lzz"
388
- bool safe_ints;
389
- #line 334 "./src/objects/statement.lzz"
390
- char mode;
391
- #line 335 "./src/objects/statement.lzz"
392
- bool const returns_data;
393
- };
394
- #line 1 "./src/objects/statement-iterator.lzz"
395
- class StatementIterator : public node::ObjectWrap
396
- {
397
- #line 2 "./src/objects/statement-iterator.lzz"
398
- public:
399
- #line 4 "./src/objects/statement-iterator.lzz"
400
- static v8::Local <v8 :: Function> Init (v8::Isolate * isolate, v8::Local <v8 :: External> data);
401
- #line 15 "./src/objects/statement-iterator.lzz"
402
- ~ StatementIterator ();
403
- #line 17 "./src/objects/statement-iterator.lzz"
404
- private:
405
- #line 19 "./src/objects/statement-iterator.lzz"
406
- explicit StatementIterator (Statement * stmt, bool bound);
407
- #line 38 "./src/objects/statement-iterator.lzz"
408
- static void JS_new (v8::FunctionCallbackInfo <v8 :: Value> const & info);
409
- #line 57 "./src/objects/statement-iterator.lzz"
410
- static void JS_next (v8::FunctionCallbackInfo <v8 :: Value> const & info);
411
- #line 64 "./src/objects/statement-iterator.lzz"
412
- static void JS_return (v8::FunctionCallbackInfo <v8 :: Value> const & info);
413
- #line 71 "./src/objects/statement-iterator.lzz"
414
- static void JS_symbolIterator (v8::FunctionCallbackInfo <v8 :: Value> const & info);
415
- #line 75 "./src/objects/statement-iterator.lzz"
416
- void Next (v8::FunctionCallbackInfo <v8 :: Value> const & info);
417
- #line 100 "./src/objects/statement-iterator.lzz"
418
- void Return (v8::FunctionCallbackInfo <v8 :: Value> const & info);
419
- #line 105 "./src/objects/statement-iterator.lzz"
420
- void Throw ();
421
- #line 111 "./src/objects/statement-iterator.lzz"
422
- void Cleanup ();
423
- #line 119 "./src/objects/statement-iterator.lzz"
424
- static v8::Local <v8::Object> NewRecord (v8::Isolate * isolate, v8::Local <v8::Context> ctx, v8::Local <v8::Value> value, Addon * addon, bool done);
425
- #line 126 "./src/objects/statement-iterator.lzz"
426
- static v8::Local <v8::Object> DoneRecord (v8::Isolate * isolate, Addon * addon);
427
- #line 130 "./src/objects/statement-iterator.lzz"
428
- Statement * const stmt;
429
- #line 131 "./src/objects/statement-iterator.lzz"
430
- sqlite3_stmt * const handle;
431
- #line 132 "./src/objects/statement-iterator.lzz"
432
- Database::State * const db_state;
433
- #line 133 "./src/objects/statement-iterator.lzz"
434
- bool const bound;
435
- #line 134 "./src/objects/statement-iterator.lzz"
436
- bool const safe_ints;
437
- #line 135 "./src/objects/statement-iterator.lzz"
438
- char const mode;
439
- #line 136 "./src/objects/statement-iterator.lzz"
440
- bool alive;
441
- #line 137 "./src/objects/statement-iterator.lzz"
442
- bool logged;
443
- };
444
- #line 1 "./src/objects/backup.lzz"
445
- class Backup : public node::ObjectWrap
446
- {
447
- #line 2 "./src/objects/backup.lzz"
448
- public:
449
- #line 4 "./src/objects/backup.lzz"
450
- static v8::Local <v8 :: Function> Init (v8::Isolate * isolate, v8::Local <v8 :: External> data);
451
- #line 12 "./src/objects/backup.lzz"
452
- static bool Compare (Backup const * const a, Backup const * const b);
453
- #line 17 "./src/objects/backup.lzz"
454
- void CloseHandles ();
455
- #line 28 "./src/objects/backup.lzz"
456
- ~ Backup ();
457
- #line 33 "./src/objects/backup.lzz"
458
- private:
459
- #line 35 "./src/objects/backup.lzz"
460
- explicit Backup (Database * db, sqlite3 * dest_handle, sqlite3_backup * backup_handle, sqlite3_uint64 id, bool unlink);
461
- #line 55 "./src/objects/backup.lzz"
462
- static void JS_new (v8::FunctionCallbackInfo <v8 :: Value> const & info);
463
- #line 98 "./src/objects/backup.lzz"
464
- static void JS_transfer (v8::FunctionCallbackInfo <v8 :: Value> const & info);
465
- #line 124 "./src/objects/backup.lzz"
466
- static void JS_close (v8::FunctionCallbackInfo <v8 :: Value> const & info);
467
- #line 132 "./src/objects/backup.lzz"
468
- Database * const db;
469
- #line 133 "./src/objects/backup.lzz"
470
- sqlite3 * const dest_handle;
471
- #line 134 "./src/objects/backup.lzz"
472
- sqlite3_backup * const backup_handle;
473
- #line 135 "./src/objects/backup.lzz"
474
- sqlite3_uint64 const id;
475
- #line 136 "./src/objects/backup.lzz"
476
- bool alive;
477
- #line 137 "./src/objects/backup.lzz"
478
- bool unlink;
479
- };
480
- #line 1 "./src/util/data-converter.lzz"
481
- class DataConverter
482
- {
483
- #line 2 "./src/util/data-converter.lzz"
484
- public:
485
- #line 4 "./src/util/data-converter.lzz"
486
- void ThrowDataConversionError (sqlite3_context * invocation, bool isBigInt);
487
- #line 13 "./src/util/data-converter.lzz"
488
- protected:
489
- #line 15 "./src/util/data-converter.lzz"
490
- virtual void PropagateJSError (sqlite3_context * invocation) = 0;
491
- #line 16 "./src/util/data-converter.lzz"
492
- virtual std::string GetDataErrorPrefix () = 0;
493
- };
494
- #line 1 "./src/util/custom-function.lzz"
495
- class CustomFunction : protected DataConverter
496
- {
497
- #line 2 "./src/util/custom-function.lzz"
498
- public:
499
- #line 4 "./src/util/custom-function.lzz"
500
- explicit CustomFunction (v8::Isolate * isolate, Database * db, char const * name, v8::Local <v8::Function> fn, bool safe_ints);
501
- #line 17 "./src/util/custom-function.lzz"
502
- virtual ~ CustomFunction ();
503
- #line 19 "./src/util/custom-function.lzz"
504
- static void xDestroy (void * self);
505
- #line 23 "./src/util/custom-function.lzz"
506
- static void xFunc (sqlite3_context * invocation, int argc, sqlite3_value * * argv);
507
- #line 40 "./src/util/custom-function.lzz"
508
- protected:
509
- #line 42 "./src/util/custom-function.lzz"
510
- void PropagateJSError (sqlite3_context * invocation);
511
- #line 48 "./src/util/custom-function.lzz"
512
- std::string GetDataErrorPrefix ();
513
- #line 52 "./src/util/custom-function.lzz"
514
- private:
515
- #line 53 "./src/util/custom-function.lzz"
516
- std::string const name;
517
- #line 54 "./src/util/custom-function.lzz"
518
- Database * const db;
519
- #line 55 "./src/util/custom-function.lzz"
520
- protected:
521
- #line 56 "./src/util/custom-function.lzz"
522
- v8::Isolate * const isolate;
523
- #line 57 "./src/util/custom-function.lzz"
524
- v8::Global <v8::Function> const fn;
525
- #line 58 "./src/util/custom-function.lzz"
526
- bool const safe_ints;
527
- };
528
- #line 1 "./src/util/custom-aggregate.lzz"
529
- class CustomAggregate : public CustomFunction
530
- {
531
- #line 2 "./src/util/custom-aggregate.lzz"
532
- public:
533
- #line 4 "./src/util/custom-aggregate.lzz"
534
- explicit CustomAggregate (v8::Isolate * isolate, Database * db, char const * name, v8::Local <v8::Value> start, v8::Local <v8::Function> step, v8::Local <v8::Value> inverse, v8::Local <v8::Value> result, bool safe_ints);
535
- #line 21 "./src/util/custom-aggregate.lzz"
536
- static void xStep (sqlite3_context * invocation, int argc, sqlite3_value * * argv);
537
- #line 25 "./src/util/custom-aggregate.lzz"
538
- static void xInverse (sqlite3_context * invocation, int argc, sqlite3_value * * argv);
539
- #line 29 "./src/util/custom-aggregate.lzz"
540
- static void xValue (sqlite3_context * invocation);
541
- #line 33 "./src/util/custom-aggregate.lzz"
542
- static void xFinal (sqlite3_context * invocation);
543
- #line 37 "./src/util/custom-aggregate.lzz"
544
- private:
545
- #line 39 "./src/util/custom-aggregate.lzz"
546
- static void xStepBase (sqlite3_context * invocation, int argc, sqlite3_value * * argv, v8::Global <v8::Function> const CustomAggregate::* ptrtm);
547
- #line 58 "./src/util/custom-aggregate.lzz"
548
- static void xValueBase (sqlite3_context * invocation, bool is_final);
549
- #line 82 "./src/util/custom-aggregate.lzz"
550
- struct Accumulator
551
- {
552
- #line 82 "./src/util/custom-aggregate.lzz"
553
- public:
554
- #line 83 "./src/util/custom-aggregate.lzz"
555
- v8::Global <v8::Value> value;
556
- #line 84 "./src/util/custom-aggregate.lzz"
557
- bool initialized;
558
- #line 85 "./src/util/custom-aggregate.lzz"
559
- bool is_window;
560
- };
561
- #line 88 "./src/util/custom-aggregate.lzz"
562
- Accumulator * GetAccumulator (sqlite3_context * invocation);
563
- #line 105 "./src/util/custom-aggregate.lzz"
564
- static void DestroyAccumulator (sqlite3_context * invocation);
565
- #line 111 "./src/util/custom-aggregate.lzz"
566
- void PropagateJSError (sqlite3_context * invocation);
567
- #line 116 "./src/util/custom-aggregate.lzz"
568
- bool const invoke_result;
569
- #line 117 "./src/util/custom-aggregate.lzz"
570
- bool const invoke_start;
571
- #line 118 "./src/util/custom-aggregate.lzz"
572
- v8::Global <v8::Function> const inverse;
573
- #line 119 "./src/util/custom-aggregate.lzz"
574
- v8::Global <v8::Function> const result;
575
- #line 120 "./src/util/custom-aggregate.lzz"
576
- v8::Global <v8::Value> const start;
577
- };
578
- #line 1 "./src/util/custom-table.lzz"
579
- class CustomTable
580
- {
581
- #line 2 "./src/util/custom-table.lzz"
582
- public:
583
- #line 4 "./src/util/custom-table.lzz"
584
- explicit CustomTable (v8::Isolate * isolate, Database * db, char const * name, v8::Local <v8::Function> factory);
585
- #line 16 "./src/util/custom-table.lzz"
586
- static void Destructor (void * self);
587
- #line 20 "./src/util/custom-table.lzz"
588
- static sqlite3_module MODULE;
589
- #line 47 "./src/util/custom-table.lzz"
590
- static sqlite3_module EPONYMOUS_MODULE;
591
- #line 74 "./src/util/custom-table.lzz"
592
- private:
593
- #line 77 "./src/util/custom-table.lzz"
594
- class VTab
595
- {
596
- #line 77 "./src/util/custom-table.lzz"
597
- friend class CustomTable;
598
- #line 78 "./src/util/custom-table.lzz"
599
- explicit VTab (CustomTable * parent, v8::Local <v8::Function> generator, std::vector <std::string> parameter_names, bool safe_ints);
600
- #line 92 "./src/util/custom-table.lzz"
601
- static CustomTable::VTab * Upcast (sqlite3_vtab * vtab);
602
- #line 96 "./src/util/custom-table.lzz"
603
- sqlite3_vtab * Downcast ();
604
- #line 100 "./src/util/custom-table.lzz"
605
- sqlite3_vtab base;
606
- #line 101 "./src/util/custom-table.lzz"
607
- CustomTable * const parent;
608
- #line 102 "./src/util/custom-table.lzz"
609
- int const parameter_count;
610
- #line 103 "./src/util/custom-table.lzz"
611
- bool const safe_ints;
612
- #line 104 "./src/util/custom-table.lzz"
613
- v8::Global <v8::Function> const generator;
614
- #line 105 "./src/util/custom-table.lzz"
615
- std::vector <std::string> const parameter_names;
616
- };
617
- #line 109 "./src/util/custom-table.lzz"
618
- class Cursor
619
- {
620
- #line 109 "./src/util/custom-table.lzz"
621
- friend class CustomTable;
622
- #line 110 "./src/util/custom-table.lzz"
623
- static CustomTable::Cursor * Upcast (sqlite3_vtab_cursor * cursor);
624
- #line 114 "./src/util/custom-table.lzz"
625
- sqlite3_vtab_cursor * Downcast ();
626
- #line 118 "./src/util/custom-table.lzz"
627
- CustomTable::VTab * GetVTab ();
628
- #line 122 "./src/util/custom-table.lzz"
629
- sqlite3_vtab_cursor base;
630
- #line 123 "./src/util/custom-table.lzz"
631
- v8::Global <v8::Object> iterator;
632
- #line 124 "./src/util/custom-table.lzz"
633
- v8::Global <v8::Function> next;
634
- #line 125 "./src/util/custom-table.lzz"
635
- v8::Global <v8::Array> row;
636
- #line 126 "./src/util/custom-table.lzz"
637
- bool done;
638
- #line 127 "./src/util/custom-table.lzz"
639
- sqlite_int64 rowid;
640
- };
641
- #line 131 "./src/util/custom-table.lzz"
642
- class TempDataConverter : DataConverter
643
- {
644
- #line 131 "./src/util/custom-table.lzz"
645
- friend class CustomTable;
646
- #line 132 "./src/util/custom-table.lzz"
647
- explicit TempDataConverter (CustomTable * parent);
648
- #line 136 "./src/util/custom-table.lzz"
649
- void PropagateJSError (sqlite3_context * invocation);
650
- #line 141 "./src/util/custom-table.lzz"
651
- std::string GetDataErrorPrefix ();
652
- #line 145 "./src/util/custom-table.lzz"
653
- CustomTable * const parent;
654
- #line 146 "./src/util/custom-table.lzz"
655
- int status;
656
- };
657
- #line 151 "./src/util/custom-table.lzz"
658
- static int xCreate (sqlite3 * db_handle, void * _self, int argc, char const * const * argv, sqlite3_vtab * * output, char * * errOutput);
659
- #line 156 "./src/util/custom-table.lzz"
660
- static int xConnect (sqlite3 * db_handle, void * _self, int argc, char const * const * argv, sqlite3_vtab * * output, char * * errOutput);
661
- #line 210 "./src/util/custom-table.lzz"
662
- static int xDisconnect (sqlite3_vtab * vtab);
663
- #line 215 "./src/util/custom-table.lzz"
664
- static int xOpen (sqlite3_vtab * vtab, sqlite3_vtab_cursor * * output);
665
- #line 220 "./src/util/custom-table.lzz"
666
- static int xClose (sqlite3_vtab_cursor * cursor);
667
- #line 228 "./src/util/custom-table.lzz"
668
- static int xFilter (sqlite3_vtab_cursor * _cursor, int idxNum, char const * idxStr, int argc, sqlite3_value * * argv);
669
- #line 284 "./src/util/custom-table.lzz"
670
- static int xNext (sqlite3_vtab_cursor * _cursor);
671
- #line 313 "./src/util/custom-table.lzz"
672
- static int xEof (sqlite3_vtab_cursor * cursor);
673
- #line 318 "./src/util/custom-table.lzz"
674
- static int xColumn (sqlite3_vtab_cursor * _cursor, sqlite3_context * invocation, int column);
675
- #line 336 "./src/util/custom-table.lzz"
676
- static int xRowid (sqlite3_vtab_cursor * cursor, sqlite_int64 * output);
677
- #line 343 "./src/util/custom-table.lzz"
678
- static int xBestIndex (sqlite3_vtab * vtab, sqlite3_index_info * output);
679
- #line 394 "./src/util/custom-table.lzz"
680
- void PropagateJSError ();
681
- #line 399 "./src/util/custom-table.lzz"
682
- Addon * const addon;
683
- #line 400 "./src/util/custom-table.lzz"
684
- v8::Isolate * const isolate;
685
- #line 401 "./src/util/custom-table.lzz"
686
- Database * const db;
687
- #line 402 "./src/util/custom-table.lzz"
688
- std::string const name;
689
- #line 403 "./src/util/custom-table.lzz"
690
- v8::Global <v8::Function> const factory;
691
- };
692
- #line 65 "./src/util/data.lzz"
693
- namespace Data
694
- {
695
- #line 72 "./src/util/data.lzz"
696
- v8::Local <v8::Value> GetValueJS (v8::Isolate * isolate, sqlite3_stmt * handle, int column, bool safe_ints);
697
- }
698
- #line 65 "./src/util/data.lzz"
699
- namespace Data
700
- {
701
- #line 76 "./src/util/data.lzz"
702
- v8::Local <v8::Value> GetValueJS (v8::Isolate * isolate, sqlite3_value * value, bool safe_ints);
703
- }
704
- #line 65 "./src/util/data.lzz"
705
- namespace Data
706
- {
707
- #line 80 "./src/util/data.lzz"
708
- v8::Local <v8::Value> GetFlatRowJS (v8::Isolate * isolate, v8::Local <v8::Context> ctx, sqlite3_stmt * handle, bool safe_ints);
709
- }
710
- #line 65 "./src/util/data.lzz"
711
- namespace Data
712
- {
713
- #line 91 "./src/util/data.lzz"
714
- v8::Local <v8::Value> GetExpandedRowJS (v8::Isolate * isolate, v8::Local <v8::Context> ctx, sqlite3_stmt * handle, bool safe_ints);
715
- }
716
- #line 65 "./src/util/data.lzz"
717
- namespace Data
718
- {
719
- #line 110 "./src/util/data.lzz"
720
- v8::Local <v8::Value> GetRawRowJS (v8::Isolate * isolate, v8::Local <v8::Context> ctx, sqlite3_stmt * handle, bool safe_ints);
721
- }
722
- #line 65 "./src/util/data.lzz"
723
- namespace Data
724
- {
725
- #line 119 "./src/util/data.lzz"
726
- v8::Local <v8::Value> GetRowJS (v8::Isolate * isolate, v8::Local <v8::Context> ctx, sqlite3_stmt * handle, bool safe_ints, char mode);
727
- }
728
- #line 65 "./src/util/data.lzz"
729
- namespace Data
730
- {
731
- #line 128 "./src/util/data.lzz"
732
- void GetArgumentsJS (v8::Isolate * isolate, v8::Local <v8::Value> * out, sqlite3_value * * values, int argument_count, bool safe_ints);
733
- }
734
- #line 65 "./src/util/data.lzz"
735
- namespace Data
736
- {
737
- #line 135 "./src/util/data.lzz"
738
- int BindValueFromJS (v8::Isolate * isolate, sqlite3_stmt * handle, int index, v8::Local <v8::Value> value);
739
- }
740
- #line 65 "./src/util/data.lzz"
741
- namespace Data
742
- {
743
- #line 140 "./src/util/data.lzz"
744
- void ResultValueFromJS (v8::Isolate * isolate, sqlite3_context * invocation, v8::Local <v8::Value> value, DataConverter * converter);
745
- }
746
- #line 1 "./src/util/binder.lzz"
747
- class Binder
748
- {
749
- #line 2 "./src/util/binder.lzz"
750
- public:
751
- #line 4 "./src/util/binder.lzz"
752
- explicit Binder (sqlite3_stmt * _handle);
753
- #line 11 "./src/util/binder.lzz"
754
- bool Bind (v8::FunctionCallbackInfo <v8 :: Value> const & info, int argc, Statement * stmt);
755
- #line 28 "./src/util/binder.lzz"
756
- private:
757
- #line 30 "./src/util/binder.lzz"
758
- struct Result
759
- {
760
- #line 31 "./src/util/binder.lzz"
761
- int count;
762
- #line 32 "./src/util/binder.lzz"
763
- bool bound_object;
764
- };
765
- #line 55 "./src/util/binder.lzz"
766
- void Fail (void (* Throw) (char const *), char const * message);
767
- #line 63 "./src/util/binder.lzz"
768
- int NextAnonIndex ();
769
- #line 69 "./src/util/binder.lzz"
770
- void BindValue (v8::Isolate * isolate, v8::Local <v8::Value> value, int index);
771
- #line 90 "./src/util/binder.lzz"
772
- int BindArray (v8::Isolate * isolate, v8::Local <v8::Array> arr);
773
- #line 116 "./src/util/binder.lzz"
774
- int BindObject (v8::Isolate * isolate, v8::Local <v8::Object> obj, Statement * stmt);
775
- #line 160 "./src/util/binder.lzz"
776
- Result BindArgs (v8::FunctionCallbackInfo <v8 :: Value> const & info, int argc, Statement * stmt);
777
- #line 200 "./src/util/binder.lzz"
778
- sqlite3_stmt * handle;
779
- #line 201 "./src/util/binder.lzz"
780
- int param_count;
781
- #line 202 "./src/util/binder.lzz"
782
- int anon_index;
783
- #line 203 "./src/util/binder.lzz"
784
- bool success;
785
- };
786
- #line 34 "./src/better_sqlite3.lzz"
787
- struct Addon
788
- {
789
- #line 35 "./src/better_sqlite3.lzz"
790
- static void JS_setErrorConstructor (v8::FunctionCallbackInfo <v8 :: Value> const & info);
791
- #line 40 "./src/better_sqlite3.lzz"
792
- static void Cleanup (void * ptr);
793
- #line 47 "./src/better_sqlite3.lzz"
794
- explicit Addon (v8::Isolate * isolate);
795
- #line 52 "./src/better_sqlite3.lzz"
796
- sqlite3_uint64 NextId ();
797
- #line 56 "./src/better_sqlite3.lzz"
798
- v8::Global <v8::Function> Statement;
799
- #line 57 "./src/better_sqlite3.lzz"
800
- v8::Global <v8::Function> StatementIterator;
801
- #line 58 "./src/better_sqlite3.lzz"
802
- v8::Global <v8::Function> Backup;
803
- #line 59 "./src/better_sqlite3.lzz"
804
- v8::Global <v8::Function> SqliteError;
805
- #line 60 "./src/better_sqlite3.lzz"
806
- v8::FunctionCallbackInfo <v8 :: Value> const * privileged_info;
807
- #line 61 "./src/better_sqlite3.lzz"
808
- sqlite3_uint64 next_id;
809
- #line 62 "./src/better_sqlite3.lzz"
810
- CS cs;
811
- #line 63 "./src/better_sqlite3.lzz"
812
- std::set <Database*, Database::CompareDatabase> dbs;
813
- };
814
- #line 20 "./src/util/macros.lzz"
815
- LZZ_INLINE v8::Local <v8::String> StringFromUtf8 (v8::Isolate * isolate, char const * data, int length)
816
- #line 20 "./src/util/macros.lzz"
817
- {
818
- return v8::String::NewFromUtf8(isolate, data, v8::NewStringType::kNormal, length).ToLocalChecked();
819
- }
820
- #line 23 "./src/util/macros.lzz"
821
- LZZ_INLINE v8::Local <v8::String> InternalizedFromUtf8 (v8::Isolate * isolate, char const * data, int length)
822
- #line 23 "./src/util/macros.lzz"
823
- {
824
- return v8::String::NewFromUtf8(isolate, data, v8::NewStringType::kInternalized, length).ToLocalChecked();
825
- }
826
- #line 26 "./src/util/macros.lzz"
827
- LZZ_INLINE v8::Local <v8::Value> InternalizedFromUtf8OrNull (v8::Isolate * isolate, char const * data, int length)
828
- #line 26 "./src/util/macros.lzz"
829
- {
830
- if (data == NULL) return v8::Null(isolate);
831
- return InternalizedFromUtf8(isolate, data, length);
832
- }
833
- #line 30 "./src/util/macros.lzz"
834
- LZZ_INLINE v8::Local <v8::String> InternalizedFromLatin1 (v8::Isolate * isolate, char const * str)
835
- #line 30 "./src/util/macros.lzz"
836
- {
837
- return v8::String::NewFromOneByte(isolate, reinterpret_cast<const uint8_t*>(str), v8::NewStringType::kInternalized).ToLocalChecked();
838
- }
839
- #line 34 "./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 34 "./src/util/macros.lzz"
842
- {
843
- obj->DefineOwnProperty(ctx, key.Get(isolate), value, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly)).FromJust();
844
- }
845
- #line 92 "./src/util/macros.lzz"
846
- LZZ_INLINE bool IS_SKIPPED (char c)
847
- #line 92 "./src/util/macros.lzz"
848
- {
849
- return c == ' ' || c == ';' || (c >= '\t' && c <= '\r');
850
- }
851
- #line 97 "./src/util/macros.lzz"
852
- template <typename T>
853
- #line 97 "./src/util/macros.lzz"
854
- LZZ_INLINE T * ALLOC_ARRAY (size_t count)
855
- #line 97 "./src/util/macros.lzz"
856
- {
857
- return static_cast<T*>(::operator new[](count * sizeof(T)));
858
- }
859
- #line 102 "./src/util/macros.lzz"
860
- template <typename T>
861
- #line 102 "./src/util/macros.lzz"
862
- LZZ_INLINE void FREE_ARRAY (T * array_pointer)
863
- #line 102 "./src/util/macros.lzz"
864
- {
865
- ::operator delete[](array_pointer);
866
- }
867
- #line 9 "./src/util/bind-map.lzz"
868
- LZZ_INLINE int BindMap::Pair::GetIndex ()
869
- #line 9 "./src/util/bind-map.lzz"
870
- {
871
- return index;
872
- }
873
- #line 13 "./src/util/bind-map.lzz"
874
- LZZ_INLINE v8::Local <v8::String> BindMap::Pair::GetName (v8::Isolate * isolate)
875
- #line 13 "./src/util/bind-map.lzz"
876
- {
877
- return name.Get(isolate);
878
- }
879
- #line 41 "./src/util/bind-map.lzz"
880
- LZZ_INLINE BindMap::Pair * BindMap::GetPairs ()
881
- #line 41 "./src/util/bind-map.lzz"
882
- {
883
- return pairs;
884
- }
885
- #line 45 "./src/util/bind-map.lzz"
886
- LZZ_INLINE int BindMap::GetSize ()
887
- #line 45 "./src/util/bind-map.lzz"
888
- {
889
- return length;
890
- }
891
- #line 79 "./src/objects/database.lzz"
892
- LZZ_INLINE void Database::AddStatement (Statement * stmt)
893
- #line 79 "./src/objects/database.lzz"
894
- { stmts.insert(stmts.end(), stmt);
895
- }
896
- #line 80 "./src/objects/database.lzz"
897
- LZZ_INLINE void Database::RemoveStatement (Statement * stmt)
898
- #line 80 "./src/objects/database.lzz"
899
- { stmts.erase(stmt);
900
- }
901
- #line 83 "./src/objects/database.lzz"
902
- LZZ_INLINE void Database::AddBackup (Backup * backup)
903
- #line 83 "./src/objects/database.lzz"
904
- { backups.insert(backups.end(), backup);
905
- }
906
- #line 84 "./src/objects/database.lzz"
907
- LZZ_INLINE void Database::RemoveBackup (Backup * backup)
908
- #line 84 "./src/objects/database.lzz"
909
- { backups.erase(backup);
910
- }
911
- #line 98 "./src/objects/database.lzz"
912
- LZZ_INLINE Database::State * Database::GetState ()
913
- #line 98 "./src/objects/database.lzz"
914
- {
915
- return reinterpret_cast<State*>(&open);
916
- }
917
- #line 101 "./src/objects/database.lzz"
918
- LZZ_INLINE sqlite3 * Database::GetHandle ()
919
- #line 101 "./src/objects/database.lzz"
920
- {
921
- return db_handle;
922
- }
923
- #line 104 "./src/objects/database.lzz"
924
- LZZ_INLINE Addon * Database::GetAddon ()
925
- #line 104 "./src/objects/database.lzz"
926
- {
927
- return addon;
928
- }
929
- #line 21 "./src/objects/statement.lzz"
930
- LZZ_INLINE bool Statement::Compare (Statement const * const a, Statement const * const b)
931
- #line 21 "./src/objects/statement.lzz"
932
- {
933
- return a->extras->id < b->extras->id;
934
- }
935
- #line 119 "./src/objects/statement-iterator.lzz"
936
- LZZ_INLINE v8::Local <v8::Object> StatementIterator::NewRecord (v8::Isolate * isolate, v8::Local <v8::Context> ctx, v8::Local <v8::Value> value, Addon * addon, bool done)
937
- #line 119 "./src/objects/statement-iterator.lzz"
938
- {
939
- v8::Local<v8::Object> record = v8::Object::New(isolate);
940
- record->Set(ctx, addon->cs.value.Get(isolate), value).FromJust();
941
- record->Set(ctx, addon->cs.done.Get(isolate), v8::Boolean::New(isolate, done)).FromJust();
942
- return record;
943
- }
944
- #line 126 "./src/objects/statement-iterator.lzz"
945
- LZZ_INLINE v8::Local <v8::Object> StatementIterator::DoneRecord (v8::Isolate * isolate, Addon * addon)
946
- #line 126 "./src/objects/statement-iterator.lzz"
947
- {
948
- return NewRecord(isolate, isolate -> GetCurrentContext ( ) , v8::Undefined(isolate), addon, true);
949
- }
950
- #line 12 "./src/objects/backup.lzz"
951
- LZZ_INLINE bool Backup::Compare (Backup const * const a, Backup const * const b)
952
- #line 12 "./src/objects/backup.lzz"
953
- {
954
- return a->id < b->id;
955
- }
956
- #line 39 "./src/util/custom-aggregate.lzz"
957
- LZZ_INLINE void CustomAggregate::xStepBase (sqlite3_context * invocation, int argc, sqlite3_value * * argv, v8::Global <v8::Function> const CustomAggregate::* ptrtm)
958
- #line 39 "./src/util/custom-aggregate.lzz"
959
- {
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 ;
961
-
962
- v8::Local<v8::Value> args_fast[5];
963
- v8::Local<v8::Value>* args = argc <= 4 ? args_fast : ALLOC_ARRAY<v8::Local<v8::Value>>(argc + 1);
964
- args[0] = acc->value.Get(isolate);
965
- if (argc != 0) Data::GetArgumentsJS(isolate, args + 1, argv, argc, self->safe_ints);
966
-
967
- v8::MaybeLocal<v8::Value> maybeReturnValue = (self->*ptrtm).Get(isolate)->Call( isolate -> GetCurrentContext ( ) , v8::Undefined(isolate), argc + 1, args);
968
- if (args != args_fast) delete[] args;
969
-
970
- if (maybeReturnValue.IsEmpty()) {
971
- self->PropagateJSError(invocation);
972
- } else {
973
- v8::Local<v8::Value> returnValue = maybeReturnValue.ToLocalChecked();
974
- if (!returnValue->IsUndefined()) acc->value.Reset(isolate, returnValue);
975
- }
976
- }
977
- #line 58 "./src/util/custom-aggregate.lzz"
978
- LZZ_INLINE void CustomAggregate::xValueBase (sqlite3_context * invocation, bool is_final)
979
- #line 58 "./src/util/custom-aggregate.lzz"
980
- {
981
- 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 ;
982
-
983
- if (!is_final) {
984
- acc->is_window = true;
985
- } else if (acc->is_window) {
986
- DestroyAccumulator(invocation);
987
- return;
988
- }
989
-
990
- v8::Local<v8::Value> result = acc->value.Get(isolate);
991
- if (self->invoke_result) {
992
- v8::MaybeLocal<v8::Value> maybeResult = self->result.Get(isolate)->Call( isolate -> GetCurrentContext ( ) , v8::Undefined(isolate), 1, &result);
993
- if (maybeResult.IsEmpty()) {
994
- self->PropagateJSError(invocation);
995
- return;
996
- }
997
- result = maybeResult.ToLocalChecked();
998
- }
999
-
1000
- Data::ResultValueFromJS(isolate, invocation, result, self);
1001
- if (is_final) DestroyAccumulator(invocation);
1002
- }
1003
- #line 92 "./src/util/custom-table.lzz"
1004
- LZZ_INLINE CustomTable::VTab * CustomTable::VTab::Upcast (sqlite3_vtab * vtab)
1005
- #line 92 "./src/util/custom-table.lzz"
1006
- {
1007
- return reinterpret_cast<VTab*>(vtab);
1008
- }
1009
- #line 96 "./src/util/custom-table.lzz"
1010
- LZZ_INLINE sqlite3_vtab * CustomTable::VTab::Downcast ()
1011
- #line 96 "./src/util/custom-table.lzz"
1012
- {
1013
- return reinterpret_cast<sqlite3_vtab*>(this);
1014
- }
1015
- #line 110 "./src/util/custom-table.lzz"
1016
- LZZ_INLINE CustomTable::Cursor * CustomTable::Cursor::Upcast (sqlite3_vtab_cursor * cursor)
1017
- #line 110 "./src/util/custom-table.lzz"
1018
- {
1019
- return reinterpret_cast<Cursor*>(cursor);
1020
- }
1021
- #line 114 "./src/util/custom-table.lzz"
1022
- LZZ_INLINE sqlite3_vtab_cursor * CustomTable::Cursor::Downcast ()
1023
- #line 114 "./src/util/custom-table.lzz"
1024
- {
1025
- return reinterpret_cast<sqlite3_vtab_cursor*>(this);
1026
- }
1027
- #line 118 "./src/util/custom-table.lzz"
1028
- LZZ_INLINE CustomTable::VTab * CustomTable::Cursor::GetVTab ()
1029
- #line 118 "./src/util/custom-table.lzz"
1030
- {
1031
- return VTab::Upcast(base.pVtab);
1032
- }
1033
- #line 52 "./src/better_sqlite3.lzz"
1034
- LZZ_INLINE sqlite3_uint64 Addon::NextId ()
1035
- #line 52 "./src/better_sqlite3.lzz"
1036
- {
1037
- return next_id++;
1038
- }
1039
- #undef LZZ_INLINE
1040
- #endif