本文整理汇总了Java中android.database.sqlite.SQLiteFullException类的典型用法代码示例。如果您正苦于以下问题:Java SQLiteFullException类的具体用法?Java SQLiteFullException怎么用?Java SQLiteFullException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SQLiteFullException类属于android.database.sqlite包,在下文中一共展示了SQLiteFullException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleError
import android.database.sqlite.SQLiteFullException; //导入依赖的package包/类
private void handleError(Exception exception) {
Exception errProcessEx = exFiltrate(exception);
if (errProcessEx instanceof SQLiteFullException) {
// If the error is sqLite full exception already, no need to update it to the database
// again.
handleSQLiteFullException((SQLiteFullException) errProcessEx);
} else {
// Normal case.
try {
model.setStatus(FileDownloadStatus.error);
model.setErrMsg(exception.toString());
database.updateError(model.getId(), errProcessEx, model.getSoFar());
} catch (SQLiteFullException fullException) {
errProcessEx = fullException;
handleSQLiteFullException((SQLiteFullException) errProcessEx);
}
}
processParams.setException(errProcessEx);
onStatusChanged(FileDownloadStatus.error);
}
示例2: readExceptionFromParcel
import android.database.sqlite.SQLiteFullException; //导入依赖的package包/类
private static final void readExceptionFromParcel(Parcel reply, String msg, int code) {
switch (code) {
case 2:
throw new IllegalArgumentException(msg);
case 3:
throw new UnsupportedOperationException(msg);
case 4:
throw new SQLiteAbortException(msg);
case 5:
throw new SQLiteConstraintException(msg);
case 6:
throw new SQLiteDatabaseCorruptException(msg);
case 7:
throw new SQLiteFullException(msg);
case 8:
throw new SQLiteDiskIOException(msg);
case 9:
throw new SQLiteException(msg);
case 11:
throw new OperationCanceledException(msg);
default:
reply.readException(code, msg);
}
}
示例3: delete
import android.database.sqlite.SQLiteFullException; //导入依赖的package包/类
@Override
public boolean delete()
throws SQLiteException
{
try {
//drop table
MapContentProviderHelper map = (MapContentProviderHelper) MapBase.getInstance();
SQLiteDatabase db = map.getDatabase(false);
String tableDrop = "DROP TABLE IF EXISTS " + mPath.getName();
db.execSQL(tableDrop);
} catch (SQLiteFullException e) {
e.printStackTrace();
}
return super.delete();
}
示例4: handleSQLiteFullException
import android.database.sqlite.SQLiteFullException; //导入依赖的package包/类
private void handleSQLiteFullException(final SQLiteFullException sqLiteFullException) {
final int id = model.getId();
if (FileDownloadLog.NEED_LOG) {
FileDownloadLog.d(this, "the data of the task[%d] is dirty, because the SQLite " +
"full exception[%s], so remove it from the database directly.",
id, sqLiteFullException.toString());
}
model.setErrMsg(sqLiteFullException.toString());
model.setStatus(FileDownloadStatus.error);
database.remove(id);
database.removeConnections(id);
}
示例5: performSetItem
import android.database.sqlite.SQLiteFullException; //导入依赖的package包/类
private boolean performSetItem(String key, String value, boolean isPersistent, boolean allowRetryWhenFull) {
SQLiteDatabase database = mDatabaseSupplier.getDatabase();
if (database == null) {
return false;
}
WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE, "set k-v to storage(key:" + key + ",value:" + value + ",isPersistent:" + isPersistent + ",allowRetry:" + allowRetryWhenFull + ")");
String sql = "INSERT OR REPLACE INTO " + WXSQLiteOpenHelper.TABLE_STORAGE + " VALUES (?,?,?,?);";
SQLiteStatement statement = null;
String timeStamp = WXSQLiteOpenHelper.sDateFormatter.format(new Date());
try {
statement = database.compileStatement(sql);
statement.clearBindings();
statement.bindString(1, key);
statement.bindString(2, value);
statement.bindString(3, timeStamp);
statement.bindLong(4, isPersistent ? 1 : 0);
statement.execute();
return true;
} catch (Exception e) {
WXLogUtils.e(WXSQLiteOpenHelper.TAG_STORAGE, "DefaultWXStorage occurred an exception when execute setItem :" + e.getMessage());
if (e instanceof SQLiteFullException) {
if (allowRetryWhenFull && trimToSize()) {
//try again
//setItem/setItemPersistent method only allow try once when occurred a sqliteFullException.
WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE, "retry set k-v to storage(key:" + key + ",value:" + value + ")");
return performSetItem(key, value, isPersistent, false);
}
}
return false;
} finally {
if(statement != null) {
statement.close();
}
}
}
示例6: printStackTrace
import android.database.sqlite.SQLiteFullException; //导入依赖的package包/类
/**
* 数据库文件已达到最大空间(数据库已满)
*
* @param e
*/
public static void printStackTrace(String TAG, SQLiteFullException e) {
if (IsDebug) {
e.printStackTrace();
} else {
logException(TAG, e);
}
}
示例7: writeExceptionToParcel
import android.database.sqlite.SQLiteFullException; //导入依赖的package包/类
/**
* Special function for writing an exception result at the header of
* a parcel, to be used when returning an exception from a transaction.
* exception will be re-thrown by the function in another process
*
* @param reply Parcel to write to
* @param e The Exception to be written.
* @see Parcel#writeNoException
* @see Parcel#writeException
*/
public static final void writeExceptionToParcel(Parcel reply, Exception e) {
int code = 0;
boolean logException = true;
if (e instanceof FileNotFoundException) {
code = 1;
logException = false;
} else if (e instanceof IllegalArgumentException) {
code = 2;
} else if (e instanceof UnsupportedOperationException) {
code = 3;
} else if (e instanceof SQLiteAbortException) {
code = 4;
} else if (e instanceof SQLiteConstraintException) {
code = 5;
} else if (e instanceof SQLiteDatabaseCorruptException) {
code = 6;
} else if (e instanceof SQLiteFullException) {
code = 7;
} else if (e instanceof SQLiteDiskIOException) {
code = 8;
} else if (e instanceof SQLiteException) {
code = 9;
} else if (e instanceof OperationApplicationException) {
code = 10;
} else if (e instanceof OperationCanceledException) {
code = 11;
logException = false;
} else {
reply.writeException(e);
Log.e(TAG, "Writing exception to parcel", e);
return;
}
reply.writeInt(code);
reply.writeString(e.getMessage());
if (logException) {
Log.e(TAG, "Writing exception to parcel", e);
}
}
示例8: performSetItem
import android.database.sqlite.SQLiteFullException; //导入依赖的package包/类
private boolean performSetItem(String key, String value, boolean isPersistent, boolean allowRetryWhenFull) {
WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE,"set k-v to storage(key:"+ key + ",value:"+ value+",isPersistent:"+isPersistent+",allowRetry:"+allowRetryWhenFull+")");
String sql = "INSERT OR REPLACE INTO " + WXSQLiteOpenHelper.TABLE_STORAGE + " VALUES (?,?,?,?);";
SQLiteStatement statement = mDatabaseSupplier.getDatabase().compileStatement(sql);
String timeStamp = WXSQLiteOpenHelper.sDateFormatter.format(new Date());
try {
statement.clearBindings();
statement.bindString(1, key);
statement.bindString(2, value);
statement.bindString(3, timeStamp);
statement.bindLong(4, isPersistent ? 1 : 0);
statement.execute();
return true;
} catch (Exception e) {
WXLogUtils.e(WXSQLiteOpenHelper.TAG_STORAGE,"DefaultWXStorage occurred an exception when execute setItem :" + e.getMessage());
if(e instanceof SQLiteFullException){
if(allowRetryWhenFull && trimToSize()){
//try again
//setItem/setItemPersistent method only allow try once when occurred a sqliteFullException.
WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE,"retry set k-v to storage(key:"+key+",value:"+value+")");
return performSetItem(key,value,isPersistent,false);
}
}
return false;
} finally {
statement.close();
}
}
示例9: setPicture
import android.database.sqlite.SQLiteFullException; //导入依赖的package包/类
public static void setPicture(MediaWrapper m, Bitmap p) {
Log.d(TAG, "Setting new picture for " + m.getTitle());
try {
getInstance().updateMedia(
m.getUri(),
mediaColumn.MEDIA_PICTURE,
p);
} catch (SQLiteFullException e) {
Log.d(TAG, "SQLiteFullException while setting picture");
}
m.setPictureParsed(true);
}
示例10: setPicture
import android.database.sqlite.SQLiteFullException; //导入依赖的package包/类
public static void setPicture(MediaWrapper m, Bitmap p) {
Log.d(TAG, "Setting new picture for " + m.getTitle());
try {
getInstance().updateMedia(
m.getUri(),
INDEX_MEDIA_PICTURE,
p);
} catch (SQLiteFullException e) {
Log.d(TAG, "SQLiteFullException while setting picture");
}
m.setPictureParsed(true);
}
示例11: handleSQLiteFullException
import android.database.sqlite.SQLiteFullException; //导入依赖的package包/类
private void handleSQLiteFullException(final SQLiteFullException sqLiteFullException) {
final int id = model.getId();
if (FileDownloadLog.NEED_LOG) {
FileDownloadLog.d(this, "the data of the task[%d] is dirty, because the SQLite "
+ "full exception[%s], so remove it from the database directly.",
id, sqLiteFullException.toString());
}
model.setErrMsg(sqLiteFullException.toString());
model.setStatus(FileDownloadStatus.error);
database.remove(id);
database.removeConnections(id);
}
示例12: setPicture
import android.database.sqlite.SQLiteFullException; //导入依赖的package包/类
public static void setPicture(Context context, Media m, Bitmap p) {
Log.d(TAG, "Setting new picture for " + m.getTitle());
try {
MediaDatabase.getInstance(context).updateMedia(
m.getLocation(),
MediaDatabase.mediaColumn.MEDIA_PICTURE,
p);
} catch (SQLiteFullException e) {
Log.d(TAG, "SQLiteFullException while setting picture");
}
m.setPictureParsed(true);
}
示例13: delete
import android.database.sqlite.SQLiteFullException; //导入依赖的package包/类
public static void delete(String tableName)
{
try {
MapContentProviderHelper map = (MapContentProviderHelper) MapBase.getInstance();
SQLiteDatabase db = map.getDatabase(true);
String tableDrop = "DROP TABLE IF EXISTS " + tableName;
db.execSQL(tableDrop);
} catch (SQLiteFullException e) {
e.printStackTrace();
}
}
示例14: setPicture
import android.database.sqlite.SQLiteFullException; //导入依赖的package包/类
public static void setPicture(Media m, Bitmap p) {
Log.d(TAG, "Setting new picture for " + m.getTitle());
try {
getInstance().updateMedia(
m.getLocation(),
mediaColumn.MEDIA_PICTURE,
p);
} catch (SQLiteFullException e) {
Log.d(TAG, "SQLiteFullException while setting picture");
}
m.setPictureParsed(true);
}
示例15: onDiskFull
import android.database.sqlite.SQLiteFullException; //导入依赖的package包/类
private void onDiskFull(SQLiteFullException e) {
mIgnoreWrites = true;
}