diff --git a/README.md b/README.md index cde37994..4e7796e1 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,6 @@ Some of the big supported features: - SQLCipher is supported as a compilation target - FTS5 plugin - Rtree plugin -- cr-sqlite plugin - sqlite-vec plugin - Reactive queries - Custom tokenizers diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt index 225510b4..1426fcb6 100644 --- a/android/CMakeLists.txt +++ b/android/CMakeLists.txt @@ -79,12 +79,6 @@ else() target_sources(${PACKAGE_NAME} PRIVATE ../cpp/sqlite3.c ../cpp/bridge.cpp) endif() -if (USE_CRSQLITE) - add_definitions( - -DOP_SQLITE_USE_CRSQLITE=1 - ) -endif() - if (USE_SQLITE_VEC) add_definitions( -DOP_SQLITE_USE_SQLITE_VEC=1 diff --git a/android/build.gradle b/android/build.gradle index 831ca5d2..5d63be16 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -35,7 +35,6 @@ def reactNativeArchitectures() { def useSQLCipher = false def useLibsql = false def useTurso = false -def useCRSQLite = false def performanceMode = false def sqliteFlags = "" def enableFTS5 = false @@ -74,7 +73,6 @@ def opsqliteConfig = packageJson["op-sqlite"] if(opsqliteConfig) { println "[OP-SQLITE] Detected op-sqlite config from package.json at: " + packageJsonFile.absolutePath useSQLCipher = !!opsqliteConfig["sqlcipher"] - useCRSQLite = !!opsqliteConfig["crsqlite"] useSqliteVec = !!opsqliteConfig["sqliteVec"] performanceMode = opsqliteConfig["performanceMode"] sqliteFlags = opsqliteConfig["sqliteFlags"] ? opsqliteConfig["sqliteFlags"] : "" @@ -89,10 +87,6 @@ if(useLibsql && useTurso) { throw new GradleException("[OP-SQLITE] Error: libsql and turso backends are mutually exclusive.") } -if(useLibsql && useCRSQLite) { - throw new GradleException("[OP-SQLITE] Error: You cannot use crsqlite with libsql.") -} - if(useSQLCipher) { println "[OP-SQLITE] using sqlcipher." } else if(useTurso) { @@ -101,10 +95,6 @@ if(useSQLCipher) { println "[OP-SQLITE] using libsql. Report any issues to Turso" } -if(useCRSQLite) { - println "[OP-SQLITE] using CR-SQLite" -} - if(performanceMode) { println "[OP-SQLITE] Performance mode enabled" } @@ -175,10 +165,6 @@ android { cFlags += "-DOP_SQLITE_USE_TURSO=1" cppFlags += "-DOP_SQLITE_USE_TURSO=1" } - if(useCRSQLite) { - cFlags += "-DOP_SQLITE_USE_CRSQLITE=1" - cppFlags += "-DOP_SQLITE_USE_CRSQLITE=1" - } if(useSqliteVec) { cFlags += "-DOP_SQLITE_USE_SQLITE_VEC=1" cppFlags += "-DOP_SQLITE_USE_SQLITE_VEC=1" @@ -206,7 +192,6 @@ android { "-DDEFAULT_SQLITE_FLAGS='${defaultSqliteFlags.join(' ')}'", "-DSQLITE_FLAGS='$sqliteFlags'", "-DUSE_SQLCIPHER=${useSQLCipher ? 1 : 0}", - "-DUSE_CRSQLITE=${useCRSQLite ? 1 : 0}", "-DUSE_LIBSQL=${useLibsql ? 1 : 0}", "-DUSE_TURSO=${useTurso ? 1 : 0}", "-DUSE_SQLITE_VEC=${useSqliteVec ? 1 : 0}", @@ -277,9 +262,6 @@ android { if (useTurso) { srcDirs += 'src/main/tursoLibs' } - if (useCRSQLite) { - srcDirs += 'src/main/libcrsqlite' - } if (useSqliteVec) { srcDirs += 'src/main/libsqlitevec' } diff --git a/android/cpp-adapter.cpp b/android/cpp-adapter.cpp index 5d2b5bd8..d0ef6588 100644 --- a/android/cpp-adapter.cpp +++ b/android/cpp-adapter.cpp @@ -43,8 +43,7 @@ struct OPSQLiteBridge : jni::JavaClass { std::string dbPathStr = dbPath->toStdString(); auto generation_alive = opsqlite::install( - *jsiRuntime, jsCallInvoker, dbPathStr.c_str(), "libcrsqlite", - "libsqlite_vec"); + *jsiRuntime, jsCallInvoker, dbPathStr.c_str(), "libsqlite_vec"); auto *handle = new std::shared_ptr>(generation_alive); return reinterpret_cast(handle); diff --git a/android/src/main/libcrsqlite/arm64-v8a/libcrsqlite.so b/android/src/main/libcrsqlite/arm64-v8a/libcrsqlite.so deleted file mode 100644 index 4d584cc4..00000000 Binary files a/android/src/main/libcrsqlite/arm64-v8a/libcrsqlite.so and /dev/null differ diff --git a/android/src/main/libcrsqlite/armeabi-v7a/libcrsqlite.so b/android/src/main/libcrsqlite/armeabi-v7a/libcrsqlite.so deleted file mode 100644 index b6ff67c4..00000000 Binary files a/android/src/main/libcrsqlite/armeabi-v7a/libcrsqlite.so and /dev/null differ diff --git a/android/src/main/libcrsqlite/x86/libcrsqlite.so b/android/src/main/libcrsqlite/x86/libcrsqlite.so deleted file mode 100644 index 568d1921..00000000 Binary files a/android/src/main/libcrsqlite/x86/libcrsqlite.so and /dev/null differ diff --git a/android/src/main/libcrsqlite/x86_64/libcrsqlite.so b/android/src/main/libcrsqlite/x86_64/libcrsqlite.so deleted file mode 100644 index e04ab9b1..00000000 Binary files a/android/src/main/libcrsqlite/x86_64/libcrsqlite.so and /dev/null differ diff --git a/cpp/OPSqlite.cpp b/cpp/OPSqlite.cpp index 6ef2685f..5ee14bdc 100644 --- a/cpp/OPSqlite.cpp +++ b/cpp/OPSqlite.cpp @@ -22,7 +22,6 @@ namespace jsi = facebook::jsi; namespace react = facebook::react; std::string _base_path; -std::string _crsqlite_path; std::string _sqlite_vec_path; std::shared_ptr invoker; std::shared_ptr> generation_alive; @@ -42,11 +41,9 @@ void invalidate(const std::shared_ptr> &generation_alive) { std::shared_ptr> install(jsi::Runtime &rt, const std::shared_ptr &_invoker, - const char *base_path, const char *crsqlite_path, - const char *sqlite_vec_path) { + const char *base_path, const char *sqlite_vec_path) { _base_path = std::string(base_path); - _crsqlite_path = std::string(crsqlite_path); _sqlite_vec_path = std::string(sqlite_vec_path); opsqlite::invoker = _invoker; diff --git a/cpp/OPSqlite.hpp b/cpp/OPSqlite.hpp index 63bd550d..8e819037 100644 --- a/cpp/OPSqlite.hpp +++ b/cpp/OPSqlite.hpp @@ -17,8 +17,7 @@ namespace react = facebook::react; // look it up -- see the comment on opsqlite::generation_alive in types.hpp. std::shared_ptr> install(jsi::Runtime &rt, const std::shared_ptr &invoker, - const char *base_path, const char *crsqlite_path, - const char *sqlite_vec_path); + const char *base_path, const char *sqlite_vec_path); void invalidate(const std::shared_ptr> &generation_alive); void expoUpdatesWorkaround(const char *base_path); diff --git a/cpp/bridge.cpp b/cpp/bridge.cpp index 0f6debc6..0c67b488 100644 --- a/cpp/bridge.cpp +++ b/cpp/bridge.cpp @@ -132,17 +132,6 @@ sqlite3 *opsqlite_open(std::string const &name, std::string const &path, sqlite3_enable_load_extension(db, 1); #endif -#ifdef OP_SQLITE_USE_CRSQLITE - const char *crsqliteEntryPoint = "sqlite3_crsqlite_init"; - - sqlite3_load_extension(db, _crsqlite_path.c_str(), crsqliteEntryPoint, - &errMsg); - - if (errMsg != nullptr) { - throw std::runtime_error(errMsg); - } -#endif - #ifdef OP_SQLITE_USE_SQLITE_VEC const char *vec_entry_point = "sqlite3_vec_init"; @@ -172,10 +161,6 @@ void create_dirs_if_needed(const std::string &path) { } void opsqlite_close(sqlite3 *db) { -#ifdef OP_SQLITE_USE_CRSQLITE - opsqlite_execute(db, "select crsql_finalize();", nullptr); -#endif - sqlite3_close_v2(db); } diff --git a/cpp/bridge.hpp b/cpp/bridge.hpp index ad226f84..a4b9231b 100644 --- a/cpp/bridge.hpp +++ b/cpp/bridge.hpp @@ -22,10 +22,9 @@ typedef std::function CommitCallback; typedef std::function RollbackCallback; -// Paths to the optional loadable extensions, set once in install() and +// Path to the optional loadable extension, set once in install() and // shared by every subsequent open() call instead of being threaded through -// as parameters. -extern std::string _crsqlite_path; +// as a parameter. extern std::string _sqlite_vec_path; std::string opsqlite_get_db_path(std::string const &db_name, diff --git a/docs/docs/api.md b/docs/docs/api.md index 6a0e4c39..8242db29 100644 --- a/docs/docs/api.md +++ b/docs/docs/api.md @@ -492,13 +492,13 @@ Loading runtime extensions is supported. You need compile your extension to the /main /jniLibs /arm64-v8a - libcrsqlite.so + libmyextension.so /armeabi-v7a - libcrsqlite.so + libmyextension.so /x86 - libcrsqlite.so + libmyextension.so /x86_64 - libcrsqlite.so + libmyextension.so ``` ### iOS @@ -514,9 +514,9 @@ Loading runtime extensions is supported. You need compile your extension to the import {open, getDylibPath} from '@op-sqlite/op-engineering'; const db = open(...); - let path = "libcrsqlite" // in Android it will be the name of the .so + let path = "libmyextension" // in Android it will be the name of the .so if (Platform.os == "ios") { - path = getDylibPath("io.vlcn.crsqlite", "crsqlite"); // You need to get the bundle name from the .framework/plist.info inside of the .xcframework you created and then the canonical name inside the same plist + path = getDylibPath("com.example.myextension", "myextension"); // You need to get the bundle name from the .framework/plist.info inside of the .xcframework you created and then the canonical name inside the same plist } // Extensions usually have a default entry point to be loaded, if the documentation says nothing, you should assume no entry point change db.loadExtension(path); diff --git a/docs/docs/changelog.md b/docs/docs/changelog.md index a0e9e8bb..eac4d9cc 100644 --- a/docs/docs/changelog.md +++ b/docs/docs/changelog.md @@ -4,6 +4,10 @@ sidebar_position: 11 # API Changes +## 18.0.0 + +- **Breaking:** Removed `crsqlite` support entirely. The `crsqlite` key in the `op-sqlite` `package.json` config no longer has any effect, and the bundled `cr-sqlite` extension binaries have been removed from the package (iOS `crsqlite.xcframework`, Android `libcrsqlite` `.so`s). If you need CR-SQLite, load it yourself as a runtime extension via `loadExtension` — see [Loading Extensions](./api.md#loading-extensions). + ## 17.2.0 - Added `failOnCreate` option to `open()`. When set to `true`, the database file must already exist; if it doesn't, `open()` throws instead of creating it. Implemented natively across all backends (plain SQLite3, SQLCipher, libsql and Turso). See the [Open Existing Only (failOnCreate)](./api.md#open-existing-only-failoncreate) section for usage. diff --git a/docs/docs/installation.md b/docs/docs/installation.md index 6710cb41..3ec9cb8e 100644 --- a/docs/docs/installation.md +++ b/docs/docs/installation.md @@ -60,7 +60,6 @@ SQLite is very customizable on compilation level. op-sqlite also allows you add // All the keys are optional, see the usage below "op-sqlite": { "sqlcipher": false - // "crsqlite": false, // "performanceMode": true, // "iosSqlite": false, // "sqliteFlags": "-DSQLITE_DQS=0 -DSQLITE_MY_FLAG=1", @@ -77,7 +76,6 @@ SQLite is very customizable on compilation level. op-sqlite also allows you add All keys are optional, only turn on the features you want: - `sqlcipher` allows to change the base sqlite implementation to [sqlcipher](https://www.zetetic.net/sqlcipher/), which encrypts all the database data with minimal overhead. You will still need to keep your encryption key secure. Read more about security in React Native [here](https://ospfranco.com/react-native-security-guide/). -- `crsqlite` is an extension that allows replication to a server backed sqlite database copy. [Repo here](https://github.com/vlcn-io/cr-sqlite). - `performanceMode` turns on certain compilation flags that make sqlite speedier at the cost of disabling some features. You should almost always turn this on, but test your app thoroughly. - `iosSqlite` uses the embedded iOS version from sqlite, which saves disk space but may use an older version and cannot load extensions as Apple disables it due to security concerns. On Android SQLite is always compiled from source as each vendor messes with sqlite or uses outdated versions. - `sqliteFlags` allows you to pass your own compilation flags to further disable/enable features and extensions. It follows the C flag format: `-D[YOUR_FLAG]=[YOUR_VALUE]`. If you are running large queries on large databases sometimes on Android devices you might get a IO exception. You can disable temporary files by using adding the `"-DSQLITE_TEMP_STORE=2"` flag. Flags listed here are applied AFTER the library defaults (including those added by `performanceMode`), so they override any default with the same name on both iOS and Android. For example, setting `"sqliteFlags": "-DSQLITE_DQS=3"` re-enables double-quoted string literals even when `performanceMode` is on. diff --git a/example/package.json b/example/package.json index 623c19af..aff0854f 100644 --- a/example/package.json +++ b/example/package.json @@ -60,7 +60,6 @@ "iosSqlite": false, "fts5": true, "rtree": true, - "crsqlite": false, "sqliteVec": false, "performanceMode": true, "tokenizers": [ diff --git a/ios/OPSQLite.mm b/ios/OPSQLite.mm index b1542296..10071307 100644 --- a/ios/OPSQLite.mm +++ b/ios/OPSQLite.mm @@ -82,17 +82,6 @@ - (NSDictionary *)getConstants { documentPath = [paths objectAtIndex:0]; } -#ifdef OP_SQLITE_USE_CRSQLITE - NSString *crsqlite_bundle_path = - [[[NSBundle mainBundle] privateFrameworksPath] - stringByAppendingPathComponent:@"crsqlite.framework"]; - NSBundle *crsqlite_bundle = [NSBundle bundleWithPath:crsqlite_bundle_path]; - NSString *crsqlite_path = [crsqlite_bundle pathForResource:@"crsqlite" - ofType:@""]; -#else - NSString *crsqlite_path = @""; -#endif - #ifdef OP_SQLITE_USE_SQLITE_VEC NSString *sqlitevec_bundle_path = [[[NSBundle mainBundle] privateFrameworksPath] @@ -107,7 +96,7 @@ - (NSDictionary *)getConstants { _generationAlive = opsqlite::install(runtime, callInvoker, [documentPath UTF8String], - [crsqlite_path UTF8String], [sqlite_vec_path UTF8String]); + [sqlite_vec_path UTF8String]); return @true; } diff --git a/ios/crsqlite.xcframework/Info.plist b/ios/crsqlite.xcframework/Info.plist deleted file mode 100644 index 6947e0d6..00000000 --- a/ios/crsqlite.xcframework/Info.plist +++ /dev/null @@ -1,46 +0,0 @@ - - - - - AvailableLibraries - - - LibraryIdentifier - ios-arm64 - LibraryPath - crsqlite.framework - SupportedArchitectures - - arm64 - - SupportedPlatform - ios - - - LibraryIdentifier - ios-arm64_x86_64-simulator - LibraryPath - crsqlite.framework - SupportedArchitectures - - arm64 - x86_64 - - SupportedPlatform - ios - SupportedPlatformVariant - simulator - - - CFBundlePackageType - XFWK - XCFrameworkFormatVersion - 1.0 - CFBundleVersion - 1.0.0 - CFBundleShortVersionString - 1.0.0 - MinimumOSVersion - 8.0 - - diff --git a/ios/crsqlite.xcframework/ios-arm64/crsqlite.framework/Info.plist b/ios/crsqlite.xcframework/ios-arm64/crsqlite.framework/Info.plist deleted file mode 100644 index 3deb06e6..00000000 --- a/ios/crsqlite.xcframework/ios-arm64/crsqlite.framework/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - crsqlite - CFBundleIdentifier - io.vlcn.crsqlite - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - FMWK - CFBundleSignature - ???? - CFBundleVersion - 1.0.0 - CFBundleShortVersionString - 1.0.0 - MinimumOSVersion - 8.0 - - diff --git a/ios/crsqlite.xcframework/ios-arm64/crsqlite.framework/crsqlite b/ios/crsqlite.xcframework/ios-arm64/crsqlite.framework/crsqlite deleted file mode 100755 index e2ed0a40..00000000 Binary files a/ios/crsqlite.xcframework/ios-arm64/crsqlite.framework/crsqlite and /dev/null differ diff --git a/ios/crsqlite.xcframework/ios-arm64_x86_64-simulator/crsqlite.framework/Info.plist b/ios/crsqlite.xcframework/ios-arm64_x86_64-simulator/crsqlite.framework/Info.plist deleted file mode 100644 index 3deb06e6..00000000 --- a/ios/crsqlite.xcframework/ios-arm64_x86_64-simulator/crsqlite.framework/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - crsqlite - CFBundleIdentifier - io.vlcn.crsqlite - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - FMWK - CFBundleSignature - ???? - CFBundleVersion - 1.0.0 - CFBundleShortVersionString - 1.0.0 - MinimumOSVersion - 8.0 - - diff --git a/ios/crsqlite.xcframework/ios-arm64_x86_64-simulator/crsqlite.framework/crsqlite b/ios/crsqlite.xcframework/ios-arm64_x86_64-simulator/crsqlite.framework/crsqlite deleted file mode 100755 index dfe145da..00000000 Binary files a/ios/crsqlite.xcframework/ios-arm64_x86_64-simulator/crsqlite.framework/crsqlite and /dev/null differ diff --git a/op-sqlite.podspec b/op-sqlite.podspec index c53b4a8b..a7c72e20 100644 --- a/op-sqlite.podspec +++ b/op-sqlite.podspec @@ -40,7 +40,6 @@ app_package = JSON.parse(File.read(package_json_path)) op_sqlite_config = app_package["op-sqlite"] use_sqlcipher = false -use_crsqlite = false use_libsql = false use_turso = false performance_mode = false @@ -53,7 +52,6 @@ tokenizers = [] if(op_sqlite_config != nil) use_sqlcipher = op_sqlite_config["sqlcipher"] == true - use_crsqlite = op_sqlite_config["crsqlite"] == true use_libsql = op_sqlite_config["libsql"] == true use_turso = op_sqlite_config["turso"] == true performance_mode = op_sqlite_config["performanceMode"] || false @@ -70,10 +68,6 @@ if phone_version then raise "SQLCipher is not supported with phone version. It cannot load extensions." end - if use_crsqlite then - raise "CRSQLite is not supported with phone version. It cannot load extensions." - end - if rtree then raise "RTree is not supported with phone version. It cannot load extensions." end @@ -87,10 +81,6 @@ if use_libsql and use_sqlite_vec then raise "You cannot use sqlite-vec with libsql. libsql already has vector search included." end -if use_libsql and use_crsqlite then - raise "You cannot use crsqlite with libsql." -end - if use_turso and use_sqlite_vec then raise "You cannot use sqlite-vec with turso backend." end @@ -169,10 +159,6 @@ Pod::Spec.new do |s| end # Exclude xcframeworks that aren't being used - if !use_crsqlite then - exclude_files += ["ios/crsqlite.xcframework/**/*"] - end - if !use_sqlite_vec then exclude_files += ["ios/sqlitevec.xcframework/**/*"] end @@ -201,12 +187,6 @@ Pod::Spec.new do |s| other_cflags += optimizedCflags end - if use_crsqlite then - log_message.call("[OP-SQLITE] using CRQSQLite 🤖") - xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " OP_SQLITE_USE_CRSQLITE=1" - frameworks.push("ios/crsqlite.xcframework") - end - if use_sqlite_vec then log_message.call("[OP-SQLITE] using Sqlite Vec ↗️") xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " OP_SQLITE_USE_SQLITE_VEC=1" diff --git a/scripts/turnOffEverything.js b/scripts/turnOffEverything.js index 7a966e98..e3159700 100644 --- a/scripts/turnOffEverything.js +++ b/scripts/turnOffEverything.js @@ -12,7 +12,6 @@ packageJson['op-sqlite']['sqlcipher'] = false; packageJson['op-sqlite']['iosSqlite'] = false; packageJson['op-sqlite']['fts5'] = true; packageJson['op-sqlite']['rtree'] = true; -packageJson['op-sqlite']['crsqlite'] = false; packageJson['op-sqlite']['sqliteVec'] = false; packageJson['op-sqlite']['tokenizers'] = ["wordtokenizer", "porter"]; diff --git a/scripts/turnOnIOSEmbedded.js b/scripts/turnOnIOSEmbedded.js index eb78b8fc..0c6af9b8 100644 --- a/scripts/turnOnIOSEmbedded.js +++ b/scripts/turnOnIOSEmbedded.js @@ -6,7 +6,6 @@ const packageJson = JSON.parse(fs.readFileSync('./example/package.json')); // Modify the op-sqlite.sqlcipher key to true packageJson['op-sqlite']['iosSqlite'] = true; packageJson['op-sqlite']['sqlcipher'] = false; -packageJson['op-sqlite']['crsqlite'] = false; packageJson['op-sqlite']['libsql'] = false; packageJson['op-sqlite']['turso'] = false; packageJson['op-sqlite']['sqliteVec'] = false;