@op-engineering/op-sqlite 6.0.1 → 6.0.2-beta1
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/cpp/DBHostObject.cpp +755 -0
- package/cpp/DBHostObject.h +56 -0
- package/cpp/PreparedStatementHostObject.cpp +1 -1
- package/cpp/bindings.cpp +20 -614
- package/cpp/bindings.h +3 -2
- package/cpp/bridge.cpp +10 -16
- package/cpp/bridge.h +2 -1
- package/cpp/sqlbatchexecutor.cpp +2 -2
- package/cpp/utils.cpp +24 -4
- package/cpp/utils.h +3 -2
- package/lib/commonjs/index.js +139 -152
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +139 -152
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +24 -39
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +196 -272
package/cpp/bridge.cpp
CHANGED
|
@@ -397,13 +397,11 @@ opsqlite_execute(std::string const &dbName, std::string const &query,
|
|
|
397
397
|
|
|
398
398
|
if (statementStatus != SQLITE_OK) {
|
|
399
399
|
const char *message = sqlite3_errmsg(db);
|
|
400
|
-
return {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
". See error codes: https://www.sqlite.org/rescode.html",
|
|
406
|
-
};
|
|
400
|
+
return {.type = SQLiteError,
|
|
401
|
+
.message =
|
|
402
|
+
"[op-sqlite] SQL statement error on opsqlite_execute:\n" +
|
|
403
|
+
std::to_string(statementStatus) + " description:\n" +
|
|
404
|
+
std::string(message)};
|
|
407
405
|
}
|
|
408
406
|
|
|
409
407
|
// The statement did not fail to parse but there is nothing to do, just
|
|
@@ -529,9 +527,7 @@ opsqlite_execute(std::string const &dbName, std::string const &query,
|
|
|
529
527
|
return {.type = SQLiteError,
|
|
530
528
|
.message =
|
|
531
529
|
"[op-sqlite] SQLite error code: " + std::to_string(result) +
|
|
532
|
-
", description: " + std::string(errorMessage)
|
|
533
|
-
".\nSee SQLite error codes reference: "
|
|
534
|
-
"https://www.sqlite.org/rescode.html"};
|
|
530
|
+
", description: " + std::string(errorMessage)};
|
|
535
531
|
}
|
|
536
532
|
|
|
537
533
|
int changedRowCount = sqlite3_changes(db);
|
|
@@ -575,8 +571,7 @@ opsqlite_execute_raw(std::string const &dbName, std::string const &query,
|
|
|
575
571
|
.type = SQLiteError,
|
|
576
572
|
.message = "[op-sqlite] SQL statement error:" +
|
|
577
573
|
std::to_string(statementStatus) +
|
|
578
|
-
" description:" + std::string(message)
|
|
579
|
-
". See error codes: https://www.sqlite.org/rescode.html",
|
|
574
|
+
" description:" + std::string(message),
|
|
580
575
|
};
|
|
581
576
|
}
|
|
582
577
|
|
|
@@ -686,9 +681,7 @@ opsqlite_execute_raw(std::string const &dbName, std::string const &query,
|
|
|
686
681
|
return {.type = SQLiteError,
|
|
687
682
|
.message =
|
|
688
683
|
"[op-sqlite] SQLite error code: " + std::to_string(step) +
|
|
689
|
-
", description: " + std::string(errorMessage)
|
|
690
|
-
".\nSee SQLite error codes reference: "
|
|
691
|
-
"https://www.sqlite.org/rescode.html"};
|
|
684
|
+
", description: " + std::string(errorMessage)};
|
|
692
685
|
}
|
|
693
686
|
|
|
694
687
|
int changedRowCount = sqlite3_changes(db);
|
|
@@ -843,7 +836,8 @@ BridgeResult opsqlite_deregister_rollback_hook(std::string const &dbName) {
|
|
|
843
836
|
return {SQLiteOk};
|
|
844
837
|
}
|
|
845
838
|
|
|
846
|
-
BridgeResult opsqlite_load_extension(std::string &db_name,
|
|
839
|
+
BridgeResult opsqlite_load_extension(std::string const &db_name,
|
|
840
|
+
std::string &path,
|
|
847
841
|
std::string &entry_point) {
|
|
848
842
|
#ifdef OP_SQLITE_USE_PHONE_VERSION
|
|
849
843
|
throw std::runtime_error(
|
package/cpp/bridge.h
CHANGED
|
@@ -78,7 +78,8 @@ BridgeResult opsqlite_execute_prepared_statement(
|
|
|
78
78
|
std::vector<DumbHostObject> *results,
|
|
79
79
|
std::shared_ptr<std::vector<SmartHostObject>> metadatas);
|
|
80
80
|
|
|
81
|
-
BridgeResult opsqlite_load_extension(std::string &db_name,
|
|
81
|
+
BridgeResult opsqlite_load_extension(std::string const &db_name,
|
|
82
|
+
std::string &path,
|
|
82
83
|
std::string &entry_point);
|
|
83
84
|
|
|
84
85
|
} // namespace opsqlite
|
package/cpp/sqlbatchexecutor.cpp
CHANGED
|
@@ -34,12 +34,12 @@ void toBatchArguments(jsi::Runtime &rt, jsi::Array const &batchParams,
|
|
|
34
34
|
for (int x = 0; x < batchUpdateParams.length(rt); x++) {
|
|
35
35
|
const jsi::Value &p = batchUpdateParams.getValueAtIndex(rt, x);
|
|
36
36
|
auto params =
|
|
37
|
-
std::make_shared<std::vector<JSVariant>>(
|
|
37
|
+
std::make_shared<std::vector<JSVariant>>(to_variant_vec(rt, p));
|
|
38
38
|
commands->push_back({query, params});
|
|
39
39
|
}
|
|
40
40
|
} else {
|
|
41
41
|
auto params = std::make_shared<std::vector<JSVariant>>(
|
|
42
|
-
|
|
42
|
+
to_variant_vec(rt, commandParams));
|
|
43
43
|
commands->push_back({query, params});
|
|
44
44
|
}
|
|
45
45
|
}
|
package/cpp/utils.cpp
CHANGED
|
@@ -79,15 +79,35 @@ JSVariant toVariant(jsi::Runtime &rt, const jsi::Value &value) {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
std::vector<
|
|
83
|
-
|
|
82
|
+
std::vector<std::string> to_string_vec(jsi::Runtime &rt, jsi::Value const &xs) {
|
|
83
|
+
|
|
84
|
+
jsi::Array values = xs.asObject(rt).asArray(rt);
|
|
85
|
+
std::vector<std::string> res;
|
|
86
|
+
for (int ii = 0; ii < values.length(rt); ii++) {
|
|
87
|
+
std::string value = values.getValueAtIndex(rt, ii).asString(rt).utf8(rt);
|
|
88
|
+
res.push_back(value);
|
|
89
|
+
}
|
|
90
|
+
return res;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
std::vector<int> to_int_vec(jsi::Runtime &rt, jsi::Value const &xs) {
|
|
94
|
+
jsi::Array values = xs.asObject(rt).asArray(rt);
|
|
95
|
+
std::vector<int> res;
|
|
96
|
+
for (int ii = 0; ii < values.length(rt); ii++) {
|
|
97
|
+
int value = static_cast<int>(values.getValueAtIndex(rt, ii).asNumber());
|
|
98
|
+
res.push_back(value);
|
|
99
|
+
}
|
|
100
|
+
return res;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
std::vector<JSVariant> to_variant_vec(jsi::Runtime &rt, jsi::Value const &xs) {
|
|
84
104
|
std::vector<JSVariant> res;
|
|
85
105
|
|
|
86
|
-
if (
|
|
106
|
+
if (xs.isNull() || xs.isUndefined()) {
|
|
87
107
|
return res;
|
|
88
108
|
}
|
|
89
109
|
|
|
90
|
-
jsi::Array values =
|
|
110
|
+
jsi::Array values = xs.asObject(rt).asArray(rt);
|
|
91
111
|
|
|
92
112
|
for (int ii = 0; ii < values.length(rt); ii++) {
|
|
93
113
|
jsi::Value value = values.getValueAtIndex(rt, ii);
|
package/cpp/utils.h
CHANGED
|
@@ -18,8 +18,9 @@ namespace jsi = facebook::jsi;
|
|
|
18
18
|
jsi::Value toJSI(jsi::Runtime &rt, JSVariant value);
|
|
19
19
|
|
|
20
20
|
JSVariant toVariant(jsi::Runtime &rt, jsi::Value const &value);
|
|
21
|
-
|
|
22
|
-
std::vector<JSVariant>
|
|
21
|
+
std::vector<std::string> to_string_vec(jsi::Runtime &rt, jsi::Value const &xs);
|
|
22
|
+
std::vector<JSVariant> to_variant_vec(jsi::Runtime &rt, jsi::Value const &xs);
|
|
23
|
+
std::vector<int> to_int_vec(jsi::Runtime &rt, jsi::Value const &xs);
|
|
23
24
|
|
|
24
25
|
jsi::Value createResult(jsi::Runtime &rt, BridgeResult status,
|
|
25
26
|
std::vector<DumbHostObject> *results,
|
package/lib/commonjs/index.js
CHANGED
|
@@ -91,175 +91,162 @@ function enhanceQueryResult(result) {
|
|
|
91
91
|
result.rows.item = idx => result.rows?._array[idx];
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
const
|
|
95
|
-
OPSQLite.open
|
|
96
|
-
|
|
97
|
-
locks[options.name] = {
|
|
94
|
+
const open = options => {
|
|
95
|
+
const db = OPSQLite.open(options);
|
|
96
|
+
const lock = {
|
|
98
97
|
queue: [],
|
|
99
98
|
inProgress: false
|
|
100
99
|
};
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
delete locks[dbName];
|
|
106
|
-
};
|
|
107
|
-
const _execute = OPSQLite.execute;
|
|
108
|
-
OPSQLite.execute = (dbName, query, params) => {
|
|
109
|
-
const sanitizedParams = params?.map(p => {
|
|
110
|
-
if (ArrayBuffer.isView(p)) {
|
|
111
|
-
return p.buffer;
|
|
100
|
+
const startNextTransaction = () => {
|
|
101
|
+
if (lock.inProgress) {
|
|
102
|
+
// Transaction is already in process bail out
|
|
103
|
+
return;
|
|
112
104
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (ArrayBuffer.isView(p)) {
|
|
123
|
-
return p.buffer;
|
|
105
|
+
if (lock.queue.length) {
|
|
106
|
+
lock.inProgress = true;
|
|
107
|
+
const tx = lock.queue.shift();
|
|
108
|
+
if (!tx) {
|
|
109
|
+
throw new Error('Could not get a operation on database');
|
|
110
|
+
}
|
|
111
|
+
setImmediate(() => {
|
|
112
|
+
tx.start();
|
|
113
|
+
});
|
|
124
114
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// spreading the object is not working, so we need to do it manually
|
|
118
|
+
let enhancedDb = {
|
|
119
|
+
delete: db.delete,
|
|
120
|
+
attach: db.attach,
|
|
121
|
+
detach: db.detach,
|
|
122
|
+
executeBatch: db.executeBatch,
|
|
123
|
+
executeBatchAsync: db.executeBatchAsync,
|
|
124
|
+
loadFile: db.loadFile,
|
|
125
|
+
updateHook: db.updateHook,
|
|
126
|
+
commitHook: db.commitHook,
|
|
127
|
+
rollbackHook: db.rollbackHook,
|
|
128
|
+
loadExtension: db.loadExtension,
|
|
129
|
+
executeRawAsync: db.executeRawAsync,
|
|
130
|
+
getDbPath: db.getDbPath,
|
|
131
|
+
reactiveExecute: db.reactiveExecute,
|
|
132
|
+
close: () => {
|
|
133
|
+
db.close();
|
|
134
|
+
delete locks[options.name];
|
|
135
|
+
},
|
|
136
|
+
execute: (query, params) => {
|
|
137
|
+
const sanitizedParams = params?.map(p => {
|
|
137
138
|
if (ArrayBuffer.isView(p)) {
|
|
138
139
|
return p.buffer;
|
|
139
140
|
}
|
|
140
141
|
return p;
|
|
141
142
|
});
|
|
142
|
-
|
|
143
|
+
const result = db.execute(query, sanitizedParams);
|
|
144
|
+
enhanceQueryResult(result);
|
|
145
|
+
return result;
|
|
143
146
|
},
|
|
144
|
-
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
};
|
|
151
|
-
OPSQLite.transaction = async (dbName, fn) => {
|
|
152
|
-
if (!locks[dbName]) {
|
|
153
|
-
throw Error(`SQLite Error: No lock found on db: ${dbName}`);
|
|
154
|
-
}
|
|
155
|
-
let isFinalized = false;
|
|
156
|
-
|
|
157
|
-
// Local transaction context object implementation
|
|
158
|
-
const execute = (query, params) => {
|
|
159
|
-
if (isFinalized) {
|
|
160
|
-
throw Error(`SQLite Error: Cannot execute query on finalized transaction: ${dbName}`);
|
|
161
|
-
}
|
|
162
|
-
return OPSQLite.execute(dbName, query, params);
|
|
163
|
-
};
|
|
164
|
-
const executeAsync = (query, params) => {
|
|
165
|
-
if (isFinalized) {
|
|
166
|
-
throw Error(`SQLite Error: Cannot execute query on finalized transaction: ${dbName}`);
|
|
167
|
-
}
|
|
168
|
-
return OPSQLite.executeAsync(dbName, query, params);
|
|
169
|
-
};
|
|
170
|
-
const commit = () => {
|
|
171
|
-
if (isFinalized) {
|
|
172
|
-
throw Error(`SQLite Error: Cannot execute commit on finalized transaction: ${dbName}`);
|
|
173
|
-
}
|
|
174
|
-
const result = OPSQLite.execute(dbName, 'COMMIT');
|
|
175
|
-
isFinalized = true;
|
|
176
|
-
return result;
|
|
177
|
-
};
|
|
178
|
-
const rollback = () => {
|
|
179
|
-
if (isFinalized) {
|
|
180
|
-
throw Error(`SQLite Error: Cannot execute rollback on finalized transaction: ${dbName}`);
|
|
181
|
-
}
|
|
182
|
-
const result = OPSQLite.execute(dbName, 'ROLLBACK');
|
|
183
|
-
isFinalized = true;
|
|
184
|
-
return result;
|
|
185
|
-
};
|
|
186
|
-
async function run() {
|
|
187
|
-
try {
|
|
188
|
-
await OPSQLite.executeAsync(dbName, 'BEGIN TRANSACTION');
|
|
189
|
-
await fn({
|
|
190
|
-
commit,
|
|
191
|
-
execute,
|
|
192
|
-
executeAsync,
|
|
193
|
-
rollback
|
|
147
|
+
executeAsync: async (query, params) => {
|
|
148
|
+
const sanitizedParams = params?.map(p => {
|
|
149
|
+
if (ArrayBuffer.isView(p)) {
|
|
150
|
+
return p.buffer;
|
|
151
|
+
}
|
|
152
|
+
return p;
|
|
194
153
|
});
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
|
|
154
|
+
const result = await db.executeAsync(query, sanitizedParams);
|
|
155
|
+
enhanceQueryResult(result);
|
|
156
|
+
return result;
|
|
157
|
+
},
|
|
158
|
+
prepareStatement: query => {
|
|
159
|
+
const stmt = db.prepareStatement(query);
|
|
160
|
+
return {
|
|
161
|
+
bind: params => {
|
|
162
|
+
const sanitizedParams = params.map(p => {
|
|
163
|
+
if (ArrayBuffer.isView(p)) {
|
|
164
|
+
return p.buffer;
|
|
165
|
+
}
|
|
166
|
+
return p;
|
|
167
|
+
});
|
|
168
|
+
stmt.bind(sanitizedParams);
|
|
169
|
+
},
|
|
170
|
+
execute: () => {
|
|
171
|
+
const res = stmt.execute();
|
|
172
|
+
enhanceQueryResult(res);
|
|
173
|
+
return res;
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
},
|
|
177
|
+
transaction: async fn => {
|
|
178
|
+
let isFinalized = false;
|
|
179
|
+
|
|
180
|
+
// Local transaction context object implementation
|
|
181
|
+
const execute = (query, params) => {
|
|
182
|
+
if (isFinalized) {
|
|
183
|
+
throw Error(`OP-Sqlite Error: Database: ${options.name}. Cannot execute query on finalized transaction`);
|
|
184
|
+
}
|
|
185
|
+
return enhancedDb.execute(query, params);
|
|
186
|
+
};
|
|
187
|
+
const executeAsync = (query, params) => {
|
|
188
|
+
if (isFinalized) {
|
|
189
|
+
throw Error(`OP-Sqlite Error: Database: ${options.name}. Cannot execute query on finalized transaction`);
|
|
190
|
+
}
|
|
191
|
+
return enhancedDb.executeAsync(query, params);
|
|
192
|
+
};
|
|
193
|
+
const commit = () => {
|
|
194
|
+
if (isFinalized) {
|
|
195
|
+
throw Error(`OP-Sqlite Error: Database: ${options.name}. Cannot execute query on finalized transaction`);
|
|
196
|
+
}
|
|
197
|
+
const result = enhancedDb.execute('COMMIT;');
|
|
198
|
+
isFinalized = true;
|
|
199
|
+
return result;
|
|
200
|
+
};
|
|
201
|
+
const rollback = () => {
|
|
202
|
+
if (isFinalized) {
|
|
203
|
+
throw Error(`OP-Sqlite Error: Database: ${options.name}. Cannot execute query on finalized transaction`);
|
|
204
|
+
}
|
|
205
|
+
const result = enhancedDb.execute('ROLLBACK;');
|
|
206
|
+
isFinalized = true;
|
|
207
|
+
return result;
|
|
208
|
+
};
|
|
209
|
+
async function run() {
|
|
200
210
|
try {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
211
|
+
await enhancedDb.executeAsync('BEGIN TRANSACTION;');
|
|
212
|
+
await fn({
|
|
213
|
+
commit,
|
|
214
|
+
execute,
|
|
215
|
+
executeAsync,
|
|
216
|
+
rollback
|
|
217
|
+
});
|
|
218
|
+
console.warn('finished executing user function for transaction');
|
|
219
|
+
if (!isFinalized) {
|
|
220
|
+
commit();
|
|
221
|
+
}
|
|
222
|
+
} catch (executionError) {
|
|
223
|
+
console.warn('transaction error', executionError);
|
|
224
|
+
if (!isFinalized) {
|
|
225
|
+
try {
|
|
226
|
+
rollback();
|
|
227
|
+
} catch (rollbackError) {
|
|
228
|
+
throw rollbackError;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
throw executionError;
|
|
232
|
+
} finally {
|
|
233
|
+
lock.inProgress = false;
|
|
234
|
+
isFinalized = false;
|
|
235
|
+
startNextTransaction();
|
|
204
236
|
}
|
|
205
237
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
start: () => {
|
|
216
|
-
run().then(resolve).catch(reject);
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
locks[dbName].queue.push(tx);
|
|
220
|
-
startNextTransaction(dbName);
|
|
221
|
-
});
|
|
222
|
-
};
|
|
223
|
-
const startNextTransaction = dbName => {
|
|
224
|
-
if (!locks[dbName]) {
|
|
225
|
-
throw Error(`Lock not found for db: ${dbName}`);
|
|
226
|
-
}
|
|
227
|
-
if (locks[dbName].inProgress) {
|
|
228
|
-
// Transaction is already in process bail out
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
if (locks[dbName].queue.length) {
|
|
232
|
-
locks[dbName].inProgress = true;
|
|
233
|
-
const tx = locks[dbName].queue.shift();
|
|
234
|
-
if (!tx) {
|
|
235
|
-
throw new Error('Could not get a operation on datebase');
|
|
238
|
+
return await new Promise((resolve, reject) => {
|
|
239
|
+
const tx = {
|
|
240
|
+
start: () => {
|
|
241
|
+
run().then(resolve).catch(reject);
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
lock.queue.push(tx);
|
|
245
|
+
startNextTransaction();
|
|
246
|
+
});
|
|
236
247
|
}
|
|
237
|
-
setImmediate(() => {
|
|
238
|
-
tx.start();
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
const open = options => {
|
|
243
|
-
OPSQLite.open(options);
|
|
244
|
-
return {
|
|
245
|
-
close: () => OPSQLite.close(options.name),
|
|
246
|
-
delete: () => OPSQLite.delete(options.name, options.location),
|
|
247
|
-
attach: (dbNameToAttach, alias, location) => OPSQLite.attach(options.name, dbNameToAttach, alias, location),
|
|
248
|
-
detach: alias => OPSQLite.detach(options.name, alias),
|
|
249
|
-
transaction: fn => OPSQLite.transaction(options.name, fn),
|
|
250
|
-
execute: (query, params) => OPSQLite.execute(options.name, query, params),
|
|
251
|
-
executeAsync: (query, params) => OPSQLite.executeAsync(options.name, query, params),
|
|
252
|
-
executeBatch: commands => OPSQLite.executeBatch(options.name, commands),
|
|
253
|
-
executeBatchAsync: commands => OPSQLite.executeBatchAsync(options.name, commands),
|
|
254
|
-
loadFile: location => OPSQLite.loadFile(options.name, location),
|
|
255
|
-
updateHook: callback => OPSQLite.updateHook(options.name, callback),
|
|
256
|
-
commitHook: callback => OPSQLite.commitHook(options.name, callback),
|
|
257
|
-
rollbackHook: callback => OPSQLite.rollbackHook(options.name, callback),
|
|
258
|
-
prepareStatement: query => OPSQLite.prepareStatement(options.name, query),
|
|
259
|
-
loadExtension: (path, entryPoint) => OPSQLite.loadExtension(options.name, path, entryPoint),
|
|
260
|
-
executeRawAsync: (query, params) => OPSQLite.executeRawAsync(options.name, query, params),
|
|
261
|
-
getDbPath: () => OPSQLite.getDbPath(options.name, options.location)
|
|
262
248
|
};
|
|
249
|
+
return enhancedDb;
|
|
263
250
|
};
|
|
264
251
|
exports.open = open;
|
|
265
252
|
const moveAssetsDatabase = async args => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","global","__OPSQLiteProxy","NativeModules","OPSQLite","Error","install","result","proxy","exports","IOS_DOCUMENT_PATH","IOS_LIBRARY_PATH","ANDROID_DATABASE_PATH","ANDROID_FILES_PATH","ANDROID_EXTERNAL_FILES_PATH","getConstants","locks","enhanceQueryResult","rows","_array","length","item","idx","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","global","__OPSQLiteProxy","NativeModules","OPSQLite","Error","install","result","proxy","exports","IOS_DOCUMENT_PATH","IOS_LIBRARY_PATH","ANDROID_DATABASE_PATH","ANDROID_FILES_PATH","ANDROID_EXTERNAL_FILES_PATH","getConstants","locks","enhanceQueryResult","rows","_array","length","item","idx","open","options","db","lock","queue","inProgress","startNextTransaction","tx","shift","setImmediate","start","enhancedDb","delete","attach","detach","executeBatch","executeBatchAsync","loadFile","updateHook","commitHook","rollbackHook","loadExtension","executeRawAsync","getDbPath","reactiveExecute","close","name","execute","query","params","sanitizedParams","map","p","ArrayBuffer","isView","buffer","executeAsync","prepareStatement","stmt","bind","res","transaction","fn","isFinalized","commit","rollback","run","console","warn","executionError","rollbackError","Promise","resolve","reject","then","catch","push","moveAssetsDatabase","args","isSQLCipher"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AADA;;AAQA,IAAIC,MAAM,CAACC,eAAe,IAAI,IAAI,EAAE;EAClC,IAAIC,0BAAa,CAACC,QAAQ,IAAI,IAAI,EAAE;IAClC,MAAM,IAAIC,KAAK,CAAC,sDAAsD,CAAC;EACzE;EAEA,IAAIF,0BAAa,CAACC,QAAQ,CAACE,OAAO,IAAI,IAAI,EAAE;IAC1C,MAAM,IAAID,KAAK,CACb,iQACF,CAAC;EACH;;EAEA;EACA,MAAME,MAAM,GAAGJ,0BAAa,CAACC,QAAQ,CAACE,OAAO,CAAC,CAAC;EAC/C,IAAIC,MAAM,KAAK,IAAI,EAAE;IACnB,MAAM,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