本文整理汇总了Java中android.database.sqlite.SQLiteException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java SQLiteException.printStackTrace方法的具体用法?Java SQLiteException.printStackTrace怎么用?Java SQLiteException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.database.sqlite.SQLiteException
的用法示例。
在下文中一共展示了SQLiteException.printStackTrace方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openDatabase
import android.database.sqlite.SQLiteException; //导入方法依赖的package包/类
/**
* @throws SQLiteException
*/
public void openDatabase() throws SQLiteException {
openHelper = new DBOpenHelper(context, MD5Utils.GetMD5Code("kf5_ticket_" + SPUtils.getUserId()) + ".db", null, VERSION);
try {
db = openHelper.getWritableDatabase();
} catch (SQLiteException e) {
e.printStackTrace();
db = openHelper.getReadableDatabase();
}
boolean isTableExit = tableIsExist(openHelper, DB_TABLE);
if (!isTableExit) {
db.execSQL(DB_CREATE);
}
}
示例2: onLoadFinished
import android.database.sqlite.SQLiteException; //导入方法依赖的package包/类
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
if (cursor != null) {
Set<String> mBookedPrograms = new HashSet();
while (cursor.moveToNext()) {
try {
int idx = cursor.getColumnIndexOrThrow(Field.MD5_ID);
if (idx != -1) {
mBookedPrograms.add(cursor.getString(idx));
}
} catch (SQLiteException e) {
e.printStackTrace();
return;
}
}
if ((getAdapter() instanceof ChannelDetailExpandableListAdapter) && getAdapter().getChannelLivehallView() != null) {
getAdapter().getChannelLivehallView().setBookedPrograms(mBookedPrograms);
}
}
}
示例3: onLoadFinished
import android.database.sqlite.SQLiteException; //导入方法依赖的package包/类
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
if (cursor != null) {
Set<String> mBookedPrograms = new HashSet();
while (cursor.moveToNext()) {
try {
int idx = cursor.getColumnIndexOrThrow(Field.MD5_ID);
if (idx != -1) {
mBookedPrograms.add(cursor.getString(idx));
}
} catch (SQLiteException e) {
e.printStackTrace();
return;
}
}
if (this.mAdapter != null) {
this.mAdapter.setBookedPrograms(mBookedPrograms);
}
}
}
示例4: execute
import android.database.sqlite.SQLiteException; //导入方法依赖的package包/类
public static boolean execute(Worker worker) {
SQLiteDatabase db = Orm.getDatabase();
db.beginTransaction();
try {
boolean isOk = worker.doTransition(db);
if (isOk) {
db.setTransactionSuccessful();
}
return isOk;
} catch(SQLiteException e) {
e.printStackTrace();
} finally {
db.endTransaction();
}
return false;
}
示例5: getEntryFromDB
import android.database.sqlite.SQLiteException; //导入方法依赖的package包/类
private boolean getEntryFromDB(ComponentKey cacheKey, CacheEntry entry, boolean lowRes) {
Cursor c = null;
try {
c = mIconDb.query(
new String[]{lowRes ? IconDB.COLUMN_ICON_LOW_RES : IconDB.COLUMN_ICON,
IconDB.COLUMN_LABEL},
IconDB.COLUMN_COMPONENT + " = ? AND " + IconDB.COLUMN_USER + " = ?",
new String[]{cacheKey.componentName.flattenToString(),
Long.toString(mUserManager.getSerialNumberForUser(cacheKey.user))});
if (c.moveToNext()) {
entry.icon = loadIconNoResize(c, 0, lowRes ? mLowResOptions : null);
entry.isLowResIcon = lowRes;
entry.title = c.getString(1);
if (entry.title == null) {
entry.title = "";
entry.contentDescription = "";
} else {
entry.contentDescription = mUserManager.getBadgedLabelForUser(
entry.title, cacheKey.user);
}
return true;
}
} catch (SQLiteException e) {
e.printStackTrace();
} finally {
if (c != null) {
c.close();
}
}
return false;
}
示例6: ensureDatabase
import android.database.sqlite.SQLiteException; //导入方法依赖的package包/类
synchronized void ensureDatabase() {
if (mDb != null && mDb.isOpen()) {
return;
}
// Sometimes retrieving the database fails. We do 2 retries: first without database deletion
// and then with deletion.
for (int tries = 0; tries < 2; tries++) {
try {
if (tries > 0) {
//delete db and recreate
deleteDB();
}
mDb = getWritableDatabase();
break;
} catch (SQLiteException e) {
e.printStackTrace();
}
// Wait before retrying.
try {
Thread.sleep(SLEEP_TIME_MS);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
}
}
if(mDb == null){
return;
}
createTableIfNotExists(mDb);
mDb.setMaximumSize(mMaximumDatabaseSize);
}
示例7: onUpgrade
import android.database.sqlite.SQLiteException; //导入方法依赖的package包/类
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
try {
if (newVersion == 7) {
new Settings(mContext).setUsersNotToNotifyWhenLive(getUsersNotToNotify(db));
}
} catch (SQLiteException e) {
e.printStackTrace();
}
db.execSQL(SQL_DELETE_ENTRIES);
onCreate(db);
//db.close();
}
示例8: getUsersNotToNotify
import android.database.sqlite.SQLiteException; //导入方法依赖的package包/类
public ArrayList<Integer> getUsersNotToNotify() {
try {
return getUsersNotToNotify(getReadableDatabase());
} catch (SQLiteException e) {
e.printStackTrace();
return new ArrayList<>();
}
}