react-native-nitro-sqlite 9.1.3 → 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.
@@ -181,7 +181,7 @@ SQLiteExecuteQueryResult sqliteExecute(const std::string& dbName, const std::str
181
181
  const void* blob = sqlite3_column_blob(statement, i);
182
182
  uint8_t* data = new uint8_t[blob_size];
183
183
  memcpy(data, blob, blob_size);
184
- row[column_name] = ArrayBuffer::makeBuffer(data, blob_size, [&data]() -> void { delete[] data; });
184
+ row[column_name] = ArrayBuffer::wrap(data, blob_size, [&data]() -> void { delete[] data; });
185
185
  break;
186
186
  }
187
187
  case SQLITE_NULL:
@@ -0,0 +1 @@
1
+ * linguist-generated
@@ -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)
@@ -5,6 +5,10 @@
5
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>
@@ -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
+ }
@@ -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'] || {}
@@ -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
@@ -41,6 +41,7 @@ namespace margelo::nitro::rnnitrosqlite {
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
+ BatchQueryCommand() = default;
44
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) {}
45
46
  };
46
47
 
@@ -52,7 +53,7 @@ namespace margelo::nitro {
52
53
 
53
54
  // C++ BatchQueryCommand <> JS BatchQueryCommand (object)
54
55
  template <>
55
- struct JSIConverter<BatchQueryCommand> {
56
+ struct JSIConverter<BatchQueryCommand> final {
56
57
  static inline BatchQueryCommand fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
57
58
  jsi::Object obj = arg.asObject(runtime);
58
59
  return BatchQueryCommand(
@@ -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(
@@ -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);
@@ -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(
@@ -52,7 +52,7 @@ namespace margelo::nitro::rnnitrosqlite {
52
52
  explicit HybridNativeQueryResultSpec(): HybridObject(TAG) { }
53
53
 
54
54
  // Destructor
55
- virtual ~HybridNativeQueryResultSpec() { }
55
+ ~HybridNativeQueryResultSpec() override = default;
56
56
 
57
57
  public:
58
58
  // Properties
@@ -62,7 +62,7 @@ namespace margelo::nitro::rnnitrosqlite {
62
62
  explicit HybridNitroSQLiteSpec(): HybridObject(TAG) { }
63
63
 
64
64
  // Destructor
65
- virtual ~HybridNitroSQLiteSpec() { }
65
+ ~HybridNitroSQLiteSpec() override = default;
66
66
 
67
67
  public:
68
68
  // Properties
@@ -32,6 +32,7 @@ namespace margelo::nitro::rnnitrosqlite {
32
32
  bool isNitroSQLiteNull SWIFT_PRIVATE;
33
33
 
34
34
  public:
35
+ SQLiteNullValue() = default;
35
36
  explicit SQLiteNullValue(bool isNitroSQLiteNull): isNitroSQLiteNull(isNitroSQLiteNull) {}
36
37
  };
37
38
 
@@ -43,7 +44,7 @@ namespace margelo::nitro {
43
44
 
44
45
  // C++ SQLiteNullValue <> JS SQLiteNullValue (object)
45
46
  template <>
46
- struct JSIConverter<SQLiteNullValue> {
47
+ struct JSIConverter<SQLiteNullValue> final {
47
48
  static inline SQLiteNullValue fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
48
49
  jsi::Object obj = arg.asObject(runtime);
49
50
  return SQLiteNullValue(
@@ -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",
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.74.0",
82
- "react-native-nitro-modules": ">=0.20.1"
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"