@op-engineering/op-sqlite 6.0.2-beta4 → 6.0.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.
@@ -5,6 +5,7 @@
5
5
  #else
6
6
  #include "bridge.h"
7
7
  #endif
8
+ #include "logs.h"
8
9
  #include "macros.h"
9
10
  #include "utils.h"
10
11
  #include <iostream>
@@ -26,7 +27,7 @@ void DBHostObject::auto_register_update_hook() {
26
27
  return;
27
28
  }
28
29
 
29
- auto hook = [this](std::string dbName, std::string table_name,
30
+ auto hook = [this](std::string name, std::string table_name,
30
31
  std::string operation, int rowId) {
31
32
  if (update_hook_callback != nullptr) {
32
33
  std::vector<JSVariant> params;
@@ -37,17 +38,17 @@ void DBHostObject::auto_register_update_hook() {
37
38
  if (operation != "DELETE") {
38
39
  std::string query = "SELECT * FROM " + table_name +
39
40
  " where rowid = " + std::to_string(rowId) + ";";
40
- opsqlite_execute(dbName, query, &params, &results, metadata);
41
+ opsqlite_execute(name, query, &params, &results, metadata);
41
42
  }
42
43
 
43
44
  jsCallInvoker->invokeAsync(
44
45
  [this,
45
46
  results = std::make_shared<std::vector<DumbHostObject>>(results),
46
- callback = update_hook_callback, tableName = std::move(table_name),
47
+ callback = update_hook_callback, table_name,
47
48
  operation = std::move(operation), &rowId] {
48
49
  auto res = jsi::Object(rt);
49
50
  res.setProperty(rt, "table",
50
- jsi::String::createFromUtf8(rt, tableName));
51
+ jsi::String::createFromUtf8(rt, table_name));
51
52
  res.setProperty(rt, "operation",
52
53
  jsi::String::createFromUtf8(rt, operation));
53
54
  res.setProperty(rt, "rowId", jsi::Value(rowId));
@@ -63,7 +64,6 @@ void DBHostObject::auto_register_update_hook() {
63
64
  }
64
65
 
65
66
  for (const auto &query_ptr : reactive_queries) {
66
-
67
67
  auto query = query_ptr.get();
68
68
  if (query->discriminators.size() == 0) {
69
69
  continue;
@@ -75,7 +75,6 @@ void DBHostObject::auto_register_update_hook() {
75
75
  if (discriminator.table != table_name) {
76
76
  continue;
77
77
  }
78
-
79
78
  // Table has matched
80
79
 
81
80
  // If no ids are specified, then we should fire
@@ -42,15 +42,8 @@ std::string opsqlite_get_db_path(std::string const &db_name,
42
42
  return location + "/" + db_name;
43
43
  }
44
44
 
45
- #ifdef OP_SQLITE_USE_SQLCIPHER
46
- BridgeResult opsqlite_open(std::string const &dbName,
47
- std::string const &last_path,
48
- std::string const &crsqlitePath,
49
- std::string const &encryptionKey) {
50
- #else
51
45
  BridgeResult opsqlite_libsql_open(std::string const &name,
52
46
  std::string const &last_path) {
53
- #endif
54
47
  std::string path = opsqlite_get_db_path(name, last_path);
55
48
 
56
49
  int status = 0;
@@ -72,11 +65,6 @@ BridgeResult opsqlite_libsql_open(std::string const &name,
72
65
 
73
66
  db_map[name] = {.db = db, .c = c};
74
67
 
75
- #ifdef OP_SQLITE_USE_SQLCIPHER
76
- opsqlite_execute(dbName, "PRAGMA key = '" + encryptionKey + "'", nullptr,
77
- nullptr, nullptr);
78
- #endif
79
-
80
68
  return {.type = SQLiteOk, .affectedRows = 0};
81
69
  }
82
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@op-engineering/op-sqlite",
3
- "version": "6.0.2-beta4",
3
+ "version": "6.0.4",
4
4
  "description": "Next generation SQLite for React Native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",