Class StatementImpl

java.lang.Object
com.mysql.jdbc.StatementImpl
All Implemented Interfaces:
Statement, Wrapper, AutoCloseable, Statement, Wrapper
Direct Known Subclasses:
PreparedStatement

public class StatementImpl extends 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.
  • Field Details

    • PING_MARKER

      protected static final String PING_MARKER
      See Also:
    • ON_DUPLICATE_KEY_UPDATE_CLAUSE

      protected static final String[] ON_DUPLICATE_KEY_UPDATE_CLAUSE
    • cancelTimeoutMutex

      protected 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:
    • USES_VARIABLES_TRUE

      public static final byte USES_VARIABLES_TRUE
      See Also:
    • USES_VARIABLES_UNKNOWN

      public static final byte USES_VARIABLES_UNKNOWN
      See Also:
    • wasCancelled

      protected boolean wasCancelled
    • wasCancelledByTimeout

      protected boolean wasCancelledByTimeout
    • batchedArgs

      protected List<Object> batchedArgs
      Holds batched commands
    • charConverter

      protected SingleByteCharsetConverter charConverter
      The character converter to use (if available)
    • charEncoding

      protected String charEncoding
      The character encoding to use (if available)
    • connection

      protected volatile MySQLConnection connection
      The connection that created us
    • physicalConnection

      protected Reference<MySQLConnection> physicalConnection
      The physical connection used to effectively execute the statement
    • currentCatalog

      protected String currentCatalog
      The catalog in use
    • doEscapeProcessing

      protected boolean doEscapeProcessing
      Should we process escape codes?
    • 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)
    • openResults

      protected Set<ResultSetInternalMethods> openResults
      Set of currently-open ResultSets
    • pedantic

      protected boolean pedantic
      Are we in pedantic mode?
    • 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 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 ArrayList<ResultSetRow> batchedGeneratedKeys
    • retrieveGeneratedKeys

      protected boolean retrieveGeneratedKeys
    • continueBatchOnError

      protected boolean continueBatchOnError
    • pingTarget

      protected PingTarget pingTarget
    • useLegacyDatetimeCode

      protected boolean useLegacyDatetimeCode
    • sendFractionalSeconds

      protected boolean sendFractionalSeconds
    • lastQueryIsOnDupKeyUpdate

      protected boolean lastQueryIsOnDupKeyUpdate
      Whether or not the last query was of the form ON DUPLICATE KEY UPDATE
    • statementExecuting

      protected final AtomicBoolean statementExecuting
      Are we currently executing a statement?
    • version5013OrNewer

      protected final boolean version5013OrNewer
  • Constructor Details

    • StatementImpl

      public StatementImpl(MySQLConnection c, String catalog) throws SQLException
      Constructor for a Statement.
      Parameters:
      c - the Connection instance that creates us
      catalog - the database name in use when we were created
      Throws:
      SQLException - if an error occurs.
  • Method Details

    • addBatch

      public void addBatch(String sql) throws SQLException
      Specified by:
      addBatch in interface Statement
      Parameters:
      sql -
      Throws:
      SQLException
    • getBatchedArgs

      public List<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 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 Statement
      Throws:
      SQLException
    • checkClosed

      protected MySQLConnection checkClosed() throws SQLException
      Checks if closed() has been called, and throws an exception if so
      Throws:
      SQLException - if this statement has been closed
    • checkForDml

      protected void checkForDml(String sql, char firstStatementChar) throws 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:
      SQLException - if the statement contains DML
    • checkNullOrEmptyQuery

      protected void checkNullOrEmptyQuery(String sql) throws SQLException
      Method checkNullOrEmptyQuery.
      Parameters:
      sql - the SQL to check
      Throws:
      SQLException - if query is null or empty.
    • clearBatch

      public void clearBatch() throws SQLException
      JDBC 2.0 Make the set of commands in the current batch empty. This method is optional.
      Specified by:
      clearBatch in interface Statement
      Throws:
      SQLException - if a database-access error occurs, or the driver does not support batch statements
    • clearWarnings

      public void clearWarnings() throws SQLException
      After this call, getWarnings returns null until a new warning is reported for this Statement.
      Specified by:
      clearWarnings in interface Statement
      Throws:
      SQLException - if a database access error occurs (why?)
    • close

      public void close() throws 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 AutoCloseable
      Specified by:
      close in interface Statement
      Throws:
      SQLException - if a database access error occurs
    • closeAllOpenResults

      protected void closeAllOpenResults() throws SQLException
      Close any open result sets that have been 'held open'
      Throws:
      SQLException
    • implicitlyCloseAllOpenResults

      protected void implicitlyCloseAllOpenResults() throws SQLException
      Close all result sets in this statement. This includes multi-results
      Throws:
      SQLException
    • removeOpenResultSet

      public void removeOpenResultSet(ResultSetInternalMethods rs)
      Description copied from interface: Statement
      Callback for result set instances to remove them from the Set that tracks them per-statement
      Specified by:
      removeOpenResultSet in interface Statement
    • getOpenResultSetCount

      public int getOpenResultSetCount()
      Description copied from interface: Statement
      Returns the number of open result sets for this statement.
      Specified by:
      getOpenResultSetCount in interface 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 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.
      Specified by:
      enableStreamingResults in interface Statement
      Throws:
      SQLException
    • disableStreamingResults

      public void disableStreamingResults() throws SQLException
      Description copied from interface: Statement
      Resets this statements fetch size and result set type to the values they had before enableStreamingResults() was called.
      Specified by:
      disableStreamingResults in interface Statement
      Throws:
      SQLException
    • setupStreamingTimeout

      protected void setupStreamingTimeout(MySQLConnection con) throws SQLException
      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().
      Throws:
      SQLException
    • execute

      public boolean execute(String sql) throws 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 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:
      SQLException - if a database access error occurs
    • statementBegins

      protected void statementBegins()
    • resetCancelledState

      protected void resetCancelledState() throws SQLException
      Throws:
      SQLException
    • execute

      public boolean execute(String sql, int returnGeneratedKeys) throws SQLException
      Specified by:
      execute in interface Statement
      Throws:
      SQLException
      See Also:
    • execute

      public boolean execute(String sql, int[] generatedKeyIndices) throws SQLException
      Specified by:
      execute in interface Statement
      Throws:
      SQLException
      See Also:
    • execute

      public boolean execute(String sql, String[] generatedKeyNames) throws SQLException
      Specified by:
      execute in interface Statement
      Throws:
      SQLException
      See Also:
    • executeBatch

      public int[] executeBatch() throws SQLException
      JDBC 2.0 Submit a batch of commands to the database for execution. This method is optional.
      Specified by:
      executeBatch in interface 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:
      SQLException - if a database-access error occurs, or the driver does not support batch statements
      BatchUpdateException
    • executeBatchInternal

      protected long[] executeBatchInternal() throws SQLException
      Throws:
      SQLException
    • hasDeadlockOrTimeoutRolledBackTx

      protected final boolean hasDeadlockOrTimeoutRolledBackTx(SQLException ex)
    • processMultiCountsAndKeys

      protected int processMultiCountsAndKeys(StatementImpl batchedStatement, int updateCountCounter, long[] updateCounts) throws SQLException
      Throws:
      SQLException
    • handleExceptionForBatch

      protected SQLException handleExceptionForBatch(int endOfBatchIndex, int numValuesPerBatch, long[] updateCounts, SQLException ex) throws BatchUpdateException, SQLException
      Throws:
      BatchUpdateException
      SQLException
    • executeQuery

      public ResultSet executeQuery(String sql) throws SQLException
      Execute a SQL statement that returns a single ResultSet
      Specified by:
      executeQuery in interface Statement
      Parameters:
      sql - typically a static SQL SELECT statement
      Returns:
      a ResulSet that contains the data produced by the query
      Throws:
      SQLException - if a database access error occurs
    • doPingInstead

      protected void doPingInstead() throws SQLException
      Throws:
      SQLException
    • generatePingResultSet

      protected ResultSetInternalMethods generatePingResultSet() throws SQLException
      Throws:
      SQLException
    • executeSimpleNonQuery

      protected void executeSimpleNonQuery(MySQLConnection c, String nonQuery) throws SQLException
      Throws:
      SQLException
    • executeUpdate

      public int executeUpdate(String sql) throws SQLException
      Execute a SQL INSERT, UPDATE or DELETE statement. In addition SQL statements that return nothing such as SQL DDL statements can be executed.
      Specified by:
      executeUpdate in interface Statement
      Parameters:
      sql - a SQL statement
      Returns:
      either a row count, or 0 for SQL commands
      Throws:
      SQLException - if a database access error occurs
    • executeUpdateInternal

      protected long executeUpdateInternal(String sql, boolean isBatch, boolean returnGeneratedKeys) throws SQLException
      Throws:
      SQLException
    • executeUpdate

      public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
      Specified by:
      executeUpdate in interface Statement
      Throws:
      SQLException
      See Also:
    • executeUpdate

      public int executeUpdate(String sql, int[] columnIndexes) throws SQLException
      Specified by:
      executeUpdate in interface Statement
      Throws:
      SQLException
      See Also:
    • executeUpdate

      public int executeUpdate(String sql, String[] columnNames) throws SQLException
      Specified by:
      executeUpdate in interface Statement
      Throws:
      SQLException
      See Also:
    • getCalendarInstanceForSessionOrNew

      protected Calendar getCalendarInstanceForSessionOrNew() throws SQLException
      Optimization to only use one calendar per-session, or calculate it for each call, depending on user configuration
      Throws:
      SQLException
    • getConnection

      public Connection getConnection() throws SQLException
      JDBC 2.0 Return the Connection that produced the Statement.
      Specified by:
      getConnection in interface Statement
      Returns:
      the Connection that produced the Statement
      Throws:
      SQLException - if an error occurs
    • getFetchDirection

      public int getFetchDirection() throws SQLException
      JDBC 2.0 Determine the fetch direction.
      Specified by:
      getFetchDirection in interface Statement
      Returns:
      the default fetch direction
      Throws:
      SQLException - if a database-access error occurs
    • getFetchSize

      public int getFetchSize() throws SQLException
      JDBC 2.0 Determine the default fetch size.
      Specified by:
      getFetchSize in interface Statement
      Returns:
      the number of rows to fetch at a time
      Throws:
      SQLException - if an error occurs
    • getGeneratedKeys

      public ResultSet getGeneratedKeys() throws SQLException
      Specified by:
      getGeneratedKeys in interface Statement
      Throws:
      SQLException
    • getGeneratedKeysInternal

      protected ResultSetInternalMethods getGeneratedKeysInternal() throws SQLException
      Throws:
      SQLException
    • getGeneratedKeysInternal

      protected ResultSetInternalMethods getGeneratedKeysInternal(long numKeys) throws SQLException
      Throws:
      SQLException
    • getId

      public int getId()
      Description copied from interface: Statement
      Returns the id used when profiling
      Specified by:
      getId in interface Statement
      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 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 Statement
      Returns:
      the current max column size limit; zero means unlimited
      Throws:
      SQLException - if a database access error occurs
    • getMaxRows

      public int getMaxRows() throws 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 Statement
      Returns:
      the current maximum row limit; zero means unlimited
      Throws:
      SQLException - if a database access error occurs
    • getMoreResults

      public boolean getMoreResults() throws SQLException
      getMoreResults moves to a Statement's next result. If it returns true, this result is a ResulSet.
      Specified by:
      getMoreResults in interface Statement
      Returns:
      true if the next ResultSet is valid
      Throws:
      SQLException - if a database access error occurs
    • getMoreResults

      public boolean getMoreResults(int current) throws SQLException
      Specified by:
      getMoreResults in interface Statement
      Throws:
      SQLException
      See Also:
    • getQueryTimeout

      public int getQueryTimeout() throws 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 Statement
      Returns:
      the current query timeout limit in seconds; 0 = unlimited
      Throws:
      SQLException - if a database access error occurs
    • getResultSet

      public ResultSet getResultSet() throws SQLException
      getResultSet returns the current result as a ResultSet. It should only be called once per result.
      Specified by:
      getResultSet in interface Statement
      Returns:
      the current result set; null if there are no more
      Throws:
      SQLException - if a database access error occurs (why?)
    • getResultSetConcurrency

      public int getResultSetConcurrency() throws SQLException
      JDBC 2.0 Determine the result set concurrency.
      Specified by:
      getResultSetConcurrency in interface Statement
      Returns:
      CONCUR_UPDATABLE or CONCUR_READONLY
      Throws:
      SQLException - if an error occurs
    • getResultSetHoldability

      public int getResultSetHoldability() throws SQLException
      Specified by:
      getResultSetHoldability in interface Statement
      Throws:
      SQLException
      See Also:
    • getResultSetInternal

      protected ResultSetInternalMethods getResultSetInternal()
    • getResultSetType

      public int getResultSetType() throws SQLException
      JDBC 2.0 Determine the result set type.
      Specified by:
      getResultSetType in interface Statement
      Returns:
      the ResultSet type (SCROLL_SENSITIVE or SCROLL_INSENSITIVE)
      Throws:
      SQLException - if an error occurs.
    • getUpdateCount

      public int getUpdateCount() throws 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 Statement
      Returns:
      the current result as an update count.
      Throws:
      SQLException - if a database access error occurs
    • getWarnings

      public SQLWarning getWarnings() throws 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 Statement
      Returns:
      the first java.sql.SQLWarning or null
      Throws:
      SQLException - if a database access error occurs
    • realClose

      protected void realClose(boolean calledExplicitly, boolean closeOpenResults) throws SQLException
      Closes this statement, and frees resources.
      Parameters:
      calledExplicitly - was this called from close()?
      Throws:
      SQLException - if an error occurs
    • setCursorName

      public void setCursorName(String name) throws 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 Statement
      Parameters:
      name - the new cursor name
      Throws:
      SQLException - if a database access error occurs
    • setEscapeProcessing

      public void setEscapeProcessing(boolean enable) throws 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 Statement
      Parameters:
      enable - true to enable; false to disable
      Throws:
      SQLException - if a database access error occurs
    • setFetchDirection

      public void setFetchDirection(int direction) throws 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 Statement
      Parameters:
      direction - the initial direction for processing rows
      Throws:
      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 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 Statement
      Parameters:
      rows - the number of rows to fetch
      Throws:
      SQLException - if a database-access error occurs, or the condition 0 <= rows <= this.getMaxRows() is not satisfied.
    • setHoldResultsOpenOverClose

      public void setHoldResultsOpenOverClose(boolean holdResultsOpenOverClose)
      Specified by:
      setHoldResultsOpenOverClose in interface Statement
    • setMaxFieldSize

      public void setMaxFieldSize(int max) throws SQLException
      Sets the maxFieldSize
      Specified by:
      setMaxFieldSize in interface Statement
      Parameters:
      max - the new max column size limit; zero means unlimited
      Throws:
      SQLException - if size exceeds buffer size
    • setMaxRows

      public void setMaxRows(int max) throws SQLException
      Set the maximum number of rows
      Specified by:
      setMaxRows in interface Statement
      Parameters:
      max - the new max rows limit; zero means unlimited
      Throws:
      SQLException - if a database access error occurs
      See Also:
    • setQueryTimeout

      public void setQueryTimeout(int seconds) throws SQLException
      Sets the queryTimeout limit
      Specified by:
      setQueryTimeout in interface Statement
      Parameters:
      seconds - - the new query timeout limit in seconds
      Throws:
      SQLException - if a database access error occurs
    • setResultSetConcurrency

      void setResultSetConcurrency(int concurrencyFlag)
      Sets the concurrency for result sets generated by this statement
      Parameters:
      concurrencyFlag -
    • setResultSetType

      void setResultSetType(int typeFlag)
      Sets the result set type for result sets generated by this statement
      Parameters:
      typeFlag -
    • getBatchedGeneratedKeys

      protected void getBatchedGeneratedKeys(Statement batchedStatement) throws SQLException
      Throws:
      SQLException
    • getBatchedGeneratedKeys

      protected void getBatchedGeneratedKeys(int maxKeys) throws SQLException
      Throws:
      SQLException
    • isClosed

      public boolean isClosed() throws SQLException
      Specified by:
      isClosed in interface Statement
      Throws:
      SQLException
    • isPoolable

      public boolean isPoolable() throws SQLException
      Specified by:
      isPoolable in interface Statement
      Throws:
      SQLException
    • setPoolable

      public void setPoolable(boolean poolable) throws SQLException
      Specified by:
      setPoolable in interface Statement
      Throws:
      SQLException
    • isWrapperFor

      public boolean isWrapperFor(Class<?> iface) throws SQLException
      Specified by:
      isWrapperFor in interface Wrapper
      Specified by:
      isWrapperFor in interface Wrapper
      Throws:
      SQLException
      See Also:
    • unwrap

      public <T> T unwrap(Class<T> iface) throws SQLException
      Specified by:
      unwrap in interface Wrapper
      Specified by:
      unwrap in interface Wrapper
      Throws:
      SQLException
      See Also:
    • findStartOfStatement

      protected static int findStartOfStatement(String sql)
    • getLocalInfileInputStream

      public 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().
      Specified by:
      getLocalInfileInputStream in interface Statement
    • setLocalInfileInputStream

      public void setLocalInfileInputStream(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.
      Specified by:
      setLocalInfileInputStream in interface Statement
    • setPingTarget

      public void setPingTarget(PingTarget pingTarget)
      Specified by:
      setPingTarget in interface Statement
    • getExceptionInterceptor

      public ExceptionInterceptor getExceptionInterceptor()
      Specified by:
      getExceptionInterceptor in interface Statement
    • containsOnDuplicateKeyInString

      protected boolean containsOnDuplicateKeyInString(String sql)
    • getOnDuplicateKeyLocation

      protected static int getOnDuplicateKeyLocation(String sql, boolean dontCheckOnDuplicateKeyUpdateInSQL, boolean rewriteBatchedStatements, boolean noBackslashEscapes)
    • closeOnCompletion

      public void closeOnCompletion() throws SQLException
      Specified by:
      closeOnCompletion in interface Statement
      Throws:
      SQLException
    • isCloseOnCompletion

      public boolean isCloseOnCompletion() throws SQLException
      Specified by:
      isCloseOnCompletion in interface Statement
      Throws:
      SQLException
    • executeLargeBatch

      public long[] executeLargeBatch() throws SQLException
      JDBC 4.2 Same as executeBatch() but returns long[] instead of int[].
      Specified by:
      executeLargeBatch in interface Statement
      Throws:
      SQLException
    • executeLargeUpdate

      public long executeLargeUpdate(String sql) throws SQLException
      JDBC 4.2 Same as executeUpdate(String) but returns long instead of int.
      Specified by:
      executeLargeUpdate in interface Statement
      Throws:
      SQLException
    • executeLargeUpdate

      public long executeLargeUpdate(String sql, int autoGeneratedKeys) throws SQLException
      JDBC 4.2 Same as executeUpdate(String, int) but returns long instead of int.
      Specified by:
      executeLargeUpdate in interface Statement
      Throws:
      SQLException
    • executeLargeUpdate

      public long executeLargeUpdate(String sql, int[] columnIndexes) throws SQLException
      JDBC 4.2 Same as executeUpdate(String, int[]) but returns long instead of int.
      Specified by:
      executeLargeUpdate in interface Statement
      Throws:
      SQLException
    • executeLargeUpdate

      public long executeLargeUpdate(String sql, String[] columnNames) throws SQLException
      JDBC 4.2 Same as executeUpdate(String, String[]) but returns long instead of int.
      Specified by:
      executeLargeUpdate in interface Statement
      Throws:
      SQLException
    • getLargeMaxRows

      public long getLargeMaxRows() throws SQLException
      JDBC 4.2 Same as getMaxRows() but returns long instead of int.
      Specified by:
      getLargeMaxRows in interface Statement
      Throws:
      SQLException
    • getLargeUpdateCount

      public long getLargeUpdateCount() throws SQLException
      JDBC 4.2 Same as getUpdateCount() but returns long instead of int;
      Specified by:
      getLargeUpdateCount in interface Statement
      Throws:
      SQLException
    • setLargeMaxRows

      public void setLargeMaxRows(long max) throws SQLException
      JDBC 4.2 Same as setMaxRows(int) but accepts a long value instead of an int.
      Specified by:
      setLargeMaxRows in interface Statement
      Throws:
      SQLException
    • isCursorRequired

      boolean isCursorRequired() throws SQLException
      Throws:
      SQLException