expo-sqlite 13.1.0 → 13.1.2
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/CHANGELOG.md +10 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/sqlite/NativeDatabase.kt +5 -0
- package/android/src/main/java/expo/modules/sqlite/NativeDatabaseBinding.kt +6 -1
- package/android/src/main/java/expo/modules/sqlite/NativeStatement.kt +5 -0
- package/android/src/main/java/expo/modules/sqlite/NativeStatementBinding.kt +6 -1
- package/android/src/main/java/expo/modules/sqlite/SQLiteModuleNext.kt +12 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 13.1.2 — 2023-12-21
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- Fixed `NativeStatementBinding` leakage on Android. ([#25996](https://github.com/expo/expo/pull/25996) by [@kudo](https://github.com/kudo))
|
|
18
|
+
|
|
19
|
+
## 13.1.1 — 2023-12-19
|
|
20
|
+
|
|
21
|
+
_This version does not introduce any user-facing changes._
|
|
22
|
+
|
|
13
23
|
## 13.1.0 — 2023-12-13
|
|
14
24
|
|
|
15
25
|
### 🛠 Breaking changes
|
package/android/build.gradle
CHANGED
|
@@ -4,7 +4,7 @@ apply plugin: 'maven-publish'
|
|
|
4
4
|
apply plugin: 'de.undercouch.download'
|
|
5
5
|
|
|
6
6
|
group = 'host.exp.exponent'
|
|
7
|
-
version = '13.1.
|
|
7
|
+
version = '13.1.2'
|
|
8
8
|
|
|
9
9
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
10
10
|
if (expoModulesCorePlugin.exists()) {
|
|
@@ -106,7 +106,7 @@ android {
|
|
|
106
106
|
namespace "expo.modules.sqlite"
|
|
107
107
|
defaultConfig {
|
|
108
108
|
versionCode 18
|
|
109
|
-
versionName "13.1.
|
|
109
|
+
versionName "13.1.2"
|
|
110
110
|
|
|
111
111
|
externalNativeBuild {
|
|
112
112
|
cmake {
|
|
@@ -10,4 +10,9 @@ internal class NativeDatabase(val databaseName: String, val openOptions: OpenDat
|
|
|
10
10
|
override fun equals(other: Any?): Boolean {
|
|
11
11
|
return other is NativeDatabase && this.ref == other.ref
|
|
12
12
|
}
|
|
13
|
+
|
|
14
|
+
override fun deallocate() {
|
|
15
|
+
super.deallocate()
|
|
16
|
+
this.ref.close()
|
|
17
|
+
}
|
|
13
18
|
}
|
|
@@ -4,12 +4,13 @@ package expo.modules.sqlite
|
|
|
4
4
|
|
|
5
5
|
import com.facebook.jni.HybridData
|
|
6
6
|
import expo.modules.core.interfaces.DoNotStrip
|
|
7
|
+
import java.io.Closeable
|
|
7
8
|
|
|
8
9
|
private typealias UpdateListener = (databaseName: String, tableName: String, operationType: Int, rowID: Long) -> Unit
|
|
9
10
|
|
|
10
11
|
@Suppress("KotlinJniMissingFunction")
|
|
11
12
|
@DoNotStrip
|
|
12
|
-
internal class NativeDatabaseBinding {
|
|
13
|
+
internal class NativeDatabaseBinding : Closeable {
|
|
13
14
|
@DoNotStrip
|
|
14
15
|
private val mHybridData: HybridData
|
|
15
16
|
|
|
@@ -19,6 +20,10 @@ internal class NativeDatabaseBinding {
|
|
|
19
20
|
mHybridData = initHybrid()
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
override fun close() {
|
|
24
|
+
mHybridData.resetNative()
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
/**
|
|
23
28
|
* Enable data change notifications
|
|
24
29
|
*/
|
|
@@ -7,6 +7,11 @@ import expo.modules.kotlin.sharedobjects.SharedRef
|
|
|
7
7
|
internal class NativeStatement : SharedRef<NativeStatementBinding>(NativeStatementBinding()) {
|
|
8
8
|
var isFinalized = false
|
|
9
9
|
|
|
10
|
+
override fun deallocate() {
|
|
11
|
+
super.deallocate()
|
|
12
|
+
this.ref.close()
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
override fun equals(other: Any?): Boolean {
|
|
11
16
|
return other is NativeStatement && this.ref == other.ref
|
|
12
17
|
}
|
|
@@ -4,13 +4,14 @@ package expo.modules.sqlite
|
|
|
4
4
|
|
|
5
5
|
import com.facebook.jni.HybridData
|
|
6
6
|
import expo.modules.core.interfaces.DoNotStrip
|
|
7
|
+
import java.io.Closeable
|
|
7
8
|
|
|
8
9
|
internal typealias SQLiteColumnNames = ArrayList<String>
|
|
9
10
|
internal typealias SQLiteColumnValues = ArrayList<Any>
|
|
10
11
|
|
|
11
12
|
@Suppress("KotlinJniMissingFunction")
|
|
12
13
|
@DoNotStrip
|
|
13
|
-
internal class NativeStatementBinding {
|
|
14
|
+
internal class NativeStatementBinding : Closeable {
|
|
14
15
|
@DoNotStrip
|
|
15
16
|
private val mHybridData: HybridData
|
|
16
17
|
|
|
@@ -18,6 +19,10 @@ internal class NativeStatementBinding {
|
|
|
18
19
|
mHybridData = initHybrid()
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
override fun close() {
|
|
23
|
+
mHybridData.resetNative()
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
// region sqlite3 bindings
|
|
22
27
|
|
|
23
28
|
external fun sqlite3_bind_parameter_index(name: String): Int
|
|
@@ -211,8 +211,11 @@ class SQLiteModuleNext : Module() {
|
|
|
211
211
|
// expo-modules-core AnyTypeConverter casts JavaScript Number to Kotlin Double,
|
|
212
212
|
// here to cast as Long if the value is an integer.
|
|
213
213
|
val normalizedParam =
|
|
214
|
-
if (param is Double && param.toDouble() % 1.0 == 0.0)
|
|
215
|
-
|
|
214
|
+
if (param is Double && param.toDouble() % 1.0 == 0.0) {
|
|
215
|
+
param.toLong()
|
|
216
|
+
} else {
|
|
217
|
+
param
|
|
218
|
+
}
|
|
216
219
|
statement.ref.bindStatementParam(index, normalizedParam)
|
|
217
220
|
}
|
|
218
221
|
}
|
|
@@ -228,12 +231,15 @@ class SQLiteModuleNext : Module() {
|
|
|
228
231
|
throw SQLiteErrorException(database.ref.convertSqlLiteErrorToString())
|
|
229
232
|
}
|
|
230
233
|
val firstRowValues: SQLiteColumnValues =
|
|
231
|
-
if (ret == NativeDatabaseBinding.SQLITE_ROW)
|
|
232
|
-
|
|
234
|
+
if (ret == NativeDatabaseBinding.SQLITE_ROW) {
|
|
235
|
+
statement.ref.getColumnValues()
|
|
236
|
+
} else {
|
|
237
|
+
arrayListOf()
|
|
238
|
+
}
|
|
233
239
|
return mapOf(
|
|
234
240
|
"lastInsertRowId" to database.ref.sqlite3_last_insert_rowid().toInt(),
|
|
235
241
|
"changes" to database.ref.sqlite3_changes(),
|
|
236
|
-
"firstRowValues" to firstRowValues
|
|
242
|
+
"firstRowValues" to firstRowValues
|
|
237
243
|
)
|
|
238
244
|
}
|
|
239
245
|
|
|
@@ -314,7 +320,7 @@ class SQLiteModuleNext : Module() {
|
|
|
314
320
|
"databaseFilePath" to databaseFilePath,
|
|
315
321
|
"tableName" to tableName,
|
|
316
322
|
"rowId" to rowID,
|
|
317
|
-
"typeId" to SQLAction.fromCode(operationType).value
|
|
323
|
+
"typeId" to SQLAction.fromCode(operationType).value
|
|
318
324
|
)
|
|
319
325
|
)
|
|
320
326
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-sqlite",
|
|
3
|
-
"version": "13.1.
|
|
3
|
+
"version": "13.1.2",
|
|
4
4
|
"description": "Provides access to a database that can be queried through a WebSQL-like API (https://www.w3.org/TR/webdatabase/). The database is persisted across restarts of your app.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"expo": "*"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "36402c8b2bc9b63f003c04642d97bf091b35fe16"
|
|
51
51
|
}
|