From 60cd4c5d86c862f55f8a6d08b5ba26e97bd55cda Mon Sep 17 00:00:00 2001 From: Oscar Franco Date: Mon, 26 Oct 2026 09:27:42 -0600 Subject: [PATCH] Run clang-format over the native sources Formatting only, with the repo's .clang-format (LLVM). Covers cpp/OP*, the libsql and Turso bridges, android/cpp-adapter.cpp, ios/OPSQLite.*, the example bridging header and op-sqlite-spm-prefix.h. Vendored sqlite/sqlcipher amalgamations, libsql/turso headers and the generated tokenizers are left untouched. Co-Authored-By: Claude Opus 5.5 --- android/cpp-adapter.cpp | 2 +- cpp/OPBridge.cpp | 18 ++--- cpp/OPDatabase.cpp | 35 +++++----- cpp/OPDatabase.hpp | 29 ++++---- cpp/OPDumbHostObject.cpp | 70 +++++++++---------- cpp/OPLogs.h | 34 ++++----- cpp/OPSmartHostObject.cpp | 26 +++---- cpp/OPSqlite.cpp | 36 +++++----- cpp/OPUtils.cpp | 9 +-- cpp/libsql/OPLibsqlBridge.cpp | 8 +-- cpp/libsql/OPLibsqlBridge.hpp | 2 +- cpp/turso/OPTursoBridge.cpp | 8 +-- example/ios/OPSQLiteExample-Bridging-Header.h | 4 +- ios/OPSQLite.mm | 9 ++- 14 files changed, 148 insertions(+), 142 deletions(-) diff --git a/android/cpp-adapter.cpp b/android/cpp-adapter.cpp index 3f800c49..b1829a50 100644 --- a/android/cpp-adapter.cpp +++ b/android/cpp-adapter.cpp @@ -1,5 +1,5 @@ -#include "OPSqlite.hpp" #include "OPLogs.h" +#include "OPSqlite.hpp" #include #include #include diff --git a/cpp/OPBridge.cpp b/cpp/OPBridge.cpp index 80b559b5..88da1797 100644 --- a/cpp/OPBridge.cpp +++ b/cpp/OPBridge.cpp @@ -5,8 +5,8 @@ #include "OPBridge.hpp" #include "OPDatabase.hpp" #include "OPDumbHostObject.hpp" -#include "OPSmartHostObject.hpp" #include "OPLogs.h" +#include "OPSmartHostObject.hpp" #include "OPUtils.hpp" #include #include @@ -216,9 +216,7 @@ void create_dirs_if_needed(const std::string &path) { } } -void opsqlite_close(sqlite3 *db) { - sqlite3_close_v2(db); -} +void opsqlite_close(sqlite3 *db) { sqlite3_close_v2(db); } void opsqlite_attach(sqlite3 *db, std::string const &doc_path, std::string const &secondary_db_name, @@ -437,7 +435,8 @@ BridgeResult opsqlite_execute(sqlite3 *db, std::string const &query, } if (params != nullptr && !params->empty()) { - opsqlite_bind_statement(statement, params, /* should_clear_bindings */ false); + opsqlite_bind_statement(statement, params, + /* should_clear_bindings */ false); } // sqlite3_column_count is the correct signal: it's non-zero for any @@ -574,7 +573,8 @@ BridgeResult opsqlite_execute_host_objects( } if (params != nullptr && !params->empty()) { - opsqlite_bind_statement(statement, params, /* should_clear_bindings */ false); + opsqlite_bind_statement(statement, params, + /* should_clear_bindings */ false); } int i, count, column_type; @@ -727,7 +727,8 @@ opsqlite_execute_raw(sqlite3 *db, std::string const &query, } if (params != nullptr && !params->empty()) { - opsqlite_bind_statement(statement, params, /* should_clear_bindings */ false); + opsqlite_bind_statement(statement, params, + /* should_clear_bindings */ false); } int i, column_type; @@ -939,7 +940,8 @@ opsqlite_execute_batch(sqlite3 *db, return run_in_transaction( [db](const char *sql) { opsqlite_execute(db, sql, nullptr); }, [db]() -> std::optional { return opsqlite_in_transaction(db); }, - "BEGIN TRANSACTION", [&]() { + "BEGIN TRANSACTION", + [&]() { int affectedRows = 0; for (int i = 0; i < commandCount; i++) { const auto &command = commands->at(i); diff --git a/cpp/OPDatabase.cpp b/cpp/OPDatabase.cpp index 213faa6c..35d316c7 100644 --- a/cpp/OPDatabase.cpp +++ b/cpp/OPDatabase.cpp @@ -98,7 +98,7 @@ void OPDatabase::on_rollback() { } void OPDatabase::on_update(const std::string &table, - const std::string &operation, long long row_id) { + const std::string &operation, long long row_id) { if (alive != nullptr && !alive->load()) { return; } @@ -203,7 +203,7 @@ void OPDatabase::release_hooks() { #ifdef OP_SQLITE_USE_LIBSQL // Remote connection constructor OPDatabase::OPDatabase(jsi::Runtime &rt, jsi::Object &js_object, - std::string &url, std::string &auth_token) + std::string &url, std::string &auth_token) : db_name(url) { worker_thread = std::make_shared(); db = opsqlite_libsql_open_remote(url, auth_token); @@ -213,11 +213,11 @@ OPDatabase::OPDatabase(jsi::Runtime &rt, jsi::Object &js_object, // Sync connection constructor OPDatabase::OPDatabase(jsi::Runtime &rt, jsi::Object &js_object, - std::string &db_name, std::string &path, - std::string &url, std::string &auth_token, - int sync_interval, bool offline, - std::string &encryption_key, - std::string &remote_encryption_key) + std::string &db_name, std::string &path, + std::string &url, std::string &auth_token, + int sync_interval, bool offline, + std::string &encryption_key, + std::string &remote_encryption_key) : base_path(path), db_name(db_name), delete_db_name(db_name) { worker_thread = std::make_shared(); @@ -232,8 +232,8 @@ OPDatabase::OPDatabase(jsi::Runtime &rt, jsi::Object &js_object, #elif defined(OP_SQLITE_USE_TURSO) // Remote connection constructor OPDatabase::OPDatabase(jsi::Runtime &rt, jsi::Object &js_object, - std::string &url, std::string &auth_token, - std::string &base_path) + std::string &url, std::string &auth_token, + std::string &base_path) : base_path(base_path), db_name(url), delete_db_name(turso_remote_db_name(url)) { worker_thread = std::make_shared(); @@ -244,9 +244,9 @@ OPDatabase::OPDatabase(jsi::Runtime &rt, jsi::Object &js_object, // Sync connection constructor OPDatabase::OPDatabase(jsi::Runtime &rt, jsi::Object &js_object, - std::string &db_name, std::string &path, - std::string &url, std::string &auth_token, - std::string &remote_encryption_key) + std::string &db_name, std::string &path, + std::string &url, std::string &auth_token, + std::string &remote_encryption_key) : base_path(path), db_name(db_name), delete_db_name(db_name) { worker_thread = std::make_shared(); @@ -260,9 +260,9 @@ OPDatabase::OPDatabase(jsi::Runtime &rt, jsi::Object &js_object, #endif OPDatabase::OPDatabase(jsi::Runtime &rt, jsi::Object &js_object, - std::string &base_path, std::string &db_name, - std::string &path, bool readOnly, - bool failOnCreate, std::string &encryption_key) + std::string &base_path, std::string &db_name, + std::string &path, bool readOnly, bool failOnCreate, + std::string &encryption_key) : base_path(base_path), db_name(db_name), delete_db_name(db_name) { worker_thread = std::make_shared(); @@ -280,7 +280,7 @@ OPDatabase::OPDatabase(jsi::Runtime &rt, jsi::Object &js_object, }; void OPDatabase::create_jsi_functions(jsi::Runtime &rt, - jsi::Object &js_object) { + jsi::Object &js_object) { js_object.setProperty(rt, "attach", HFN(this) { throw_if_closed("attach"); @@ -757,7 +757,8 @@ void OPDatabase::create_jsi_functions(jsi::Runtime &rt, } catch (const SQLiteError &e) { throw_js_error(rt, e); } - opsqlite_bind_statement(stmt, &variant_args, /* should_clear_bindings */ false); + opsqlite_bind_statement(stmt, &variant_args, + /* should_clear_bindings */ false); auto callback = std::make_shared(query.getProperty(rt, "callback")); diff --git a/cpp/OPDatabase.hpp b/cpp/OPDatabase.hpp index ba6948c6..ccdcb0dd 100644 --- a/cpp/OPDatabase.hpp +++ b/cpp/OPDatabase.hpp @@ -41,35 +41,33 @@ struct ReactiveQuery { std::shared_ptr callback; }; -class JSI_EXPORT OPDatabase - : public jsi::NativeState, - public std::enable_shared_from_this { +class JSI_EXPORT OPDatabase : public jsi::NativeState, + public std::enable_shared_from_this { public: // Normal constructor shared between all backends - OPDatabase(jsi::Runtime &rt, jsi::Object &js_object, - std::string &base_path, std::string &db_name, - std::string &path, bool readOnly, bool failOnCreate, - std::string &encryption_key); + OPDatabase(jsi::Runtime &rt, jsi::Object &js_object, std::string &base_path, + std::string &db_name, std::string &path, bool readOnly, + bool failOnCreate, std::string &encryption_key); #ifdef OP_SQLITE_USE_LIBSQL // Constructor for remoteOpen, purely for remote databases OPDatabase(jsi::Runtime &rt, jsi::Object &js_object, std::string &url, - std::string &auth_token); + std::string &auth_token); // Constructor for a local database with remote sync OPDatabase(jsi::Runtime &rt, jsi::Object &js_object, std::string &db_name, - std::string &path, std::string &url, std::string &auth_token, - int sync_interval, bool offline, std::string &encryption_key, - std::string &remote_encryption_key); + std::string &path, std::string &url, std::string &auth_token, + int sync_interval, bool offline, std::string &encryption_key, + std::string &remote_encryption_key); #elif defined(OP_SQLITE_USE_TURSO) // Constructor for remoteOpen, purely for remote databases OPDatabase(jsi::Runtime &rt, jsi::Object &js_object, std::string &url, - std::string &auth_token, std::string &base_path); + std::string &auth_token, std::string &base_path); // Constructor for a local database with remote sync OPDatabase(jsi::Runtime &rt, jsi::Object &js_object, std::string &db_name, - std::string &path, std::string &url, std::string &auth_token, - std::string &remote_encryption_key); + std::string &path, std::string &url, std::string &auth_token, + std::string &remote_encryption_key); #endif void on_update(const std::string &table, const std::string &operation, @@ -88,7 +86,8 @@ class JSI_EXPORT OPDatabase void release_hooks(); void throw_if_closed(const char *function_name) const; void create_jsi_functions(jsi::Runtime &rt, jsi::Object &js_object); - void flush_pending_reactive_queries(const std::shared_ptr &resolve); + void + flush_pending_reactive_queries(const std::shared_ptr &resolve); std::string base_path; // Bound at construction, on the JS thread, to the generation that created diff --git a/cpp/OPDumbHostObject.cpp b/cpp/OPDumbHostObject.cpp index a38fb504..eda7e160 100644 --- a/cpp/OPDumbHostObject.cpp +++ b/cpp/OPDumbHostObject.cpp @@ -9,64 +9,64 @@ namespace jsi = facebook::jsi; DumbHostObject::DumbHostObject( std::shared_ptr> metadata) { - this->metadata = metadata; + this->metadata = metadata; }; std::vector DumbHostObject::getPropertyNames(jsi::Runtime &rt) { - std::vector keys; + std::vector keys; - for (auto field : *metadata) { - // TODO improve this by generating the propName once on metadata - // creation - keys.push_back(jsi::PropNameID::forAscii( - rt, std::get(field.fields[0].second))); - } + for (auto field : *metadata) { + // TODO improve this by generating the propName once on metadata + // creation + keys.push_back(jsi::PropNameID::forAscii( + rt, std::get(field.fields[0].second))); + } - return keys; + return keys; } jsi::Value DumbHostObject::get(jsi::Runtime &rt, const jsi::PropNameID &propNameID) { - auto name = propNameID.utf8(rt); - auto fields = metadata.get(); - for (int i = 0; i < fields->size(); i++) { - auto fieldName = std::get(fields->at(i).fields[0].second); - if (fieldName == name) { - return to_jsi(rt, values.at(i)); - } + auto name = propNameID.utf8(rt); + auto fields = metadata.get(); + for (int i = 0; i < fields->size(); i++) { + auto fieldName = std::get(fields->at(i).fields[0].second); + if (fieldName == name) { + return to_jsi(rt, values.at(i)); } + } - for (auto pairField : ownValues) { - if (name == pairField.first) { - return to_jsi(rt, pairField.second); - } + for (auto pairField : ownValues) { + if (name == pairField.first) { + return to_jsi(rt, pairField.second); } + } - return {}; + return {}; } void DumbHostObject::set(jsi::Runtime &rt, const jsi::PropNameID &name, const jsi::Value &value) { - auto key = name.utf8(rt); - auto fields = metadata.get(); - for (int i = 0; i < fields->size(); i++) { - auto fieldName = std::get(fields->at(i).fields[0].second); - if (fieldName == key) { - values[i] = to_variant(rt, value); - return; - } + auto key = name.utf8(rt); + auto fields = metadata.get(); + for (int i = 0; i < fields->size(); i++) { + auto fieldName = std::get(fields->at(i).fields[0].second); + if (fieldName == key) { + values[i] = to_variant(rt, value); + return; } + } - for (auto pairField : ownValues) { - if (key == pairField.first) { - pairField.second = to_variant(rt, value); - return; - } + for (auto pairField : ownValues) { + if (key == pairField.first) { + pairField.second = to_variant(rt, value); + return; } + } - ownValues.push_back(std::make_pair(key, to_variant(rt, value))); + ownValues.push_back(std::make_pair(key, to_variant(rt, value))); } } // namespace opsqlite diff --git a/cpp/OPLogs.h b/cpp/OPLogs.h index 42ca6f16..7f1d499b 100644 --- a/cpp/OPLogs.h +++ b/cpp/OPLogs.h @@ -15,26 +15,26 @@ #include #define LOG_TAG "op-sqlite" #define LOGV(...) \ - printf(" "); \ - printf(__VA_ARGS__); \ - printf("\t - <%s> \n", LOG_TAG); + printf(" "); \ + printf(__VA_ARGS__); \ + printf("\t - <%s> \n", LOG_TAG); #define LOGD(...) \ - printf(" "); \ - printf(__VA_ARGS__); \ - printf("\t - <%s> \n", LOG_TAG); + printf(" "); \ + printf(__VA_ARGS__); \ + printf("\t - <%s> \n", LOG_TAG); #define LOGI(...) \ - printf(" "); \ - printf(__VA_ARGS__); \ - printf("\t - <%s> \n", LOG_TAG); + printf(" "); \ + printf(__VA_ARGS__); \ + printf("\t - <%s> \n", LOG_TAG); #define LOGW(...) \ - printf(" * Warning: "); \ - printf(__VA_ARGS__); \ - printf("\t - <%s> \n", LOG_TAG); + printf(" * Warning: "); \ + printf(__VA_ARGS__); \ + printf("\t - <%s> \n", LOG_TAG); #define LOGE(...) \ - printf(" *** Error: "); \ - printf(__VA_ARGS__); \ - printf("\t - <%s> \n", LOG_TAG); + printf(" *** Error: "); \ + printf(__VA_ARGS__); \ + printf("\t - <%s> \n", LOG_TAG); #define LOGSIMPLE(...) \ - printf(" "); \ - printf(__VA_ARGS__); + printf(" "); \ + printf(__VA_ARGS__); #endif // ANDROID diff --git a/cpp/OPSmartHostObject.cpp b/cpp/OPSmartHostObject.cpp index 8d2792c6..f5807700 100644 --- a/cpp/OPSmartHostObject.cpp +++ b/cpp/OPSmartHostObject.cpp @@ -7,28 +7,28 @@ namespace jsi = facebook::jsi; std::vector SmartHostObject::getPropertyNames(jsi::Runtime &rt) { - std::vector keys; + std::vector keys; - keys.reserve(fields.size()); - for (const auto &field : fields) { - keys.emplace_back(jsi::PropNameID::forAscii(rt, field.first)); - } + keys.reserve(fields.size()); + for (const auto &field : fields) { + keys.emplace_back(jsi::PropNameID::forAscii(rt, field.first)); + } - return keys; + return keys; } jsi::Value SmartHostObject::get(jsi::Runtime &rt, const jsi::PropNameID &propNameID) { - auto name = propNameID.utf8(rt); + auto name = propNameID.utf8(rt); - for (const auto &field : fields) { - auto fieldName = field.first; - if (fieldName == name) { - return to_jsi(rt, field.second); - } + for (const auto &field : fields) { + auto fieldName = field.first; + if (fieldName == name) { + return to_jsi(rt, field.second); } + } - return {}; + return {}; } } // namespace opsqlite diff --git a/cpp/OPSqlite.cpp b/cpp/OPSqlite.cpp index 3ee40eaa..265b5039 100644 --- a/cpp/OPSqlite.cpp +++ b/cpp/OPSqlite.cpp @@ -29,14 +29,14 @@ std::shared_ptr> generation_alive; // Each platform module calls its own invalidate() lifecycle hook when React // Native tears down the JS context (CodePush/Hot Reload, or any other // runtime teardown) -- OPSQLiteModule.invalidate() on Android, which reaches -// this function through JNI's clearStateNativeJsi (see android/cpp-adapter.cpp), -// and -[OPSQLite invalidate] on iOS (see ios/OPSQLite.mm). Each currently -// open OPDatabase cleans itself up independently -- OPDatabase's own -// invalidate() (interrupt + drain + close), called from its destructor, -// already runs whenever the JS runtime destroys it, so there's no registry to -// walk here. All THIS invalidate() needs to do is mark THIS generation dead so -// in-flight async work drops its result instead of resolving into whichever -// runtime replaces it. +// this function through JNI's clearStateNativeJsi (see +// android/cpp-adapter.cpp), and -[OPSQLite invalidate] on iOS (see +// ios/OPSQLite.mm). Each currently open OPDatabase cleans itself up +// independently -- OPDatabase's own invalidate() (interrupt + drain + close), +// called from its destructor, already runs whenever the JS runtime destroys it, +// so there's no registry to walk here. All THIS invalidate() needs to do is +// mark THIS generation dead so in-flight async work drops its result instead of +// resolving into whichever runtime replaces it. void invalidate(const std::shared_ptr> &generation_alive) { if (generation_alive != nullptr) { generation_alive->store(false); @@ -146,7 +146,7 @@ install(jsi::Runtime &rt, const std::shared_ptr &invoker, std::string url = options.getProperty(rt, "url").asString(rt).utf8(rt); std::string auth_token = - options.getProperty(rt, "authToken").asString(rt).utf8(rt); + options.getProperty(rt, "authToken").asString(rt).utf8(rt); jsi::Object js_db(rt); #ifdef OP_SQLITE_USE_LIBSQL @@ -168,7 +168,7 @@ install(jsi::Runtime &rt, const std::shared_ptr &invoker, std::string path = std::string(_base_path); std::string url = options.getProperty(rt, "url").asString(rt).utf8(rt); std::string auth_token = - options.getProperty(rt, "authToken").asString(rt).utf8(rt); + options.getProperty(rt, "authToken").asString(rt).utf8(rt); int sync_interval = 0; if (options.hasProperty(rt, "libsqlSyncInterval")) { @@ -184,13 +184,13 @@ install(jsi::Runtime &rt, const std::shared_ptr &invoker, std::string encryption_key; if (options.hasProperty(rt, "encryptionKey")) { encryption_key = - options.getProperty(rt, "encryptionKey").asString(rt).utf8(rt); + options.getProperty(rt, "encryptionKey").asString(rt).utf8(rt); } std::string remote_encryption_key; if (options.hasProperty(rt, "remoteEncryptionKey")) { remote_encryption_key = - options.getProperty(rt, "remoteEncryptionKey").asString(rt).utf8(rt); + options.getProperty(rt, "remoteEncryptionKey").asString(rt).utf8(rt); } std::string location; @@ -208,17 +208,17 @@ install(jsi::Runtime &rt, const std::shared_ptr &invoker, } jsi::Object js_db(rt); - #ifdef OP_SQLITE_USE_LIBSQL +#ifdef OP_SQLITE_USE_LIBSQL std::shared_ptr db = std::make_shared( - rt, js_db, name, path, url, auth_token, sync_interval, offline, - encryption_key, remote_encryption_key); - #else + rt, js_db, name, path, url, auth_token, sync_interval, offline, + encryption_key, remote_encryption_key); +#else (void)sync_interval; (void)offline; std::shared_ptr db = std::make_shared( - rt, js_db, name, path, url, auth_token, remote_encryption_key); - #endif + rt, js_db, name, path, url, auth_token, remote_encryption_key); +#endif js_db.setNativeState(rt, db); return js_db; diff --git a/cpp/OPUtils.cpp b/cpp/OPUtils.cpp index 401b262a..f4bdbccd 100644 --- a/cpp/OPUtils.cpp +++ b/cpp/OPUtils.cpp @@ -331,7 +331,8 @@ BatchResult import_sql_file(sqlite3 *db, std::string path) { return run_in_transaction( [db](const char *sql) { opsqlite_execute(db, sql, nullptr); }, [db]() -> std::optional { return opsqlite_in_transaction(db); }, - "BEGIN EXCLUSIVE TRANSACTION", [&]() { + "BEGIN EXCLUSIVE TRANSACTION", + [&]() { int affectedRows = 0; int commands = 0; while (std::getline(sqFile, line, '\n')) { @@ -423,9 +424,9 @@ promisify(jsi::Runtime &rt, const char *function_name, // Bind this generation's invoker and liveness flag here, on the JS thread, // while the promise is being constructed. Reading the process globals from - // the worker instead lets a task queued by a torn-down runtime post into the - // runtime that replaced it, and then call asFunction() on a jsi::Value that - // belongs to the dead one. + // the worker instead lets a task queued by a torn-down runtime post into + // the runtime that replaced it, and then call asFunction() on a jsi::Value + // that belongs to the dead one. auto invoker = opsqlite::invoker; auto alive = opsqlite::generation_alive; diff --git a/cpp/libsql/OPLibsqlBridge.cpp b/cpp/libsql/OPLibsqlBridge.cpp index 2b966365..9b8baf40 100644 --- a/cpp/libsql/OPLibsqlBridge.cpp +++ b/cpp/libsql/OPLibsqlBridge.cpp @@ -1,9 +1,9 @@ #include "OPLibsqlBridge.hpp" #include "OPDumbHostObject.hpp" -#include "OPSmartHostObject.hpp" -#include "libsql.h" #include "OPLogs.h" +#include "OPSmartHostObject.hpp" #include "OPUtils.hpp" +#include "libsql.h" #include #include #include @@ -777,8 +777,8 @@ opsqlite_libsql_execute_batch(DB const &db, return run_in_transaction( [&db](const char *sql) { opsqlite_libsql_execute(db, sql, nullptr); }, // libsql exposes no way to read the autocommit state - []() -> std::optional { return std::nullopt; }, - "BEGIN TRANSACTION", [&]() { + []() -> std::optional { return std::nullopt; }, "BEGIN TRANSACTION", + [&]() { int affectedRows = 0; for (int i = 0; i < commandCount; i++) { const auto &command = commands->at(i); diff --git a/cpp/libsql/OPLibsqlBridge.hpp b/cpp/libsql/OPLibsqlBridge.hpp index 8feb3807..47010540 100644 --- a/cpp/libsql/OPLibsqlBridge.hpp +++ b/cpp/libsql/OPLibsqlBridge.hpp @@ -2,9 +2,9 @@ #include "OPDumbHostObject.hpp" #include "OPSmartHostObject.hpp" -#include "libsql.h" #include "OPTypes.hpp" #include "OPUtils.hpp" +#include "libsql.h" #include #define LIBSQL_INT 1 diff --git a/cpp/turso/OPTursoBridge.cpp b/cpp/turso/OPTursoBridge.cpp index 6fb0d0d5..8353cb62 100644 --- a/cpp/turso/OPTursoBridge.cpp +++ b/cpp/turso/OPTursoBridge.cpp @@ -1,7 +1,7 @@ +#include "OPBridge.hpp" #include "OPDatabase.hpp" #include "OPDumbHostObject.hpp" #include "OPSmartHostObject.hpp" -#include "OPBridge.hpp" #include "OPUtils.hpp" #ifdef __APPLE__ @@ -885,8 +885,7 @@ void opsqlite_register_rollback_hook( void opsqlite_deregister_rollback_hook([[maybe_unused]] sqlite3 *db) {} bool opsqlite_in_transaction(sqlite3 *db) { - auto connection = - require_turso_connection(to_turso_db(db), "in_transaction"); + auto connection = require_turso_connection(to_turso_db(db), "in_transaction"); return !turso_connection_get_autocommit(connection); } @@ -908,7 +907,8 @@ opsqlite_execute_batch(sqlite3 *db, return run_in_transaction( [db](const char *sql) { opsqlite_execute(db, sql, nullptr); }, [db]() -> std::optional { return opsqlite_in_transaction(db); }, - "BEGIN TRANSACTION", [&]() { + "BEGIN TRANSACTION", + [&]() { int affected_rows = 0; for (size_t i = 0; i < command_count; i++) { const auto &command = commands->at(i); diff --git a/example/ios/OPSQLiteExample-Bridging-Header.h b/example/ios/OPSQLiteExample-Bridging-Header.h index 1b2cb5d6..339994e9 100644 --- a/example/ios/OPSQLiteExample-Bridging-Header.h +++ b/example/ios/OPSQLiteExample-Bridging-Header.h @@ -1,4 +1,4 @@ // -// Use this file to import your target's public headers that you would like to expose to Swift. +// Use this file to import your target's public headers that you would like to +// expose to Swift. // - diff --git a/ios/OPSQLite.mm b/ios/OPSQLite.mm index 23fcd6cf..1f430994 100644 --- a/ios/OPSQLite.mm +++ b/ios/OPSQLite.mm @@ -69,10 +69,13 @@ - (NSDictionary *)getConstants { // guard with an exception handler instead, in case that ever changes. facebook::jsi::Runtime *jsiRuntime = nullptr; @try { - id runtimeProvider = (id)_bridge; + id runtimeProvider = + (id)_bridge; jsiRuntime = (facebook::jsi::Runtime *)[runtimeProvider runtime]; } @catch (NSException *exception) { - RCTLogError(@"[OP-SQLITE] Failed to obtain the JSI runtime from the bridge: %@", exception); + RCTLogError( + @"[OP-SQLITE] Failed to obtain the JSI runtime from the bridge: %@", + exception); return @false; } if (jsiRuntime == nil) { @@ -122,7 +125,7 @@ - (NSDictionary *)getConstants { _generationAlive = opsqlite::install(runtime, callInvoker, [documentPath UTF8String], - [sqlite_vec_path UTF8String]); + [sqlite_vec_path UTF8String]); return @true; }