@op-engineering/op-sqlite 11.4.2 → 11.4.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.
- package/cpp/DBHostObject.cpp +4 -2
- package/package.json +1 -1
package/cpp/DBHostObject.cpp
CHANGED
|
@@ -144,6 +144,7 @@ DBHostObject::DBHostObject(jsi::Runtime &rt, std::string &url,
|
|
|
144
144
|
std::string &auth_token,
|
|
145
145
|
std::shared_ptr<react::CallInvoker> invoker)
|
|
146
146
|
: db_name(url), invoker(std::move(invoker)), rt(rt) {
|
|
147
|
+
_thread_pool = std::make_shared<ThreadPool>();
|
|
147
148
|
db = opsqlite_libsql_open_remote(url, auth_token);
|
|
148
149
|
|
|
149
150
|
create_jsi_functions();
|
|
@@ -155,6 +156,7 @@ DBHostObject::DBHostObject(jsi::Runtime &rt,
|
|
|
155
156
|
std::string &url, std::string &auth_token,
|
|
156
157
|
int sync_interval)
|
|
157
158
|
: db_name(db_name), invoker(std::move(invoker)), rt(rt) {
|
|
159
|
+
_thread_pool = std::make_shared<ThreadPool>();
|
|
158
160
|
db = opsqlite_libsql_open_sync(db_name, path, url, auth_token,
|
|
159
161
|
sync_interval);
|
|
160
162
|
|
|
@@ -371,7 +373,7 @@ void DBHostObject::create_jsi_functions() {
|
|
|
371
373
|
: std::vector<JSVariant>();
|
|
372
374
|
|
|
373
375
|
auto promiseCtr = rt.global().getPropertyAsFunction(rt, "Promise");
|
|
374
|
-
|
|
376
|
+
auto promise = promiseCtr.callAsConstructor(rt,
|
|
375
377
|
HOSTFN("executor") {
|
|
376
378
|
auto task = [this, &rt, query, params,
|
|
377
379
|
resolve = std::make_shared<jsi::Value>(rt, args[0]),
|
|
@@ -425,7 +427,7 @@ void DBHostObject::create_jsi_functions() {
|
|
|
425
427
|
return {};
|
|
426
428
|
}));
|
|
427
429
|
|
|
428
|
-
|
|
430
|
+
return promise;
|
|
429
431
|
});
|
|
430
432
|
|
|
431
433
|
function_map["executeWithHostObjects"] = HOSTFN("executeWithHostObjects") {
|