一个愚蠢的问题,但我在这里找不到错误......
CREATE TABLE units (_id INTEGER PRIMARY KEY AUTOINCREMENT, group_id INTEGER NOT NULL, unit_name STRING NOT NULL UNIQUE (group_id, unit_name))
SQLite说:
SQLiteManager: Likely SQL syntax error: CREATE TABLE units (_id INTEGER PRIMARY KEY AUTOINCREMENT, group_id INTEGER NOT NULL, unit_name STRING NOT NULL UNIQUE (group_id, unit_name))
[ near "(": syntax error ]
Exception Name: NS_ERROR_FAILURE
Exception Message: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [mozIStorageConnection.createStatement]
错误是什么?
答案 0 :(得分:1)
我的猜测是在UNIQUE
之前缺少逗号:
CREATE TABLE units (
_id INTEGER PRIMARY KEY AUTOINCREMENT,
group_id INTEGER NOT NULL,
unit_name STRING NOT NULL,
UNIQUE (group_id, unit_name)
)