'Unable to exit this illegal statement exception loop
I am new to android.And i got this task at work.you can see in the logs i am getting illegal statement multiple times.what i want is it should give this exception only one time .below is the method that i think causing the exception.
@Override
public boolean executeInsertQuery(String query) {
boolean isInsertSuccess;
SQLiteStatement sqlStmt = null;
try {
if (dbWriteInstance == null) {
dbWriteInstance = getWriteableDatabase();
}
sqlStmt = dbWriteInstance.compileStatement(query);
sqlStmt.executeInsert();
dbWriteInstance.yieldIfContendedSafely();
isInsertSuccess = true;
} catch (Exception e) {
bllLog.logInfo(LogWarningEvent.UNEXPECTED_EXCEPTION, e,
"Exception in SQLiteAccess.executeInsertQuery()");
isInsertSuccess = false;
} finally {
if (sqlStmt != null) {
sqlStmt.close();
}
}
return isInsertSuccess;
}
/**
* Compiles an SQL statement into a reusable pre-compiled statement object.
* The parameters are identical to {@link #execSQL(String)}. You may put ?s in the
* statement and fill in those values with {@link SQLiteProgram#bindString}
* and {@link SQLiteProgram#bindLong} each time you want to run the
* statement. Statements may not return result sets larger than 1x1.
*
* @param sql The raw SQL statement, may contain ? for unknown values to be
* bound later.
*
* @return A pre-compiled {@link SQLiteStatement} object. Note that
* {@link SQLiteStatement}s are not synchronized, see the documentation for more details.
*
* @throws SQLException If the SQL string is invalid for some reason
* @throws IllegalStateException if the database is not open
*/
public SQLiteStatement compileStatement(String sql) throws SQLException {
lock();
try {
if (!isOpen()) {
throw new IllegalStateException("database not open");
}
return new SQLiteStatement(this, sql);
} finally {
unlock();
}
}
See the image from 10689 to 10715 i am getting this multiple times i just want this whole block one time
Any suggestion on this will be helpful thanks..
Solution 1:[1]
yes @Bentaye the name of this class is also sqlitedbaccess.sry stack overflow is not allowing me to comment more.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | shiga123 |

