dart - sqflite 中的多个表
问题描述
我对 Flutter 很陌生,我只想设置一个包含多个表的 SQLite 数据库。我的研究如下。
提前致谢。
await db.execute('''
create table $reminderTable (
$columnReminderId integer primary key autoincrement,
$columnReminderCarId integer not null,
$columnReminderName text not null,
$columnReminderNotifyMileage integer not null,
$columnReminderEndMileage integer not null
)''');
await db.execute('''
create table $carTable (
$columnCarId integer primary key autoincrement,
$columnCarTitle text not null
)''');
调用 sqlite3_step 的未知错误(10:磁盘 I/O 错误)rs
解决方案
例如,您可以组合多个 db.execute 调用
void _createDb(Database db, int newVersion) async {
await db.execute(
'CREATE TABLE $noteTable($colId INTEGER PRIMARY KEY AUTOINCREMENT, $colTitle TEXT, '
'$colDescription TEXT, $colPriority INTEGER, $colDate TEXT)');
await db.execute(
'CREATE TABLE $noteTable($colId INTEGER PRIMARY KEY AUTOINCREMENT, $colTitle TEXT, '
'$colDescription TEXT, $colPriority INTEGER, $colDate TEXT)');
}
推荐阅读
- javascript - Angular 并且在 document.ready() 之后只调用一次 JS 事件?
- bash - 有没有一种简单的方法来制作多个读取命令而不是手动输入每个命令?
- aws-lambda - AWS APIGW - 访问 Lambda 映射模板中集成请求的静态 HTTP 标头
- javascript - React 本机 VirtualizedLists 不应该嵌套在普通警告中
- python - cv2.triangulatePoints 不是很准确吗?
- php - 如何在php的内部函数中使用外部函数的参数?
- c# - 我如何循环它以询问用户是否要输入另一个变量并再次运行程序
- regex - 来自字符串电话号码的正则表达式 4 位数字
- html - 为什么 ID 正确时找不到我的 HTML 值?
- excel - 对活动图表和系列集合的困惑