## com.mysql.jdbc
Class StatementImpl

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

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

Direct Known Subclasses:
  PreparedStatement

    public class StatementImpl

extends java.lang.Object
implements Statement

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.

See Also:
  `Statement`, `ResultSetInternalMethods`

Nested Class Summary
`(package private) class` `StatementImpl.CancelTask` Thread used to implement query timeouts...Eventually we could be more efficient and have one thread with timers, but this is a straightforward and simple way to implement a feature that isn't used all that often.

Field Summary
`protected java.util.List<java.lang.Object>` `batchedArgs` Holds batched commands
`protected java.util.ArrayList<ResultSetRow>` `batchedGeneratedKeys`
`protected java.lang.Object` `cancelTimeoutMutex` Mutex to prevent race between returning query results and noticing that we're timed-out or cancelled.
`protected SingleByteCharsetConverter` `charConverter` The character converter to use (if available)
`protected java.lang.String` `charEncoding` The character encoding to use (if available)
`protected boolean` `clearWarningsCalled` Has clearWarnings() been called?
`protected MySQLConnection` `connection` The connection that created us
`protected long` `connectionId`
`protected boolean` `continueBatchOnError`
`protected java.lang.String` `currentCatalog` The catalog in use
`protected boolean` `doEscapeProcessing` Should we process escape codes?
`protected com.mysql.jdbc.profiler.ProfilerEventHandler` `eventSink` If we're profiling, where should events go to?
`protected ResultSetInternalMethods` `generatedKeysResults`
`protected boolean` `holdResultsOpenOverClose` Should this statement hold results open over .close() irregardless of connection's setting?
`protected boolean` `isClosed` Has this statement been closed?
`protected long` `lastInsertId` The auto_increment value for the last insert
`protected boolean` `lastQueryIsOnDupKeyUpdate` Whether or not the last query was of the form ON DUPLICATE KEY UPDATE
`protected int` `maxFieldSize` The max field size for this statement
`protected int` `maxRows` The maximum number of rows to return for this statement (-1 means _all_ rows)
`protected boolean` `maxRowsChanged` Has someone changed this for this statement?
`protected java.util.Set<ResultSetInternalMethods>` `openResults` Set of currently-open ResultSets
`protected boolean` `pedantic` Are we in pedantic mode?
`protected static java.lang.String` `PING_MARKER`
`protected PingTarget` `pingTarget`
`protected java.lang.String` `pointOfOrigin` Where this statement was created, only used if profileSql or useUsageAdvisor set to true.
`protected boolean` `profileSQL` Should we profile?
`protected ResultSetInternalMethods` `results` The current results
`protected int` `resultSetConcurrency` The concurrency for this result set (updatable or not)
`protected int` `resultSetType` The type of this result set (scroll sensitive or in-sensitive)
`protected boolean` `retrieveGeneratedKeys`
`(package private) static int` `statementCounter` Used to generate IDs when profiling.
`protected java.util.concurrent.atomic.AtomicBoolean` `statementExecuting` Are we currently executing a statement?
`protected int` `statementId` Used to identify this statement when profiling.
`protected int` `timeoutInMillis` The timeout for a query
`protected long` `updateCount` The update count for this statement
`protected boolean` `useLegacyDatetimeCode`
`static byte` `USES_VARIABLES_FALSE`
`static byte` `USES_VARIABLES_TRUE`
`static byte` `USES_VARIABLES_UNKNOWN`
`protected boolean` `useUsageAdvisor` Should we use the usage advisor?
`protected boolean` `version5013OrNewer`
`protected java.sql.SQLWarning` `warningChain` The warnings chain.
`protected boolean` `wasCancelled`
`protected boolean` `wasCancelledByTimeout`

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

Constructor Summary
`StatementImpl(MySQLConnection c, java.lang.String catalog)` Constructor for a Statement.

Method Summary
`void` `addBatch(java.lang.String sql)` DOCUMENT ME!
`void` `cancel()` Cancels this Statement object if both the DBMS and driver support aborting an SQL statement.
`protected MySQLConnection` `checkClosed()` Checks if closed() has been called, and throws an exception if so
`protected void` `checkForDml(java.lang.String sql, char firstStatementChar)` Checks if the given SQL query with the given first non-ws char is a DML statement.
`protected void` `checkNullOrEmptyQuery(java.lang.String sql)` Method checkNullOrEmptyQuery.
`void` `clearBatch()` JDBC 2.0 Make the set of commands in the current batch empty.
`void` `clearWarnings()` After this call, getWarnings returns null until a new warning is reported for this Statement.
`void` `close()` In many cases, it is desirable to immediately release a Statement's database and JDBC resources instead of waiting for this to happen when it is automatically closed.
`protected void` `closeAllOpenResults()` Close any open result sets that have been 'held open'
`void` `closeOnCompletion()`
`protected boolean` `containsOnDuplicateKeyInString(java.lang.String sql)`
`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
`void` `disableStreamingResults()` Resets this statements fetch size and result set type to the values they had before enableStreamingResults() was called.
`protected void` `doPingInstead()`
`void` `enableStreamingResults()` 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.
`boolean` `execute(java.lang.String sql)` Execute a SQL statement that may return multiple results.
`boolean` `execute(java.lang.String sql, int returnGeneratedKeys)`
`boolean` `execute(java.lang.String sql, int[] generatedKeyIndices)`
`boolean` `execute(java.lang.String sql, java.lang.String[] generatedKeyNames)`
`int[]` `executeBatch()` JDBC 2.0 Submit a batch of commands to the database for execution.
`java.sql.ResultSet` `executeQuery(java.lang.String sql)` Execute a SQL statement that retruns a single ResultSet
`protected void` `executeSimpleNonQuery(MySQLConnection c, java.lang.String nonQuery)`
`int` `executeUpdate(java.lang.String sql)` Execute a SQL INSERT, UPDATE or DELETE statement.
`protected int` `executeUpdate(java.lang.String sql, boolean isBatch, boolean returnGeneratedKeys)`
`int` `executeUpdate(java.lang.String sql, int returnGeneratedKeys)`
`int` `executeUpdate(java.lang.String sql, int[] generatedKeyIndices)`
`int` `executeUpdate(java.lang.String sql, java.lang.String[] generatedKeyNames)`
`protected int` `findStartOfStatement(java.lang.String sql)`
`protected ResultSetInternalMethods` `generatePingResultSet()`
`java.util.List<java.lang.Object>` `getBatchedArgs()` Get the batched args as added by the addBatch method(s).
`protected void` `getBatchedGeneratedKeys(int maxKeys)`
`protected void` `getBatchedGeneratedKeys(java.sql.Statement batchedStatement)`
`protected java.util.Calendar` `getCalendarInstanceForSessionOrNew()` Optimization to only use one calendar per-session, or calculate it for each call, depending on user configuration
`java.sql.Connection` `getConnection()` JDBC 2.0 Return the Connection that produced the Statement.
`ExceptionInterceptor` `getExceptionInterceptor()`
`int` `getFetchDirection()` JDBC 2.0 Determine the fetch direction.
`int` `getFetchSize()` JDBC 2.0 Determine the default fetch size.
`java.sql.ResultSet` `getGeneratedKeys()` DOCUMENT ME!
`protected java.sql.ResultSet` `getGeneratedKeysInternal()`
`protected java.sql.ResultSet` `getGeneratedKeysInternal(int numKeys)`
`protected int` `getId()` Returns the id used when profiling
`long` `getLastInsertID()` getLastInsertID returns the value of the auto_incremented key after an executeQuery() or excute() call.
`java.io.InputStream` `getLocalInfileInputStream()` Returns the InputStream instance that will be used to send data in response to a "LOAD DATA LOCAL INFILE" statement.
`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.
`int` `getMaxFieldSize()` The maxFieldSize limit (in bytes) is the maximum amount of data returned for any column value; it only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR and LONGVARCHAR columns.
`int` `getMaxRows()` The maxRows limit is set to limit the number of rows that any ResultSet can contain.
`boolean` `getMoreResults()` getMoreResults moves to a Statement's next result.
`boolean` `getMoreResults(int current)`
`protected int` `getOnDuplicateKeyLocation(java.lang.String sql)`
`int` `getOpenResultSetCount()` Returns the number of open result sets for this statement.
`int` `getQueryTimeout()` The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute.
`java.sql.ResultSet` `getResultSet()` getResultSet returns the current result as a ResultSet.
`int` `getResultSetConcurrency()` JDBC 2.0 Determine the result set concurrency.
`int` `getResultSetHoldability()`
`protected ResultSetInternalMethods` `getResultSetInternal()`
`int` `getResultSetType()` JDBC 2.0 Determine the result set type.
`int` `getUpdateCount()` getUpdateCount returns the current result as an update count, if the result is a ResultSet or there are no more results, -1 is returned.
`java.sql.SQLWarning` `getWarnings()` The first warning reported by calls on this Statement is returned.
`protected java.sql.SQLException` `handleExceptionForBatch(int endOfBatchIndex, int numValuesPerBatch, int[] updateCounts, java.sql.SQLException ex)`
`protected boolean` `hasDeadlockOrTimeoutRolledBackTx(java.sql.SQLException ex)`
`boolean` `isClosed()`
`boolean` `isCloseOnCompletion()`
`boolean` `isPoolable()`
`boolean` `isWrapperFor(java.lang.Class<?> iface)` Returns true if this either implements the interface argument or is directly or indirectly a wrapper for an object that does.
`protected int` `processMultiCountsAndKeys(StatementImpl batchedStatement, int updateCountCounter, int[] updateCounts)`
`protected void` `realClose(boolean calledExplicitly, boolean closeOpenResults)` Closes this statement, and frees resources.
`void` `removeOpenResultSet(java.sql.ResultSet rs)` Callback for result set instances to remove them from the Set that tracks them per-statement
`protected void` `resetCancelledState()`
`void` `setCursorName(java.lang.String name)` setCursorName defines the SQL cursor name that will be used by subsequent execute methods.
`void` `setEscapeProcessing(boolean enable)` If escape scanning is on (the default), the driver will do escape substitution before sending the SQL to the database.
`void` `setFetchDirection(int direction)` JDBC 2.0 Give a hint as to the direction in which the rows in a result set will be processed.
`void` `setFetchSize(int rows)` JDBC 2.0 Give the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed.
`void` `setHoldResultsOpenOverClose(boolean holdResultsOpenOverClose)`
`void` `setLocalInfileInputStream(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.
`void` `setMaxFieldSize(int max)` Sets the maxFieldSize
`void` `setMaxRows(int max)` Set the maximum number of rows
`void` `setPingTarget(PingTarget pingTarget)`
`void` `setPoolable(boolean poolable)`
`void` `setQueryTimeout(int seconds)` Sets the queryTimeout limit
`(package private) void` `setResultSetConcurrency(int concurrencyFlag)` Sets the concurrency for result sets generated by this statement
`(package private) void` `setResultSetType(int typeFlag)` Sets the result set type for result sets generated by this statement
`protected void` `statementBegins()`
`java.lang.Object` `unwrap(java.lang.Class<?> iface)` Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy.

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

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

Field Detail

### PING_MARKER

    protected static final java.lang.String PING_MARKER

See Also:
  Constant Field Values

### cancelTimeoutMutex

    protected java.lang.Object cancelTimeoutMutex

  Mutex to prevent race between returning query results and noticing that we're timed-out or cancelled.

### statementCounter

    static int statementCounter

  Used to generate IDs when profiling.

### 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

### wasCancelled

    protected boolean wasCancelled

### wasCancelledByTimeout

    protected boolean wasCancelledByTimeout

### batchedArgs

    protected java.util.List<java.lang.Object> batchedArgs

  Holds batched commands

### charConverter

    protected SingleByteCharsetConverter charConverter

  The character converter to use (if available)

### charEncoding

    protected java.lang.String charEncoding

  The character encoding to use (if available)

### connection

    protected volatile MySQLConnection connection

  The connection that created us

### connectionId

    protected long connectionId

### currentCatalog

    protected java.lang.String currentCatalog

  The catalog in use

### doEscapeProcessing

    protected boolean doEscapeProcessing

  Should we process escape codes?

### eventSink

    protected com.mysql.jdbc.profiler.ProfilerEventHandler eventSink

  If we're profiling, where should events go to?

### isClosed

    protected boolean isClosed

  Has this statement been closed?

### lastInsertId

    protected long lastInsertId

  The auto_increment value for the last insert

### maxFieldSize

    protected int maxFieldSize

  The max field size for this statement

### maxRows

    protected int maxRows

  The maximum number of rows to return for this statement (-1 means _all_ rows)

### maxRowsChanged

    protected boolean maxRowsChanged

  Has someone changed this for this statement?

### openResults

    protected java.util.Set<ResultSetInternalMethods> openResults

  Set of currently-open ResultSets

### pedantic

    protected boolean pedantic

  Are we in pedantic mode?

### pointOfOrigin

    protected java.lang.String pointOfOrigin

  Where this statement was created, only used if profileSql or useUsageAdvisor set to true.

### profileSQL

    protected boolean profileSQL

  Should we profile?

### results

    protected ResultSetInternalMethods results

  The current results

### generatedKeysResults

    protected ResultSetInternalMethods generatedKeysResults

### resultSetConcurrency

    protected int resultSetConcurrency

  The concurrency for this result set (updatable or not)

### resultSetType

    protected int resultSetType

  The type of this result set (scroll sensitive or in-sensitive)

### statementId

    protected int statementId

  Used to identify this statement when profiling.

### timeoutInMillis

    protected int timeoutInMillis

  The timeout for a query

### updateCount

    protected long updateCount

  The update count for this statement

### useUsageAdvisor

    protected boolean useUsageAdvisor

  Should we use the usage advisor?

### warningChain

    protected java.sql.SQLWarning warningChain

  The warnings chain.

### clearWarningsCalled

    protected boolean clearWarningsCalled

  Has clearWarnings() been called?

### holdResultsOpenOverClose

    protected boolean holdResultsOpenOverClose

  Should this statement hold results open over .close() irregardless of connection's setting?

### batchedGeneratedKeys

    protected java.util.ArrayList<ResultSetRow> batchedGeneratedKeys

### retrieveGeneratedKeys

    protected boolean retrieveGeneratedKeys

### continueBatchOnError

    protected boolean continueBatchOnError

### pingTarget

    protected PingTarget pingTarget

### useLegacyDatetimeCode

    protected boolean useLegacyDatetimeCode

### lastQueryIsOnDupKeyUpdate

    protected boolean lastQueryIsOnDupKeyUpdate

  Whether or not the last query was of the form ON DUPLICATE KEY UPDATE

### statementExecuting

    protected final java.util.concurrent.atomic.AtomicBoolean statementExecuting

  Are we currently executing a statement?

### version5013OrNewer

    protected final boolean version5013OrNewer

Constructor Detail

### StatementImpl

    public StatementImpl(MySQLConnection c,
                         java.lang.String catalog)
                  throws java.sql.SQLException

  Constructor for a Statement.

  Parameters:
    `c` - the Connection instantation that creates us
    `catalog` - the database name in use when we were created
  Throws:
    `java.sql.SQLException` - if an error occurs.

Method Detail

### addBatch

    public void addBatch(java.lang.String sql)
                  throws java.sql.SQLException

  DOCUMENT ME!

  Specified by:
    `addBatch` in interface `java.sql.Statement`
  Parameters:
    `sql` - DOCUMENT ME!
  Throws:
    `java.sql.SQLException` - DOCUMENT ME!

### getBatchedArgs

    public java.util.List<java.lang.Object> getBatchedArgs()

  Get the batched args as added by the addBatch method(s). The list is unmodifiable and might contain any combination of String, BatchParams, or BatchedBindValues depending on how the parameters were batched.

  Returns:
    an unmodifiable List of batched args

### cancel

    public void cancel()
                throws java.sql.SQLException

  Cancels this Statement object if both the DBMS and driver support aborting an SQL statement. This method can be used by one thread to cancel a statement that is being executed by another thread.

  Specified by:
    `cancel` in interface `java.sql.Statement`
  Throws:
    `java.sql.SQLException`

### checkClosed

    protected MySQLConnection checkClosed()
                                   throws java.sql.SQLException

  Checks if closed() has been called, and throws an exception if so

  Throws:
    `java.sql.SQLException` - if this statement has been closed

### checkForDml

    protected void checkForDml(java.lang.String sql,
                               char firstStatementChar)
                        throws java.sql.SQLException

  Checks 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 check
    `firstStatementChar` - 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.SQLException

  Method 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

  JDBC 2.0 Make the set of commands in the current batch empty. This method is optional.

  Specified by:
    `clearBatch` in interface `java.sql.Statement`
  Throws:
    `java.sql.SQLException` - if a database-access error occurs, or the driver does not support batch statements

### clearWarnings

    public void clearWarnings()
                       throws java.sql.SQLException

  After this call, getWarnings returns null until a new warning is reported for this Statement.

  Specified by:
    `clearWarnings` in interface `java.sql.Statement`
  Throws:
    `java.sql.SQLException` - if a database access error occurs (why?)

### close

    public void close()
               throws java.sql.SQLException

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

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

  Specified by:
    `close` in interface `java.sql.Statement`
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### closeAllOpenResults

    protected void closeAllOpenResults()
                                throws java.sql.SQLException

  Close any open result sets that have been 'held open'

  Throws:
    `java.sql.SQLException`

### removeOpenResultSet

    public void removeOpenResultSet(java.sql.ResultSet rs)

  Description copied from interface: `Statement`
  Callback for result set instances to remove them from the Set that tracks them per-statement

### getOpenResultSetCount

    public int getOpenResultSetCount()

  Description copied from interface: `Statement`
  Returns the number of open result sets for this statement.

  Returns:

### 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.SQLException

  Description copied from interface: `Statement`
  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.

  Throws:
    `java.sql.SQLException`

### disableStreamingResults

    public void disableStreamingResults()
                                 throws java.sql.SQLException

  Description copied from interface: `Statement`
  Resets this statements fetch size and result set type to the values they had before enableStreamingResults() was called.

  Throws:
    `java.sql.SQLException`

### execute

    public boolean execute(java.lang.String sql)
                    throws java.sql.SQLException

  Execute a SQL statement that may return multiple results. We don't have to worry about this since we do not support multiple ResultSets. You can use getResultSet or getUpdateCount to retrieve the result.

  Specified by:
    `execute` in interface `java.sql.Statement`
  Parameters:
    `sql` - any SQL statement
  Returns:
    true if the next result is a ResulSet, false if it is an update count or there are no more results
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### statementBegins

    protected void statementBegins()

### resetCancelledState

    protected void resetCancelledState()
                                throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### execute

    public boolean execute(java.lang.String sql,
                           int returnGeneratedKeys)
                    throws java.sql.SQLException

  Specified by:
    `execute` in interface `java.sql.Statement`
  Throws:
    `java.sql.SQLException`
  See Also:
    `execute(String, int)`

### execute

    public boolean execute(java.lang.String sql,
                           int[] generatedKeyIndices)
                    throws java.sql.SQLException

  Specified by:
    `execute` in interface `java.sql.Statement`
  Throws:
    `java.sql.SQLException`
  See Also:
    `execute(String, int[])`

### execute

    public boolean execute(java.lang.String sql,
                           java.lang.String[] generatedKeyNames)
                    throws java.sql.SQLException

  Specified by:
    `execute` in interface `java.sql.Statement`
  Throws:
    `java.sql.SQLException`
  See Also:
    `execute(String, String[])`

### executeBatch

    public int[] executeBatch()
                       throws java.sql.SQLException

  JDBC 2.0 Submit a batch of commands to the database for execution. This method is optional.

  Specified by:
    `executeBatch` in interface `java.sql.Statement`
  Returns:
    an array of update counts containing one element for each command in the batch. The array is ordered according to the order in which commands were inserted into the batch
  Throws:
    `java.sql.SQLException` - if a database-access error occurs, or the driver does not support batch statements
    `java.sql.BatchUpdateException` - DOCUMENT ME!

### hasDeadlockOrTimeoutRolledBackTx

    protected final boolean hasDeadlockOrTimeoutRolledBackTx(java.sql.SQLException ex)

### processMultiCountsAndKeys

    protected int processMultiCountsAndKeys(StatementImpl batchedStatement,
                                            int updateCountCounter,
                                            int[] updateCounts)
                                     throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### handleExceptionForBatch

    protected java.sql.SQLException handleExceptionForBatch(int endOfBatchIndex,
                                                            int numValuesPerBatch,
                                                            int[] updateCounts,
                                                            java.sql.SQLException ex)
                                                     throws java.sql.BatchUpdateException

  Throws:
    `java.sql.BatchUpdateException`

### executeQuery

    public java.sql.ResultSet executeQuery(java.lang.String sql)
                                    throws java.sql.SQLException

  Execute a SQL statement that retruns a single ResultSet

  Specified by:
    `executeQuery` in interface `java.sql.Statement`
  Parameters:
    `sql` - typically a static SQL SELECT statement
  Returns:
    a ResulSet that contains the data produced by the query
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### doPingInstead

    protected void doPingInstead()
                          throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### generatePingResultSet

    protected ResultSetInternalMethods generatePingResultSet()
                                                      throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### executeSimpleNonQuery

    protected void executeSimpleNonQuery(MySQLConnection 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

  Execute a SQL INSERT, UPDATE or DELETE statement. In addition SQL statements that return nothing such as SQL DDL statements can be executed Any IDs generated for AUTO_INCREMENT fields can be retrieved by casting this Statement to org.gjt.mm.mysql.Statement and calling the getLastInsertID() method.

  Specified by:
    `executeUpdate` in interface `java.sql.Statement`
  Parameters:
    `sql` - a SQL statement
  Returns:
    either a row count, or 0 for SQL commands
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### executeUpdate

    protected int executeUpdate(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 returnGeneratedKeys)
                      throws java.sql.SQLException

  Specified by:
    `executeUpdate` in interface `java.sql.Statement`
  Throws:
    `java.sql.SQLException`
  See Also:
    `executeUpdate(String, int)`

### executeUpdate

    public int executeUpdate(java.lang.String sql,
                             int[] generatedKeyIndices)
                      throws java.sql.SQLException

  Specified by:
    `executeUpdate` in interface `java.sql.Statement`
  Throws:
    `java.sql.SQLException`
  See Also:
    `executeUpdate(String, int[])`

### executeUpdate

    public int executeUpdate(java.lang.String sql,
                             java.lang.String[] generatedKeyNames)
                      throws java.sql.SQLException

  Specified by:
    `executeUpdate` in interface `java.sql.Statement`
  Throws:
    `java.sql.SQLException`
  See Also:
    `executeUpdate(String, String[])`

### getCalendarInstanceForSessionOrNew

    protected java.util.Calendar getCalendarInstanceForSessionOrNew()
                                                             throws java.sql.SQLException

  Optimization to only use one calendar per-session, or calculate it for each call, depending on user configuration

  Throws:
    `java.sql.SQLException`

### getConnection

    public java.sql.Connection getConnection()
                                      throws java.sql.SQLException

  JDBC 2.0 Return the Connection that produced the Statement.

  Specified by:
    `getConnection` in interface `java.sql.Statement`
  Returns:
    the Connection that produced the Statement
  Throws:
    `java.sql.SQLException` - if an error occurs

### getFetchDirection

    public int getFetchDirection()
                          throws java.sql.SQLException

  JDBC 2.0 Determine the fetch direction.

  Specified by:
    `getFetchDirection` in interface `java.sql.Statement`
  Returns:
    the default fetch direction
  Throws:
    `java.sql.SQLException` - if a database-access error occurs

### getFetchSize

    public int getFetchSize()
                     throws java.sql.SQLException

  JDBC 2.0 Determine the default fetch size.

  Specified by:
    `getFetchSize` in interface `java.sql.Statement`
  Returns:
    the number of rows to fetch at a time
  Throws:
    `java.sql.SQLException` - if an error occurs

### getGeneratedKeys

    public java.sql.ResultSet getGeneratedKeys()
                                        throws java.sql.SQLException

  DOCUMENT ME!

  Specified by:
    `getGeneratedKeys` in interface `java.sql.Statement`
  Returns:
    DOCUMENT ME!
  Throws:
    `java.sql.SQLException` - DOCUMENT ME!

### getGeneratedKeysInternal

    protected java.sql.ResultSet getGeneratedKeysInternal()
                                                   throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### getGeneratedKeysInternal

    protected java.sql.ResultSet getGeneratedKeysInternal(int numKeys)
                                                   throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### getId

    protected int getId()

  Returns the id used when profiling

  Returns:
    the id used when profiling.

### 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 versions newer than 3.22.4 return 64-bit values for update counts

  Returns:
    the current update count.

### getMaxFieldSize

    public int getMaxFieldSize()
                        throws java.sql.SQLException

  The maxFieldSize limit (in bytes) is the maximum amount of data returned for any column value; it only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR and LONGVARCHAR columns. If the limit is exceeded, the excess data is silently discarded.

  Specified by:
    `getMaxFieldSize` in interface `java.sql.Statement`
  Returns:
    the current max column size limit; zero means unlimited
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### getMaxRows

    public int getMaxRows()
                   throws java.sql.SQLException

  The maxRows limit is set to limit the number of rows that any ResultSet can contain. If the limit is exceeded, the excess rows are silently dropped.

  Specified by:
    `getMaxRows` in interface `java.sql.Statement`
  Returns:
    the current maximum row limit; zero means unlimited
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### getMoreResults

    public boolean getMoreResults()
                           throws java.sql.SQLException

  getMoreResults moves to a Statement's next result. If it returns true, this result is a ResulSet.

  Specified by:
    `getMoreResults` in interface `java.sql.Statement`
  Returns:
    true if the next ResultSet is valid
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### getMoreResults

    public boolean getMoreResults(int current)
                           throws java.sql.SQLException

  Specified by:
    `getMoreResults` in interface `java.sql.Statement`
  Throws:
    `java.sql.SQLException`
  See Also:
    `getMoreResults(int)`

### getQueryTimeout

    public int getQueryTimeout()
                        throws java.sql.SQLException

  The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute. If the limit is exceeded, a SQLException is thrown.

  Specified by:
    `getQueryTimeout` in interface `java.sql.Statement`
  Returns:
    the current query timeout limit in seconds; 0 = unlimited
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### getResultSet

    public java.sql.ResultSet getResultSet()
                                    throws java.sql.SQLException

  getResultSet returns the current result as a ResultSet. It should only be called once per result.

  Specified by:
    `getResultSet` in interface `java.sql.Statement`
  Returns:
    the current result set; null if there are no more
  Throws:
    `java.sql.SQLException` - if a database access error occurs (why?)

### getResultSetConcurrency

    public int getResultSetConcurrency()
                                throws java.sql.SQLException

  JDBC 2.0 Determine the result set concurrency.

  Specified by:
    `getResultSetConcurrency` in interface `java.sql.Statement`
  Returns:
    CONCUR_UPDATABLE or CONCUR_READONLY
  Throws:
    `java.sql.SQLException` - if an error occurs

### getResultSetHoldability

    public int getResultSetHoldability()
                                throws java.sql.SQLException

  Specified by:
    `getResultSetHoldability` in interface `java.sql.Statement`
  Throws:
    `java.sql.SQLException`
  See Also:
    `getResultSetHoldability()`

### getResultSetInternal

    protected ResultSetInternalMethods getResultSetInternal()

### getResultSetType

    public int getResultSetType()
                         throws java.sql.SQLException

  JDBC 2.0 Determine the result set type.

  Specified by:
    `getResultSetType` in interface `java.sql.Statement`
  Returns:
    the ResultSet type (SCROLL_SENSITIVE or SCROLL_INSENSITIVE)
  Throws:
    `java.sql.SQLException` - if an error occurs.

### getUpdateCount

    public int getUpdateCount()
                       throws java.sql.SQLException

  getUpdateCount 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.

  Specified by:
    `getUpdateCount` in interface `java.sql.Statement`
  Returns:
    the current result as an update count.
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### getWarnings

    public java.sql.SQLWarning getWarnings()
                                    throws java.sql.SQLException

  The first warning reported by calls on this Statement is returned. A Statement's execute methods clear its java.sql.SQLWarning chain. Subsequent Statement warnings will be chained to this java.sql.SQLWarning.

  The Warning chain is automatically cleared each time a statement is (re)executed.

  Note: If you are processing a ResultSet then any warnings associated with ResultSet reads will be chained on the ResultSet object.

  Specified by:
    `getWarnings` in interface `java.sql.Statement`
  Returns:
    the first java.sql.SQLWarning or null
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### realClose

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

  Closes this statement, and frees resources.

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

### setCursorName

    public void setCursorName(java.lang.String name)
                       throws java.sql.SQLException

  setCursorName defines the SQL cursor name that will be used by subsequent execute methods. This name can then be used in SQL positioned update/delete statements to identify the current row in the ResultSet generated by this statement. If a database doesn't support positioned update/delete, this method is a no-op.

  Note: This MySQL driver does not support cursors.

  Specified by:
    `setCursorName` in interface `java.sql.Statement`
  Parameters:
    `name` - the new cursor name
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### setEscapeProcessing

    public void setEscapeProcessing(boolean enable)
                             throws java.sql.SQLException

  If escape scanning is on (the default), the driver will do escape substitution before sending the SQL to the database.

  Specified by:
    `setEscapeProcessing` in interface `java.sql.Statement`
  Parameters:
    `enable` - true to enable; false to disable
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### setFetchDirection

    public void setFetchDirection(int direction)
                           throws java.sql.SQLException

  JDBC 2.0 Give a hint as to the direction in which the rows in a result set will be processed. The hint applies only to result sets created using this Statement object. The default value is ResultSet.FETCH_FORWARD.

  Specified by:
    `setFetchDirection` in interface `java.sql.Statement`
  Parameters:
    `direction` - the initial direction for processing rows
  Throws:
    `java.sql.SQLException` - if a database-access error occurs or direction is not one of ResultSet.FETCH_FORWARD, ResultSet.FETCH_REVERSE, or ResultSet.FETCH_UNKNOWN

### setFetchSize

    public void setFetchSize(int rows)
                      throws java.sql.SQLException

  JDBC 2.0 Give the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed. The number of rows specified only affects result sets created using this statement. If the value specified is zero, then the hint is ignored. The default value is zero.

  Specified by:
    `setFetchSize` in interface `java.sql.Statement`
  Parameters:
    `rows` - the number of rows to fetch
  Throws:
    `java.sql.SQLException` - if a database-access error occurs, or the condition 0 <= rows <= this.getMaxRows() is not satisfied.

### setHoldResultsOpenOverClose

    public void setHoldResultsOpenOverClose(boolean holdResultsOpenOverClose)

### setMaxFieldSize

    public void setMaxFieldSize(int max)
                         throws java.sql.SQLException

  Sets the maxFieldSize

  Specified by:
    `setMaxFieldSize` in interface `java.sql.Statement`
  Parameters:
    `max` - the new max column size limit; zero means unlimited
  Throws:
    `java.sql.SQLException` - if size exceeds buffer size

### setMaxRows

    public void setMaxRows(int max)
                    throws java.sql.SQLException

  Set the maximum number of rows

  Specified by:
    `setMaxRows` in interface `java.sql.Statement`
  Parameters:
    `max` - the new max rows limit; zero means unlimited
  Throws:
    `java.sql.SQLException` - if a database access error occurs
  See Also:
    `getMaxRows`

### setQueryTimeout

    public void setQueryTimeout(int seconds)
                         throws java.sql.SQLException

  Sets the queryTimeout limit

  Specified by:
    `setQueryTimeout` in interface `java.sql.Statement`
  Parameters:
    `seconds` - - the new query timeout limit in seconds
  Throws:
    `java.sql.SQLException` - if a database access error occurs

### setResultSetConcurrency

    void setResultSetConcurrency(int concurrencyFlag)

  Sets the concurrency for result sets generated by this statement

  Parameters:
    `concurrencyFlag` - DOCUMENT ME!

### setResultSetType

    void setResultSetType(int typeFlag)

  Sets the result set type for result sets generated by this statement

  Parameters:
    `typeFlag` - DOCUMENT ME!

### 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:
    `isClosed` in interface `java.sql.Statement`
  Throws:
    `java.sql.SQLException`

### isPoolable

    public boolean isPoolable()
                       throws java.sql.SQLException

  Specified by:
    `isPoolable` in interface `java.sql.Statement`
  Throws:
    `java.sql.SQLException`

### setPoolable

    public void setPoolable(boolean poolable)
                     throws java.sql.SQLException

  Specified by:
    `setPoolable` in interface `java.sql.Statement`
  Throws:
    `java.sql.SQLException`

### isWrapperFor

    public boolean isWrapperFor(java.lang.Class<?> iface)
                         throws java.sql.SQLException

  Returns true if this either implements the interface argument or is directly or indirectly a wrapper for an object that does. Returns false otherwise. If this implements the interface then return true, else if this is a wrapper then return the result of recursively calling `isWrapperFor` on the wrapped object. If this does not implement the interface and is not a wrapper, return false. This method should be implemented as a low-cost operation compared to `unwrap` so that callers can use this method to avoid expensive `unwrap` calls that may fail. If this method returns true then calling `unwrap` with the same argument should succeed.

  Specified by:
    `isWrapperFor` in interface `java.sql.Wrapper`
  Parameters:
    `interfaces` - a Class defining an interface.
  Returns:
    true if this implements the interface or directly or indirectly wraps an object that does.
  Throws:
    `java.sql.SQLException` - if an error occurs while determining whether this is a wrapper for an object with the given interface.
  Since:
    1.6

### unwrap

    public java.lang.Object unwrap(java.lang.Class<?> iface)
                            throws java.sql.SQLException

  Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy. The result may be either the object found to implement the interface or a proxy for that object. If the receiver implements the interface then that is the object. If the receiver is a wrapper and the wrapped object implements the interface then that is the object. Otherwise the object is the result of calling `unwrap` recursively on the wrapped object. If the receiver is not a wrapper and does not implement the interface, then an `SQLException` is thrown.

  Parameters:
    `iface` - A Class defining an interface that the result must implement.
  Returns:
    an object that implements the interface. May be a proxy for the actual implementing object.
  Throws:
    `java.sql.SQLException` - If no object found that implements the interface
  Since:
    1.6

### findStartOfStatement

    protected int findStartOfStatement(java.lang.String sql)

### getLocalInfileInputStream

    public java.io.InputStream getLocalInfileInputStream()

  Description copied from interface: `Statement`
  Returns 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().

### setLocalInfileInputStream

    public void setLocalInfileInputStream(java.io.InputStream stream)

  Description copied from interface: `Statement`
  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. 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.

### setPingTarget

    public void setPingTarget(PingTarget pingTarget)

### getExceptionInterceptor

    public ExceptionInterceptor getExceptionInterceptor()

### containsOnDuplicateKeyInString

    protected boolean containsOnDuplicateKeyInString(java.lang.String sql)

### getOnDuplicateKeyLocation

    protected int getOnDuplicateKeyLocation(java.lang.String sql)

### closeOnCompletion

    public void closeOnCompletion()
                           throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### isCloseOnCompletion

    public boolean isCloseOnCompletion()
                                throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`