共用方式為


IPreparedStatement Interface

Definition

An object that represents a precompiled SQL statement.

[Android.Runtime.Register("java/sql/PreparedStatement", "", "Java.Sql.IPreparedStatementInvoker")]
public interface IPreparedStatement : IDisposable, Java.Interop.IJavaPeerable, Java.Sql.IStatement
[<Android.Runtime.Register("java/sql/PreparedStatement", "", "Java.Sql.IPreparedStatementInvoker")>]
type IPreparedStatement = interface
    interface IStatement
    interface IWrapper
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Derived
Attributes
Implements

Remarks

An object that represents a precompiled SQL statement.

A SQL statement is precompiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.

<B>Note:</B> The setter methods (setShort, setString, and so on) for setting IN parameter values must specify types that are compatible with the defined SQL type of the input parameter. For instance, if the IN parameter has SQL type INTEGER, then the method setInt should be used.

If arbitrary parameter type conversions are required, the method setObject should be used with a target SQL type.

In the following example of setting a parameter, con represents an active connection:

PreparedStatement pstmt = con.prepareStatement("UPDATE EMPLOYEES
                                                SET SALARY = ? WHERE ID = ?");
              pstmt.setBigDecimal(1, 153833.00)
              pstmt.setInt(2, 110592)

Java documentation for java.sql.PreparedStatement.

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

CloseAllResults

The constant indicating that all ResultSet objects that have previously been kept open should be closed when calling getMoreResults.

(Inherited from IStatement)
CloseCurrentResult

The constant indicating that the current ResultSet object should be closed when calling getMoreResults.

(Inherited from IStatement)
ExecuteFailed

The constant indicating that an error occured while executing a batch statement.

(Inherited from IStatement)
KeepCurrentResult

The constant indicating that the current ResultSet object should not be closed when calling getMoreResults.

(Inherited from IStatement)
NoGeneratedKeys

The constant indicating that generated keys should not be made available for retrieval.

(Inherited from IStatement)
ReturnGeneratedKeys

The constant indicating that generated keys should be made available for retrieval.

(Inherited from IStatement)
SuccessNoInfo

The constant indicating that a batch statement executed successfully but that no count of the number of rows it affected is available.

(Inherited from IStatement)

Properties

Connection

Gets the Connection object which created this statement.

(Inherited from IStatement)
FetchDirection

Gets the default direction for fetching rows for ResultSets generated from this statement.

(Inherited from IStatement)
FetchSize

Gets the default number of rows for a fetch for the ResultSet objects returned from this statement.

(Inherited from IStatement)
GeneratedKeys

Returns auto generated keys created by executing this statement.

(Inherited from IStatement)
Handle

Gets the JNI value of the underlying Android object.

(Inherited from IJavaObject)
IsClosed

Returns true if this statement has been closed, false otherwise.

(Inherited from IStatement)
JniIdentityHashCode

Returns the value of java.lang.System.identityHashCode() for the wrapped instance.

(Inherited from IJavaPeerable)
JniManagedPeerState

State of the managed peer.

(Inherited from IJavaPeerable)
JniPeerMembers

Member access and invocation support.

(Inherited from IJavaPeerable)
MaxFieldSize

Gets the maximum number of bytes which can be returned as values from character and binary type columns in a ResultSet derived from this statement.

(Inherited from IStatement)
MaxRows

Gets the maximum number of rows that a ResultSet can contain when produced from this statement.

(Inherited from IStatement)
MetaData

Returns a ResultSetMetaData describing the ResultSet that would be produced by execution of the PreparedStatement.

MoreResults

Moves to this statement's next result.

(Inherited from IStatement)
ParameterMetaData

Gets information about the parameters of the PreparedStatement.

PeerReference

Returns a JniObjectReference of the wrapped Java object instance.

(Inherited from IJavaPeerable)
Poolable

Returns true if this statement is poolable, false otherwise.

(Inherited from IStatement)
QueryTimeout

Gets the timeout value for the statement's execution time.

(Inherited from IStatement)
ResultSet

Gets the current result.

(Inherited from IStatement)
ResultSetConcurrency

Gets the concurrency setting for ResultSet objects generated by this statement.

(Inherited from IStatement)
ResultSetHoldability

Gets the cursor hold setting for ResultSet objects generated by this statement.

(Inherited from IStatement)
ResultSetType

Gets the ResultSet type setting for ResultSets derived from this statement.

(Inherited from IStatement)
UpdateCount

Gets an update count for the current result if it is not a ResultSet.

(Inherited from IStatement)
Warnings

Retrieves the first SQLWarning reported by calls on this statement.

(Inherited from IStatement)

Methods

AddBatch()

Adds a set of parameters to this PreparedStatement object's batch of commands.

AddBatch(String)

Adds the given SQL command to the current list of commmands for this Statement object.

(Inherited from IStatement)
Cancel()

Cancels this Statement object if both the DBMS and driver support aborting an SQL statement.

(Inherited from IStatement)
ClearBatch()

Empties this Statement object's current list of SQL commands.

(Inherited from IStatement)
ClearParameters()

Clears the current parameter values immediately.

ClearWarnings()

Clears all the warnings reported on this Statement object.

(Inherited from IStatement)
Close()

Releases this Statement object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.

(Inherited from IStatement)
Disposed()

Called when the instance has been disposed.

(Inherited from IJavaPeerable)
DisposeUnlessReferenced()

If there are no outstanding references to this instance, then calls Dispose(); otherwise, does nothing.

(Inherited from IJavaPeerable)
Execute()

Executes the SQL statement in this PreparedStatement object, which may be any kind of SQL statement.

Execute(String, Int32)

Executes the given SQL statement, which may return multiple results, and signals the driver that any auto-generated keys should be made available for retrieval.

(Inherited from IStatement)
Execute(String, Int32[])

Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.

(Inherited from IStatement)
Execute(String, String[])

Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.

(Inherited from IStatement)
Execute(String)

Executes the given SQL statement, which may return multiple results.

(Inherited from IStatement)
ExecuteBatch()

Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts.

(Inherited from IStatement)
ExecuteQuery()

Executes the SQL query in this PreparedStatement object and returns the ResultSet object generated by the query.

ExecuteQuery(String)

Executes the given SQL statement, which returns a single ResultSet object.

(Inherited from IStatement)
ExecuteUpdate()

Executes the SQL statement in this PreparedStatement object, which must be an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or DELETE; or an SQL statement that returns nothing, such as a DDL statement.

ExecuteUpdate(String, Int32)

Executes the given SQL statement and signals the driver with the given flag about whether the auto-generated keys produced by this Statement object should be made available for retrieval.

(Inherited from IStatement)
ExecuteUpdate(String, Int32[])

Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.

(Inherited from IStatement)
ExecuteUpdate(String, String[])

Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.

(Inherited from IStatement)
ExecuteUpdate(String)

Executes the given SQL statement, which may be an INSERT, UPDATE, or DELETE statement or an SQL statement that returns nothing, such as an SQL DDL statement.

(Inherited from IStatement)
Finalized()

Called when the instance has been finalized.

(Inherited from IJavaPeerable)
GetMoreResults(Int32)

Moves to this Statement object's next result, deals with any current ResultSet object(s) according to the instructions specified by the given flag, and returns true if the next result is a ResultSet object.

(Inherited from IStatement)
IsWrapperFor(Class)

Returns true if this either implements the interface argument or is directly or indirectly a wrapper for an object that does.

(Inherited from IWrapper)
SetArray(Int32, IArray)

Sets the designated parameter to the given java.sql.Array object.

SetAsciiStream(Int32, Stream, Int32)

Sets the designated parameter to the given input stream, which will have the specified number of bytes.

SetAsciiStream(Int32, Stream, Int64)

Sets the designated parameter to the given input stream, which will have the specified number of bytes.

SetAsciiStream(Int32, Stream)

Sets the designated parameter to the given input stream.

SetBigDecimal(Int32, BigDecimal)

Sets the designated parameter to the given java.math.BigDecimal value.

SetBinaryStream(Int32, Stream, Int32)

Sets the designated parameter to the given input stream, which will have the specified number of bytes.

SetBinaryStream(Int32, Stream, Int64)

Sets the designated parameter to the given input stream, which will have the specified number of bytes.

SetBinaryStream(Int32, Stream)

Sets the designated parameter to the given input stream.

SetBlob(Int32, IBlob)

Sets the designated parameter to the given java.sql.Blob object.

SetBlob(Int32, Stream, Int64)

Sets the designated parameter to a InputStream object.

SetBlob(Int32, Stream)

Sets the designated parameter to a InputStream object.

SetBoolean(Int32, Boolean)

Sets the designated parameter to the given Java boolean value.

SetByte(Int32, SByte)

Sets the designated parameter to the given Java byte value.

SetBytes(Int32, Byte[])

Sets the designated parameter to the given Java array of bytes.

SetCharacterStream(Int32, Reader, Int32)

Sets the designated parameter to the given Reader object, which is the given number of characters long.

SetCharacterStream(Int32, Reader, Int64)

Sets the designated parameter to the given Reader object, which is the given number of characters long.

SetCharacterStream(Int32, Reader)

Sets the designated parameter to the given Reader object.

SetClob(Int32, IClob)

Sets the designated parameter to the given java.sql.Clob object.

SetClob(Int32, Reader, Int64)

Sets the designated parameter to a Reader object.

SetClob(Int32, Reader)

Sets the designated parameter to a Reader object.

SetCursorName(String)

Sets the SQL cursor name to the given String, which will be used by subsequent Statement object execute methods.

(Inherited from IStatement)
SetDate(Int32, Date, Calendar)

Sets the designated parameter to the given java.sql.Date value, using the given Calendar object.

SetDate(Int32, Date)

Sets the designated parameter to the given java.sql.Date value using the default time zone of the virtual machine that is running the application.

SetDouble(Int32, Double)

Sets the designated parameter to the given Java double value.

SetEscapeProcessing(Boolean)

Sets escape processing on or off.

(Inherited from IStatement)
SetFloat(Int32, Single)

Sets the designated parameter to the given Java float value.

SetInt(Int32, Int32)

Sets the designated parameter to the given Java int value.

SetJniIdentityHashCode(Int32)

Set the value returned by JniIdentityHashCode.

(Inherited from IJavaPeerable)
SetJniManagedPeerState(JniManagedPeerStates) (Inherited from IJavaPeerable)
SetLong(Int32, Int64)

Sets the designated parameter to the given Java long value.

SetNCharacterStream(Int32, Reader, Int64)

Sets the designated parameter to a Reader object.

SetNCharacterStream(Int32, Reader)

Sets the designated parameter to a Reader object.

SetNClob(Int32, INClob)

Sets the designated parameter to a java.sql.NClob object.

SetNClob(Int32, Reader, Int64)

Sets the designated parameter to a Reader object.

SetNClob(Int32, Reader)

Sets the designated parameter to a Reader object.

SetNString(Int32, String)

Sets the designated paramter to the given String object.

SetNull(Int32, Int32, String)

Sets the designated parameter to SQL NULL.

SetNull(Int32, Int32)

Sets the designated parameter to SQL NULL.

SetObject(Int32, Object, Int32, Int32)

Sets the value of the designated parameter with the given object.

SetObject(Int32, Object, Int32)

Sets the value of the designated parameter with the given object.

SetObject(Int32, Object)

Sets the value of the designated parameter using the given object.

SetPeerReference(JniObjectReference)

Set the value returned by PeerReference.

(Inherited from IJavaPeerable)
SetRef(Int32, IRef)

Sets the designated parameter to the given REF(&lt;structured-type&gt;) value.

SetRowId(Int32, IRowId)

Sets the designated parameter to the given java.sql.RowId object.

SetShort(Int32, Int16)

Sets the designated parameter to the given Java short value.

SetSQLXML(Int32, ISQLXML)

Sets the designated parameter to the given java.sql.SQLXML object.

SetString(Int32, String)

Sets the designated parameter to the given Java String value.

SetTime(Int32, Time, Calendar)

Sets the designated parameter to the given java.sql.Time value, using the given Calendar object.

SetTime(Int32, Time)

Sets the designated parameter to the given java.sql.Time value.

SetTimestamp(Int32, Timestamp, Calendar)

Sets the designated parameter to the given java.sql.Timestamp value, using the given Calendar object.

SetTimestamp(Int32, Timestamp)

Sets the designated parameter to the given java.sql.Timestamp value.

SetUnicodeStream(Int32, Stream, Int32)
Obsolete.

Sets the designated parameter to the given input stream, which will have the specified number of bytes.

SetURL(Int32, URL)

Sets the designated parameter to the given java.net.URL value.

UnregisterFromRuntime()

Unregister this instance so that the runtime will not return it from future Java.Interop.JniRuntime+JniValueManager.PeekValue invocations.

(Inherited from IJavaPeerable)
Unwrap(Class)

Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy.

(Inherited from IWrapper)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to