/** * Cancels the currently running statement. This method has effect only during execution of the step() method, * and so it is run from a different thread. * <p/> * This method works by setting a cancel flag, which is checked by the progress callback. Hence, if the progress * callback is disabled, this method will not have effect. Likewise, if <code>stepsPerCallback</code> parameter * is set to large values, the reaction to this call may be far from immediate. * <p/> * If execution is cancelled, the step() method will throw {@link SQLiteInterruptedException}, and transaction * will be rolled back. * <p/> * This method is <strong>thread-safe</strong>. * <p/> * * @see SQLiteConnection#setStepsPerCallback * @see <a href="http://www.sqlite.org/c3ref/progress_handler.html">sqlite3_progress_callback</a> */ public void cancel() { ProgressHandler handler; synchronized (this) { myCancelled = true; handler = myProgressHandler; } if (handler != null) { handler.cancel(); } }
public static int uninstall_progress_handler(SWIGTYPE_p_sqlite3 db, ProgressHandler handler) { SWIGTYPE_p_direct_buffer pointer = handler.dispose(); if (pointer == null) return 0; return _SQLiteManualJNI.uninstall_progress_handler(SWIGTYPE_p_sqlite3.getCPtr(db), SWIGTYPE_p_direct_buffer.getCPtr(pointer)); }
private ProgressHandler prepareStep() throws SQLiteException { clearBindStreams(true); clearColumnStreams(); ProgressHandler ph = myController.getProgressHandler(); ph.reset(); synchronized (this) { if (myCancelled) throw new SQLiteInterruptedException(); myProgressHandler = ph; } return ph; }
public ProgressHandler install_progress_handler(SWIGTYPE_p_sqlite3 db, int stepsPerCallback) { myLastReturnCode = 0; myLong[0] = 0; myObject[0] = null; myLastReturnCode = _SQLiteManualJNI.install_progress_handler(SWIGTYPE_p_sqlite3.getCPtr(db), stepsPerCallback, myLong, myObject); ByteBuffer r = myObject[0] instanceof ByteBuffer ? (ByteBuffer) myObject[0] : null; myObject[0] = null; long ptr = myLong[0]; myLong[0] = 0; if (ptr == 0 || r == null) return null; return new ProgressHandler(new SWIGTYPE_p_direct_buffer(ptr, true), r, stepsPerCallback); }