本文整理汇总了Java中android.database.DatabaseUtils.stringForQuery方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseUtils.stringForQuery方法的具体用法?Java DatabaseUtils.stringForQuery怎么用?Java DatabaseUtils.stringForQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.database.DatabaseUtils
的用法示例。
在下文中一共展示了DatabaseUtils.stringForQuery方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: a
import android.database.DatabaseUtils; //导入方法依赖的package包/类
public final String a(SQLiteDatabase paramSQLiteDatabase, String paramString)
{
if (paramString == null) {
return null;
}
try
{
String str1 = this.z;
String[] arrayOfString = new String[2];
arrayOfString[0] = this.s;
arrayOfString[1] = paramString;
String str2 = DatabaseUtils.stringForQuery(paramSQLiteDatabase, str1, arrayOfString);
return str2;
}
catch (SQLiteDoneException localSQLiteDoneException) {}
return null;
}
示例2: r
import android.database.DatabaseUtils; //导入方法依赖的package包/类
private String r()
{
SQLiteDatabase localSQLiteDatabase = bqj.a(this.l, this.h).getReadableDatabase();
String[] arrayOfString;
if (!TextUtils.isEmpty(this.d))
{
arrayOfString = new String[2];
arrayOfString[0] = this.d;
arrayOfString[1] = this.f;
}
try
{
String str = DatabaseUtils.stringForQuery(localSQLiteDatabase, "SELECT tile_id FROM all_tiles WHERE photo_id = ? AND view_id = ?", arrayOfString);
if (!TextUtils.equals(str, this.e)) {
this.e = str;
}
label71:
return this.e;
}
catch (SQLiteDoneException localSQLiteDoneException)
{
break label71;
}
}
示例3: getType
import android.database.DatabaseUtils; //导入方法依赖的package包/类
/**
* Returns the content-provider-style MIME types of the various
* types accessible through this content provider.
*/
@Override
public String getType(final Uri uri) {
int match = sURIMatcher.match(uri);
switch (match) {
case MY_DOWNLOADS:
case ALL_DOWNLOADS: {
return DOWNLOAD_LIST_TYPE;
}
case MY_DOWNLOADS_ID:
case ALL_DOWNLOADS_ID:
case PUBLIC_DOWNLOAD_ID: {
// return the mimetype of this id from the database
final String id = getDownloadIdFromUri(uri);
final SQLiteDatabase db = mOpenHelper.getReadableDatabase();
final String mimeType = DatabaseUtils.stringForQuery(db,
"SELECT " + Downloads.Impl.COLUMN_MIME_TYPE + " FROM " + DB_TABLE +
" WHERE " + Downloads.Impl._ID + " = ?",
new String[]{id});
if (TextUtils.isEmpty(mimeType)) {
return DOWNLOAD_TYPE;
} else {
return mimeType;
}
}
default: {
if (Constants.LOGV) {
Log.v(Constants.TAG, "calling getType on an unknown URI: " + uri);
}
throw new IllegalArgumentException("Unknown URI: " + uri);
}
}
}
示例4: getType
import android.database.DatabaseUtils; //导入方法依赖的package包/类
/**
* Returns the content-provider-style MIME types of the various
* types accessible through this content provider.
*/
@Override
public String getType(final Uri uri) {
int match = sURIMatcher.match(uri);
switch (match) {
case MY_DOWNLOADS:
case ALL_DOWNLOADS: {
return DOWNLOAD_LIST_TYPE;
}
case MY_DOWNLOADS_ID:
case ALL_DOWNLOADS_ID:
case PUBLIC_DOWNLOAD_ID: {
// return the mimetype of this id from the database
final String id = getDownloadIdFromUri(uri);
final SQLiteDatabase db = mOpenHelper.getReadableDatabase();
final String mimeType = DatabaseUtils.stringForQuery(db,
"SELECT " + Downloads.Impl.COLUMN_MIME_TYPE + " FROM " + DB_TABLE +
" WHERE " + Downloads.Impl._ID + " = ?",
new String[]{id});
if (TextUtils.isEmpty(mimeType)) {
return DOWNLOAD_TYPE;
} else {
return mimeType;
}
}
default: {
if (Constants.LOGV) {
Log.v(Constants.TAG, "calling getType on an unknown URI: " + uri);
}
throw new IllegalArgumentException("Unknown URI: " + uri);
}
}
}
示例5: stringForQuery
import android.database.DatabaseUtils; //导入方法依赖的package包/类
public static String stringForQuery(SQLiteDatabase db, String query, String[] selectionArgs) {
try {
return DatabaseUtils.stringForQuery(db, query, selectionArgs);
} catch (SQLiteDoneException e) {
return "";
}
}
示例6: getLanguageName
import android.database.DatabaseUtils; //导入方法依赖的package包/类
public String getLanguageName(String code) throws IllegalArgumentException{
SQLiteDatabase db = getReadableDatabase();
final String languageNameQuery = String.format("SELECT %s FROM %s WHERE %s=?",
ProjectContract.LanguageEntry.LANGUAGE_NAME, ProjectContract.LanguageEntry.TABLE_LANGUAGE, ProjectContract.LanguageEntry.LANGUAGE_CODE);
String name;
try {
name = DatabaseUtils.stringForQuery(db, languageNameQuery, new String[]{code});
} catch (SQLiteDoneException e){
//db.close();
throw new IllegalArgumentException("Language: " + code + " not ");
}
//db.close();
return name;
}
示例7: getLanguageCode
import android.database.DatabaseUtils; //导入方法依赖的package包/类
public String getLanguageCode(int id) throws IllegalArgumentException{
SQLiteDatabase db = getReadableDatabase();
final String languageNameQuery = String.format("SELECT %s FROM %s WHERE %s=?",
ProjectContract.LanguageEntry.LANGUAGE_CODE, ProjectContract.LanguageEntry.TABLE_LANGUAGE, ProjectContract.LanguageEntry._ID);
String code;
try {
code = DatabaseUtils.stringForQuery(db, languageNameQuery, new String[]{String.valueOf(id)});
} catch (SQLiteDoneException e){
//db.close();
throw new IllegalArgumentException("Language id not found in database.");
}
//db.close();
return code;
}
示例8: getBookName
import android.database.DatabaseUtils; //导入方法依赖的package包/类
public String getBookName(String slug) throws IllegalArgumentException{
SQLiteDatabase db = getReadableDatabase();
final String bookNameQuery = String.format("SELECT %s FROM %s WHERE %s=?",
ProjectContract.BookEntry.BOOK_NAME, ProjectContract.BookEntry.TABLE_BOOK, ProjectContract.BookEntry.BOOK_SLUG);
String name;
try {
name = DatabaseUtils.stringForQuery(db, bookNameQuery, new String[]{slug});
} catch (SQLiteDoneException e){
//db.close();
throw new IllegalArgumentException("Book slug: " + slug + " not found in database.");
}
//db.close();
return name;
}
示例9: getBookSlug
import android.database.DatabaseUtils; //导入方法依赖的package包/类
public String getBookSlug(int id) throws IllegalArgumentException{
SQLiteDatabase db = getReadableDatabase();
final String bookSlugQuery = String.format("SELECT %s FROM %s WHERE %s=?",
ProjectContract.BookEntry.BOOK_SLUG, ProjectContract.BookEntry.TABLE_BOOK, ProjectContract.BookEntry._ID);
String slug;
try {
slug = DatabaseUtils.stringForQuery(db, bookSlugQuery, new String[]{String.valueOf(id)});
} catch (SQLiteDoneException e){
//db.close();
throw new IllegalArgumentException("Book id not found in database.");
}
//db.close();
return slug;
}
示例10: getBookAnthology
import android.database.DatabaseUtils; //导入方法依赖的package包/类
public String getBookAnthology(String slug) throws IllegalArgumentException{
SQLiteDatabase db = getReadableDatabase();
final String bookNameQuery = String.format("SELECT %s FROM %s WHERE %s=?",
ProjectContract.BookEntry.BOOK_ANTHOLOGY, ProjectContract.BookEntry.TABLE_BOOK, ProjectContract.BookEntry.BOOK_SLUG);
String anthology = DatabaseUtils.stringForQuery(db, bookNameQuery, new String[]{slug});
//db.close();
return anthology;
}
示例11: sampleDatabaseUtils
import android.database.DatabaseUtils; //导入方法依赖的package包/类
public void sampleDatabaseUtils(DatabaseUtils databaseUtils, String input) {
databaseUtils.longForQuery(null, input, null);
databaseUtils.stringForQuery(null, input, null);
databaseUtils.blobFileDescriptorForQuery(null, input, null);
databaseUtils.createDbFromSqlStatements(null, null, 0, input);
}
示例12: a
import android.database.DatabaseUtils; //导入方法依赖的package包/类
public static String a(SQLiteDatabase paramSQLiteDatabase, okn paramokn)
{
ojf localojf;
String str5;
if (paramokn.b(okm.a) != null)
{
localojf = ((okm)paramokn.b(okm.a)).b;
str5 = jrf.a(3, new String[] { jrf.a(null, localojf.g.b, localojf.k.c, 3) });
}
try
{
String[] arrayOfString3 = new String[3];
arrayOfString3[0] = str5;
arrayOfString3[1] = localojf.g.b;
arrayOfString3[2] = localojf.d;
String str6 = DatabaseUtils.stringForQuery(paramSQLiteDatabase, "SELECT tile_id FROM all_tiles WHERE view_id = ? AND owner_id = ? AND photo_id = ? AND media_attr & 512 == 0", arrayOfString3);
return str6;
}
catch (SQLiteDoneException localSQLiteDoneException3)
{
oif localoif;
String str3;
break label295;
}
if (paramokn.b(okl.a) != null)
{
localoif = ((okl)paramokn.b(okl.a)).b;
str3 = jrf.a(3, new String[] { jrf.a(null, localoif.e, localoif.b, 3) });
}
try
{
String[] arrayOfString2 = new String[2];
arrayOfString2[0] = str3;
arrayOfString2[1] = localoif.e;
String str4 = DatabaseUtils.stringForQuery(paramSQLiteDatabase, "SELECT tile_id FROM all_tiles WHERE view_id = ? AND owner_id = ? AND photo_id IS NULL AND media_attr & 512 == 0", arrayOfString2);
return str4;
}
catch (SQLiteDoneException localSQLiteDoneException2)
{
oir localoir;
String str1;
break label295;
}
if (paramokn.b(okk.a) != null)
{
localoir = ((okk)paramokn.b(okk.a)).b;
str1 = jrf.a(3, new String[] { jrf.a(null, localoir.e.b, localoir.c, 3) });
}
try
{
String[] arrayOfString1 = new String[2];
arrayOfString1[0] = str1;
arrayOfString1[1] = localoir.e.b;
String str2 = DatabaseUtils.stringForQuery(paramSQLiteDatabase, "SELECT tile_id FROM all_tiles WHERE view_id = ? AND owner_id = ? AND photo_id IS NULL AND media_attr & 512 == 0", arrayOfString1);
return str2;
}
catch (SQLiteDoneException localSQLiteDoneException1) {}
throw new IllegalArgumentException("Tile must be a known type");
label295:
return null;
}
示例13: getCurrentThemeId
import android.database.DatabaseUtils; //导入方法依赖的package包/类
public String getCurrentThemeId(String blogId) {
return DatabaseUtils.stringForQuery(db, "SELECT themeId FROM " + THEMES_TABLE + " WHERE blogId=? AND isCurrent='1'", new String[] { blogId });
}