当前位置: 首页>>代码示例>>Java>>正文


Java SQLiteDiskIOException类代码示例

本文整理汇总了Java中android.database.sqlite.SQLiteDiskIOException的典型用法代码示例。如果您正苦于以下问题:Java SQLiteDiskIOException类的具体用法?Java SQLiteDiskIOException怎么用?Java SQLiteDiskIOException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SQLiteDiskIOException类属于android.database.sqlite包,在下文中一共展示了SQLiteDiskIOException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readExceptionFromParcel

import android.database.sqlite.SQLiteDiskIOException; //导入依赖的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);
    }
}
 
开发者ID:kkmike999,项目名称:YuiHatano,代码行数:25,代码来源:ShadowDatabaseUtils.java

示例2: put

import android.database.sqlite.SQLiteDiskIOException; //导入依赖的package包/类
/**
 * Stores the image with the given URL and the modified/version String.
 * 
 * @param url
 *          The URL of the photo to be put.
 * @param modified
 *          The modified/version string.
 * @param image
 *          The image data.
 */
private synchronized boolean put(URL url, String modified, Bitmap image) {
  if (!imageDb.isReady()) {
    return false;
  }
  Log.i(TAG, "Attempting to put " + url.toString());
  if (imageDb.exists(url)) {
    Log.i(TAG, "ALREADY EXISTS!");
    return false;
  }

  Log.i(TAG, "Putting photo into DB.");
  try {
    return imageDb.put(url, modified, image) != -1;
  } catch (SQLiteDiskIOException ex) {
    Log.w(TAG, "Unable to put photo in DB, disk full or unavailable.");
    return false;
  }
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:29,代码来源:FileSystemImageCache.java

示例3: writeToDb

import android.database.sqlite.SQLiteDiskIOException; //导入依赖的package包/类
private void writeToDb(Object o, Bitmap preview) {
    String name = getObjectName(o);
    SQLiteDatabase db = mDb.getWritableDatabase();
    ContentValues values = new ContentValues();

    values.put(CacheDb.COLUMN_NAME, name);
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    preview.compress(Bitmap.CompressFormat.PNG, 100, stream);
    values.put(CacheDb.COLUMN_PREVIEW_BITMAP, stream.toByteArray());
    values.put(CacheDb.COLUMN_SIZE, mSize);
    try {
        db.insert(CacheDb.TABLE_NAME, null, values);
    } catch (SQLiteDiskIOException e) {
        recreateDb();
    }
}
 
开发者ID:Phonemetra,项目名称:TurboLauncher,代码行数:17,代码来源:WidgetPreviewLoader.java

示例4: removePackageFromDb

import android.database.sqlite.SQLiteDiskIOException; //导入依赖的package包/类
public static void removePackageFromDb(final CacheDb cacheDb, final String packageName) {
    synchronized(sInvalidPackages) {
        sInvalidPackages.add(packageName);
    }
    new AsyncTask<Void, Void, Void>() {
        public Void doInBackground(Void ... args) {
            SQLiteDatabase db = cacheDb.getWritableDatabase();
            try {
                db.delete(CacheDb.TABLE_NAME,
                        CacheDb.COLUMN_NAME + " LIKE ? OR " +
                        CacheDb.COLUMN_NAME + " LIKE ?", // SELECT query
                        new String[] {
                                WIDGET_PREFIX + packageName + "/%",
                                SHORTCUT_PREFIX + packageName + "/%"
                        } // args to SELECT query
                );
            } catch (SQLiteDiskIOException e) {
            }
            synchronized(sInvalidPackages) {
                sInvalidPackages.remove(packageName);
            }
            return null;
        }
    }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null);
}
 
开发者ID:Phonemetra,项目名称:TurboLauncher,代码行数:26,代码来源:WidgetPreviewLoader.java

示例5: selectCalibAlgo

import android.database.sqlite.SQLiteDiskIOException; //导入依赖的package包/类
public int selectCalibAlgo( long cid )
{
  int algo = CalibInfo.ALGO_AUTO; // default 
  // if ( myDB == null ) return 0;
  Cursor cursor = null;
  try {
    cursor = myDB.query( CALIB_TABLE,
                          new String[] { "algo" }, // columns
                          "id=?",
                          new String[] { Long.toString(cid) },
                          null, null, null ); 
    if ( cursor != null && cursor.moveToFirst()) {
      algo = (int)cursor.getLong( 0 );
    }
  } catch ( SQLiteDiskIOException e ) { handleDiskIOError( e );
  } finally { if (cursor != null && !cursor.isClosed()) cursor.close(); }
  return algo;
}
 
开发者ID:marcocorvi,项目名称:topodroid,代码行数:19,代码来源:DeviceHelper.java

示例6: getCalibCID

import android.database.sqlite.SQLiteDiskIOException; //导入依赖的package包/类
public long getCalibCID( String name, String device )
{
  long id = -1L;
  Cursor cursor = null;
  try {
    cursor = myDB.query( CALIB_TABLE,
                         new String[] { "id" }, // columns
                         "name=? and device=?",
                         new String[] { name, device },
                         null, null, null );
    if (cursor != null && cursor.moveToFirst()) {
      id = cursor.getLong( 0 );
    }
  } catch ( SQLiteDiskIOException e ) { handleDiskIOError( e );
  } finally { if (cursor != null && !cursor.isClosed()) cursor.close(); }
  return id;
}
 
开发者ID:marcocorvi,项目名称:topodroid,代码行数:18,代码来源:DeviceHelper.java

示例7: selectCalibInfo

import android.database.sqlite.SQLiteDiskIOException; //导入依赖的package包/类
public CalibInfo selectCalibInfo( long cid )
{
  CalibInfo info = null;
  // if ( myDB == null ) return null;
  Cursor cursor = null;
  try {
    cursor = myDB.query( CALIB_TABLE,
                         new String[] { "name", "day", "device", "comment", "algo" }, // columns
                         "id=?",
                         new String[] { Long.toString(cid) },
                         null, null, null ); 
    if ( cursor != null && cursor.moveToFirst()) {
      info = new CalibInfo( 
              cid,
              cursor.getString( 0 ),
              cursor.getString( 1 ),
              cursor.getString( 2 ),
              cursor.getString( 3 ),
              (int)cursor.getLong( 4 ) );
    }
  } catch ( SQLiteDiskIOException e ) { handleDiskIOError( e );
  } finally { if (cursor != null && !cursor.isClosed()) cursor.close(); }
  return info;
}
 
开发者ID:marcocorvi,项目名称:topodroid,代码行数:25,代码来源:DeviceHelper.java

示例8: selectCalibCoeff

import android.database.sqlite.SQLiteDiskIOException; //导入依赖的package包/类
public String selectCalibCoeff( long cid )
{
  String coeff = null;
  // if ( myDB == null ) return null;
  Cursor cursor = null;
  try {
    cursor = myDB.query( CALIB_TABLE,
                         new String[] { "coeff" }, // columns
                         "id=?",
                         new String[] { Long.toString(cid) },
                         null, null, null );
    if ( cursor != null && cursor.moveToFirst()) {
      coeff = cursor.getString( 0 );
    }
  } catch ( SQLiteDiskIOException e ) { handleDiskIOError( e );
  } finally { if (cursor != null && !cursor.isClosed()) cursor.close(); }
  return coeff;
}
 
开发者ID:marcocorvi,项目名称:topodroid,代码行数:19,代码来源:DeviceHelper.java

示例9: selectAllNames

import android.database.sqlite.SQLiteDiskIOException; //导入依赖的package包/类
private List<String> selectAllNames( String table )
{
  TDLog.Log( TDLog.LOG_DB, "selectAllNames table " + table );

  List< String > list = new ArrayList<>();
  // if ( myDB == null ) return list;
  Cursor cursor = null;
  try {
    cursor = myDB.query( table,
                         new String[] { "name" }, // columns
                         null, null, null, null, "name" );
    if (cursor.moveToFirst()) {
      do {
        list.add( cursor.getString(0) );
      } while (cursor.moveToNext());
    }
  } catch ( SQLiteDiskIOException e ) { handleDiskIOError( e );
  } finally { if (cursor != null && !cursor.isClosed()) cursor.close(); }
  TDLog.Log( TDLog.LOG_DB, "found " + list.size() + " names " );
  return list;
}
 
开发者ID:marcocorvi,项目名称:topodroid,代码行数:22,代码来源:DeviceHelper.java

示例10: selectDeviceCalibs

import android.database.sqlite.SQLiteDiskIOException; //导入依赖的package包/类
public List<String> selectDeviceCalibs( String device ) 
{
  List<String> ret = new ArrayList<>();
  Cursor cursor = null;
  try {
    cursor = myDB.query( CALIB_TABLE,
                         new String[] { "name", "day" }, // columns
                         "device=?",
                         new String[] { device },
                         null, null, null );
    if (cursor != null && cursor.moveToFirst() ) {
      do {
        ret.add( cursor.getString(0) + " - " + cursor.getString(1) );
      } while (cursor.moveToNext());
    }
  } catch ( SQLiteDiskIOException e ) { handleDiskIOError( e );
  } finally { if (cursor != null && !cursor.isClosed()) cursor.close(); }
  return ret;
}
 
开发者ID:marcocorvi,项目名称:topodroid,代码行数:20,代码来源:DeviceHelper.java

示例11: selectDeviceCalibsInfo

import android.database.sqlite.SQLiteDiskIOException; //导入依赖的package包/类
public List<CalibInfo> selectDeviceCalibsInfo( String device ) 
{
  List<CalibInfo> ret = new ArrayList<>();
  Cursor cursor = null;
  try {
    cursor = myDB.query( CALIB_TABLE,
                         new String[] { "id", "name", "day", "comment", "algo" }, // columns
                         "device=?",
                         new String[] { device },
                         null, null, null );
    if (cursor != null && cursor.moveToFirst() ) {
      do {
        ret.add( new CalibInfo(
          cursor.getLong(0),
          cursor.getString(1),
          cursor.getString(2),
          device,
          cursor.getString(3),
          (int)cursor.getLong(4) ) );
      } while (cursor.moveToNext());
    }
  } catch ( SQLiteDiskIOException e ) { handleDiskIOError( e );
  } finally { if (cursor != null && !cursor.isClosed()) cursor.close(); }
  return ret;
}
 
开发者ID:marcocorvi,项目名称:topodroid,代码行数:26,代码来源:DeviceHelper.java

示例12: getValue

import android.database.sqlite.SQLiteDiskIOException; //导入依赖的package包/类
public String getValue( String key )
{
  if ( myDB == null ) {
    TDLog.Error( "DeviceHelper::getValue null DB");
    return null;
  }
  if ( key == null || key.length() == 0 ) {
    TDLog.Error( "DeviceHelper::getValue null key");
    return null;
  }
  String value = null;
  Cursor cursor = null;
  try {
    cursor = myDB.query( CONFIG_TABLE,
                         new String[] { "value" }, // columns
                         "key = ?", new String[] { key },
                         null, null, null );
    if ( cursor != null && cursor.moveToFirst()) {
      value = cursor.getString( 0 );
    }
  } catch ( SQLiteDiskIOException e ) { handleDiskIOError( e );
  } finally { if (cursor != null && !cursor.isClosed()) cursor.close(); }
  return value;
}
 
开发者ID:marcocorvi,项目名称:topodroid,代码行数:25,代码来源:DeviceHelper.java

示例13: getNameFromId

import android.database.sqlite.SQLiteDiskIOException; //导入依赖的package包/类
private String getNameFromId( String table, long id )
{
  String ret = null;
  // if ( myDB == null ) return null;
  Cursor cursor = null;
  try {
    cursor = myDB.query( table, new String[] { "name" },
                         "id=?", new String[] { Long.toString(id) },
                         null, null, null );
    if (cursor != null && cursor.moveToFirst() ) {
      ret = cursor.getString(0);
    }
  } catch ( SQLiteDiskIOException e ) { handleDiskIOError( e );
  } finally { if (cursor != null && !cursor.isClosed()) cursor.close(); }
  return ret;
}
 
开发者ID:marcocorvi,项目名称:topodroid,代码行数:17,代码来源:DeviceHelper.java

示例14: getIdFromName

import android.database.sqlite.SQLiteDiskIOException; //导入依赖的package包/类
private long getIdFromName( String table, String name ) 
{
  long id = -1;
  // if ( myDB == null ) { return -2; }
  Cursor cursor = null;
  try {
    cursor = myDB.query( table, new String[] { "id" },
                         "name = ?", new String[] { name },
                         null, null, null );
    if (cursor != null && cursor.moveToFirst() ) {
      id = cursor.getLong(0);
    }
  } catch ( SQLiteDiskIOException e ) { handleDiskIOError( e );
  } finally { if (cursor != null && !cursor.isClosed()) cursor.close(); }
  return id;
}
 
开发者ID:marcocorvi,项目名称:topodroid,代码行数:17,代码来源:DeviceHelper.java

示例15: maxId

import android.database.sqlite.SQLiteDiskIOException; //导入依赖的package包/类
private long maxId( String table, long sid )
{
  long id = 1;
  // if ( myDB == null ) return 1L;
  Cursor cursor = null;
  try {
    cursor = myDB.query( table, new String[] { "max(id)" },
                       "surveyId=?", 
                       new String[] { Long.toString(sid) },
                       null, null, null );
    if (cursor != null && cursor.moveToFirst() ) {
      id = 1 + cursor.getLong(0);
    }
  } catch ( SQLiteDiskIOException e ) { handleDiskIOError( e );
  } finally { if (cursor != null && !cursor.isClosed()) cursor.close(); }
  return id;
}
 
开发者ID:marcocorvi,项目名称:topodroid,代码行数:18,代码来源:DeviceHelper.java


注:本文中的android.database.sqlite.SQLiteDiskIOException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。