use of io.requery.android.sqlite.SingleResultSet 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.sqlite.SingleResultSet in project requery by requery.
the class SqlitexPreparedStatement method executeUpdate.
@Override
public int executeUpdate() throws SQLException {
if (autoGeneratedKeys == RETURN_GENERATED_KEYS) {
try {
long rowId = statement.executeInsert();
insertResult = new SingleResultSet(this, rowId);
updateCount = 1;
} catch (SQLiteException e) {
SqlitexConnection.throwSQLException(e);
}
} else {
try {
updateCount = statement.executeUpdateDelete();
} catch (SQLiteException e) {
SqlitexConnection.throwSQLException(e);
}
}
return updateCount;
}
use of io.requery.android.sqlite.SingleResultSet in project requery by requery.
the class SqlCipherPreparedStatement method executeUpdate.
@Override
public int executeUpdate() throws SQLException {
if (autoGeneratedKeys == RETURN_GENERATED_KEYS) {
try {
long rowId = statement.executeInsert();
insertResult = new SingleResultSet(this, rowId);
updateCount = 1;
} catch (SQLiteException e) {
SqlCipherConnection.throwSQLException(e);
}
} else {
try {
updateCount = statement.executeUpdateDelete();
} catch (SQLiteException e) {
SqlCipherConnection.throwSQLException(e);
}
}
return updateCount;
}
use of io.requery.android.sqlite.SingleResultSet in project requery by requery.
the class SqlCipherStatement 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) {
SqlCipherConnection.throwSQLException(e);
} finally {
if (statement != null) {
statement.close();
}
}
return false;
}
use of io.requery.android.sqlite.SingleResultSet 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