@capacitor-community/sqlite 4.2.1 → 4.2.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/README.md +1 -0
- package/electron/dist/plugin.js +24 -0
- package/electron/dist/plugin.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
package/electron/dist/plugin.js
CHANGED
|
@@ -220,6 +220,7 @@ class UtilsSQLite {
|
|
|
220
220
|
* @param isOpen
|
|
221
221
|
*/
|
|
222
222
|
async beginTransaction(db, isOpen) {
|
|
223
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
223
224
|
return new Promise((resolve, reject) => {
|
|
224
225
|
const msg = 'BeginTransaction: ';
|
|
225
226
|
if (!isOpen) {
|
|
@@ -823,6 +824,23 @@ class UtilsSQLite {
|
|
|
823
824
|
return Promise.reject(`isSqlDeleted: ${err}`);
|
|
824
825
|
}
|
|
825
826
|
}
|
|
827
|
+
async getJournalMode(mDB) {
|
|
828
|
+
let resQuery = [];
|
|
829
|
+
let retMode = "delete";
|
|
830
|
+
const query = `PRAGMA journal_mode;`;
|
|
831
|
+
try {
|
|
832
|
+
resQuery = await this.queryAll(mDB, query, []);
|
|
833
|
+
if (resQuery.length === 1) {
|
|
834
|
+
for (const query of resQuery) {
|
|
835
|
+
retMode = query.journal_mode;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
return retMode;
|
|
839
|
+
}
|
|
840
|
+
catch (err) {
|
|
841
|
+
return Promise.reject('GetJournalMode: ' + `${err}`);
|
|
842
|
+
}
|
|
843
|
+
}
|
|
826
844
|
/**
|
|
827
845
|
* GetTableColumnNamesTypes
|
|
828
846
|
* @param mDB
|
|
@@ -3584,6 +3602,8 @@ class Database {
|
|
|
3584
3602
|
this.ensureDatabaseIsOpen();
|
|
3585
3603
|
try {
|
|
3586
3604
|
if (transaction) {
|
|
3605
|
+
const mode = await this.sqliteUtil.getJournalMode(this.database);
|
|
3606
|
+
console.log(`$$$ in executeSQL journal_mode: ${mode} $$$`);
|
|
3587
3607
|
await this.sqliteUtil.beginTransaction(this.database, this._isDbOpen);
|
|
3588
3608
|
}
|
|
3589
3609
|
const changes = await this.sqliteUtil.execute(this.database, sql, false);
|
|
@@ -3640,6 +3660,8 @@ class Database {
|
|
|
3640
3660
|
initChanges = await this.sqliteUtil.dbChanges(this.database);
|
|
3641
3661
|
// start a transaction
|
|
3642
3662
|
if (transaction) {
|
|
3663
|
+
const mode = await this.sqliteUtil.getJournalMode(this.database);
|
|
3664
|
+
console.log(`$$$ in runSQL journal_mode: ${mode} $$$`);
|
|
3643
3665
|
await this.sqliteUtil.beginTransaction(this.database, this._isDbOpen);
|
|
3644
3666
|
}
|
|
3645
3667
|
}
|
|
@@ -3683,6 +3705,8 @@ class Database {
|
|
|
3683
3705
|
initChanges = await this.sqliteUtil.dbChanges(this.database);
|
|
3684
3706
|
// start a transaction
|
|
3685
3707
|
if (transaction) {
|
|
3708
|
+
const mode = await this.sqliteUtil.getJournalMode(this.database);
|
|
3709
|
+
console.log(`$$$ in execSet journal_mode: ${mode} $$$`);
|
|
3686
3710
|
await this.sqliteUtil.beginTransaction(this.database, this._isDbOpen);
|
|
3687
3711
|
}
|
|
3688
3712
|
}
|