Search in sources :

Example 6 with SingleResultSet

use of io.requery.android.sqlite.SingleResultSet in project requery by requery.

the class SqlCipherStatement method executeUpdate.

@Override
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
    SQLiteStatement statement = null;
    try {
        statement = connection.getDatabase().compileStatement(sql);
        if (autoGeneratedKeys == RETURN_GENERATED_KEYS) {
            long rowId = statement.executeInsert();
            insertResult = new SingleResultSet(this, rowId);
            return 1;
        } else {
            return updateCount = statement.executeUpdateDelete();
        }
    } catch (SQLiteException e) {
        SqlCipherConnection.throwSQLException(e);
    } finally {
        if (statement != null) {
            statement.close();
        }
    }
    return 0;
}
Also used : SQLiteStatement(net.sqlcipher.database.SQLiteStatement) SingleResultSet(io.requery.android.sqlite.SingleResultSet) SQLiteException(net.sqlcipher.database.SQLiteException)

Aggregations

SingleResultSet (io.requery.android.sqlite.SingleResultSet)6 SQLiteException (android.database.sqlite.SQLiteException)3 SQLiteException (net.sqlcipher.database.SQLiteException)3 SQLiteStatement (io.requery.android.database.sqlite.SQLiteStatement)2 SQLiteStatement (net.sqlcipher.database.SQLiteStatement)2