DatabaseException(Flutter中输入不完整(代码1 SQLITE_ERROR)

lymnna71  于 2023-05-07  发布在  SQLite
关注(0)|答案(1)|浏览(168)

当我使用flutter和创建表时,我得到以下错误!:

error DatabaseException(incomplete input (code 1 SQLITE_ERROR): , while compiling: CREATE TABLE scheduled_shift_groups(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, uniqueGroupId TEXT, nightShiftCount INTEGER, dayShiftCount INTEGER, weekEnding INTEGER, estimatedIncome REAL) sql 'CREATE TABLE scheduled_shift_groups(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, uniqueGroupId TEXT, nightShiftCount INTEGER, dayShiftCount INTEGER, weekEnding INTEGER, estimatedIncome REAL' args []} during open, closing...

下面是我的代码:

Future<Database> database = getDatabasesPath().then((String path) {
    return openDatabase(
      join(path, dbName),
      onCreate: (Database db, int version) async {
        await db.execute(
            "CREATE TABLE $scheduledShiftGroupsTableName(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, uniqueGroupId TEXT, nightShiftCount INTEGER, dayShiftCount INTEGER, weekEnding INTEGER, estimatedIncome REAL");
      },
      version: 1,
    );
  });
kgsdhlau

kgsdhlau1#

其实我犯了个愚蠢的错误!!!在execute方法中,我忘记了REAL后面的)符号。
现在问题解决了)。编码快乐!

相关问题