SQLiteDatabase SQLiteDatabase Class

Definition

Exposes methods to manage a SQLite database.

[Android.Runtime.Register("android/database/sqlite/SQLiteDatabase", ApiSince=1, DoNotGenerateAcw=true)]
public class SQLiteDatabase : Android.Database.Sqlite.SQLiteClosable
type SQLiteDatabase = class
    inherit SQLiteClosable
Inheritance
Attributes

Remarks

Android platform documentation

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

SQLiteDatabase(IntPtr, JniHandleOwnership) SQLiteDatabase(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Fields

ConflictAbort ConflictAbort

When a constraint violation occurs,no ROLLBACK is executed so changes from prior commands within the same transaction are preserved.

ConflictFail ConflictFail

When a constraint violation occurs, the command aborts with a return code SQLITE_CONSTRAINT.

ConflictIgnore ConflictIgnore

When a constraint violation occurs, the one row that contains the constraint violation is not inserted or changed.

ConflictNone ConflictNone

Use the following when no conflict action is specified.

ConflictReplace ConflictReplace

When a UNIQUE constraint violation occurs, the pre-existing rows that are causing the constraint violation are removed prior to inserting or updating the current row.

ConflictRollback ConflictRollback

When a constraint violation occurs, an immediate ROLLBACK occurs, thus ending the current transaction, and the command aborts with a return code of SQLITE_CONSTRAINT.

MaxSqlCacheSize MaxSqlCacheSize

Absolute max value that can be set by SetMaxSqlCacheSize(Int32).

SqliteMaxLikePatternLength SqliteMaxLikePatternLength

Properties

Class Class

Returns the unique instance of Class that represents this object's class.

(Inherited from Object)
Handle Handle

The handle to the underlying Android instance.

(Inherited from Object)
IJavaObjectEx.IsProxy IJavaObjectEx.IsProxy Inherited from Object
IJavaObjectEx.KeyHandle IJavaObjectEx.KeyHandle Inherited from Object
IJavaObjectEx.NeedsActivation IJavaObjectEx.NeedsActivation Inherited from Object
IJavaPeerable.JniManagedPeerState IJavaPeerable.JniManagedPeerState Inherited from Object
IsDatabaseIntegrityOk IsDatabaseIntegrityOk

Runs 'pragma integrity_check' on the given database (and all the attached databases) and returns true if the given database (and all its attached databases) pass integrity_check, false otherwise.

IsDbLockedByCurrentThread IsDbLockedByCurrentThread

Returns true if the current thread is holding an active connection to the database.

IsDbLockedByOtherThreads IsDbLockedByOtherThreads

Always returns false.

IsOpen IsOpen

Returns true if the database is currently open.

IsReadOnly IsReadOnly

Returns true if the database is opened as read only.

IsWriteAheadLoggingEnabled IsWriteAheadLoggingEnabled

Returns true if write-ahead logging has been enabled for this database.

JniIdentityHashCode JniIdentityHashCode Inherited from Object
JniPeerMembers JniPeerMembers
MaximumSize MaximumSize

Returns the maximum size the database may grow to.

PageSize PageSize

Returns the current database page size, in bytes.

Path Path

Gets the path to the database file.

PeerReference PeerReference Inherited from Object
SyncedTables SyncedTables

Deprecated.

ThresholdClass ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Version Version

Gets the database version.

Methods

AcquireReference() AcquireReference()

Acquires a reference to the object.

(Inherited from SQLiteClosable)
BeginTransaction() BeginTransaction()

Begins a transaction in EXCLUSIVE mode.

BeginTransactionNonExclusive() BeginTransactionNonExclusive()

Begins a transaction in IMMEDIATE mode.

BeginTransactionWithListener(ISQLiteTransactionListener) BeginTransactionWithListener(ISQLiteTransactionListener)

Begins a transaction in EXCLUSIVE mode.

BeginTransactionWithListenerNonExclusive(ISQLiteTransactionListener) BeginTransactionWithListenerNonExclusive(ISQLiteTransactionListener)

Begins a transaction in IMMEDIATE mode.

Clone() Clone()

Creates and returns a copy of this Object.

(Inherited from Object)
Close() Close()
CompileStatement(String) CompileStatement(String)

Compiles an SQL statement into a reusable pre-compiled statement object.

Create(SQLiteDatabase+ICursorFactory) Create(SQLiteDatabase+ICursorFactory)

Create a memory backed SQLite database.

CreateInMemory(SQLiteDatabase+OpenParams) CreateInMemory(SQLiteDatabase+OpenParams)
Delete(String, String, String[]) Delete(String, String, String[])

Convenience method for deleting rows in the database.

DeleteDatabase(File) DeleteDatabase(File)

Deletes a database including its journal file and other auxiliary files that may have been created by the database engine.

DisableWriteAheadLogging() DisableWriteAheadLogging()

This method disables the features enabled by EnableWriteAheadLogging().

Dispose() Dispose() Inherited from Object
Dispose(Boolean) Dispose(Boolean) Inherited from Object
EnableWriteAheadLogging() EnableWriteAheadLogging()

This method enables parallel execution of queries from multiple threads on the same database.

EndTransaction() EndTransaction()

End a transaction.

Equals(Object) Equals(Object)

Compares this instance with the specified object and indicates if they are equal.

(Inherited from Object)
ExecSQL(String) ExecSQL(String)

Execute a single SQL statement that is NOT a SELECT or any other SQL statement that returns data.

ExecSQL(String, Object[]) ExecSQL(String, Object[])

Execute a single SQL statement that is NOT a SELECT/INSERT/UPDATE/DELETE.

FindEditTable(String) FindEditTable(String)

Finds the name of the first table, which is editable.

GetHashCode() GetHashCode()

Returns an integer hash code for this object.

(Inherited from Object)
Insert(String, String, ContentValues) Insert(String, String, ContentValues)

Convenience method for inserting a row into the database.

InsertOrThrow(String, String, ContentValues) InsertOrThrow(String, String, ContentValues)

Convenience method for inserting a row into the database.

InsertWithOnConflict(String, String, ContentValues, Conflict) InsertWithOnConflict(String, String, ContentValues, Conflict)

General method for inserting a row into the database.

InTransaction() InTransaction()

Returns true if the current thread has a transaction pending.

JavaFinalize() JavaFinalize()

Invoked when the garbage collector has detected that this instance is no longer reachable.

(Inherited from Object)
MarkTableSyncable(String, String) MarkTableSyncable(String, String)

Mark this table as syncable.

MarkTableSyncable(String, String, String) MarkTableSyncable(String, String, String)

Mark this table as syncable, with the _sync_dirty residing in another table.

NeedUpgrade(Int32) NeedUpgrade(Int32)

Returns true if the new version code is greater than the current database version.

Notify() Notify()

Causes a thread which is waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
NotifyAll() NotifyAll()

Causes all threads which are waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
OnAllReferencesReleased() OnAllReferencesReleased()

Called when the last reference to the object was released by a call to ReleaseReference() or Close().

OnAllReferencesReleasedFromContainer() OnAllReferencesReleasedFromContainer()

Called when the last reference to the object was released by a call to ReleaseReferenceFromContainer().

(Inherited from SQLiteClosable)
OpenDatabase(File, SQLiteDatabase+OpenParams) OpenDatabase(File, SQLiteDatabase+OpenParams)
OpenDatabase(String, SQLiteDatabase+ICursorFactory, DatabaseOpenFlags) OpenDatabase(String, SQLiteDatabase+ICursorFactory, DatabaseOpenFlags)
OpenDatabase(String, SQLiteDatabase+ICursorFactory, DatabaseOpenFlags, IDatabaseErrorHandler) OpenDatabase(String, SQLiteDatabase+ICursorFactory, DatabaseOpenFlags, IDatabaseErrorHandler)
OpenOrCreateDatabase(File, SQLiteDatabase+ICursorFactory) OpenOrCreateDatabase(File, SQLiteDatabase+ICursorFactory)

Equivalent to openDatabase(file.getPath(), factory, CREATE_IF_NECESSARY).

OpenOrCreateDatabase(String, SQLiteDatabase+ICursorFactory) OpenOrCreateDatabase(String, SQLiteDatabase+ICursorFactory)

Equivalent to openDatabase(path, factory, CREATE_IF_NECESSARY).

OpenOrCreateDatabase(String, SQLiteDatabase+ICursorFactory, IDatabaseErrorHandler) OpenOrCreateDatabase(String, SQLiteDatabase+ICursorFactory, IDatabaseErrorHandler)

Equivalent to openDatabase(path, factory, CREATE_IF_NECESSARY, errorHandler).

Query(Boolean, String, String[], String, String[], String, String, String, String) Query(Boolean, String, String[], String, String[], String, String, String, String)

Query the given URL, returning a ICursor over the result set.

Query(Boolean, String, String[], String, String[], String, String, String, String, CancellationSignal) Query(Boolean, String, String[], String, String[], String, String, String, String, CancellationSignal)

Query the given URL, returning a ICursor over the result set.

Query(String, String[], String, String[], String, String, String) Query(String, String[], String, String[], String, String, String)

Query the given table, returning a ICursor over the result set.

Query(String, String[], String, String[], String, String, String, String) Query(String, String[], String, String[], String, String, String, String)

Query the given table, returning a ICursor over the result set.

QueryWithFactory(SQLiteDatabase+ICursorFactory, Boolean, String, String[], String, String[], String, String, String, String) QueryWithFactory(SQLiteDatabase+ICursorFactory, Boolean, String, String[], String, String[], String, String, String, String)

Query the given URL, returning a ICursor over the result set.

QueryWithFactory(SQLiteDatabase+ICursorFactory, Boolean, String, String[], String, String[], String, String, String, String, CancellationSignal) QueryWithFactory(SQLiteDatabase+ICursorFactory, Boolean, String, String[], String, String[], String, String, String, String, CancellationSignal)

Query the given URL, returning a ICursor over the result set.

RawQuery(String, String[]) RawQuery(String, String[])

Runs the provided SQL and returns a ICursor over the result set.

RawQuery(String, String[], CancellationSignal) RawQuery(String, String[], CancellationSignal)

Runs the provided SQL and returns a ICursor over the result set.

RawQueryWithFactory(SQLiteDatabase+ICursorFactory, String, String[], String) RawQueryWithFactory(SQLiteDatabase+ICursorFactory, String, String[], String)

Runs the provided SQL and returns a cursor over the result set.

RawQueryWithFactory(SQLiteDatabase+ICursorFactory, String, String[], String, CancellationSignal) RawQueryWithFactory(SQLiteDatabase+ICursorFactory, String, String[], String, CancellationSignal)

Runs the provided SQL and returns a cursor over the result set.

ReleaseMemory() ReleaseMemory()

Attempts to release memory that SQLite holds but does not require to operate properly.

ReleaseReference() ReleaseReference()

Releases a reference to the object, closing the object if the last reference was released.

(Inherited from SQLiteClosable)
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.

(Inherited from SQLiteClosable)
Replace(String, String, ContentValues) Replace(String, String, ContentValues)

Convenience method for replacing a row in the database.

ReplaceOrThrow(String, String, ContentValues) ReplaceOrThrow(String, String, ContentValues)

Convenience method for replacing a row in the database.

SetForeignKeyConstraintsEnabled(Boolean) SetForeignKeyConstraintsEnabled(Boolean)

Sets whether foreign key constraints are enabled for the database.

SetHandle(IntPtr, JniHandleOwnership) SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetLocale(Locale) SetLocale(Locale)

Sets the locale for this database.

SetLockingEnabled(Boolean) SetLockingEnabled(Boolean)

Control whether or not the SQLiteDatabase is made thread-safe by using locks around critical sections.

SetMaximumSize(Int64) SetMaximumSize(Int64)

Sets the maximum size the database will grow to.

SetMaxSqlCacheSize(Int32) SetMaxSqlCacheSize(Int32)

Sets the maximum size of the prepared-statement cache for this database. (size of the cache = number of compiled-sql-statements stored in the cache).

SetTransactionSuccessful() SetTransactionSuccessful()

Marks the current transaction as successful.

ToArray<T>() ToArray<T>() Inherited from Object
ToString() ToString()

Returns a string containing a concise, human-readable description of this object.

(Inherited from Object)
UnregisterFromRuntime() UnregisterFromRuntime() Inherited from Object
Update(String, ContentValues, String, String[]) Update(String, ContentValues, String, String[])

Convenience method for updating rows in the database.

UpdateWithOnConflict(String, ContentValues, String, String[], Conflict) UpdateWithOnConflict(String, ContentValues, String, String[], Conflict)

Convenience method for updating rows in the database.

ValidateSql(String, CancellationSignal) ValidateSql(String, CancellationSignal)
Wait() Wait()

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

(Inherited from Object)
Wait(Int64) Wait(Int64)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)
Wait(Int64, Int32) Wait(Int64, Int32)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)
YieldIfContended() YieldIfContended()

Temporarily end the transaction to let other threads run.

YieldIfContendedSafely() YieldIfContendedSafely()

Temporarily end the transaction to let other threads run.

YieldIfContendedSafely(Int64) YieldIfContendedSafely(Int64)

Temporarily end the transaction to let other threads run.

Explicit Interface Implementations

IJavaObjectEx.ToLocalJniHandle() IJavaObjectEx.ToLocalJniHandle() Inherited from Object
IJavaPeerable.Disposed() IJavaPeerable.Disposed() Inherited from Object
IJavaPeerable.DisposeUnlessReferenced() IJavaPeerable.DisposeUnlessReferenced() Inherited from Object
IJavaPeerable.Finalized() IJavaPeerable.Finalized() Inherited from Object
IJavaPeerable.SetJniIdentityHashCode(Int32) IJavaPeerable.SetJniIdentityHashCode(Int32) Inherited from Object
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) Inherited from Object
IJavaPeerable.SetPeerReference(JniObjectReference) IJavaPeerable.SetPeerReference(JniObjectReference) Inherited from Object

Extension Methods

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable) GetJniTypeName(IJavaPeerable)

Applies to