Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mysql.jdbc
Class ServerPreparedStatement

    java.lang.Object
      com.mysql.jdbc.StatementImpl
          com.mysql.jdbc.PreparedStatement
              com.mysql.jdbc.ServerPreparedStatement

All Implemented Interfaces:
  java.sql.PreparedStatement, java.sql.Statement, java.sql.Wrapper

Direct Known Subclasses:
  JDBC4ServerPreparedStatement

    public class ServerPreparedStatement

extends PreparedStatement

JDBC Interface for MySQL-4.1 and newer server-side PreparedStatements.

Nested Class Summary
`static class` | `ServerPreparedStatement.BatchedBindValues`
`static class` | `ServerPreparedStatement.BindValue`

Nested classes/interfaces inherited from class com.mysql.jdbc.PreparedStatement
`PreparedStatement.AppendingBatchVisitor, PreparedStatement.BatchParams, PreparedStatement.BatchVisitor, PreparedStatement.EmulatedPreparedStatementBindings, PreparedStatement.EndPoint, PreparedStatement.ParseInfo`

Nested classes/interfaces inherited from class com.mysql.jdbc.StatementImpl
`StatementImpl.CancelTask`

Field Summary
`protected static int` | `BLOB_STREAM_READ_BUF_SIZE`
`protected boolean` | `isCached`

Fields inherited from class com.mysql.jdbc.PreparedStatement
`batchCommandIndex, batchedValuesClause, batchHasPlainStatements, firstCharOfStmt, hasLimitClause, isLoadDataQuery, isNull, numberOfExecutions, originalSql, parameterCount, parameterMetaData, parameterTypes, parseInfo, rewrittenBatchSize, serverSupportsFracSecs, useTrueBoolean, usingAnsiMode`

Fields inherited from class com.mysql.jdbc.StatementImpl
`batchedArgs, batchedGeneratedKeys, cancelTimeoutMutex, charConverter, charEncoding, clearWarningsCalled, connection, connectionId, continueBatchOnError, currentCatalog, doEscapeProcessing, eventSink, generatedKeysResults, holdResultsOpenOverClose, isClosed, lastInsertId, lastQueryIsOnDupKeyUpdate, maxFieldSize, maxRows, maxRowsChanged, openResults, pedantic, PING_MARKER, pingTarget, pointOfOrigin, profileSQL, results, resultSetConcurrency, resultSetType, retrieveGeneratedKeys, statementCounter, statementExecuting, statementId, timeoutInMillis, updateCount, useLegacyDatetimeCode, USES_VARIABLES_FALSE, USES_VARIABLES_TRUE, USES_VARIABLES_UNKNOWN, useUsageAdvisor, version5013OrNewer, warningChain, wasCancelled, wasCancelledByTimeout`

Fields inherited from interface java.sql.Statement
`CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO`

Constructor Summary
`protected` | `ServerPreparedStatement(MySQLConnection conn, java.lang.String sql, java.lang.String catalog, int resultSetType, int resultSetConcurrency)` Creates a new ServerPreparedStatement object.

Method Summary
`void` | `addBatch()` JDBC 2.0 Add a set of parameters to the batch.
`protected java.lang.String` | `asSql(boolean quoteStreamsAndUnknowns)`
`boolean` | `canRewriteAsMultiValueInsertAtSqlLevel()`
`boolean` | `canRewriteAsMultivalueInsertStatement()`
`protected MySQLConnection` | `checkClosed()` Checks if closed() has been called, and throws an exception if so
`void` | `clearParameters()` In general, parameter values remain in force for repeated used of a Statement.
`void` | `close()` In many cases, it is desirable to immediately release a Statement's database and JDBC resources instead of waiting for this to happen when it is automatically closed.
`protected long[]` | `computeMaxParameterSetSizeAndBatchSize(int numBatchedArgs)` Computes the maximum parameter set size, and entire batch size given the number of arguments in the batch.
`protected boolean` | `containsOnDuplicateKeyUpdateInSQL()`
`protected int[]` | `executeBatchSerially(int batchTimeout)` Executes the current batch of statements by executing them one-by-one.
`protected ResultSetInternalMethods` | `executeInternal(int maxRowsToRetrieve, Buffer sendPacket, boolean createStreamingResultSet, boolean queryIsSelectOnly, Field[] metadataFromCache, boolean isBatch)` Actually execute the prepared statement.
`protected Buffer` | `fillSendPacket()` Creates the packet that contains the query to be sent to the server.
`protected Buffer` | `fillSendPacket(byte[][] batchedParameterStrings, java.io.InputStream[] batchedParameterStreams, boolean[] batchedIsStream, int[] batchedStreamLengths)` Creates the packet that contains the query to be sent to the server.
`protected ServerPreparedStatement.BindValue` | `getBinding(int parameterIndex, boolean forLongData)` Returns the structure representing the value that (can be)/(is) bound at the given parameter index.
`(package private) byte[]` | `getBytes(int parameterIndex)`
`protected static ServerPreparedStatement` | `getInstance(MySQLConnection conn, java.lang.String sql, java.lang.String catalog, int resultSetType, int resultSetConcurrency)` 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 int` | `getLocationOfOnDuplicateKeyUpdate()`
`java.sql.ResultSetMetaData` | `getMetaData()` The number, types and properties of a ResultSet's columns are provided by the getMetaData method.
`ServerPreparedStatement.BindValue[]` | `getParameterBindValues()` Return current bind values for use by Statement Interceptors.
`java.sql.ParameterMetaData` | `getParameterMetaData()`
`protected long` | `getServerStatementId()`
`(package private) boolean` | `isNull(int paramIndex)`
`protected boolean` | `isOnDuplicateKeyUpdate()`
`protected PreparedStatement` | `prepareBatchedInsertSQL(MySQLConnection localConn, int numBatches)` Returns a prepared statement for the number of batched parameters, used when re-writing batch INSERTs.
`protected void` | `realClose(boolean calledExplicitly, boolean closeOpenResults)` Closes this connection and frees all resources.
`protected void` | `rePrepare()` Used by Connection when auto-reconnecting to retrieve 'lost' prepared statements.
`void` | `setArray(int i, java.sql.Array x)` JDBC 2.0 Set an Array parameter.
`void` | `setAsciiStream(int parameterIndex, java.io.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.
`void` | `setBigDecimal(int parameterIndex, java.math.BigDecimal x)` Set a parameter to a java.math.BigDecimal value.
`void` | `setBinaryStream(int parameterIndex, java.io.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.
`void` | `setBlob(int parameterIndex, java.sql.Blob x)` JDBC 2.0 Set a BLOB parameter.
`void` | `setBoolean(int parameterIndex, boolean x)` Set a parameter to a Java boolean value.
`void` | `setByte(int parameterIndex, byte x)` Set a parameter to a Java byte value.
`void` | `setBytes(int parameterIndex, byte[] x)` Set a parameter to a Java array of bytes.
`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.
`void` | `setClob(int parameterIndex, java.sql.Clob x)` JDBC 2.0 Set a CLOB parameter.
`protected void` | `setClosed(boolean flag)`
`void` | `setDate(int parameterIndex, java.sql.Date x)` Set a parameter to a java.sql.Date value.
`void` | `setDate(int parameterIndex, java.sql.Date x, java.util.Calendar cal)` Set a parameter to a java.sql.Date value.
`void` | `setDouble(int parameterIndex, double x)` Set a parameter to a Java double value.
`void` | `setFloat(int parameterIndex, float x)` Set a parameter to a Java float value.
`void` | `setInt(int parameterIndex, int x)` Set a parameter to a Java int value.
`void` | `setLong(int parameterIndex, long x)` Set a parameter to a Java long value.
`void` | `setNull(int parameterIndex, int sqlType)` Set a parameter to SQL NULL Note: You must specify the parameters SQL type (although MySQL ignores it)
`void` | `setNull(int parameterIndex, int sqlType, java.lang.String typeName)` Set a parameter to SQL NULL.
`protected int` | `setOneBatchedParameterSet(java.sql.PreparedStatement batchedStatement, int batchedParamIndex, java.lang.Object paramSet)`
`void` | `setRef(int i, java.sql.Ref x)` JDBC 2.0 Set a REF(<structured-type>) parameter.
`void` | `setShort(int parameterIndex, short x)` Set a parameter to a Java short value.
`void` | `setString(int parameterIndex, java.lang.String x)` Set a parameter to a Java String value.
`void` | `setTime(int parameterIndex, java.sql.Time x)` Set a parameter to a java.sql.Time value.
`void` | `setTime(int parameterIndex, java.sql.Time x, java.util.Calendar cal)` Set a parameter to a java.sql.Time value.
`protected void` | `setTimeInternal(int parameterIndex, java.sql.Time x, java.util.Calendar targetCalendar, java.util.TimeZone tz, boolean rollForward)` Set a parameter to a java.sql.Time value.
`void` | `setTimestamp(int parameterIndex, java.sql.Timestamp x)` Set a parameter to a java.sql.Timestamp value.
`void` | `setTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar cal)` Set a parameter to a java.sql.Timestamp value.
`protected void` | `setTimestampInternal(int parameterIndex, java.sql.Timestamp x, java.util.Calendar targetCalendar, java.util.TimeZone tz, boolean rollForward)`
`protected void` | `setType(ServerPreparedStatement.BindValue oldValue, int bufferType)`
`void` | `setUnicodeStream(int parameterIndex, java.io.InputStream x, int length)` Deprecated.
`void` | `setURL(int parameterIndex, java.net.URL x)`
`java.lang.String` | `toString()` Returns this PreparedStatement represented as a string.

Methods inherited from class com.mysql.jdbc.PreparedStatement
`addBatch, asSql, canRewrite, checkBounds, checkReadOnlySafeStatement, clearBatch, computeBatchSize, detectFractionalSecondsSupport, execute, executeBatch, executeBatchedInserts, executePreparedBatchAsMultiStatement, executeQuery, executeUpdate, executeUpdate, executeUpdate, getBytesRepresentation, getBytesRepresentationForBatch, getDateTime, getInstance, getInstance, getInstance, getNonRewrittenSql, getParameterBindings, getParameterIndexOffset, getParseInfo, getPreparedSql, getRewrittenBatchSize, getUpdateCount, getValuesClause, isSelectQuery, readFully, setAsciiStream, setAsciiStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBytes, setBytesNoEscape, setBytesNoEscapeNoQuotes, setCharacterStream, setCharacterStream, setClob, setClob, setInternal, setInternal, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNString, setObject, setObject, setObject, setRetrieveGeneratedKeys`

Methods inherited from class com.mysql.jdbc.StatementImpl
`cancel, checkForDml, checkNullOrEmptyQuery, clearWarnings, closeAllOpenResults, closeOnCompletion, containsOnDuplicateKeyInString, createStreamingResultSet, disableStreamingResults, doPingInstead, enableStreamingResults, execute, execute, execute, execute, executeQuery, executeSimpleNonQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, executeUpdate, findStartOfStatement, generatePingResultSet, getBatchedArgs, getBatchedGeneratedKeys, getBatchedGeneratedKeys, getCalendarInstanceForSessionOrNew, getConnection, getExceptionInterceptor, getFetchDirection, getFetchSize, getGeneratedKeys, getGeneratedKeysInternal, getGeneratedKeysInternal, getId, getLastInsertID, getLocalInfileInputStream, getLongUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getOnDuplicateKeyLocation, getOpenResultSetCount, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetInternal, getResultSetType, getWarnings, handleExceptionForBatch, hasDeadlockOrTimeoutRolledBackTx, isClosed, isCloseOnCompletion, isPoolable, isWrapperFor, processMultiCountsAndKeys, removeOpenResultSet, resetCancelledState, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setHoldResultsOpenOverClose, setLocalInfileInputStream, setMaxFieldSize, setMaxRows, setPingTarget, setPoolable, setQueryTimeout, setResultSetConcurrency, setResultSetType, statementBegins, unwrap`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.sql.PreparedStatement
`setNClob, setRowId, setSQLXML`

Methods inherited from interface java.sql.Statement
`cancel, clearWarnings, execute, execute, execute, execute, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getWarnings, isClosed, isPoolable, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout`

Methods inherited from interface java.sql.Wrapper
`isWrapperFor, unwrap`

Field Detail

### BLOB_STREAM_READ_BUF_SIZE

    protected static final int BLOB_STREAM_READ_BUF_SIZE

See Also:
  Constant Field Values

### isCached

    protected boolean isCached

Constructor Detail

### ServerPreparedStatement

    protected ServerPreparedStatement(MySQLConnection conn,
                                      java.lang.String sql,
                                      java.lang.String catalog,
                                      int resultSetType,
                                      int resultSetConcurrency)
                               throws java.sql.SQLException

  Creates a new ServerPreparedStatement object.

  Parameters:
    `conn` - the connection creating us.
    `sql` - the SQL containing the statement to prepare.
    `catalog` - the catalog in use when we were created.
  Throws:
    `java.sql.SQLException` - If an error occurs

Method Detail

### getInstance

    protected static ServerPreparedStatement getInstance(MySQLConnection conn,
                                                         java.lang.String sql,
                                                         java.lang.String catalog,
                                                         int resultSetType,
                                                         int resultSetConcurrency)
                                                  throws java.sql.SQLException

  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.

  Throws:
    `java.sql.SQLException`

### addBatch

    public void addBatch()
                  throws java.sql.SQLException

  JDBC 2.0 Add a set of parameters to the batch.

  Specified by:
    `addBatch` in interface `java.sql.PreparedStatement`
  Overrides:
    `addBatch` in class `PreparedStatement`
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  See Also:
    `StatementImpl.addBatch(java.lang.String)`

### asSql

    protected java.lang.String asSql(boolean quoteStreamsAndUnknowns)
                              throws java.sql.SQLException

  Overrides:
    `asSql` in class `PreparedStatement`
  Throws:
    `java.sql.SQLException`

### checkClosed

    protected MySQLConnection checkClosed()
                                   throws java.sql.SQLException

  Description copied from class: `StatementImpl`
  Checks if closed() has been called, and throws an exception if so

  Overrides:
    `checkClosed` in class `StatementImpl`
  Throws:
    `java.sql.SQLException` - if this statement has been closed

### clearParameters

    public void clearParameters()
                         throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  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

  Specified by:
    `clearParameters` in interface `java.sql.PreparedStatement`
  Overrides:
    `clearParameters` in class `PreparedStatement`
  Throws:
    `java.sql.SQLException` - if a database access error occurs
  See Also:
    `PreparedStatement.clearParameters()`

### setClosed

    protected void setClosed(boolean flag)

### close

    public void close()
               throws java.sql.SQLException

  Description copied from class: `StatementImpl`
  In many cases, it is desirable to immediately release a Statement's database and JDBC resources instead of waiting for this to happen when it is automatically closed. The close method provides this immediate release.

  Note: A Statement is automatically closed when it is garbage collected. When a Statement is closed, its current ResultSet, if one exists, is also closed.

  Specified by:
    `close` in interface `java.sql.Statement`
  Overrides:
    `close` in class `StatementImpl`
  Throws:
    `java.sql.SQLException` - if a database access error occurs
  See Also:
    `Statement.close()`

### executeBatchSerially

    protected int[] executeBatchSerially(int batchTimeout)
                                  throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  Executes the current batch of statements by executing them one-by-one.

  Overrides:
    `executeBatchSerially` in class `PreparedStatement`
  Returns:
    a list of update counts
  Throws:
    `java.sql.SQLException` - if an error occurs

### executeInternal

    protected ResultSetInternalMethods executeInternal(int maxRowsToRetrieve,
                                                       Buffer sendPacket,
                                                       boolean createStreamingResultSet,
                                                       boolean queryIsSelectOnly,
                                                       Field[] metadataFromCache,
                                                       boolean isBatch)
                                                throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  Actually execute the prepared statement. This is here so server-side PreparedStatements can re-use most of the code from this class.

  Overrides:
    `executeInternal` in class `PreparedStatement`
  Parameters:
    `maxRowsToRetrieve` - the max number of rows to return
    `sendPacket` - the packet to send
    `createStreamingResultSet` - should a 'streaming' result set be created?
    `queryIsSelectOnly` - is this query doing a SELECT?
  Returns:
    the results as a ResultSet
  Throws:
    `java.sql.SQLException` - if an error occurs.
  See Also:
    `com.mysql.jdbc.PreparedStatement#executeInternal(int, com.mysql.jdbc.Buffer, boolean, boolean)`

### fillSendPacket

    protected Buffer fillSendPacket()
                             throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  Creates the packet that contains the query to be sent to the server.

  Overrides:
    `fillSendPacket` in class `PreparedStatement`
  Returns:
    A Buffer filled with the query representing the PreparedStatement.
  Throws:
    `java.sql.SQLException` - if an error occurs.
  See Also:
    `PreparedStatement.fillSendPacket()`

### fillSendPacket

    protected Buffer fillSendPacket(byte[][] batchedParameterStrings,
                                    java.io.InputStream[] batchedParameterStreams,
                                    boolean[] batchedIsStream,
                                    int[] batchedStreamLengths)
                             throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  Creates the packet that contains the query to be sent to the server.

  Overrides:
    `fillSendPacket` in class `PreparedStatement`
  Parameters:
    `batchedParameterStrings` - the parameters as strings
    `batchedParameterStreams` - the parameters as streams
    `batchedIsStream` - is the given parameter a stream?
    `batchedStreamLengths` - the lengths of the streams (if appropriate)
  Returns:
    a Buffer filled with the query that represents this statement
  Throws:
    `java.sql.SQLException` - if an error occurs.
  See Also:
    `com.mysql.jdbc.PreparedStatement#fillSendPacket(byte, java.io.InputStream, boolean, int)`

### getBinding

    protected ServerPreparedStatement.BindValue getBinding(int parameterIndex,
                                                           boolean forLongData)
                                                    throws java.sql.SQLException

  Returns the structure representing the value that (can be)/(is) bound at the given parameter index.

  Parameters:
    `parameterIndex` - 1-based
    `forLongData` - is this for a stream?
  Returns:
  Throws:
    `java.sql.SQLException`

### getParameterBindValues

    public ServerPreparedStatement.BindValue[] getParameterBindValues()

  Return current bind values for use by Statement Interceptors.

  Returns:
    the bind values as set by setXXX and stored by addBatch
  See Also:
    `PreparedStatement.executeBatch()`, `addBatch()`

### getBytes

    byte[] getBytes(int parameterIndex)
              throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`
  See Also:
    `com.mysql.jdbc.PreparedStatement#getBytes(int)`

### getMetaData

    public java.sql.ResultSetMetaData getMetaData()
                                           throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  The number, types and properties of a ResultSet's columns are provided by the getMetaData method.

  Specified by:
    `getMetaData` in interface `java.sql.PreparedStatement`
  Overrides:
    `getMetaData` in class `PreparedStatement`
  Returns:
    the description of a ResultSet's columns
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  See Also:
    `PreparedStatement.getMetaData()`

### getParameterMetaData

    public java.sql.ParameterMetaData getParameterMetaData()
                                                    throws java.sql.SQLException

  Specified by:
    `getParameterMetaData` in interface `java.sql.PreparedStatement`
  Overrides:
    `getParameterMetaData` in class `PreparedStatement`
  Throws:
    `java.sql.SQLException`
  See Also:
    `PreparedStatement.getParameterMetaData()`

### isNull

    boolean isNull(int paramIndex)

  Overrides:
    `isNull` in class `PreparedStatement`
  See Also:
    `PreparedStatement.isNull(int)`

### realClose

    protected void realClose(boolean calledExplicitly,
                             boolean closeOpenResults)
                      throws java.sql.SQLException

  Closes this connection and frees all resources.

  Overrides:
    `realClose` in class `PreparedStatement`
  Parameters:
    `calledExplicitly` - was this called from close()?
  Throws:
    `java.sql.SQLException` - if an error occurs

### rePrepare

    protected void rePrepare()
                      throws java.sql.SQLException

  Used by Connection when auto-reconnecting to retrieve 'lost' prepared statements.

  Throws:
    `java.sql.SQLException` - if an error occurs.

### setArray

    public void setArray(int i,
                         java.sql.Array x)
                  throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  JDBC 2.0 Set an Array parameter.

  Specified by:
    `setArray` in interface `java.sql.PreparedStatement`
  Overrides:
    `setArray` in class `PreparedStatement`
  Parameters:
    `i` - the first parameter is 1, the second is 2, ...
    `x` - an object representing an SQL array
  Throws:
    `java.sql.SQLException` - because this method is not implemented.
    `NotImplemented` - DOCUMENT ME!
  See Also:
    `PreparedStatement.setArray(int, java.sql.Array)`

### setAsciiStream

    public void setAsciiStream(int parameterIndex,
                               java.io.InputStream x,
                               int length)
                        throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  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.

  Specified by:
    `setAsciiStream` in interface `java.sql.PreparedStatement`
  Overrides:
    `setAsciiStream` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1...
    `x` - the parameter value
    `length` - the number of bytes in the stream
  Throws:
    `java.sql.SQLException` - if a database access error occurs
  See Also:
    `PreparedStatement.setAsciiStream(int, java.io.InputStream, int)`

### setBigDecimal

    public void setBigDecimal(int parameterIndex,
                              java.math.BigDecimal x)
                       throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  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.

  Specified by:
    `setBigDecimal` in interface `java.sql.PreparedStatement`
  Overrides:
    `setBigDecimal` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1...
    `x` - the parameter value
  Throws:
    `java.sql.SQLException` - if a database access error occurs
  See Also:
    `PreparedStatement.setBigDecimal(int, java.math.BigDecimal)`

### setBinaryStream

    public void setBinaryStream(int parameterIndex,
                                java.io.InputStream x,
                                int length)
                         throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  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.

  Specified by:
    `setBinaryStream` in interface `java.sql.PreparedStatement`
  Overrides:
    `setBinaryStream` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1...
    `x` - the parameter value
    `length` - the number of bytes to read from the stream (ignored)
  Throws:
    `java.sql.SQLException` - if a database access error occurs
  See Also:
    `PreparedStatement.setBinaryStream(int, java.io.InputStream, int)`

### setBlob

    public void setBlob(int parameterIndex,
                        java.sql.Blob x)
                 throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  JDBC 2.0 Set a BLOB parameter.

  Specified by:
    `setBlob` in interface `java.sql.PreparedStatement`
  Overrides:
    `setBlob` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1, the second is 2, ...
    `x` - an object representing a BLOB
  Throws:
    `java.sql.SQLException` - if a database error occurs
  See Also:
    `PreparedStatement.setBlob(int, java.sql.Blob)`

### setBoolean

    public void setBoolean(int parameterIndex,
                           boolean x)
                    throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  Set a parameter to a Java boolean value. The driver converts this to a SQL BIT value when it sends it to the database.

  Specified by:
    `setBoolean` in interface `java.sql.PreparedStatement`
  Overrides:
    `setBoolean` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1...
    `x` - the parameter value
  Throws:
    `java.sql.SQLException` - if a database access error occurs
  See Also:
    `PreparedStatement.setBoolean(int, boolean)`

### setByte

    public void setByte(int parameterIndex,
                        byte x)
                 throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  Set a parameter to a Java byte value. The driver converts this to a SQL TINYINT value when it sends it to the database.

  Specified by:
    `setByte` in interface `java.sql.PreparedStatement`
  Overrides:
    `setByte` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1...
    `x` - the parameter value
  Throws:
    `java.sql.SQLException` - if a database access error occurs
  See Also:
    `PreparedStatement.setByte(int, byte)`

### setBytes

    public void setBytes(int parameterIndex,
                         byte[] x)
                  throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  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.

  Specified by:
    `setBytes` in interface `java.sql.PreparedStatement`
  Overrides:
    `setBytes` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1...
    `x` - the parameter value
  Throws:
    `java.sql.SQLException` - if a database access error occurs
  See Also:
    `java.sql.PreparedStatement#setBytes(int, byte)`

### setCharacterStream

    public void setCharacterStream(int parameterIndex,
                                   java.io.Reader reader,
                                   int length)
                            throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  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.

  Specified by:
    `setCharacterStream` in interface `java.sql.PreparedStatement`
  Overrides:
    `setCharacterStream` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1, the second is 2, ...
    `reader` - the java reader which contains the UNICODE data
    `length` - the number of characters in the stream
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  See Also:
    `PreparedStatement.setCharacterStream(int, java.io.Reader, int)`

### setClob

    public void setClob(int parameterIndex,
                        java.sql.Clob x)
                 throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  JDBC 2.0 Set a CLOB parameter.

  Specified by:
    `setClob` in interface `java.sql.PreparedStatement`
  Overrides:
    `setClob` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1, the second is 2, ...
    `x` - an object representing a CLOB
  Throws:
    `java.sql.SQLException` - if a database error occurs
  See Also:
    `PreparedStatement.setClob(int, java.sql.Clob)`

### setDate

    public void setDate(int parameterIndex,
                        java.sql.Date x)
                 throws java.sql.SQLException

  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.

  Specified by:
    `setDate` in interface `java.sql.PreparedStatement`
  Overrides:
    `setDate` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1, the second is 2, ...
    `x` - the parameter value
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.

### setDate

    public void setDate(int parameterIndex,
                        java.sql.Date x,
                        java.util.Calendar cal)
                 throws java.sql.SQLException

  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.

  Specified by:
    `setDate` in interface `java.sql.PreparedStatement`
  Overrides:
    `setDate` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1, the second is 2, ...
    `x` - the parameter value
    `cal` - the calendar to interpret the date with
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.

### setDouble

    public void setDouble(int parameterIndex,
                          double x)
                   throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  Set a parameter to a Java double value. The driver converts this to a SQL DOUBLE value when it sends it to the database

  Specified by:
    `setDouble` in interface `java.sql.PreparedStatement`
  Overrides:
    `setDouble` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1...
    `x` - the parameter value
  Throws:
    `java.sql.SQLException` - if a database access error occurs
  See Also:
    `PreparedStatement.setDouble(int, double)`

### setFloat

    public void setFloat(int parameterIndex,
                         float x)
                  throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  Set a parameter to a Java float value. The driver converts this to a SQL FLOAT value when it sends it to the database.

  Specified by:
    `setFloat` in interface `java.sql.PreparedStatement`
  Overrides:
    `setFloat` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1...
    `x` - the parameter value
  Throws:
    `java.sql.SQLException` - if a database access error occurs
  See Also:
    `PreparedStatement.setFloat(int, float)`

### setInt

    public void setInt(int parameterIndex,
                       int x)
                throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  Set a parameter to a Java int value. The driver converts this to a SQL INTEGER value when it sends it to the database.

  Specified by:
    `setInt` in interface `java.sql.PreparedStatement`
  Overrides:
    `setInt` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1...
    `x` - the parameter value
  Throws:
    `java.sql.SQLException` - if a database access error occurs
  See Also:
    `PreparedStatement.setInt(int, int)`

### setLong

    public void setLong(int parameterIndex,
                        long x)
                 throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  Set a parameter to a Java long value. The driver converts this to a SQL BIGINT value when it sends it to the database.

  Specified by:
    `setLong` in interface `java.sql.PreparedStatement`
  Overrides:
    `setLong` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1...
    `x` - the parameter value
  Throws:
    `java.sql.SQLException` - if a database access error occurs
  See Also:
    `PreparedStatement.setLong(int, long)`

### setNull

    public void setNull(int parameterIndex,
                        int sqlType)
                 throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  Set a parameter to SQL NULL

  Note: You must specify the parameters SQL type (although MySQL ignores it)

  Specified by:
    `setNull` in interface `java.sql.PreparedStatement`
  Overrides:
    `setNull` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1, etc...
    `sqlType` - the SQL type code defined in java.sql.Types
  Throws:
    `java.sql.SQLException` - if a database access error occurs
  See Also:
    `PreparedStatement.setNull(int, int)`

### setNull

    public void setNull(int parameterIndex,
                        int sqlType,
                        java.lang.String typeName)
                 throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  Set a parameter to SQL NULL.

  Note: You must specify the parameter's SQL type.

  Specified by:
    `setNull` in interface `java.sql.PreparedStatement`
  Overrides:
    `setNull` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1, the second is 2, ...
    `sqlType` - SQL type code defined by java.sql.Types
    `typeName` - argument parameters for null
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  See Also:
    `PreparedStatement.setNull(int, int, java.lang.String)`

### setRef

    public void setRef(int i,
                       java.sql.Ref x)
                throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  JDBC 2.0 Set a REF(<structured-type>) parameter.

  Specified by:
    `setRef` in interface `java.sql.PreparedStatement`
  Overrides:
    `setRef` in class `PreparedStatement`
  Parameters:
    `i` - the first parameter is 1, the second is 2, ...
    `x` - an object representing data of an SQL REF Type
  Throws:
    `java.sql.SQLException` - if a database error occurs
    `NotImplemented` - DOCUMENT ME!
  See Also:
    `PreparedStatement.setRef(int, java.sql.Ref)`

### setShort

    public void setShort(int parameterIndex,
                         short x)
                  throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  Set a parameter to a Java short value. The driver converts this to a SQL SMALLINT value when it sends it to the database.

  Specified by:
    `setShort` in interface `java.sql.PreparedStatement`
  Overrides:
    `setShort` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1...
    `x` - the parameter value
  Throws:
    `java.sql.SQLException` - if a database access error occurs
  See Also:
    `PreparedStatement.setShort(int, short)`

### setString

    public void setString(int parameterIndex,
                          java.lang.String x)
                   throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  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.

  Specified by:
    `setString` in interface `java.sql.PreparedStatement`
  Overrides:
    `setString` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1...
    `x` - the parameter value
  Throws:
    `java.sql.SQLException` - if a database access error occurs
  See Also:
    `PreparedStatement.setString(int, java.lang.String)`

### setTime

    public void setTime(int parameterIndex,
                        java.sql.Time x)
                 throws java.sql.SQLException

  Set a parameter to a java.sql.Time value.

  Specified by:
    `setTime` in interface `java.sql.PreparedStatement`
  Overrides:
    `setTime` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1...));
    `x` - the parameter value
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### setTime

    public void setTime(int parameterIndex,
                        java.sql.Time x,
                        java.util.Calendar cal)
                 throws java.sql.SQLException

  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, using the given timezone.

  Specified by:
    `setTime` in interface `java.sql.PreparedStatement`
  Overrides:
    `setTime` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1...));
    `x` - the parameter value
    `cal` - the timezone to use
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### setTimeInternal

    protected void setTimeInternal(int parameterIndex,
                                   java.sql.Time x,
                                   java.util.Calendar targetCalendar,
                                   java.util.TimeZone tz,
                                   boolean rollForward)
                            throws java.sql.SQLException

  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, using the given timezone.

  Parameters:
    `parameterIndex` - the first parameter is 1...));
    `x` - the parameter value
    `tz` - the timezone to use
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### setTimestamp

    public void setTimestamp(int parameterIndex,
                             java.sql.Timestamp x)
                      throws java.sql.SQLException

  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.

  Specified by:
    `setTimestamp` in interface `java.sql.PreparedStatement`
  Overrides:
    `setTimestamp` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1, the second is 2, ...
    `x` - the parameter value
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.

### setTimestamp

    public void setTimestamp(int parameterIndex,
                             java.sql.Timestamp x,
                             java.util.Calendar cal)
                      throws java.sql.SQLException

  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.

  Specified by:
    `setTimestamp` in interface `java.sql.PreparedStatement`
  Overrides:
    `setTimestamp` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - the first parameter is 1, the second is 2, ...
    `x` - the parameter value
    `cal` - the timezone to use
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.

### setTimestampInternal

    protected void setTimestampInternal(int parameterIndex,
                                        java.sql.Timestamp x,
                                        java.util.Calendar targetCalendar,
                                        java.util.TimeZone tz,
                                        boolean rollForward)
                                 throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### setType

    protected void setType(ServerPreparedStatement.BindValue oldValue,
                           int bufferType)
                    throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### setUnicodeStream

    public void setUnicodeStream(int parameterIndex,
                                 java.io.InputStream x,
                                 int length)
                          throws java.sql.SQLException

  Deprecated.

  DOCUMENT ME!

  Specified by:
    `setUnicodeStream` in interface `java.sql.PreparedStatement`
  Overrides:
    `setUnicodeStream` in class `PreparedStatement`
  Parameters:
    `parameterIndex` - DOCUMENT ME!
    `x` - DOCUMENT ME!
    `length` - DOCUMENT ME!
  Throws:
    `java.sql.SQLException` - DOCUMENT ME!
    `NotImplemented` - DOCUMENT ME!
  See Also:
    `PreparedStatement.setUnicodeStream(int, java.io.InputStream, int)`

### setURL

    public void setURL(int parameterIndex,
                       java.net.URL x)
                throws java.sql.SQLException

  Specified by:
    `setURL` in interface `java.sql.PreparedStatement`
  Overrides:
    `setURL` in class `PreparedStatement`
  Throws:
    `java.sql.SQLException`
  See Also:
    `PreparedStatement.setURL(int, java.net.URL)`

### toString

    public java.lang.String toString()

  Description copied from class: `PreparedStatement`
  Returns this PreparedStatement represented as a string.

  Overrides:
    `toString` in class `PreparedStatement`
  Returns:
    this PreparedStatement represented as a string.
  See Also:
    `Object.toString()`

### getServerStatementId

    protected long getServerStatementId()

### canRewriteAsMultiValueInsertAtSqlLevel

    public boolean canRewriteAsMultiValueInsertAtSqlLevel()
                                                   throws java.sql.SQLException

  Overrides:
    `canRewriteAsMultiValueInsertAtSqlLevel` in class `PreparedStatement`
  Throws:
    `java.sql.SQLException`

### canRewriteAsMultivalueInsertStatement

    public boolean canRewriteAsMultivalueInsertStatement()
                                                  throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### getLocationOfOnDuplicateKeyUpdate

    protected int getLocationOfOnDuplicateKeyUpdate()
                                             throws java.sql.SQLException

  Overrides:
    `getLocationOfOnDuplicateKeyUpdate` in class `PreparedStatement`
  Throws:
    `java.sql.SQLException`

### isOnDuplicateKeyUpdate

    protected boolean isOnDuplicateKeyUpdate()
                                      throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### computeMaxParameterSetSizeAndBatchSize

    protected long[] computeMaxParameterSetSizeAndBatchSize(int numBatchedArgs)
                                                     throws java.sql.SQLException

  Computes the maximum parameter set size, and entire batch size given the number of arguments in the batch.

  Overrides:
    `computeMaxParameterSetSizeAndBatchSize` in class `PreparedStatement`
  Throws:
    `java.sql.SQLException`

### setOneBatchedParameterSet

    protected int setOneBatchedParameterSet(java.sql.PreparedStatement batchedStatement,
                                            int batchedParamIndex,
                                            java.lang.Object paramSet)
                                     throws java.sql.SQLException

  Overrides:
    `setOneBatchedParameterSet` in class `PreparedStatement`
  Throws:
    `java.sql.SQLException`

### containsOnDuplicateKeyUpdateInSQL

    protected boolean containsOnDuplicateKeyUpdateInSQL()

  Overrides:
    `containsOnDuplicateKeyUpdateInSQL` in class `PreparedStatement`

### prepareBatchedInsertSQL

    protected PreparedStatement prepareBatchedInsertSQL(MySQLConnection localConn,
                                                        int numBatches)
                                                 throws java.sql.SQLException

  Description copied from class: `PreparedStatement`
  Returns a prepared statement for the number of batched parameters, used when re-writing batch INSERTs.

  Overrides:
    `prepareBatchedInsertSQL` in class `PreparedStatement`
  Throws:
    `java.sql.SQLException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD