Class ServerPreparedStatement
- All Implemented Interfaces:
Statement, Wrapper, AutoCloseable, PreparedStatement, Statement, Wrapper
- Direct Known Subclasses:
JDBC4ServerPreparedStatement
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classNested classes/interfaces inherited from class PreparedStatement
PreparedStatement.AppendingBatchVisitor, PreparedStatement.BatchParams, PreparedStatement.BatchVisitor, PreparedStatement.EmulatedPreparedStatementBindings, PreparedStatement.EndPoint, PreparedStatement.ParseInfoNested classes/interfaces inherited from class StatementImpl
StatementImpl.CancelTask -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intprotected booleanFields inherited from class PreparedStatement
batchCommandIndex, batchedValuesClause, batchHasPlainStatements, firstCharOfStmt, isLoadDataQuery, isNull, numberOfExecutions, originalSql, parameterCount, parameterMetaData, parameterTypes, parseInfo, rewrittenBatchSize, serverSupportsFracSecs, useTrueBoolean, usingAnsiModeFields inherited from class StatementImpl
batchedArgs, batchedGeneratedKeys, cancelTimeoutMutex, charConverter, charEncoding, clearWarningsCalled, connection, continueBatchOnError, currentCatalog, doEscapeProcessing, generatedKeysResults, holdResultsOpenOverClose, isClosed, lastInsertId, lastQueryIsOnDupKeyUpdate, maxFieldSize, maxRows, ON_DUPLICATE_KEY_UPDATE_CLAUSE, openResults, pedantic, physicalConnection, PING_MARKER, pingTarget, profileSQL, results, resultSetConcurrency, resultSetType, retrieveGeneratedKeys, sendFractionalSeconds, statementCounter, statementExecuting, statementId, timeoutInMillis, updateCount, useLegacyDatetimeCode, USES_VARIABLES_FALSE, USES_VARIABLES_TRUE, USES_VARIABLES_UNKNOWN, useUsageAdvisor, version5013OrNewer, warningChain, wasCancelled, wasCancelledByTimeoutFields inherited from interface Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedServerPreparedStatement(MySQLConnection conn, String sql, String catalog, int resultSetType, int resultSetConcurrency) Creates a new ServerPreparedStatement object. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBatch()JDBC 2.0 Add a set of parameters to the batch.asSql(boolean quoteStreamsAndUnknowns) booleanprotected MySQLConnectionChecks if closed() has been called, and throws an exception if sovoidIn general, parameter values remain in force for repeated used of a Statement.voidclose()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 booleanprotected long[]executeBatchSerially(int batchTimeout) Executes the current batch of statements by executing them one-by-one.protected ResultSetInternalMethodsexecuteInternal(int maxRowsToRetrieve, Buffer sendPacket, boolean createStreamingResultSet, boolean queryIsSelectOnly, Field[] metadataFromCache, boolean isBatch) Actually execute the prepared statement.protected BufferCreates the packet that contains the query to be sent to the server.protected BufferfillSendPacket(byte[][] batchedParameterStrings, InputStream[] batchedParameterStreams, boolean[] batchedIsStream, int[] batchedStreamLengths) Creates the packet that contains the query to be sent to the server.protected ServerPreparedStatement.BindValuegetBinding(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 ServerPreparedStatementgetInstance(MySQLConnection conn, String sql, 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 intThe number, types and properties of a ResultSet's columns are provided by the getMetaData method.Return current bind values for use by Statement Interceptors.protected long(package private) boolean(package private) booleanisNull(int paramIndex) protected booleanprotected PreparedStatementprepareBatchedInsertSQL(MySQLConnection localConn, int numBatches) Returns a prepared statement for the number of batched parameters, used when re-writing batch INSERTs.protected voidrealClose(boolean calledExplicitly, boolean closeOpenResults) Closes this connection and frees all resources.protected voidUsed by Connection when auto-reconnecting to retrieve 'lost' prepared statements.protected voidresetToType(ServerPreparedStatement.BindValue oldValue, int bufferType) Reset a bind value to be used for a new value of the given type.voidJDBC 2.0 Set an Array parameter.voidsetAsciiStream(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.voidsetBigDecimal(int parameterIndex, BigDecimal x) Set a parameter to a java.math.BigDecimal value.voidsetBinaryStream(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.voidJDBC 2.0 Set a BLOB parameter.voidsetBoolean(int parameterIndex, boolean x) Set a parameter to a Java boolean value.voidsetByte(int parameterIndex, byte x) Set a parameter to a Java byte value.voidsetBytes(int parameterIndex, byte[] x) Set a parameter to a Java array of bytes.voidsetCharacterStream(int parameterIndex, 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.voidJDBC 2.0 Set a CLOB parameter.protected voidsetClosed(boolean flag) voidSet a parameter to a java.sql.Date value.voidSet a parameter to a java.sql.Date value.voidsetDouble(int parameterIndex, double x) Set a parameter to a Java double value.voidsetFloat(int parameterIndex, float x) Set a parameter to a Java float value.voidsetInt(int parameterIndex, int x) Set a parameter to a Java int value.voidsetLong(int parameterIndex, long x) Set a parameter to a Java long value.voidsetNull(int parameterIndex, int sqlType) Set a parameter to SQL NULLvoidSet a parameter to SQL NULL.protected intsetOneBatchedParameterSet(PreparedStatement batchedStatement, int batchedParamIndex, Object paramSet) voidsetPoolable(boolean poolable) voidJDBC 2.0 Set a REF(<structured-type>) parameter.voidsetShort(int parameterIndex, short x) Set a parameter to a Java short value.voidSet a parameter to a Java String value.voidSet a parameter to a java.sql.Time value.voidSet a parameter to a java.sql.Time value.voidsetTimestamp(int parameterIndex, Timestamp x) Set a parameter to a java.sql.Timestamp value.voidsetTimestamp(int parameterIndex, Timestamp x, Calendar cal) Set a parameter to a java.sql.Timestamp value.voidsetUnicodeStream(int parameterIndex, InputStream x, int length) Deprecated.voidtoString()Returns this PreparedStatement represented as a string.Methods inherited from class PreparedStatement
addBatch, asSql, canRewrite, checkBounds, checkReadOnlySafeStatement, clearBatch, computeBatchSize, detectFractionalSecondsSupport, execute, executeBatchedInserts, executeBatchInternal, executeLargeUpdate, executePreparedBatchAsMultiStatement, executeQuery, executeUpdate, executeUpdateInternal, executeUpdateInternal, 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, setTimestampInternalMethods inherited from class StatementImpl
cancel, checkForDml, checkNullOrEmptyQuery, clearWarnings, closeAllOpenResults, closeOnCompletion, containsOnDuplicateKeyInString, createStreamingResultSet, disableStreamingResults, doPingInstead, enableStreamingResults, execute, execute, execute, execute, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeSimpleNonQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, executeUpdateInternal, findStartOfStatement, generatePingResultSet, getBatchedArgs, getBatchedGeneratedKeys, getBatchedGeneratedKeys, getCalendarInstanceForSessionOrNew, getConnection, getExceptionInterceptor, getFetchDirection, getFetchSize, getGeneratedKeys, getGeneratedKeysInternal, getGeneratedKeysInternal, getId, getLargeMaxRows, getLargeUpdateCount, getLastInsertID, getLocalInfileInputStream, getLongUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getOnDuplicateKeyLocation, getOpenResultSetCount, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetInternal, getResultSetType, getWarnings, handleExceptionForBatch, hasDeadlockOrTimeoutRolledBackTx, implicitlyCloseAllOpenResults, isClosed, isCloseOnCompletion, isPoolable, isWrapperFor, processMultiCountsAndKeys, removeOpenResultSet, resetCancelledState, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setHoldResultsOpenOverClose, setLargeMaxRows, setLocalInfileInputStream, setMaxFieldSize, setMaxRows, setPingTarget, setQueryTimeout, setResultSetConcurrency, setResultSetType, setupStreamingTimeout, statementBegins, unwrapMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface PreparedStatement
setNClob, setObject, setObject, setRowId, setSQLXMLMethods inherited from interface Statement
cancel, clearWarnings, closeOnCompletion, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, execute, execute, execute, execute, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isSimpleIdentifier, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setQueryTimeoutMethods inherited from interface Wrapper
isWrapperFor, unwrap
-
Field Details
-
BLOB_STREAM_READ_BUF_SIZE
protected static final int BLOB_STREAM_READ_BUF_SIZE- See Also:
-
isCached
protected boolean isCached
-
-
Constructor Details
-
ServerPreparedStatement
protected ServerPreparedStatement(MySQLConnection conn, String sql, String catalog, int resultSetType, int resultSetConcurrency) throws 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:
SQLException- If an error occurs
-
-
Method Details
-
getInstance
protected static ServerPreparedStatement getInstance(MySQLConnection conn, String sql, String catalog, int resultSetType, int resultSetConcurrency) throws 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:
SQLException
-
addBatch
JDBC 2.0 Add a set of parameters to the batch.- Specified by:
addBatchin interfacePreparedStatement- Overrides:
addBatchin classPreparedStatement- Throws:
SQLException- if a database-access error occurs.- See Also:
-
asSql
- Overrides:
asSqlin classPreparedStatement- Throws:
SQLException
-
checkClosed
Description copied from class:StatementImplChecks if closed() has been called, and throws an exception if so- Overrides:
checkClosedin classStatementImpl- Throws:
SQLException- if this statement has been closed
-
clearParameters
Description copied from class:PreparedStatementIn 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:
clearParametersin interfacePreparedStatement- Overrides:
clearParametersin classPreparedStatement- Throws:
SQLException- if a database access error occurs- See Also:
-
setClosed
protected void setClosed(boolean flag) -
close
Description copied from class:StatementImplIn 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceStatement- Overrides:
closein classStatementImpl- Throws:
SQLException- if a database access error occurs- See Also:
-
executeBatchSerially
Description copied from class:PreparedStatementExecutes the current batch of statements by executing them one-by-one.- Overrides:
executeBatchSeriallyin classPreparedStatement- Returns:
- a list of update counts
- Throws:
SQLException- if an error occurs
-
executeInternal
protected ResultSetInternalMethods executeInternal(int maxRowsToRetrieve, Buffer sendPacket, boolean createStreamingResultSet, boolean queryIsSelectOnly, Field[] metadataFromCache, boolean isBatch) throws SQLException Description copied from class:PreparedStatementActually execute the prepared statement. This is here so server-side PreparedStatements can re-use most of the code from this class.- Overrides:
executeInternalin classPreparedStatement- Parameters:
maxRowsToRetrieve- the max number of rows to returnsendPacket- the packet to sendcreateStreamingResultSet- should a 'streaming' result set be created?queryIsSelectOnly- is this query doing a SELECT?- Returns:
- the results as a ResultSet
- Throws:
SQLException- if an error occurs.- See Also:
-
fillSendPacket
Description copied from class:PreparedStatementCreates the packet that contains the query to be sent to the server.- Overrides:
fillSendPacketin classPreparedStatement- Returns:
- A Buffer filled with the query representing the PreparedStatement.
- Throws:
SQLException- if an error occurs.- See Also:
-
fillSendPacket
protected Buffer fillSendPacket(byte[][] batchedParameterStrings, InputStream[] batchedParameterStreams, boolean[] batchedIsStream, int[] batchedStreamLengths) throws SQLException Description copied from class:PreparedStatementCreates the packet that contains the query to be sent to the server.- Overrides:
fillSendPacketin classPreparedStatement- Parameters:
batchedParameterStrings- the parameters as stringsbatchedParameterStreams- the parameters as streamsbatchedIsStream- 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:
SQLException- if an error occurs.- See Also:
-
getBinding
protected ServerPreparedStatement.BindValue getBinding(int parameterIndex, boolean forLongData) throws SQLException Returns the structure representing the value that (can be)/(is) bound at the given parameter index.- Parameters:
parameterIndex- 1-basedforLongData- is this for a stream?- Throws:
SQLException
-
getParameterBindValues
Return current bind values for use by Statement Interceptors.- Returns:
- the bind values as set by setXXX and stored by addBatch
- See Also:
-
getBytes
- Throws:
SQLException- See Also:
-
getMetaData
Description copied from class:PreparedStatementThe number, types and properties of a ResultSet's columns are provided by the getMetaData method.- Specified by:
getMetaDatain interfacePreparedStatement- Overrides:
getMetaDatain classPreparedStatement- Returns:
- the description of a ResultSet's columns
- Throws:
SQLException- if a database-access error occurs.- See Also:
-
getParameterMetaData
- Specified by:
getParameterMetaDatain interfacePreparedStatement- Overrides:
getParameterMetaDatain classPreparedStatement- Throws:
SQLException- See Also:
-
isNull
boolean isNull(int paramIndex) - Overrides:
isNullin classPreparedStatement- See Also:
-
realClose
Closes this connection and frees all resources.- Overrides:
realClosein classPreparedStatement- Parameters:
calledExplicitly- was this called from close()?- Throws:
SQLException- if an error occurs
-
rePrepare
Used by Connection when auto-reconnecting to retrieve 'lost' prepared statements.- Throws:
SQLException- if an error occurs.
-
isCursorRequired
- Overrides:
isCursorRequiredin classStatementImpl- Throws:
SQLException
-
setArray
Description copied from class:PreparedStatementJDBC 2.0 Set an Array parameter.- Specified by:
setArrayin interfacePreparedStatement- Overrides:
setArrayin classPreparedStatement- Parameters:
i- the first parameter is 1, the second is 2, ...x- an object representing an SQL array- Throws:
SQLException- because this method is not implemented.- See Also:
-
setAsciiStream
Description copied from class:PreparedStatementWhen 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:
setAsciiStreamin interfacePreparedStatement- Overrides:
setAsciiStreamin classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1...x- the parameter valuelength- the number of bytes in the stream- Throws:
SQLException- if a database access error occurs- See Also:
-
setBigDecimal
Description copied from class:PreparedStatementSet 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:
setBigDecimalin interfacePreparedStatement- Overrides:
setBigDecimalin classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1...x- the parameter value- Throws:
SQLException- if a database access error occurs- See Also:
-
setBinaryStream
Description copied from class:PreparedStatementWhen 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:
setBinaryStreamin interfacePreparedStatement- Overrides:
setBinaryStreamin classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1...x- the parameter valuelength- the number of bytes to read from the stream (ignored)- Throws:
SQLException- if a database access error occurs- See Also:
-
setBlob
Description copied from class:PreparedStatementJDBC 2.0 Set a BLOB parameter.- Specified by:
setBlobin interfacePreparedStatement- Overrides:
setBlobin classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- an object representing a BLOB- Throws:
SQLException- if a database error occurs- See Also:
-
setBoolean
Description copied from class:PreparedStatementSet 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:
setBooleanin interfacePreparedStatement- Overrides:
setBooleanin classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1...x- the parameter value- Throws:
SQLException- if a database access error occurs- See Also:
-
setByte
Description copied from class:PreparedStatementSet 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:
setBytein interfacePreparedStatement- Overrides:
setBytein classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1...x- the parameter value- Throws:
SQLException- if a database access error occurs- See Also:
-
setBytes
Description copied from class:PreparedStatementSet 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:
setBytesin interfacePreparedStatement- Overrides:
setBytesin classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1...x- the parameter value- Throws:
SQLException- if a database access error occurs- See Also:
-
setCharacterStream
Description copied from class:PreparedStatementJDBC 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:
setCharacterStreamin interfacePreparedStatement- Overrides:
setCharacterStreamin classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...reader- the java reader which contains the UNICODE datalength- the number of characters in the stream- Throws:
SQLException- if a database-access error occurs.- See Also:
-
setClob
Description copied from class:PreparedStatementJDBC 2.0 Set a CLOB parameter.- Specified by:
setClobin interfacePreparedStatement- Overrides:
setClobin classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- an object representing a CLOB- Throws:
SQLException- if a database error occurs- See Also:
-
setDate
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:
setDatein interfacePreparedStatement- Overrides:
setDatein classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
SQLException- if a database-access error occurs.
-
setDate
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:
setDatein interfacePreparedStatement- Overrides:
setDatein classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter valuecal- the calendar to interpret the date with- Throws:
SQLException- if a database-access error occurs.
-
setDouble
Description copied from class:PreparedStatementSet 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:
setDoublein interfacePreparedStatement- Overrides:
setDoublein classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1...x- the parameter value- Throws:
SQLException- if a database access error occurs- See Also:
-
setFloat
Description copied from class:PreparedStatementSet 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:
setFloatin interfacePreparedStatement- Overrides:
setFloatin classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1...x- the parameter value- Throws:
SQLException- if a database access error occurs- See Also:
-
setInt
Description copied from class:PreparedStatementSet 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:
setIntin interfacePreparedStatement- Overrides:
setIntin classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1...x- the parameter value- Throws:
SQLException- if a database access error occurs- See Also:
-
setLong
Description copied from class:PreparedStatementSet 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:
setLongin interfacePreparedStatement- Overrides:
setLongin classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1...x- the parameter value- Throws:
SQLException- if a database access error occurs- See Also:
-
setNull
Description copied from class:PreparedStatementSet a parameter to SQL NULLNote: You must specify the parameters SQL type (although MySQL ignores it)
- Specified by:
setNullin interfacePreparedStatement- Overrides:
setNullin classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1, etc...sqlType- the SQL type code defined in java.sql.Types- Throws:
SQLException- if a database access error occurs- See Also:
-
setNull
Description copied from class:PreparedStatementSet a parameter to SQL NULL.Note: You must specify the parameter's SQL type.
- Specified by:
setNullin interfacePreparedStatement- Overrides:
setNullin classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...sqlType- SQL type code defined by java.sql.TypestypeName- argument parameters for null- Throws:
SQLException- if a database-access error occurs.- See Also:
-
setRef
Description copied from class:PreparedStatementJDBC 2.0 Set a REF(<structured-type>) parameter.- Specified by:
setRefin interfacePreparedStatement- Overrides:
setRefin classPreparedStatement- Parameters:
i- the first parameter is 1, the second is 2, ...x- an object representing data of an SQL REF Type- Throws:
SQLException- if a database error occurs- See Also:
-
setShort
Description copied from class:PreparedStatementSet 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:
setShortin interfacePreparedStatement- Overrides:
setShortin classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1...x- the parameter value- Throws:
SQLException- if a database access error occurs- See Also:
-
setString
Description copied from class:PreparedStatementSet 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:
setStringin interfacePreparedStatement- Overrides:
setStringin classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1...x- the parameter value- Throws:
SQLException- if a database access error occurs- See Also:
-
setTime
Set a parameter to a java.sql.Time value.- Specified by:
setTimein interfacePreparedStatement- Overrides:
setTimein classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1...));x- the parameter value- Throws:
SQLException- if a database access error occurs
-
setTime
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:
setTimein interfacePreparedStatement- Overrides:
setTimein classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1...));x- the parameter valuecal- the timezone to use- Throws:
SQLException- if a database access error occurs
-
setTimestamp
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:
setTimestampin interfacePreparedStatement- Overrides:
setTimestampin classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter value- Throws:
SQLException- if a database-access error occurs.
-
setTimestamp
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:
setTimestampin interfacePreparedStatement- Overrides:
setTimestampin classPreparedStatement- Parameters:
parameterIndex- the first parameter is 1, the second is 2, ...x- the parameter valuecal- the timezone to use- Throws:
SQLException- if a database-access error occurs.
-
resetToType
protected void resetToType(ServerPreparedStatement.BindValue oldValue, int bufferType) throws SQLException Reset a bind value to be used for a new value of the given type.- Throws:
SQLException
-
setUnicodeStream
@Deprecated public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException Deprecated.Description copied from class:PreparedStatementWhen 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.
- Specified by:
setUnicodeStreamin interfacePreparedStatement- Overrides:
setUnicodeStreamin classPreparedStatement- Parameters:
parameterIndex-x-length-- Throws:
SQLExceptionNotImplemented- See Also:
-
setURL
- Specified by:
setURLin interfacePreparedStatement- Overrides:
setURLin classPreparedStatement- Throws:
SQLException- See Also:
-
toString
Description copied from class:PreparedStatementReturns this PreparedStatement represented as a string.- Overrides:
toStringin classPreparedStatement- Returns:
- this PreparedStatement represented as a string.
- See Also:
-
getServerStatementId
protected long getServerStatementId() -
canRewriteAsMultiValueInsertAtSqlLevel
- Overrides:
canRewriteAsMultiValueInsertAtSqlLevelin classPreparedStatement- Throws:
SQLException
-
getLocationOfOnDuplicateKeyUpdate
- Overrides:
getLocationOfOnDuplicateKeyUpdatein classPreparedStatement- Throws:
SQLException
-
isOnDuplicateKeyUpdate
- Throws:
SQLException
-
computeMaxParameterSetSizeAndBatchSize
Computes the maximum parameter set size, and entire batch size given the number of arguments in the batch.- Overrides:
computeMaxParameterSetSizeAndBatchSizein classPreparedStatement- Throws:
SQLException
-
setOneBatchedParameterSet
protected int setOneBatchedParameterSet(PreparedStatement batchedStatement, int batchedParamIndex, Object paramSet) throws SQLException - Overrides:
setOneBatchedParameterSetin classPreparedStatement- Throws:
SQLException
-
containsOnDuplicateKeyUpdateInSQL
protected boolean containsOnDuplicateKeyUpdateInSQL()- Overrides:
containsOnDuplicateKeyUpdateInSQLin classPreparedStatement
-
prepareBatchedInsertSQL
protected PreparedStatement prepareBatchedInsertSQL(MySQLConnection localConn, int numBatches) throws SQLException Description copied from class:PreparedStatementReturns a prepared statement for the number of batched parameters, used when re-writing batch INSERTs.- Overrides:
prepareBatchedInsertSQLin classPreparedStatement- Throws:
SQLException
-
setPoolable
- Specified by:
setPoolablein interfaceStatement- Overrides:
setPoolablein classStatementImpl- Throws:
SQLException
-