Java Code Examples for com.google.android.exoplayer2.database.VersionTable#removeVersion()

The following examples show how to use com.google.android.exoplayer2.database.VersionTable#removeVersion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CachedContentIndex.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
private static void delete(DatabaseProvider databaseProvider, String hexUid)
    throws DatabaseIOException {
  try {
    String tableName = getTableName(hexUid);
    SQLiteDatabase writableDatabase = databaseProvider.getWritableDatabase();
    writableDatabase.beginTransactionNonExclusive();
    try {
      VersionTable.removeVersion(
          writableDatabase, VersionTable.FEATURE_CACHE_CONTENT_METADATA, hexUid);
      dropTable(writableDatabase, tableName);
      writableDatabase.setTransactionSuccessful();
    } finally {
      writableDatabase.endTransaction();
    }
  } catch (SQLException e) {
    throw new DatabaseIOException(e);
  }
}
 
Example 2
Source File: CacheFileMetadataIndex.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * Deletes index data for the specified cache.
 *
 * <p>This method may be slow and shouldn't normally be called on the main thread.
 *
 * @param databaseProvider Provides the database in which the index is stored.
 * @param uid The cache UID.
 * @throws DatabaseIOException If an error occurs deleting the index data.
 */
@WorkerThread
public static void delete(DatabaseProvider databaseProvider, long uid)
    throws DatabaseIOException {
  String hexUid = Long.toHexString(uid);
  try {
    String tableName = getTableName(hexUid);
    SQLiteDatabase writableDatabase = databaseProvider.getWritableDatabase();
    writableDatabase.beginTransactionNonExclusive();
    try {
      VersionTable.removeVersion(
          writableDatabase, VersionTable.FEATURE_CACHE_FILE_METADATA, hexUid);
      dropTable(writableDatabase, tableName);
      writableDatabase.setTransactionSuccessful();
    } finally {
      writableDatabase.endTransaction();
    }
  } catch (SQLException e) {
    throw new DatabaseIOException(e);
  }
}
 
Example 3
Source File: CachedContentIndex.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private static void delete(DatabaseProvider databaseProvider, String hexUid)
    throws DatabaseIOException {
  try {
    String tableName = getTableName(hexUid);
    SQLiteDatabase writableDatabase = databaseProvider.getWritableDatabase();
    writableDatabase.beginTransaction();
    try {
      VersionTable.removeVersion(
          writableDatabase, VersionTable.FEATURE_CACHE_CONTENT_METADATA, hexUid);
      dropTable(writableDatabase, tableName);
      writableDatabase.setTransactionSuccessful();
    } finally {
      writableDatabase.endTransaction();
    }
  } catch (SQLException e) {
    throw new DatabaseIOException(e);
  }
}
 
Example 4
Source File: CacheFileMetadataIndex.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Deletes index data for the specified cache.
 *
 * @param databaseProvider Provides the database in which the index is stored.
 * @param uid The cache UID.
 * @throws DatabaseIOException If an error occurs deleting the index data.
 */
public static void delete(DatabaseProvider databaseProvider, long uid)
    throws DatabaseIOException {
  String hexUid = Long.toHexString(uid);
  try {
    String tableName = getTableName(hexUid);
    SQLiteDatabase writableDatabase = databaseProvider.getWritableDatabase();
    writableDatabase.beginTransaction();
    try {
      VersionTable.removeVersion(
          writableDatabase, VersionTable.FEATURE_CACHE_FILE_METADATA, hexUid);
      dropTable(writableDatabase, tableName);
      writableDatabase.setTransactionSuccessful();
    } finally {
      writableDatabase.endTransaction();
    }
  } catch (SQLException e) {
    throw new DatabaseIOException(e);
  }
}
 
Example 5
Source File: CachedContentIndex.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private static void delete(DatabaseProvider databaseProvider, String hexUid)
    throws DatabaseIOException {
  try {
    String tableName = getTableName(hexUid);
    SQLiteDatabase writableDatabase = databaseProvider.getWritableDatabase();
    writableDatabase.beginTransaction();
    try {
      VersionTable.removeVersion(
          writableDatabase, VersionTable.FEATURE_CACHE_CONTENT_METADATA, hexUid);
      dropTable(writableDatabase, tableName);
      writableDatabase.setTransactionSuccessful();
    } finally {
      writableDatabase.endTransaction();
    }
  } catch (SQLException e) {
    throw new DatabaseIOException(e);
  }
}
 
Example 6
Source File: CacheFileMetadataIndex.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Deletes index data for the specified cache.
 *
 * @param databaseProvider Provides the database in which the index is stored.
 * @param uid The cache UID.
 * @throws DatabaseIOException If an error occurs deleting the index data.
 */
public static void delete(DatabaseProvider databaseProvider, long uid)
    throws DatabaseIOException {
  String hexUid = Long.toHexString(uid);
  try {
    String tableName = getTableName(hexUid);
    SQLiteDatabase writableDatabase = databaseProvider.getWritableDatabase();
    writableDatabase.beginTransaction();
    try {
      VersionTable.removeVersion(
          writableDatabase, VersionTable.FEATURE_CACHE_FILE_METADATA, hexUid);
      dropTable(writableDatabase, tableName);
      writableDatabase.setTransactionSuccessful();
    } finally {
      writableDatabase.endTransaction();
    }
  } catch (SQLException e) {
    throw new DatabaseIOException(e);
  }
}