@Override public Void call() throws Exception { statement.dispose(); return null; } });
public void closeStatement() { statement.dispose(); // if (! statement.isDisposed() ) {//!isStatementClosed) { // if (statement != null) { // isStatementClosed = true; // } // } }
@Override public Void call() throws Exception { statement.dispose(); return null; } });
public void closeStatement() { statement.dispose(); // if (! statement.isDisposed() ) {//!isStatementClosed) { // if (statement != null) { // isStatementClosed = true; // } // } }
@Override public Void call() throws Exception { statement.dispose(); return null; } });
public void closeStatement() { statement.dispose(); }
public void closeStatement() { statement.dispose(); }
@Override public Object call() throws Exception { SQLiteStatement stmt = getStatement(connectionPtr, statementPtr); statementsMap.remove(statementPtr); stmt.dispose(); return null; } });
static void disposeQuietly(SQLiteStatement stmt) { if (stmt != null && !stmt.isDisposed()) { try { stmt.dispose(); } catch (Throwable e) {} } }
@Override public Object call() throws Exception { SQLiteStatement stmt = getStatement(connectionPtr, statementPtr); statementsMap.remove(statementPtr); stmt.dispose(); return null; } });
public void dispose() { if (this.isStatementDisposed() == false) { this.stmt.dispose(); this.stmt = null; } }
public void dispose() { if (this.isStatementDisposed() == false && this.stmt != null) { this.stmt.dispose(); this.stmt = null; } }
public void dispose() { if (this.isStatementDisposed() == false) { this.stmt.dispose(); this.stmt = null; } }
public void dispose() { if (this.isStatementDisposed() == false && this.stmt != null) { this.stmt.dispose(); this.stmt = null; } }
import com.almworks.sqlite4java.SQLiteConnection; import com.almworks.sqlite4java.SQLiteStatement; import org.junit.Test; import java.io.File; public class SqliteTest { @Test public void aTest() throws Exception { SQLiteConnection db = new SQLiteConnection(new File("/tmp/database")); db.open(true); SQLiteStatement st = db.prepare("SELECT name FROM dummy"); try { while(st.step()) { System.err.printf("name = %s\n", st.columnString(1)); } } finally { st.dispose(); } } }
/** * Gets a DIA data RunSlice iterator * * @param minParentMz * @param maxParentMz * @return the RunSlice iterator * @throws SQLiteException * @throws StreamCorruptedException */ public Iterator<RunSlice> getLcMsnRunSliceIterator(double minParentMz, double maxParentMz) throws SQLiteException, StreamCorruptedException { // First pass to load the index final SQLiteStatement fakeStmt = this.connection.prepare("SELECT data FROM bounding_box", false); while (fakeStmt.step()) { } fakeStmt.dispose(); return new LcMsnRunSliceIterator(this, connection, minParentMz, maxParentMz); }
/** * Gets a DIA data RunSlice iterator * * @param minParentMz * @param maxParentMz * @return the RunSlice iterator * @throws SQLiteException * @throws StreamCorruptedException */ public Iterator<RunSlice> getLcMsnRunSliceIterator(double minParentMz, double maxParentMz) throws SQLiteException, StreamCorruptedException { // First pass to load the index final SQLiteStatement fakeStmt = this.connection.prepare("SELECT data FROM bounding_box", false); while (fakeStmt.step()) { } fakeStmt.dispose(); return new LcMsnRunSliceIterator(this, connection, minParentMz, maxParentMz); }
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();
/** * Gets a RunSlice iterator. * * @return the RunSlice iterator */ public Observable<RunSlice> getLcMsRunSliceStream() { return Observable.create(subscriber -> { SQLiteJob<Void> sqliteJob = SQLiteObservableJob.buildSQLiteJob( subscriber, connection -> { // First pass to load the index final SQLiteStatement fakeStmt = connection.prepare("SELECT * FROM bounding_box", false); while (fakeStmt.step()) {} fakeStmt.dispose(); SQLiteObservableJob.observeIterator( subscriber, new LcMsRunSliceIterator(this, connection) ); return null; }); queue.execute(sqliteJob); }); }
/** * Gets the mz range. * * @param msLevel * the ms level * @return runSlice min mz and runSlice max mz * @throws SQLiteException * the sQ lite exception */ public static int[] getMzRange(int msLevel, SQLiteConnection connection) throws SQLiteException { final SQLiteStatement stmt = connection.prepare("SELECT min(begin_mz), max(end_mz) FROM run_slice WHERE ms_level=?"); stmt.bind(1, msLevel); stmt.step(); final int minMz = stmt.columnInt(0); final int maxMz = stmt.columnInt(1); stmt.dispose(); final int[] mzRange = { minMz, maxMz }; return mzRange; }