react-native-nitro-sqlite 9.1.1 → 9.1.3

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.
Files changed (74) hide show
  1. package/RNNitroSQLite.podspec +1 -1
  2. package/cpp/operations.cpp +5 -9
  3. package/cpp/sqlite/sqlite3.c +112968 -89110
  4. package/cpp/sqlite/sqlite3.h +2462 -1303
  5. package/cpp/types.hpp +4 -4
  6. package/lib/commonjs/index.js +21 -19
  7. package/lib/commonjs/index.js.map +1 -1
  8. package/lib/commonjs/operations/execute.js +21 -3
  9. package/lib/commonjs/operations/execute.js.map +1 -1
  10. package/lib/commonjs/operations/session.js.map +1 -1
  11. package/lib/commonjs/types.js +1 -1
  12. package/lib/commonjs/types.js.map +1 -1
  13. package/lib/module/index.js +16 -1
  14. package/lib/module/index.js.map +1 -1
  15. package/lib/module/operations/execute.js +21 -3
  16. package/lib/module/operations/execute.js.map +1 -1
  17. package/lib/module/operations/session.js.map +1 -1
  18. package/lib/module/types.js +2 -0
  19. package/lib/module/types.js.map +1 -1
  20. package/lib/typescript/commonjs/index.d.ts +6 -1
  21. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  22. package/lib/typescript/commonjs/operations/execute.d.ts +3 -3
  23. package/lib/typescript/commonjs/operations/execute.d.ts.map +1 -1
  24. package/lib/typescript/commonjs/operations/transaction.d.ts.map +1 -1
  25. package/lib/typescript/commonjs/specs/NativeQueryResult.nitro.d.ts +2 -2
  26. package/lib/typescript/commonjs/specs/NativeQueryResult.nitro.d.ts.map +1 -1
  27. package/lib/typescript/commonjs/specs/NitroSQLite.nitro.d.ts +3 -3
  28. package/lib/typescript/commonjs/specs/NitroSQLite.nitro.d.ts.map +1 -1
  29. package/lib/typescript/commonjs/typeORM.d.ts +2 -2
  30. package/lib/typescript/commonjs/typeORM.d.ts.map +1 -1
  31. package/lib/typescript/commonjs/types.d.ts +14 -8
  32. package/lib/typescript/commonjs/types.d.ts.map +1 -1
  33. package/lib/typescript/module/index.d.ts +6 -1
  34. package/lib/typescript/module/index.d.ts.map +1 -1
  35. package/lib/typescript/module/operations/execute.d.ts +3 -3
  36. package/lib/typescript/module/operations/execute.d.ts.map +1 -1
  37. package/lib/typescript/module/operations/transaction.d.ts.map +1 -1
  38. package/lib/typescript/module/specs/NativeQueryResult.nitro.d.ts +2 -2
  39. package/lib/typescript/module/specs/NativeQueryResult.nitro.d.ts.map +1 -1
  40. package/lib/typescript/module/specs/NitroSQLite.nitro.d.ts +3 -3
  41. package/lib/typescript/module/specs/NitroSQLite.nitro.d.ts.map +1 -1
  42. package/lib/typescript/module/typeORM.d.ts +2 -2
  43. package/lib/typescript/module/typeORM.d.ts.map +1 -1
  44. package/lib/typescript/module/types.d.ts +14 -8
  45. package/lib/typescript/module/types.d.ts.map +1 -1
  46. package/nitrogen/generated/android/RNNitroSQLite+autolinking.cmake +1 -1
  47. package/nitrogen/generated/android/RNNitroSQLite+autolinking.gradle +1 -1
  48. package/nitrogen/generated/android/RNNitroSQLiteOnLoad.cpp +1 -1
  49. package/nitrogen/generated/android/RNNitroSQLiteOnLoad.hpp +1 -1
  50. package/nitrogen/generated/ios/RNNitroSQLite+autolinking.rb +1 -1
  51. package/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Bridge.cpp +1 -1
  52. package/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Bridge.hpp +1 -1
  53. package/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Umbrella.hpp +1 -1
  54. package/nitrogen/generated/ios/RNNitroSQLiteAutolinking.mm +1 -1
  55. package/nitrogen/generated/ios/RNNitroSQLiteAutolinking.swift +1 -1
  56. package/nitrogen/generated/shared/c++/BatchQueryCommand.hpp +9 -6
  57. package/nitrogen/generated/shared/c++/BatchQueryResult.hpp +1 -1
  58. package/nitrogen/generated/shared/c++/ColumnType.hpp +1 -1
  59. package/nitrogen/generated/shared/c++/FileLoadResult.hpp +1 -1
  60. package/nitrogen/generated/shared/c++/HybridNativeQueryResultSpec.cpp +1 -1
  61. package/nitrogen/generated/shared/c++/HybridNativeQueryResultSpec.hpp +5 -2
  62. package/nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.cpp +1 -1
  63. package/nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.hpp +6 -3
  64. package/nitrogen/generated/shared/c++/SQLiteNullValue.hpp +68 -0
  65. package/nitrogen/generated/shared/c++/SQLiteQueryColumnMetadata.hpp +1 -1
  66. package/package.json +1 -1
  67. package/src/index.ts +20 -2
  68. package/src/operations/execute.ts +54 -12
  69. package/src/operations/session.ts +6 -6
  70. package/src/operations/transaction.ts +4 -4
  71. package/src/specs/NativeQueryResult.nitro.ts +2 -2
  72. package/src/specs/NitroSQLite.nitro.ts +3 -3
  73. package/src/typeORM.ts +4 -4
  74. package/src/types.ts +20 -15
@@ -1,6 +1,6 @@
1
- import type { QueryResult, SQLiteItem, SQLiteQueryParams, Transaction } from './types';
1
+ import type { QueryResult, Transaction, SQLiteQueryParams, QueryResultRow } from './types';
2
2
  interface TypeOrmNitroSQLiteConnection {
3
- executeSql: <RowData extends SQLiteItem = never>(sql: string, params: SQLiteQueryParams | undefined, okExecute: (res: QueryResult<RowData>) => void, failExecute: (msg: string) => void) => Promise<void>;
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,UAAU,EACV,iBAAiB,EACjB,WAAW,EACZ,MAAM,SAAS,CAAA;AAGhB,UAAU,4BAA4B;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AO,SAAS,cAAc,GAAG,KAAK,EACjD,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,iBAAiB,GAAG,SAAS,EACrC,SAAS,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC,OAAO,CAAC,KAAK,IAAI,EAC9C,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,KAC/B,OAAO,CAAC,IAAI,CAAC,CAAA;IAClB,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACtE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,KAAK,IAAI,CAAA;IACrE,MAAM,EAAE,CACN,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,QAAQ,EAAE,MAAM,IAAI,KACjB,IAAI,CAAA;IACT,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAA;CACtD;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa;4BAEb;QACP,IAAI,EAAE,MAAM,CAAA;QACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;KAClB,MACG,CAAC,EAAE,EAAE,4BAA4B,KAAK,IAAI,QACxC,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,KAC1B,4BAA4B,GAAG,IAAI;CAuDvC,CAAA"}
@@ -23,29 +23,35 @@ export declare enum ColumnType {
23
23
  ARRAY_BUFFER = 4,
24
24
  NULL_VALUE = 5
25
25
  }
26
+ export type SQLiteNullValue = {
27
+ isNitroSQLiteNull: true;
28
+ };
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 SQLiteValue = boolean | number | bigint | string | ArrayBuffer | undefined;
30
- export type SQLiteItem = Record<string, SQLiteValue>;
31
- export interface QueryResult<RowData extends SQLiteItem = SQLiteItem> {
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: RowData[];
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) => RowData | undefined;
50
+ item: (idx: number) => Row | undefined;
44
51
  };
45
52
  }
46
- export type SQLiteQueryParams = SQLiteValue[];
47
- export type ExecuteQuery = <RowData extends SQLiteItem = SQLiteItem>(query: string, params?: SQLiteQueryParams) => QueryResult<RowData>;
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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;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB"}
@@ -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 © 2024 Marc Rousavy @ Margelo
5
+ # Copyright © 2025 Marc Rousavy @ Margelo
6
6
  #
7
7
 
8
8
  # This is a CMake file that adds all files generated by Nitrogen
@@ -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 © 2024 Marc Rousavy @ Margelo
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,7 +2,7 @@
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 © 2024 Marc Rousavy @ Margelo
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "RNNitroSQLiteOnLoad.hpp"
@@ -2,7 +2,7 @@
2
2
  /// RNNitroSQLiteOnLoad.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2024 Marc Rousavy @ Margelo
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include <jni.h>
@@ -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 © 2024 Marc Rousavy @ Margelo
5
+ # Copyright © 2025 Marc Rousavy @ Margelo
6
6
  #
7
7
 
8
8
  # This is a Ruby script that adds all files generated by Nitrogen
@@ -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 © 2024 Marc Rousavy @ Margelo
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-Bridge.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2024 Marc Rousavy @ Margelo
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -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 © 2024 Marc Rousavy @ Margelo
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -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 © 2024 Marc Rousavy @ Margelo
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 © 2024 Marc Rousavy @ Margelo
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 © 2024 Marc Rousavy @ Margelo
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,10 @@ 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, int64_t, bool, std::shared_ptr<ArrayBuffer>>>, std::vector<std::vector<std::variant<std::string, double, int64_t, bool, std::shared_ptr<ArrayBuffer>>>>>> params SWIFT_PRIVATE;
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
- explicit BatchQueryCommand(std::string query, std::optional<std::variant<std::vector<std::variant<std::string, double, int64_t, bool, std::shared_ptr<ArrayBuffer>>>, std::vector<std::vector<std::variant<std::string, double, int64_t, bool, std::shared_ptr<ArrayBuffer>>>>>> params): query(query), params(params) {}
44
+ 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
45
  };
43
46
 
44
47
  } // namespace margelo::nitro::rnnitrosqlite
@@ -54,13 +57,13 @@ namespace margelo::nitro {
54
57
  jsi::Object obj = arg.asObject(runtime);
55
58
  return BatchQueryCommand(
56
59
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "query")),
57
- JSIConverter<std::optional<std::variant<std::vector<std::variant<std::string, double, int64_t, bool, std::shared_ptr<ArrayBuffer>>>, std::vector<std::vector<std::variant<std::string, double, int64_t, bool, std::shared_ptr<ArrayBuffer>>>>>>>::fromJSI(runtime, obj.getProperty(runtime, "params"))
60
+ 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
61
  );
59
62
  }
60
63
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const BatchQueryCommand& arg) {
61
64
  jsi::Object obj(runtime);
62
65
  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, int64_t, bool, std::shared_ptr<ArrayBuffer>>>, std::vector<std::vector<std::variant<std::string, double, int64_t, bool, std::shared_ptr<ArrayBuffer>>>>>>>::toJSI(runtime, arg.params));
66
+ 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
67
  return obj;
65
68
  }
66
69
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -69,7 +72,7 @@ namespace margelo::nitro {
69
72
  }
70
73
  jsi::Object obj = value.getObject(runtime);
71
74
  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, int64_t, bool, std::shared_ptr<ArrayBuffer>>>, std::vector<std::vector<std::variant<std::string, double, int64_t, bool, std::shared_ptr<ArrayBuffer>>>>>>>::canConvert(runtime, obj.getProperty(runtime, "params"))) return false;
75
+ 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
76
  return true;
74
77
  }
75
78
  };
@@ -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 © 2024 Marc Rousavy @ Margelo
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -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 © 2024 Marc Rousavy @ Margelo
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -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 © 2024 Marc Rousavy @ Margelo
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -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 © 2024 Marc Rousavy @ Margelo
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 © 2024 Marc Rousavy @ Margelo
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 {
@@ -55,7 +58,7 @@ namespace margelo::nitro::rnnitrosqlite {
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, int64_t, bool, std::shared_ptr<ArrayBuffer>>>> getResults() = 0;
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 © 2024 Marc Rousavy @ Margelo
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 © 2024 Marc Rousavy @ Margelo
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"
@@ -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, int64_t, bool, std::shared_ptr<ArrayBuffer>>>>& params) = 0;
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, int64_t, bool, std::shared_ptr<ArrayBuffer>>>>& params) = 0;
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,68 @@
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
+ explicit SQLiteNullValue(bool isNitroSQLiteNull): isNitroSQLiteNull(isNitroSQLiteNull) {}
36
+ };
37
+
38
+ } // namespace margelo::nitro::rnnitrosqlite
39
+
40
+ namespace margelo::nitro {
41
+
42
+ using namespace margelo::nitro::rnnitrosqlite;
43
+
44
+ // C++ SQLiteNullValue <> JS SQLiteNullValue (object)
45
+ template <>
46
+ struct JSIConverter<SQLiteNullValue> {
47
+ static inline SQLiteNullValue fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
48
+ jsi::Object obj = arg.asObject(runtime);
49
+ return SQLiteNullValue(
50
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isNitroSQLiteNull"))
51
+ );
52
+ }
53
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const SQLiteNullValue& arg) {
54
+ jsi::Object obj(runtime);
55
+ obj.setProperty(runtime, "isNitroSQLiteNull", JSIConverter<bool>::toJSI(runtime, arg.isNitroSQLiteNull));
56
+ return obj;
57
+ }
58
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
59
+ if (!value.isObject()) {
60
+ return false;
61
+ }
62
+ jsi::Object obj = value.getObject(runtime);
63
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isNitroSQLiteNull"))) return false;
64
+ return true;
65
+ }
66
+ };
67
+
68
+ } // 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 © 2024 Marc Rousavy @ Margelo
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nitro-sqlite",
3
- "version": "9.1.1",
3
+ "version": "9.1.3",
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",
package/src/index.ts CHANGED
@@ -3,8 +3,8 @@ import { HybridNitroSQLite } from './nitro'
3
3
  import { open } from './operations/session'
4
4
  import NitroSQLiteOnLoad from './specs/NativeNitroSQLiteOnLoad'
5
5
  import { execute, executeAsync } from './operations/execute'
6
-
7
- export * from './types'
6
+ import { SQLiteNullValue } from './types'
7
+ export type * from './types'
8
8
  export { typeORMDriver } from './typeORM'
9
9
 
10
10
  export const onInitialized = new Promise<void>((resolve) => {
@@ -25,3 +25,21 @@ export const NitroSQLite = {
25
25
  }
26
26
 
27
27
  export { open } from './operations/session'
28
+
29
+ let ENABLE_SIMPLE_NULL_HANDLING = false
30
+ export function enableSimpleNullHandling(
31
+ shouldEnableSimpleNullHandling = true
32
+ ) {
33
+ ENABLE_SIMPLE_NULL_HANDLING = shouldEnableSimpleNullHandling
34
+ }
35
+ export function isSimpleNullHandlingEnabled() {
36
+ return ENABLE_SIMPLE_NULL_HANDLING
37
+ }
38
+
39
+ export const NITRO_SQLITE_NULL: SQLiteNullValue = { isNitroSQLiteNull: true }
40
+ export function isNitroSQLiteNull(value: any): value is SQLiteNullValue {
41
+ if (typeof value === 'object' && 'isNitroSQLiteNull' in value) {
42
+ return true
43
+ }
44
+ return false
45
+ }
@@ -1,37 +1,79 @@
1
+ import {
2
+ NITRO_SQLITE_NULL,
3
+ isNitroSQLiteNull,
4
+ isSimpleNullHandlingEnabled,
5
+ } from '..'
1
6
  import { HybridNitroSQLite } from '../nitro'
2
7
  import type { NativeQueryResult } from '../specs/NativeQueryResult.nitro'
3
- import type { QueryResult, SQLiteItem, SQLiteQueryParams } from '../types'
8
+ import type {
9
+ QueryResult,
10
+ NativeSQLiteQueryParams,
11
+ SQLiteQueryParams,
12
+ QueryResultRow,
13
+ } from '../types'
4
14
 
5
- export function execute<Data extends SQLiteItem = never>(
15
+ export function execute<Row extends QueryResultRow = never>(
6
16
  dbName: string,
7
17
  query: string,
8
18
  params?: SQLiteQueryParams
9
- ): QueryResult<Data> {
10
- const nativeResult = HybridNitroSQLite.execute(dbName, query, params)
11
- const result = buildJsQueryResult<Data>(nativeResult)
19
+ ): QueryResult<Row> {
20
+ const nativeResult = HybridNitroSQLite.execute(
21
+ dbName,
22
+ query,
23
+ toNativeQueryParams(params)
24
+ )
25
+ const result = buildJsQueryResult<Row>(nativeResult)
12
26
  return result
13
27
  }
14
28
 
15
- export async function executeAsync<Data extends SQLiteItem = never>(
29
+ export async function executeAsync<Row extends QueryResultRow = never>(
16
30
  dbName: string,
17
31
  query: string,
18
32
  params?: SQLiteQueryParams
19
- ): Promise<QueryResult<Data>> {
33
+ ): Promise<QueryResult<Row>> {
34
+ const transformedParams = isSimpleNullHandlingEnabled()
35
+ ? toNativeQueryParams(params)
36
+ : (params as NativeSQLiteQueryParams)
37
+
20
38
  const nativeResult = await HybridNitroSQLite.executeAsync(
21
39
  dbName,
22
40
  query,
23
- params
41
+ transformedParams
24
42
  )
25
- const result = buildJsQueryResult<Data>(nativeResult)
43
+ const result = buildJsQueryResult<Row>(nativeResult)
26
44
  return result
27
45
  }
28
46
 
29
- function buildJsQueryResult<Data extends SQLiteItem = never>({
47
+ function toNativeQueryParams(
48
+ params: SQLiteQueryParams | undefined
49
+ ): NativeSQLiteQueryParams | undefined {
50
+ return params?.map((param) => {
51
+ if (param === undefined || param === null) {
52
+ return NITRO_SQLITE_NULL
53
+ }
54
+ return param
55
+ })
56
+ }
57
+
58
+ function buildJsQueryResult<Row extends QueryResultRow = never>({
30
59
  insertId,
31
60
  rowsAffected,
32
61
  results,
33
- }: NativeQueryResult): QueryResult<Data> {
34
- const data = results as Data[]
62
+ }: NativeQueryResult): QueryResult<Row> {
63
+ let data: Row[] = results as Row[]
64
+
65
+ if (isSimpleNullHandlingEnabled()) {
66
+ data = results.map((row) =>
67
+ Object.fromEntries(
68
+ Object.entries(row).map(([key, value]) => {
69
+ if (isNitroSQLiteNull(value)) {
70
+ return [key, null]
71
+ }
72
+ return [key, value]
73
+ })
74
+ )
75
+ ) as Row[]
76
+ }
35
77
 
36
78
  return {
37
79
  insertId,
@@ -5,9 +5,9 @@ import type {
5
5
  NitroSQLiteConnection,
6
6
  NitroSQLiteConnectionOptions,
7
7
  QueryResult,
8
- SQLiteItem,
9
- SQLiteQueryParams,
10
8
  Transaction,
9
+ SQLiteQueryParams,
10
+ QueryResultRow,
11
11
  } from '../types'
12
12
  import { execute, executeAsync } from './execute'
13
13
 
@@ -24,14 +24,14 @@ export function open(
24
24
  detach: (alias: string) => HybridNitroSQLite.detach(options.name, alias),
25
25
  transaction: (fn: (tx: Transaction) => Promise<void> | void) =>
26
26
  transaction(options.name, fn),
27
- execute: <Data extends SQLiteItem = never>(
27
+ execute: <Row extends QueryResultRow = never>(
28
28
  query: string,
29
29
  params?: SQLiteQueryParams
30
- ): QueryResult<Data> => execute(options.name, query, params),
31
- executeAsync: <Data extends SQLiteItem = never>(
30
+ ): QueryResult<Row> => execute(options.name, query, params),
31
+ executeAsync: <Row extends QueryResultRow = never>(
32
32
  query: string,
33
33
  params?: SQLiteQueryParams
34
- ): Promise<QueryResult<Data>> => executeAsync(options.name, query, params),
34
+ ): Promise<QueryResult<Row>> => executeAsync(options.name, query, params),
35
35
  executeBatch: (commands: BatchQueryCommand[]) =>
36
36
  HybridNitroSQLite.executeBatch(options.name, commands),
37
37
  executeBatchAsync: (commands: BatchQueryCommand[]) =>