@UnstableApi
class VersionTable


Utility methods for accessing versions of media library database components. This allows them to be versioned independently to the version of the containing database.

Summary

Constants

const Int

Version of tables used for cache content metadata.

const Int

Version of tables used for cache file metadata.

const Int

Version of tables used from external features.

const Int

Version of tables used for offline functionality.

const Int

Returned by getVersion if the version is unset.

Public functions

java-static Int
getVersion(database: SQLiteDatabase!, feature: Int, instanceUid: String!)

Returns the version of a specified instance of a feature, or VERSION_UNSET if no version is set.

java-static Unit
removeVersion(
    writableDatabase: SQLiteDatabase!,
    feature: Int,
    instanceUid: String!
)

Removes the version of a specified instance of a feature.

java-static Unit
setVersion(
    writableDatabase: SQLiteDatabase!,
    feature: Int,
    instanceUid: String!,
    version: Int
)

Sets the version of a specified instance of a specified feature.

Constants

FEATURE_CACHE_CONTENT_METADATA

const val FEATURE_CACHE_CONTENT_METADATA = 1: Int

Version of tables used for cache content metadata.

FEATURE_CACHE_FILE_METADATA

const val FEATURE_CACHE_FILE_METADATA = 2: Int

Version of tables used for cache file metadata.

FEATURE_EXTERNAL

const val FEATURE_EXTERNAL = 1000: Int

Version of tables used from external features.

FEATURE_OFFLINE

const val FEATURE_OFFLINE = 0: Int

Version of tables used for offline functionality.

VERSION_UNSET

const val VERSION_UNSET = -1: Int

Returned by getVersion if the version is unset.

Public functions

getVersion

java-static fun getVersion(database: SQLiteDatabase!, feature: Int, instanceUid: String!): Int

Returns the version of a specified instance of a feature, or VERSION_UNSET if no version is set.

Parameters
database: SQLiteDatabase!

The database to query.

feature: Int

The feature.

instanceUid: String!

The unique identifier of the instance of the feature.

Returns
Int

The version, or VERSION_UNSET if no version is set.

Throws
androidx.media3.database.DatabaseIOException

If an error occurs executing the SQL.

removeVersion

java-static fun removeVersion(
    writableDatabase: SQLiteDatabase!,
    feature: Int,
    instanceUid: String!
): Unit

Removes the version of a specified instance of a feature.

Parameters
writableDatabase: SQLiteDatabase!

The database to update.

feature: Int

The feature.

instanceUid: String!

The unique identifier of the instance of the feature.

Throws
androidx.media3.database.DatabaseIOException

If an error occurs executing the SQL.

setVersion

java-static fun setVersion(
    writableDatabase: SQLiteDatabase!,
    feature: Int,
    instanceUid: String!,
    version: Int
): Unit

Sets the version of a specified instance of a specified feature.

Parameters
writableDatabase: SQLiteDatabase!

The database to update.

feature: Int

The feature.

instanceUid: String!

The unique identifier of the instance of the feature.

version: Int

The version.

Throws
androidx.media3.database.DatabaseIOException

If an error occurs executing the SQL.