@capacitor-community/sqlite 5.0.1 → 5.0.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/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/Database.java
CHANGED
|
@@ -8,6 +8,7 @@ import static android.database.Cursor.FIELD_TYPE_STRING;
|
|
|
8
8
|
|
|
9
9
|
import android.content.Context;
|
|
10
10
|
import android.content.SharedPreferences;
|
|
11
|
+
import android.os.Build;
|
|
11
12
|
import android.util.Log;
|
|
12
13
|
import androidx.sqlite.db.SimpleSQLiteQuery;
|
|
13
14
|
import androidx.sqlite.db.SupportSQLiteDatabase;
|
|
@@ -22,6 +23,7 @@ import java.io.File;
|
|
|
22
23
|
import java.text.SimpleDateFormat;
|
|
23
24
|
import java.util.ArrayList;
|
|
24
25
|
import java.util.Arrays;
|
|
26
|
+
import java.util.Base64;
|
|
25
27
|
import java.util.Collections;
|
|
26
28
|
import java.util.Date;
|
|
27
29
|
import java.util.Dictionary;
|
|
@@ -795,7 +797,12 @@ public class Database {
|
|
|
795
797
|
row.put(colName, c.getDouble(index));
|
|
796
798
|
break;
|
|
797
799
|
case FIELD_TYPE_BLOB:
|
|
798
|
-
row.put(colName, c.getBlob(index));
|
|
800
|
+
// row.put(colName, c.getBlob(index));
|
|
801
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
802
|
+
row.put(colName, Base64.getEncoder().encodeToString(c.getBlob(index)));
|
|
803
|
+
} else {
|
|
804
|
+
row.put(colName, JSONObject.NULL);
|
|
805
|
+
}
|
|
799
806
|
break;
|
|
800
807
|
case FIELD_TYPE_NULL:
|
|
801
808
|
row.put(colName, JSONObject.NULL);
|
|
@@ -909,13 +909,15 @@ 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
|
-
let
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
912
|
+
if let dataBlob = sqlite3_column_blob(handle, index){
|
|
913
|
+
let dataBlobLength = sqlite3_column_bytes(handle,index)
|
|
914
|
+
let data = Data(bytes: dataBlob,
|
|
915
|
+
count:Int(dataBlobLength))
|
|
916
|
+
rowData[String(cString: name)] = data.base64EncodedString()
|
|
917
|
+
} else {
|
|
918
|
+
rowData[String(cString: name)] = NSNull()
|
|
919
|
+
}
|
|
920
|
+
|
|
919
921
|
case SQLITE_TEXT:
|
|
920
922
|
let buffer = sqlite3_column_text(handle, index)
|
|
921
923
|
if let mBuffer = buffer {
|