public class MariaDbClientPreparedStatement extends AbstractMariaDbPrepareStatement implements Cloneable
| Modifier and Type | Field and Description |
|---|---|
protected MariaDbClientParameterizeQuery |
query |
useFractionalSecondsbinaryData, connection, deleteEndSemicolonPattern, executionResult, fetchSize, firstRewrite, isRewriteable, protocol, resultSetScrollType, timerTaskCLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO| Constructor and Description |
|---|
MariaDbClientPreparedStatement(MariaDbConnection connection,
String sql,
int resultSetScrollType)
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.
|
protected Calendar |
cal() |
void |
clearBatch()
Clear batch.
|
void |
clearParameters()
Clears the current parameter values immediately.
|
MariaDbClientPreparedStatement |
clone()
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. |
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. |
protected ParameterHolder |
getCurrentParameterHolder(int parameterIndex) |
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. |
protected int |
getParameterCount() |
ParameterMetaData |
getParameterMetaData()
Retrieves the number, types and properties of this
PreparedStatement object's parameters. |
protected boolean |
isNoBackslashEscapes() |
protected void |
setParameter(int parameterIndex,
ParameterHolder holder) |
String |
toString() |
protected boolean |
useFractionalSeconds() |
setArray, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setDate, setDate, setDouble, setFloat, setInt, setLong, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setNull, setNull, setObject, setObject, setObject, setRef, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURLcacheMoreResults, cancel, checkClose, clearWarnings, closeOnCompletion, execute, execute, execute, execute, execute, executeBatch, executeQuery, executeQuery, executeQueryEpilog, executeUpdate, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getInsertIncipit, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getProtocol, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isInsertRewriteable, isPoolable, isWrapperFor, retrieveCallableResult, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLocalInfileInputStream, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout, skipMoreResults, stringToQuery, unloadDriver, unwrapequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitexecuteLargeUpdate, setObject, setObjectcancel, clearWarnings, closeOnCompletion, execute, execute, execute, execute, executeBatch, executeLargeBatch, 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, unwrapprotected MariaDbClientParameterizeQuery query
public MariaDbClientPreparedStatement(MariaDbConnection connection, String sql, int resultSetScrollType) throws SQLException
connection - connectionsql - sql queryresultSetScrollType - one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY,
ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVESQLException - exceptionpublic MariaDbClientPreparedStatement clone() throws CloneNotSupportedException
clone in class AbstractMariaDbPrepareStatementCloneNotSupportedException - if any error occur.protected boolean isNoBackslashEscapes()
isNoBackslashEscapes in class AbstractMariaDbPrepareStatementprotected boolean useFractionalSeconds()
useFractionalSeconds in class AbstractMariaDbPrepareStatementprotected Calendar cal()
cal in class AbstractMariaDbPrepareStatementprotected ParameterHolder getCurrentParameterHolder(int parameterIndex)
public ResultSet executeQuery() throws SQLException
PreparedStatement object
and returns the ResultSet object generated by the query.executeQuery in interface PreparedStatementResultSet 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 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).execute in interface PreparedStatementtrue 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 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.executeUpdate in interface PreparedStatementSQLException - if a database access error occurs; this method is called on a closed
PreparedStatement or the SQL statement returns a
ResultSet objectpublic void addBatch()
throws SQLException
PreparedStatement object's batch of send.
addBatch in interface PreparedStatementSQLException - 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 MariaDbStatementsql - typically this is a SQL INSERT or UPDATE statementSQLException - every time since that method is forbidden on prepareStatementMariaDbStatement.executeBatch(),
DatabaseMetaData.supportsBatchUpdates()public void clearBatch()
clearBatch in interface StatementclearBatch in class MariaDbStatementMariaDbStatement.addBatch(java.lang.String),
DatabaseMetaData.supportsBatchUpdates()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.
getMetaData in interface PreparedStatementResultSet 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
PreparedStatementSQLFeatureNotSupportedException - if the JDBC driver does not support this methodprotected void setParameter(int parameterIndex,
ParameterHolder holder)
throws SQLException
setParameter in class AbstractMariaDbPrepareStatementSQLExceptionpublic ParameterMetaData getParameterMetaData() throws SQLException
PreparedStatement object's parameters.getParameterMetaData in interface PreparedStatementgetParameterMetaData in class AbstractMariaDbPrepareStatementParameterMetaData 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()
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.
clearParameters in interface PreparedStatementpublic void close()
throws SQLException
MariaDbStatementStatement 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 MariaDbStatementSQLException - if a database access error occursprotected int getParameterCount()
Copyright © 2016. All rights reserved.