From 6daab728d8de98e5ceeac7932baf5919e50d33fb Mon Sep 17 00:00:00 2001 From: Oscar Franco Date: Thu, 31 Oct 2024 09:33:14 +0100 Subject: [PATCH] Adds the rtree flag to config object --- README.md | 5 ++++ android/build.gradle | 11 ++++++++- example/ios/Podfile.lock | 4 ++-- example/package.json | 1 + op-sqlite.podspec | 51 +++++++++++++++++++++++----------------- 5 files changed, 48 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 98847bcd..1c71163e 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,17 @@ OP-SQLite has grown large to cover a lot of plugins, sqlite versions and APIs. P [See the docs](https://ospfranco.notion.site/OP-SQLite-Documentation-a279a52102464d0cb13c3fa230d2f2dc?pvs=4) +Join the Discord: + +https://discord.gg/W9XmqCQCKP + Some of the big and external (back-ends, out-of-tree features, plugins) supported features: - Vanilla sqlite ofc - Libsql is supported as a sqlite backend - SQLCipher is supported as a sqlite backend - FTS5 plugin +- Rtree plugin - cr-sqlite plugin - sqlite-vec plugin - Reactive queries (currently with some issues, please donate) diff --git a/android/build.gradle b/android/build.gradle index 427aa8ef..4d5b8338 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -34,6 +34,7 @@ def performanceMode = "0" def sqliteFlags = "" def enableFTS5 = false def useSqliteVec = false +def enableRtree = false def packageJsonFile = new File("$rootDir/../package.json") def packageJson = new JsonSlurper().parseText(packageJsonFile.text) @@ -47,6 +48,7 @@ if(opsqliteConfig) { sqliteFlags = opsqliteConfig["sqliteFlags"] ? opsqliteConfig["sqliteFlags"] : "" enableFTS5 = opsqliteConfig["fts5"] useLibsql = opsqliteConfig["libsql"] + enableRtree = opsqliteConfig["rtree"] } if(useSQLCipher) { @@ -73,6 +75,10 @@ if(enableFTS5) { println "[OP-SQLITE] FTS5 enabled! 🔎" } +if(enableRtree) { + println "[OP-SQLITE] RTree enabled! 🌲" +} + if(useSqliteVec) { println "[OP-SQLITE] Sqlite Vec enabled! ↗️" } @@ -137,7 +143,10 @@ android { cFlags += ["-DSQLITE_DQS=0", "-DSQLITE_THREADSAFE=1", "-DSQLITE_DEFAULT_MEMSTATUS=0", "-DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1", "-DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1", "-DSQLITE_MAX_EXPR_DEPTH=0", "-DSQLITE_OMIT_DEPRECATED=1", "-DSQLITE_OMIT_PROGRESS_CALLBACK=1", "-DSQLITE_OMIT_SHARED_CACHE=1", "-DSQLITE_USE_ALLOCA=1"] } if(enableFTS5) { - cFlags += ["-DSQLITE_ENABLE_FTS4=1", "-DSQLITE_ENABLE_FTS3_PARENTHESIS=1", "-DSQLITE_ENABLE_FTS5=1"] + cFlags += ["-DSQLITE_ENABLE_FTS5=1"] + } + if(enableRtree) { + cFlags += ["-DSQLITE_ENABLE_RTREE=1"] } if(useSqliteVec) { cFlags += "-DOP_SQLITE_USE_SQLITE_VEC=1" diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 38e6272e..2e9985ee 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -10,7 +10,7 @@ PODS: - hermes-engine (0.76.0): - hermes-engine/Pre-built (= 0.76.0) - hermes-engine/Pre-built (0.76.0) - - op-sqlite (9.2.6): + - op-sqlite (9.2.7): - DoubleConversion - glog - hermes-engine @@ -1785,7 +1785,7 @@ SPEC CHECKSUMS: GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4 glog: 08b301085f15bcbb6ff8632a8ebaf239aae04e6a hermes-engine: 9de51d2f67336348a6cd5b686330e436d1dbd522 - op-sqlite: 92fef1bcdad6299e2c87d11c0dc68404ad809d00 + op-sqlite: ab9cf6578c162cd30ad4c311a353f3801e8fdde5 RCT-Folly: bf5c0376ffe4dd2cf438dcf86db385df9fdce648 RCTDeprecation: 4c2c4a088b6f0ccfcbd53c9d5614b0238ad57909 RCTRequired: 2d8a683a7848bc0baf5883f0792c1ac43f6267b5 diff --git a/example/package.json b/example/package.json index 5cfb5f11..f9a3cb1e 100644 --- a/example/package.json +++ b/example/package.json @@ -71,6 +71,7 @@ "performanceMode": "2", "iosSqlite": false, "fts5": true, + "rtree": true, "libsql": false, "sqliteVec": true } diff --git a/op-sqlite.podspec b/op-sqlite.podspec index ee168c45..d14e7d93 100644 --- a/op-sqlite.podspec +++ b/op-sqlite.podspec @@ -10,10 +10,10 @@ fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1' parent_folder_name = File.basename(__dir__) app_package = nil -# for development purposes on user machines the podspec should be able to read the package.json from the root folder -# since it lives inside node_modules/@op-engineering/op-sqlite +# When installed on user node_modules lives inside node_modules/@op-engineering/op-sqlite if __dir__.include?("node_modules") app_package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "package.json"))) +# When running on the example app else app_package = JSON.parse(File.read(File.join(__dir__, "example", "package.json"))) end @@ -26,6 +26,7 @@ performance_mode = "0" phone_version = false sqlite_flags = "" fts5 = false +rtree = false use_sqlite_vec = false if(op_sqlite_config != nil) @@ -36,13 +37,31 @@ if(op_sqlite_config != nil) phone_version = op_sqlite_config["iosSqlite"] == true sqlite_flags = op_sqlite_config["sqliteFlags"] || "" fts5 = op_sqlite_config["fts5"] == true + rtree = op_sqlite_config["rtree"] == true use_sqlite_vec = op_sqlite_config["sqliteVec"] == true end -if phone_version && use_sqlcipher - raise "Cannot use phone embedded version and SQLCipher. SQLCipher needs to be compiled from sources with the project." -end +if phone_version then + if use_sqlcipher then + raise "SQLCipher is not supported with phone version" + end + + if use_crsqlite then + raise "CRSQLite is not supported with phone version" + end + if fts5 then + raise "FTS5 is not supported with phone version" + end + + if rtree then + raise "RTree is not supported with phone version" + end + + if use_sqlite_vec then + raise "SQLite Vec is not supported with phone version" + end +end Pod::Spec.new do |s| s.name = "op-sqlite" @@ -91,24 +110,17 @@ Pod::Spec.new do |s| optimizedCflags = other_cflags + '$(inherited) -DSQLITE_DQS=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1 -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_OMIT_DEPRECATED=1 -DSQLITE_OMIT_PROGRESS_CALLBACK=1 -DSQLITE_OMIT_SHARED_CACHE=1 -DSQLITE_USE_ALLOCA=1' frameworks = [] - if fts5 && !phone_version then + if fts5 then log_message.call("[OP-SQLITE] FTS5 enabled 🔎") xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " SQLITE_ENABLE_FTS5=1" end + + if rtree then + log_message.call("[OP-SQLITE] RTree enabled 🌲") + xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " SQLITE_ENABLE_RTREE=1" + end if phone_version then - if use_sqlcipher then - raise "SQLCipher is not supported with phone version" - end - - if use_crsqlite then - raise "CRSQLite is not supported with phone version" - end - - if fts5 then - raise "FTS5 is not supported with phone version" - end - log_message.call("[OP-SQLITE] using iOS embedded SQLite 📱") xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " OP_SQLITE_USE_PHONE_VERSION=1" s.exclude_files = "cpp/sqlite3.c", "cpp/sqlite3.h" @@ -138,9 +150,6 @@ Pod::Spec.new do |s| end if use_libsql then - if use_sqlcipher then - raise "Cannot use SQLCipher and libsql at the same time" - end xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " OP_SQLITE_USE_LIBSQL=1" if use_crsqlite then frameworks = ["ios/libsql.xcframework", "ios/crsqlite.xcframework"]