在 Flutter 中,如何插入 sqflite table 但 table 没有带自动递增整数的 id?
At Flutter, how to insert into sqflite table but the table doesn't have an id with auto increment integer?
我看到 sqflite 数据库助手实例插入函数 returns Future<int>
。我知道我的 table 是否使用 INTEGER PRIMARY KEY AUTO_INCREMENT
作为 id。但是如果我的id是STRING PRIMARY KEY NOT NULL
呢?当函数坚持 return Future<int>
时,将从函数中 return 编辑什么?如何让 return 值变成 Future<String>
?或者我可以忽略这个 return 值吗?
即使您使用文本主键,每个 SQLite table 都有一个整数行 ID (https://www.sqlite.org/rowidtable.html)。在这种情况下,您可以忽略 return 值。
我看到 sqflite 数据库助手实例插入函数 returns Future<int>
。我知道我的 table 是否使用 INTEGER PRIMARY KEY AUTO_INCREMENT
作为 id。但是如果我的id是STRING PRIMARY KEY NOT NULL
呢?当函数坚持 return Future<int>
时,将从函数中 return 编辑什么?如何让 return 值变成 Future<String>
?或者我可以忽略这个 return 值吗?
即使您使用文本主键,每个 SQLite table 都有一个整数行 ID (https://www.sqlite.org/rowidtable.html)。在这种情况下,您可以忽略 return 值。