@op-engineering/op-sqlite 6.0.2-beta1 → 6.0.2-beta4
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/android/CMakeLists.txt +26 -15
- package/android/build.gradle +10 -1
- package/android/cpp-adapter.cpp +4 -0
- package/android/jniLibs/arm64-v8a/libsql_experimental.a +0 -0
- package/android/jniLibs/armeabi-v7a/libsql_experimental.a +0 -0
- package/android/jniLibs/x86/libsql_experimental.a +0 -0
- package/android/jniLibs/x86_64/libsql_experimental.a +0 -0
- package/cpp/DBHostObject.cpp +234 -87
- package/cpp/DBHostObject.h +19 -10
- package/cpp/PreparedStatementHostObject.cpp +28 -14
- package/cpp/PreparedStatementHostObject.h +18 -14
- package/cpp/bindings.cpp +49 -32
- package/cpp/bindings.h +4 -3
- package/cpp/bridge.cpp +45 -0
- package/cpp/bridge.h +3 -0
- package/cpp/libsql/bridge.cpp +660 -0
- package/cpp/libsql/bridge.h +76 -0
- package/cpp/libsql/libsql.h +133 -0
- package/cpp/sqlite3.h +0 -1
- package/cpp/types.h +5 -0
- package/cpp/utils.cpp +45 -3
- package/cpp/utils.h +2 -3
- package/ios/libsql.xcframework/Info.plist +48 -0
- package/ios/libsql.xcframework/ios-arm64/Headers/libsql.h +133 -0
- package/ios/libsql.xcframework/ios-arm64/libsql_experimental.a +0 -0
- package/ios/libsql.xcframework/ios-arm64_x86_64-simulator/Headers/libsql.h +133 -0
- package/ios/libsql.xcframework/ios-arm64_x86_64-simulator/libsql_experimental.a +0 -0
- package/lib/commonjs/index.js +167 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +164 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +14 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/op-sqlite.podspec +20 -3
- package/package.json +1 -1
- package/src/index.ts +209 -3
- package/cpp/sqlbatchexecutor.cpp +0 -93
- package/cpp/sqlbatchexecutor.h +0 -30
package/android/CMakeLists.txt
CHANGED
|
@@ -9,6 +9,7 @@ set (BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
|
|
|
9
9
|
include_directories(
|
|
10
10
|
../cpp
|
|
11
11
|
../cpp/sqlcipher
|
|
12
|
+
../cpp/libsql
|
|
12
13
|
)
|
|
13
14
|
|
|
14
15
|
add_definitions(
|
|
@@ -18,29 +19,18 @@ add_definitions(
|
|
|
18
19
|
add_library(
|
|
19
20
|
${PACKAGE_NAME}
|
|
20
21
|
SHARED
|
|
21
|
-
../cpp/bridge.cpp
|
|
22
|
-
../cpp/bridge.h
|
|
23
22
|
../cpp/bindings.cpp
|
|
24
|
-
../cpp/bindings.h
|
|
25
|
-
../cpp/utils.h
|
|
26
23
|
../cpp/utils.cpp
|
|
27
|
-
../cpp/ThreadPool.h
|
|
28
24
|
../cpp/ThreadPool.cpp
|
|
29
|
-
../cpp/sqlbatchexecutor.h
|
|
30
|
-
../cpp/sqlbatchexecutor.cpp
|
|
31
25
|
../cpp/SmartHostObject.cpp
|
|
32
|
-
../cpp/SmartHostObject.h
|
|
33
|
-
../cpp/PreparedStatementHostObject.h
|
|
34
26
|
../cpp/PreparedStatementHostObject.cpp
|
|
35
27
|
../cpp/DumbHostObject.cpp
|
|
36
|
-
../cpp/
|
|
37
|
-
../cpp/macros.h
|
|
38
|
-
../cpp/types.h
|
|
28
|
+
../cpp/DBHostObject.cpp
|
|
39
29
|
cpp-adapter.cpp
|
|
40
30
|
)
|
|
41
31
|
|
|
42
32
|
if (USE_SQLCIPHER)
|
|
43
|
-
target_sources(${PACKAGE_NAME} PRIVATE ../cpp/sqlcipher/sqlite3.h ../cpp/sqlcipher/sqlite3.c)
|
|
33
|
+
target_sources(${PACKAGE_NAME} PRIVATE ../cpp/sqlcipher/sqlite3.h ../cpp/sqlcipher/sqlite3.c ../cpp/bridge.cpp ../cpp/bridge.h)
|
|
44
34
|
|
|
45
35
|
add_definitions(
|
|
46
36
|
-DOP_SQLITE_USE_SQLCIPHER=1
|
|
@@ -49,8 +39,14 @@ if (USE_SQLCIPHER)
|
|
|
49
39
|
)
|
|
50
40
|
|
|
51
41
|
find_package(openssl REQUIRED CONFIG)
|
|
42
|
+
elseif (USE_LIBSQL)
|
|
43
|
+
target_sources(${PACKAGE_NAME} PRIVATE ../cpp/libsql/bridge.cpp)
|
|
44
|
+
|
|
45
|
+
add_definitions(
|
|
46
|
+
-DOP_SQLITE_USE_LIBSQL=1
|
|
47
|
+
)
|
|
52
48
|
else()
|
|
53
|
-
target_sources(${PACKAGE_NAME} PRIVATE ../cpp/sqlite3.h ../cpp/sqlite3.c)
|
|
49
|
+
target_sources(${PACKAGE_NAME} PRIVATE ../cpp/sqlite3.h ../cpp/sqlite3.c ../cpp/bridge.cpp ../cpp/bridge.h)
|
|
54
50
|
endif()
|
|
55
51
|
|
|
56
52
|
if (USE_CRSQLITE)
|
|
@@ -81,7 +77,22 @@ if (USE_SQLCIPHER)
|
|
|
81
77
|
android
|
|
82
78
|
openssl::crypto
|
|
83
79
|
)
|
|
84
|
-
|
|
80
|
+
elseif (USE_LIBSQL)
|
|
81
|
+
cmake_path(SET LIBSQL ${CMAKE_CURRENT_SOURCE_DIR}/jniLibs/${ANDROID_ABI}/libsql_experimental.a NORMALIZE)
|
|
82
|
+
add_library(libsql STATIC IMPORTED)
|
|
83
|
+
set_target_properties(libsql PROPERTIES IMPORTED_LOCATION ${LIBSQL})
|
|
84
|
+
|
|
85
|
+
target_link_libraries(
|
|
86
|
+
${PACKAGE_NAME}
|
|
87
|
+
${LOG_LIB}
|
|
88
|
+
fbjni::fbjni
|
|
89
|
+
ReactAndroid::jsi
|
|
90
|
+
ReactAndroid::turbomodulejsijni
|
|
91
|
+
ReactAndroid::react_nativemodule_core
|
|
92
|
+
android
|
|
93
|
+
libsql
|
|
94
|
+
)
|
|
95
|
+
else ()
|
|
85
96
|
target_link_libraries(
|
|
86
97
|
${PACKAGE_NAME}
|
|
87
98
|
${LOG_LIB}
|
package/android/build.gradle
CHANGED
|
@@ -28,6 +28,7 @@ def isNewArchitectureEnabled() {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
def useSQLCipher = false
|
|
31
|
+
def useLibsql = false
|
|
31
32
|
def useCRSQLite = false
|
|
32
33
|
def performanceMode = "0"
|
|
33
34
|
def sqliteFlags = ""
|
|
@@ -43,10 +44,13 @@ if(opsqliteConfig) {
|
|
|
43
44
|
performanceMode = opsqliteConfig["performanceMode"] ? opsqliteConfig["performanceMode"] : ""
|
|
44
45
|
sqliteFlags = opsqliteConfig["sqliteFlags"] ? opsqliteConfig["sqliteFlags"] : ""
|
|
45
46
|
enableFTS5 = opsqliteConfig["fts5"]
|
|
47
|
+
useLibsql = opsqliteConfig["libsql"]
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
if(useSQLCipher) {
|
|
49
51
|
println "[OP-SQLITE] using SQLCipher 🔒"
|
|
52
|
+
} else if(useLibsql) {
|
|
53
|
+
println "[OP-SQLITE] using libsql 📦"
|
|
50
54
|
} else {
|
|
51
55
|
println "[OP-SQLITE] using Vanilla SQLite"
|
|
52
56
|
}
|
|
@@ -117,6 +121,10 @@ android {
|
|
|
117
121
|
cFlags += "-DOP_SQLITE_USE_SQLCIPHER=1"
|
|
118
122
|
cppFlags += "-DOP_SQLITE_USE_SQLCIPHER=1"
|
|
119
123
|
}
|
|
124
|
+
if(useLibsql) {
|
|
125
|
+
cFlags += "-DOP_SQLITE_USE_LIBSQL=1"
|
|
126
|
+
cppFlags += "-DOP_SQLITE_USE_LIBSQL=1"
|
|
127
|
+
}
|
|
120
128
|
if(useCRSQLite) {
|
|
121
129
|
cFlags += "-DOP_SQLITE_USE_CRSQLITE=1"
|
|
122
130
|
cppFlags += "-DOP_SQLITE_USE_CRSQLITE=1"
|
|
@@ -136,7 +144,8 @@ android {
|
|
|
136
144
|
arguments "-DANDROID_STL=c++_shared",
|
|
137
145
|
"-DSQLITE_FLAGS='$sqliteFlags'",
|
|
138
146
|
"-DUSE_SQLCIPHER=${useSQLCipher ? 1 : 0}",
|
|
139
|
-
"-DUSE_CRSQLITE=${useCRSQLite ? 1 : 0}"
|
|
147
|
+
"-DUSE_CRSQLITE=${useCRSQLite ? 1 : 0}",
|
|
148
|
+
"-DUSE_LIBSQL=${useLibsql ? 1 : 0}"
|
|
140
149
|
abiFilters (*reactNativeArchitectures())
|
|
141
150
|
}
|
|
142
151
|
}
|
package/android/cpp-adapter.cpp
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
#include <jsi/jsi.h>
|
|
7
7
|
#include <typeinfo>
|
|
8
8
|
|
|
9
|
+
namespace jsi = facebook::jsi;
|
|
10
|
+
namespace react = facebook::react;
|
|
11
|
+
namespace jni = facebook::jni;
|
|
12
|
+
|
|
9
13
|
// This file is not using raw jni but rather fbjni, do not change how the native
|
|
10
14
|
// functions are registered
|
|
11
15
|
// https://github.com/facebookincubator/fbjni/blob/main/docs/quickref.md
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|