@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); } });
private static <T> T getFuture(final String comment, final Future<T> future) { try { return Uninterruptibles.getUninterruptibly(future); // No need to catch cancellationexception - we never cancel these futures } catch (ExecutionException e) { Throwable t = e.getCause(); if (t instanceof SQLiteException) { final RuntimeException sqlException = getSqliteException("Cannot " + comment, ((SQLiteException) t).getBaseErrorCode()); sqlException.initCause(e); throw sqlException; } else { throw new RuntimeException(e); } } }
public void setPatternMapping(String phonr_nr, long[] pattern){ //Database call here. Example: try{ database.open(); database.setPattern(phone_nr, pattern); database.close(); }catch(SQLiteException e){ e.printStackTrace(); } }
protected void rethrow(SQLiteException e) { throw new RuntimeException(e.getMessage()); }
try { } catch( SQLiteException e) { Log.e("My App",e.toString(), e); }
/** * Converts SQLiteExceptions into the corresponding * EngineException. */ protected static EngineException convertException(SQLiteException e) { if (e instanceof SQLiteInterruptedException) { return new QueryInterruptedException(e.getMessage()); } else { // Normal db errors: syntax error, database not set errors, etc. // This kind of errors should not retry in replicas. if (e.getErrorCode() == SQLiteConstants.SQLITE_ERROR) { String message = e.getMessage(); if (message != null && message.contains("syntax error]")) { return new SyntaxErrorException(e.getMessage()); } else { return new ShouldNotRetryInReplicaException(e.getMessage()); } } if (e.getErrorCode() == SQLite4JavaClient.ERROR_CODE_MAXIMUM_RESULTS_REACHED) { return new TooManyResultsException(e.getMessage()); } else { // Unexpected exception. Should rety in replica. return new ShouldRetryInReplicaException(e.getMessage(), e); } } } }
public long[] getPattern(String phone_nr){ //Database call here. Example: long[] pattern = null; try{ database.open(); pattern = database.setPattern(phone_nr, pattern); database.close(); }catch(SQLiteException e){ e.printStackTrace(); } return pattern; }
protected void rethrow(SQLiteException e) { throw new RuntimeException(e.getMessage()); }
}catch(SQLiteException e){ Log.d ("OMG", "button1::onClick() caught exception: " + e.toString() ) ; // do nothing or some clean up ... but app will likely keep chugging along }
@Override public String call(final SQLiteStatement statement) throws Exception { if (!statement.step()) { throw new SQLiteException(SQLiteConstants.SQLITE_DONE, "No rows returned from query"); } return statement.columnString(0); } });
private void populateDatabase() { try { long rowId = 0; rowId = dbControl.addWord("testSyn",null,null,1); } catch (SQLiteException e){ e.printStackTrace(); }
public <T> T execute(final String comment, final Callable<T> work) { try { return Uninterruptibles.getUninterruptibly(dbExecutor.submit(work)); // No need to catch cancellationexception - we never cancel these futures } catch (ExecutionException e) { Throwable t = e.getCause(); if (t instanceof SQLiteException) { RuntimeException sqlException = getSqliteException("Cannot " + comment, ((SQLiteException) t).getBaseErrorCode()); sqlException.initCause(e); throw sqlException; } else { throw new RuntimeException(e); } } }
/** * Creates an instance of SQLiteException. * * @param errorCode codes are defined in {@link SQLiteConstants} * @param errorMessage optional error message * @param cause error cause */ public SQLiteException(int errorCode, String errorMessage, Throwable cause) { super("[" + errorCode + "] " + (errorMessage == null ? "sqlite error" : errorMessage), cause); myErrorCode = errorCode; if (Internal.isFineLogging()) { Internal.logFine(getClass(), getMessage()); } }
public void freeBuffer(DirectBuffer buffer) { try { SQLiteConnection.this.freeBuffer(buffer); } catch (SQLiteException e) { Internal.logWarn(SQLiteConnection.this, e.toString()); } }
private SWIGTYPE_p_intarray handle() throws SQLiteException { SWIGTYPE_p_intarray handle = myHandle; if (handle == null) { throw new SQLiteException(WRAPPER_STATEMENT_DISPOSED, null); } return handle; }
try { Log.i(TAG, "donedddddd"); database = SQLiteDatabase.openOrCreateDatabase(DATABASE_FILE_PATH + File.separator + DATABASE_NAME, null); String CREATE_CONTACTS_TABLE = "CREATE TABLE " + TABLE_CONTACTS + "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_NAME + " TEXT," + KEY_PH_NO + " TEXT" + ")"; database.execSQL(CREATE_CONTACTS_TABLE); } catch (SQLiteException ex) { ex.printStackTrace(); } finally { database.close(); }
public <T> T execute(final String comment, final Callable<T> work) { try { return Uninterruptibles.getUninterruptibly(dbExecutor.submit(work)); // No need to catch cancellationexception - we never cancel these futures } catch (ExecutionException e) { Throwable t = e.getCause(); if (t instanceof SQLiteException) { RuntimeException sqlException = getSqliteException("Cannot " + comment, ((SQLiteException) t).getBaseErrorCode()); sqlException.initCause(e); throw sqlException; } else { throw new RuntimeException(e); } } }
return e.getMessage(); } finally { if (st != null) st.dispose();
public static Cursor GetFavouritesList(SQLiteOpenHelper helper){ try { return(helper.getReadableDatabase().rawQuery("SELECT SocietyName FROM Favourites",null)); } catch(SQLiteException e) { Log.e("Favourites", e.toString()); } return null; }
private SWIGTYPE_p_sqlite3_blob handle() throws SQLiteException { SWIGTYPE_p_sqlite3_blob handle = myHandle; if (handle == null) { throw new SQLiteException(SQLiteConstants.WRAPPER_BLOB_DISPOSED, null); } return handle; }