SQLiteLog(8646): (1) table tempsettings 没有名为 user 的列
SQLiteLog( 8646): (1) table tempsettings has no column named user
我正在学习如何在 flutter 应用程序中升级数据库,看起来非常简单,但我在执行 INSERT 时遇到此错误:
E/SQLiteLog( 9107): (1) table tempsettings has no column named user
I/flutter ( 9107): DatabaseException(table tempsettings has no column
named user (code 1 SQLITE_ERROR): , while compiling: INSERT INTO
tempsettings('id', 'user', 'company', 'url') SELECT 'id', 'user',
'company', 'url' FROM settings) E/SQLiteLog( 9107): (1) no such
column: user I/flutter ( 9107): DatabaseException(no such column: user
(code 1 SQLITE_ERROR): , while compiling: INSERT INTO settings('id',
'user', 'company', 'url', 'theme') SELECT id, user, company, url, 1
FROM tempsettings)
await db
.execute("CREATE TABLE tempsettings("
"'id' INTEGER "
"'user' TEXT,"
"'company' TEXT,"
"'url' TEXT)")
.catchError((error) => print(error.toString()));
await db.execute(
"INSERT INTO tempsettings('id', 'user', 'company', 'url') SELECT 'id', 'user', 'company', 'url' FROM settings")
.catchError((error) => print(error.toString()));
有谁能帮助我如何执行此 INSERT?
谢谢。
您在创建 id 列后缺少逗号
await db.execute("CREATE TABLE tempsettings("
"id INTEGER ", //this comma was missing
"user TEXT,"
"company TEXT,"
"url TEXT)")
.catchError((error) => print(error.toString()));
我正在学习如何在 flutter 应用程序中升级数据库,看起来非常简单,但我在执行 INSERT 时遇到此错误:
E/SQLiteLog( 9107): (1) table tempsettings has no column named user I/flutter ( 9107): DatabaseException(table tempsettings has no column named user (code 1 SQLITE_ERROR): , while compiling: INSERT INTO tempsettings('id', 'user', 'company', 'url') SELECT 'id', 'user', 'company', 'url' FROM settings) E/SQLiteLog( 9107): (1) no such column: user I/flutter ( 9107): DatabaseException(no such column: user (code 1 SQLITE_ERROR): , while compiling: INSERT INTO settings('id', 'user', 'company', 'url', 'theme') SELECT id, user, company, url, 1 FROM tempsettings)
await db
.execute("CREATE TABLE tempsettings("
"'id' INTEGER "
"'user' TEXT,"
"'company' TEXT,"
"'url' TEXT)")
.catchError((error) => print(error.toString()));
await db.execute(
"INSERT INTO tempsettings('id', 'user', 'company', 'url') SELECT 'id', 'user', 'company', 'url' FROM settings")
.catchError((error) => print(error.toString()));
有谁能帮助我如何执行此 INSERT?
谢谢。
您在创建 id 列后缺少逗号
await db.execute("CREATE TABLE tempsettings("
"id INTEGER ", //this comma was missing
"user TEXT,"
"company TEXT,"
"url TEXT)")
.catchError((error) => print(error.toString()));