Class StatementImpl
- All Implemented Interfaces:
Statement, Wrapper, AutoCloseable, Statement, Wrapper
- Direct Known Subclasses:
PreparedStatement
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classThread 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
FieldsModifier and TypeFieldDescriptionHolds batched commandsprotected ArrayList<ResultSetRow> protected ObjectMutex to prevent race between returning query results and noticing that we're timed-out or cancelled.protected SingleByteCharsetConverterThe character converter to use (if available)protected StringThe character encoding to use (if available)protected booleanHas clearWarnings() been called?protected MySQLConnectionThe connection that created usprotected booleanprotected StringThe catalog in useprotected booleanShould we process escape codes?protected ResultSetInternalMethodsprotected booleanShould this statement hold results open over .close() irregardless of connection's setting?protected booleanHas this statement been closed?protected longThe auto_increment value for the last insertprotected booleanWhether or not the last query was of the form ON DUPLICATE KEY UPDATEprotected intThe max field size for this statementprotected intThe maximum number of rows to return for this statement (-1 means _all_ rows)protected static final String[]protected Set<ResultSetInternalMethods> Set of currently-open ResultSetsprotected booleanAre we in pedantic mode?protected Reference<MySQLConnection> The physical connection used to effectively execute the statementprotected static final Stringprotected PingTargetprotected booleanShould we profile?protected ResultSetInternalMethodsThe current resultsprotected intThe concurrency for this result set (updatable or not)protected intThe type of this result set (scroll sensitive or in-sensitive)protected booleanprotected boolean(package private) static intUsed to generate IDs when profiling.protected final AtomicBooleanAre we currently executing a statement?protected intUsed to identify this statement when profiling.protected intThe timeout for a queryprotected longThe update count for this statementprotected booleanstatic final bytestatic final bytestatic final byteprotected booleanShould we use the usage advisor?protected final booleanprotected SQLWarningThe warnings chain.protected booleanprotected booleanFields inherited from interface Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO -
Constructor Summary
ConstructorsConstructorDescriptionStatementImpl(MySQLConnection c, String catalog) Constructor for a Statement. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidcancel()Cancels this Statement object if both the DBMS and driver support aborting an SQL statement.protected MySQLConnectionChecks if closed() has been called, and throws an exception if soprotected voidcheckForDml(String sql, char firstStatementChar) Checks if the given SQL query with the given first non-ws char is a DML statement.protected voidMethod checkNullOrEmptyQuery.voidJDBC 2.0 Make the set of commands in the current batch empty.voidAfter this call, getWarnings returns null until a new warning is reported for this Statement.voidclose()In many cases, it is desirable to immediately release a Statement's database and JDBC resources instead of waiting for this to happen when it is automatically closed.protected voidClose any open result sets that have been 'held open'voidprotected booleanprotected booleanWe only stream result sets when they are forward-only, read-only, and the fetch size has been set to Integer.MIN_VALUEvoidResets this statements fetch size and result set type to the values they had before enableStreamingResults() was called.protected voidvoidWorkaround 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 a SQL statement that may return multiple results.booleanbooleanbooleanint[]JDBC 2.0 Submit a batch of commands to the database for execution.protected long[]long[]JDBC 4.2 Same asexecuteBatch()but returns long[] instead of int[].longexecuteLargeUpdate(String sql) JDBC 4.2 Same asexecuteUpdate(String)but returns long instead of int.longexecuteLargeUpdate(String sql, int autoGeneratedKeys) JDBC 4.2 Same asexecuteUpdate(String, int)but returns long instead of int.longexecuteLargeUpdate(String sql, int[] columnIndexes) JDBC 4.2 Same asexecuteUpdate(String, int[])but returns long instead of int.longexecuteLargeUpdate(String sql, String[] columnNames) JDBC 4.2 Same asexecuteUpdate(String, String[])but returns long instead of int.executeQuery(String sql) Execute a SQL statement that returns a single ResultSetprotected voidexecuteSimpleNonQuery(MySQLConnection c, String nonQuery) intexecuteUpdate(String sql) Execute a SQL INSERT, UPDATE or DELETE statement.intexecuteUpdate(String sql, int autoGeneratedKeys) intexecuteUpdate(String sql, int[] columnIndexes) intexecuteUpdate(String sql, String[] columnNames) protected longexecuteUpdateInternal(String sql, boolean isBatch, boolean returnGeneratedKeys) protected static intprotected ResultSetInternalMethodsGet the batched args as added by the addBatch method(s).protected voidgetBatchedGeneratedKeys(int maxKeys) protected voidgetBatchedGeneratedKeys(Statement batchedStatement) protected CalendarOptimization to only use one calendar per-session, or calculate it for each call, depending on user configurationJDBC 2.0 Return the Connection that produced the Statement.intJDBC 2.0 Determine the fetch direction.intJDBC 2.0 Determine the default fetch size.protected ResultSetInternalMethodsprotected ResultSetInternalMethodsgetGeneratedKeysInternal(long numKeys) intgetId()Returns the id used when profilinglongJDBC 4.2 Same asgetMaxRows()but returns long instead of int.longJDBC 4.2 Same asgetUpdateCount()but returns long instead of int;longgetLastInsertID returns the value of the auto_incremented key after an executeQuery() or excute() call.Returns the InputStream instance that will be used to send data in response to a "LOAD DATA LOCAL INFILE" statement.longgetLongUpdateCount returns the current result as an update count, if the result is a ResultSet or there are no more results, -1 is returned.intThe 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.intThe maxRows limit is set to limit the number of rows that any ResultSet can contain.booleangetMoreResults moves to a Statement's next result.booleangetMoreResults(int current) protected static intgetOnDuplicateKeyLocation(String sql, boolean dontCheckOnDuplicateKeyUpdateInSQL, boolean rewriteBatchedStatements, boolean noBackslashEscapes) intReturns the number of open result sets for this statement.intThe queryTimeout limit is the number of seconds the driver will wait for a Statement to execute.getResultSet returns the current result as a ResultSet.intJDBC 2.0 Determine the result set concurrency.intprotected ResultSetInternalMethodsintJDBC 2.0 Determine the result set type.intgetUpdateCount returns the current result as an update count, if the result is a ResultSet or there are no more results, -1 is returned.The first warning reported by calls on this Statement is returned.protected SQLExceptionhandleExceptionForBatch(int endOfBatchIndex, int numValuesPerBatch, long[] updateCounts, SQLException ex) protected final booleanprotected voidClose all result sets in this statement.booleanisClosed()boolean(package private) booleanbooleanbooleanisWrapperFor(Class<?> iface) protected intprocessMultiCountsAndKeys(StatementImpl batchedStatement, int updateCountCounter, long[] updateCounts) protected voidrealClose(boolean calledExplicitly, boolean closeOpenResults) Closes this statement, and frees resources.voidCallback for result set instances to remove them from the Set that tracks them per-statementprotected voidvoidsetCursorName(String name) setCursorName defines the SQL cursor name that will be used by subsequent execute methods.voidsetEscapeProcessing(boolean enable) If escape scanning is on (the default), the driver will do escape substitution before sending the SQL to the database.voidsetFetchDirection(int direction) JDBC 2.0 Give a hint as to the direction in which the rows in a result set will be processed.voidsetFetchSize(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.voidsetHoldResultsOpenOverClose(boolean holdResultsOpenOverClose) voidsetLargeMaxRows(long max) JDBC 4.2 Same assetMaxRows(int)but accepts a long value instead of an int.voidsetLocalInfileInputStream(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) Sets the maxFieldSizevoidsetMaxRows(int max) Set the maximum number of rowsvoidsetPingTarget(PingTarget pingTarget) voidsetPoolable(boolean poolable) voidsetQueryTimeout(int seconds) Sets the queryTimeout limit(package private) voidsetResultSetConcurrency(int concurrencyFlag) Sets the concurrency for result sets generated by this statement(package private) voidsetResultSetType(int typeFlag) Sets the result set type for result sets generated by this statementprotected voidAdjust net_write_timeout to a higher value if we're streaming result sets.protected void<T> TMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Statement
enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, isSimpleIdentifier
-
Field Details
-
PING_MARKER
- See Also:
-
ON_DUPLICATE_KEY_UPDATE_CLAUSE
-
cancelTimeoutMutex
Mutex to prevent race between returning query results and noticing that we're timed-out or cancelled. -
statementCounter
static int statementCounterUsed 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
-
charConverter
The character converter to use (if available) -
charEncoding
The character encoding to use (if available) -
connection
The connection that created us -
physicalConnection
The physical connection used to effectively execute the statement -
currentCatalog
The catalog in use -
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
protected 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) -
resultSetType
protected int resultSetTypeThe type of this result set (scroll sensitive or in-sensitive) -
statementId
protected int statementIdUsed to identify this statement when profiling. -
timeoutInMillis
protected int timeoutInMillisThe timeout for a query -
updateCount
protected long updateCountThe update count for this statement -
useUsageAdvisor
protected boolean useUsageAdvisorShould we use the usage advisor? -
warningChain
The warnings chain. -
clearWarningsCalled
protected boolean clearWarningsCalledHas clearWarnings() been called? -
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
-
useLegacyDatetimeCode
protected boolean useLegacyDatetimeCode -
sendFractionalSeconds
protected boolean sendFractionalSeconds -
lastQueryIsOnDupKeyUpdate
protected boolean lastQueryIsOnDupKeyUpdateWhether or not the last query was of the form ON DUPLICATE KEY UPDATE -
statementExecuting
Are we currently executing a statement? -
version5013OrNewer
protected final boolean version5013OrNewer
-
-
Constructor Details
-
StatementImpl
Constructor for a Statement.- Parameters:
c- the Connection instance that creates uscatalog- the database name in use when we were created- Throws:
SQLException- if an error occurs.
-
-
Method Details
-
addBatch
- Specified by:
addBatchin interfaceStatement- Parameters:
sql-- Throws:
SQLException
-
getBatchedArgs
-
cancel
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:
cancelin interfaceStatement- Throws:
SQLException
-
checkClosed
Checks if closed() has been called, and throws an exception if so- Throws:
SQLException- if this statement has been closed
-
checkForDml
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 checkfirstStatementChar- the UC first non-ws char of the statement- Throws:
SQLException- if the statement contains DML
-
checkNullOrEmptyQuery
Method checkNullOrEmptyQuery.- Parameters:
sql- the SQL to check- Throws:
SQLException- if query is null or empty.
-
clearBatch
JDBC 2.0 Make the set of commands in the current batch empty. This method is optional.- Specified by:
clearBatchin interfaceStatement- Throws:
SQLException- if a database-access error occurs, or the driver does not support batch statements
-
clearWarnings
After this call, getWarnings returns null until a new warning is reported for this Statement.- Specified by:
clearWarningsin interfaceStatement- Throws:
SQLException- if a database access error occurs (why?)
-
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. The close method provides this immediate release.Note: A Statement is automatically closed when it is garbage collected. When a Statement is closed, its current ResultSet, if one exists, is also closed.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceStatement- Throws:
SQLException- if a database access error occurs
-
closeAllOpenResults
Close any open result sets that have been 'held open'- Throws:
SQLException
-
implicitlyCloseAllOpenResults
Close all result sets in this statement. This includes multi-results- Throws:
SQLException
-
removeOpenResultSet
Description copied from interface:StatementCallback for result set instances to remove them from the Set that tracks them per-statement- Specified by:
removeOpenResultSetin interfaceStatement
-
getOpenResultSetCount
public int getOpenResultSetCount()Description copied from interface:StatementReturns the number of open result sets for this statement.- Specified by:
getOpenResultSetCountin interfaceStatement
-
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
Description copied from interface:StatementWorkaround 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 interfaceStatement- Throws:
SQLException
-
disableStreamingResults
Description copied from interface:StatementResets this statements fetch size and result set type to the values they had before enableStreamingResults() was called.- Specified by:
disableStreamingResultsin interfaceStatement- Throws:
SQLException
-
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().- Throws:
SQLException
-
execute
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:
executein interfaceStatement- 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
- Throws:
SQLException
-
execute
- Specified by:
executein interfaceStatement- Throws:
SQLException- See Also:
-
execute
- Specified by:
executein interfaceStatement- Throws:
SQLException- See Also:
-
execute
- Specified by:
executein interfaceStatement- Throws:
SQLException- See Also:
-
executeBatch
JDBC 2.0 Submit a batch of commands to the database for execution. This method is optional.- Specified by:
executeBatchin interfaceStatement- 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 statementsBatchUpdateException
-
executeBatchInternal
- Throws:
SQLException
-
hasDeadlockOrTimeoutRolledBackTx
-
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:
BatchUpdateExceptionSQLException
-
executeQuery
Execute a SQL statement that returns a single ResultSet- Specified by:
executeQueryin interfaceStatement- 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
- Throws:
SQLException
-
generatePingResultSet
- Throws:
SQLException
-
executeSimpleNonQuery
- Throws:
SQLException
-
executeUpdate
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:
executeUpdatein interfaceStatement- 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
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException- See Also:
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException- See Also:
-
executeUpdate
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException- See Also:
-
getCalendarInstanceForSessionOrNew
Optimization to only use one calendar per-session, or calculate it for each call, depending on user configuration- Throws:
SQLException
-
getConnection
JDBC 2.0 Return the Connection that produced the Statement.- Specified by:
getConnectionin interfaceStatement- Returns:
- the Connection that produced the Statement
- Throws:
SQLException- if an error occurs
-
getFetchDirection
JDBC 2.0 Determine the fetch direction.- Specified by:
getFetchDirectionin interfaceStatement- Returns:
- the default fetch direction
- Throws:
SQLException- if a database-access error occurs
-
getFetchSize
JDBC 2.0 Determine the default fetch size.- Specified by:
getFetchSizein interfaceStatement- Returns:
- the number of rows to fetch at a time
- Throws:
SQLException- if an error occurs
-
getGeneratedKeys
- Specified by:
getGeneratedKeysin interfaceStatement- Throws:
SQLException
-
getGeneratedKeysInternal
- Throws:
SQLException
-
getGeneratedKeysInternal
- Throws:
SQLException
-
getId
-
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
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:
getMaxFieldSizein interfaceStatement- Returns:
- the current max column size limit; zero means unlimited
- Throws:
SQLException- if a database access error occurs
-
getMaxRows
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:
getMaxRowsin interfaceStatement- Returns:
- the current maximum row limit; zero means unlimited
- Throws:
SQLException- if a database access error occurs
-
getMoreResults
getMoreResults moves to a Statement's next result. If it returns true, this result is a ResulSet.- Specified by:
getMoreResultsin interfaceStatement- Returns:
- true if the next ResultSet is valid
- Throws:
SQLException- if a database access error occurs
-
getMoreResults
- Specified by:
getMoreResultsin interfaceStatement- Throws:
SQLException- See Also:
-
getQueryTimeout
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:
getQueryTimeoutin interfaceStatement- Returns:
- the current query timeout limit in seconds; 0 = unlimited
- Throws:
SQLException- if a database access error occurs
-
getResultSet
getResultSet returns the current result as a ResultSet. It should only be called once per result.- Specified by:
getResultSetin interfaceStatement- Returns:
- the current result set; null if there are no more
- Throws:
SQLException- if a database access error occurs (why?)
-
getResultSetConcurrency
JDBC 2.0 Determine the result set concurrency.- Specified by:
getResultSetConcurrencyin interfaceStatement- Returns:
- CONCUR_UPDATABLE or CONCUR_READONLY
- Throws:
SQLException- if an error occurs
-
getResultSetHoldability
- Specified by:
getResultSetHoldabilityin interfaceStatement- Throws:
SQLException- See Also:
-
getResultSetInternal
-
getResultSetType
JDBC 2.0 Determine the result set type.- Specified by:
getResultSetTypein interfaceStatement- Returns:
- the ResultSet type (SCROLL_SENSITIVE or SCROLL_INSENSITIVE)
- Throws:
SQLException- if an error occurs.
-
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. It should only be called once per result.- Specified by:
getUpdateCountin interfaceStatement- Returns:
- the current result as an update count.
- Throws:
SQLException- if a database access error occurs
-
getWarnings
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:
getWarningsin interfaceStatement- Returns:
- the first java.sql.SQLWarning or null
- Throws:
SQLException- if a database access error occurs
-
realClose
Closes this statement, and frees resources.- Parameters:
calledExplicitly- was this called from close()?- Throws:
SQLException- if an error occurs
-
setCursorName
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:
setCursorNamein interfaceStatement- Parameters:
name- the new cursor name- Throws:
SQLException- if a database access error occurs
-
setEscapeProcessing
If escape scanning is on (the default), the driver will do escape substitution before sending the SQL to the database.- Specified by:
setEscapeProcessingin interfaceStatement- Parameters:
enable- true to enable; false to disable- Throws:
SQLException- if a database access error occurs
-
setFetchDirection
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:
setFetchDirectionin interfaceStatement- 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
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:
setFetchSizein interfaceStatement- 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:
setHoldResultsOpenOverClosein interfaceStatement
-
setMaxFieldSize
Sets the maxFieldSize- Specified by:
setMaxFieldSizein interfaceStatement- Parameters:
max- the new max column size limit; zero means unlimited- Throws:
SQLException- if size exceeds buffer size
-
setMaxRows
Set the maximum number of rows- Specified by:
setMaxRowsin interfaceStatement- Parameters:
max- the new max rows limit; zero means unlimited- Throws:
SQLException- if a database access error occurs- See Also:
-
setQueryTimeout
Sets the queryTimeout limit- Specified by:
setQueryTimeoutin interfaceStatement- 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
- Throws:
SQLException
-
getBatchedGeneratedKeys
- Throws:
SQLException
-
isClosed
- Specified by:
isClosedin interfaceStatement- Throws:
SQLException
-
isPoolable
- Specified by:
isPoolablein interfaceStatement- Throws:
SQLException
-
setPoolable
- Specified by:
setPoolablein interfaceStatement- Throws:
SQLException
-
isWrapperFor
- Specified by:
isWrapperForin interfaceWrapper- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException- See Also:
-
unwrap
- Specified by:
unwrapin interfaceWrapper- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException- See Also:
-
findStartOfStatement
-
getLocalInfileInputStream
Description copied from interface:StatementReturns 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 interfaceStatement
-
setLocalInfileInputStream
Description copied from interface:StatementSets 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 interfaceStatement
-
setPingTarget
- Specified by:
setPingTargetin interfaceStatement
-
getExceptionInterceptor
- Specified by:
getExceptionInterceptorin interfaceStatement
-
containsOnDuplicateKeyInString
-
getOnDuplicateKeyLocation
protected static int getOnDuplicateKeyLocation(String sql, boolean dontCheckOnDuplicateKeyUpdateInSQL, boolean rewriteBatchedStatements, boolean noBackslashEscapes) -
closeOnCompletion
- Specified by:
closeOnCompletionin interfaceStatement- Throws:
SQLException
-
isCloseOnCompletion
- Specified by:
isCloseOnCompletionin interfaceStatement- Throws:
SQLException
-
executeLargeBatch
JDBC 4.2 Same asexecuteBatch()but returns long[] instead of int[].- Specified by:
executeLargeBatchin interfaceStatement- Throws:
SQLException
-
executeLargeUpdate
JDBC 4.2 Same asexecuteUpdate(String)but returns long instead of int.- Specified by:
executeLargeUpdatein interfaceStatement- Throws:
SQLException
-
executeLargeUpdate
JDBC 4.2 Same asexecuteUpdate(String, int)but returns long instead of int.- Specified by:
executeLargeUpdatein interfaceStatement- Throws:
SQLException
-
executeLargeUpdate
JDBC 4.2 Same asexecuteUpdate(String, int[])but returns long instead of int.- Specified by:
executeLargeUpdatein interfaceStatement- Throws:
SQLException
-
executeLargeUpdate
JDBC 4.2 Same asexecuteUpdate(String, String[])but returns long instead of int.- Specified by:
executeLargeUpdatein interfaceStatement- Throws:
SQLException
-
getLargeMaxRows
JDBC 4.2 Same asgetMaxRows()but returns long instead of int.- Specified by:
getLargeMaxRowsin interfaceStatement- Throws:
SQLException
-
getLargeUpdateCount
JDBC 4.2 Same asgetUpdateCount()but returns long instead of int;- Specified by:
getLargeUpdateCountin interfaceStatement- Throws:
SQLException
-
setLargeMaxRows
JDBC 4.2 Same assetMaxRows(int)but accepts a long value instead of an int.- Specified by:
setLargeMaxRowsin interfaceStatement- Throws:
SQLException
-
isCursorRequired
- Throws:
SQLException
-