Share via


SQLiteRawStatement Class

Definition

A SQLiteRawStatement represents a SQLite prepared statement.

[Android.Runtime.Register("android/database/sqlite/SQLiteRawStatement", ApiSince=35, DoNotGenerateAcw=true)]
public sealed class SQLiteRawStatement : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.IO.ICloseable
[<Android.Runtime.Register("android/database/sqlite/SQLiteRawStatement", ApiSince=35, DoNotGenerateAcw=true)>]
type SQLiteRawStatement = class
    inherit Object
    interface ICloseable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
SQLiteRawStatement
Attributes
Implements

Remarks

A SQLiteRawStatement represents a SQLite prepared statement. The methods correspond very closely to SQLite APIs that operate on a sqlite_stmt object. In general, each API in this class corresponds to a single SQLite API.

A SQLiteRawStatement must be created through a database, and there must be a transaction open at the time. Statements are implicitly closed when the outermost transaction ends, or if the current transaction is marked successful. Statements may be explicitly closed at any time with #close. The #close operation is idempotent and may be called multiple times without harm.

Multiple SQLiteRawStatements may be open simultaneously. They are independent of each other. Closing one statement does not affect any other statement nor does it have any effect on the enclosing transaction.

Once a SQLiteRawStatement has been closed, no further database operations are permitted on that statement. An IllegalStateException will be thrown if a database operation is attempted on a closed statement.

All operations on a SQLiteRawStatement must be invoked from the thread that created it. A IllegalStateException will be thrown if cross-thread use is detected.

A common pattern for statements is try-with-resources. <pre> // Begin a transaction. database.beginTransaction(); try (SQLiteRawStatement statement = database.createRawStatement("SELECT * FROM ...")) { while (statement.step()) { // Fetch columns from the result rows. } database.setTransactionSuccessful(); } finally { database.endTransaction(); } </pre> Note that SQLiteRawStatement is unrelated to SQLiteStatement.

Java documentation for android.database.sqlite.SQLiteRawStatement.

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.

Fields

SqliteDataTypeBlob
Obsolete.

The constant returned by #getColumnType when the column value is SQLITE_BLOB.

SqliteDataTypeFloat
Obsolete.

The constant returned by #getColumnType when the column value is SQLITE_FLOAT.

SqliteDataTypeInteger
Obsolete.

The constant returned by #getColumnType when the column value is SQLITE_INTEGER.

SqliteDataTypeNull
Obsolete.

The constant returned by #getColumnType when the column value is SQLITE_NULL.

SqliteDataTypeText
Obsolete.

The constant returned by #getColumnType when the column value is SQLITE_TEXT.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsOpen

Return true if the statement is still open and false otherwise.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
ParameterCount

Return the number of parameters in the statement.

PeerReference (Inherited from Object)
ResultColumnCount

Return the number of columns in the current result row.

ThresholdClass

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

(Inherited from Object)
ThresholdType

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

(Inherited from Object)

Methods

BindBlob(Int32, Byte[], Int32, Int32)

Bind a blob to a parameter.

BindBlob(Int32, Byte[])

Bind a blob to a parameter.

BindDouble(Int32, Double)

Bind a double to a parameter.

BindInt(Int32, Int32)

Bind an int to a parameter.

BindLong(Int32, Int64)

Bind a long to the parameter.

BindNull(Int32)

Bind a null to the parameter.

BindText(Int32, String)

Bind a string to the parameter.

ClearBindings()

Clear all parameter bindings.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Close()

Close the object and release any native resources.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetColumnBlob(Int32)

Return the column value of the result row as a blob.

GetColumnDouble(Int32)

Return the column value as a double.

GetColumnInt(Int32)

Return the column value as a int.

GetColumnLength(Int32)

Return the length of the column value in the result row.

GetColumnLong(Int32)

Return the column value as a long.

GetColumnName(Int32)

Return the name of the column in the result row.

GetColumnText(Int32)

Return the column value as a text.

GetColumnType(Int32)

Return the type of the column in the result row.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetParameterIndex(String)

Return the index of the parameter with specified name.

GetParameterName(Int32)

Return the name of the parameter at the specified index.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
ReadColumnBlob(Int32, Byte[], Int32, Int32, Int32)

Copy the column value of the result row, interpreted as a blob, into the buffer.

Reset()

Reset the statement.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
Step()

Step to the next result row.

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

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

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

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Gets the JNI name of the type of the instance self.

JavaAs<TResult>(IJavaPeerable)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

TryJavaCast<TResult>(IJavaPeerable, TResult)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

Applies to