mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
fix: capacitor driver PRAGMA bug (#11467)
* fix: capacitor driver PRAGMA bug add usage of query method for PRAGMA queries in CapacitorQueryRunner.ts; add usage of execute method for PRAGMA queries in CapacitorDriver.ts; PRAGMA statements must be executed with query method in CapacitorQueryRunner.ts to be able to return results used in AbstractSqliteQueryRunner, not just success indicator, otherwise error appears: tableColumn.type.indexOf is not a function.; PRAGMA statements must be executed with execute method in CapacitorDriver.ts, otherwise error appears: prepareSQL step failed rc: 100 message: another row available * fix: npm format
This commit is contained in:
parent
b8dbca515e
commit
d325d9e63d
@ -80,7 +80,7 @@ export class CapacitorDriver extends AbstractSqliteDriver {
|
||||
|
||||
// we need to enable foreign keys in sqlite to make sure all foreign key related features
|
||||
// working properly. this also makes onDelete to work with sqlite.
|
||||
await connection.run(`PRAGMA foreign_keys = ON`)
|
||||
await connection.execute(`PRAGMA foreign_keys = ON`)
|
||||
|
||||
if (
|
||||
this.options.journalMode &&
|
||||
@ -88,7 +88,7 @@ export class CapacitorDriver extends AbstractSqliteDriver {
|
||||
this.options.journalMode,
|
||||
) !== -1
|
||||
) {
|
||||
await connection.run(
|
||||
await connection.execute(
|
||||
`PRAGMA journal_mode = ${this.options.journalMode}`,
|
||||
)
|
||||
}
|
||||
|
||||
@ -81,9 +81,7 @@ export class CapacitorQueryRunner extends AbstractSqliteQueryRunner {
|
||||
].indexOf(command) !== -1
|
||||
) {
|
||||
raw = await databaseConnection.execute(query, false)
|
||||
} else if (
|
||||
["INSERT", "UPDATE", "DELETE", "PRAGMA"].indexOf(command) !== -1
|
||||
) {
|
||||
} else if (["INSERT", "UPDATE", "DELETE"].indexOf(command) !== -1) {
|
||||
raw = await databaseConnection.run(query, parameters, false)
|
||||
} else {
|
||||
raw = await databaseConnection.query(query, parameters || [])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user