public class JDBC4PreparedStatement extends BasePrepareStatement
autoGeneratedKeys, hasLongData, indexMap, parameterCount, SPEC_ISO_ZONED_DATE_TIMEactualSql, addRowid, batchQueries, canUseServerTimeout, closed, connection, exceptionFactory, executing, fetchSize, isFetchSizeSet, lock, maxRows, options, originalSql, parameterSql, processedSql, protocol, queryTimeout, results, resultSetConcurrency, resultSetScrollType, rowidSql, selectEndPos, simpleSql, sqlType, STMT_ALTER, STMT_BEGIN, STMT_CALL, STMT_CREATE, STMT_DECLARE, STMT_DELETE, STMT_DROP, STMT_INSERT, STMT_SELECT, STMT_UNKNOWN, STMT_UPDATE, utickSql, whereEndPosCLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO| Constructor and Description |
|---|
JDBC4PreparedStatement(OceanBaseConnection connection,
String sql,
int resultSetScrollType,
int resultSetConcurrency,
int autoGeneratedKeys,
ExceptionFactory exceptionFactory)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBatch()
Adds a set of parameters to this
PreparedStatement object's batch of send. |
void |
addBatch(String sql)
Add batch.
|
String |
asSql() |
String |
asSql(boolean quoteStreamsAndUnknowns) |
void |
clearBatch()
Clear batch.
|
void |
clearParameters()
Clears the current parameter values immediately.
|
JDBC4PreparedStatement |
clone(OceanBaseConnection connection)
Clone statement.
|
void |
close()
Releases this
Statement object's database and JDBC resources immediately instead
of waiting for this to happen when it is automatically closed. |
boolean |
execute()
Executes the SQL statement in this
PreparedStatement object, which may be any kind
of SQL statement. |
int[] |
executeBatch()
{inheritdoc}.
|
protected boolean |
executeInternal(int fetchSize) |
long[] |
executeLargeBatch()
Execute batch, like executeBatch(), with returning results with long[].
|
ResultSet |
executeQuery()
Executes the SQL query in this
PreparedStatement object and returns the
ResultSet object generated by the query. |
int |
executeUpdate()
Executes the SQL statement in this
PreparedStatement object, which must be an SQL
Data Manipulation Language (DML) statement, such as INSERT, UPDATE or
DELETE; or an SQL statement that returns nothing, such as a DDL statement. |
ResultSetMetaData |
getMetaData()
Retrieves a
ResultSetMetaData object that contains information about the columns
of the ResultSet object that will be returned when this PreparedStatement
object is executed. |
ParameterMetaData |
getParameterMetaData()
Retrieves the number, types and properties of this
PreparedStatement object's
parameters. |
ParameterHolder[] |
getParameters() |
protected ClientPrepareResult |
getPrepareResult() |
int[] |
getServerUpdateCounts()
Non JDBC : Permit to retrieve server update counts when using option rewriteBatchedStatements.
|
void |
setArray(int parameterIndex,
Array array)
Sets the designated parameter to the given
java.sql.Array object. |
void |
setParameter(int parameterIndex,
ParameterHolder holder)
Set parameter.
|
void |
setParameters(ParameterHolder[] paramArray) |
String |
toString()
{inherit}.
|
executeLargeUpdate, getParameterCount, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBINARY_DOUBLE, setBINARY_FLOAT, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setDate, setDate, setDouble, setFloat, setIndexMap, setInt, setINTERVALDS, setINTERVALYM, setLobLocator, setLocalDateTime, setLong, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setNull, setNull, setNUMBER_FLOAT, setNUMBER, setObject, setObject, setObject, setObject, setObject, setParameterCount, setRef, setRowId, setShort, setSQLXML, setString, setStruct, setTime, setTime, setTimestamp, setTIMESTAMP, setTimestamp, setTIMESTAMPLTZ, setTIMESTAMPTZ, setUnicodeStream, setURLcancel, checkClose, checkCloseOnCompletion, clearWarnings, closeOnCompletion, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, execute, execute, execute, execute, executeBatchEpilogue, executeBatchExceptionEpilogue, executeBatchExceptionEpilogue, executeEpilogue, executeExceptionEpilogue, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeQueryPrologue, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getActualSql, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResults, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getSqlType, getUpdateCount, getWarnings, getWhereEndPos, isAddRowid, isClosed, isCloseOnCompletion, isCursorResultSet, isPoolable, isSimpleIdentifier, isWrapperFor, realClose, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setLocalInfileInputStream, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout, setTimerTask, skipMoreResults, testExecute, unwrapclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcancel, clearWarnings, closeOnCompletion, execute, execute, execute, execute, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeoutisWrapperFor, unwrappublic JDBC4PreparedStatement(OceanBaseConnection connection, String sql, int resultSetScrollType, int resultSetConcurrency, int autoGeneratedKeys, ExceptionFactory exceptionFactory) throws SQLException
connection - connectionsql - sql queryresultSetScrollType - one of the following ResultSet constants:
ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or
ResultSet.TYPE_SCROLL_SENSITIVEresultSetConcurrency - a concurrency type; one of ResultSet.CONCUR_READ_ONLY
or ResultSet.CONCUR_UPDATABLEautoGeneratedKeys - a flag indicating whether auto-generated keys should be returned; one
of Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYSexceptionFactory - exception factorySQLException - exceptionpublic JDBC4PreparedStatement clone(OceanBaseConnection connection) throws CloneNotSupportedException
clone in class BasePrepareStatementconnection - connectionCloneNotSupportedException - if any error occur.public boolean execute()
throws SQLException
PreparedStatement object, which may be any kind
of SQL statement. Some prepared statements return multiple results; the execute
method handles these complex statements as well as the simpler form of statements handled by
the methods executeQuery and executeUpdate. execute method returns a boolean to indicate the form of the
first result. You must call either the method getResultSet or getUpdateCount
to retrieve the result; you must call getInternalMoreResults to move to
any subsequent result(s).true if the first result is a ResultSet object; false
if the first result is an update count or there is no resultSQLException - if a database access error occurs; this method is called on a closed
PreparedStatement or an argument is supplied to this methodStatement.execute(java.lang.String),
Statement.getResultSet(),
Statement.getUpdateCount(),
Statement.getMoreResults()public ResultSet executeQuery() throws SQLException
PreparedStatement object and returns the
ResultSet object generated by the query.ResultSet object that contains the data produced by the query; never
nullSQLException - if a database access error occurs; this method is called on a closed
PreparedStatement or the SQL statement does not return a ResultSet
objectpublic int executeUpdate()
throws SQLException
PreparedStatement object, which must be an SQL
Data Manipulation Language (DML) statement, such as INSERT, UPDATE or
DELETE; or an SQL statement that returns nothing, such as a DDL statement.
Result-set are permitted for historical reason, even if spec indicate to throw exception.SQLException - if a database access error occurs; this method is called on a closed
PreparedStatementprotected boolean executeInternal(int fetchSize)
throws SQLException
executeInternal in class BasePrepareStatementSQLExceptionpublic void addBatch()
throws SQLException
PreparedStatement object's batch of send. SQLException - if a database access error occurs or this method is called on a closed
PreparedStatementStatement.addBatch(java.lang.String)public void addBatch(String sql) throws SQLException
addBatch in interface StatementaddBatch in class OceanBaseStatementsql - typically this is a SQL INSERT or UPDATE statementSQLException - every time since that method is forbidden on prepareStatementOceanBaseStatement.executeBatch(),
DatabaseMetaData.supportsBatchUpdates()public void clearBatch()
clearBatch in interface StatementclearBatch in class OceanBaseStatementOceanBaseStatement.addBatch(java.lang.String),
DatabaseMetaData.supportsBatchUpdates()public int[] executeBatch()
throws SQLException
executeBatch in interface StatementexecuteBatch in class OceanBaseStatementSQLException - if a database access error occurs, this method is called on a closed
Statement or the driver does not support batch statements. Throws BatchUpdateException (a subclass of SQLException) if one of the send sent to
the database fails to execute properly or attempts to return a result set.OceanBaseStatement.addBatch(java.lang.String),
DatabaseMetaData.supportsBatchUpdates()public int[] getServerUpdateCounts()
public long[] executeLargeBatch()
throws SQLException
executeLargeBatch in interface StatementexecuteLargeBatch in class OceanBaseStatementSQLException - if a database error occur.public ResultSetMetaData getMetaData() throws SQLException
ResultSetMetaData object that contains information about the columns
of the ResultSet object that will be returned when this PreparedStatement
object is executed. PreparedStatement object is precompiled, it is possible to know about
the ResultSet object that it will return without having to execute it.
Consequently, it is possible to invoke the method getMetaData on a
PreparedStatement object rather than waiting to execute it and then invoking the
ResultSet.getMetaData method on the ResultSet object that is returned.ResultSet object's columns or null if
the driver cannot return a ResultSetMetaData objectSQLException - if a database access error occurs or this method is called on a closed
PreparedStatementpublic void setParameter(int parameterIndex,
ParameterHolder holder)
throws SQLException
setParameter in class BasePrepareStatementparameterIndex - indexholder - parameter holderSQLException - if index position doesn't correspond to query parameterspublic ParameterMetaData getParameterMetaData() throws SQLException
PreparedStatement object's
parameters.getParameterMetaData in interface PreparedStatementgetParameterMetaData in class BasePrepareStatementParameterMetaData object that contains information about the number,
types and properties for each parameter marker of this PreparedStatement
objectSQLException - if a database access error occurs or this method is called on a closed
PreparedStatementParameterMetaDatapublic void clearParameters()
throws SQLException
In general, parameter values remain in force for repeated use of a statement. Setting a
parameter value automatically clears its previous value. However, in some cases it is useful to
immediately release the resources used by the current parameter values; this can be done by
calling the method clearParameters.
SQLExceptionpublic ParameterHolder[] getParameters()
getParameters in class BasePrepareStatementpublic void setParameters(ParameterHolder[] paramArray)
setParameters in class BasePrepareStatementpublic void close()
throws SQLException
OceanBaseStatementStatement object's database and JDBC resources immediately instead
of waiting for this to happen when it is automatically closed. It is generally good practice to
release resources as soon as you are finished with them to avoid tying up database resources.
Calling the method close on a Statement object that is already closed
has no effect. Note:When a Statement object is closed, its current
ResultSet object, if one exists, is also closed.close in interface AutoCloseableclose in interface Statementclose in class OceanBaseStatementSQLException - if a database access error occurspublic void setArray(int parameterIndex,
Array array)
throws SQLException
BasePrepareStatementjava.sql.Array object. The driver
converts this to an SQL ARRAY value when it sends it to the database.setArray in interface PreparedStatementsetArray in class BasePrepareStatementparameterIndex - the first parameter is 1, the second is 2, ...array - an Array object that maps an SQL ARRAY valueSQLException - if parameterIndex does not correspond to a parameter marker in the SQL
statement; if a database access error occurs or this method is called on a closed
PreparedStatementprotected ClientPrepareResult getPrepareResult()
public String asSql() throws SQLException
asSql in class BasePrepareStatementSQLExceptionpublic String asSql(boolean quoteStreamsAndUnknowns) throws SQLException
SQLExceptionCopyright © 2022 oceanbase.com. All rights reserved.