use of com.lidroid.xutils.db.table.Id in project xUtils by wyouflf.
the class DbUtils method saveBindingIdWithoutTransaction.
private boolean saveBindingIdWithoutTransaction(Object entity) throws DbException {
Class<?> entityType = entity.getClass();
Table table = Table.get(this, entityType);
Id idColumn = table.id;
if (idColumn.isAutoIncrement()) {
execNonQuery(SqlInfoBuilder.buildInsertSqlInfo(this, entity));
long id = getLastAutoIncrementId(table.tableName);
if (id == -1) {
return false;
}
idColumn.setAutoIncrementId(entity, id);
return true;
} else {
execNonQuery(SqlInfoBuilder.buildInsertSqlInfo(this, entity));
return true;
}
}
use of com.lidroid.xutils.db.table.Id in project xUtils by wyouflf.
the class DbUtils method saveOrUpdateWithoutTransaction.
//***************************** private operations with out transaction *****************************
private void saveOrUpdateWithoutTransaction(Object entity) throws DbException {
Table table = Table.get(this, entity.getClass());
Id id = table.id;
if (id.isAutoIncrement()) {
if (id.getColumnValue(entity) != null) {
execNonQuery(SqlInfoBuilder.buildUpdateSqlInfo(this, entity));
} else {
saveBindingIdWithoutTransaction(entity);
}
} else {
execNonQuery(SqlInfoBuilder.buildReplaceSqlInfo(this, entity));
}
}