use of io.requery.android.database.sqlite.SQLiteStatement in project requery by requery.
the class SqlitexStatement method execute.
@Override
public boolean execute(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 true;
} else {
statement.execute();
}
} catch (SQLiteException e) {
SqlitexConnection.throwSQLException(e);
} finally {
if (statement != null) {
statement.close();
}
}
return false;
}
use of io.requery.android.database.sqlite.SQLiteStatement in project requery by requery.
the class SqlitexStatement 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);
updateCount = 1;
} else {
updateCount = statement.executeUpdateDelete();
}
} catch (SQLiteException e) {
SqlitexConnection.throwSQLException(e);
} finally {
if (statement != null) {
statement.close();
}
}
return updateCount;
}
Aggregations