Edu*_*zer 8 react-native expo create-react-native-app
拥有以下代码:
import { SQLite } from 'expo';
const db = SQLite.openDatabase('mydb.db')
db.transaction( tx => {
tx.executeSql('insert into invalidTable values (?,?)', [1,2], null, (transact, err) => {
//I can't find error description in the objects below
console.log({transact, err})
})
})
Run Code Online (Sandbox Code Playgroud)
如何获取sqlite错误消息,以确定导致此错误的原因(在本例中为无效表)?
该API文档说我的误差函数" 有两个参数:交易本身,以及错误对象 ",但我找不到在没有这些错误描述.
我做了一个小吃模拟这个场景.
这为我记录了错误
import { SQLite } from 'expo';
const db = SQLite.openDatabase('mydb.db')
db.transaction(tx => {
tx.executeSql(sql, params, (_, { rows }) => {
console.log(rows._array)
}, (t, error) => {
console.log(error);
})
})
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
840 次 |
| 最近记录: |