Stay organized with collections
Save and categorize content based on your preferences.
SQLiteClosable
abstract class SQLiteClosable : Closeable
Known Indirect Subclasses
|
An object created from a SQLiteDatabase that can be closed. This class implements a primitive reference counting scheme for database objects.
Summary
Public methods |
open Unit |
Acquires a reference to the object.
|
open Unit |
Releases a reference to the object, closing the object if the last reference was released.
|
open Unit |
Releases a reference to the object, closing the object if the last reference was released.
|
open Unit |
Releases a reference to the object that was owned by the container of the object, closing the object if the last reference was released.
|
Public constructors
SQLiteClosable
SQLiteClosable()
Public methods
acquireReference
open fun acquireReference(): Unit
Acquires a reference to the object.
Exceptions |
java.lang.IllegalStateException |
if the last reference to the object has already been released. |
close
open fun close(): Unit
Releases a reference to the object, closing the object if the last reference was released. Calling this method is equivalent to calling releaseReference
.
Exceptions |
java.lang.Exception |
if this resource cannot be closed |
java.io.IOException |
if an I/O error occurs |
releaseReference
open fun releaseReference(): Unit
Releases a reference to the object, closing the object if the last reference was released.
releaseReferenceFromContainer
open fun releaseReferenceFromContainer(): Unit
Deprecated: Do not use.
Releases a reference to the object that was owned by the container of the object, closing the object if the last reference was released.
Protected methods
onAllReferencesReleased
protected abstract fun onAllReferencesReleased(): Unit
Called when the last reference to the object was released by a call to releaseReference()
or #close().
onAllReferencesReleasedFromContainer
protected open fun onAllReferencesReleasedFromContainer(): Unit
Deprecated: Do not use.
Called when the last reference to the object was released by a call to releaseReferenceFromContainer()
.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# SQLiteClosable\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nSQLiteClosable\n==============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/database/sqlite/SQLiteClosable \"View this page in Java\") \n\n```\nabstract class SQLiteClosable : Closeable\n```\n\n|---|---------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.database.sqlite.SQLiteClosable](#) |\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [CursorWindow](../CursorWindow.html#), [SQLiteDatabase](/reference/kotlin/android/database/sqlite/SQLiteDatabase), [SQLiteProgram](/reference/kotlin/android/database/sqlite/SQLiteProgram) |----------------------------------------------------------------------------|----------------------------------------------| | [CursorWindow](../CursorWindow.html#) | A buffer containing multiple cursor rows. | | [SQLiteDatabase](/reference/kotlin/android/database/sqlite/SQLiteDatabase) | Exposes methods to manage a SQLite database. | | [SQLiteProgram](/reference/kotlin/android/database/sqlite/SQLiteProgram) | A base class for compiled SQLite programs. | |\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Indirect Subclasses [SQLiteQuery](/reference/kotlin/android/database/sqlite/SQLiteQuery), [SQLiteStatement](/reference/kotlin/android/database/sqlite/SQLiteStatement) |------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------| | [SQLiteQuery](/reference/kotlin/android/database/sqlite/SQLiteQuery) | Represents a query that reads the resulting rows into a [SQLiteQuery](/reference/kotlin/android/database/sqlite/SQLiteQuery). | | [SQLiteStatement](/reference/kotlin/android/database/sqlite/SQLiteStatement) | Represents a statement that can be executed against a database. | |\n\nAn object created from a SQLiteDatabase that can be closed. This class implements a primitive reference counting scheme for database objects.\n\nSummary\n-------\n\n| Public constructors ||\n|------------------------------------------------|---|\n| [SQLiteClosable](#SQLiteClosable())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [acquireReference](#acquireReference())`()` Acquires a reference to the object. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [close](#close())`()` Releases a reference to the object, closing the object if the last reference was released. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [releaseReference](#releaseReference())`()` Releases a reference to the object, closing the object if the last reference was released. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [releaseReferenceFromContainer](#releaseReferenceFromContainer())`()` Releases a reference to the object that was owned by the container of the object, closing the object if the last reference was released. |\n\n| Protected methods ||\n|---------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onAllReferencesReleased](#onAllReferencesReleased())`()` Called when the last reference to the object was released by a call to [releaseReference()](#releaseReference()) or #close(). |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onAllReferencesReleasedFromContainer](#onAllReferencesReleasedFromContainer())`()` Called when the last reference to the object was released by a call to [releaseReferenceFromContainer()](#releaseReferenceFromContainer()). |\n\nPublic constructors\n-------------------\n\n### SQLiteClosable\n\n```\nSQLiteClosable()\n```\n\nPublic methods\n--------------\n\n### acquireReference\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun acquireReference(): Unit\n```\n\nAcquires a reference to the object.\n\n| Exceptions ||\n|-----------------------------------|----------------------------------------------------------------|\n| `java.lang.IllegalStateException` | if the last reference to the object has already been released. |\n\n### close\n\nAdded in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun close(): Unit\n```\n\nReleases a reference to the object, closing the object if the last reference was released. Calling this method is equivalent to calling [releaseReference](#releaseReference()).\n\n| Exceptions ||\n|-----------------------|-----------------------------------|\n| `java.lang.Exception` | if this resource cannot be closed |\n| `java.io.IOException` | if an I/O error occurs |\n\n**See Also**\n\n- \u003c#releaseReference()\u003e\n- \u003c#onAllReferencesReleased()\u003e \n\n### releaseReference\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun releaseReference(): Unit\n```\n\nReleases a reference to the object, closing the object if the last reference was released. \n**See Also**\n\n- \u003c#onAllReferencesReleased()\u003e \n\n### releaseReferenceFromContainer\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nDeprecated in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun releaseReferenceFromContainer(): Unit\n```\n\n**Deprecated:** *Do not use.*\n\nReleases a reference to the object that was owned by the container of the object, closing the object if the last reference was released. \n**See Also**\n\n- \u003c#onAllReferencesReleasedFromContainer()\u003e\n\nProtected methods\n-----------------\n\n### onAllReferencesReleased\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nprotected abstract fun onAllReferencesReleased(): Unit\n```\n\nCalled when the last reference to the object was released by a call to [releaseReference()](#releaseReference()) or #close(). \n\n### onAllReferencesReleasedFromContainer\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nDeprecated in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nprotected open fun onAllReferencesReleasedFromContainer(): Unit\n```\n\n**Deprecated:** *Do not use.*\n\nCalled when the last reference to the object was released by a call to [releaseReferenceFromContainer()](#releaseReferenceFromContainer())."]]