react-native-nitro-sqlite 9.1.7 → 9.1.9
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/build.gradle +1 -0
- package/cpp/specs/HybridNitroSQLite.cpp +2 -2
- package/cpp/specs/HybridNitroSQLite.hpp +2 -2
- package/cpp/sqliteExecuteBatch.cpp +1 -1
- package/cpp/sqliteExecuteBatch.hpp +2 -2
- package/lib/commonjs/index.js +30 -21
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nullHandling.js +33 -0
- package/lib/commonjs/nullHandling.js.map +1 -0
- package/lib/commonjs/operations/execute.js +7 -11
- package/lib/commonjs/operations/execute.js.map +1 -1
- package/lib/commonjs/operations/executeBatch.js +34 -0
- package/lib/commonjs/operations/executeBatch.js.map +1 -0
- package/lib/commonjs/operations/session.js +3 -2
- package/lib/commonjs/operations/session.js.map +1 -1
- package/lib/commonjs/types.js +4 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/index.js +5 -17
- package/lib/module/index.js.map +1 -1
- package/lib/module/nullHandling.js +25 -0
- package/lib/module/nullHandling.js.map +1 -0
- package/lib/module/operations/execute.js +5 -8
- package/lib/module/operations/execute.js.map +1 -1
- package/lib/module/operations/executeBatch.js +29 -0
- package/lib/module/operations/executeBatch.js.map +1 -0
- package/lib/module/operations/session.js +3 -2
- package/lib/module/operations/session.js.map +1 -1
- package/lib/module/types.js +6 -0
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +4 -7
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/nullHandling.d.ts +8 -0
- package/lib/typescript/commonjs/nullHandling.d.ts.map +1 -0
- package/lib/typescript/commonjs/operations/execute.d.ts.map +1 -1
- package/lib/typescript/commonjs/operations/executeBatch.d.ts +4 -0
- package/lib/typescript/commonjs/operations/executeBatch.d.ts.map +1 -0
- package/lib/typescript/commonjs/operations/session.d.ts.map +1 -1
- package/lib/typescript/commonjs/specs/NitroSQLite.nitro.d.ts +3 -3
- package/lib/typescript/commonjs/specs/NitroSQLite.nitro.d.ts.map +1 -1
- package/lib/typescript/commonjs/types.d.ts +8 -0
- package/lib/typescript/commonjs/types.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +4 -7
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/nullHandling.d.ts +8 -0
- package/lib/typescript/module/nullHandling.d.ts.map +1 -0
- package/lib/typescript/module/operations/execute.d.ts.map +1 -1
- package/lib/typescript/module/operations/executeBatch.d.ts +4 -0
- package/lib/typescript/module/operations/executeBatch.d.ts.map +1 -0
- package/lib/typescript/module/operations/session.d.ts.map +1 -1
- package/lib/typescript/module/specs/NitroSQLite.nitro.d.ts +3 -3
- package/lib/typescript/module/specs/NitroSQLite.nitro.d.ts.map +1 -1
- package/lib/typescript/module/types.d.ts +8 -0
- package/lib/typescript/module/types.d.ts.map +1 -1
- package/nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.hpp +5 -5
- package/nitrogen/generated/shared/c++/{BatchQueryCommand.hpp → NativeBatchQueryCommand.hpp} +10 -10
- package/package.json +1 -1
- package/src/index.ts +9 -19
- package/src/nullHandling.ts +31 -0
- package/src/operations/execute.ts +8 -12
- package/src/operations/executeBatch.ts +56 -0
- package/src/operations/session.ts +3 -2
- package/src/specs/NitroSQLite.nitro.ts +6 -3
- package/src/types.ts +10 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../src/operations/execute.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../src/operations/execute.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,WAAW,EAEX,iBAAiB,EACjB,cAAc,EACf,MAAM,UAAU,CAAA;AAEjB,wBAAgB,OAAO,CAAC,GAAG,SAAS,cAAc,GAAG,KAAK,EACxD,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,iBAAiB,GACzB,WAAW,CAAC,GAAG,CAAC,CAYlB;AAED,wBAAsB,YAAY,CAAC,GAAG,SAAS,cAAc,GAAG,KAAK,EACnE,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,iBAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAY3B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BatchQueryResult, BatchQueryCommand } from '../types';
|
|
2
|
+
export declare function executeBatch(dbName: string, commands: BatchQueryCommand[]): BatchQueryResult;
|
|
3
|
+
export declare function executeBatchAsync(dbName: string, commands: BatchQueryCommand[]): Promise<BatchQueryResult>;
|
|
4
|
+
//# sourceMappingURL=executeBatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executeBatch.d.ts","sourceRoot":"","sources":["../../../../src/operations/executeBatch.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,gBAAgB,EAChB,iBAAiB,EAElB,MAAM,UAAU,CAAA;AAEjB,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,iBAAiB,EAAE,GAC5B,gBAAgB,CAOlB;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,iBAAiB,EAAE,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAU3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/operations/session.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,qBAAqB,EACrB,4BAA4B,EAK7B,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/operations/session.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,qBAAqB,EACrB,4BAA4B,EAK7B,MAAM,UAAU,CAAA;AAIjB,wBAAgB,IAAI,CAClB,OAAO,EAAE,4BAA4B,GACpC,qBAAqB,CA4BvB;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,QAOvD;AAED,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,QAGnC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
-
import type { BatchQueryResult, FileLoadResult,
|
|
2
|
+
import type { BatchQueryResult, FileLoadResult, NativeSQLiteQueryParams, NativeBatchQueryCommand } from '../types';
|
|
3
3
|
import type { NativeQueryResult } from './NativeQueryResult.nitro';
|
|
4
4
|
export interface NitroSQLite extends HybridObject<{
|
|
5
5
|
ios: 'c++';
|
|
@@ -12,8 +12,8 @@ export interface NitroSQLite extends HybridObject<{
|
|
|
12
12
|
detach(mainDbName: string, alias: string): void;
|
|
13
13
|
execute(dbName: string, query: string, params?: NativeSQLiteQueryParams): NativeQueryResult;
|
|
14
14
|
executeAsync(dbName: string, query: string, params?: NativeSQLiteQueryParams): Promise<NativeQueryResult>;
|
|
15
|
-
executeBatch(dbName: string, commands:
|
|
16
|
-
executeBatchAsync(dbName: string, commands:
|
|
15
|
+
executeBatch(dbName: string, commands: NativeBatchQueryCommand[]): BatchQueryResult;
|
|
16
|
+
executeBatchAsync(dbName: string, commands: NativeBatchQueryCommand[]): Promise<BatchQueryResult>;
|
|
17
17
|
loadFile(dbName: string, location: string): FileLoadResult;
|
|
18
18
|
loadFileAsync(dbName: string, location: string): Promise<FileLoadResult>;
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NitroSQLite.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/NitroSQLite.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OA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CAAA;IACnB,iBAAiB,CACf,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,uBAAuB,EAAE,GAClC,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc,CAAA;IAC1D,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;CACzE"}
|
|
@@ -27,6 +27,7 @@ export type SQLiteNullValue = {
|
|
|
27
27
|
isNitroSQLiteNull: true;
|
|
28
28
|
};
|
|
29
29
|
export type SQLiteValue = boolean | number | string | ArrayBuffer | SQLiteNullValue;
|
|
30
|
+
/** Used internally to transform the query params into a native format without nullish values */
|
|
30
31
|
export type NativeSQLiteQueryParams = SQLiteValue[];
|
|
31
32
|
/**
|
|
32
33
|
* Represents a value that can be stored in a SQLite database
|
|
@@ -68,6 +69,13 @@ export interface BatchQueryCommand {
|
|
|
68
69
|
query: string;
|
|
69
70
|
params?: SQLiteQueryParams | SQLiteQueryParams[];
|
|
70
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Used internally to transform the batch query commands into a native format without nullish values
|
|
74
|
+
*/
|
|
75
|
+
export interface NativeBatchQueryCommand {
|
|
76
|
+
query: string;
|
|
77
|
+
params?: NativeSQLiteQueryParams | NativeSQLiteQueryParams[];
|
|
78
|
+
}
|
|
71
79
|
/**
|
|
72
80
|
* status: 0 or undefined for correct execution, 1 for error
|
|
73
81
|
* message: if status === 1, here you will find error description
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,IAAI,IAAI,CAAA;IAC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YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { open } from './operations/session';
|
|
2
2
|
import { execute, executeAsync } from './operations/execute';
|
|
3
|
-
import {
|
|
3
|
+
import { executeBatch, executeBatchAsync } from './operations/executeBatch';
|
|
4
4
|
export type * from './types';
|
|
5
5
|
export { typeORMDriver } from './typeORM';
|
|
6
6
|
export declare const NitroSQLite: {
|
|
@@ -9,12 +9,12 @@ export declare const NitroSQLite: {
|
|
|
9
9
|
transaction: (dbName: string, fn: (tx: import("./types").Transaction) => Promise<void> | void) => Promise<void>;
|
|
10
10
|
execute: typeof execute;
|
|
11
11
|
executeAsync: typeof executeAsync;
|
|
12
|
+
executeBatch: typeof executeBatch;
|
|
13
|
+
executeBatchAsync: typeof executeBatchAsync;
|
|
12
14
|
close(dbName: string): void;
|
|
13
15
|
drop(dbName: string, location?: string): void;
|
|
14
16
|
attach(mainDbName: string, dbNameToAttach: string, alias: string, location?: string): void;
|
|
15
17
|
detach(mainDbName: string, alias: string): void;
|
|
16
|
-
executeBatch(dbName: string, commands: import("./types").BatchQueryCommand[]): import("./types").BatchQueryResult;
|
|
17
|
-
executeBatchAsync(dbName: string, commands: import("./types").BatchQueryCommand[]): Promise<import("./types").BatchQueryResult>;
|
|
18
18
|
loadFile(dbName: string, location: string): import("./types").FileLoadResult;
|
|
19
19
|
loadFileAsync(dbName: string, location: string): Promise<import("./types").FileLoadResult>;
|
|
20
20
|
__type?: string;
|
|
@@ -27,8 +27,5 @@ export declare const NitroSQLite: {
|
|
|
27
27
|
dispose(): void;
|
|
28
28
|
};
|
|
29
29
|
export { open } from './operations/session';
|
|
30
|
-
export
|
|
31
|
-
export declare function isSimpleNullHandlingEnabled(): boolean;
|
|
32
|
-
export declare const NITRO_SQLITE_NULL: SQLiteNullValue;
|
|
33
|
-
export declare function isNitroSQLiteNull(value: any): value is SQLiteNullValue;
|
|
30
|
+
export { isNitroSQLiteNull, NITRO_SQLITE_NULL, isSimpleNullHandlingEnabled, enableSimpleNullHandling, } from './nullHandling';
|
|
34
31
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAE5D,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC3E,mBAAmB,SAAS,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAIzC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;CAYvB,CAAA;AAED,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SQLiteNullValue, SQLiteValue } from './types';
|
|
2
|
+
import { SQLiteQueryParamItem } from './types';
|
|
3
|
+
export declare function enableSimpleNullHandling(shouldEnableSimpleNullHandling?: boolean): void;
|
|
4
|
+
export declare function isSimpleNullHandlingEnabled(): boolean;
|
|
5
|
+
export declare const NITRO_SQLITE_NULL: SQLiteNullValue;
|
|
6
|
+
export declare function isNitroSQLiteNull(value: any): value is SQLiteNullValue;
|
|
7
|
+
export declare function replaceWithNativeNullValue(value: SQLiteQueryParamItem): SQLiteValue;
|
|
8
|
+
//# sourceMappingURL=nullHandling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nullHandling.d.ts","sourceRoot":"","sources":["../../../src/nullHandling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAI9C,wBAAgB,wBAAwB,CACtC,8BAA8B,UAAO,QAGtC;AAED,wBAAgB,2BAA2B,YAE1C;AAED,eAAO,MAAM,iBAAiB,EAAE,eAA6C,CAAA;AAC7E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,eAAe,CAKtE;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,oBAAoB,GAC1B,WAAW,CAKb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../src/operations/execute.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../src/operations/execute.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,WAAW,EAEX,iBAAiB,EACjB,cAAc,EACf,MAAM,UAAU,CAAA;AAEjB,wBAAgB,OAAO,CAAC,GAAG,SAAS,cAAc,GAAG,KAAK,EACxD,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,iBAAiB,GACzB,WAAW,CAAC,GAAG,CAAC,CAYlB;AAED,wBAAsB,YAAY,CAAC,GAAG,SAAS,cAAc,GAAG,KAAK,EACnE,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,iBAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAY3B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BatchQueryResult, BatchQueryCommand } from '../types';
|
|
2
|
+
export declare function executeBatch(dbName: string, commands: BatchQueryCommand[]): BatchQueryResult;
|
|
3
|
+
export declare function executeBatchAsync(dbName: string, commands: BatchQueryCommand[]): Promise<BatchQueryResult>;
|
|
4
|
+
//# sourceMappingURL=executeBatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executeBatch.d.ts","sourceRoot":"","sources":["../../../../src/operations/executeBatch.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,gBAAgB,EAChB,iBAAiB,EAElB,MAAM,UAAU,CAAA;AAEjB,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,iBAAiB,EAAE,GAC5B,gBAAgB,CAOlB;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,iBAAiB,EAAE,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAU3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/operations/session.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,qBAAqB,EACrB,4BAA4B,EAK7B,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/operations/session.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,qBAAqB,EACrB,4BAA4B,EAK7B,MAAM,UAAU,CAAA;AAIjB,wBAAgB,IAAI,CAClB,OAAO,EAAE,4BAA4B,GACpC,qBAAqB,CA4BvB;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,QAOvD;AAED,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,QAGnC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
-
import type { BatchQueryResult, FileLoadResult,
|
|
2
|
+
import type { BatchQueryResult, FileLoadResult, NativeSQLiteQueryParams, NativeBatchQueryCommand } from '../types';
|
|
3
3
|
import type { NativeQueryResult } from './NativeQueryResult.nitro';
|
|
4
4
|
export interface NitroSQLite extends HybridObject<{
|
|
5
5
|
ios: 'c++';
|
|
@@ -12,8 +12,8 @@ export interface NitroSQLite extends HybridObject<{
|
|
|
12
12
|
detach(mainDbName: string, alias: string): void;
|
|
13
13
|
execute(dbName: string, query: string, params?: NativeSQLiteQueryParams): NativeQueryResult;
|
|
14
14
|
executeAsync(dbName: string, query: string, params?: NativeSQLiteQueryParams): Promise<NativeQueryResult>;
|
|
15
|
-
executeBatch(dbName: string, commands:
|
|
16
|
-
executeBatchAsync(dbName: string, commands:
|
|
15
|
+
executeBatch(dbName: string, commands: NativeBatchQueryCommand[]): BatchQueryResult;
|
|
16
|
+
executeBatchAsync(dbName: string, commands: NativeBatchQueryCommand[]): Promise<BatchQueryResult>;
|
|
17
17
|
loadFile(dbName: string, location: string): FileLoadResult;
|
|
18
18
|
loadFileAsync(dbName: string, location: string): Promise<FileLoadResult>;
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NitroSQLite.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/NitroSQLite.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"NitroSQLite.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/NitroSQLite.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,uBAAuB,EAC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,cAAc,CAAC,CAAA;CACzE"}
|
|
@@ -27,6 +27,7 @@ export type SQLiteNullValue = {
|
|
|
27
27
|
isNitroSQLiteNull: true;
|
|
28
28
|
};
|
|
29
29
|
export type SQLiteValue = boolean | number | string | ArrayBuffer | SQLiteNullValue;
|
|
30
|
+
/** Used internally to transform the query params into a native format without nullish values */
|
|
30
31
|
export type NativeSQLiteQueryParams = SQLiteValue[];
|
|
31
32
|
/**
|
|
32
33
|
* Represents a value that can be stored in a SQLite database
|
|
@@ -68,6 +69,13 @@ export interface BatchQueryCommand {
|
|
|
68
69
|
query: string;
|
|
69
70
|
params?: SQLiteQueryParams | SQLiteQueryParams[];
|
|
70
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Used internally to transform the batch query commands into a native format without nullish values
|
|
74
|
+
*/
|
|
75
|
+
export interface NativeBatchQueryCommand {
|
|
76
|
+
query: string;
|
|
77
|
+
params?: NativeSQLiteQueryParams | NativeSQLiteQueryParams[];
|
|
78
|
+
}
|
|
71
79
|
/**
|
|
72
80
|
* status: 0 or undefined for correct execution, 1 for error
|
|
73
81
|
* message: if status === 1, here you will find error description
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,IAAI,IAAI,CAAA;IACb,MAAM,IAAI,IAAI,CAAA;IACd,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtE,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,WAAW,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,G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AAA;QACb,+BAA+B;QAC/B,MAAM,EAAE,MAAM,CAAA;QACd;;;WAGG;QACH,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,GAAG,SAAS,CAAA;KACvC,CAAA;CACF;AAED,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,SAAS,cAAc,GAAG,cAAc,EACrE,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,iBAAiB,KACvB,WAAW,CAAC,GAAG,CAAC,CAAA;AAErB,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,SAAS,cAAc,GAAG,cAAc,EAC1E,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,iBAAiB,KACvB,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;AAE9B,MAAM,WAAW,WAAW;IAC1B,MAAM,IAAI,WAAW,CAAA;IACrB,QAAQ,IAAI,WAAW,CAAA;IACvB,OAAO,EAAE,YAAY,CAAA;IACrB,YAAY,EAAE,iBAAiB,CAAA;CAChC;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,EAAE,CAAA;CACjD;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,uBAAuB,GAAG,uBAAuB,EAAE,CAAA;CAC7D;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB"}
|
|
@@ -21,8 +21,8 @@ namespace NitroModules { class ArrayBuffer; }
|
|
|
21
21
|
namespace margelo::nitro::rnnitrosqlite { struct SQLiteNullValue; }
|
|
22
22
|
// Forward declaration of `BatchQueryResult` to properly resolve imports.
|
|
23
23
|
namespace margelo::nitro::rnnitrosqlite { struct BatchQueryResult; }
|
|
24
|
-
// Forward declaration of `
|
|
25
|
-
namespace margelo::nitro::rnnitrosqlite { struct
|
|
24
|
+
// Forward declaration of `NativeBatchQueryCommand` to properly resolve imports.
|
|
25
|
+
namespace margelo::nitro::rnnitrosqlite { struct NativeBatchQueryCommand; }
|
|
26
26
|
// Forward declaration of `FileLoadResult` to properly resolve imports.
|
|
27
27
|
namespace margelo::nitro::rnnitrosqlite { struct FileLoadResult; }
|
|
28
28
|
|
|
@@ -36,7 +36,7 @@ namespace margelo::nitro::rnnitrosqlite { struct FileLoadResult; }
|
|
|
36
36
|
#include "SQLiteNullValue.hpp"
|
|
37
37
|
#include <NitroModules/Promise.hpp>
|
|
38
38
|
#include "BatchQueryResult.hpp"
|
|
39
|
-
#include "
|
|
39
|
+
#include "NativeBatchQueryCommand.hpp"
|
|
40
40
|
#include "FileLoadResult.hpp"
|
|
41
41
|
|
|
42
42
|
namespace margelo::nitro::rnnitrosqlite {
|
|
@@ -77,8 +77,8 @@ namespace margelo::nitro::rnnitrosqlite {
|
|
|
77
77
|
virtual void detach(const std::string& mainDbName, const std::string& alias) = 0;
|
|
78
78
|
virtual std::shared_ptr<margelo::nitro::rnnitrosqlite::HybridNativeQueryResultSpec> execute(const std::string& dbName, const std::string& query, const std::optional<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>>& params) = 0;
|
|
79
79
|
virtual std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::rnnitrosqlite::HybridNativeQueryResultSpec>>> executeAsync(const std::string& dbName, const std::string& query, const std::optional<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>>& params) = 0;
|
|
80
|
-
virtual BatchQueryResult executeBatch(const std::string& dbName, const std::vector<
|
|
81
|
-
virtual std::shared_ptr<Promise<BatchQueryResult>> executeBatchAsync(const std::string& dbName, const std::vector<
|
|
80
|
+
virtual BatchQueryResult executeBatch(const std::string& dbName, const std::vector<NativeBatchQueryCommand>& commands) = 0;
|
|
81
|
+
virtual std::shared_ptr<Promise<BatchQueryResult>> executeBatchAsync(const std::string& dbName, const std::vector<NativeBatchQueryCommand>& commands) = 0;
|
|
82
82
|
virtual FileLoadResult loadFile(const std::string& dbName, const std::string& location) = 0;
|
|
83
83
|
virtual std::shared_ptr<Promise<FileLoadResult>> loadFileAsync(const std::string& dbName, const std::string& location) = 0;
|
|
84
84
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// NativeBatchQueryCommand.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
@@ -33,16 +33,16 @@ namespace margelo::nitro::rnnitrosqlite { struct SQLiteNullValue; }
|
|
|
33
33
|
namespace margelo::nitro::rnnitrosqlite {
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* A struct which can be represented as a JavaScript object (
|
|
36
|
+
* A struct which can be represented as a JavaScript object (NativeBatchQueryCommand).
|
|
37
37
|
*/
|
|
38
|
-
struct
|
|
38
|
+
struct NativeBatchQueryCommand {
|
|
39
39
|
public:
|
|
40
40
|
std::string query SWIFT_PRIVATE;
|
|
41
41
|
std::optional<std::variant<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>, std::vector<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>>>> params SWIFT_PRIVATE;
|
|
42
42
|
|
|
43
43
|
public:
|
|
44
|
-
|
|
45
|
-
explicit
|
|
44
|
+
NativeBatchQueryCommand() = default;
|
|
45
|
+
explicit NativeBatchQueryCommand(std::string query, std::optional<std::variant<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>, std::vector<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>>>> params): query(query), params(params) {}
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
} // namespace margelo::nitro::rnnitrosqlite
|
|
@@ -51,17 +51,17 @@ namespace margelo::nitro {
|
|
|
51
51
|
|
|
52
52
|
using namespace margelo::nitro::rnnitrosqlite;
|
|
53
53
|
|
|
54
|
-
// C++
|
|
54
|
+
// C++ NativeBatchQueryCommand <> JS NativeBatchQueryCommand (object)
|
|
55
55
|
template <>
|
|
56
|
-
struct JSIConverter<
|
|
57
|
-
static inline
|
|
56
|
+
struct JSIConverter<NativeBatchQueryCommand> final {
|
|
57
|
+
static inline NativeBatchQueryCommand fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
58
58
|
jsi::Object obj = arg.asObject(runtime);
|
|
59
|
-
return
|
|
59
|
+
return NativeBatchQueryCommand(
|
|
60
60
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "query")),
|
|
61
61
|
JSIConverter<std::optional<std::variant<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>, std::vector<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>>>>>::fromJSI(runtime, obj.getProperty(runtime, "params"))
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const
|
|
64
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const NativeBatchQueryCommand& arg) {
|
|
65
65
|
jsi::Object obj(runtime);
|
|
66
66
|
obj.setProperty(runtime, "query", JSIConverter<std::string>::toJSI(runtime, arg.query));
|
|
67
67
|
obj.setProperty(runtime, "params", JSIConverter<std::optional<std::variant<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>, std::vector<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>>>>>::toJSI(runtime, arg.params));
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { transaction } from './operations/transaction'
|
|
|
2
2
|
import { HybridNitroSQLite } from './nitro'
|
|
3
3
|
import { open } from './operations/session'
|
|
4
4
|
import { execute, executeAsync } from './operations/execute'
|
|
5
|
-
import { SQLiteNullValue } from './types'
|
|
6
5
|
import { init } from './OnLoad'
|
|
6
|
+
import { executeBatch, executeBatchAsync } from './operations/executeBatch'
|
|
7
7
|
export type * from './types'
|
|
8
8
|
export { typeORMDriver } from './typeORM'
|
|
9
9
|
|
|
@@ -19,24 +19,14 @@ export const NitroSQLite = {
|
|
|
19
19
|
transaction,
|
|
20
20
|
execute,
|
|
21
21
|
executeAsync,
|
|
22
|
+
executeBatch,
|
|
23
|
+
executeBatchAsync,
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
export { open } from './operations/session'
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
export function isSimpleNullHandlingEnabled() {
|
|
33
|
-
return ENABLE_SIMPLE_NULL_HANDLING
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const NITRO_SQLITE_NULL: SQLiteNullValue = { isNitroSQLiteNull: true }
|
|
37
|
-
export function isNitroSQLiteNull(value: any): value is SQLiteNullValue {
|
|
38
|
-
if (typeof value === 'object' && 'isNitroSQLiteNull' in value) {
|
|
39
|
-
return true
|
|
40
|
-
}
|
|
41
|
-
return false
|
|
42
|
-
}
|
|
27
|
+
export {
|
|
28
|
+
isNitroSQLiteNull,
|
|
29
|
+
NITRO_SQLITE_NULL,
|
|
30
|
+
isSimpleNullHandlingEnabled,
|
|
31
|
+
enableSimpleNullHandling,
|
|
32
|
+
} from './nullHandling'
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SQLiteNullValue, SQLiteValue } from './types'
|
|
2
|
+
import { SQLiteQueryParamItem } from './types'
|
|
3
|
+
|
|
4
|
+
let ENABLE_SIMPLE_NULL_HANDLING = false
|
|
5
|
+
|
|
6
|
+
export function enableSimpleNullHandling(
|
|
7
|
+
shouldEnableSimpleNullHandling = true
|
|
8
|
+
) {
|
|
9
|
+
ENABLE_SIMPLE_NULL_HANDLING = shouldEnableSimpleNullHandling
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function isSimpleNullHandlingEnabled() {
|
|
13
|
+
return ENABLE_SIMPLE_NULL_HANDLING
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const NITRO_SQLITE_NULL: SQLiteNullValue = { isNitroSQLiteNull: true }
|
|
17
|
+
export function isNitroSQLiteNull(value: any): value is SQLiteNullValue {
|
|
18
|
+
if (typeof value === 'object' && 'isNitroSQLiteNull' in value) {
|
|
19
|
+
return true
|
|
20
|
+
}
|
|
21
|
+
return false
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function replaceWithNativeNullValue(
|
|
25
|
+
value: SQLiteQueryParamItem
|
|
26
|
+
): SQLiteValue {
|
|
27
|
+
if (value === undefined || value === null) {
|
|
28
|
+
return NITRO_SQLITE_NULL
|
|
29
|
+
}
|
|
30
|
+
return value
|
|
31
|
+
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
NITRO_SQLITE_NULL,
|
|
3
|
-
isNitroSQLiteNull,
|
|
4
|
-
isSimpleNullHandlingEnabled,
|
|
5
|
-
} from '..'
|
|
1
|
+
import { isNitroSQLiteNull, isSimpleNullHandlingEnabled } from '../nullHandling'
|
|
6
2
|
import { HybridNitroSQLite } from '../nitro'
|
|
3
|
+
import { replaceWithNativeNullValue } from '../nullHandling'
|
|
7
4
|
import type { NativeQueryResult } from '../specs/NativeQueryResult.nitro'
|
|
8
5
|
import type {
|
|
9
6
|
QueryResult,
|
|
@@ -17,10 +14,14 @@ export function execute<Row extends QueryResultRow = never>(
|
|
|
17
14
|
query: string,
|
|
18
15
|
params?: SQLiteQueryParams
|
|
19
16
|
): QueryResult<Row> {
|
|
17
|
+
const transformedParams = isSimpleNullHandlingEnabled()
|
|
18
|
+
? toNativeQueryParams(params)
|
|
19
|
+
: (params as NativeSQLiteQueryParams)
|
|
20
|
+
|
|
20
21
|
const nativeResult = HybridNitroSQLite.execute(
|
|
21
22
|
dbName,
|
|
22
23
|
query,
|
|
23
|
-
|
|
24
|
+
transformedParams
|
|
24
25
|
)
|
|
25
26
|
const result = buildJsQueryResult<Row>(nativeResult)
|
|
26
27
|
return result
|
|
@@ -47,12 +48,7 @@ export async function executeAsync<Row extends QueryResultRow = never>(
|
|
|
47
48
|
function toNativeQueryParams(
|
|
48
49
|
params: SQLiteQueryParams | undefined
|
|
49
50
|
): NativeSQLiteQueryParams | undefined {
|
|
50
|
-
return params?.map((param) =>
|
|
51
|
-
if (param === undefined || param === null) {
|
|
52
|
-
return NITRO_SQLITE_NULL
|
|
53
|
-
}
|
|
54
|
-
return param
|
|
55
|
-
})
|
|
51
|
+
return params?.map((param) => replaceWithNativeNullValue(param))
|
|
56
52
|
}
|
|
57
53
|
|
|
58
54
|
function buildJsQueryResult<Row extends QueryResultRow = never>({
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isSimpleNullHandlingEnabled,
|
|
3
|
+
replaceWithNativeNullValue,
|
|
4
|
+
} from '../nullHandling'
|
|
5
|
+
import { HybridNitroSQLite } from '../nitro'
|
|
6
|
+
import type {
|
|
7
|
+
NativeSQLiteQueryParams,
|
|
8
|
+
BatchQueryResult,
|
|
9
|
+
BatchQueryCommand,
|
|
10
|
+
NativeBatchQueryCommand,
|
|
11
|
+
} from '../types'
|
|
12
|
+
|
|
13
|
+
export function executeBatch(
|
|
14
|
+
dbName: string,
|
|
15
|
+
commands: BatchQueryCommand[]
|
|
16
|
+
): BatchQueryResult {
|
|
17
|
+
const transformedCommands = isSimpleNullHandlingEnabled()
|
|
18
|
+
? toNativeBatchQueryCommands(commands)
|
|
19
|
+
: (commands as NativeBatchQueryCommand[])
|
|
20
|
+
|
|
21
|
+
const result = HybridNitroSQLite.executeBatch(dbName, transformedCommands)
|
|
22
|
+
return result
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function executeBatchAsync(
|
|
26
|
+
dbName: string,
|
|
27
|
+
commands: BatchQueryCommand[]
|
|
28
|
+
): Promise<BatchQueryResult> {
|
|
29
|
+
const transformedCommands = isSimpleNullHandlingEnabled()
|
|
30
|
+
? toNativeBatchQueryCommands(commands)
|
|
31
|
+
: (commands as NativeBatchQueryCommand[])
|
|
32
|
+
|
|
33
|
+
const result = await HybridNitroSQLite.executeBatchAsync(
|
|
34
|
+
dbName,
|
|
35
|
+
transformedCommands
|
|
36
|
+
)
|
|
37
|
+
return result
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function toNativeBatchQueryCommands(
|
|
41
|
+
commands: BatchQueryCommand[]
|
|
42
|
+
): NativeBatchQueryCommand[] {
|
|
43
|
+
return commands.map((command) => {
|
|
44
|
+
const transformedParams = command.params?.map((param) => {
|
|
45
|
+
if (Array.isArray(param)) {
|
|
46
|
+
return param.map((p) => replaceWithNativeNullValue(p))
|
|
47
|
+
}
|
|
48
|
+
return replaceWithNativeNullValue(param)
|
|
49
|
+
}) as NativeSQLiteQueryParams | NativeSQLiteQueryParams[]
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
query: command.query,
|
|
53
|
+
params: transformedParams,
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
}
|
|
@@ -10,6 +10,7 @@ import type {
|
|
|
10
10
|
QueryResultRow,
|
|
11
11
|
} from '../types'
|
|
12
12
|
import { execute, executeAsync } from './execute'
|
|
13
|
+
import { executeBatch, executeBatchAsync } from './executeBatch'
|
|
13
14
|
|
|
14
15
|
export function open(
|
|
15
16
|
options: NitroSQLiteConnectionOptions
|
|
@@ -33,9 +34,9 @@ export function open(
|
|
|
33
34
|
params?: SQLiteQueryParams
|
|
34
35
|
): Promise<QueryResult<Row>> => executeAsync(options.name, query, params),
|
|
35
36
|
executeBatch: (commands: BatchQueryCommand[]) =>
|
|
36
|
-
|
|
37
|
+
executeBatch(options.name, commands),
|
|
37
38
|
executeBatchAsync: (commands: BatchQueryCommand[]) =>
|
|
38
|
-
|
|
39
|
+
executeBatchAsync(options.name, commands),
|
|
39
40
|
loadFile: (location: string) =>
|
|
40
41
|
HybridNitroSQLite.loadFile(options.name, location),
|
|
41
42
|
loadFileAsync: (location: string) =>
|
|
@@ -2,8 +2,8 @@ import type { HybridObject } from 'react-native-nitro-modules'
|
|
|
2
2
|
import type {
|
|
3
3
|
BatchQueryResult,
|
|
4
4
|
FileLoadResult,
|
|
5
|
-
BatchQueryCommand,
|
|
6
5
|
NativeSQLiteQueryParams,
|
|
6
|
+
NativeBatchQueryCommand,
|
|
7
7
|
} from '../types'
|
|
8
8
|
import type { NativeQueryResult } from './NativeQueryResult.nitro'
|
|
9
9
|
|
|
@@ -29,10 +29,13 @@ export interface NitroSQLite
|
|
|
29
29
|
query: string,
|
|
30
30
|
params?: NativeSQLiteQueryParams
|
|
31
31
|
): Promise<NativeQueryResult>
|
|
32
|
-
executeBatch(
|
|
32
|
+
executeBatch(
|
|
33
|
+
dbName: string,
|
|
34
|
+
commands: NativeBatchQueryCommand[]
|
|
35
|
+
): BatchQueryResult
|
|
33
36
|
executeBatchAsync(
|
|
34
37
|
dbName: string,
|
|
35
|
-
commands:
|
|
38
|
+
commands: NativeBatchQueryCommand[]
|
|
36
39
|
): Promise<BatchQueryResult>
|
|
37
40
|
loadFile(dbName: string, location: string): FileLoadResult
|
|
38
41
|
loadFileAsync(dbName: string, location: string): Promise<FileLoadResult>
|
package/src/types.ts
CHANGED
|
@@ -36,6 +36,8 @@ export type SQLiteValue =
|
|
|
36
36
|
| string
|
|
37
37
|
| ArrayBuffer
|
|
38
38
|
| SQLiteNullValue
|
|
39
|
+
|
|
40
|
+
/** Used internally to transform the query params into a native format without nullish values */
|
|
39
41
|
export type NativeSQLiteQueryParams = SQLiteValue[]
|
|
40
42
|
|
|
41
43
|
/**
|
|
@@ -91,6 +93,14 @@ export interface BatchQueryCommand {
|
|
|
91
93
|
params?: SQLiteQueryParams | SQLiteQueryParams[]
|
|
92
94
|
}
|
|
93
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Used internally to transform the batch query commands into a native format without nullish values
|
|
98
|
+
*/
|
|
99
|
+
export interface NativeBatchQueryCommand {
|
|
100
|
+
query: string
|
|
101
|
+
params?: NativeSQLiteQueryParams | NativeSQLiteQueryParams[]
|
|
102
|
+
}
|
|
103
|
+
|
|
94
104
|
/**
|
|
95
105
|
* status: 0 or undefined for correct execution, 1 for error
|
|
96
106
|
* message: if status === 1, here you will find error description
|