use of androidx.media3.database.DatabaseIOException in project ExoPlayer by google.
the class DefaultDownloadIndex method putDownload.
@Override
public void putDownload(Download download) throws DatabaseIOException {
ensureInitialized();
try {
SQLiteDatabase writableDatabase = databaseProvider.getWritableDatabase();
putDownloadInternal(download, writableDatabase);
} catch (SQLiteException e) {
throw new DatabaseIOException(e);
}
}
use of androidx.media3.database.DatabaseIOException in project ExoPlayer by google.
the class DefaultDownloadIndex method setStopReason.
@Override
public void setStopReason(String id, int stopReason) throws DatabaseIOException {
ensureInitialized();
try {
ContentValues values = new ContentValues();
values.put(COLUMN_STOP_REASON, stopReason);
SQLiteDatabase writableDatabase = databaseProvider.getWritableDatabase();
writableDatabase.update(tableName, values, WHERE_STATE_IS_TERMINAL + " AND " + WHERE_ID_EQUALS, new String[] { id });
} catch (SQLException e) {
throw new DatabaseIOException(e);
}
}
use of androidx.media3.database.DatabaseIOException in project ExoPlayer by google.
the class DefaultDownloadIndex method setStatesToRemoving.
@Override
public void setStatesToRemoving() throws DatabaseIOException {
ensureInitialized();
try {
ContentValues values = new ContentValues();
values.put(COLUMN_STATE, Download.STATE_REMOVING);
// Only downloads in STATE_FAILED are allowed a failure reason, so we need to clear it here in
// case we're moving downloads from STATE_FAILED to STATE_REMOVING.
values.put(COLUMN_FAILURE_REASON, Download.FAILURE_REASON_NONE);
SQLiteDatabase writableDatabase = databaseProvider.getWritableDatabase();
writableDatabase.update(tableName, values, /* whereClause= */
null, /* whereArgs= */
null);
} catch (SQLException e) {
throw new DatabaseIOException(e);
}
}
use of androidx.media3.database.DatabaseIOException in project ExoPlayer by google.
the class DefaultDownloadIndex method setDownloadingStatesToQueued.
@Override
public void setDownloadingStatesToQueued() throws DatabaseIOException {
ensureInitialized();
try {
ContentValues values = new ContentValues();
values.put(COLUMN_STATE, Download.STATE_QUEUED);
SQLiteDatabase writableDatabase = databaseProvider.getWritableDatabase();
writableDatabase.update(tableName, values, WHERE_STATE_IS_DOWNLOADING, /* whereArgs= */
null);
} catch (SQLException e) {
throw new DatabaseIOException(e);
}
}
use of androidx.media3.database.DatabaseIOException in project ExoPlayer by google.
the class CacheFileMetadataIndex method remove.
/**
* Removes metadata.
*
* <p>This method may be slow and shouldn't normally be called on the main thread.
*
* @param name The name of the file whose metadata is to be removed.
* @throws DatabaseIOException If an error occurs removing the metadata.
*/
@WorkerThread
public void remove(String name) throws DatabaseIOException {
Assertions.checkNotNull(tableName);
try {
SQLiteDatabase writableDatabase = databaseProvider.getWritableDatabase();
writableDatabase.delete(tableName, WHERE_NAME_EQUALS, new String[] { name });
} catch (SQLException e) {
throw new DatabaseIOException(e);
}
}
Aggregations