本文整理汇总了Java中android.database.sqlite.SQLiteDoneException类的典型用法代码示例。如果您正苦于以下问题:Java SQLiteDoneException类的具体用法?Java SQLiteDoneException怎么用?Java SQLiteDoneException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SQLiteDoneException类属于android.database.sqlite包,在下文中一共展示了SQLiteDoneException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getQName
import android.database.sqlite.SQLiteDoneException; //导入依赖的package包/类
public String getQName(int uid, String ip) {
lock.readLock().lock();
try {
SQLiteDatabase db = this.getReadableDatabase();
// There is a segmented index on resource
// There is an index on access.daddr
String query = "SELECT d.qname";
query += " FROM dns AS d";
query += " LEFT JOIN access AS a";
query += " ON a.daddr = d.qname AND a.uid = " + uid;
query += " WHERE d.resource = '" + ip.replace("'", "''") + "'";
query += " ORDER BY CASE a.daddr WHEN NULL THEN 1 ELSE 0 END, d.qname";
query += " LIMIT 1";
return db.compileStatement(query).simpleQueryForString();
} catch (SQLiteDoneException ignored) {
// Not found
return null;
} finally {
lock.readLock().unlock();
}
}
示例2: getQName
import android.database.sqlite.SQLiteDoneException; //导入依赖的package包/类
public String getQName(String ip) {
mLock.readLock().lock();
try {
SQLiteDatabase db = this.getReadableDatabase();
// There is a segmented index on resource
String query = "SELECT qname";
query += " FROM dns";
query += " WHERE resource = '" + ip.replace("'", "''") + "'";
query += " ORDER BY time DESC";
query += " LIMIT 1";
return db.compileStatement(query).simpleQueryForString();
} catch (SQLiteDoneException ignored) {
// Not found
return null;
} finally {
mLock.readLock().unlock();
}
}
示例3: a
import android.database.sqlite.SQLiteDoneException; //导入依赖的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;
}
示例4: b
import android.database.sqlite.SQLiteDoneException; //导入依赖的package包/类
public final long b(int paramInt, String paramString, long paramLong)
{
SQLiteDatabase localSQLiteDatabase = hsb.b(this.a, paramInt);
try
{
String str = this.b;
long l = DatabaseUtils.longForQuery(localSQLiteDatabase, 13 + String.valueOf(paramString).length() + String.valueOf(str).length() + "SELECT " + paramString + " FROM " + str, null);
return l;
}
catch (SQLiteException localSQLiteException)
{
return -1L;
}
catch (SQLiteDoneException localSQLiteDoneException) {}
return -1L;
}
示例5: e
import android.database.sqlite.SQLiteDoneException; //导入依赖的package包/类
public static boolean e(Context paramContext, int paramInt)
{
SQLiteDatabase localSQLiteDatabase = bqj.a(paramContext, paramInt).getReadableDatabase();
try
{
long l = DatabaseUtils.longForQuery(localSQLiteDatabase, "SELECT wipeout_stats FROM account_status", null);
boolean bool1 = l < 1L;
boolean bool2 = false;
if (!bool1) {
bool2 = true;
}
return bool2;
}
catch (SQLiteDoneException localSQLiteDoneException) {}
return false;
}
示例6: r
import android.database.sqlite.SQLiteDoneException; //导入依赖的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;
}
}
示例7: getProjectId
import android.database.sqlite.SQLiteDoneException; //导入依赖的package包/类
public int getProjectId(String languageCode, String slug, String version) throws IllegalArgumentException {
// Logger.w(this.toString(), "Trying to get project Id for " + languageCode + " " + slug + " " + version);
String languageId = String.valueOf(getLanguageId(languageCode));
String bookId = String.valueOf(getBookId(slug));
SQLiteDatabase db = getReadableDatabase();
final String projectIdQuery = String.format("SELECT %s FROM %s WHERE %s=? AND %s=? AND %s=?",
ProjectContract.ProjectEntry._ID, ProjectContract.ProjectEntry.TABLE_PROJECT, ProjectContract.ProjectEntry.PROJECT_TARGET_LANGUAGE_FK, ProjectContract.ProjectEntry.PROJECT_BOOK_FK, ProjectContract.ProjectEntry.PROJECT_VERSION);
int id = -1;
try {
id = (int) DatabaseUtils.longForQuery(db, projectIdQuery, new String[]{languageId, bookId, version});
} catch (SQLiteDoneException e) {
//db.close();
throw new IllegalArgumentException("Project not found in database");
}
//db.close();
return id;
}
示例8: getChapterId
import android.database.sqlite.SQLiteDoneException; //导入依赖的package包/类
public int getChapterId(String languageCode, String slug, String version, int chapter){
// Logger.w(this.toString(), "trying to get chapter id for chapter " + chapter);
String projectId = String.valueOf(getProjectId(languageCode, slug, version));
SQLiteDatabase db = getReadableDatabase();
final String chapterIdQuery = String.format("SELECT %s FROM %s WHERE %s=? AND %s=?",
ProjectContract.ChapterEntry._ID, ProjectContract.ChapterEntry.TABLE_CHAPTER, ProjectContract.ChapterEntry.CHAPTER_PROJECT_FK, ProjectContract.ChapterEntry.CHAPTER_NUMBER);
int id = -1;
try {
id = (int) DatabaseUtils.longForQuery(db, chapterIdQuery, new String[]{projectId, String.valueOf(chapter)});
} catch (SQLiteDoneException e){
//db.close();
throw new IllegalArgumentException("Chapter not found in database");
}
//db.close();
return id;
}
示例9: getUnitId
import android.database.sqlite.SQLiteDoneException; //导入依赖的package包/类
public int getUnitId(String languageCode, String slug, String version, int chapter, int startVerse) throws IllegalArgumentException{
// Logger.w(this.toString(), "Trying to get unit Id for start verse " + startVerse);
String projectId = String.valueOf(getProjectId(languageCode, slug, version));
String chapterId = String.valueOf(getChapterId(languageCode, slug, version, chapter));
SQLiteDatabase db = getReadableDatabase();
final String unitIdQuery = String.format("SELECT %s FROM %s WHERE %s=? AND %s=? AND %s=?",
ProjectContract.UnitEntry._ID, ProjectContract.UnitEntry.TABLE_UNIT, ProjectContract.UnitEntry.UNIT_PROJECT_FK, ProjectContract.UnitEntry.UNIT_CHAPTER_FK, ProjectContract.UnitEntry.UNIT_START_VERSE);
int id = -1;
try {
id = (int) DatabaseUtils.longForQuery(db, unitIdQuery, new String[]{projectId, chapterId, String.valueOf(startVerse)});
} catch (SQLiteDoneException e){
//db.close();
throw new IllegalArgumentException("Unit not found in database");
}
//db.close();
return id;
}
示例10: getTakeId
import android.database.sqlite.SQLiteDoneException; //导入依赖的package包/类
public int getTakeId(FileNameExtractor fne) throws IllegalArgumentException{
Logger.w(this.toString(), "Attempting to get take id for " + fne.getLang() + " " + fne.getBook() + " " + fne.getSource() + " verse start " + fne.getStartVerse() + " take " + fne.getTake());
String unitId = String.valueOf(getUnitId(fne.getLang(), fne.getBook(), fne.getSource(), fne.getChapter(), fne.getStartVerse()));
SQLiteDatabase db = getReadableDatabase();
final String takeIdQuery = String.format("SELECT %s FROM %s WHERE %s=? AND %s=?",
ProjectContract.TakeEntry._ID, ProjectContract.TakeEntry.TABLE_TAKE, ProjectContract.TakeEntry.TAKE_UNIT_FK, ProjectContract.TakeEntry.TAKE_NUMBER);
int id = -1;
try {
id = (int) DatabaseUtils.longForQuery(db, takeIdQuery, new String[]{unitId, String.valueOf(fne.getTake())});
} catch (SQLiteDoneException e){
//db.close();
throw new IllegalArgumentException("Take not found in database.");
}
//db.close();
return id;
}
示例11: hasIdentity
import android.database.sqlite.SQLiteDoneException; //导入依赖的package包/类
/**
* Check for the existence of an identity.
* @param identityName The name of the identity.
* @return True if the identity exists, otherwise false.
* @throws PibImpl.Error for a non-semantic (database access) error.
*/
public boolean
hasIdentity(Name identityName) throws PibImpl.Error
{
// Use a statement because it allows binding a blob for the query.
SQLiteStatement statement = database_.compileStatement(SELECT_hasIdentity);
try {
statement.bindBlob(1, identityName.wireEncode().getImmutableArray());
try {
statement.simpleQueryForLong();
return true;
} catch (SQLiteDoneException ex) {
// No match.
return false;
}
} finally {
statement.close();
}
}
示例12: hasKey
import android.database.sqlite.SQLiteDoneException; //导入依赖的package包/类
/**
* Check for the existence of a key with keyName.
* @param keyName The name of the key.
* @return True if the key exists, otherwise false. Return false if the
* identity does not exist.
* @throws PibImpl.Error for a non-semantic (database access) error.
*/
public boolean
hasKey(Name keyName) throws PibImpl.Error
{
// Use a statement because it allows binding a blob for the query.
SQLiteStatement statement = database_.compileStatement(SELECT_hasKey);
try {
statement.bindBlob(1, keyName.wireEncode().getImmutableArray());
try {
statement.simpleQueryForLong();
return true;
} catch (SQLiteDoneException ex) {
// No match.
return false;
}
} finally {
statement.close();
}
}
示例13: hasCertificate
import android.database.sqlite.SQLiteDoneException; //导入依赖的package包/类
/**
* Check for the existence of a certificate with name certificateName.
* @param certificateName The name of the certificate.
* @return True if the certificate exists, otherwise false.
* @throws PibImpl.Error for a non-semantic (database access) error.
*/
public boolean
hasCertificate(Name certificateName) throws PibImpl.Error
{
// Use a statement because it allows binding a blob for the query.
SQLiteStatement statement = database_.compileStatement(SELECT_hasCertificate);
try {
statement.bindBlob(1, certificateName.wireEncode().getImmutableArray());
try {
statement.simpleQueryForLong();
return true;
} catch (SQLiteDoneException ex) {
// No match.
return false;
}
} finally {
statement.close();
}
}
示例14: hasDefaultIdentity
import android.database.sqlite.SQLiteDoneException; //导入依赖的package包/类
private boolean
hasDefaultIdentity() throws PibImpl.Error
{
// Use a statement because it allows binding a blob for the query.
SQLiteStatement statement = database_.compileStatement
(SELECT_hasDefaultIdentity);
try {
try {
statement.simpleQueryForLong();
return true;
} catch (SQLiteDoneException ex) {
// No match.
return false;
}
} finally {
statement.close();
}
}
示例15: hasDefaultKeyOfIdentity
import android.database.sqlite.SQLiteDoneException; //导入依赖的package包/类
private boolean
hasDefaultKeyOfIdentity(Name identityName) throws PibImpl.Error
{
// Use a statement because it allows binding a blob for the query.
SQLiteStatement statement = database_.compileStatement
(SELECT_hasDefaultKeyOfIdentity);
try {
statement.bindBlob(1, identityName.wireEncode().getImmutableArray());
try {
statement.simpleQueryForLong();
return true;
} catch (SQLiteDoneException ex) {
// No match.
return false;
}
} finally {
statement.close();
}
}