我在我的 android 应用程序中创建表时遇到了真正的麻烦。
这是我的错误:
06-21 23:29:58.490: E/SQLiteLog(19571): (1) near "index": syntax error
06-21 23:29:58.820: E/InfiniDatabase(19571): Creating Index Table Failed
06-21 23:29:58.820: E/InfiniDatabase(19571): android.database.sqlite.SQLiteException: near "index": syntax error (code 1): , while compiling: CREATE TABLE index (_id INTEGER PRIMARY KEY)
这是我正在使用的“测试”声明,因为我的完整声明不是在玩球。我对 SQL 毫无用处 - 是我还是计算机?
这是Java片段:
//used to create are initial index table...
@Override
public void onCreate(SQLiteDatabase db)
{
Log.d(TAG_NAME, "Now Creating Index Table");
try{
final String INDEX_TABLE_CREATE = "CREATE TABLE " + INDEX_TABLE_NAME +
" (" +
COL_ID + " INTEGER PRIMARY KEY" + ")";
db.execSQL(INDEX_TABLE_CREATE);
Log.d(TAG_NAME,"Created New Index Table");
}
catch(SQLException e)
{
Log.e(TAG_NAME, "Creating Index Table Failed", e);
}
}