我在android應用程序中遇到問題,我想用下面的腳本創建數據庫。SQLite和Android異常
CREATE TABLE IF NOT EXISTS events (
_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
source_device_id INT,
timestamp INT NOT NULL,
processed BOOLEAN DEFAULT FALSE,
event_type TINYINT NOT NULL,
payload BLOB);
CREATE INDEX IF NOT EXISTS events_unprocessed ON events (processed, _id);
和我的Android代碼
public void onCreate(SQLiteDatabase db) {
InputStream schemaStream = context.getResources().openRawResource(R.raw.logdb_schema);
Scanner schemaScanner = new Scanner(schemaStream, "UTF-8");
schemaScanner.useDelimiter(";");
Log.i(TAG, "Creating database");
try {
db.beginTransaction();
while (schemaScanner.hasNext()) {
String statement = schemaScanner.next();
Log.d(TAG, "Creating database: " + statement);
db.execSQL(statement);
}
db.setTransactionSuccessful();
}
finally {
db.endTransaction();
}
}
它不工作其發電運行時異常:
android.database.sqlite.SQLiteException: not an error:
*什麼*運行時異常?如果您需要幫助,我們需要詳細信息。 –
android.database.sqlite.SQLiteException:不是錯誤 – Altaf
如果我使用'sqlite3'命令它可以工作。這不可能是整個錯誤,必須有更多。請檢查您的[logcat輸出](http://developer.android.com/guide/developing/debugging/debugging-log.html#startingLogcat),並將其發佈在這裏... – Knickedi