Package com.mysql.cj.jdbc
Class StatementImpl
java.lang.Object
com.mysql.cj.jdbc.StatementImpl
- All Implemented Interfaces:
JdbcStatement,Query,java.lang.AutoCloseable,java.sql.Statement,java.sql.Wrapper
- Direct Known Subclasses:
ClientPreparedStatement
public class StatementImpl extends java.lang.Object implements JdbcStatement
A Statement object is used for executing a static SQL statement and obtaining
the results produced by it.
Only one ResultSet per Statement can be open at any point in time. Therefore, if the reading of one ResultSet is interleaved with the reading of another,
each must have been generated by different Statements. All statement execute methods implicitly close a statement's current ResultSet if an open one exists.
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description protected java.util.ArrayList<Row>batchedGeneratedKeysprotected java.lang.StringcharEncodingThe character encoding to use (if available)protected NativeMessageBuildercommandBuilderprotected JdbcConnectionconnectionThe connection that created usprotected booleancontinueBatchOnErrorprotected booleandoEscapeProcessingShould we process escape codes?protected booleandontCheckOnDuplicateKeyUpdateInSQLprotected RuntimeProperty<java.lang.Boolean>dontTrackOpenResourcesprotected RuntimeProperty<java.lang.Boolean>dumpQueriesOnExceptionprotected ExceptionInterceptorexceptionInterceptorprotected ResultSetInternalMethodsgeneratedKeysResultsprotected booleanholdResultsOpenOverCloseShould this statement hold results open over .close() irregardless of connection's setting?protected booleanisClosedHas this statement been closed?protected longlastInsertIdThe auto_increment value for the last insertprotected booleanlastQueryIsOnDupKeyUpdateWhether or not the last query was of the form ON DUPLICATE KEY UPDATEprotected booleanlogSlowQueriesprotected RuntimeProperty<java.lang.Integer>maxAllowedPacketprotected intmaxFieldSizeThe max field size for this statementintmaxRowsThe maximum number of rows to return for this statement (-1 means _all_ rows)protected java.util.Set<ResultSetInternalMethods>openResultsSet of currently-open ResultSetsprotected booleanpedanticAre we in pedantic mode?protected static java.lang.StringPING_MARKERprotected PingTargetpingTargetprotected booleanprofileSQLShould we profile?protected Queryqueryprotected ResultSetInternalMethodsresultsThe current resultsprotected intresultSetConcurrencyThe concurrency for this result set (updatable or not)protected ResultSetFactoryresultSetFactoryprotected booleanretrieveGeneratedKeysprotected RuntimeProperty<java.lang.Boolean>rewriteBatchedStatementsprotected NativeSessionsessionprotected longupdateCountThe update count for this statementstatic byteUSES_VARIABLES_FALSEstatic byteUSES_VARIABLES_TRUEstatic byteUSES_VARIABLES_UNKNOWNprotected booleanuseUsageAdvisorShould we use the usage advisor?protected java.sql.SQLWarningwarningChainThe warnings chain. -
Constructor Summary
Constructors Constructor Description StatementImpl(JdbcConnection c, java.lang.String db)Constructor for a Statement. -
Method Summary
Modifier and Type Method Description voidaddBatch(java.lang.Object batch)voidaddBatch(java.lang.String sql)voidcancel()voidcheckCancelTimeout()protected JdbcConnectioncheckClosed()Checks if closed() has been called, and throws an exception if soprotected voidcheckForDml(java.lang.String sql, char firstStatementChar)Checks if the given SQL query with the given first non-ws char is a DML statement.protected voidcheckNullOrEmptyQuery(java.lang.String sql)Method checkNullOrEmptyQuery.voidclearBatch()voidclearBatchedArgs()voidclearWarnings()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 voidcloseAllOpenResults()Close any open result sets that have been 'held open'voidcloseOnCompletion()voidcloseQuery()protected booleancontainsOnDuplicateKeyInString(java.lang.String sql)protected booleancreateStreamingResultSet()We only stream result sets when they are forward-only, read-only, and the fetch size has been set to Integer.MIN_VALUEvoiddisableStreamingResults()Resets this statements fetch size and result set type to the values they had before enableStreamingResults() was called.protected voiddoPingInstead()voidenableStreamingResults()Workaround for containers that 'check' for sane values of Statement.setFetchSize() so that applications can use the Java variant of libmysql's mysql_use_result() behavior.booleanexecute(java.lang.String sql)booleanexecute(java.lang.String sql, int returnGeneratedKeys)booleanexecute(java.lang.String sql, int[] generatedKeyIndices)booleanexecute(java.lang.String sql, java.lang.String[] generatedKeyNames)int[]executeBatch()protected long[]executeBatchInternal()long[]executeLargeBatch()longexecuteLargeUpdate(java.lang.String sql)longexecuteLargeUpdate(java.lang.String sql, int autoGeneratedKeys)longexecuteLargeUpdate(java.lang.String sql, int[] columnIndexes)longexecuteLargeUpdate(java.lang.String sql, java.lang.String[] columnNames)java.sql.ResultSetexecuteQuery(java.lang.String sql)voidexecuteSimpleNonQuery(JdbcConnection c, java.lang.String nonQuery)intexecuteUpdate(java.lang.String sql)intexecuteUpdate(java.lang.String sql, int autoGeneratedKeys)intexecuteUpdate(java.lang.String sql, int[] columnIndexes)intexecuteUpdate(java.lang.String sql, java.lang.String[] columnNames)protected longexecuteUpdateInternal(java.lang.String sql, boolean isBatch, boolean returnGeneratedKeys)protected static intfindStartOfStatement(java.lang.String sql)protected ResultSetInternalMethodsgeneratePingResultSet()java.util.List<java.lang.Object>getBatchedArgs()Get the batched args as added by the addBatch method(s).protected voidgetBatchedGeneratedKeys(int maxKeys)protected voidgetBatchedGeneratedKeys(java.sql.Statement batchedStatement)java.lang.ObjectgetCancelTimeoutMutex()java.sql.ConnectiongetConnection()java.lang.StringgetCurrentDatabase()ExceptionInterceptorgetExceptionInterceptor()longgetExecuteTime()Returns the elapsed time for the server to execute the query.intgetFetchDirection()intgetFetchSize()java.sql.ResultSetgetGeneratedKeys()protected ResultSetInternalMethodsgetGeneratedKeysInternal()protected ResultSetInternalMethodsgetGeneratedKeysInternal(long numKeys)intgetId()Returns the query id used when profilinglonggetLargeMaxRows()longgetLargeUpdateCount()longgetLastInsertID()getLastInsertID returns the value of the auto_incremented key after an executeQuery() or excute() call.java.io.InputStreamgetLocalInfileInputStream()Returns the InputStream instance that will be used to send data in response to a "LOAD DATA LOCAL INFILE" statement.longgetLongUpdateCount()getLongUpdateCount returns the current result as an update count, if the result is a ResultSet or there are no more results, -1 is returned.intgetMaxFieldSize()intgetMaxRows()booleangetMoreResults()booleangetMoreResults(int current)intgetOpenResultSetCount()Returns the number of open result sets for this statement.QuerygetQuery()intgetQueryTimeout()intgetResultFetchSize()java.sql.ResultSetgetResultSet()intgetResultSetConcurrency()<T extends Resultset, M extends Message>
ProtocolEntityFactory<T,M>getResultSetFactory()intgetResultSetHoldability()protected ResultSetInternalMethodsgetResultSetInternal()intgetResultSetType()Resultset.TypegetResultType()longgetServerStatementId()SessiongetSession()java.util.concurrent.atomic.AtomicBooleangetStatementExecuting()intgetTimeoutInMillis()intgetUpdateCount()java.sql.SQLWarninggetWarnings()protected java.sql.SQLExceptionhandleExceptionForBatch(int endOfBatchIndex, int numValuesPerBatch, long[] updateCounts, java.sql.SQLException ex)protected booleanhasDeadlockOrTimeoutRolledBackTx(java.sql.SQLException ex)protected voidimplicitlyCloseAllOpenResults()Close all result sets in this statement.protected voidinitQuery()booleanisClearWarningsCalled()booleanisClosed()booleanisCloseOnCompletion()booleanisPoolable()booleanisWrapperFor(java.lang.Class<?> iface)protected intprocessMultiCountsAndKeys(StatementImpl batchedStatement, int updateCountCounter, long[] updateCounts)protected voidrealClose(boolean calledExplicitly, boolean closeOpenResults)Closes this statement, and frees resources.voidremoveOpenResultSet(ResultSetInternalMethods rs)Callback for result set instances to remove them from the Set that tracks them per-statementvoidresetCancelledState()voidsetCancelStatus(Query.CancelStatus cs)voidsetClearWarningsCalled(boolean clearWarningsCalled)voidsetCurrentDatabase(java.lang.String currentDb)voidsetCursorName(java.lang.String name)voidsetEscapeProcessing(boolean enable)voidsetExecuteTime(long executeTime)voidsetFetchDirection(int direction)voidsetFetchSize(int rows)voidsetHoldResultsOpenOverClose(boolean holdResultsOpenOverClose)voidsetLargeMaxRows(long max)voidsetLocalInfileInputStream(java.io.InputStream stream)Sets an InputStream instance that will be used to send data to the MySQL server for a "LOAD DATA LOCAL INFILE" statement rather than a FileInputStream or URLInputStream that represents the path given as an argument to the statement.voidsetMaxFieldSize(int max)voidsetMaxRows(int max)voidsetPingTarget(PingTarget pingTarget)voidsetPoolable(boolean poolable)voidsetQueryTimeout(int seconds)voidsetResultFetchSize(int fetchSize)voidsetResultType(Resultset.Type resultSetType)voidsetTimeoutInMillis(int timeoutInMillis)protected voidsetupStreamingTimeout(JdbcConnection con)Adjust net_write_timeout to a higher value if we're streaming result sets.CancelQueryTaskstartQueryTimer(Query stmtToCancel, int timeout)voidstatementBegins()voidstopQueryTimer(CancelQueryTask timeoutTask, boolean rethrowCancelReason, boolean checkCancelTimeout)<T> Tunwrap(java.lang.Class<T> iface)
-
Field Details
-
PING_MARKER
protected static final java.lang.String PING_MARKER- See Also:
- Constant Field Values
-
commandBuilder
-
USES_VARIABLES_FALSE
public static final byte USES_VARIABLES_FALSE- See Also:
- Constant Field Values
-
USES_VARIABLES_TRUE
public static final byte USES_VARIABLES_TRUE- See Also:
- Constant Field Values
-
USES_VARIABLES_UNKNOWN
public static final byte USES_VARIABLES_UNKNOWN- See Also:
- Constant Field Values
-
charEncoding
protected java.lang.String charEncodingThe character encoding to use (if available) -
connection
The connection that created us -
doEscapeProcessing
protected boolean doEscapeProcessingShould we process escape codes? -
isClosed
protected boolean isClosedHas this statement been closed? -
lastInsertId
protected long lastInsertIdThe auto_increment value for the last insert -
maxFieldSize
protected int maxFieldSizeThe max field size for this statement -
maxRows
public int maxRowsThe maximum number of rows to return for this statement (-1 means _all_ rows) -
openResults
Set of currently-open ResultSets -
pedantic
protected boolean pedanticAre we in pedantic mode? -
profileSQL
protected boolean profileSQLShould we profile? -
results
The current results -
generatedKeysResults
-
resultSetConcurrency
protected int resultSetConcurrencyThe concurrency for this result set (updatable or not) -
updateCount
protected long updateCountThe update count for this statement -
useUsageAdvisor
protected boolean useUsageAdvisorShould we use the usage advisor? -
warningChain
protected java.sql.SQLWarning warningChainThe warnings chain. -
holdResultsOpenOverClose
protected boolean holdResultsOpenOverCloseShould this statement hold results open over .close() irregardless of connection's setting? -
batchedGeneratedKeys
-
retrieveGeneratedKeys
protected boolean retrieveGeneratedKeys -
continueBatchOnError
protected boolean continueBatchOnError -
pingTarget
-
exceptionInterceptor
-
lastQueryIsOnDupKeyUpdate
protected boolean lastQueryIsOnDupKeyUpdateWhether or not the last query was of the form ON DUPLICATE KEY UPDATE -
dontTrackOpenResources
-
dumpQueriesOnException
-
logSlowQueries
protected boolean logSlowQueries -
rewriteBatchedStatements
-
maxAllowedPacket
-
dontCheckOnDuplicateKeyUpdateInSQL
protected boolean dontCheckOnDuplicateKeyUpdateInSQL -
resultSetFactory
-
query
-
session
-
-
Constructor Details
-
StatementImpl
Constructor for a Statement.- Parameters:
c- the Connection instance that creates usdb- the database name in use when we were created- Throws:
java.sql.SQLException- if an error occurs.
-
-
Method Details
-
initQuery
protected void initQuery() -
addBatch
public void addBatch(java.lang.String sql) throws java.sql.SQLException- Specified by:
addBatchin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
addBatch
public void addBatch(java.lang.Object batch) -
getBatchedArgs
public java.util.List<java.lang.Object> getBatchedArgs()Description copied from interface:QueryGet the batched args as added by the addBatch method(s). The list is unmodifiable and might contain any combination of String, ClientPreparedQueryBindings, or ServerPreparedQueryBindings depending on how the parameters were batched.- Specified by:
getBatchedArgsin interfaceQuery- Returns:
- an unmodifiable List of batched args
-
cancel
public void cancel() throws java.sql.SQLException- Specified by:
cancelin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
checkClosed
Checks if closed() has been called, and throws an exception if so- Returns:
- connection
- Throws:
StatementIsClosedException- if this statement has been closed
-
checkForDml
protected void checkForDml(java.lang.String sql, char firstStatementChar) throws java.sql.SQLExceptionChecks if the given SQL query with the given first non-ws char is a DML statement. Throws an exception if it is.- Parameters:
sql- the SQL to checkfirstStatementChar- the UC first non-ws char of the statement- Throws:
java.sql.SQLException- if the statement contains DML
-
checkNullOrEmptyQuery
protected void checkNullOrEmptyQuery(java.lang.String sql) throws java.sql.SQLExceptionMethod checkNullOrEmptyQuery.- Parameters:
sql- the SQL to check- Throws:
java.sql.SQLException- if query is null or empty.
-
clearBatch
public void clearBatch() throws java.sql.SQLException- Specified by:
clearBatchin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
clearBatchedArgs
public void clearBatchedArgs()- Specified by:
clearBatchedArgsin interfaceQuery
-
clearWarnings
public void clearWarnings() throws java.sql.SQLException- Specified by:
clearWarningsin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
close
public void close() throws java.sql.SQLExceptionIn 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 interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.sql.Statement- Throws:
java.sql.SQLException- if a database access error occurs
-
closeAllOpenResults
protected void closeAllOpenResults() throws java.sql.SQLExceptionClose any open result sets that have been 'held open'- Throws:
java.sql.SQLException- if an error occurs
-
implicitlyCloseAllOpenResults
protected void implicitlyCloseAllOpenResults() throws java.sql.SQLExceptionClose all result sets in this statement. This includes multi-results- Throws:
java.sql.SQLException- if a database access error occurs
-
removeOpenResultSet
Description copied from interface:JdbcStatementCallback for result set instances to remove them from the Set that tracks them per-statement- Specified by:
removeOpenResultSetin interfaceJdbcStatement- Parameters:
rs- result set
-
getOpenResultSetCount
public int getOpenResultSetCount()Description copied from interface:JdbcStatementReturns the number of open result sets for this statement.- Specified by:
getOpenResultSetCountin interfaceJdbcStatement- Returns:
- the number of open result sets for this statement
-
createStreamingResultSet
protected boolean createStreamingResultSet()We only stream result sets when they are forward-only, read-only, and the fetch size has been set to Integer.MIN_VALUE- Returns:
- true if this result set should be streamed row at-a-time, rather than read all at once.
-
enableStreamingResults
public void enableStreamingResults() throws java.sql.SQLExceptionDescription copied from interface:JdbcStatementWorkaround for containers that 'check' for sane values of Statement.setFetchSize() so that applications can use the Java variant of libmysql's mysql_use_result() behavior.- Specified by:
enableStreamingResultsin interfaceJdbcStatement- Throws:
java.sql.SQLException- if an error occurs
-
disableStreamingResults
public void disableStreamingResults() throws java.sql.SQLExceptionDescription copied from interface:JdbcStatementResets this statements fetch size and result set type to the values they had before enableStreamingResults() was called.- Specified by:
disableStreamingResultsin interfaceJdbcStatement- Throws:
java.sql.SQLException- if an error occurs
-
setupStreamingTimeout
Adjust net_write_timeout to a higher value if we're streaming result sets. More often than not, someone runs into an issue where they blow net_write_timeout when using this feature, and if they're willing to hold a result set open for 30 seconds or more, one more round-trip isn't going to hurt. This is reset by RowDataDynamic.close().- Parameters:
con- created this statement- Throws:
java.sql.SQLException- if a database error occurs
-
startQueryTimer
- Specified by:
startQueryTimerin interfaceQuery
-
stopQueryTimer
public void stopQueryTimer(CancelQueryTask timeoutTask, boolean rethrowCancelReason, boolean checkCancelTimeout)- Specified by:
stopQueryTimerin interfaceQuery
-
execute
public boolean execute(java.lang.String sql) throws java.sql.SQLException- Specified by:
executein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
statementBegins
public void statementBegins()- Specified by:
statementBeginsin interfaceQuery
-
resetCancelledState
public void resetCancelledState()- Specified by:
resetCancelledStatein interfaceQuery
-
execute
public boolean execute(java.lang.String sql, int returnGeneratedKeys) throws java.sql.SQLException- Specified by:
executein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
execute
public boolean execute(java.lang.String sql, int[] generatedKeyIndices) throws java.sql.SQLException- Specified by:
executein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
execute
public boolean execute(java.lang.String sql, java.lang.String[] generatedKeyNames) throws java.sql.SQLException- Specified by:
executein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
executeBatch
public int[] executeBatch() throws java.sql.SQLException- Specified by:
executeBatchin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
executeBatchInternal
protected long[] executeBatchInternal() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
hasDeadlockOrTimeoutRolledBackTx
protected final boolean hasDeadlockOrTimeoutRolledBackTx(java.sql.SQLException ex) -
processMultiCountsAndKeys
protected int processMultiCountsAndKeys(StatementImpl batchedStatement, int updateCountCounter, long[] updateCounts) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
handleExceptionForBatch
protected java.sql.SQLException handleExceptionForBatch(int endOfBatchIndex, int numValuesPerBatch, long[] updateCounts, java.sql.SQLException ex) throws java.sql.BatchUpdateException, java.sql.SQLException- Throws:
java.sql.BatchUpdateExceptionjava.sql.SQLException
-
executeQuery
public java.sql.ResultSet executeQuery(java.lang.String sql) throws java.sql.SQLException- Specified by:
executeQueryin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
doPingInstead
protected void doPingInstead() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
generatePingResultSet
- Throws:
java.sql.SQLException
-
executeSimpleNonQuery
public void executeSimpleNonQuery(JdbcConnection c, java.lang.String nonQuery) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
executeUpdate
public int executeUpdate(java.lang.String sql) throws java.sql.SQLException- Specified by:
executeUpdatein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
executeUpdateInternal
protected long executeUpdateInternal(java.lang.String sql, boolean isBatch, boolean returnGeneratedKeys) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
executeUpdate
public int executeUpdate(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException- Specified by:
executeUpdatein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
executeUpdate
public int executeUpdate(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException- Specified by:
executeUpdatein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
executeUpdate
public int executeUpdate(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException- Specified by:
executeUpdatein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException- Specified by:
getConnectionin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getFetchDirection
public int getFetchDirection() throws java.sql.SQLException- Specified by:
getFetchDirectionin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getFetchSize
public int getFetchSize() throws java.sql.SQLException- Specified by:
getFetchSizein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getGeneratedKeys
public java.sql.ResultSet getGeneratedKeys() throws java.sql.SQLException- Specified by:
getGeneratedKeysin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getGeneratedKeysInternal
- Throws:
java.sql.SQLException
-
getGeneratedKeysInternal
protected ResultSetInternalMethods getGeneratedKeysInternal(long numKeys) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getLastInsertID
public long getLastInsertID()getLastInsertID returns the value of the auto_incremented key after an executeQuery() or excute() call.This gets around the un-threadsafe behavior of "select LAST_INSERT_ID()" which is tied to the Connection that created this Statement, and therefore could have had many INSERTS performed before one gets a chance to call "select LAST_INSERT_ID()".
- Returns:
- the last update ID.
-
getLongUpdateCount
public long getLongUpdateCount()getLongUpdateCount returns the current result as an update count, if the result is a ResultSet or there are no more results, -1 is returned. It should only be called once per result.This method returns longs as MySQL server returns 64-bit values for update counts
- Returns:
- the current update count.
-
getMaxFieldSize
public int getMaxFieldSize() throws java.sql.SQLException- Specified by:
getMaxFieldSizein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getMaxRows
public int getMaxRows() throws java.sql.SQLException- Specified by:
getMaxRowsin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getMoreResults
public boolean getMoreResults() throws java.sql.SQLException- Specified by:
getMoreResultsin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getMoreResults
public boolean getMoreResults(int current) throws java.sql.SQLException- Specified by:
getMoreResultsin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getQueryTimeout
public int getQueryTimeout() throws java.sql.SQLException- Specified by:
getQueryTimeoutin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getResultSet
public java.sql.ResultSet getResultSet() throws java.sql.SQLException- Specified by:
getResultSetin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getResultSetConcurrency
public int getResultSetConcurrency() throws java.sql.SQLException- Specified by:
getResultSetConcurrencyin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getResultSetHoldability
public int getResultSetHoldability() throws java.sql.SQLException- Specified by:
getResultSetHoldabilityin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getResultSetInternal
-
getResultSetType
public int getResultSetType() throws java.sql.SQLException- Specified by:
getResultSetTypein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getUpdateCount
public int getUpdateCount() throws java.sql.SQLException- Specified by:
getUpdateCountin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getWarnings
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException- Specified by:
getWarningsin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
realClose
protected void realClose(boolean calledExplicitly, boolean closeOpenResults) throws java.sql.SQLExceptionCloses this statement, and frees resources.- Parameters:
calledExplicitly- was this called from close()?closeOpenResults- should open result sets be closed?- Throws:
java.sql.SQLException- if an error occurs
-
setCursorName
public void setCursorName(java.lang.String name) throws java.sql.SQLException- Specified by:
setCursorNamein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
setEscapeProcessing
public void setEscapeProcessing(boolean enable) throws java.sql.SQLException- Specified by:
setEscapeProcessingin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
setFetchDirection
public void setFetchDirection(int direction) throws java.sql.SQLException- Specified by:
setFetchDirectionin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
setFetchSize
public void setFetchSize(int rows) throws java.sql.SQLException- Specified by:
setFetchSizein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
setHoldResultsOpenOverClose
public void setHoldResultsOpenOverClose(boolean holdResultsOpenOverClose)- Specified by:
setHoldResultsOpenOverClosein interfaceJdbcStatement
-
setMaxFieldSize
public void setMaxFieldSize(int max) throws java.sql.SQLException- Specified by:
setMaxFieldSizein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
setMaxRows
public void setMaxRows(int max) throws java.sql.SQLException- Specified by:
setMaxRowsin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
setQueryTimeout
public void setQueryTimeout(int seconds) throws java.sql.SQLException- Specified by:
setQueryTimeoutin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getBatchedGeneratedKeys
protected void getBatchedGeneratedKeys(java.sql.Statement batchedStatement) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getBatchedGeneratedKeys
protected void getBatchedGeneratedKeys(int maxKeys) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
isClosed
public boolean isClosed() throws java.sql.SQLException- Specified by:
isClosedin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
isPoolable
public boolean isPoolable() throws java.sql.SQLException- Specified by:
isPoolablein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
setPoolable
public void setPoolable(boolean poolable) throws java.sql.SQLException- Specified by:
setPoolablein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
isWrapperFor
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException- Specified by:
isWrapperForin interfacejava.sql.Wrapper- Throws:
java.sql.SQLException
-
unwrap
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException- Specified by:
unwrapin interfacejava.sql.Wrapper- Throws:
java.sql.SQLException
-
findStartOfStatement
protected static int findStartOfStatement(java.lang.String sql) -
getLocalInfileInputStream
public java.io.InputStream getLocalInfileInputStream()Description copied from interface:JdbcStatementReturns the InputStream instance that will be used to send data in response to a "LOAD DATA LOCAL INFILE" statement. This method returns NULL if no such stream has been set via setLocalInfileInputStream().- Specified by:
getLocalInfileInputStreamin interfaceJdbcStatement- Returns:
- input stream
-
setLocalInfileInputStream
public void setLocalInfileInputStream(java.io.InputStream stream)Description copied from interface:JdbcStatementSets an InputStream instance that will be used to send data to the MySQL server for a "LOAD DATA LOCAL INFILE" statement rather than a FileInputStream or URLInputStream that represents the path given as an argument to the statement. This stream will be read to completion upon execution of a "LOAD DATA LOCAL INFILE" statement, and will automatically be closed by the driver, so it needs to be reset before each call to execute*() that would cause the MySQL server to request data to fulfill the request for "LOAD DATA LOCAL INFILE". If this value is set to NULL, the driver will revert to using a FileInputStream or URLInputStream as required.- Specified by:
setLocalInfileInputStreamin interfaceJdbcStatement- Parameters:
stream- input stream
-
setPingTarget
- Specified by:
setPingTargetin interfaceJdbcStatement
-
getExceptionInterceptor
- Specified by:
getExceptionInterceptorin interfaceJdbcStatement
-
containsOnDuplicateKeyInString
protected boolean containsOnDuplicateKeyInString(java.lang.String sql) -
closeOnCompletion
public void closeOnCompletion() throws java.sql.SQLException- Specified by:
closeOnCompletionin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
isCloseOnCompletion
public boolean isCloseOnCompletion() throws java.sql.SQLException- Specified by:
isCloseOnCompletionin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
executeLargeBatch
public long[] executeLargeBatch() throws java.sql.SQLException- Specified by:
executeLargeBatchin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
executeLargeUpdate
public long executeLargeUpdate(java.lang.String sql) throws java.sql.SQLException- Specified by:
executeLargeUpdatein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
executeLargeUpdate
public long executeLargeUpdate(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException- Specified by:
executeLargeUpdatein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
executeLargeUpdate
public long executeLargeUpdate(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException- Specified by:
executeLargeUpdatein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
executeLargeUpdate
public long executeLargeUpdate(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException- Specified by:
executeLargeUpdatein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getLargeMaxRows
public long getLargeMaxRows() throws java.sql.SQLException- Specified by:
getLargeMaxRowsin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getLargeUpdateCount
public long getLargeUpdateCount() throws java.sql.SQLException- Specified by:
getLargeUpdateCountin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
setLargeMaxRows
public void setLargeMaxRows(long max) throws java.sql.SQLException- Specified by:
setLargeMaxRowsin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getCurrentDatabase
public java.lang.String getCurrentDatabase()- Specified by:
getCurrentDatabasein interfaceQuery
-
getServerStatementId
public long getServerStatementId() -
getResultSetFactory
- Specified by:
getResultSetFactoryin interfaceQuery
-
getId
public int getId()Description copied from interface:QueryReturns the query id used when profiling -
setCancelStatus
- Specified by:
setCancelStatusin interfaceQuery
-
checkCancelTimeout
public void checkCancelTimeout()- Specified by:
checkCancelTimeoutin interfaceQuery
-
getSession
- Specified by:
getSessionin interfaceQuery
-
getCancelTimeoutMutex
public java.lang.Object getCancelTimeoutMutex()- Specified by:
getCancelTimeoutMutexin interfaceQuery
-
closeQuery
public void closeQuery()- Specified by:
closeQueryin interfaceQuery
-
getResultFetchSize
public int getResultFetchSize()- Specified by:
getResultFetchSizein interfaceQuery
-
setResultFetchSize
public void setResultFetchSize(int fetchSize)- Specified by:
setResultFetchSizein interfaceQuery
-
getResultType
- Specified by:
getResultTypein interfaceQuery
-
setResultType
- Specified by:
setResultTypein interfaceQuery
-
getTimeoutInMillis
public int getTimeoutInMillis()- Specified by:
getTimeoutInMillisin interfaceQuery
-
setTimeoutInMillis
public void setTimeoutInMillis(int timeoutInMillis)- Specified by:
setTimeoutInMillisin interfaceQuery
-
getExecuteTime
public long getExecuteTime()Description copied from interface:QueryReturns the elapsed time for the server to execute the query.- Specified by:
getExecuteTimein interfaceQuery- Returns:
- the time it took for the server to execute the query.
-
setExecuteTime
public void setExecuteTime(long executeTime)- Specified by:
setExecuteTimein interfaceQuery
-
getStatementExecuting
public java.util.concurrent.atomic.AtomicBoolean getStatementExecuting()- Specified by:
getStatementExecutingin interfaceQuery
-
setCurrentDatabase
public void setCurrentDatabase(java.lang.String currentDb)- Specified by:
setCurrentDatabasein interfaceQuery
-
isClearWarningsCalled
public boolean isClearWarningsCalled()- Specified by:
isClearWarningsCalledin interfaceQuery
-
setClearWarningsCalled
public void setClearWarningsCalled(boolean clearWarningsCalled)- Specified by:
setClearWarningsCalledin interfaceQuery
-
getQuery
- Specified by:
getQueryin interfaceJdbcStatement
-