単純なテーブルを作成していますが、テーブルを実行すると、次のようなエラーがスローされます。
10-06 09:15:28.606: E/AndroidRuntime(595):
android.database.sqlite.SQLiteException: near "item": error:
create table item (_id integer primary key autoincrement,
item_id text not null,
item_name text not null);
私のdbhelperクラスは次のとおりです:--
<code>
public class DbHelper は SQLiteOpenHelper を拡張します {
private static final String CREATE_ITEM_TABLE = String.format("CREATE TABLE %s ( %s INTEGER PRIMARY KEY AUTOINCREMENT, %s TEXT NOT NULL, %s TEXT NOT NULL);",
"item","_id", "item_id", "item_name");
private static final String DATABASE_NAME = "applicationdata";
private static final int DATABASE_VERSION = 1;
public DbHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
// Method is called during creation of the database
@Override
public void onCreate(SQLiteDatabase database) {
database.execSQL(CREATE_ITEM_TABLE);
}
// Method is called during an upgrade of the database,
// e.g. if you increase the database version
@Override
public void onUpgrade(SQLiteDatabase database, int oldVersion,
int newVersion) {
Log.w(DbHelper.class.getName(), "Upgrading database from version "
+ oldVersion + " to " + newVersion
+ ", which will destroy all old data");
database.execSQL("DROP TABLE IF EXISTS item");
onCreate(database);
}
}
</code>
私を助けてください。