bug:3330569 print better message to help debug the problem
methods such as SQLiteStatement.simpleQueryForString() expect one and only row to be returned when the query is executed. if the application provides a query that doesn't return any data, then the error message printed is pretty confusing. make it less confusing and print the query itself to help debug the error. Change-Id: Ife2066f3a3eab0b98845a49e8f72b518458a7757
This commit is contained in:
@@ -131,6 +131,10 @@ public class SQLiteStatement extends SQLiteProgram
|
|||||||
long retValue = native_1x1_long();
|
long retValue = native_1x1_long();
|
||||||
mDatabase.logTimeStat(mSql, timeStart);
|
mDatabase.logTimeStat(mSql, timeStart);
|
||||||
return retValue;
|
return retValue;
|
||||||
|
} catch (SQLiteDoneException e) {
|
||||||
|
throw new SQLiteDoneException(
|
||||||
|
"expected 1 row from this query but query returned no data. check the query: " +
|
||||||
|
mSql);
|
||||||
} finally {
|
} finally {
|
||||||
releaseAndUnlock();
|
releaseAndUnlock();
|
||||||
}
|
}
|
||||||
@@ -150,6 +154,10 @@ public class SQLiteStatement extends SQLiteProgram
|
|||||||
String retValue = native_1x1_string();
|
String retValue = native_1x1_string();
|
||||||
mDatabase.logTimeStat(mSql, timeStart);
|
mDatabase.logTimeStat(mSql, timeStart);
|
||||||
return retValue;
|
return retValue;
|
||||||
|
} catch (SQLiteDoneException e) {
|
||||||
|
throw new SQLiteDoneException(
|
||||||
|
"expected 1 row from this query but query returned no data. check the query: " +
|
||||||
|
mSql);
|
||||||
} finally {
|
} finally {
|
||||||
releaseAndUnlock();
|
releaseAndUnlock();
|
||||||
}
|
}
|
||||||
@@ -172,6 +180,10 @@ public class SQLiteStatement extends SQLiteProgram
|
|||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
Log.e(TAG, "simpleQueryForBlobFileDescriptor() failed", ex);
|
Log.e(TAG, "simpleQueryForBlobFileDescriptor() failed", ex);
|
||||||
return null;
|
return null;
|
||||||
|
} catch (SQLiteDoneException e) {
|
||||||
|
throw new SQLiteDoneException(
|
||||||
|
"expected 1 row from this query but query returned no data. check the query: " +
|
||||||
|
mSql);
|
||||||
} finally {
|
} finally {
|
||||||
releaseAndUnlock();
|
releaseAndUnlock();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user