| java.lang.Object com.mysql.jdbc.StatementImpl com.mysql.jdbc.PreparedStatement
PreparedStatement | public class PreparedStatement extends com.mysql.jdbc.StatementImpl implements java.sql.PreparedStatement(Code) | | A SQL Statement is pre-compiled and stored in a PreparedStatement object.
This object can then be used to efficiently execute this statement multiple
times.
Note: The setXXX methods 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 setInt should be
used.
If arbitrary parameter type conversions are required, then the setObject
method should be used with a target SQL type.
author: Mark Matthews version: $Id: PreparedStatement.java,v 1.1.2.1 2005/05/13 18:58:38 mmatthews version: Exp $ See Also: java.sql.ResultSet See Also: java.sql.PreparedStatement |
Inner Class :class BatchParams | |
Inner Class :class EndPoint | |
Inner Class :class ParseInfo | |
Method Summary | |
public void | addBatch() JDBC 2.0 Add a set of parameters to the batch. | public synchronized void | addBatch(String sql) | protected String | asSql() | protected String | asSql(boolean quoteStreamsAndUnknowns) | public synchronized boolean | canRewriteAsMultivalueInsertStatement() | public synchronized void | clearBatch() | public synchronized void | clearParameters() In general, parameter values remain in force for repeated used of a
Statement. | public synchronized void | close() Closes this prepared statement and releases all resources. | protected int | computeBatchSize(int numBatchedArgs) Computes the optimum number of batched parameter lists to send
without overflowing max_allowed_packet. | protected long[] | computeMaxParameterSetSizeAndBatchSize(int numBatchedArgs) Computes the maximum parameter set size, and entire batch size given
the number of arguments in the batch. | public boolean | execute() | public int[] | executeBatch() JDBC 2.0 Submit a batch of commands to the database for execution. | protected int[] | executeBatchSerially(int batchTimeout) Executes the current batch of statements by executing them one-by-one. | protected int[] | executeBatchedInserts(int batchTimeout) Rewrites the already prepared statement into a multi-value insert
statement of 'statementsPerBatch' values and executes the entire batch
using this new statement. | protected ResultSetInternalMethods | executeInternal(int maxRowsToRetrieve, Buffer sendPacket, boolean createStreamingResultSet, boolean queryIsSelectOnly, Field[] metadataFromCache, boolean isBatch) Actually execute the prepared statement. | protected int[] | executePreparedBatchAsMultiStatement(int batchTimeout) Rewrites the already prepared statement into a multi-statement
query of 'statementsPerBatch' values and executes the entire batch
using this new statement. | public java.sql.ResultSet | executeQuery() | public int | executeUpdate() Execute a SQL INSERT, UPDATE or DELETE statement. | protected int | executeUpdate(boolean clearBatchedGeneratedKeysAndWarnings, boolean isBatch) | protected int | executeUpdate(byte[][] batchedParameterStrings, InputStream[] batchedParameterStreams, boolean[] batchedIsStream, int[] batchedStreamLengths, boolean[] batchedIsNull, boolean isReallyBatch) | protected Buffer | fillSendPacket() Creates the packet that contains the query to be sent to the server. | protected Buffer | fillSendPacket(byte[][] batchedParameterStrings, InputStream[] batchedParameterStreams, boolean[] batchedIsStream, int[] batchedStreamLengths) Creates the packet that contains the query to be sent to the server. | public byte[] | getBytesRepresentation(int parameterIndex) | protected static PreparedStatement | getInstance(ConnectionImpl conn, String catalog) Creates a prepared statement instance -- We need to provide factory-style
methods so we can support both JDBC3 (and older) and JDBC4 runtimes,
otherwise the class verifier complains when it tries to load JDBC4-only
interface classes that are present in JDBC4 method signatures. | protected static PreparedStatement | getInstance(ConnectionImpl conn, String sql, String catalog) Creates a prepared statement instance -- We need to provide factory-style
methods so we can support both JDBC3 (and older) and JDBC4 runtimes,
otherwise the class verifier complains when it tries to load JDBC4-only
interface classes that are present in JDBC4 method signatures. | protected static PreparedStatement | getInstance(ConnectionImpl conn, String sql, String catalog, ParseInfo cachedParseInfo) Creates a prepared statement instance -- We need to provide factory-style
methods so we can support both JDBC3 (and older) and JDBC4 runtimes,
otherwise the class verifier complains when it tries to load JDBC4-only
interface classes that are present in JDBC4 method signatures. | public java.sql.ResultSetMetaData | getMetaData() The number, types and properties of a ResultSet's columns are provided by
the getMetaData method. | public ParameterBindings | getParameterBindings() | protected int | getParameterIndexOffset() | public ParameterMetaData | getParameterMetaData() | ParseInfo | getParseInfo() | public synchronized boolean | isClosed() | boolean | isNull(int paramIndex) | protected boolean | isSelectQuery() | protected static int | readFully(Reader reader, char[] buf, int length) Reads length bytes from reader into buf. | protected void | realClose(boolean calledExplicitly, boolean closeOpenResults) | public void | setArray(int i, Array x) JDBC 2.0 Set an Array parameter. | public void | setAsciiStream(int parameterIndex, InputStream x, int length) When a very large ASCII value is input to a LONGVARCHAR parameter, it may
be more practical to send it via a java.io.InputStream. | public void | setAsciiStream(int parameterIndex, InputStream x) | public void | setAsciiStream(int parameterIndex, InputStream x, long length) | public void | setBigDecimal(int parameterIndex, BigDecimal x) Set a parameter to a java.math.BigDecimal value. | public void | setBinaryStream(int parameterIndex, InputStream x, int length) When a very large binary value is input to a LONGVARBINARY parameter, it
may be more practical to send it via a java.io.InputStream. | public void | setBinaryStream(int parameterIndex, InputStream x) | public void | setBinaryStream(int parameterIndex, InputStream x, long length) | public void | setBlob(int parameterIndex, InputStream inputStream, long length) | public void | setBlob(int i, java.sql.Blob x) JDBC 2.0 Set a BLOB parameter. | public void | setBlob(int parameterIndex, InputStream inputStream) | public void | setBoolean(int parameterIndex, boolean x) Set a parameter to a Java boolean value. | public void | setByte(int parameterIndex, byte x) Set a parameter to a Java byte value. | public void | setBytes(int parameterIndex, byte[] x) Set a parameter to a Java array of bytes. | protected void | setBytes(int parameterIndex, byte[] x, boolean checkForIntroducer, boolean escapeForMBChars) | protected void | setBytesNoEscape(int parameterIndex, byte[] parameterAsBytes) Used by updatable result sets for refreshRow() because the parameter has
already been escaped for updater or inserter prepared statements. | protected void | setBytesNoEscapeNoQuotes(int parameterIndex, byte[] parameterAsBytes) | public void | setCharacterStream(int parameterIndex, java.io.Reader reader, int length) JDBC 2.0 When a very large UNICODE value is input to a LONGVARCHAR
parameter, it may be more practical to send it via a java.io.Reader. | public void | setCharacterStream(int parameterIndex, Reader reader) | public void | setCharacterStream(int parameterIndex, Reader reader, long length) | public void | setClob(int i, Clob x) JDBC 2.0 Set a CLOB parameter. | public void | setClob(int parameterIndex, Reader reader) | public void | setClob(int parameterIndex, Reader reader, long length) | public void | setDate(int parameterIndex, java.sql.Date x) Set a parameter to a java.sql.Date value. | public void | setDate(int parameterIndex, java.sql.Date x, Calendar cal) Set a parameter to a java.sql.Date value. | public void | setDouble(int parameterIndex, double x) Set a parameter to a Java double value. | public void | setFloat(int parameterIndex, float x) Set a parameter to a Java float value. | public void | setInt(int parameterIndex, int x) Set a parameter to a Java int value. | final protected void | setInternal(int paramIndex, byte[] val) | final protected void | setInternal(int paramIndex, String val) | public void | setLong(int parameterIndex, long x) Set a parameter to a Java long value. | public void | setNCharacterStream(int parameterIndex, Reader value) | public void | setNCharacterStream(int parameterIndex, Reader reader, long length) JDBC 2.0 When a very large UNICODE value is input to a LONGVARCHAR
parameter, it may be more practical to send it via a java.io.Reader. | public void | setNClob(int parameterIndex, Reader reader) | public void | setNClob(int parameterIndex, Reader reader, long length) JDBC 4.0 Set a NCLOB parameter. | public void | setNString(int parameterIndex, String x) Set a parameter to a Java String value. | public void | setNull(int parameterIndex, int sqlType) | public void | setNull(int parameterIndex, int sqlType, String arg) Set a parameter to SQL NULL. | public void | setObject(int parameterIndex, Object parameterObj) | public void | setObject(int parameterIndex, Object parameterObj, int targetSqlType) | public void | setObject(int parameterIndex, Object parameterObj, int targetSqlType, int scale) Set the value of a parameter using an object; use the java.lang
equivalent objects for integral values.
The given Java object will be converted to the targetSqlType before being
sent to the database.
note that this method may be used to pass database-specific abstract data
types. | protected int | setOneBatchedParameterSet(java.sql.PreparedStatement batchedStatement, int batchedParamIndex, Object paramSet) | public void | setRef(int i, Ref x) JDBC 2.0 Set a REF(<structured-type>) parameter. | void | setResultSetConcurrency(int concurrencyFlag) | void | setResultSetType(int typeFlag) | protected void | setRetrieveGeneratedKeys(boolean retrieveGeneratedKeys) | public void | setShort(int parameterIndex, short x) Set a parameter to a Java short value. | public void | setString(int parameterIndex, String x) Set a parameter to a Java String value. | public void | setTime(int parameterIndex, java.sql.Time x, Calendar cal) Set a parameter to a java.sql.Time value. | public void | setTime(int parameterIndex, Time x) Set a parameter to a java.sql.Time value. | public void | setTimestamp(int parameterIndex, java.sql.Timestamp x, Calendar cal) Set a parameter to a java.sql.Timestamp value. | public void | setTimestamp(int parameterIndex, Timestamp x) Set a parameter to a java.sql.Timestamp value. | public void | setURL(int parameterIndex, URL arg) | public void | setUnicodeStream(int parameterIndex, InputStream x, int length) When a very large Unicode value is input to a LONGVARCHAR parameter, it
may be more practical to send it via a java.io.InputStream. | public String | toString() Returns this PreparedStatement represented as a string. |
batchHasPlainStatements | protected boolean batchHasPlainStatements(Code) | | Does the batch (if any) contain "plain" statements added by
Statement.addBatch(String)?
If so, we can't re-write it to use multi-value or multi-queries.
|
batchedValuesClause | protected String batchedValuesClause(Code) | | |
firstCharOfStmt | protected char firstCharOfStmt(Code) | | What is the first character of the prepared statement (used to check for
SELECT vs. INSERT/UPDATE/DELETE)
|
hasLimitClause | protected boolean hasLimitClause(Code) | | Does the SQL for this statement contain a 'limit' clause?
|
isLoadDataQuery | protected boolean isLoadDataQuery(Code) | | Is this query a LOAD DATA query?
|
numberOfExecutions | protected int numberOfExecutions(Code) | | |
originalSql | protected String originalSql(Code) | | The SQL that was passed in to 'prepare'
|
parameterCount | protected int parameterCount(Code) | | The number of parameters in this PreparedStatement
|
parameterTypes | protected int[] parameterTypes(Code) | | Only used by statement interceptors at the moment to
provide introspection of bound values
|
useTrueBoolean | protected boolean useTrueBoolean(Code) | | Are we using a version of MySQL where we can use 'true' boolean values?
|
usingAnsiMode | protected boolean usingAnsiMode(Code) | | |
PreparedStatement | public PreparedStatement(ConnectionImpl conn, String catalog) throws SQLException(Code) | | Constructor used by server-side prepared statements
Parameters: conn - the connection that created us Parameters: catalog - the catalog in use when we were created throws: SQLException - if an error occurs |
PreparedStatement | public PreparedStatement(ConnectionImpl conn, String sql, String catalog) throws SQLException(Code) | | Constructor for the PreparedStatement class.
Parameters: conn - the connection creating this statement Parameters: sql - the SQL for this statement Parameters: catalog - the catalog/database this statement should be issued against throws: SQLException - if a database error occurs. |
PreparedStatement | public PreparedStatement(ConnectionImpl conn, String sql, String catalog, ParseInfo cachedParseInfo) throws SQLException(Code) | | Creates a new PreparedStatement object.
Parameters: conn - the connection creating this statement Parameters: sql - the SQL for this statement Parameters: catalog - the catalog/database this statement should be issued against Parameters: cachedParseInfo - already created parseInfo. throws: SQLException - DOCUMENT ME! |
canRewriteAsMultivalueInsertStatement | public synchronized boolean canRewriteAsMultivalueInsertStatement()(Code) | | |
clearParameters | public synchronized void clearParameters() throws SQLException(Code) | | In general, parameter values remain in force for repeated used of a
Statement. Setting a parameter value automatically clears its previous
value. However, in some cases, it is useful to immediately release the
resources used by the current parameter values; this can be done by
calling clearParameters
exception: SQLException - if a database access error occurs |
close | public synchronized void close() throws SQLException(Code) | | Closes this prepared statement and releases all resources.
throws: SQLException - if database error occurs. |
computeBatchSize | protected int computeBatchSize(int numBatchedArgs)(Code) | | Computes the optimum number of batched parameter lists to send
without overflowing max_allowed_packet.
Parameters: numBatchedArgs - |
computeMaxParameterSetSizeAndBatchSize | protected long[] computeMaxParameterSetSizeAndBatchSize(int numBatchedArgs)(Code) | | Computes the maximum parameter set size, and entire batch size given
the number of arguments in the batch.
|
execute | public boolean execute() throws SQLException(Code) | | Some prepared statements return multiple results; the execute method
handles these complex statements as well as the simpler form of
statements handled by executeQuery and executeUpdate
true if the next result is a ResultSet; false if it is an updatecount or there are no more results exception: SQLException - if a database access error occurs |
executeBatch | public int[] executeBatch() throws SQLException(Code) | | JDBC 2.0 Submit a batch of commands to the database for execution. This
method is optional.
an array of update counts containing one element for each commandin the batch. The array is ordered according to the order inwhich commands were inserted into the batch exception: SQLException - if a database-access error occurs, or the driver does notsupport batch statements throws: java.sql.BatchUpdateException - DOCUMENT ME! |
executeBatchSerially | protected int[] executeBatchSerially(int batchTimeout) throws SQLException(Code) | | Executes the current batch of statements by executing them one-by-one.
a list of update counts throws: SQLException - if an error occurs |
executeBatchedInserts | protected int[] executeBatchedInserts(int batchTimeout) throws SQLException(Code) | | Rewrites the already prepared statement into a multi-value insert
statement of 'statementsPerBatch' values and executes the entire batch
using this new statement.
update counts in the same fashion as executeBatch() throws: SQLException - |
executeInternal | protected ResultSetInternalMethods executeInternal(int maxRowsToRetrieve, Buffer sendPacket, boolean createStreamingResultSet, boolean queryIsSelectOnly, Field[] metadataFromCache, boolean isBatch) throws SQLException(Code) | | Actually execute the prepared statement. This is here so server-side
PreparedStatements can re-use most of the code from this class.
Parameters: maxRowsToRetrieve - the max number of rows to return Parameters: sendPacket - the packet to send Parameters: createStreamingResultSet - should a 'streaming' result set be created? Parameters: queryIsSelectOnly - is this query doing a SELECT? Parameters: unpackFields - DOCUMENT ME! the results as a ResultSet throws: SQLException - if an error occurs. |
executePreparedBatchAsMultiStatement | protected int[] executePreparedBatchAsMultiStatement(int batchTimeout) throws SQLException(Code) | | Rewrites the already prepared statement into a multi-statement
query of 'statementsPerBatch' values and executes the entire batch
using this new statement.
update counts in the same fashion as executeBatch() throws: SQLException - |
executeQuery | public java.sql.ResultSet executeQuery() throws SQLException(Code) | | A Prepared SQL query is executed and its ResultSet is returned
a ResultSet that contains the data produced by the query - nevernull exception: SQLException - if a database access error occurs |
executeUpdate | public int executeUpdate() throws SQLException(Code) | | Execute a SQL INSERT, UPDATE or DELETE statement. In addition, SQL
statements that return nothing such as SQL DDL statements can be
executed.
either the row count for INSERT, UPDATE or DELETE; or 0 for SQLstatements that return nothing. exception: SQLException - if a database access error occurs |
executeUpdate | protected int executeUpdate(boolean clearBatchedGeneratedKeysAndWarnings, boolean isBatch) throws SQLException(Code) | | |
executeUpdate | protected int executeUpdate(byte[][] batchedParameterStrings, InputStream[] batchedParameterStreams, boolean[] batchedIsStream, int[] batchedStreamLengths, boolean[] batchedIsNull, boolean isReallyBatch) throws SQLException(Code) | | Added to allow batch-updates
Parameters: batchedParameterStrings - string values used in single statement Parameters: batchedParameterStreams - stream values used in single statement Parameters: batchedIsStream - flags for streams used in single statement Parameters: batchedStreamLengths - lengths of streams to be read. Parameters: batchedIsNull - flags for parameters that are null the update count throws: SQLException - if a database error occurs |
fillSendPacket | protected Buffer fillSendPacket() throws SQLException(Code) | | Creates the packet that contains the query to be sent to the server.
A Buffer filled with the query representing thePreparedStatement. throws: SQLException - if an error occurs. |
fillSendPacket | protected Buffer fillSendPacket(byte[][] batchedParameterStrings, InputStream[] batchedParameterStreams, boolean[] batchedIsStream, int[] batchedStreamLengths) throws SQLException(Code) | | Creates the packet that contains the query to be sent to the server.
Parameters: batchedParameterStrings - the parameters as strings Parameters: batchedParameterStreams - the parameters as streams Parameters: batchedIsStream - is the given parameter a stream? Parameters: batchedStreamLengths - the lengths of the streams (if appropriate) a Buffer filled with the query that represents this statement throws: SQLException - if an error occurs. |
getBytesRepresentation | public byte[] getBytesRepresentation(int parameterIndex) throws SQLException(Code) | | DOCUMENT ME!
Parameters: parameterIndex - DOCUMENT ME! DOCUMENT ME! throws: SQLException - DOCUMENT ME! |
getInstance | protected static PreparedStatement getInstance(ConnectionImpl conn, String catalog) throws SQLException(Code) | | Creates a prepared statement instance -- We need to provide factory-style
methods so we can support both JDBC3 (and older) and JDBC4 runtimes,
otherwise the class verifier complains when it tries to load JDBC4-only
interface classes that are present in JDBC4 method signatures.
|
getInstance | protected static PreparedStatement getInstance(ConnectionImpl conn, String sql, String catalog) throws SQLException(Code) | | Creates a prepared statement instance -- We need to provide factory-style
methods so we can support both JDBC3 (and older) and JDBC4 runtimes,
otherwise the class verifier complains when it tries to load JDBC4-only
interface classes that are present in JDBC4 method signatures.
|
getInstance | protected static PreparedStatement getInstance(ConnectionImpl conn, String sql, String catalog, ParseInfo cachedParseInfo) throws SQLException(Code) | | Creates a prepared statement instance -- We need to provide factory-style
methods so we can support both JDBC3 (and older) and JDBC4 runtimes,
otherwise the class verifier complains when it tries to load JDBC4-only
interface classes that are present in JDBC4 method signatures.
|
getMetaData | public java.sql.ResultSetMetaData getMetaData() throws SQLException(Code) | | The number, types and properties of a ResultSet's columns are provided by
the getMetaData method.
the description of a ResultSet's columns exception: SQLException - if a database-access error occurs. |
getParameterIndexOffset | protected int getParameterIndexOffset()(Code) | | For calling stored functions, this will be -1 as we don't really count
the first '?' parameter marker, it's only syntax, but JDBC counts it
as #1, otherwise it will return 0
|
getParseInfo | ParseInfo getParseInfo()(Code) | | |
isNull | boolean isNull(int paramIndex)(Code) | | |
isSelectQuery | protected boolean isSelectQuery()(Code) | | |
readFully | protected static int readFully(Reader reader, char[] buf, int length) throws IOException(Code) | | Reads length bytes from reader into buf. Blocks until enough input is
available
Parameters: reader - DOCUMENT ME! Parameters: buf - DOCUMENT ME! Parameters: length - DOCUMENT ME! DOCUMENT ME! throws: IOException - DOCUMENT ME! |
realClose | protected void realClose(boolean calledExplicitly, boolean closeOpenResults) throws SQLException(Code) | | Closes this statement, releasing all resources
Parameters: calledExplicitly - was this called by close()? throws: SQLException - if an error occurs |
setArray | public void setArray(int i, Array x) throws SQLException(Code) | | JDBC 2.0 Set an Array parameter.
Parameters: i - the first parameter is 1, the second is 2, ... Parameters: x - an object representing an SQL array throws: SQLException - because this method is not implemented. throws: NotImplemented - DOCUMENT ME! |
setAsciiStream | public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException(Code) | | When a very large ASCII value is input to a LONGVARCHAR parameter, it may
be more practical to send it via a java.io.InputStream. JDBC will read
the data from the stream as needed, until it reaches end-of-file. The
JDBC driver will do any necessary conversion from ASCII to the database
char format.
Note: This stream object can either be a standard Java stream
object or your own subclass that implements the standard interface.
Parameters: parameterIndex - the first parameter is 1... Parameters: x - the parameter value Parameters: length - the number of bytes in the stream exception: SQLException - if a database access error occurs |
setBigDecimal | public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException(Code) | | Set a parameter to a java.math.BigDecimal value. The driver converts this
to a SQL NUMERIC value when it sends it to the database.
Parameters: parameterIndex - the first parameter is 1... Parameters: x - the parameter value exception: SQLException - if a database access error occurs |
setBinaryStream | public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException(Code) | | When a very large binary value is input to a LONGVARBINARY parameter, it
may be more practical to send it via a java.io.InputStream. JDBC will
read the data from the stream as needed, until it reaches end-of-file.
Note: This stream object can either be a standard Java stream
object or your own subclass that implements the standard interface.
Parameters: parameterIndex - the first parameter is 1... Parameters: x - the parameter value Parameters: length - the number of bytes to read from the stream (ignored) throws: SQLException - if a database access error occurs |
setBlob | public void setBlob(int i, java.sql.Blob x) throws SQLException(Code) | | JDBC 2.0 Set a BLOB parameter.
Parameters: i - the first parameter is 1, the second is 2, ... Parameters: x - an object representing a BLOB throws: SQLException - if a database error occurs |
setBoolean | public void setBoolean(int parameterIndex, boolean x) throws SQLException(Code) | | Set a parameter to a Java boolean value. The driver converts this to a
SQL BIT value when it sends it to the database.
Parameters: parameterIndex - the first parameter is 1... Parameters: x - the parameter value throws: SQLException - if a database access error occurs |
setByte | public void setByte(int parameterIndex, byte x) throws SQLException(Code) | | Set a parameter to a Java byte value. The driver converts this to a SQL
TINYINT value when it sends it to the database.
Parameters: parameterIndex - the first parameter is 1... Parameters: x - the parameter value exception: SQLException - if a database access error occurs |
setBytes | public void setBytes(int parameterIndex, byte[] x) throws SQLException(Code) | | Set a parameter to a Java array of bytes. The driver converts this to a
SQL VARBINARY or LONGVARBINARY (depending on the argument's size relative
to the driver's limits on VARBINARYs) when it sends it to the database.
Parameters: parameterIndex - the first parameter is 1... Parameters: x - the parameter value exception: SQLException - if a database access error occurs |
setBytes | protected void setBytes(int parameterIndex, byte[] x, boolean checkForIntroducer, boolean escapeForMBChars) throws SQLException(Code) | | |
setBytesNoEscape | protected void setBytesNoEscape(int parameterIndex, byte[] parameterAsBytes) throws SQLException(Code) | | Used by updatable result sets for refreshRow() because the parameter has
already been escaped for updater or inserter prepared statements.
Parameters: parameterIndex - the parameter to set. Parameters: parameterAsBytes - the parameter as a string. throws: SQLException - if an error occurs |
setBytesNoEscapeNoQuotes | protected void setBytesNoEscapeNoQuotes(int parameterIndex, byte[] parameterAsBytes) throws SQLException(Code) | | |
setCharacterStream | public void setCharacterStream(int parameterIndex, java.io.Reader reader, int length) throws SQLException(Code) | | JDBC 2.0 When a very large UNICODE value is input to a LONGVARCHAR
parameter, it may be more practical to send it via a java.io.Reader. JDBC
will read the data from the stream as needed, until it reaches
end-of-file. The JDBC driver will do any necessary conversion from
UNICODE to the database char format.
Note: This stream object can either be a standard Java stream
object or your own subclass that implements the standard interface.
Parameters: parameterIndex - the first parameter is 1, the second is 2, ... Parameters: reader - the java reader which contains the UNICODE data Parameters: length - the number of characters in the stream exception: SQLException - if a database-access error occurs. |
setCharacterStream | public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException(Code) | | |
setClob | public void setClob(int i, Clob x) throws SQLException(Code) | | JDBC 2.0 Set a CLOB parameter.
Parameters: i - the first parameter is 1, the second is 2, ... Parameters: x - an object representing a CLOB throws: SQLException - if a database error occurs |
setDate | public void setDate(int parameterIndex, java.sql.Date x) throws java.sql.SQLException(Code) | | Set a parameter to a java.sql.Date value. The driver converts this to a
SQL DATE value when it sends it to the database.
Parameters: parameterIndex - the first parameter is 1... Parameters: x - the parameter value exception: java.sql.SQLException - if a database access error occurs |
setDate | public void setDate(int parameterIndex, java.sql.Date x, Calendar cal) throws SQLException(Code) | | Set a parameter to a java.sql.Date value. The driver converts this to a
SQL DATE value when it sends it to the database.
Parameters: parameterIndex - the first parameter is 1, the second is 2, ... Parameters: x - the parameter value Parameters: cal - the calendar to interpret the date with exception: SQLException - if a database-access error occurs. |
setDouble | public void setDouble(int parameterIndex, double x) throws SQLException(Code) | | Set a parameter to a Java double value. The driver converts this to a SQL
DOUBLE value when it sends it to the database
Parameters: parameterIndex - the first parameter is 1... Parameters: x - the parameter value exception: SQLException - if a database access error occurs |
setFloat | public void setFloat(int parameterIndex, float x) throws SQLException(Code) | | Set a parameter to a Java float value. The driver converts this to a SQL
FLOAT value when it sends it to the database.
Parameters: parameterIndex - the first parameter is 1... Parameters: x - the parameter value exception: SQLException - if a database access error occurs |
setInt | public void setInt(int parameterIndex, int x) throws SQLException(Code) | | Set a parameter to a Java int value. The driver converts this to a SQL
INTEGER value when it sends it to the database.
Parameters: parameterIndex - the first parameter is 1... Parameters: x - the parameter value exception: SQLException - if a database access error occurs |
setInternal | final protected void setInternal(int paramIndex, byte[] val) throws SQLException(Code) | | |
setLong | public void setLong(int parameterIndex, long x) throws SQLException(Code) | | Set a parameter to a Java long value. The driver converts this to a SQL
BIGINT value when it sends it to the database.
Parameters: parameterIndex - the first parameter is 1... Parameters: x - the parameter value exception: SQLException - if a database access error occurs |
setNCharacterStream | public void setNCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException(Code) | | JDBC 2.0 When a very large UNICODE value is input to a LONGVARCHAR
parameter, it may be more practical to send it via a java.io.Reader. JDBC
will read the data from the stream as needed, until it reaches
end-of-file. The JDBC driver will do any necessary conversion from
UNICODE to the database char format.
Note: This stream object can either be a standard Java stream
object or your own subclass that implements the standard interface.
Parameters: parameterIndex - the first parameter is 1, the second is 2, ... Parameters: reader - the java reader which contains the UNICODE data Parameters: length - the number of characters in the stream exception: SQLException - if a database-access error occurs. |
setNClob | public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException(Code) | | JDBC 4.0 Set a NCLOB parameter.
Parameters: parameterIndex - the first parameter is 1, the second is 2, ... Parameters: reader - the java reader which contains the UNICODE data Parameters: length - the number of characters in the stream throws: SQLException - if a database error occurs |
setNString | public void setNString(int parameterIndex, String x) throws SQLException(Code) | | Set a parameter to a Java String value. The driver converts this to a SQL
VARCHAR or LONGVARCHAR value with introducer _utf8 (depending on the
arguments size relative to the driver's limits on VARCHARs) when it sends
it to the database. If charset is set as utf8, this method just call setString.
Parameters: parameterIndex - the first parameter is 1... Parameters: x - the parameter value exception: SQLException - if a database access error occurs |
setNull | public void setNull(int parameterIndex, int sqlType) throws SQLException(Code) | | Set a parameter to SQL NULL
Note: You must specify the parameters SQL type (although MySQL
ignores it)
Parameters: parameterIndex - the first parameter is 1, etc... Parameters: sqlType - the SQL type code defined in java.sql.Types exception: SQLException - if a database access error occurs |
setNull | public void setNull(int parameterIndex, int sqlType, String arg) throws SQLException(Code) | | Set a parameter to SQL NULL.
Note: You must specify the parameter's SQL type.
Parameters: parameterIndex - the first parameter is 1, the second is 2, ... Parameters: sqlType - SQL type code defined by java.sql.Types Parameters: arg - argument parameters for null exception: SQLException - if a database-access error occurs. |
setObject | public void setObject(int parameterIndex, Object parameterObj) throws SQLException(Code) | | DOCUMENT ME!
Parameters: parameterIndex - DOCUMENT ME! Parameters: parameterObj - DOCUMENT ME! throws: SQLException - DOCUMENT ME! |
setObject | public void setObject(int parameterIndex, Object parameterObj, int targetSqlType) throws SQLException(Code) | | DOCUMENT ME!
Parameters: parameterIndex - DOCUMENT ME! Parameters: parameterObj - DOCUMENT ME! Parameters: targetSqlType - DOCUMENT ME! throws: SQLException - DOCUMENT ME! |
setObject | public void setObject(int parameterIndex, Object parameterObj, int targetSqlType, int scale) throws SQLException(Code) | | Set the value of a parameter using an object; use the java.lang
equivalent objects for integral values.
The given Java object will be converted to the targetSqlType before being
sent to the database.
note that this method may be used to pass database-specific abstract data
types. This is done by using a Driver-specific Java type and using a
targetSqlType of java.sql.Types.OTHER
Parameters: parameterIndex - the first parameter is 1... Parameters: parameterObj - the object containing the input parameter value Parameters: targetSqlType - The SQL type to be send to the database Parameters: scale - For java.sql.Types.DECIMAL or java.sql.Types.NUMERIC typesthis is the number of digits after the decimal. For all othertypes this value will be ignored. throws: SQLException - if a database access error occurs |
setRef | public void setRef(int i, Ref x) throws SQLException(Code) | | JDBC 2.0 Set a REF(<structured-type>) parameter.
Parameters: i - the first parameter is 1, the second is 2, ... Parameters: x - an object representing data of an SQL REF Type throws: SQLException - if a database error occurs throws: NotImplemented - DOCUMENT ME! |
setResultSetConcurrency | void setResultSetConcurrency(int concurrencyFlag)(Code) | | Sets the concurrency for result sets generated by this statement
Parameters: concurrencyFlag - DOCUMENT ME! |
setResultSetType | void setResultSetType(int typeFlag)(Code) | | Sets the result set type for result sets generated by this statement
Parameters: typeFlag - DOCUMENT ME! |
setRetrieveGeneratedKeys | protected void setRetrieveGeneratedKeys(boolean retrieveGeneratedKeys)(Code) | | DOCUMENT ME!
Parameters: retrieveGeneratedKeys - |
setShort | public void setShort(int parameterIndex, short x) throws SQLException(Code) | | Set a parameter to a Java short value. The driver converts this to a SQL
SMALLINT value when it sends it to the database.
Parameters: parameterIndex - the first parameter is 1... Parameters: x - the parameter value exception: SQLException - if a database access error occurs |
setString | public void setString(int parameterIndex, String x) throws SQLException(Code) | | Set a parameter to a Java String value. The driver converts this to a SQL
VARCHAR or LONGVARCHAR value (depending on the arguments size relative to
the driver's limits on VARCHARs) when it sends it to the database.
Parameters: parameterIndex - the first parameter is 1... Parameters: x - the parameter value exception: SQLException - if a database access error occurs |
setTime | public void setTime(int parameterIndex, java.sql.Time x, Calendar cal) throws SQLException(Code) | | Set a parameter to a java.sql.Time value. The driver converts this to a
SQL TIME value when it sends it to the database.
Parameters: parameterIndex - the first parameter is 1, the second is 2, ... Parameters: x - the parameter value Parameters: cal - the cal specifying the timezone throws: SQLException - if a database-access error occurs. |
setTime | public void setTime(int parameterIndex, Time x) throws java.sql.SQLException(Code) | | Set a parameter to a java.sql.Time value. The driver converts this to a
SQL TIME value when it sends it to the database.
Parameters: parameterIndex - the first parameter is 1...)); Parameters: x - the parameter value throws: java.sql.SQLException - if a database access error occurs |
setTimestamp | public void setTimestamp(int parameterIndex, java.sql.Timestamp x, Calendar cal) throws SQLException(Code) | | Set a parameter to a java.sql.Timestamp value. The driver converts this
to a SQL TIMESTAMP value when it sends it to the database.
Parameters: parameterIndex - the first parameter is 1, the second is 2, ... Parameters: x - the parameter value Parameters: cal - the calendar specifying the timezone to use throws: SQLException - if a database-access error occurs. |
setTimestamp | public void setTimestamp(int parameterIndex, Timestamp x) throws java.sql.SQLException(Code) | | Set a parameter to a java.sql.Timestamp value. The driver converts this
to a SQL TIMESTAMP value when it sends it to the database.
Parameters: parameterIndex - the first parameter is 1... Parameters: x - the parameter value throws: java.sql.SQLException - if a database access error occurs |
setUnicodeStream | public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException(Code) | | When a very large Unicode value is input to a LONGVARCHAR parameter, it
may be more practical to send it via a java.io.InputStream. JDBC will
read the data from the stream as needed, until it reaches end-of-file.
The JDBC driver will do any necessary conversion from UNICODE to the
database char format.
Note: This stream object can either be a standard Java stream
object or your own subclass that implements the standard interface.
Parameters: parameterIndex - the first parameter is 1... Parameters: x - the parameter value Parameters: length - the number of bytes to read from the stream throws: SQLException - if a database access error occurs |
toString | public String toString()(Code) | | Returns this PreparedStatement represented as a string.
this PreparedStatement represented as a string. |
Methods inherited from com.mysql.jdbc.StatementImpl | public synchronized void addBatch(String sql) throws SQLException(Code)(Java Doc) public void cancel() throws SQLException(Code)(Java Doc) protected void checkClosed() throws SQLException(Code)(Java Doc) protected void checkForDml(String sql, char firstStatementChar) throws SQLException(Code)(Java Doc) protected void checkNullOrEmptyQuery(String sql) throws SQLException(Code)(Java Doc) public synchronized void clearBatch() throws SQLException(Code)(Java Doc) public void clearWarnings() throws SQLException(Code)(Java Doc) public void close() throws SQLException(Code)(Java Doc) protected void closeAllOpenResults()(Code)(Java Doc) protected boolean createStreamingResultSet()(Code)(Java Doc) public void disableStreamingResults() throws SQLException(Code)(Java Doc) protected void doPingInstead() throws SQLException(Code)(Java Doc) public void enableStreamingResults() throws SQLException(Code)(Java Doc) public boolean execute(String sql) throws SQLException(Code)(Java Doc) public boolean execute(String sql, int returnGeneratedKeys) throws SQLException(Code)(Java Doc) public boolean execute(String sql, int[] generatedKeyIndices) throws SQLException(Code)(Java Doc) public boolean execute(String sql, String[] generatedKeyNames) throws SQLException(Code)(Java Doc) public synchronized int[] executeBatch() throws SQLException(Code)(Java Doc) public java.sql.ResultSet executeQuery(String sql) throws SQLException(Code)(Java Doc) protected void executeSimpleNonQuery(ConnectionImpl c, String nonQuery) throws SQLException(Code)(Java Doc) public int executeUpdate(String sql) throws SQLException(Code)(Java Doc) protected int executeUpdate(String sql, boolean isBatch) throws SQLException(Code)(Java Doc) public int executeUpdate(String sql, int returnGeneratedKeys) throws SQLException(Code)(Java Doc) public int executeUpdate(String sql, int[] generatedKeyIndices) throws SQLException(Code)(Java Doc) public int executeUpdate(String sql, String[] generatedKeyNames) throws SQLException(Code)(Java Doc) protected int findStartOfStatement(String sql)(Code)(Java Doc) protected ResultSetInternalMethods generatePingResultSet() throws SQLException(Code)(Java Doc) protected void getBatchedGeneratedKeys(java.sql.Statement batchedStatement) throws SQLException(Code)(Java Doc) protected void getBatchedGeneratedKeys() throws SQLException(Code)(Java Doc) protected Calendar getCalendarInstanceForSessionOrNew()(Code)(Java Doc) public java.sql.Connection getConnection() throws SQLException(Code)(Java Doc) public int getFetchDirection() throws SQLException(Code)(Java Doc) public int getFetchSize() throws SQLException(Code)(Java Doc) public synchronized java.sql.ResultSet getGeneratedKeys() throws SQLException(Code)(Java Doc) protected java.sql.ResultSet getGeneratedKeysInternal() throws SQLException(Code)(Java Doc) protected int getId()(Code)(Java Doc) public long getLastInsertID()(Code)(Java Doc) public synchronized InputStream getLocalInfileInputStream()(Code)(Java Doc) public long getLongUpdateCount()(Code)(Java Doc) public int getMaxFieldSize() throws SQLException(Code)(Java Doc) public int getMaxRows() throws SQLException(Code)(Java Doc) public boolean getMoreResults() throws SQLException(Code)(Java Doc) public boolean getMoreResults(int current) throws SQLException(Code)(Java Doc) public int getQueryTimeout() throws SQLException(Code)(Java Doc) public java.sql.ResultSet getResultSet() throws SQLException(Code)(Java Doc) public int getResultSetConcurrency() throws SQLException(Code)(Java Doc) public int getResultSetHoldability() throws SQLException(Code)(Java Doc) protected ResultSetInternalMethods getResultSetInternal()(Code)(Java Doc) public int getResultSetType() throws SQLException(Code)(Java Doc) public int getUpdateCount() throws SQLException(Code)(Java Doc) public java.sql.SQLWarning getWarnings() throws SQLException(Code)(Java Doc) protected SQLException handleExceptionForBatch(int endOfBatchIndex, int numValuesPerBatch, int[] updateCounts, SQLException ex) throws BatchUpdateException(Code)(Java Doc) public synchronized boolean isClosed() throws SQLException(Code)(Java Doc) public boolean isPoolable() throws SQLException(Code)(Java Doc) public boolean isWrapperFor(Class iface) throws SQLException(Code)(Java Doc) protected int processMultiCountsAndKeys(StatementImpl batchedStatement, int updateCountCounter, int[] updateCounts) throws SQLException(Code)(Java Doc) protected void realClose(boolean calledExplicitly, boolean closeOpenResults) throws SQLException(Code)(Java Doc) protected synchronized void resetCancelledState()(Code)(Java Doc) public void setCursorName(String name) throws SQLException(Code)(Java Doc) public void setEscapeProcessing(boolean enable) throws SQLException(Code)(Java Doc) public void setFetchDirection(int direction) throws SQLException(Code)(Java Doc) public void setFetchSize(int rows) throws SQLException(Code)(Java Doc) protected void setHoldResultsOpenOverClose(boolean holdResultsOpenOverClose)(Code)(Java Doc) public synchronized void setLocalInfileInputStream(InputStream stream)(Code)(Java Doc) public void setMaxFieldSize(int max) throws SQLException(Code)(Java Doc) public void setMaxRows(int max) throws SQLException(Code)(Java Doc) public synchronized void setPingTarget(PingTarget pingTarget)(Code)(Java Doc) public void setPoolable(boolean poolable) throws SQLException(Code)(Java Doc) public void setQueryTimeout(int seconds) throws SQLException(Code)(Java Doc) void setResultSetConcurrency(int concurrencyFlag)(Code)(Java Doc) void setResultSetType(int typeFlag)(Code)(Java Doc) public Object unwrap(Class iface) throws java.sql.SQLException(Code)(Java Doc)
|
|
|