@capacitor-community/sqlite 5.2.3 → 5.2.4
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 +5 -6
- package/android/src/main/java/com/getcapacitor/community/database/sqlite/CapacitorSQLitePlugin.java +12 -7
- package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/Database.java +20 -7
- package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/UtilsSQLCipher.java +62 -0
- package/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/UtilsSQLStatement.java +20 -14
- package/dist/esm/definitions.d.ts +6 -6
- package/dist/esm/definitions.js +42 -21
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +42 -21
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +42 -21
- package/dist/plugin.js.map +1 -1
- package/electron/dist/plugin.js +72 -78
- package/electron/dist/plugin.js.map +1 -1
- package/ios/Plugin/CapacitorSQLite.swift +1082 -1139
- package/ios/Plugin/CapacitorSQLitePlugin.swift +3 -2
- package/ios/Plugin/Database.swift +27 -3
- package/ios/Plugin/ImportExportJson/ImportFromJson.swift +2 -2
- package/ios/Plugin/Utils/UtilsDelete.swift +2 -3
- package/ios/Plugin/Utils/UtilsEncryption.swift +75 -0
- package/ios/Plugin/Utils/UtilsSQLCipher.swift +3 -3
- package/ios/Plugin/Utils/UtilsSQLStatement.swift +81 -17
- package/ios/Plugin/Utils/UtilsSecret.swift +1 -0
- package/package.json +3 -3
- package/src/definitions.ts +88 -54
- package/src/web.ts +10 -4
package/dist/plugin.js
CHANGED
|
@@ -138,6 +138,12 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
138
138
|
const conn = new SQLiteDBConnection(database, readonly, this.sqlite);
|
|
139
139
|
const connName = readonly ? `RO_${database}` : `RW_${database}`;
|
|
140
140
|
this._connectionDict.set(connName, conn);
|
|
141
|
+
/*
|
|
142
|
+
console.log(`*** in createConnection connectionDict: ***`)
|
|
143
|
+
this._connectionDict.forEach((connection, key) => {
|
|
144
|
+
console.log(`Key: ${key}, Value: ${connection}`);
|
|
145
|
+
});
|
|
146
|
+
*/
|
|
141
147
|
return Promise.resolve(conn);
|
|
142
148
|
}
|
|
143
149
|
catch (err) {
|
|
@@ -151,6 +157,11 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
151
157
|
await this.sqlite.closeConnection({ database, readonly });
|
|
152
158
|
const connName = readonly ? `RO_${database}` : `RW_${database}`;
|
|
153
159
|
this._connectionDict.delete(connName);
|
|
160
|
+
/* console.log(`*** in closeConnection connectionDict: ***`)
|
|
161
|
+
this._connectionDict.forEach((connection, key) => {
|
|
162
|
+
console.log(`Key: ${key}, Value: ${connection}`);
|
|
163
|
+
});
|
|
164
|
+
*/
|
|
154
165
|
return Promise.resolve();
|
|
155
166
|
}
|
|
156
167
|
catch (err) {
|
|
@@ -254,6 +265,11 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
254
265
|
async closeAllConnections() {
|
|
255
266
|
const delDict = new Map();
|
|
256
267
|
try {
|
|
268
|
+
/* console.log(`*** in closeAllConnections connectionDict: ***`)
|
|
269
|
+
this._connectionDict.forEach((connection, key) => {
|
|
270
|
+
console.log(`Key: ${key}, Value: ${connection}`);
|
|
271
|
+
});
|
|
272
|
+
*/
|
|
257
273
|
for (const key of this._connectionDict.keys()) {
|
|
258
274
|
const database = key.substring(3);
|
|
259
275
|
const readonly = key.substring(0, 3) === 'RO_' ? true : false;
|
|
@@ -266,6 +282,7 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
266
282
|
return Promise.resolve();
|
|
267
283
|
}
|
|
268
284
|
catch (err) {
|
|
285
|
+
console.log(`in definition closeAllConnections err: `, err);
|
|
269
286
|
return Promise.reject(err);
|
|
270
287
|
}
|
|
271
288
|
}
|
|
@@ -473,8 +490,9 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
473
490
|
}
|
|
474
491
|
async beginTransaction() {
|
|
475
492
|
try {
|
|
476
|
-
const changes = await this.sqlite
|
|
477
|
-
|
|
493
|
+
const changes = await this.sqlite.beginTransaction({
|
|
494
|
+
database: this.dbName,
|
|
495
|
+
});
|
|
478
496
|
return Promise.resolve(changes);
|
|
479
497
|
}
|
|
480
498
|
catch (err) {
|
|
@@ -483,8 +501,9 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
483
501
|
}
|
|
484
502
|
async commitTransaction() {
|
|
485
503
|
try {
|
|
486
|
-
const changes = await this.sqlite
|
|
487
|
-
|
|
504
|
+
const changes = await this.sqlite.commitTransaction({
|
|
505
|
+
database: this.dbName,
|
|
506
|
+
});
|
|
488
507
|
return Promise.resolve(changes);
|
|
489
508
|
}
|
|
490
509
|
catch (err) {
|
|
@@ -493,8 +512,9 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
493
512
|
}
|
|
494
513
|
async rollbackTransaction() {
|
|
495
514
|
try {
|
|
496
|
-
const changes = await this.sqlite
|
|
497
|
-
|
|
515
|
+
const changes = await this.sqlite.rollbackTransaction({
|
|
516
|
+
database: this.dbName,
|
|
517
|
+
});
|
|
498
518
|
return Promise.resolve(changes);
|
|
499
519
|
}
|
|
500
520
|
catch (err) {
|
|
@@ -503,8 +523,9 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
503
523
|
}
|
|
504
524
|
async isTransactionActive() {
|
|
505
525
|
try {
|
|
506
|
-
const result = await this.sqlite
|
|
507
|
-
|
|
526
|
+
const result = await this.sqlite.isTransactionActive({
|
|
527
|
+
database: this.dbName,
|
|
528
|
+
});
|
|
508
529
|
return Promise.resolve(result);
|
|
509
530
|
}
|
|
510
531
|
catch (err) {
|
|
@@ -581,7 +602,7 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
581
602
|
statements: statements,
|
|
582
603
|
transaction: transaction,
|
|
583
604
|
readonly: false,
|
|
584
|
-
isSQL92: isSQL92
|
|
605
|
+
isSQL92: isSQL92,
|
|
585
606
|
});
|
|
586
607
|
return Promise.resolve(res);
|
|
587
608
|
}
|
|
@@ -602,7 +623,7 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
602
623
|
statement: statement,
|
|
603
624
|
values: values,
|
|
604
625
|
readonly: this.readonly,
|
|
605
|
-
isSql92: true
|
|
626
|
+
isSql92: true,
|
|
606
627
|
});
|
|
607
628
|
}
|
|
608
629
|
else {
|
|
@@ -611,7 +632,7 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
611
632
|
statement: statement,
|
|
612
633
|
values: [],
|
|
613
634
|
readonly: this.readonly,
|
|
614
|
-
isSQL92: isSQL92
|
|
635
|
+
isSQL92: isSQL92,
|
|
615
636
|
});
|
|
616
637
|
}
|
|
617
638
|
// reorder rows for ios
|
|
@@ -637,7 +658,7 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
637
658
|
transaction: transaction,
|
|
638
659
|
readonly: false,
|
|
639
660
|
returnMode: mRetMode,
|
|
640
|
-
isSQL92: true
|
|
661
|
+
isSQL92: true,
|
|
641
662
|
});
|
|
642
663
|
// }
|
|
643
664
|
}
|
|
@@ -652,7 +673,7 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
652
673
|
transaction: transaction,
|
|
653
674
|
readonly: false,
|
|
654
675
|
returnMode: mRetMode,
|
|
655
|
-
isSQL92: isSQL92
|
|
676
|
+
isSQL92: isSQL92,
|
|
656
677
|
});
|
|
657
678
|
}
|
|
658
679
|
// reorder rows for ios
|
|
@@ -677,7 +698,7 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
677
698
|
transaction: transaction,
|
|
678
699
|
readonly: false,
|
|
679
700
|
returnMode: returnMode,
|
|
680
|
-
isSQL92: isSQL92
|
|
701
|
+
isSQL92: isSQL92,
|
|
681
702
|
});
|
|
682
703
|
// }
|
|
683
704
|
// reorder rows for ios
|
|
@@ -833,10 +854,10 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
833
854
|
if (!this.readonly) {
|
|
834
855
|
try {
|
|
835
856
|
await this.sqlite.beginTransaction({
|
|
836
|
-
database: this.dbName
|
|
857
|
+
database: this.dbName,
|
|
837
858
|
});
|
|
838
859
|
isActive = await this.sqlite.isTransactionActive({
|
|
839
|
-
database: this.dbName
|
|
860
|
+
database: this.dbName,
|
|
840
861
|
});
|
|
841
862
|
if (!isActive) {
|
|
842
863
|
return Promise.reject('After Begin Transaction, no transaction active');
|
|
@@ -858,7 +879,7 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
858
879
|
transaction: false,
|
|
859
880
|
readonly: false,
|
|
860
881
|
returnMode: retMode,
|
|
861
|
-
isSQL92: isSQL92
|
|
882
|
+
isSQL92: isSQL92,
|
|
862
883
|
});
|
|
863
884
|
if (ret.changes.changes <= 0) {
|
|
864
885
|
throw new Error('Error in transaction method run ');
|
|
@@ -873,7 +894,7 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
873
894
|
readonly: false,
|
|
874
895
|
});
|
|
875
896
|
isActive = await this.sqlite.isTransactionActive({
|
|
876
|
-
database: this.dbName
|
|
897
|
+
database: this.dbName,
|
|
877
898
|
});
|
|
878
899
|
if (ret.changes.changes < 0) {
|
|
879
900
|
throw new Error('Error in transaction method execute ');
|
|
@@ -882,11 +903,11 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
882
903
|
}
|
|
883
904
|
}
|
|
884
905
|
isActive = await this.sqlite.isTransactionActive({
|
|
885
|
-
database: this.dbName
|
|
906
|
+
database: this.dbName,
|
|
886
907
|
});
|
|
887
908
|
if (isActive) {
|
|
888
909
|
const retC = await this.sqlite.commitTransaction({
|
|
889
|
-
database: this.dbName
|
|
910
|
+
database: this.dbName,
|
|
890
911
|
});
|
|
891
912
|
changes += retC.changes.changes;
|
|
892
913
|
}
|
|
@@ -896,7 +917,7 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
896
917
|
catch (err) {
|
|
897
918
|
const msg = err.message ? err.message : err;
|
|
898
919
|
isActive = await this.sqlite.isTransactionActive({
|
|
899
|
-
database: this.dbName
|
|
920
|
+
database: this.dbName,
|
|
900
921
|
});
|
|
901
922
|
if (isActive) {
|
|
902
923
|
await this.sqlite.rollbackTransaction({
|