Angular sqlbatch执行时发生Sqlite异常
我正在我的离子应用程序中集成SQLite。执行代码时出现以下错误 错误错误:未捕获(承诺中):错误:没有错误处理程序的语句失败:sqlite3\u prepare\u v2失败:输入不完整 错误:没有错误处理程序的语句失败:sqlite3\u prepare\u v2失败:输入不完整 我的代码如下Angular sqlbatch执行时发生Sqlite异常,angular,sqlite,ionic2,android-sqlite,Angular,Sqlite,Ionic2,Android Sqlite,我正在我的离子应用程序中集成SQLite。执行代码时出现以下错误 错误错误:未捕获(承诺中):错误:没有错误处理程序的语句失败:sqlite3\u prepare\u v2失败:输入不完整 错误:没有错误处理程序的语句失败:sqlite3\u prepare\u v2失败:输入不完整 我的代码如下 createEncryptedDB() { this.platform.ready().then(() => { this.sqlite.create({ n
createEncryptedDB() {
this.platform.ready().then(() => {
this.sqlite.create({
name: 'sampleDb',
location: 'default',
key: 'mypassword'
}).then((sqlObject: SQLiteObject) => {
this.db = sqlObject;
const tableList: any = [];
tableList.push(['CREATE TABLE IF NOT EXISTS TEST_DATA(kty text, kty_type varchar(30)']);
this.queryAll(tableList).then(() => {
console.log("Tables were created")
}).catch((ex) => {
return Promise.reject(ex);
});
});
});
}
public queryAll(list: any[]): Promise<any> {
return new Promise((resolve, reject) => {
try {
this.platform.ready().then(() => {
resolve();
return this.db.sqlBatch(list);
});
} catch (err) {
reject({ err: err });
}
});
createEncryptedDB(){
this.platform.ready()。然后(()=>{
this.sqlite.create({
名称:“sampleDb”,
位置:'默认',
密钥:“我的密码”
}).然后((sqlObject:SQLiteObject)=>{
this.db=sqlObject;
const tableList:any=[];
push(['createtable IF NOT EXISTS TEST_DATA(kty text,kty_type varchar(30)”));
this.queryAll(tableList).then(()=>{
log(“创建了表”)
}).catch((ex)=>{
退货承诺。拒绝(ex);
});
});
});
}
公开查询(列表:任意[]):承诺{
返回新承诺((解决、拒绝)=>{
试一试{
this.platform.ready()。然后(()=>{
解决();
返回此.db.sqlBatch(列表);
});
}捕捉(错误){
拒绝({err:err});
}
});
请注意,我们正在加密数据库。有人知道如何修复此问题吗?在
创建表
命令中存在语法错误。它缺少最后一个结束符)
。这可能不是代码中唯一的错误,但它解释了此特定故障