@Override public Long call(final SQLiteStatement statement) throws Exception { if (!statement.step()) { throw new SQLiteException(SQLiteConstants.SQLITE_DONE, "No rows returned from query"); } return statement.columnLong(0); } });
public long columnLong(String columnName) throws SQLiteException { return this.stmt.columnLong(sqliteQuery.getColumnIndex(columnName)); }
public long columnLong(String columnName) throws SQLiteException { return this.stmt.columnLong(sqliteQuery.getColumnIndex(columnName)); }
@Override public Long call() throws SQLiteException { SQLiteStatement stmt = stmt(connectionPtr, statementPtr); if (!stmt.step()) { throw new SQLiteException(SQLiteConstants.SQLITE_DONE, "No rows returned from query"); } return stmt.columnLong(0); } });
public long extractSingleLong() throws SQLiteException { this.stmt.step(); long result = this.stmt.columnLong(0); this.dispose(); return result; }
public long extractSingleLong() throws SQLiteException { this.stmt.step(); long result = this.stmt.columnLong(0); this.dispose(); return result; }
@Override public Long call(final SQLiteStatement statement) throws Exception { if (!statement.step()) { throw new SQLiteException(SQLiteConstants.SQLITE_DONE, "No rows returned from query"); } return statement.columnLong(0); } });
@Override public Long call() throws SQLiteException { SQLiteStatement stmt = stmt(connectionPtr, statementPtr); if (!stmt.step()) { throw new SQLiteException(SQLiteConstants.SQLITE_DONE, "No rows returned from query"); } return stmt.columnLong(0); } });
@Override public Long call(final SQLiteStatement statement) throws Exception { if (!statement.step()) { throw new SQLiteException(SQLiteConstants.SQLITE_DONE, "No rows returned from query"); } return statement.columnLong(0); } });
/** * Utility method to run the query on the db and return the value in the * first column of the first row. */ 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); } }
SQLiteConnection db = new SQLiteConnection(new File("/tmp/database")); db.open(true); ... SQLiteStatement st = db.prepare("SELECT order_id FROM orders WHERE quantity >= ?"); try { st.bind(1, minimumQuantity); while (st.step()) { orders.add(st.columnLong(0)); } } finally { st.dispose(); } ... db.dispose();
static Tuple getDataRow(SQLiteStatement stmt) throws SQLiteException { logger.entering("com.cloudant.sync.internal.sqlite.sqlite4java.SQLiteWrapperUtils","getDataRow",stmt); Tuple result = new Tuple(getColumnTypes(stmt)); for (int i = 0; i < stmt.columnCount(); i++) { Integer type = stmt.columnType(i); // Log.v(LOG_TAG, "i: " + i + ", type: " + mapColumnType(type) + ", expected type: " + result.getType(i)); switch (type) { case SQLiteConstants.SQLITE_NULL: result.put(i); break; case SQLiteConstants.SQLITE_TEXT: result.put(i, stmt.columnString(i)); break; case SQLiteConstants.SQLITE_INTEGER: result.put(i, stmt.columnLong(i)); break; case SQLiteConstants.SQLITE_FLOAT: result.put(i, Double.valueOf(stmt.columnDouble(i)).floatValue()); break; case SQLiteConstants.SQLITE_BLOB: result.put(i, stmt.columnBlob(i)); break; default: throw new IllegalArgumentException("Unsupported data type: " + type); } } return result; }
return columnDouble(column); case SQLITE_INTEGER: long value = columnLong(column); if (value == (int)value) { return (int)value;
stmt.columnLong(SpectrumHeaderColIdx.id), stmt.columnInt(SpectrumHeaderColIdx.initialId), stmt.columnInt(SpectrumHeaderColIdx.cycleCol),
stmt.columnLong(SpectrumHeaderColIdx.id), stmt.columnInt(SpectrumHeaderColIdx.initialId), stmt.columnInt(SpectrumHeaderColIdx.cycleCol),