@capacitor-community/sqlite 5.0.2 → 5.0.3-1
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/src/main/java/com/getcapacitor/community/database/sqlite/CapacitorSQLite.java +1 -0
- package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/Database.java +5 -2
- package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/ImportExportJson/ImportFromJson.java +6 -7
- package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/ImportExportJson/UtilsJson.java +13 -14
- package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/UtilsSQLite.java +45 -3
- package/electron/dist/plugin.js +37 -42
- package/electron/dist/plugin.js.map +1 -1
- package/ios/Plugin/CapacitorSQLite.swift +25 -0
- package/ios/Plugin/Extensions/Array.swift +13 -0
- package/ios/Plugin/Extensions/Data.swift +13 -0
- package/ios/Plugin/Utils/UtilsBinding.swift +6 -0
- package/ios/Plugin/Utils/UtilsSQLCipher.swift +5 -4
- package/package.json +1 -1
|
@@ -802,6 +802,31 @@ enum CapacitorSQLiteError: Error {
|
|
|
802
802
|
val.append(obj)
|
|
803
803
|
} else if value is NSNull {
|
|
804
804
|
val.append(value)
|
|
805
|
+
} else if let obj = value as? [String: Any] {
|
|
806
|
+
if var keys = Array(obj.keys) as? [String] {
|
|
807
|
+
if #available(iOS 15.0, *) {
|
|
808
|
+
keys.sort(using: .localizedStandard)
|
|
809
|
+
var valuesArr: [UInt8] = []
|
|
810
|
+
for key in keys {
|
|
811
|
+
if let mVal = obj[key] {
|
|
812
|
+
if let iVal = mVal as? Int {
|
|
813
|
+
valuesArr.append(UInt8(iVal))
|
|
814
|
+
} else {
|
|
815
|
+
let msg: String = "Error in reading buffer"
|
|
816
|
+
throw CapacitorSQLiteError.failed(message: msg)
|
|
817
|
+
}
|
|
818
|
+
} else {
|
|
819
|
+
let msg: String = "Error in reading buffer"
|
|
820
|
+
throw CapacitorSQLiteError.failed(message: msg)
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
val.append(valuesArr)
|
|
824
|
+
} else {
|
|
825
|
+
let msg: String = "Error buffer sorted not implemented"
|
|
826
|
+
throw CapacitorSQLiteError.failed(message: msg)
|
|
827
|
+
|
|
828
|
+
}
|
|
829
|
+
}
|
|
805
830
|
} else {
|
|
806
831
|
let msg: String = "Not a SQL type"
|
|
807
832
|
throw CapacitorSQLiteError.failed(message: msg)
|
|
@@ -34,6 +34,7 @@ class UtilsBinding {
|
|
|
34
34
|
}
|
|
35
35
|
return message
|
|
36
36
|
}
|
|
37
|
+
// swiftlint:disable cyclomatic_complexity
|
|
37
38
|
class func bind( handle: OpaquePointer?, value: Any?, idx: Int)
|
|
38
39
|
throws {
|
|
39
40
|
if value == nil {
|
|
@@ -64,9 +65,14 @@ class UtilsBinding {
|
|
|
64
65
|
var bInt: Int32 = Int32(0)
|
|
65
66
|
if value {bInt = Int32(1)}
|
|
66
67
|
sqlite3_bind_int(handle, Int32(idx), Int32(bInt))
|
|
68
|
+
} else if let value = value as? [UInt8] {
|
|
69
|
+
let data: Data = Data(value)
|
|
70
|
+
sqlite3_bind_blob(handle, Int32(idx), data.bytes,
|
|
71
|
+
Int32(data.bytes.count), SQLITETRANSIENT)
|
|
67
72
|
} else {
|
|
68
73
|
throw UtilsSQLCipherError.bindFailed
|
|
69
74
|
}
|
|
70
75
|
|
|
71
76
|
}
|
|
77
|
+
// swiftlint:enable cyclomatic_complexity
|
|
72
78
|
}
|
|
@@ -909,11 +909,12 @@ class UtilsSQLCipher {
|
|
|
909
909
|
let val: Double = sqlite3_column_double(handle, index)
|
|
910
910
|
rowData[String(cString: name)] = val
|
|
911
911
|
case SQLITE_BLOB:
|
|
912
|
-
if let dataBlob = sqlite3_column_blob(handle, index){
|
|
913
|
-
let dataBlobLength = sqlite3_column_bytes(handle,index)
|
|
912
|
+
if let dataBlob = sqlite3_column_blob(handle, index) {
|
|
913
|
+
let dataBlobLength = sqlite3_column_bytes(handle, index)
|
|
914
914
|
let data = Data(bytes: dataBlob,
|
|
915
|
-
count:Int(dataBlobLength))
|
|
916
|
-
rowData[String(cString: name)] = data.base64EncodedString()
|
|
915
|
+
count: Int(dataBlobLength))
|
|
916
|
+
// rowData[String(cString: name)] = data.base64EncodedString()
|
|
917
|
+
rowData[String(cString: name)] = data.bytes
|
|
917
918
|
} else {
|
|
918
919
|
rowData[String(cString: name)] = NSNull()
|
|
919
920
|
}
|