@op-engineering/op-sqlite 15.0.6 → 15.1.0
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/android/CMakeLists.txt +1 -1
- package/android/build.gradle +1 -1
- package/android/cpp-adapter.cpp +1 -1
- package/android/jniLibs/arm64-v8a/libsql_experimental.a +0 -0
- package/android/jniLibs/armeabi-v7a/libsql_experimental.a +0 -0
- package/android/jniLibs/x86/libsql_experimental.a +0 -0
- package/android/jniLibs/x86_64/libsql_experimental.a +0 -0
- package/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt +7 -9
- package/cpp/DBHostObject.cpp +470 -660
- package/cpp/DBHostObject.h +56 -58
- package/cpp/DumbHostObject.cpp +1 -1
- package/cpp/DumbHostObject.h +12 -13
- package/cpp/OPSqlite.cpp +207 -0
- package/cpp/OPThreadPool.cpp +79 -79
- package/cpp/OPThreadPool.h +28 -28
- package/cpp/PreparedStatementHostObject.cpp +87 -136
- package/cpp/PreparedStatementHostObject.h +16 -28
- package/cpp/SmartHostObject.cpp +1 -1
- package/cpp/SmartHostObject.h +6 -7
- package/cpp/bridge.cpp +639 -633
- package/cpp/bridge.h +2 -2
- package/cpp/libsql/LICENSE.txt +9 -0
- package/cpp/libsql/bridge.cpp +25 -2
- package/cpp/libsql/{bridge.h → bridge.hpp} +8 -4
- package/cpp/libsql/libsql.h +4 -0
- package/cpp/macros.hpp +21 -0
- package/cpp/sqlcipher/LICENSE.txt +24 -0
- package/cpp/types.hpp +42 -0
- package/cpp/utils.cpp +320 -255
- package/cpp/{utils.h → utils.hpp} +9 -1
- package/ios/OPSQLite.mm +104 -106
- package/ios/libsql.xcframework/Info.plist +5 -5
- package/ios/libsql.xcframework/ios-arm64/Headers/libsql.h +4 -0
- package/ios/libsql.xcframework/ios-arm64/libsql_experimental.a +0 -0
- package/ios/libsql.xcframework/ios-arm64_x86_64-simulator/Headers/libsql.h +4 -0
- package/ios/libsql.xcframework/ios-arm64_x86_64-simulator/libsql_experimental.a +0 -0
- package/lib/module/functions.js +42 -33
- package/lib/module/functions.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/functions.d.ts +5 -1
- package/lib/typescript/src/functions.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +9 -1
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/op-sqlite.podspec +1 -1
- package/package.json +10 -8
- package/src/functions.ts +54 -43
- package/src/index.ts +1 -12
- package/src/types.ts +9 -1
- package/cpp/bindings.cpp +0 -202
- package/cpp/macros.h +0 -15
- package/cpp/types.h +0 -33
- /package/cpp/{bindings.h → OPSqlite.hpp} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GACd,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,WAAW,GACX,eAAe,CAAC;AAEpB;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC;IACZ,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAEpC,OAAO,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC;CAC7B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,uLAAuL;IACvL,IAAI,EAAE,MAAM,CAAC;IACb;sDACkD;IAClD,K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AAa,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,gBAAgB,EAAE,MAAM,MAAM,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,CAAC,OAAO,EAAE;QACd,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,KAAK,WAAW,CAAC;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,aAAa,CAAC,EAAE,MAAM,CAAA;KACvB,KAAK,WAAW,CAAC;IAClB,UAAU,EAAE,CAAC,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,KAAK,WAAW,CAAC;IACzE,QAAQ,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,WAAW,CAAC;IAC7C,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,QAAQ,EAAE,MAAM,OAAO,CAAC;IACxB,aAAa,EAAE,MAAM,OAAO,CAAC;CAC9B,CAAC"}
|
package/op-sqlite.podspec
CHANGED
|
@@ -96,7 +96,7 @@ Pod::Spec.new do |s|
|
|
|
96
96
|
install_modules_dependencies(s)
|
|
97
97
|
|
|
98
98
|
# Base source files
|
|
99
|
-
source_files = Dir.glob("ios/**/*.{h,m,mm}") + Dir.glob("cpp/**/*.{h,cpp,c}")
|
|
99
|
+
source_files = Dir.glob("ios/**/*.{h,hpp,m,mm}") + Dir.glob("cpp/**/*.{hpp,h,cpp,c}")
|
|
100
100
|
|
|
101
101
|
# Set the path to the `c_sources` directory based on environment
|
|
102
102
|
if is_user_app
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@op-engineering/op-sqlite",
|
|
3
|
-
"version": "15.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "15.1.0",
|
|
4
|
+
"description": "Fastest SQLite for React Native",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
7
7
|
"react-native": "src/index",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"sqlite"
|
|
49
49
|
],
|
|
50
50
|
"repository": "https://github.com/OP-Engineering/op-sqlite",
|
|
51
|
-
"author": "Oscar Franco <ospfranco@
|
|
51
|
+
"author": "Oscar Franco <ospfranco@gmail.com> (https://github.com/ospfranco)",
|
|
52
52
|
"license": "MIT",
|
|
53
53
|
"bugs": {
|
|
54
54
|
"url": "https://github.com/OP-Engineering/op-sqlite/issues"
|
|
@@ -59,11 +59,10 @@
|
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"clang-format": "^1.8.0",
|
|
62
|
-
"lefthook": "^1.5.5",
|
|
63
62
|
"react": "19.1.1",
|
|
64
|
-
"react-native": "0.
|
|
65
|
-
"react-native-builder-bob": "^0.40.
|
|
66
|
-
"typescript": "5.
|
|
63
|
+
"react-native": "0.82.1",
|
|
64
|
+
"react-native-builder-bob": "^0.40.15",
|
|
65
|
+
"typescript": "5.0.4"
|
|
67
66
|
},
|
|
68
67
|
"peerDependencies": {
|
|
69
68
|
"react": "*",
|
|
@@ -110,5 +109,8 @@
|
|
|
110
109
|
"type": "turbo-module",
|
|
111
110
|
"version": "0.52.1"
|
|
112
111
|
},
|
|
113
|
-
"packageManager": "yarn@4.
|
|
112
|
+
"packageManager": "yarn@4.11.0",
|
|
113
|
+
"dependencies": {
|
|
114
|
+
"react-native-safe-area-context": "^5.6.2"
|
|
115
|
+
}
|
|
114
116
|
}
|
package/src/functions.ts
CHANGED
|
@@ -149,6 +149,8 @@ function enhanceDB(db: _InternalDB, options: DBParams): DB {
|
|
|
149
149
|
getDbPath: db.getDbPath,
|
|
150
150
|
reactiveExecute: db.reactiveExecute,
|
|
151
151
|
sync: db.sync,
|
|
152
|
+
setReservedBytes: db.setReservedBytes,
|
|
153
|
+
getReservedBytes: db.getReservedBytes,
|
|
152
154
|
close: db.close,
|
|
153
155
|
executeWithHostObjects: async (
|
|
154
156
|
query: string,
|
|
@@ -178,31 +180,31 @@ function enhanceDB(db: _InternalDB, options: DBParams): DB {
|
|
|
178
180
|
return db.executeRaw(query, sanitizedParams as Scalar[]);
|
|
179
181
|
},
|
|
180
182
|
executeSync: (query: string, params?: Scalar[]): QueryResult => {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
let intermediateResult = sanitizedParams
|
|
184
|
-
? db.executeSync(query, sanitizedParams as Scalar[])
|
|
183
|
+
let res = params
|
|
184
|
+
? db.executeSync(query, sanitizeArrayBuffersInArray(params) as Scalar[])
|
|
185
185
|
: db.executeSync(query);
|
|
186
186
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
let
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
let
|
|
193
|
-
|
|
187
|
+
if (!res.rows) {
|
|
188
|
+
let rows: Record<string, Scalar>[] = [];
|
|
189
|
+
for (let i = 0; i < (res.rawRows?.length ?? 0); i++) {
|
|
190
|
+
let row: Record<string, Scalar> = {};
|
|
191
|
+
let rawRow = res.rawRows![i]!;
|
|
192
|
+
for (let j = 0; j < res.columnNames!.length; j++) {
|
|
193
|
+
let columnName = res.columnNames![j]!;
|
|
194
|
+
let value = rawRow[j]!;
|
|
194
195
|
|
|
195
|
-
|
|
196
|
+
row[columnName] = value;
|
|
197
|
+
}
|
|
198
|
+
rows.push(row);
|
|
196
199
|
}
|
|
197
|
-
rows.push(row);
|
|
198
|
-
}
|
|
199
200
|
|
|
200
|
-
|
|
201
|
-
...intermediateResult,
|
|
202
|
-
rows,
|
|
203
|
-
};
|
|
201
|
+
delete res.rawRows;
|
|
204
202
|
|
|
205
|
-
|
|
203
|
+
res = {
|
|
204
|
+
...res,
|
|
205
|
+
rows,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
206
208
|
|
|
207
209
|
return res;
|
|
208
210
|
},
|
|
@@ -216,32 +218,34 @@ function enhanceDB(db: _InternalDB, options: DBParams): DB {
|
|
|
216
218
|
query: string,
|
|
217
219
|
params?: Scalar[] | undefined
|
|
218
220
|
): Promise<QueryResult> => {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
let
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
let
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
221
|
+
let res = params
|
|
222
|
+
? await db.execute(
|
|
223
|
+
query,
|
|
224
|
+
sanitizeArrayBuffersInArray(params) as Scalar[]
|
|
225
|
+
)
|
|
226
|
+
: await db.execute(query);
|
|
227
|
+
|
|
228
|
+
if (!res.rows) {
|
|
229
|
+
let rows: Record<string, Scalar>[] = [];
|
|
230
|
+
for (let i = 0; i < (res.rawRows?.length ?? 0); i++) {
|
|
231
|
+
let row: Record<string, Scalar> = {};
|
|
232
|
+
let rawRow = res.rawRows![i]!;
|
|
233
|
+
for (let j = 0; j < res.columnNames!.length; j++) {
|
|
234
|
+
let columnName = res.columnNames![j]!;
|
|
235
|
+
let value = rawRow[j]!;
|
|
236
|
+
|
|
237
|
+
row[columnName] = value;
|
|
238
|
+
}
|
|
239
|
+
rows.push(row);
|
|
235
240
|
}
|
|
236
|
-
rows.push(row);
|
|
237
|
-
}
|
|
238
241
|
|
|
239
|
-
|
|
240
|
-
...intermediateResult,
|
|
241
|
-
rows,
|
|
242
|
-
};
|
|
242
|
+
delete res.rawRows;
|
|
243
243
|
|
|
244
|
-
|
|
244
|
+
res = {
|
|
245
|
+
...res,
|
|
246
|
+
rows,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
245
249
|
|
|
246
250
|
return res;
|
|
247
251
|
},
|
|
@@ -414,11 +418,18 @@ export const open = (params: {
|
|
|
414
418
|
return enhancedDb;
|
|
415
419
|
};
|
|
416
420
|
|
|
421
|
+
export function openV2(params: { path: string; encryptionKey?: string }) {
|
|
422
|
+
const db = OPSQLite.openV2(params);
|
|
423
|
+
const enhancedDb = enhanceDB(db, params as any);
|
|
424
|
+
|
|
425
|
+
return enhancedDb;
|
|
426
|
+
}
|
|
427
|
+
|
|
417
428
|
/**
|
|
418
429
|
* Moves the database from the assets folder to the default path (check the docs) or to a custom path
|
|
419
430
|
* It DOES NOT OVERWRITE the database if it already exists in the destination path
|
|
420
431
|
* if you want to overwrite the database, you need to pass the overwrite flag as true
|
|
421
|
-
* @param args object with the parameters for the
|
|
432
|
+
* @param args object with the parameters for the operation
|
|
422
433
|
* @returns promise, rejects if failed to move the database, resolves if the operation was successful
|
|
423
434
|
*/
|
|
424
435
|
export const moveAssetsDatabase = async (args: {
|
package/src/index.ts
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import { NativeModules } from 'react-native';
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
OPSQLite,
|
|
5
|
-
open,
|
|
6
|
-
openRemote,
|
|
7
|
-
openSync,
|
|
8
|
-
moveAssetsDatabase,
|
|
9
|
-
getDylibPath,
|
|
10
|
-
isSQLCipher,
|
|
11
|
-
isLibsql,
|
|
12
|
-
isIOSEmbedded,
|
|
13
|
-
isIOSEmbeeded,
|
|
14
|
-
} from './functions';
|
|
3
|
+
export * from './functions';
|
|
15
4
|
export { Storage } from './Storage';
|
|
16
5
|
export type {
|
|
17
6
|
Scalar,
|
package/src/types.ts
CHANGED
|
@@ -144,6 +144,8 @@ export type _InternalDB = {
|
|
|
144
144
|
callback: (response: any) => void;
|
|
145
145
|
}) => () => void;
|
|
146
146
|
sync: () => void;
|
|
147
|
+
setReservedBytes: (reservedBytes: number) => void;
|
|
148
|
+
getReservedBytes: () => number;
|
|
147
149
|
flushPendingReactiveQueries: () => Promise<void>;
|
|
148
150
|
};
|
|
149
151
|
|
|
@@ -267,7 +269,7 @@ export type DB = {
|
|
|
267
269
|
*/
|
|
268
270
|
executeRawSync: (query: string, params?: Scalar[]) => any[];
|
|
269
271
|
/**
|
|
270
|
-
*
|
|
272
|
+
* Gets the absolute path to the db file. Useful for debugging on local builds and for attaching the DB from users devices
|
|
271
273
|
*/
|
|
272
274
|
getDbPath: (location?: string) => string;
|
|
273
275
|
/**
|
|
@@ -290,6 +292,8 @@ export type DB = {
|
|
|
290
292
|
* The database is hosted in turso
|
|
291
293
|
**/
|
|
292
294
|
sync: () => void;
|
|
295
|
+
setReservedBytes: (reservedBytes: number) => void;
|
|
296
|
+
getReservedBytes: () => number;
|
|
293
297
|
};
|
|
294
298
|
|
|
295
299
|
export type DBParams = {
|
|
@@ -306,6 +310,10 @@ export type OPSQLiteProxy = {
|
|
|
306
310
|
location?: string;
|
|
307
311
|
encryptionKey?: string;
|
|
308
312
|
}) => _InternalDB;
|
|
313
|
+
openV2: (options: {
|
|
314
|
+
path: string;
|
|
315
|
+
encryptionKey?: string
|
|
316
|
+
}) => _InternalDB,
|
|
309
317
|
openRemote: (options: { url: string; authToken: string }) => _InternalDB;
|
|
310
318
|
openSync: (options: DBParams) => _InternalDB;
|
|
311
319
|
isSQLCipher: () => boolean;
|
package/cpp/bindings.cpp
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
#include "bindings.h"
|
|
2
|
-
#include "DBHostObject.h"
|
|
3
|
-
#include "DumbHostObject.h"
|
|
4
|
-
#include "OPThreadPool.h"
|
|
5
|
-
#ifdef OP_SQLITE_USE_LIBSQL
|
|
6
|
-
#include "libsql/bridge.h"
|
|
7
|
-
#else
|
|
8
|
-
#include "bridge.h"
|
|
9
|
-
#endif
|
|
10
|
-
#include "logs.h"
|
|
11
|
-
#include "macros.h"
|
|
12
|
-
#include "utils.h"
|
|
13
|
-
#include <iostream>
|
|
14
|
-
#include <string>
|
|
15
|
-
#include <unordered_map>
|
|
16
|
-
#include <vector>
|
|
17
|
-
|
|
18
|
-
namespace opsqlite {
|
|
19
|
-
|
|
20
|
-
namespace jsi = facebook::jsi;
|
|
21
|
-
|
|
22
|
-
std::string _base_path;
|
|
23
|
-
std::string _crsqlite_path;
|
|
24
|
-
std::string _sqlite_vec_path;
|
|
25
|
-
std::vector<std::shared_ptr<DBHostObject>> dbs;
|
|
26
|
-
|
|
27
|
-
// React native will try to clean the module on JS context invalidation
|
|
28
|
-
// (CodePush/Hot Reload) The clearState function is called
|
|
29
|
-
void invalidate() {
|
|
30
|
-
for (const auto &db : dbs) {
|
|
31
|
-
db->invalidate();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Clear our existing vector of shared pointers so they can be garbage
|
|
35
|
-
// collected
|
|
36
|
-
dbs.clear();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
void install(jsi::Runtime &rt,
|
|
40
|
-
const std::shared_ptr<react::CallInvoker> &invoker,
|
|
41
|
-
const char *base_path, const char *crsqlite_path,
|
|
42
|
-
const char *sqlite_vec_path) {
|
|
43
|
-
_base_path = std::string(base_path);
|
|
44
|
-
_crsqlite_path = std::string(crsqlite_path);
|
|
45
|
-
_sqlite_vec_path = std::string(sqlite_vec_path);
|
|
46
|
-
|
|
47
|
-
auto open = HOST_STATIC_FN("open") {
|
|
48
|
-
jsi::Object options = args[0].asObject(rt);
|
|
49
|
-
std::string name =
|
|
50
|
-
options.getProperty(rt, "name").asString(rt).utf8(rt);
|
|
51
|
-
std::string path = std::string(_base_path);
|
|
52
|
-
std::string location;
|
|
53
|
-
std::string encryption_key;
|
|
54
|
-
|
|
55
|
-
if (options.hasProperty(rt, "location")) {
|
|
56
|
-
location =
|
|
57
|
-
options.getProperty(rt, "location").asString(rt).utf8(rt);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (options.hasProperty(rt, "encryptionKey")) {
|
|
61
|
-
encryption_key =
|
|
62
|
-
options.getProperty(rt, "encryptionKey").asString(rt).utf8(rt);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
#ifdef OP_SQLITE_USE_SQLCIPHER
|
|
66
|
-
if (encryption_key.empty()) {
|
|
67
|
-
log_to_console(rt, "Encryption key is missing for SQLCipher");
|
|
68
|
-
}
|
|
69
|
-
#endif
|
|
70
|
-
|
|
71
|
-
if (!location.empty()) {
|
|
72
|
-
if (location == ":memory:") {
|
|
73
|
-
path = ":memory:";
|
|
74
|
-
} else if (location.rfind('/', 0) == 0) {
|
|
75
|
-
path = location;
|
|
76
|
-
} else {
|
|
77
|
-
path = path + "/" + location;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
std::shared_ptr<DBHostObject> db = std::make_shared<DBHostObject>(
|
|
82
|
-
rt, path, invoker, name, path, _crsqlite_path, _sqlite_vec_path,
|
|
83
|
-
encryption_key);
|
|
84
|
-
dbs.emplace_back(db);
|
|
85
|
-
return jsi::Object::createFromHostObject(rt, db);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
auto is_sqlcipher = HOST_STATIC_FN("isSQLCipher") {
|
|
89
|
-
#ifdef OP_SQLITE_USE_SQLCIPHER
|
|
90
|
-
return true;
|
|
91
|
-
#else
|
|
92
|
-
return false;
|
|
93
|
-
#endif
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
auto is_ios_embedded = HOST_STATIC_FN("isIOSEmbedded") {
|
|
97
|
-
#ifdef OP_SQLITE_USE_PHONE_VERSION
|
|
98
|
-
return true;
|
|
99
|
-
#else
|
|
100
|
-
return false;
|
|
101
|
-
#endif
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
auto is_libsql = HOST_STATIC_FN("isLibsql") {
|
|
105
|
-
#ifdef OP_SQLITE_USE_LIBSQL
|
|
106
|
-
return true;
|
|
107
|
-
#else
|
|
108
|
-
return false;
|
|
109
|
-
#endif
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
#ifdef OP_SQLITE_USE_LIBSQL
|
|
113
|
-
auto open_remote = HOST_STATIC_FN("openRemote") {
|
|
114
|
-
jsi::Object options = args[0].asObject(rt);
|
|
115
|
-
|
|
116
|
-
std::string url = options.getProperty(rt, "url").asString(rt).utf8(rt);
|
|
117
|
-
|
|
118
|
-
std::string auth_token =
|
|
119
|
-
options.getProperty(rt, "authToken").asString(rt).utf8(rt);
|
|
120
|
-
|
|
121
|
-
std::shared_ptr<DBHostObject> db = std::make_shared<DBHostObject>(
|
|
122
|
-
rt, url, auth_token, invoker);
|
|
123
|
-
|
|
124
|
-
return jsi::Object::createFromHostObject(rt, db);
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
auto open_sync = HOST_STATIC_FN("openSync") {
|
|
128
|
-
jsi::Object options = args[0].asObject(rt);
|
|
129
|
-
std::string name =
|
|
130
|
-
options.getProperty(rt, "name").asString(rt).utf8(rt);
|
|
131
|
-
std::string path = std::string(_base_path);
|
|
132
|
-
std::string url = options.getProperty(rt, "url").asString(rt).utf8(rt);
|
|
133
|
-
std::string auth_token =
|
|
134
|
-
options.getProperty(rt, "authToken").asString(rt).utf8(rt);
|
|
135
|
-
|
|
136
|
-
int sync_interval = 0;
|
|
137
|
-
if (options.hasProperty(rt, "libsqlSyncInterval")) {
|
|
138
|
-
sync_interval = static_cast<int>(
|
|
139
|
-
options.getProperty(rt, "libsqlSyncInterval").asNumber());
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
bool offline = false;
|
|
143
|
-
if (options.hasProperty(rt, "libsqlOffline")) {
|
|
144
|
-
offline = options.getProperty(rt, "libsqlOffline").asBool();
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
std::string encryption_key;
|
|
148
|
-
if (options.hasProperty(rt, "encryptionKey")) {
|
|
149
|
-
encryption_key =
|
|
150
|
-
options.getProperty(rt, "encryptionKey").asString(rt).utf8(rt);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
std::string remote_encryption_key;
|
|
154
|
-
if (options.hasProperty(rt, "remoteEncryptionKey")) {
|
|
155
|
-
remote_encryption_key =
|
|
156
|
-
options.getProperty(rt, "remoteEncryptionKey").asString(rt).utf8(rt);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
std::string location;
|
|
160
|
-
if (options.hasProperty(rt, "location")) {
|
|
161
|
-
location =
|
|
162
|
-
options.getProperty(rt, "location").asString(rt).utf8(rt);
|
|
163
|
-
}
|
|
164
|
-
if (!location.empty()) {
|
|
165
|
-
if (location == ":memory:") {
|
|
166
|
-
path = ":memory:";
|
|
167
|
-
} else if (location.rfind("/", 0) == 0) {
|
|
168
|
-
path = location;
|
|
169
|
-
} else {
|
|
170
|
-
path = path + "/" + location;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
std::shared_ptr<DBHostObject> db = std::make_shared<DBHostObject>(
|
|
175
|
-
rt, invoker, name, path, url, auth_token, sync_interval, offline, encryption_key, remote_encryption_key);
|
|
176
|
-
return jsi::Object::createFromHostObject(rt, db);
|
|
177
|
-
});
|
|
178
|
-
#endif
|
|
179
|
-
|
|
180
|
-
jsi::Object module = jsi::Object(rt);
|
|
181
|
-
module.setProperty(rt, "open", std::move(open));
|
|
182
|
-
module.setProperty(rt, "isSQLCipher", std::move(is_sqlcipher));
|
|
183
|
-
module.setProperty(rt, "isLibsql", std::move(is_libsql));
|
|
184
|
-
module.setProperty(rt, "isIOSEmbedded", std::move(is_ios_embedded));
|
|
185
|
-
#ifdef OP_SQLITE_USE_LIBSQL
|
|
186
|
-
module.setProperty(rt, "openRemote", std::move(open_remote));
|
|
187
|
-
module.setProperty(rt, "openSync", std::move(open_sync));
|
|
188
|
-
#endif
|
|
189
|
-
|
|
190
|
-
rt.global().setProperty(rt, "__OPSQLiteProxy", std::move(module));
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
void expoUpdatesWorkaround(const char *base_path) {
|
|
194
|
-
#ifdef OP_SQLITE_USE_LIBSQL
|
|
195
|
-
std::string path = std::string(base_path);
|
|
196
|
-
// Open a DB before anything else so that expo-updates does not mess up the
|
|
197
|
-
// configuration
|
|
198
|
-
opsqlite_libsql_open("__dummy", path, "");
|
|
199
|
-
#endif
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
} // namespace opsqlite
|
package/cpp/macros.h
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#define HOSTFN(name) \
|
|
4
|
-
jsi::Function::createFromHostFunction( \
|
|
5
|
-
rt, \
|
|
6
|
-
jsi::PropNameID::forAscii(rt, name), \
|
|
7
|
-
0, \
|
|
8
|
-
[=, this](jsi::Runtime &rt, const jsi::Value &thisValue, const jsi::Value *args, size_t count) -> jsi::Value
|
|
9
|
-
|
|
10
|
-
#define HOST_STATIC_FN(name) \
|
|
11
|
-
jsi::Function::createFromHostFunction( \
|
|
12
|
-
rt, \
|
|
13
|
-
jsi::PropNameID::forAscii(rt, name), \
|
|
14
|
-
0, \
|
|
15
|
-
[=](jsi::Runtime &rt, const jsi::Value &thisValue, const jsi::Value *args, size_t count) -> jsi::Value
|
package/cpp/types.h
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <memory>
|
|
4
|
-
#include <string>
|
|
5
|
-
#include <variant>
|
|
6
|
-
#include <vector>
|
|
7
|
-
|
|
8
|
-
struct ArrayBuffer {
|
|
9
|
-
std::shared_ptr<uint8_t> data;
|
|
10
|
-
size_t size;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
using JSVariant = std::variant<nullptr_t, bool, int, double, long, long long,
|
|
14
|
-
std::string, ArrayBuffer>;
|
|
15
|
-
|
|
16
|
-
struct BridgeResult {
|
|
17
|
-
std::string message;
|
|
18
|
-
int affectedRows;
|
|
19
|
-
double insertId;
|
|
20
|
-
std::vector<std::vector<JSVariant>> rows;
|
|
21
|
-
std::vector<std::string> column_names;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
struct BatchResult {
|
|
25
|
-
std::string message;
|
|
26
|
-
int affectedRows;
|
|
27
|
-
int commands;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
struct BatchArguments {
|
|
31
|
-
std::string sql;
|
|
32
|
-
std::vector<JSVariant> params;
|
|
33
|
-
};
|
|
File without changes
|