當前位置: 首頁>>代碼示例>>Java>>正文


Java DatabaseUtils.appendEscapedSQLString方法代碼示例

本文整理匯總了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";
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:25,代碼來源:dem.java

示例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);
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:23,代碼來源:csl.java

示例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);
}
 
開發者ID:Macadamian,項目名稱:smart-pantry,代碼行數:28,代碼來源:InventoryItemsRepository.java

示例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();
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:9,代碼來源:DbQueryUtils.java

示例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);
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:36,代碼來源:jqw.java

示例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();
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:10,代碼來源:jrf.java

示例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);
}
 
開發者ID:Macadamian,項目名稱:smart-pantry,代碼行數:12,代碼來源:CategoryRepository.java

示例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);
}
 
開發者ID:Macadamian,項目名稱:smart-pantry,代碼行數:13,代碼來源:InventoryRepository.java

示例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();
}
 
開發者ID:googlesamples,項目名稱:android-testdpc,代碼行數:11,代碼來源:PreferenceIndexSqliteOpenHelper.java

示例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;
    }
  }
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:77,代碼來源:dlb.java

示例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 (&lt;append chunk 1>&lt;append chunk2>) AND (&lt;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);
}
 
開發者ID:doppllib,項目名稱:core-doppl,代碼行數:20,代碼來源:SQLiteQueryBuilder.java


注:本文中的android.database.DatabaseUtils.appendEscapedSQLString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。