@capacitor-community/sqlite 5.0.8 → 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 -23
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +42 -23
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +42 -23
- 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 +7 -7
- package/src/definitions.ts +88 -56
- 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
|
}
|
|
@@ -448,8 +465,6 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
448
465
|
return this.readonly;
|
|
449
466
|
}
|
|
450
467
|
async open() {
|
|
451
|
-
const jeepSQlEL = document.querySelector("jeep-sqlite");
|
|
452
|
-
console.log(`in definition open jeepSQlEL: `, jeepSQlEL);
|
|
453
468
|
try {
|
|
454
469
|
await this.sqlite.open({
|
|
455
470
|
database: this.dbName,
|
|
@@ -475,8 +490,9 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
475
490
|
}
|
|
476
491
|
async beginTransaction() {
|
|
477
492
|
try {
|
|
478
|
-
const changes = await this.sqlite
|
|
479
|
-
|
|
493
|
+
const changes = await this.sqlite.beginTransaction({
|
|
494
|
+
database: this.dbName,
|
|
495
|
+
});
|
|
480
496
|
return Promise.resolve(changes);
|
|
481
497
|
}
|
|
482
498
|
catch (err) {
|
|
@@ -485,8 +501,9 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
485
501
|
}
|
|
486
502
|
async commitTransaction() {
|
|
487
503
|
try {
|
|
488
|
-
const changes = await this.sqlite
|
|
489
|
-
|
|
504
|
+
const changes = await this.sqlite.commitTransaction({
|
|
505
|
+
database: this.dbName,
|
|
506
|
+
});
|
|
490
507
|
return Promise.resolve(changes);
|
|
491
508
|
}
|
|
492
509
|
catch (err) {
|
|
@@ -495,8 +512,9 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
495
512
|
}
|
|
496
513
|
async rollbackTransaction() {
|
|
497
514
|
try {
|
|
498
|
-
const changes = await this.sqlite
|
|
499
|
-
|
|
515
|
+
const changes = await this.sqlite.rollbackTransaction({
|
|
516
|
+
database: this.dbName,
|
|
517
|
+
});
|
|
500
518
|
return Promise.resolve(changes);
|
|
501
519
|
}
|
|
502
520
|
catch (err) {
|
|
@@ -505,8 +523,9 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
505
523
|
}
|
|
506
524
|
async isTransactionActive() {
|
|
507
525
|
try {
|
|
508
|
-
const result = await this.sqlite
|
|
509
|
-
|
|
526
|
+
const result = await this.sqlite.isTransactionActive({
|
|
527
|
+
database: this.dbName,
|
|
528
|
+
});
|
|
510
529
|
return Promise.resolve(result);
|
|
511
530
|
}
|
|
512
531
|
catch (err) {
|
|
@@ -583,7 +602,7 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
583
602
|
statements: statements,
|
|
584
603
|
transaction: transaction,
|
|
585
604
|
readonly: false,
|
|
586
|
-
isSQL92: isSQL92
|
|
605
|
+
isSQL92: isSQL92,
|
|
587
606
|
});
|
|
588
607
|
return Promise.resolve(res);
|
|
589
608
|
}
|
|
@@ -604,7 +623,7 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
604
623
|
statement: statement,
|
|
605
624
|
values: values,
|
|
606
625
|
readonly: this.readonly,
|
|
607
|
-
isSql92: true
|
|
626
|
+
isSql92: true,
|
|
608
627
|
});
|
|
609
628
|
}
|
|
610
629
|
else {
|
|
@@ -613,7 +632,7 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
613
632
|
statement: statement,
|
|
614
633
|
values: [],
|
|
615
634
|
readonly: this.readonly,
|
|
616
|
-
isSQL92: isSQL92
|
|
635
|
+
isSQL92: isSQL92,
|
|
617
636
|
});
|
|
618
637
|
}
|
|
619
638
|
// reorder rows for ios
|
|
@@ -639,7 +658,7 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
639
658
|
transaction: transaction,
|
|
640
659
|
readonly: false,
|
|
641
660
|
returnMode: mRetMode,
|
|
642
|
-
isSQL92: true
|
|
661
|
+
isSQL92: true,
|
|
643
662
|
});
|
|
644
663
|
// }
|
|
645
664
|
}
|
|
@@ -654,7 +673,7 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
654
673
|
transaction: transaction,
|
|
655
674
|
readonly: false,
|
|
656
675
|
returnMode: mRetMode,
|
|
657
|
-
isSQL92: isSQL92
|
|
676
|
+
isSQL92: isSQL92,
|
|
658
677
|
});
|
|
659
678
|
}
|
|
660
679
|
// reorder rows for ios
|
|
@@ -679,7 +698,7 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
679
698
|
transaction: transaction,
|
|
680
699
|
readonly: false,
|
|
681
700
|
returnMode: returnMode,
|
|
682
|
-
isSQL92: isSQL92
|
|
701
|
+
isSQL92: isSQL92,
|
|
683
702
|
});
|
|
684
703
|
// }
|
|
685
704
|
// reorder rows for ios
|
|
@@ -835,10 +854,10 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
835
854
|
if (!this.readonly) {
|
|
836
855
|
try {
|
|
837
856
|
await this.sqlite.beginTransaction({
|
|
838
|
-
database: this.dbName
|
|
857
|
+
database: this.dbName,
|
|
839
858
|
});
|
|
840
859
|
isActive = await this.sqlite.isTransactionActive({
|
|
841
|
-
database: this.dbName
|
|
860
|
+
database: this.dbName,
|
|
842
861
|
});
|
|
843
862
|
if (!isActive) {
|
|
844
863
|
return Promise.reject('After Begin Transaction, no transaction active');
|
|
@@ -860,7 +879,7 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
860
879
|
transaction: false,
|
|
861
880
|
readonly: false,
|
|
862
881
|
returnMode: retMode,
|
|
863
|
-
isSQL92: isSQL92
|
|
882
|
+
isSQL92: isSQL92,
|
|
864
883
|
});
|
|
865
884
|
if (ret.changes.changes <= 0) {
|
|
866
885
|
throw new Error('Error in transaction method run ');
|
|
@@ -875,7 +894,7 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
875
894
|
readonly: false,
|
|
876
895
|
});
|
|
877
896
|
isActive = await this.sqlite.isTransactionActive({
|
|
878
|
-
database: this.dbName
|
|
897
|
+
database: this.dbName,
|
|
879
898
|
});
|
|
880
899
|
if (ret.changes.changes < 0) {
|
|
881
900
|
throw new Error('Error in transaction method execute ');
|
|
@@ -884,11 +903,11 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
884
903
|
}
|
|
885
904
|
}
|
|
886
905
|
isActive = await this.sqlite.isTransactionActive({
|
|
887
|
-
database: this.dbName
|
|
906
|
+
database: this.dbName,
|
|
888
907
|
});
|
|
889
908
|
if (isActive) {
|
|
890
909
|
const retC = await this.sqlite.commitTransaction({
|
|
891
|
-
database: this.dbName
|
|
910
|
+
database: this.dbName,
|
|
892
911
|
});
|
|
893
912
|
changes += retC.changes.changes;
|
|
894
913
|
}
|
|
@@ -898,7 +917,7 @@ var capacitorCapacitorSQLite = (function (exports, core) {
|
|
|
898
917
|
catch (err) {
|
|
899
918
|
const msg = err.message ? err.message : err;
|
|
900
919
|
isActive = await this.sqlite.isTransactionActive({
|
|
901
|
-
database: this.dbName
|
|
920
|
+
database: this.dbName,
|
|
902
921
|
});
|
|
903
922
|
if (isActive) {
|
|
904
923
|
await this.sqlite.rollbackTransaction({
|