@@ -75,11 +75,11 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> jsCallInvoker
7575 tempDocPath = tempDocPath + " /" + args[1 ].asString (rt).utf8 (rt);
7676 }
7777
78- SequelResult result = sequel_open (dbName, tempDocPath);
78+ SQLiteOPResult result = sqliteOpenDb (dbName, tempDocPath);
7979
80- if (result.type == SequelResultError )
80+ if (result.type == SQLiteError )
8181 {
82- return createError (rt, result.message .c_str ());
82+ return createError (rt, result.errorMessage .c_str ());
8383 }
8484
8585 return createOk (rt);
@@ -99,7 +99,7 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> jsCallInvoker
9999 // string dbName = args[0].asString(rt).utf8(rt);
100100 // SequelResult result = sequel_attach(dbName);
101101 //
102- // if (result.type == SequelResultError )
102+ // if (result.type == SQLiteError )
103103 // {
104104 // jsi::detail::throwJSError(rt, result.message.c_str());
105105 // return {};
@@ -127,14 +127,14 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> jsCallInvoker
127127
128128 string dbName = args[0 ].asString (rt).utf8 (rt);
129129
130- SequelResult result = sequel_close (dbName);
130+ SQLiteOPResult result = sqliteCloseDb (dbName);
131131
132- if (result.type == SequelResultError )
132+ if (result.type == SQLiteError )
133133 {
134- return createError (rt, result.message .c_str ());
134+ return createError (rt, result.errorMessage .c_str ());
135135 }
136136
137- return move (result. value );
137+ return createOk (rt );
138138 });
139139
140140 // Delete db
@@ -156,11 +156,11 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> jsCallInvoker
156156
157157 string dbName = args[0 ].asString (rt).utf8 (rt);
158158
159- SequelResult result = sequel_remove (dbName, docPathStr);
159+ SQLiteOPResult result = sqliteRemoveDb (dbName, docPathStr);
160160
161- if (result.type == SequelResultError )
161+ if (result.type == SQLiteError )
162162 {
163- return createError (rt, result.message .c_str ());
163+ return createError (rt, result.errorMessage .c_str ());
164164 }
165165
166166 return jsi::Value::undefined ();
@@ -182,7 +182,7 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> jsCallInvoker
182182
183183 // Filling the results
184184 vector<map<string, QuickValue>> results;
185- auto status = sequel_execute3 (dbName, query, ¶ms, &results);
185+ auto status = sqliteExecute (dbName, query, ¶ms, &results);
186186
187187 // Converting results into a JSI Response
188188 auto jsiResult = createSequelQueryExecutionResult (rt, status, &results);
@@ -213,13 +213,14 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> jsCallInvoker
213213 jsiBatchParametersToQuickArguments (rt, batchParams, &commands);
214214
215215 auto batchResult = executeBatch (dbName, &commands);
216- if (batchResult.type == SequelResultOk )
216+ if (batchResult.type == SQLiteOk )
217217 {
218218 auto res = jsi::Object (rt);
219219 res.setProperty (rt, " status" , jsi::Value (0 ));
220220 res.setProperty (rt, " rowsAffected" , jsi::Value (batchResult.affectedRows ));
221221 return move (res);
222- } else
222+ }
223+ else
223224 {
224225 return createError (rt, batchResult.message );
225226 }
@@ -239,7 +240,8 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> jsCallInvoker
239240
240241 const jsi::Value ¶ms = args[1 ];
241242 const jsi::Value &callbackHolder = args[2 ];
242- if (!callbackHolder.isObject () || !callbackHolder.asObject (rt).isFunction (rt)) {
243+ if (!callbackHolder.isObject () || !callbackHolder.asObject (rt).isFunction (rt))
244+ {
243245 jsi::detail::throwJSError (rt, " [react-native-quick-sqlite][asyncExecuteSqlBatch] The callback argument must be a function" );
244246 return {};
245247 }
@@ -264,9 +266,9 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> jsCallInvoker
264266 {
265267 // Inside the new worker thread, we can now call sqlite operations
266268 auto batchResult = executeBatch (dbName, commands.get ());
267- invoker->invokeAsync ([&rt, batchResult = move (batchResult), callback]
268- {
269- if (batchResult.type == SequelResultOk )
269+ invoker->invokeAsync ([&rt, batchResult = move (batchResult), callback]
270+ {
271+ if (batchResult.type == SQLiteOk )
270272 {
271273 auto res = jsi::Object (rt);
272274 res.setProperty (rt, " status" , jsi::Value (0 ));
@@ -275,8 +277,7 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> jsCallInvoker
275277 } else
276278 {
277279 callback->asObject (rt).asFunction (rt).call (rt, createError (rt, batchResult.message ));
278- }
279- });
280+ } });
280281 }
281282 catch (std::exception &exc)
282283 {
@@ -299,7 +300,7 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> jsCallInvoker
299300 const string sqlFileName = args[1 ].asString (rt).utf8 (rt);
300301
301302 const auto importResult = importSQLFile (dbName, sqlFileName);
302- if (importResult.type == SequelResultOk )
303+ if (importResult.type == SQLiteOk )
303304 {
304305 auto res = jsi::Object (rt);
305306 res.setProperty (rt, " status" , jsi::Value (0 ));
@@ -327,7 +328,8 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> jsCallInvoker
327328 }
328329
329330 const jsi::Value &callbackHolder = args[2 ];
330- if (!callbackHolder.isObject () || !callbackHolder.asObject (rt).isFunction (rt)) {
331+ if (!callbackHolder.isObject () || !callbackHolder.asObject (rt).isFunction (rt))
332+ {
331333 jsi::detail::throwJSError (rt, " [react-native-quick-sqlite][asyncLoadSqlFile] The callback argument must be a function" );
332334 return {};
333335 }
@@ -347,7 +349,7 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> jsCallInvoker
347349 // Executing the callback invoke inside the JavaScript thread in order to safe build JSI objects that depends on jsi::Runtime and must be synchronized.
348350 invoker->invokeAsync ([&rt, result = move (importResult), callback]
349351 {
350- if (result.type == SequelResultOk )
352+ if (result.type == SQLiteOk )
351353 {
352354 auto res = jsi::Object (rt);
353355 res.setProperty (rt, " status" , jsi::Value (0 ));
@@ -383,11 +385,12 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> jsCallInvoker
383385 }
384386
385387 const jsi::Value &callbackHolder = args[3 ];
386- if (!callbackHolder.isObject () || !callbackHolder.asObject (rt).isFunction (rt)) {
388+ if (!callbackHolder.isObject () || !callbackHolder.asObject (rt).isFunction (rt))
389+ {
387390 jsi::detail::throwJSError (rt, " [react-native-quick-sqlite][asyncExecuteSql] The callback argument must be a function" );
388391 return {};
389392 }
390-
393+
391394 const string dbName = args[0 ].asString (rt).utf8 (rt);
392395 const string query = args[1 ].asString (rt).utf8 (rt);
393396 const jsi::Value &originalParams = args[2 ];
@@ -404,7 +407,7 @@ void install(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> jsCallInvoker
404407 {
405408 // Inside the new worker thread, we can now call sqlite operations
406409 vector<map<string, QuickValue>> results;
407- auto status = sequel_execute3 (dbName, query, params.get (), &results);
410+ auto status = sqliteExecute (dbName, query, params.get (), &results);
408411 invoker->invokeAsync ([&rt, results = make_shared<vector<map<string, QuickValue>>>(results), status_copy = move (status), callback]
409412 {
410413 // Now, back into the JavaScript thread, we can translate the results
0 commit comments