Merge "Throw clear error if a row doesn't fit into CursorWindow"

This commit is contained in:
Fyodor Kupolov
2017-10-23 18:44:23 +00:00
committed by Android (Google) Code Review

View File

@@ -765,6 +765,14 @@ static jlong nativeExecuteForCursorWindow(JNIEnv* env, jclass clazz,
if (startPos > totalRows) {
ALOGE("startPos %d > actual rows %d", startPos, totalRows);
}
if (totalRows > 0 && addedRows == 0) {
String8 msg;
msg.appendFormat("Row too big to fit into CursorWindow requiredPos=%d, totalRows=%d",
requiredPos, totalRows);
throw_sqlite3_exception(env, SQLITE_TOOBIG, NULL, msg.string());
return 0;
}
jlong result = jlong(startPos) << 32 | jlong(totalRows);
return result;
}