return new Promise((resolve, reject) => {
plus.sqlite.executeSql({
name: this.dbName,
sql: INSERT INTO ${dbTable} (id, level, name, nodeTypes, parentId , sort) VALUES (?, ?, ?, ?,?,?)
,
args: dataList.map(item => [item.id, item.level, item.name, item.nodeTypes, item.parentId, item.sort]),
success(e) {
console.log(e, '成功回调999999')
resolve(e)
},
fail(e) {
console.log(e, '失败回调')
reject(e)
}
})
})
这种的插入方式好像插入不到数据库里面
sql = BEGIN; INSERT INTO ${dbTable} (id, level, name, nodeTypes, parentId , sort) VALUES ('${item.id}',${item.level},'${item.name}',${item.nodeTypes},'${item.parentId}','${item.sort}'); INSERT INTO ${dbTable} (id, level, name, nodeTypes, parentId , sort) VALUES ('${item.id}',${item.level},'${item.name}',${item.nodeTypes},'${item.parentId}','${item.sort}'); INSERT INTO ${dbTable} (id, level, name, nodeTypes, parentId , sort) VALUES ('${item.id}',${item.level},'${item.name}',${item.nodeTypes},'${item.parentId}','${item.sort}'); COMMIT; 这种方式也是插入不进去的 就没有别的方法了吗 还是我操作错误 我查表是没有查到数据的除了一条一条插入正常 sql =
BEGIN;这个方法也只有第一条能插入后续的没进入到库里面
0 个回复