public static Long longForQuery(SQLiteConnection conn, String query, Object[] bindArgs)
            throws SQLiteException {
        SQLiteStatement stmt = null;
        try {
            stmt = conn.prepare(query);
            if (bindArgs != null && bindArgs.length > 0) {
                stmt = SQLiteWrapperUtils.bindArguments(stmt, bindArgs);
            }
            if (stmt.step()) {
                return stmt.columnLong(0);
            } else {
                throw new IllegalStateException("query failed to return any result: " + query);
            }
        } finally {
            SQLiteWrapperUtils.disposeQuietly(stmt);
        }
    }
public static Long longForQuery ( SQLiteConnection conn , String query , Object [ ] bindArgs ) throws SQLiteException { SQLiteStatement stmt = null ; try { stmt = conn . prepare ( query ) ; if ( bindArgs != null && bindArgs . length > 0 ) { stmt = SQLiteWrapperUtils . bindArguments ( stmt , bindArgs ) ; } if ( stmt . step ( ) ) { return stmt . columnLong ( 0 ) ; } else { throw new IllegalStateException ( "query failed to return any result: " + query ) ; } } finally { SQLiteWrapperUtils . disposeQuietly ( stmt ) ; } }
Utility method to run the query on the db and return the value in the
first column of the first row.