Package com.mysql.cj.jdbc
Class ClientPreparedStatement
java.lang.Object
com.mysql.cj.jdbc.StatementImpl
com.mysql.cj.jdbc.ClientPreparedStatement
- All Implemented Interfaces:
JdbcPreparedStatement,JdbcStatement,Query,java.lang.AutoCloseable,java.sql.PreparedStatement,java.sql.Statement,java.sql.Wrapper
- Direct Known Subclasses:
CallableStatement,ServerPreparedStatement
public class ClientPreparedStatement extends StatementImpl implements JdbcPreparedStatement
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.
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringbatchedValuesClauseprotected booleanbatchHasPlainStatementsDoes 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.protected MysqlParameterMetadataparameterMetaDataprotected intrewrittenBatchSizeFields inherited from class com.mysql.cj.jdbc.StatementImpl
batchedGeneratedKeys, charEncoding, commandBuilder, connection, continueBatchOnError, doEscapeProcessing, dontCheckOnDuplicateKeyUpdateInSQL, dontTrackOpenResources, dumpQueriesOnException, exceptionInterceptor, generatedKeysResults, holdResultsOpenOverClose, isClosed, lastInsertId, lastQueryIsOnDupKeyUpdate, logSlowQueries, maxAllowedPacket, maxFieldSize, maxRows, openResults, pedantic, PING_MARKER, pingTarget, profileSQL, query, results, resultSetConcurrency, resultSetFactory, retrieveGeneratedKeys, rewriteBatchedStatements, session, updateCount, USES_VARIABLES_FALSE, USES_VARIABLES_TRUE, USES_VARIABLES_UNKNOWN, useUsageAdvisor, warningChain -
Constructor Summary
Constructors Modifier Constructor Description protectedClientPreparedStatement(JdbcConnection conn, java.lang.String db)Constructor used by server-side prepared statementsClientPreparedStatement(JdbcConnection conn, java.lang.String sql, java.lang.String db)Constructor for the PreparedStatement class.ClientPreparedStatement(JdbcConnection conn, java.lang.String sql, java.lang.String db, ParseInfo cachedParseInfo)Creates a new PreparedStatement object. -
Method Summary
Modifier and Type Method Description voidaddBatch()voidaddBatch(java.lang.String sql)java.lang.StringasSql()java.lang.StringasSql(boolean quoteStreamsAndUnknowns)protected voidcheckBounds(int paramIndex, int parameterIndexOffset)protected booleancheckReadOnlySafeStatement()Check to see if the statement is safe for read-only replicas after failover.voidclearBatch()voidclearParameters()protected booleancontainsOnDuplicateKeyUpdateInSQL()booleanexecute()protected long[]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 long[]executeBatchInternal()protected long[]executeBatchSerially(int batchTimeout)Executes the current batch of statements by executing them one-by-one.protected <M extends Message>
ResultSetInternalMethodsexecuteInternal(int maxRowsToRetrieve, M sendPacket, boolean createStreamingResultSet, boolean queryIsSelectOnly, ColumnDefinition metadata, boolean isBatch)Actually execute the prepared statement.longexecuteLargeUpdate()protected long[]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.java.sql.ResultSetexecuteQuery()intexecuteUpdate()protected longexecuteUpdateInternal(boolean clearBatchedGeneratedKeysAndWarnings, boolean isBatch)protected longexecuteUpdateInternal(QueryBindings<?> bindings, boolean isReallyBatch)Added to allow batch-updatesbyte[]getBytesRepresentation(int parameterIndex)intgetCoreParameterIndex(int paramIndex)protected static ClientPreparedStatementgetInstance(JdbcConnection conn, java.lang.String sql, java.lang.String db)Creates a prepared statement instanceprotected static ClientPreparedStatementgetInstance(JdbcConnection conn, java.lang.String sql, java.lang.String db, ParseInfo cachedParseInfo)Creates a prepared statement instancejava.sql.ResultSetMetaDatagetMetaData()byte[]getOrigBytes(int parameterIndex)ParameterBindingsgetParameterBindings()protected intgetParameterIndexOffset()For calling stored functions, this will be -1 as Connector/J does not count the first '?' parameter marker, but JDBC counts it * as 1, otherwise it will return 0java.sql.ParameterMetaDatagetParameterMetaData()ParseInfogetParseInfo()java.lang.StringgetPreparedSql()QueryBindings<?>getQueryBindings()intgetUpdateCount()protected voidinitQuery()booleanisNull(int paramIndex)protected booleanisSelectQuery()protected ClientPreparedStatementprepareBatchedInsertSQL(JdbcConnection localConn, int numBatches)Returns a prepared statement for the number of batched parameters, used when re-writing batch INSERTs.voidrealClose(boolean calledExplicitly, boolean closeOpenResults)Closes this statement, and frees resources.voidsetArray(int i, java.sql.Array x)voidsetAsciiStream(int parameterIndex, java.io.InputStream x)voidsetAsciiStream(int parameterIndex, java.io.InputStream x, int length)voidsetAsciiStream(int parameterIndex, java.io.InputStream x, long length)voidsetBigDecimal(int parameterIndex, java.math.BigDecimal x)voidsetBigInteger(int parameterIndex, java.math.BigInteger x)voidsetBinaryStream(int parameterIndex, java.io.InputStream x)voidsetBinaryStream(int parameterIndex, java.io.InputStream x, int length)voidsetBinaryStream(int parameterIndex, java.io.InputStream x, long length)voidsetBlob(int parameterIndex, java.io.InputStream inputStream)voidsetBlob(int parameterIndex, java.io.InputStream inputStream, long length)voidsetBlob(int i, java.sql.Blob x)voidsetBoolean(int parameterIndex, boolean x)voidsetByte(int parameterIndex, byte x)voidsetBytes(int parameterIndex, byte[] x)voidsetBytes(int parameterIndex, byte[] x, boolean checkForIntroducer, boolean escapeForMBChars)voidsetBytesNoEscape(int parameterIndex, byte[] parameterAsBytes)Used by updatable result sets for refreshRow() because the parameter has already been escaped for updater or inserter prepared statements.voidsetBytesNoEscapeNoQuotes(int parameterIndex, byte[] parameterAsBytes)voidsetCharacterStream(int parameterIndex, java.io.Reader reader)voidsetCharacterStream(int parameterIndex, java.io.Reader reader, int length)voidsetCharacterStream(int parameterIndex, java.io.Reader reader, long length)voidsetClob(int parameterIndex, java.io.Reader reader)voidsetClob(int parameterIndex, java.io.Reader reader, long length)voidsetClob(int i, java.sql.Clob x)voidsetDate(int parameterIndex, java.sql.Date x)voidsetDate(int parameterIndex, java.sql.Date x, java.util.Calendar cal)voidsetDouble(int parameterIndex, double x)voidsetFloat(int parameterIndex, float x)voidsetInt(int parameterIndex, int x)voidsetLong(int parameterIndex, long x)voidsetNCharacterStream(int parameterIndex, java.io.Reader value)voidsetNCharacterStream(int parameterIndex, java.io.Reader reader, long length)voidsetNClob(int parameterIndex, java.io.Reader reader)voidsetNClob(int parameterIndex, java.io.Reader reader, long length)voidsetNClob(int parameterIndex, java.sql.NClob value)voidsetNString(int parameterIndex, java.lang.String x)Set a parameter to a Java String value.voidsetNull(int parameterIndex, int sqlType)voidsetNull(int parameterIndex, int sqlType, java.lang.String typeName)voidsetNull(int parameterIndex, MysqlType mysqlType)voidsetObject(int parameterIndex, java.lang.Object parameterObj)voidsetObject(int parameterIndex, java.lang.Object parameterObj, int targetSqlType)voidsetObject(int parameterIndex, java.lang.Object parameterObj, int targetSqlType, int scale)voidsetObject(int parameterIndex, java.lang.Object parameterObj, java.sql.SQLType targetSqlType)voidsetObject(int parameterIndex, java.lang.Object x, java.sql.SQLType targetSqlType, int scaleOrLength)protected intsetOneBatchedParameterSet(java.sql.PreparedStatement batchedStatement, int batchedParamIndex, java.lang.Object paramSet)voidsetRef(int i, java.sql.Ref x)protected voidsetRetrieveGeneratedKeys(boolean flag)voidsetRowId(int parameterIndex, java.sql.RowId x)voidsetShort(int parameterIndex, short x)voidsetSQLXML(int parameterIndex, java.sql.SQLXML xmlObject)voidsetString(int parameterIndex, java.lang.String x)voidsetTime(int parameterIndex, java.sql.Time x)voidsetTime(int parameterIndex, java.sql.Time x, java.util.Calendar cal)voidsetTimestamp(int parameterIndex, java.sql.Timestamp x)voidsetTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar cal)voidsetTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar targetCalendar, int fractionalLength)voidsetUnicodeStream(int parameterIndex, java.io.InputStream x, int length)Deprecated.voidsetURL(int parameterIndex, java.net.URL arg)java.lang.StringtoString()Returns this PreparedStatement represented as a string.Methods inherited from class com.mysql.cj.jdbc.StatementImpl
addBatch, cancel, checkCancelTimeout, checkClosed, checkForDml, checkNullOrEmptyQuery, clearBatchedArgs, clearWarnings, close, closeAllOpenResults, closeOnCompletion, closeQuery, 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, getCancelTimeoutMutex, getConnection, getCurrentDatabase, getExceptionInterceptor, getExecuteTime, getFetchDirection, getFetchSize, getGeneratedKeys, getGeneratedKeysInternal, getGeneratedKeysInternal, getId, getLargeMaxRows, getLargeUpdateCount, getLastInsertID, getLocalInfileInputStream, getLongUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getOpenResultSetCount, getQuery, getQueryTimeout, getResultFetchSize, getResultSet, getResultSetConcurrency, getResultSetFactory, getResultSetHoldability, getResultSetInternal, getResultSetType, getResultType, getServerStatementId, getSession, getStatementExecuting, getTimeoutInMillis, getWarnings, handleExceptionForBatch, hasDeadlockOrTimeoutRolledBackTx, implicitlyCloseAllOpenResults, isClearWarningsCalled, isClosed, isCloseOnCompletion, isPoolable, isWrapperFor, processMultiCountsAndKeys, removeOpenResultSet, resetCancelledState, setCancelStatus, setClearWarningsCalled, setCurrentDatabase, setCursorName, setEscapeProcessing, setExecuteTime, setFetchDirection, setFetchSize, setHoldResultsOpenOverClose, setLargeMaxRows, setLocalInfileInputStream, setMaxFieldSize, setMaxRows, setPingTarget, setPoolable, setQueryTimeout, setResultFetchSize, setResultType, setTimeoutInMillis, setupStreamingTimeout, startQueryTimer, statementBegins, stopQueryTimer, unwrapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.mysql.cj.jdbc.JdbcStatement
disableStreamingResults, enableStreamingResults, getExceptionInterceptor, getLocalInfileInputStream, getOpenResultSetCount, getQuery, removeOpenResultSet, setHoldResultsOpenOverClose, setLocalInfileInputStream, setPingTargetMethods inherited from interface com.mysql.cj.Query
addBatch, checkCancelTimeout, clearBatchedArgs, closeQuery, getBatchedArgs, getCancelTimeoutMutex, getCurrentDatabase, getExecuteTime, getId, getResultFetchSize, getResultSetFactory, getResultType, getSession, getStatementExecuting, getTimeoutInMillis, isClearWarningsCalled, resetCancelledState, setCancelStatus, setClearWarningsCalled, setCurrentDatabase, setExecuteTime, setResultFetchSize, setResultType, setTimeoutInMillis, startQueryTimer, statementBegins, stopQueryTimerMethods inherited from interface java.sql.Statement
cancel, clearWarnings, close, 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, setPoolable, setQueryTimeout
-
Field Details
-
batchHasPlainStatements
protected boolean batchHasPlainStatementsDoes 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. -
parameterMetaData
-
batchedValuesClause
protected java.lang.String batchedValuesClause -
rewrittenBatchSize
protected int rewrittenBatchSize
-
-
Constructor Details
-
ClientPreparedStatement
protected ClientPreparedStatement(JdbcConnection conn, java.lang.String db) throws java.sql.SQLExceptionConstructor used by server-side prepared statements- Parameters:
conn- the connection that created usdb- the database in use when we were created- Throws:
java.sql.SQLException- if an error occurs
-
ClientPreparedStatement
public ClientPreparedStatement(JdbcConnection conn, java.lang.String sql, java.lang.String db) throws java.sql.SQLExceptionConstructor for the PreparedStatement class.- Parameters:
conn- the connection creating this statementsql- the SQL for this statementdb- the database this statement should be issued against- Throws:
java.sql.SQLException- if a database error occurs.
-
ClientPreparedStatement
public ClientPreparedStatement(JdbcConnection conn, java.lang.String sql, java.lang.String db, ParseInfo cachedParseInfo) throws java.sql.SQLExceptionCreates a new PreparedStatement object.- Parameters:
conn- the connection creating this statementsql- the SQL for this statementdb- the database this statement should be issued againstcachedParseInfo- already created parseInfo or null.- Throws:
java.sql.SQLException- if a database access error occurs
-
-
Method Details
-
getInstance
protected static ClientPreparedStatement getInstance(JdbcConnection conn, java.lang.String sql, java.lang.String db) throws java.sql.SQLExceptionCreates a prepared statement instance- Parameters:
conn- the connection creating this statementsql- the SQL for this statementdb- the database this statement should be issued against- Returns:
- ClientPreparedStatement
- Throws:
java.sql.SQLException- if a database access error occurs
-
getInstance
protected static ClientPreparedStatement getInstance(JdbcConnection conn, java.lang.String sql, java.lang.String db, ParseInfo cachedParseInfo) throws java.sql.SQLExceptionCreates a prepared statement instance- Parameters:
conn- the connection creating this statementsql- the SQL for this statementdb- the database this statement should be issued againstcachedParseInfo- already created parseInfo or null.- Returns:
- ClientPreparedStatement instance
- Throws:
java.sql.SQLException- if a database access error occurs
-
initQuery
protected void initQuery()- Overrides:
initQueryin classStatementImpl
-
getQueryBindings
- Specified by:
getQueryBindingsin interfaceJdbcPreparedStatement
-
toString
public java.lang.String toString()Returns this PreparedStatement represented as a string.- Overrides:
toStringin classjava.lang.Object- Returns:
- this PreparedStatement represented as a string.
-
addBatch
public void addBatch() throws java.sql.SQLException- Specified by:
addBatchin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
addBatch
public void addBatch(java.lang.String sql) throws java.sql.SQLException- Specified by:
addBatchin interfacejava.sql.Statement- Overrides:
addBatchin classStatementImpl- Throws:
java.sql.SQLException
-
asSql
public java.lang.String asSql() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
asSql
public java.lang.String asSql(boolean quoteStreamsAndUnknowns) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
clearBatch
public void clearBatch() throws java.sql.SQLException- Specified by:
clearBatchin interfacejava.sql.Statement- Overrides:
clearBatchin classStatementImpl- Throws:
java.sql.SQLException
-
clearParameters
public void clearParameters() throws java.sql.SQLException- Specified by:
clearParametersin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
checkReadOnlySafeStatement
protected boolean checkReadOnlySafeStatement() throws java.sql.SQLExceptionCheck to see if the statement is safe for read-only replicas after failover.- Returns:
- true if safe for read-only.
- Throws:
java.sql.SQLException- if a database access error occurs or this method is called on a closed PreparedStatement
-
execute
public boolean execute() throws java.sql.SQLException- Specified by:
executein interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
executeBatchInternal
protected long[] executeBatchInternal() throws java.sql.SQLException- Overrides:
executeBatchInternalin classStatementImpl- Throws:
java.sql.SQLException
-
executePreparedBatchAsMultiStatement
protected long[] executePreparedBatchAsMultiStatement(int batchTimeout) throws java.sql.SQLExceptionRewrites the already prepared statement into a multi-statement query of 'statementsPerBatch' values and executes the entire batch using this new statement.- Parameters:
batchTimeout- timeout for the batch execution- Returns:
- update counts in the same fashion as executeBatch()
- Throws:
java.sql.SQLException- if a database access error occurs or this method is called on a closed PreparedStatement
-
setOneBatchedParameterSet
protected int setOneBatchedParameterSet(java.sql.PreparedStatement batchedStatement, int batchedParamIndex, java.lang.Object paramSet) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
executeBatchedInserts
protected long[] executeBatchedInserts(int batchTimeout) throws java.sql.SQLExceptionRewrites the already prepared statement into a multi-value insert statement of 'statementsPerBatch' values and executes the entire batch using this new statement.- Parameters:
batchTimeout- timeout for the batch execution- Returns:
- update counts in the same fashion as executeBatch()
- Throws:
java.sql.SQLException- if a database access error occurs or this method is called on a closed PreparedStatement
-
executeBatchSerially
protected long[] executeBatchSerially(int batchTimeout) throws java.sql.SQLExceptionExecutes the current batch of statements by executing them one-by-one.- Parameters:
batchTimeout- timeout for the batch execution- Returns:
- a list of update counts
- Throws:
java.sql.SQLException- if an error occurs
-
executeInternal
protected <M extends Message> ResultSetInternalMethods executeInternal(int maxRowsToRetrieve, M sendPacket, boolean createStreamingResultSet, boolean queryIsSelectOnly, ColumnDefinition metadata, boolean isBatch) throws java.sql.SQLExceptionActually execute the prepared statement. This is here so server-side PreparedStatements can re-use most of the code from this class.- Type Parameters:
M- extendsMessage- 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?metadata- use this metadata instead of the one provided on wireisBatch- is this a batch query?- Returns:
- the results as a ResultSet
- Throws:
java.sql.SQLException- if an error occurs.
-
executeQuery
public java.sql.ResultSet executeQuery() throws java.sql.SQLException- Specified by:
executeQueryin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
executeUpdate
public int executeUpdate() throws java.sql.SQLException- Specified by:
executeUpdatein interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
executeUpdateInternal
protected long executeUpdateInternal(boolean clearBatchedGeneratedKeysAndWarnings, boolean isBatch) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
executeUpdateInternal
protected long executeUpdateInternal(QueryBindings<?> bindings, boolean isReallyBatch) throws java.sql.SQLExceptionAdded to allow batch-updates- Parameters:
bindings- bindings objectisReallyBatch- is it a batched statement?- Returns:
- the update count
- Throws:
java.sql.SQLException- if a database error occurs
-
containsOnDuplicateKeyUpdateInSQL
protected boolean containsOnDuplicateKeyUpdateInSQL() -
prepareBatchedInsertSQL
protected ClientPreparedStatement prepareBatchedInsertSQL(JdbcConnection localConn, int numBatches) throws java.sql.SQLExceptionReturns a prepared statement for the number of batched parameters, used when re-writing batch INSERTs.- Parameters:
localConn- the connection creating this statementnumBatches- number of entries in a batch- Returns:
- new ClientPreparedStatement
- Throws:
java.sql.SQLException- if a database access error occurs or this method is called on a closed PreparedStatement
-
setRetrieveGeneratedKeys
protected void setRetrieveGeneratedKeys(boolean flag) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getBytesRepresentation
public byte[] getBytesRepresentation(int parameterIndex) throws java.sql.SQLException- Specified by:
getBytesRepresentationin interfaceJdbcPreparedStatement- Throws:
java.sql.SQLException
-
getOrigBytes
public byte[] getOrigBytes(int parameterIndex) throws java.sql.SQLException- Specified by:
getOrigBytesin interfaceJdbcPreparedStatement- Throws:
java.sql.SQLException
-
getMetaData
public java.sql.ResultSetMetaData getMetaData() throws java.sql.SQLException- Specified by:
getMetaDatain interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
isSelectQuery
protected boolean isSelectQuery() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getParameterMetaData
public java.sql.ParameterMetaData getParameterMetaData() throws java.sql.SQLException- Specified by:
getParameterMetaDatain interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
getParseInfo
- Specified by:
getParseInfoin interfaceJdbcPreparedStatement
-
isNull
public boolean isNull(int paramIndex) throws java.sql.SQLException- Specified by:
isNullin interfaceJdbcPreparedStatement- Throws:
java.sql.SQLException
-
realClose
public void realClose(boolean calledExplicitly, boolean closeOpenResults) throws java.sql.SQLExceptionDescription copied from class:StatementImplCloses this statement, and frees resources.- Specified by:
realClosein interfaceJdbcPreparedStatement- Overrides:
realClosein classStatementImpl- Parameters:
calledExplicitly- was this called from close()?closeOpenResults- should open result sets be closed?- Throws:
java.sql.SQLException- if an error occurs
-
getPreparedSql
public java.lang.String getPreparedSql()- Specified by:
getPreparedSqlin interfaceJdbcPreparedStatement
-
getUpdateCount
public int getUpdateCount() throws java.sql.SQLException- Specified by:
getUpdateCountin interfacejava.sql.Statement- Overrides:
getUpdateCountin classStatementImpl- Throws:
java.sql.SQLException
-
executeLargeUpdate
public long executeLargeUpdate() throws java.sql.SQLException- Specified by:
executeLargeUpdatein interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
getParameterBindings
- Specified by:
getParameterBindingsin interfaceJdbcPreparedStatement- Throws:
java.sql.SQLException
-
getParameterIndexOffset
protected int getParameterIndexOffset()For calling stored functions, this will be -1 as Connector/J does not count the first '?' parameter marker, but JDBC counts it * as 1, otherwise it will return 0- Returns:
- offset
-
checkBounds
protected void checkBounds(int paramIndex, int parameterIndexOffset) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getCoreParameterIndex
public final int getCoreParameterIndex(int paramIndex) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setArray
public void setArray(int i, java.sql.Array x) throws java.sql.SQLException- Specified by:
setArrayin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setAsciiStream
public void setAsciiStream(int parameterIndex, java.io.InputStream x) throws java.sql.SQLException- Specified by:
setAsciiStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setAsciiStream
public void setAsciiStream(int parameterIndex, java.io.InputStream x, int length) throws java.sql.SQLException- Specified by:
setAsciiStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setAsciiStream
public void setAsciiStream(int parameterIndex, java.io.InputStream x, long length) throws java.sql.SQLException- Specified by:
setAsciiStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBigDecimal
public void setBigDecimal(int parameterIndex, java.math.BigDecimal x) throws java.sql.SQLException- Specified by:
setBigDecimalin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBinaryStream
public void setBinaryStream(int parameterIndex, java.io.InputStream x) throws java.sql.SQLException- Specified by:
setBinaryStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBinaryStream
public void setBinaryStream(int parameterIndex, java.io.InputStream x, int length) throws java.sql.SQLException- Specified by:
setBinaryStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBinaryStream
public void setBinaryStream(int parameterIndex, java.io.InputStream x, long length) throws java.sql.SQLException- Specified by:
setBinaryStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBlob
public void setBlob(int i, java.sql.Blob x) throws java.sql.SQLException- Specified by:
setBlobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBlob
public void setBlob(int parameterIndex, java.io.InputStream inputStream) throws java.sql.SQLException- Specified by:
setBlobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBlob
public void setBlob(int parameterIndex, java.io.InputStream inputStream, long length) throws java.sql.SQLException- Specified by:
setBlobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBoolean
public void setBoolean(int parameterIndex, boolean x) throws java.sql.SQLException- Specified by:
setBooleanin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setByte
public void setByte(int parameterIndex, byte x) throws java.sql.SQLException- Specified by:
setBytein interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBytes
public void setBytes(int parameterIndex, byte[] x) throws java.sql.SQLException- Specified by:
setBytesin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBytes
public void setBytes(int parameterIndex, byte[] x, boolean checkForIntroducer, boolean escapeForMBChars) throws java.sql.SQLException- Specified by:
setBytesin interfaceJdbcPreparedStatement- Throws:
java.sql.SQLException
-
setBytesNoEscape
public void setBytesNoEscape(int parameterIndex, byte[] parameterAsBytes) throws java.sql.SQLExceptionDescription copied from interface:JdbcPreparedStatementUsed by updatable result sets for refreshRow() because the parameter has already been escaped for updater or inserter prepared statements.- Specified by:
setBytesNoEscapein interfaceJdbcPreparedStatement- Parameters:
parameterIndex- the parameter to set.parameterAsBytes- the parameter as a string.- Throws:
java.sql.SQLException- if an error occurs
-
setBytesNoEscapeNoQuotes
public void setBytesNoEscapeNoQuotes(int parameterIndex, byte[] parameterAsBytes) throws java.sql.SQLException- Specified by:
setBytesNoEscapeNoQuotesin interfaceJdbcPreparedStatement- Throws:
java.sql.SQLException
-
setCharacterStream
public void setCharacterStream(int parameterIndex, java.io.Reader reader) throws java.sql.SQLException- Specified by:
setCharacterStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setCharacterStream
public void setCharacterStream(int parameterIndex, java.io.Reader reader, int length) throws java.sql.SQLException- Specified by:
setCharacterStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setCharacterStream
public void setCharacterStream(int parameterIndex, java.io.Reader reader, long length) throws java.sql.SQLException- Specified by:
setCharacterStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setClob
public void setClob(int parameterIndex, java.io.Reader reader) throws java.sql.SQLException- Specified by:
setClobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setClob
public void setClob(int parameterIndex, java.io.Reader reader, long length) throws java.sql.SQLException- Specified by:
setClobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setClob
public void setClob(int i, java.sql.Clob x) throws java.sql.SQLException- Specified by:
setClobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setDate
public void setDate(int parameterIndex, java.sql.Date x) throws java.sql.SQLException- Specified by:
setDatein interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setDate
public void setDate(int parameterIndex, java.sql.Date x, java.util.Calendar cal) throws java.sql.SQLException- Specified by:
setDatein interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setDouble
public void setDouble(int parameterIndex, double x) throws java.sql.SQLException- Specified by:
setDoublein interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setFloat
public void setFloat(int parameterIndex, float x) throws java.sql.SQLException- Specified by:
setFloatin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setInt
public void setInt(int parameterIndex, int x) throws java.sql.SQLException- Specified by:
setIntin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setLong
public void setLong(int parameterIndex, long x) throws java.sql.SQLException- Specified by:
setLongin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBigInteger
public void setBigInteger(int parameterIndex, java.math.BigInteger x) throws java.sql.SQLException- Specified by:
setBigIntegerin interfaceJdbcPreparedStatement- Throws:
java.sql.SQLException
-
setNCharacterStream
public void setNCharacterStream(int parameterIndex, java.io.Reader value) throws java.sql.SQLException- Specified by:
setNCharacterStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNCharacterStream
public void setNCharacterStream(int parameterIndex, java.io.Reader reader, long length) throws java.sql.SQLException- Specified by:
setNCharacterStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNClob
public void setNClob(int parameterIndex, java.io.Reader reader) throws java.sql.SQLException- Specified by:
setNClobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNClob
public void setNClob(int parameterIndex, java.io.Reader reader, long length) throws java.sql.SQLException- Specified by:
setNClobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNClob
public void setNClob(int parameterIndex, java.sql.NClob value) throws java.sql.SQLException- Specified by:
setNClobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNString
public void setNString(int parameterIndex, java.lang.String x) throws java.sql.SQLExceptionSet 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.- Specified by:
setNStringin interfacejava.sql.PreparedStatement- Parameters:
parameterIndex- the first parameter is 1...x- the parameter value- Throws:
java.sql.SQLException- if a database access error occurs
-
setNull
public void setNull(int parameterIndex, int sqlType) throws java.sql.SQLException- Specified by:
setNullin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNull
public void setNull(int parameterIndex, int sqlType, java.lang.String typeName) throws java.sql.SQLException- Specified by:
setNullin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNull
- Specified by:
setNullin interfaceJdbcPreparedStatement- Throws:
java.sql.SQLException
-
setObject
public void setObject(int parameterIndex, java.lang.Object parameterObj) throws java.sql.SQLException- Specified by:
setObjectin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setObject
public void setObject(int parameterIndex, java.lang.Object parameterObj, int targetSqlType) throws java.sql.SQLException- Specified by:
setObjectin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setObject
public void setObject(int parameterIndex, java.lang.Object parameterObj, java.sql.SQLType targetSqlType) throws java.sql.SQLException- Specified by:
setObjectin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setObject
public void setObject(int parameterIndex, java.lang.Object parameterObj, int targetSqlType, int scale) throws java.sql.SQLException- Specified by:
setObjectin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setObject
public void setObject(int parameterIndex, java.lang.Object x, java.sql.SQLType targetSqlType, int scaleOrLength) throws java.sql.SQLException- Specified by:
setObjectin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setRef
public void setRef(int i, java.sql.Ref x) throws java.sql.SQLException- Specified by:
setRefin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setRowId
public void setRowId(int parameterIndex, java.sql.RowId x) throws java.sql.SQLException- Specified by:
setRowIdin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setShort
public void setShort(int parameterIndex, short x) throws java.sql.SQLException- Specified by:
setShortin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setSQLXML
public void setSQLXML(int parameterIndex, java.sql.SQLXML xmlObject) throws java.sql.SQLException- Specified by:
setSQLXMLin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setString
public void setString(int parameterIndex, java.lang.String x) throws java.sql.SQLException- Specified by:
setStringin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setTime
public void setTime(int parameterIndex, java.sql.Time x) throws java.sql.SQLException- Specified by:
setTimein interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setTime
public void setTime(int parameterIndex, java.sql.Time x, java.util.Calendar cal) throws java.sql.SQLException- Specified by:
setTimein interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setTimestamp
public void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws java.sql.SQLException- Specified by:
setTimestampin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setTimestamp
public void setTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar cal) throws java.sql.SQLException- Specified by:
setTimestampin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setTimestamp
public void setTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar targetCalendar, int fractionalLength) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setUnicodeStream
@Deprecated public void setUnicodeStream(int parameterIndex, java.io.InputStream x, int length) throws java.sql.SQLExceptionDeprecated.- Specified by:
setUnicodeStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setURL
public void setURL(int parameterIndex, java.net.URL arg) throws java.sql.SQLException- Specified by:
setURLin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-