private VersionCode readSqliteVersionLocked(ISQLiteDatabase db) { try { String versionString = db.simpleQueryForString("select sqlite_version()", null); return VersionCode.parse(versionString); } catch (RuntimeException e) { onError("Failed to read sqlite version", e); throw e; } }
/** * Execute a statement that returns a 1x1 String result. If you know your result set will only have one row and * column, this is much more efficient than calling {@link #rawQuery(String, Object[])} and parsing the cursor. * <br> * Note: This will throw an exception if the given SQL query returns a result that is not a single column * * @param sql a sql statement * @param sqlArgs arguments to bind to the sql statement * @return the String result of the query */ public String simpleQueryForString(String sql, Object[] sqlArgs) { acquireNonExclusiveLock(); try { return getDatabase().simpleQueryForString(sql, sqlArgs); } finally { releaseNonExclusiveLock(); } }
private VersionCode readSqliteVersionLocked(ISQLiteDatabase db) { try { String versionString = db.simpleQueryForString("select sqlite_version()", null); return VersionCode.parse(versionString); } catch (RuntimeException e) { onError("Failed to read sqlite version", e); throw e; } }
/** * Execute a statement that returns a 1x1 String result. If you know your result set will only have one row and * column, this is much more efficient than calling {@link #rawQuery(String, Object[])} and parsing the cursor. * <br> * Note: This will throw an exception if the given SQL query returns a result that is not a single column * * @param sql a sql statement * @param sqlArgs arguments to bind to the sql statement * @return the String result of the query */ public String simpleQueryForString(String sql, Object[] sqlArgs) { acquireNonExclusiveLock(); try { return getDatabase().simpleQueryForString(sql, sqlArgs); } finally { releaseNonExclusiveLock(); } }