Methods Summary |
---|
public com.android.internal.content.SelectionBuilder | append(java.lang.String selection, java.lang.Object selectionArgs)Append the given selection clause to the internal state. Each clause is
surrounded with parenthesis and combined using {@code AND}.
if (TextUtils.isEmpty(selection)) {
if (selectionArgs != null && selectionArgs.length > 0) {
throw new IllegalArgumentException(
"Valid selection required when including arguments");
}
// Shortcut when clause is empty
return this;
}
if (mSelection.length() > 0) {
mSelection.append(" AND ");
}
mSelection.append("(").append(selection).append(")");
if (selectionArgs != null) {
for (Object arg : selectionArgs) {
// TODO: switch to storing direct Object instances once
// http://b/2464440 is fixed
mSelectionArgs.add(String.valueOf(arg));
}
}
return this;
|
public int | delete(android.database.sqlite.SQLiteDatabase db, java.lang.String table)Execute delete using the current internal state as {@code WHERE} clause.
return db.delete(table, getSelection(), getSelectionArgs());
|
public java.lang.String | getSelection()Return selection string for current internal state.
return mSelection.toString();
|
public java.lang.String[] | getSelectionArgs()Return selection arguments for current internal state.
return mSelectionArgs.toArray(new String[mSelectionArgs.size()]);
|
public android.database.Cursor | query(android.database.sqlite.SQLiteDatabase db, java.lang.String table, java.lang.String[] columns, java.lang.String orderBy)Execute query using the current internal state as {@code WHERE} clause.
Missing arguments as treated as {@code null}.
return query(db, table, columns, null, null, orderBy, null);
|
public android.database.Cursor | query(android.database.sqlite.SQLiteDatabase db, java.lang.String table, java.lang.String[] columns, java.lang.String groupBy, java.lang.String having, java.lang.String orderBy, java.lang.String limit)Execute query using the current internal state as {@code WHERE} clause.
return db.query(table, columns, getSelection(), getSelectionArgs(), groupBy, having,
orderBy, limit);
|
public com.android.internal.content.SelectionBuilder | reset()Reset any internal state, allowing this builder to be recycled.
mSelection.setLength(0);
mSelectionArgs.clear();
return this;
|
public int | update(android.database.sqlite.SQLiteDatabase db, java.lang.String table, android.content.ContentValues values)Execute update using the current internal state as {@code WHERE} clause.
return db.update(table, values, getSelection(), getSelectionArgs());
|