Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite suddenly considers everything as not an error

It started on an Android phone, simple create statement in a file inside the assets/migrations folder (I use a 3rd party library called ActiveAndroid and for 2 years it worked okay - I did not changed anything about that):

CREATE TABLE IF NOT EXISTS Car (Brand TEXT);

I get this exception:

04-07 15:31:36.683  15738-15738/? E/SQLiteLog﹕ (21) API called with NULL prepared statement
04-07 15:31:36.683  15738-15738/? E/SQLiteLog﹕ (21) misuse at line 63243 of [00bb9c9ce4]
java.lang.RuntimeException: Unable to create application com.activeandroid.app.Application: android.database.sqlite.SQLiteException: not an error (code 0)


at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4394)
            at android.app.ActivityThread.access$1300(ActivityThread.java:141)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5041)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.database.sqlite.SQLiteException: not an error (code 0)
            at android.database.sqlite.SQLiteConnection.nativeExecuteForChangedRowCount(Native Method)
            at android.database.sqlite.SQLiteConnection.executeForChangedRowCount(SQLiteConnection.java:727)
            at android.database.sqlite.SQLiteSession.executeForChangedRowCount(SQLiteSession.java:754)
            at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:64)
            at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1665)
            at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1594)
            at com.activeandroid.DatabaseHelper.executeSqlScript(DatabaseHelper.java:185)
            at com.activeandroid.DatabaseHelper.executeMigrations(DatabaseHelper.java:155)
            at com.activeandroid.DatabaseHelper.onUpgrade(DatabaseHelper.java:78)
            at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:257)
            at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
            at com.activeandroid.Cache.openDatabase(Cache.java:104)
            at com.activeandroid.Cache.initialize(Cache.java:77)
            at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:43)
            at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:30)
            at com.activeandroid.app.Application.onCreate(Application.java:25)
            at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1000)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4391)
            at android.app.ActivityThread.access$1300(ActivityThread.java:141)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5041)
            at java.lang.reflect.Method.invokeNative(Native Method)

So I checked it on my computer with a Firefox addon called SQLite Manager and created a brand new file (the file is totally unrelated to the Android database). I used this select and on the last error I get this:

enter image description here

It seems that every SQLite statement is a not an error statement.

Unfortunately, Android can't handle that.

What should I do?

like image 281
Nestor Avatar asked Apr 07 '15 14:04

Nestor


People also ask

What does the SQLite error message indicate?

The error message indicates that a similar operation can not be performed by using the same database connection or a different link to the database using a shared cache, as there is a transaction event. Because SQLite is a lightweight database, a higher level of competition can not be managed.

What does it mean when database is locked SQLite?

“SQLite Error Database is locked” Factors Normally, this error code occurs when an SQLite user attempts to perform two unauthorized transactions or operations on the same data connection and the same other server details. An NFS locking problem generates SQLite locked error.

What should I do if SQLite says “vactable is not available”?

Look again at the error message. It is telling you that the database does not contain a table called "VacTable". Use the command line sqlite3 shell to check the database. Please Sign up or sign in to vote.

Why SQLite is not a high level of competition?

Because SQLite is a lightweight database, a higher level of competition can not be managed. While attempting to do two Select operations in a multithreaded program simultaneously on a table.


1 Answers

It seems that the upgrade script in the assets\migration folder had some empty lines and that caused the not an error.

like image 128
Nestor Avatar answered Sep 20 '22 14:09

Nestor