public int update_all(Map<String, Object> data) { ContentValues cv = new ContentValues(); for (Entry<String, Object> e : data.entrySet()) { if (e.getValue() == null) continue; Tools.putObjectToContentValues(cv, e.getKey(), e.getValue()); } int count = _db.update(_tableName, cv, Tools.join(_whereList, " AND "), null); this.release(); return count; }
public int update_all(Bundle data) { Set<String> keys = data.keySet(); ContentValues cv = new ContentValues(); for (String key : keys) { if (data.get(key) == null) continue; Tools.putObjectToContentValues(cv, key, data.get(key)); } int count = _db.update(_tableName, cv, Tools.join(_whereList, " AND "), null); this.release(); return count; }
private String makeSelectSQL() { String sql = ""; if (_selectList.isEmpty()) { sql = "SELECT '" + _tableName + "'.* FROM '" + _tableName + "'"; } else { String selects = ""; selects = Tools.join(_selectList, ","); sql = "SELECT " + selects + " FROM '" + _tableName + "'"; } String wheres = ""; wheres = Tools.join(_whereList, " AND "); if (wheres.isEmpty() == false) { sql = sql + " WHERE " + wheres; } String orders = ""; orders = Tools.join(_orderList, ","); if (_orderList.isEmpty() == false) { sql = sql + " ORDER BY " + orders; } sql = sql + _limitSQL; sql = sql + ";"; return sql; }
public int destroy_all() { int count = _db.delete(_tableName, Tools.join(_whereList, " AND "), null); this.release(); return count; }