发布于 2020-02-17 21:56:56
您已经编写了 transaction ,但是,我要让您知道,在SQLite插件中没有transaction属性,您需要添加write create属性,无论是打开还是创建数据库。像=>一样
this.sqlite.create({
name: 'data.db',
location: 'default'
})
.then((db: SQLiteObject) =>
db.executeSql('create table danceMoves(name VARCHAR(32))', [])
.then(() => console.log('Executed SQL'))
.catch(e => console.log(e));
})
.catch(e => console.log(e));发布于 2020-02-17 14:37:05
从sqlite打开或创建db时,应在之后使用executeSql执行查询并对db执行操作。Sqlite for ionic 4不再支持事务。For more information and example
this.sqlite.create({
name: 'data.db',
location: 'default'
})
.then((db: SQLiteObject) => {
db.executeSql('create table danceMoves(name VARCHAR(32))', [])
.then(() => console.log('Executed SQL'))
.catch(e => console.log(e));
})
.catch(e => console.log(e));https://stackoverflow.com/questions/60255481
复制相似问题