## org.mariadb.jdbc
Class MariaDbPreparedStatementClient

    java.lang.Object
      org.mariadb.jdbc.MariaDbStatement
          org.mariadb.jdbc.BasePrepareStatement
              org.mariadb.jdbc.MariaDbPreparedStatementClient

All Implemented Interfaces:
  Cloneable, PreparedStatement, Statement, Wrapper

Direct Known Subclasses:
  CallableFunctionStatement

    public class MariaDbPreparedStatementClient

extends BasePrepareStatement

Field Summary
`protected List<ParameterHolder[]>` `parameterList`
`protected ClientPrepareResult` `prepareResult`

Fields inherited from class org.mariadb.jdbc.BasePrepareStatement
`hasLongData, useFractionalSeconds`

Fields inherited from class org.mariadb.jdbc.MariaDbStatement
`batchQueries, canUseServerTimeout, closed, connection, fetchSize, lock, maxRows, mustCloseOnCompletion, options, protocol, queryTimeout, results, resultSetScrollType, timerTaskFuture, timerTaskRunnable, warningsCleared`

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
`MariaDbPreparedStatementClient(MariaDbConnection connection, String sql, int resultSetScrollType)` Constructor.

Method Summary
`void` `addBatch()` Adds a set of parameters to this `PreparedStatement` object's batch of send.
`void` `addBatch(String sql)` Add batch.
`void` `clearBatch()` Clear batch.
`void` `clearParameters()` Clears the current parameter values immediately.
`MariaDbPreparedStatementClient` `clone(MariaDbConnection 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)`
`protected void` `executeInternalBatch(int size)` Choose better way to execute queries according to query and options.
`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.
`protected int` `getParameterCount()`
`ParameterMetaData` `getParameterMetaData()` Retrieves the number, types and properties of this `PreparedStatement` object's parameters.
`protected ClientPrepareResult` `getPrepareResult()`
`protected void` `setParameter(int parameterIndex, ParameterHolder holder)`
`String` `toString()` {inherit}.

Methods inherited from class org.mariadb.jdbc.BasePrepareStatement

`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, setInternalObject, setLong, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setNull, setNull, setObject, setObject, setObject, setRef, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURL`

Methods inherited from class org.mariadb.jdbc.MariaDbStatement

`cancel, checkClose, checkCloseOnCompletion, clearWarnings, closeOnCompletion, execute, execute, execute, execute, executeBatchEpilogue, executeBatchExceptionEpilogue, executeEpilogue, executeExceptionEpilogue, executeInternal, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeQueryPrologue, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getProtocol, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getServerThreadId, getUpdateCount, getWarnings, handleFailoverAndTimeout, internalBatchExecution, isClosed, isCloseOnCompletion, isPoolable, isWrapperFor, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setLocalInfileInputStream, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout, setTimerTask, skipMoreResults, stopTimeoutTask, testExecute, unloadDriver, unwrap`

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

Methods inherited from interface java.sql.Statement

`cancel, clearWarnings, execute, execute, execute, execute, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isPoolable, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout`

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

Field Detail

### prepareResult

    protected ClientPrepareResult prepareResult

### parameterList

    protected List<ParameterHolder[]> parameterList

Constructor Detail

### MariaDbPreparedStatementClient

    public MariaDbPreparedStatementClient(MariaDbConnection connection,
                                          String sql,
                                          int resultSetScrollType)
                                   throws SQLException

  Constructor.

  Parameters:
    `connection` - connection
    `sql` - sql query
    `resultSetScrollType` - one of the following `ResultSet` constants: `ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.TYPE_SCROLL_INSENSITIVE`, or `ResultSet.TYPE_SCROLL_SENSITIVE`
  Throws:
    `SQLException` - exception

Method Detail

### clone

    public MariaDbPreparedStatementClient clone(MariaDbConnection connection)
                                         throws CloneNotSupportedException

  Clone statement.

  Overrides:
    `clone` in class `BasePrepareStatement`
  Parameters:
    `connection` - connection
  Returns:
    Clone statement.
  Throws:
    `CloneNotSupportedException` - if any error occur.

### execute

    public boolean execute()
                    throws SQLException

  Executes the SQL statement in this `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`.
  The `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).

  Returns:
    `true` if the first result is a `ResultSet` object; `false` if the first result is an update count or there is no result
  Throws:
    `SQLException` - if a database access error occurs; this method is called on a closed `PreparedStatement` or an argument is supplied to this method
  See Also:
    `Statement.execute(java.lang.String)`, `Statement.getResultSet()`, `Statement.getUpdateCount()`, `Statement.getMoreResults()`

### executeQuery

    public ResultSet executeQuery()
                           throws SQLException

  Executes the SQL query in this `PreparedStatement` object and returns the `ResultSet` object generated by the query.

  Returns:
    a `ResultSet` object that contains the data produced by the query; never `null`
  Throws:
    `SQLException` - if a database access error occurs; this method is called on a closed `PreparedStatement` or the SQL statement does not return a `ResultSet` object

### executeUpdate

    public int executeUpdate()
                      throws SQLException

  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.

  Returns:
    either (1) the row count for SQL Data Manipulation Language (DML) statements or (2) 0 for SQL statements that return nothing
  Throws:
    `SQLException` - if a database access error occurs; this method is called on a closed `PreparedStatement` or the SQL statement returns a `ResultSet` object

### executeInternal

    protected boolean executeInternal(int fetchSize)
                               throws SQLException

  Specified by:
    `executeInternal` in class `BasePrepareStatement`
  Throws:
    `SQLException`

### addBatch

    public void addBatch()
                  throws SQLException

  Adds a set of parameters to this `PreparedStatement` object's batch of send.

  Throws:
    `SQLException` - if a database access error occurs or this method is called on a closed `PreparedStatement`
  Since:
    1.2
  See Also:
    `Statement.addBatch(java.lang.String)`

### addBatch

    public void addBatch(String sql)
                  throws SQLException

  Add batch.

  Specified by:
    `addBatch` in interface `Statement`
  Overrides:
    `addBatch` in class `MariaDbStatement`
  Parameters:
    `sql` - typically this is a SQL `INSERT` or `UPDATE` statement
  Throws:
    `SQLException` - every time since that method is forbidden on prepareStatement
  See Also:
    `MariaDbStatement.executeBatch()`, `DatabaseMetaData.supportsBatchUpdates()`

### clearBatch

    public void clearBatch()

  Clear batch.

  Specified by:
    `clearBatch` in interface `Statement`
  Overrides:
    `clearBatch` in class `MariaDbStatement`
  See Also:
    `MariaDbStatement.addBatch(java.lang.String)`, `DatabaseMetaData.supportsBatchUpdates()`

### executeBatch

    public int[] executeBatch()
                       throws SQLException

  {inheritdoc}.

  Specified by:
    `executeBatch` in interface `Statement`
  Overrides:
    `executeBatch` in class `MariaDbStatement`
  Returns:
    an array of update counts containing one element for each command in the batch. The elements of the array are ordered according to the order in which send were added to the batch.
  Throws:
    `SQLException` - 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.
  See Also:
    `MariaDbStatement.addBatch(java.lang.String)`, `DatabaseMetaData.supportsBatchUpdates()`

### executeLargeBatch

    public long[] executeLargeBatch()
                             throws SQLException

  Execute batch, like executeBatch(), with returning results with long[]. For when row count may exceed Integer.MAX_VALUE.

  Returns:
    an array of update counts (one element for each command in the batch)
  Throws:
    `SQLException` - if a database error occur.

### executeInternalBatch

    protected void executeInternalBatch(int size)
                                 throws SQLException

  Choose better way to execute queries according to query and options.

  Parameters:
    `size` - parameters number
  Throws:
    `SQLException` - if any error occur

### getMetaData

    public ResultSetMetaData getMetaData()
                                  throws SQLException

  Retrieves a `ResultSetMetaData` object that contains information about the columns of the `ResultSet` object that will be returned when this `PreparedStatement` object is executed.
  Because a `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.
  NOTE: Using this method may be expensive for some drivers due to the lack of underlying DBMS support.

  Returns:
    the description of a `ResultSet` object's columns or `null` if the driver cannot return a `ResultSetMetaData` object
  Throws:
    `SQLException` - if a database access error occurs or this method is called on a closed `PreparedStatement`
    `SQLFeatureNotSupportedException` - if the JDBC driver does not support this method
  Since:
    1.2

### setParameter

    protected void setParameter(int parameterIndex,
                                ParameterHolder holder)
                         throws SQLException

  Specified by:
    `setParameter` in class `BasePrepareStatement`
  Throws:
    `SQLException`

### getParameterMetaData

    public ParameterMetaData getParameterMetaData()
                                           throws SQLException

  Retrieves the number, types and properties of this `PreparedStatement` object's parameters.

  Specified by:
    `getParameterMetaData` in interface `PreparedStatement`
  Specified by:
    `getParameterMetaData` in class `BasePrepareStatement`
  Returns:
    a `ParameterMetaData` object that contains information about the number, types and properties for each parameter marker of this `PreparedStatement` object
  Throws:
    `SQLException` - if a database access error occurs or this method is called on a closed `PreparedStatement`
  Since:
    1.4
  See Also:
    `ParameterMetaData`

### clearParameters

    public void clearParameters()

  Clears the current parameter values immediately.

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

### close

    public void close()
               throws SQLException

  Description copied from class: `MariaDbStatement`
  Releases this `Statement` 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.

  Specified by:
    `close` in interface `Statement`
  Overrides:
    `close` in class `MariaDbStatement`
  Throws:
    `SQLException` - if a database access error occurs

### getParameterCount

    protected int getParameterCount()

### toString

    public String toString()

  {inherit}.

  Overrides:
    `toString` in class `Object`

### getPrepareResult

    protected ClientPrepareResult getPrepareResult()

Copyright © 2017. All rights reserved.