@op-engineering/op-sqlite 7.0.1 → 7.0.5

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.
@@ -179,7 +179,7 @@ DBHostObject::DBHostObject(jsi::Runtime &rt, std::string &base_path,
179
179
  BridgeResult result =
180
180
  opsqlite_open(db_name, path, crsqlite_path, encryption_key);
181
181
  #elif OP_SQLITE_USE_LIBSQL
182
- BridgeResult result = opsqlite_libsql_open(db_name, path);
182
+ BridgeResult result = opsqlite_libsql_open(db_name, path, crsqlite_path);
183
183
  #else
184
184
  BridgeResult result = opsqlite_open(db_name, path, crsqlite_path);
185
185
  #endif
@@ -80,7 +80,8 @@ BridgeResult opsqlite_libsql_open_sync(std::string const &name,
80
80
  }
81
81
 
82
82
  BridgeResult opsqlite_libsql_open(std::string const &name,
83
- std::string const &last_path) {
83
+ std::string const &last_path,
84
+ std::string const &crsqlitePath) {
84
85
  std::string path = opsqlite_get_db_path(name, last_path);
85
86
 
86
87
  int status = 0;
@@ -100,6 +101,19 @@ BridgeResult opsqlite_libsql_open(std::string const &name,
100
101
  return {.type = SQLiteError, .message = err};
101
102
  }
102
103
 
104
+ #ifdef OP_SQLITE_USE_CRSQLITE
105
+ const char *errMsg;
106
+ const char *crsqliteEntryPoint = "sqlite3_crsqlite_init";
107
+
108
+ status = libsql_load_extension(c, crsqlitePath.c_str(), crsqliteEntryPoint, &errMsg);
109
+
110
+ if (status != 0) {
111
+ return {.type = SQLiteError, .message = errMsg};
112
+ } else {
113
+ LOGI("Loaded CRSQlite successfully");
114
+ }
115
+ #endif
116
+
103
117
  db_map[name] = {.db = db, .c = c};
104
118
 
105
119
  return {.type = SQLiteOk, .affectedRows = 0};
@@ -28,7 +28,8 @@ std::string opsqlite_get_db_path(std::string const &name,
28
28
  std::string const &location);
29
29
 
30
30
  BridgeResult opsqlite_libsql_open(std::string const &name,
31
- std::string const &path);
31
+ std::string const &path,
32
+ std::string const &crsqlitePath);
32
33
 
33
34
  BridgeResult opsqlite_libsql_open_remote(std::string const &url,
34
35
  std::string const &auth_token);
@@ -91,6 +91,11 @@ void libsql_close(libsql_database_t db);
91
91
 
92
92
  int libsql_connect(libsql_database_t db, libsql_connection_t *out_conn, const char **out_err_msg);
93
93
 
94
+ int libsql_load_extension(libsql_connection_t conn,
95
+ const char *path,
96
+ const char *entry_point,
97
+ const char **out_err_msg);
98
+
94
99
  int libsql_reset(libsql_connection_t conn, const char **out_err_msg);
95
100
 
96
101
  void libsql_disconnect(libsql_connection_t conn);
@@ -91,6 +91,11 @@ void libsql_close(libsql_database_t db);
91
91
 
92
92
  int libsql_connect(libsql_database_t db, libsql_connection_t *out_conn, const char **out_err_msg);
93
93
 
94
+ int libsql_load_extension(libsql_connection_t conn,
95
+ const char *path,
96
+ const char *entry_point,
97
+ const char **out_err_msg);
98
+
94
99
  int libsql_reset(libsql_connection_t conn, const char **out_err_msg);
95
100
 
96
101
  void libsql_disconnect(libsql_connection_t conn);
@@ -91,6 +91,11 @@ void libsql_close(libsql_database_t db);
91
91
 
92
92
  int libsql_connect(libsql_database_t db, libsql_connection_t *out_conn, const char **out_err_msg);
93
93
 
94
+ int libsql_load_extension(libsql_connection_t conn,
95
+ const char *path,
96
+ const char *entry_point,
97
+ const char **out_err_msg);
98
+
94
99
  int libsql_reset(libsql_connection_t conn, const char **out_err_msg);
95
100
 
96
101
  void libsql_disconnect(libsql_connection_t conn);
package/op-sqlite.podspec CHANGED
@@ -130,15 +130,15 @@ Pod::Spec.new do |s|
130
130
  end
131
131
 
132
132
  if use_libsql then
133
- if use_crsqlite then
134
- raise "Cannot use CRSQLite and libsql at the same time"
135
- end
136
-
137
133
  if use_sqlcipher then
138
134
  raise "Cannot use SQLCipher and libsql at the same time"
139
135
  end
140
136
  xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " OP_SQLITE_USE_LIBSQL=1"
141
- s.vendored_frameworks = "ios/libsql.xcframework"
137
+ if use_crsqlite then
138
+ s.vendored_frameworks = "ios/libsql.xcframework", "ios/crsqlite.xcframework"
139
+ else
140
+ s.vendored_frameworks = "ios/libsql.xcframework"
141
+ end
142
142
  end
143
143
 
144
144
  if sqlite_flags != "" then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@op-engineering/op-sqlite",
3
- "version": "7.0.1",
3
+ "version": "7.0.5",
4
4
  "description": "Next generation SQLite for React Native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",