本文整理汇总了Java中android.database.DatabaseUtils.appendEscapedSQLString方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseUtils.appendEscapedSQLString方法的具体用法?Java DatabaseUtils.appendEscapedSQLString怎么用?Java DatabaseUtils.appendEscapedSQLString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.database.DatabaseUtils
的用法示例。
在下文中一共展示了DatabaseUtils.appendEscapedSQLString方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: a
import android.database.DatabaseUtils; //导入方法依赖的package包/类
private static String a(List<jpx> paramList)
{
StringBuilder localStringBuilder = new StringBuilder();
if (paramList != null) {
for (int i = -1 + paramList.size(); i >= 0; i--)
{
String str = ((jpx)paramList.get(i)).e().a;
if (str != null)
{
DatabaseUtils.appendEscapedSQLString(localStringBuilder, str);
localStringBuilder.append(',');
}
}
}
if (localStringBuilder.length() > 0)
{
localStringBuilder.setLength(-1 + localStringBuilder.length());
Locale localLocale = Locale.US;
Object[] arrayOfObject = new Object[1];
arrayOfObject[0] = localStringBuilder.toString();
return String.format(localLocale, "( type == 4 AND tile_id NOT IN (%s) )", arrayOfObject);
}
return "type == 4";
}
示例2: a
import android.database.DatabaseUtils; //导入方法依赖的package包/类
private static String a(nve[] paramArrayOfnve)
{
if ((paramArrayOfnve == null) || (paramArrayOfnve.length == 0)) {
return "0";
}
mfz localmfz = (mfz)mfx.a.get();
localmfz.b = (1 + localmfz.b);
if (localmfz.b == 1) {}
for (StringBuilder localStringBuilder = localmfz.a;; localStringBuilder = new StringBuilder(256))
{
localStringBuilder.append("gaia_id IN (");
int i = paramArrayOfnve.length;
for (int j = 0; j < i; j++)
{
DatabaseUtils.appendEscapedSQLString(localStringBuilder, paramArrayOfnve[j].a);
localStringBuilder.append(',');
}
}
localStringBuilder.setLength(-1 + localStringBuilder.length());
localStringBuilder.append(')');
return mfx.b(localStringBuilder);
}
示例3: getItemByBarcode
import android.database.DatabaseUtils; //导入方法依赖的package包/类
/**
* Checks whether an item already exists linked to this barcode, and returns it
*
* @param barcode the barcode string for the item to be found
*/
public Cursor getItemByBarcode(String barcode){
if(barcode == null) {
return null;
}
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
String inventoryItemName = MyContract.InventoryItemEntry.TABLE_NAME;
String inventoryName = MyContract.InventoryEntry.TABLE_NAME;
queryBuilder.setTables(String.format("%s LEFT OUTER JOIN %s ON (%s = %s)",
inventoryItemName, inventoryName,
InventoryItemTable.tableQualifiedColumn(MyContract.InventoryItemEntry.COLUMN_INVENTORY_UUID),
InventoryTable.tableQualifiedColumn(MyContract.InventoryEntry.COLUMN_INVENTORY_UUID)));
String[] columns = getItemDisplayColumns();
String selection = InventoryItemTable.tableQualifiedColumn(MyContract.InventoryItemEntry.COLUMN_BARCODE) + " LIKE ?";
DatabaseUtils.appendEscapedSQLString(new StringBuilder(), barcode);
String[] selectionArgs = {barcode};
String orderBy = InventoryItemTable.tableQualifiedColumn(MyContract.InventoryItemEntry.COLUMN_UPDATED_AT +" DESC");
String limit = "1";
return queryBuilder.query(getReadableDatabase(), columns, selection, selectionArgs, null, null, orderBy, limit);
}
示例4: getEqualityClause
import android.database.DatabaseUtils; //导入方法依赖的package包/类
/** Returns a WHERE clause assert equality of a field to a value. */
public static String getEqualityClause(String field, String value) {
StringBuilder clause = new StringBuilder();
clause.append(field);
clause.append(" = ");
DatabaseUtils.appendEscapedSQLString(clause, value);
return clause.toString();
}
示例5: a
import android.database.DatabaseUtils; //导入方法依赖的package包/类
public static String a(String paramString, List<ipf> paramList)
{
StringBuilder localStringBuilder = new StringBuilder();
if (paramList != null) {
for (int i = -1 + paramList.size(); i >= 0; i--)
{
String str = ((ipf)paramList.get(i)).a;
if (str != null)
{
DatabaseUtils.appendEscapedSQLString(localStringBuilder, str);
localStringBuilder.append(',');
}
}
}
if (localStringBuilder.length() > 0)
{
localStringBuilder.setLength(-1 + localStringBuilder.length());
if (paramString == null)
{
Locale localLocale2 = Locale.US;
Object[] arrayOfObject2 = new Object[1];
arrayOfObject2[0] = localStringBuilder.toString();
paramString = String.format(localLocale2, "tile_id NOT IN (%s)", arrayOfObject2);
}
}
else
{
return paramString;
}
Locale localLocale1 = Locale.US;
Object[] arrayOfObject1 = new Object[2];
arrayOfObject1[0] = paramString;
arrayOfObject1[1] = localStringBuilder.toString();
return String.format(localLocale1, "( %s AND tile_id NOT IN (%s) )", arrayOfObject1);
}
示例6: a
import android.database.DatabaseUtils; //导入方法依赖的package包/类
private static String a(Context paramContext, int paramInt, String[] paramArrayOfString)
{
StringBuilder localStringBuilder = new StringBuilder();
localStringBuilder.append("owner_id = ");
DatabaseUtils.appendEscapedSQLString(localStringBuilder, ((giz)mbb.a(paramContext, giz.class)).a(paramInt).b("gaia_id"));
localStringBuilder.append(" AND ");
a(localStringBuilder, "photo_id", new ArrayList(Arrays.asList(paramArrayOfString)));
return localStringBuilder.toString();
}
示例7: getCategoryByName
import android.database.DatabaseUtils; //导入方法依赖的package包/类
public Cursor getCategoryByName(String categoryName){
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
queryBuilder.setTables(CategoryEntry.TABLE_NAME);
String[] columns = { CategoryTable.tableQualifiedColumn(CategoryEntry._ID)};
String selection = CategoryTable.tableQualifiedColumn(CategoryEntry.COLUMN_NAME) + " = ?";
DatabaseUtils.appendEscapedSQLString(new StringBuilder(), categoryName);
String[] selectionArgs = {categoryName};
String limit = "1";
return queryBuilder.query(getReadableDatabase(), columns, selection, selectionArgs, null, null, null, limit);
}
示例8: getInventoryUUIDByName
import android.database.DatabaseUtils; //导入方法依赖的package包/类
public Cursor getInventoryUUIDByName(String inventoryName){
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
queryBuilder.setTables(MyContract.InventoryEntry.TABLE_NAME);
String[] columns = {MyContract.InventoryEntry.COLUMN_INVENTORY_UUID};
String selection = InventoryTable.tableQualifiedColumn(MyContract.InventoryEntry.COLUMN_NAME) + "= ?";
DatabaseUtils.appendEscapedSQLString(new StringBuilder(), inventoryName);
String[] selectionArgs = {inventoryName};
String limit = "1";
return queryBuilder.query(getReadableDatabase(), columns, selection, selectionArgs, null, null, null, limit);
}
示例9: buildLookupSQL
import android.database.DatabaseUtils; //导入方法依赖的package包/类
private String buildLookupSQL(List<String> targetFragments) {
StringBuilder stringBuilder = new StringBuilder(LOOKUP_SQL);
for (String fragment : targetFragments) {
DatabaseUtils.appendEscapedSQLString(stringBuilder, fragment);
stringBuilder.append(",");
}
stringBuilder.setLength(stringBuilder.length() - 1); // Strip the last comma
stringBuilder.append(")");
return stringBuilder.toString();
}
示例10: a
import android.database.DatabaseUtils; //导入方法依赖的package包/类
public final void a(Context paramContext, int paramInt, String paramString1, String paramString2, boolean paramBoolean)
{
a(paramInt);
Boolean localBoolean = (Boolean)b.remove(paramString1);
if (localBoolean == null) {}
StringBuilder localStringBuilder;
for (boolean bool = false;; bool = localBoolean.booleanValue())
{
d.add(paramString1);
if (!paramBoolean) {
break label333;
}
a(paramContext, paramInt, paramString1);
if ((!bool) || (c) || (b.size() > 0) || (d.isEmpty())) {
break label308;
}
localStringBuilder = new StringBuilder();
localStringBuilder.append("in_my_circles!= 0").append(" AND person_id").append(" IN (");
Iterator localIterator = d.iterator();
while (localIterator.hasNext())
{
DatabaseUtils.appendEscapedSQLString(localStringBuilder, (String)localIterator.next());
localStringBuilder.append(',');
}
}
d.clear();
localStringBuilder.setLength(-1 + localStringBuilder.length());
localStringBuilder.append(')');
Cursor localCursor = paramContext.getContentResolver().query(EsProvider.a(EsProvider.f(paramContext), paramInt), new String[] { "person_id" }, localStringBuilder.toString(), null, null);
if (localCursor != null) {}
for (;;)
{
int i;
try
{
int k = localCursor.getCount();
i = k;
localCursor.close();
if (i != 0)
{
Resources localResources = paramContext.getResources();
int j = efj.xb;
Object[] arrayOfObject = new Object[1];
arrayOfObject[0] = Integer.valueOf(i);
dlc localdlc = new dlc(this, paramContext, localResources.getQuantityString(j, i, arrayOfObject));
efj.m().post(localdlc);
}
label308:
paramContext.getContentResolver().notifyChange(EsProvider.f(paramContext), null);
return;
}
finally
{
localCursor.close();
}
label333:
if ((bool) && (!c))
{
Intent localIntent = efj.b(paramContext, paramInt, paramString1, null, true);
localIntent.setPackage(paramContext.getPackageName());
localIntent.addFlags(335544320);
PendingIntent localPendingIntent = PendingIntent.getActivity(paramContext, dmr.a(), localIntent, 0);
dk localdk = new dk(paramContext);
localdk.x.icon = 17301543;
localdk.a(16, true);
localdk.b = dk.a(paramContext.getString(aau.cP));
localdk.c = dk.a(paramContext.getString(aau.cO, new Object[] { paramString2 }));
localdk.d = localPendingIntent;
NotificationManager localNotificationManager = (NotificationManager)paramContext.getSystemService("notification");
String str = String.valueOf(paramContext.getPackageName());
localNotificationManager.notify(19 + String.valueOf(str).length() + String.valueOf(paramString1).length() + str + ":notifications:add:" + paramString1, aaw.gf, localdk.a());
continue;
i = 0;
}
}
}
示例11: appendWhereEscapeString
import android.database.DatabaseUtils; //导入方法依赖的package包/类
/**
* Append a chunk to the WHERE clause of the query. All chunks appended are surrounded
* by parenthesis and ANDed with the selection passed to {@link #query}. The final
* WHERE clause looks like:
*
* WHERE (<append chunk 1><append chunk2>) AND (<query() selection parameter>)
*
* @param inWhere the chunk of text to append to the WHERE clause. it will be escaped
* to avoid SQL injection attacks
*/
public void appendWhereEscapeString(String inWhere) {
if (mWhereClause == null) {
mWhereClause = new StringBuilder(inWhere.length() + 16);
}
if (mWhereClause.length() == 0) {
mWhereClause.append('(');
}
DatabaseUtils.appendEscapedSQLString(mWhereClause, inWhere);
}