@op-engineering/op-sqlite 2.0.18 → 2.0.20

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.
@@ -7,17 +7,13 @@
7
7
  #include <typeinfo>
8
8
 
9
9
  struct OPSQLiteBridge : jni::JavaClass<OPSQLiteBridge> {
10
- static constexpr auto kJavaDescriptor =
11
- "Lcom/op/sqlite/OPSQLiteBridge;";
10
+ static constexpr auto kJavaDescriptor = "Lcom/op/sqlite/OPSQLiteBridge;";
12
11
 
13
12
  static void registerNatives() {
14
13
  javaClassStatic()->registerNatives(
15
- {
16
- makeNativeMethod("installNativeJsi",
17
- OPSQLiteBridge::installNativeJsi),
14
+ {makeNativeMethod("installNativeJsi", OPSQLiteBridge::installNativeJsi),
18
15
  makeNativeMethod("clearStateNativeJsi",
19
- OPSQLiteBridge::clearStateNativeJsi)
20
- });
16
+ OPSQLiteBridge::clearStateNativeJsi)});
21
17
  }
22
18
 
23
19
  private:
@@ -31,7 +27,7 @@ private:
31
27
 
32
28
  opsqlite::install(*jsiRuntime, jsCallInvoker, dbPathStr.c_str());
33
29
  }
34
-
30
+
35
31
  static void clearStateNativeJsi(jni::alias_ref<jni::JObject> thiz) {
36
32
  opsqlite::clearState();
37
33
  }
package/cpp/bridge.cpp CHANGED
@@ -146,6 +146,9 @@ BridgeResult opsqlite_remove(std::string const &dbName,
146
146
 
147
147
  inline void opsqlite_bind_statement(sqlite3_stmt *statement,
148
148
  const std::vector<JSVariant> *values) {
149
+ // reset any existing bound values
150
+ sqlite3_clear_bindings(statement);
151
+
149
152
  size_t size = values->size();
150
153
 
151
154
  for (int ii = 0; ii < size; ii++) {
@@ -181,8 +184,6 @@ BridgeResult opsqlite_execute_prepared_statement(
181
184
 
182
185
  check_db_open(dbName);
183
186
 
184
- sqlite3_reset(statement);
185
-
186
187
  sqlite3 *db = dbMap[dbName];
187
188
 
188
189
  const char *errorMessage;
@@ -296,8 +297,9 @@ BridgeResult opsqlite_execute_prepared_statement(
296
297
  }
297
298
  }
298
299
 
299
- if (isFailed) {
300
+ sqlite3_reset(statement);
300
301
 
302
+ if (isFailed) {
301
303
  return {.type = SQLiteError,
302
304
  .message = "[op-sqlite] SQLite code: " + std::to_string(result) +
303
305
  " execution error: " + std::string(errorMessage)};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@op-engineering/op-sqlite",
3
- "version": "2.0.18",
3
+ "version": "2.0.20",
4
4
  "description": "Next generation SQLite for React Native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -50,6 +50,7 @@
50
50
  "react": "18.2.0",
51
51
  "react-native": "0.73.1",
52
52
  "react-native-builder-bob": "^0.23.2",
53
+ "turbo": "^1.12.4",
53
54
  "typescript": "5.0.4"
54
55
  },
55
56
  "peerDependencies": {
@@ -64,6 +65,9 @@
64
65
  "javaPackageName": "com.op.sqlite"
65
66
  }
66
67
  },
68
+ "workspaces": [
69
+ "example"
70
+ ],
67
71
  "prettier": {
68
72
  "quoteProps": "consistent",
69
73
  "singleQuote": true,
@@ -84,5 +88,6 @@
84
88
  }
85
89
  ]
86
90
  ]
87
- }
91
+ },
92
+ "packageManager": "yarn@4.1.0"
88
93
  }