react-native-nitro-sqlite 9.1.2 → 9.1.4
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/RNNitroSQLite.podspec +1 -1
- package/cpp/operations.cpp +5 -9
- package/cpp/sqlite/sqlite3.c +112968 -89110
- package/cpp/sqlite/sqlite3.h +2462 -1303
- package/cpp/types.hpp +4 -4
- package/lib/commonjs/index.js +21 -19
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/operations/execute.js +21 -3
- package/lib/commonjs/operations/execute.js.map +1 -1
- package/lib/commonjs/operations/session.js.map +1 -1
- package/lib/commonjs/types.js +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/index.js +16 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/operations/execute.js +21 -3
- package/lib/module/operations/execute.js.map +1 -1
- package/lib/module/operations/session.js.map +1 -1
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +6 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/operations/execute.d.ts +3 -3
- package/lib/typescript/commonjs/operations/execute.d.ts.map +1 -1
- package/lib/typescript/commonjs/operations/transaction.d.ts.map +1 -1
- package/lib/typescript/commonjs/specs/NativeQueryResult.nitro.d.ts +2 -2
- package/lib/typescript/commonjs/specs/NativeQueryResult.nitro.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/typeORM.d.ts +2 -2
- package/lib/typescript/commonjs/typeORM.d.ts.map +1 -1
- package/lib/typescript/commonjs/types.d.ts +14 -8
- package/lib/typescript/commonjs/types.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +6 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/operations/execute.d.ts +3 -3
- package/lib/typescript/module/operations/execute.d.ts.map +1 -1
- package/lib/typescript/module/operations/transaction.d.ts.map +1 -1
- package/lib/typescript/module/specs/NativeQueryResult.nitro.d.ts +2 -2
- package/lib/typescript/module/specs/NativeQueryResult.nitro.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/typeORM.d.ts +2 -2
- package/lib/typescript/module/typeORM.d.ts.map +1 -1
- package/lib/typescript/module/types.d.ts +14 -8
- package/lib/typescript/module/types.d.ts.map +1 -1
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/RNNitroSQLite+autolinking.cmake +20 -1
- package/nitrogen/generated/android/RNNitroSQLite+autolinking.gradle +1 -1
- package/nitrogen/generated/android/RNNitroSQLiteOnLoad.cpp +5 -1
- package/nitrogen/generated/android/RNNitroSQLiteOnLoad.hpp +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnnitrosqlite/RNNitroSQLiteOnLoad.kt +35 -0
- package/nitrogen/generated/ios/RNNitroSQLite+autolinking.rb +3 -1
- package/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Bridge.cpp +1 -1
- package/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Bridge.hpp +1 -1
- package/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Umbrella.hpp +1 -2
- package/nitrogen/generated/ios/RNNitroSQLiteAutolinking.mm +1 -1
- package/nitrogen/generated/ios/RNNitroSQLiteAutolinking.swift +1 -1
- package/nitrogen/generated/shared/c++/BatchQueryCommand.hpp +11 -7
- package/nitrogen/generated/shared/c++/BatchQueryResult.hpp +3 -2
- package/nitrogen/generated/shared/c++/ColumnType.hpp +2 -2
- package/nitrogen/generated/shared/c++/FileLoadResult.hpp +3 -2
- package/nitrogen/generated/shared/c++/HybridNativeQueryResultSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNativeQueryResultSpec.hpp +6 -3
- package/nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.hpp +7 -4
- package/nitrogen/generated/shared/c++/SQLiteNullValue.hpp +69 -0
- package/nitrogen/generated/shared/c++/SQLiteQueryColumnMetadata.hpp +3 -2
- package/package.json +3 -3
- package/src/index.ts +20 -2
- package/src/operations/execute.ts +54 -12
- package/src/operations/session.ts +6 -6
- package/src/operations/transaction.ts +4 -4
- package/src/specs/NativeQueryResult.nitro.ts +2 -2
- package/src/specs/NitroSQLite.nitro.ts +3 -3
- package/src/typeORM.ts +4 -4
- package/src/types.ts +23 -12
- package/nitrogen/generated/android/RNNitroSQLiteOnLoad.kt +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { QueryResult,
|
|
1
|
+
import type { QueryResult, Transaction, SQLiteQueryParams, QueryResultRow } from './types';
|
|
2
2
|
interface TypeOrmNitroSQLiteConnection {
|
|
3
|
-
executeSql: <RowData extends
|
|
3
|
+
executeSql: <RowData extends QueryResultRow = never>(sql: string, params: SQLiteQueryParams | undefined, okExecute: (res: QueryResult<RowData>) => void, failExecute: (msg: string) => void) => Promise<void>;
|
|
4
4
|
transaction: (fn: (tx: Transaction) => Promise<void>) => Promise<void>;
|
|
5
5
|
close: (okClose: () => void, failClose: (e: unknown) => void) => void;
|
|
6
6
|
attach: (dbNameToAttach: string, alias: string, location: string | undefined, callback: () => void) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeORM.d.ts","sourceRoot":"","sources":["../../../src/typeORM.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,WAAW,EACX,
|
|
1
|
+
{"version":3,"file":"typeORM.d.ts","sourceRoot":"","sources":["../../../src/typeORM.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,cAAc,EACf,MAAM,SAAS,CAA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
|
29
|
+
export type SQLiteValue = boolean | number | string | ArrayBuffer | SQLiteNullValue;
|
|
30
|
+
export type NativeSQLiteQueryParams = SQLiteValue[];
|
|
26
31
|
/**
|
|
27
32
|
* Represents a value that can be stored in a SQLite database
|
|
28
33
|
*/
|
|
29
|
-
export type
|
|
30
|
-
export type
|
|
31
|
-
export
|
|
34
|
+
export type SQLiteQueryParamItem = SQLiteValue | null | undefined;
|
|
35
|
+
export type SQLiteQueryParams = SQLiteQueryParamItem[];
|
|
36
|
+
export type QueryResultRowItem = SQLiteValue | undefined;
|
|
37
|
+
export type QueryResultRow = Record<string, QueryResultRowItem>;
|
|
38
|
+
export interface QueryResult<Row extends QueryResultRow = QueryResultRow> {
|
|
32
39
|
readonly insertId?: number;
|
|
33
40
|
readonly rowsAffected: number;
|
|
34
41
|
readonly rows?: {
|
|
35
42
|
/** Raw array with all dataset */
|
|
36
|
-
_array:
|
|
43
|
+
_array: Row[];
|
|
37
44
|
/** The lengh of the dataset */
|
|
38
45
|
length: number;
|
|
39
46
|
/** A convenience function to acess the index based the row object
|
|
40
47
|
* @param idx the row index
|
|
41
48
|
* @returns the row structure identified by column names
|
|
42
49
|
*/
|
|
43
|
-
item: (idx: number) =>
|
|
50
|
+
item: (idx: number) => Row | undefined;
|
|
44
51
|
};
|
|
45
52
|
}
|
|
46
|
-
export type
|
|
47
|
-
export type
|
|
48
|
-
export type ExecuteAsyncQuery = <RowData extends SQLiteItem = SQLiteItem>(query: string, params?: SQLiteQueryParams) => Promise<QueryResult<RowData>>;
|
|
53
|
+
export type ExecuteQuery = <Row extends QueryResultRow = QueryResultRow>(query: string, params?: SQLiteQueryParams) => QueryResult<Row>;
|
|
54
|
+
export type ExecuteAsyncQuery = <Row extends QueryResultRow = QueryResultRow>(query: string, params?: SQLiteQueryParams) => Promise<QueryResult<Row>>;
|
|
49
55
|
export interface Transaction {
|
|
50
56
|
commit(): QueryResult;
|
|
51
57
|
rollback(): QueryResult;
|
|
@@ -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,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACzE,OAAO,EAAE,YAAY,CAAA;IACrB,YAAY,EAAE,iBAAiB,CAAA;IAC/B,YAAY,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,gBAAgB,CAAA;IAC7D,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC3E,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAAA;IAC1C,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;CACzD;AAED,oBAAY,UAAU;IACpB,OAAO,IAAA;IACP,MAAM,IAAA;IACN,KAAK,IAAA;IACL,IAAI,IAAA;IACJ,YAAY,IAAA;IACZ,UAAU,IAAA;CACX;
|
|
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,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Q,gBAAgB;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* linguist-generated
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# RNNitroSQLite+autolinking.cmake
|
|
3
3
|
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
# https://github.com/mrousavy/nitro
|
|
5
|
-
# Copyright ©
|
|
5
|
+
# Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
#
|
|
7
7
|
|
|
8
8
|
# This is a CMake file that adds all files generated by Nitrogen
|
|
@@ -33,6 +33,25 @@ target_sources(
|
|
|
33
33
|
|
|
34
34
|
)
|
|
35
35
|
|
|
36
|
+
# Define a flag to check if we are building properly
|
|
37
|
+
add_definitions(-DBUILDING_RNNITROSQLITE_WITH_GENERATED_CMAKE_PROJECT)
|
|
38
|
+
|
|
39
|
+
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
40
|
+
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
|
|
41
|
+
target_compile_definitions(
|
|
42
|
+
RNNitroSQLite PRIVATE
|
|
43
|
+
-DFOLLY_NO_CONFIG=1
|
|
44
|
+
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
|
45
|
+
-DFOLLY_USE_LIBCPP=1
|
|
46
|
+
-DFOLLY_CFG_NO_COROUTINES=1
|
|
47
|
+
-DFOLLY_MOBILE=1
|
|
48
|
+
-DFOLLY_HAVE_RECVMMSG=1
|
|
49
|
+
-DFOLLY_HAVE_PTHREAD=1
|
|
50
|
+
# Once we target android-23 above, we can comment
|
|
51
|
+
# the following line. NDK uses GNU style stderror_r() after API 23.
|
|
52
|
+
-DFOLLY_HAVE_XSI_STRERROR_R=1
|
|
53
|
+
)
|
|
54
|
+
|
|
36
55
|
# Add all libraries required by the generated specs
|
|
37
56
|
find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
|
|
38
57
|
find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// RNNitroSQLite+autolinking.gradle
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
/// This is a Gradle file that adds all files generated by Nitrogen
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
/// RNNitroSQLiteOnLoad.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
+
#ifndef BUILDING_RNNITROSQLITE_WITH_GENERATED_CMAKE_PROJECT
|
|
9
|
+
#error RNNitroSQLiteOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
|
|
10
|
+
#endif
|
|
11
|
+
|
|
8
12
|
#include "RNNitroSQLiteOnLoad.hpp"
|
|
9
13
|
|
|
10
14
|
#include <jni.h>
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnnitrosqlite/RNNitroSQLiteOnLoad.kt
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// RNNitroSQLiteOnLoad.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.rnnitrosqlite
|
|
9
|
+
|
|
10
|
+
import android.util.Log
|
|
11
|
+
|
|
12
|
+
internal class RNNitroSQLiteOnLoad {
|
|
13
|
+
companion object {
|
|
14
|
+
private const val TAG = "RNNitroSQLiteOnLoad"
|
|
15
|
+
private var didLoad = false
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the native part of "RNNitroSQLite".
|
|
18
|
+
* This method is idempotent and can be called more than once.
|
|
19
|
+
*/
|
|
20
|
+
@JvmStatic
|
|
21
|
+
fun initializeNative() {
|
|
22
|
+
if (didLoad) return
|
|
23
|
+
try {
|
|
24
|
+
Log.i(TAG, "Loading RNNitroSQLite C++ library...")
|
|
25
|
+
System.loadLibrary("RNNitroSQLite")
|
|
26
|
+
Log.i(TAG, "Successfully loaded RNNitroSQLite C++ library!")
|
|
27
|
+
didLoad = true
|
|
28
|
+
} catch (e: Error) {
|
|
29
|
+
Log.e(TAG, "Failed to load RNNitroSQLite C++ library! Is it properly installed and linked? " +
|
|
30
|
+
"Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
|
|
31
|
+
throw e
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# RNNitroSQLite+autolinking.rb
|
|
3
3
|
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
# https://github.com/mrousavy/nitro
|
|
5
|
-
# Copyright ©
|
|
5
|
+
# Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
#
|
|
7
7
|
|
|
8
8
|
# This is a Ruby script that adds all files generated by Nitrogen
|
|
@@ -44,6 +44,8 @@ def add_nitrogen_files(spec)
|
|
|
44
44
|
spec.private_header_files = current_private_header_files + [
|
|
45
45
|
# iOS specific specs
|
|
46
46
|
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
|
47
|
+
# Views are framework-specific and should be private
|
|
48
|
+
"nitrogen/generated/shared/**/views/**/*"
|
|
47
49
|
]
|
|
48
50
|
|
|
49
51
|
current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// RNNitroSQLite-Swift-Cxx-Bridge.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "RNNitroSQLite-Swift-Cxx-Bridge.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// RNNitroSQLite-Swift-Cxx-Umbrella.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
// Common C++ types used in Swift
|
|
20
20
|
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
21
21
|
#include <NitroModules/AnyMapHolder.hpp>
|
|
22
|
-
#include <NitroModules/HybridContext.hpp>
|
|
23
22
|
#include <NitroModules/RuntimeError.hpp>
|
|
24
23
|
|
|
25
24
|
// Forward declarations of Swift defined types
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// RNNitroSQLiteAutolinking.mm
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#import <Foundation/Foundation.h>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// RNNitroSQLiteAutolinking.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
public final class RNNitroSQLiteAutolinking {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// BatchQueryCommand.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -20,12 +20,15 @@
|
|
|
20
20
|
|
|
21
21
|
// Forward declaration of `ArrayBuffer` to properly resolve imports.
|
|
22
22
|
namespace NitroModules { class ArrayBuffer; }
|
|
23
|
+
// Forward declaration of `SQLiteNullValue` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::rnnitrosqlite { struct SQLiteNullValue; }
|
|
23
25
|
|
|
24
26
|
#include <string>
|
|
25
27
|
#include <optional>
|
|
26
28
|
#include <variant>
|
|
27
29
|
#include <vector>
|
|
28
30
|
#include <NitroModules/ArrayBuffer.hpp>
|
|
31
|
+
#include "SQLiteNullValue.hpp"
|
|
29
32
|
|
|
30
33
|
namespace margelo::nitro::rnnitrosqlite {
|
|
31
34
|
|
|
@@ -35,10 +38,11 @@ namespace margelo::nitro::rnnitrosqlite {
|
|
|
35
38
|
struct BatchQueryCommand {
|
|
36
39
|
public:
|
|
37
40
|
std::string query SWIFT_PRIVATE;
|
|
38
|
-
std::optional<std::variant<std::vector<std::variant<std::string, double,
|
|
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;
|
|
39
42
|
|
|
40
43
|
public:
|
|
41
|
-
|
|
44
|
+
BatchQueryCommand() = default;
|
|
45
|
+
explicit BatchQueryCommand(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) {}
|
|
42
46
|
};
|
|
43
47
|
|
|
44
48
|
} // namespace margelo::nitro::rnnitrosqlite
|
|
@@ -49,18 +53,18 @@ namespace margelo::nitro {
|
|
|
49
53
|
|
|
50
54
|
// C++ BatchQueryCommand <> JS BatchQueryCommand (object)
|
|
51
55
|
template <>
|
|
52
|
-
struct JSIConverter<BatchQueryCommand> {
|
|
56
|
+
struct JSIConverter<BatchQueryCommand> final {
|
|
53
57
|
static inline BatchQueryCommand fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
54
58
|
jsi::Object obj = arg.asObject(runtime);
|
|
55
59
|
return BatchQueryCommand(
|
|
56
60
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "query")),
|
|
57
|
-
JSIConverter<std::optional<std::variant<std::vector<std::variant<std::string, double,
|
|
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"))
|
|
58
62
|
);
|
|
59
63
|
}
|
|
60
64
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const BatchQueryCommand& arg) {
|
|
61
65
|
jsi::Object obj(runtime);
|
|
62
66
|
obj.setProperty(runtime, "query", JSIConverter<std::string>::toJSI(runtime, arg.query));
|
|
63
|
-
obj.setProperty(runtime, "params", JSIConverter<std::optional<std::variant<std::vector<std::variant<std::string, double,
|
|
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));
|
|
64
68
|
return obj;
|
|
65
69
|
}
|
|
66
70
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -69,7 +73,7 @@ namespace margelo::nitro {
|
|
|
69
73
|
}
|
|
70
74
|
jsi::Object obj = value.getObject(runtime);
|
|
71
75
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "query"))) return false;
|
|
72
|
-
if (!JSIConverter<std::optional<std::variant<std::vector<std::variant<std::string, double,
|
|
76
|
+
if (!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>>>>>>::canConvert(runtime, obj.getProperty(runtime, "params"))) return false;
|
|
73
77
|
return true;
|
|
74
78
|
}
|
|
75
79
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// BatchQueryResult.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -32,6 +32,7 @@ namespace margelo::nitro::rnnitrosqlite {
|
|
|
32
32
|
std::optional<double> rowsAffected SWIFT_PRIVATE;
|
|
33
33
|
|
|
34
34
|
public:
|
|
35
|
+
BatchQueryResult() = default;
|
|
35
36
|
explicit BatchQueryResult(std::optional<double> rowsAffected): rowsAffected(rowsAffected) {}
|
|
36
37
|
};
|
|
37
38
|
|
|
@@ -43,7 +44,7 @@ namespace margelo::nitro {
|
|
|
43
44
|
|
|
44
45
|
// C++ BatchQueryResult <> JS BatchQueryResult (object)
|
|
45
46
|
template <>
|
|
46
|
-
struct JSIConverter<BatchQueryResult> {
|
|
47
|
+
struct JSIConverter<BatchQueryResult> final {
|
|
47
48
|
static inline BatchQueryResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
48
49
|
jsi::Object obj = arg.asObject(runtime);
|
|
49
50
|
return BatchQueryResult(
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// ColumnType.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -41,7 +41,7 @@ namespace margelo::nitro {
|
|
|
41
41
|
|
|
42
42
|
// C++ ColumnType <> JS ColumnType (enum)
|
|
43
43
|
template <>
|
|
44
|
-
struct JSIConverter<ColumnType> {
|
|
44
|
+
struct JSIConverter<ColumnType> final {
|
|
45
45
|
static inline ColumnType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
46
46
|
int enumValue = JSIConverter<int>::fromJSI(runtime, arg);
|
|
47
47
|
return static_cast<ColumnType>(enumValue);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// FileLoadResult.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -33,6 +33,7 @@ namespace margelo::nitro::rnnitrosqlite {
|
|
|
33
33
|
std::optional<double> rowsAffected SWIFT_PRIVATE;
|
|
34
34
|
|
|
35
35
|
public:
|
|
36
|
+
FileLoadResult() = default;
|
|
36
37
|
explicit FileLoadResult(std::optional<double> commands, std::optional<double> rowsAffected): commands(commands), rowsAffected(rowsAffected) {}
|
|
37
38
|
};
|
|
38
39
|
|
|
@@ -44,7 +45,7 @@ namespace margelo::nitro {
|
|
|
44
45
|
|
|
45
46
|
// C++ FileLoadResult <> JS FileLoadResult (object)
|
|
46
47
|
template <>
|
|
47
|
-
struct JSIConverter<FileLoadResult> {
|
|
48
|
+
struct JSIConverter<FileLoadResult> final {
|
|
48
49
|
static inline FileLoadResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
49
50
|
jsi::Object obj = arg.asObject(runtime);
|
|
50
51
|
return FileLoadResult(
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNativeQueryResultSpec.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridNativeQueryResultSpec.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNativeQueryResultSpec.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
// Forward declaration of `ArrayBuffer` to properly resolve imports.
|
|
17
17
|
namespace NitroModules { class ArrayBuffer; }
|
|
18
|
+
// Forward declaration of `SQLiteNullValue` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::rnnitrosqlite { struct SQLiteNullValue; }
|
|
18
20
|
// Forward declaration of `SQLiteQueryColumnMetadata` to properly resolve imports.
|
|
19
21
|
namespace margelo::nitro::rnnitrosqlite { struct SQLiteQueryColumnMetadata; }
|
|
20
22
|
|
|
@@ -24,6 +26,7 @@ namespace margelo::nitro::rnnitrosqlite { struct SQLiteQueryColumnMetadata; }
|
|
|
24
26
|
#include <string>
|
|
25
27
|
#include <variant>
|
|
26
28
|
#include <NitroModules/ArrayBuffer.hpp>
|
|
29
|
+
#include "SQLiteNullValue.hpp"
|
|
27
30
|
#include "SQLiteQueryColumnMetadata.hpp"
|
|
28
31
|
|
|
29
32
|
namespace margelo::nitro::rnnitrosqlite {
|
|
@@ -49,13 +52,13 @@ namespace margelo::nitro::rnnitrosqlite {
|
|
|
49
52
|
explicit HybridNativeQueryResultSpec(): HybridObject(TAG) { }
|
|
50
53
|
|
|
51
54
|
// Destructor
|
|
52
|
-
|
|
55
|
+
~HybridNativeQueryResultSpec() override = default;
|
|
53
56
|
|
|
54
57
|
public:
|
|
55
58
|
// Properties
|
|
56
59
|
virtual double getRowsAffected() = 0;
|
|
57
60
|
virtual std::optional<double> getInsertId() = 0;
|
|
58
|
-
virtual std::vector<std::unordered_map<std::string, std::variant<std::string, double,
|
|
61
|
+
virtual std::vector<std::unordered_map<std::string, std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>> getResults() = 0;
|
|
59
62
|
virtual std::optional<std::unordered_map<std::string, SQLiteQueryColumnMetadata>> getMetadata() = 0;
|
|
60
63
|
|
|
61
64
|
public:
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNitroSQLiteSpec.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridNitroSQLiteSpec.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNitroSQLiteSpec.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
namespace margelo::nitro::rnnitrosqlite { class HybridNativeQueryResultSpec; }
|
|
18
18
|
// Forward declaration of `ArrayBuffer` to properly resolve imports.
|
|
19
19
|
namespace NitroModules { class ArrayBuffer; }
|
|
20
|
+
// Forward declaration of `SQLiteNullValue` to properly resolve imports.
|
|
21
|
+
namespace margelo::nitro::rnnitrosqlite { struct SQLiteNullValue; }
|
|
20
22
|
// Forward declaration of `BatchQueryResult` to properly resolve imports.
|
|
21
23
|
namespace margelo::nitro::rnnitrosqlite { struct BatchQueryResult; }
|
|
22
24
|
// Forward declaration of `BatchQueryCommand` to properly resolve imports.
|
|
@@ -31,6 +33,7 @@ namespace margelo::nitro::rnnitrosqlite { struct FileLoadResult; }
|
|
|
31
33
|
#include <vector>
|
|
32
34
|
#include <variant>
|
|
33
35
|
#include <NitroModules/ArrayBuffer.hpp>
|
|
36
|
+
#include "SQLiteNullValue.hpp"
|
|
34
37
|
#include <NitroModules/Promise.hpp>
|
|
35
38
|
#include "BatchQueryResult.hpp"
|
|
36
39
|
#include "BatchQueryCommand.hpp"
|
|
@@ -59,7 +62,7 @@ namespace margelo::nitro::rnnitrosqlite {
|
|
|
59
62
|
explicit HybridNitroSQLiteSpec(): HybridObject(TAG) { }
|
|
60
63
|
|
|
61
64
|
// Destructor
|
|
62
|
-
|
|
65
|
+
~HybridNitroSQLiteSpec() override = default;
|
|
63
66
|
|
|
64
67
|
public:
|
|
65
68
|
// Properties
|
|
@@ -72,8 +75,8 @@ namespace margelo::nitro::rnnitrosqlite {
|
|
|
72
75
|
virtual void drop(const std::string& dbName, const std::optional<std::string>& location) = 0;
|
|
73
76
|
virtual void attach(const std::string& mainDbName, const std::string& dbNameToAttach, const std::string& alias, const std::optional<std::string>& location) = 0;
|
|
74
77
|
virtual void detach(const std::string& mainDbName, const std::string& alias) = 0;
|
|
75
|
-
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,
|
|
76
|
-
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,
|
|
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
|
+
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;
|
|
77
80
|
virtual BatchQueryResult executeBatch(const std::string& dbName, const std::vector<BatchQueryCommand>& commands) = 0;
|
|
78
81
|
virtual std::shared_ptr<Promise<BatchQueryResult>> executeBatchAsync(const std::string& dbName, const std::vector<BatchQueryCommand>& commands) = 0;
|
|
79
82
|
virtual FileLoadResult loadFile(const std::string& dbName, const std::string& location) = 0;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// SQLiteNullValue.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
namespace margelo::nitro::rnnitrosqlite {
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A struct which can be represented as a JavaScript object (SQLiteNullValue).
|
|
29
|
+
*/
|
|
30
|
+
struct SQLiteNullValue {
|
|
31
|
+
public:
|
|
32
|
+
bool isNitroSQLiteNull SWIFT_PRIVATE;
|
|
33
|
+
|
|
34
|
+
public:
|
|
35
|
+
SQLiteNullValue() = default;
|
|
36
|
+
explicit SQLiteNullValue(bool isNitroSQLiteNull): isNitroSQLiteNull(isNitroSQLiteNull) {}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
} // namespace margelo::nitro::rnnitrosqlite
|
|
40
|
+
|
|
41
|
+
namespace margelo::nitro {
|
|
42
|
+
|
|
43
|
+
using namespace margelo::nitro::rnnitrosqlite;
|
|
44
|
+
|
|
45
|
+
// C++ SQLiteNullValue <> JS SQLiteNullValue (object)
|
|
46
|
+
template <>
|
|
47
|
+
struct JSIConverter<SQLiteNullValue> final {
|
|
48
|
+
static inline SQLiteNullValue fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
49
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
50
|
+
return SQLiteNullValue(
|
|
51
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isNitroSQLiteNull"))
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const SQLiteNullValue& arg) {
|
|
55
|
+
jsi::Object obj(runtime);
|
|
56
|
+
obj.setProperty(runtime, "isNitroSQLiteNull", JSIConverter<bool>::toJSI(runtime, arg.isNitroSQLiteNull));
|
|
57
|
+
return obj;
|
|
58
|
+
}
|
|
59
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
60
|
+
if (!value.isObject()) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
jsi::Object obj = value.getObject(runtime);
|
|
64
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isNitroSQLiteNull"))) return false;
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
} // namespace margelo::nitro
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// SQLiteQueryColumnMetadata.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -36,6 +36,7 @@ namespace margelo::nitro::rnnitrosqlite {
|
|
|
36
36
|
double index SWIFT_PRIVATE;
|
|
37
37
|
|
|
38
38
|
public:
|
|
39
|
+
SQLiteQueryColumnMetadata() = default;
|
|
39
40
|
explicit SQLiteQueryColumnMetadata(std::string name, ColumnType type, double index): name(name), type(type), index(index) {}
|
|
40
41
|
};
|
|
41
42
|
|
|
@@ -47,7 +48,7 @@ namespace margelo::nitro {
|
|
|
47
48
|
|
|
48
49
|
// C++ SQLiteQueryColumnMetadata <> JS SQLiteQueryColumnMetadata (object)
|
|
49
50
|
template <>
|
|
50
|
-
struct JSIConverter<SQLiteQueryColumnMetadata> {
|
|
51
|
+
struct JSIConverter<SQLiteQueryColumnMetadata> final {
|
|
51
52
|
static inline SQLiteQueryColumnMetadata fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
52
53
|
jsi::Object obj = arg.asObject(runtime);
|
|
53
54
|
return SQLiteQueryColumnMetadata(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nitro-sqlite",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.4",
|
|
4
4
|
"description": "Fast SQLite library for React Native built using Nitro Modules",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./lib/commonjs/index",
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
80
|
"react": ">=17.0.0",
|
|
81
|
-
"react-native": ">=0.
|
|
82
|
-
"react-native-nitro-modules": ">=0.
|
|
81
|
+
"react-native": ">=0.75.0",
|
|
82
|
+
"react-native-nitro-modules": ">=0.24.1"
|
|
83
83
|
},
|
|
84
84
|
"resolutions": {
|
|
85
85
|
"@types/react": "^18.2.44"
|