fix: had to remove a select from migration for Android to migrate.
This commit is contained in:
@@ -394,7 +394,7 @@ export class CapacitorPlatformService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply SQLite PRAGMAs on temporary connection (v3.3.2)
|
* Apply SQLite PRAGMAs on temporary connection (v3.3.3)
|
||||||
*
|
*
|
||||||
* CRITICAL: PRAGMAs must run OUTSIDE any transaction.
|
* CRITICAL: PRAGMAs must run OUTSIDE any transaction.
|
||||||
* Uses a temporary connection to avoid conflicts with main connection.
|
* Uses a temporary connection to avoid conflicts with main connection.
|
||||||
@@ -410,6 +410,9 @@ export class CapacitorPlatformService
|
|||||||
* - Only set synchronous=NORMAL when WAL is effective
|
* - Only set synchronous=NORMAL when WAL is effective
|
||||||
* - Don't attempt WAL on read-only bundles or protected file modes
|
* - Don't attempt WAL on read-only bundles or protected file modes
|
||||||
*
|
*
|
||||||
|
* v3.3.3: Fixed busy_timeout PRAGMA to use query() instead of run() to avoid
|
||||||
|
* "error code 100: another row available" on some Capacitor SQLite builds.
|
||||||
|
*
|
||||||
* @returns Object with journal_mode value
|
* @returns Object with journal_mode value
|
||||||
*/
|
*/
|
||||||
private async _applyPragmasOnTempConnection(): Promise<{
|
private async _applyPragmasOnTempConnection(): Promise<{
|
||||||
@@ -490,18 +493,38 @@ export class CapacitorPlatformService
|
|||||||
journalMode = "default";
|
journalMode = "default";
|
||||||
}
|
}
|
||||||
|
|
||||||
// busy_timeout — treat ROW(100) as benign
|
// busy_timeout: use query() and ignore the row to avoid "another row available" (v3.3.3)
|
||||||
|
// v3.3.3: Fixed "error code 100: another row available" by using query() instead of run()
|
||||||
|
// Some Capacitor SQLite builds return busy_timeout as a row, which causes run() to fail
|
||||||
try {
|
try {
|
||||||
await pragmaConn.run("PRAGMA busy_timeout = 5000;", []);
|
// Some builds return the effective timeout as a row; query() is the safe call.
|
||||||
|
await pragmaConn.query("PRAGMA busy_timeout = 5000;");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const msg = this._errMsg(e);
|
// As a fallback (rare), try run(); but tolerate row/done mismatch
|
||||||
if (!/another\s+row\s+available/i.test(msg)) throw e;
|
try {
|
||||||
|
await pragmaConn.run("PRAGMA busy_timeout = 5000;", []);
|
||||||
|
} catch (e2) {
|
||||||
|
const msg = (
|
||||||
|
e2 instanceof Error ? e2.message : String(e2)
|
||||||
|
).toLowerCase();
|
||||||
|
if (msg.includes("another row available")) {
|
||||||
|
// benign on some plugins; swallow
|
||||||
|
} else {
|
||||||
|
// If you prefer, just warn and continue—don't fail init on busy_timeout
|
||||||
|
logger.debug(
|
||||||
|
"[CapacitorPlatformService] busy_timeout warning:",
|
||||||
|
e2,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
`[CapacitorPlatformService] PRAGMAs applied (temp): journal_mode=${journalMode}`,
|
`[CapacitorPlatformService] PRAGMAs applied (temp, v3.3.3): journal_mode=${journalMode}`,
|
||||||
|
);
|
||||||
|
logger.log(
|
||||||
|
"[CapacitorPlatformService] [PRAGMA] temp path -> done (v3.3.3)",
|
||||||
);
|
);
|
||||||
logger.log("[CapacitorPlatformService] [PRAGMA] temp path -> done");
|
|
||||||
logger.log("[CapacitorPlatformService] PRAGMA path: temp");
|
logger.log("[CapacitorPlatformService] PRAGMA path: temp");
|
||||||
return { journalMode, path: "temp" as const };
|
return { journalMode, path: "temp" as const };
|
||||||
} finally {
|
} finally {
|
||||||
@@ -519,10 +542,13 @@ export class CapacitorPlatformService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply PRAGMAs on existing connection (v3.3.4 fallback)
|
* Apply PRAGMAs on existing connection (v3.3.3 fallback)
|
||||||
*
|
*
|
||||||
* Always completes and sets this.db. Repairs desync if needed.
|
* Always completes and sets this.db. Repairs desync if needed.
|
||||||
* Does not set synchronous (often fails in transaction).
|
* Does not set synchronous (often fails in transaction).
|
||||||
|
*
|
||||||
|
* v3.3.3: Fixed busy_timeout PRAGMA to use query() instead of run() to avoid
|
||||||
|
* "error code 100: another row available" on some Capacitor SQLite builds.
|
||||||
*/
|
*/
|
||||||
private async _applyPragmasOnExistingConnection(): Promise<{
|
private async _applyPragmasOnExistingConnection(): Promise<{
|
||||||
journalMode: string;
|
journalMode: string;
|
||||||
@@ -616,16 +642,29 @@ export class CapacitorPlatformService
|
|||||||
journalMode = "default";
|
journalMode = "default";
|
||||||
}
|
}
|
||||||
|
|
||||||
// busy_timeout — ignore ROW(100)
|
// busy_timeout: use query() and ignore the row to avoid "another row available" (v3.3.3)
|
||||||
|
// v3.3.3: Fixed "error code 100: another row available" by using query() instead of run()
|
||||||
|
// Some Capacitor SQLite builds return busy_timeout as a row, which causes run() to fail
|
||||||
try {
|
try {
|
||||||
await conn.run("PRAGMA busy_timeout = 5000;", []);
|
// Some builds return the effective timeout as a row; query() is the safe call.
|
||||||
|
await conn.query("PRAGMA busy_timeout = 5000;");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const msg = this._errMsg(e);
|
// As a fallback (rare), try run(); but tolerate row/done mismatch
|
||||||
if (!/another\s+row\s+available/i.test(msg)) {
|
try {
|
||||||
logger.debug(
|
await conn.run("PRAGMA busy_timeout = 5000;", []);
|
||||||
"[CapacitorPlatformService] [PRAGMA] fallback: busy_timeout warning:",
|
} catch (e2) {
|
||||||
msg,
|
const msg = (
|
||||||
);
|
e2 instanceof Error ? e2.message : String(e2)
|
||||||
|
).toLowerCase();
|
||||||
|
if (msg.includes("another row available")) {
|
||||||
|
// benign on some plugins; swallow
|
||||||
|
} else {
|
||||||
|
// If you prefer, just warn and continue—don't fail init on busy_timeout
|
||||||
|
logger.debug(
|
||||||
|
"[CapacitorPlatformService] busy_timeout warning:",
|
||||||
|
e2,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user