Class EmbedPreparedStatement

All Implemented Interfaces:
AutoCloseable, PreparedStatement, Statement, Wrapper, EnginePreparedStatement, EngineStatement
Direct Known Subclasses:
EmbedCallableStatement, EmbedPreparedStatement42

public class EmbedPreparedStatement extends EmbedStatement implements EnginePreparedStatement
EmbedPreparedStatement is a local JDBC statement. It supports JDBC 4.1.
  • Field Details

    • rMetaData

      protected ResultSetMetaData rMetaData
    • gcDuringGetMetaData

      private String gcDuringGetMetaData
    • preparedStatement

      protected PreparedStatement preparedStatement
    • activation

      private Activation activation
    • usePreTenFiveHdrFormat

      private Boolean usePreTenFiveHdrFormat
      Tells which header format to use when writing CLOBs into the store.

      This is lazily set if we need it, and there are currently only two valid header formats to choose between.

      See Also:
    • bcc

  • Constructor Details

    • EmbedPreparedStatement

      public EmbedPreparedStatement(EmbedConnection conn, String sql, boolean forMetaData, int resultSetType, int resultSetConcurrency, int resultSetHoldability, int autoGeneratedKeys, int[] columnIndexes, String[] columnNames) throws SQLException
      Constructor assumes caller will setup context stack and restore it.
      Throws:
      SQLException
  • Method Details

    • finalize

      protected void finalize() throws Throwable
      JDBC states that a Statement is closed when garbage collected.
      Overrides:
      finalize in class EmbedStatement
      Throws:
      Throwable - Allows any exception to be thrown during finalize
    • execute

      public final boolean execute(String sql) throws SQLException
      Description copied from class: EmbedStatement
      Execute a SQL statement that may return multiple results. Under some (uncommon) situations a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this, unless you're executing a stored procedure that you know may return multiple results, or unless you're dynamically executing an unknown SQL string. The "execute", "getMoreResults", "getResultSet" and "getUpdateCount" methods let you navigate through multiple results. The "execute" method executes a SQL statement and indicates the form of the first result. You can then use getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s).
      Specified by:
      execute in interface Statement
      Overrides:
      execute in class EmbedStatement
      Parameters:
      sql - any SQL statement
      Returns:
      true if the first result is a ResultSet; false if it is an integer
      Throws:
      SQLException - thrown on failure
      See Also:
    • execute

      public final boolean execute(String sql, int autoGenKeys) throws SQLException
      Description copied from class: EmbedStatement
      JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that any auto-generated keys should be made available for retrieval. The driver will ignore this signal if the SQL statement is not an INSERT/UPDATE statement.
      Specified by:
      execute in interface Statement
      Overrides:
      execute in class EmbedStatement
      Parameters:
      sql - any SQL statement
      autoGenKeys - - a constant indicating whether auto-generated keys should be made available for retrieval using the method getGeneratedKeys; one of the following constants: Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS
      Returns:
      rue if the first result is a ResultSet object; false if it is an update count or there are no results
      Throws:
      SQLException - if a database access error occurs
    • execute

      public final boolean execute(String sql, int[] columnIndexes) throws SQLException
      Description copied from class: EmbedStatement
      JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. This array contains the indexes of the columns in the target table that contain the auto-generated keys that should be made available. The driver will ignore the array if the given SQL statement is not an INSERT/UPDATE statement.
      Specified by:
      execute in interface Statement
      Overrides:
      execute in class EmbedStatement
      Parameters:
      sql - any SQL statement
      columnIndexes - - an array of the indexes of the columns in the inserted/updated row that should be made available for retrieval by a call to the method getGeneratedKeys
      Returns:
      rue if the first result is a ResultSet object; false if it is an update count or there are no results
      Throws:
      SQLException - if a database access error occurs
    • execute

      public final boolean execute(String sql, String[] columnNames) throws SQLException
      Description copied from class: EmbedStatement
      JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. This array contains the names of the columns in the target table that contain the auto-generated keys that should be made available. The driver will ignore the array if the given SQL statement is not an INSERT/UPDATE statement.
      Specified by:
      execute in interface Statement
      Overrides:
      execute in class EmbedStatement
      Parameters:
      sql - any SQL statement
      columnNames - - an array of the names of the columns in the inserted/updated row that should be made available for retrieval by a call to the method getGeneratedKeys
      Returns:
      rue if the first result is a ResultSet object; false if it is an update count or there are no results
      Throws:
      SQLException - if a database access error occurs
    • executeQuery

      public final ResultSet executeQuery(String sql) throws SQLException
      Description copied from class: EmbedStatement
      Execute a SQL statement that returns a single ResultSet.
      Specified by:
      executeQuery in interface Statement
      Overrides:
      executeQuery in class EmbedStatement
      Parameters:
      sql - typically this is a static SQL SELECT statement
      Returns:
      a ResultSet that contains the data produced by the query; never null
      Throws:
      SQLException - thrown on failure.
    • executeUpdate

      public final int executeUpdate(String sql) throws SQLException
      Description copied from class: EmbedStatement
      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
      Overrides:
      executeUpdate in class EmbedStatement
      Parameters:
      sql - a SQL INSERT, UPDATE or DELETE statement or a SQL statement that returns nothing
      Returns:
      either the row count for INSERT, UPDATE or DELETE; or 0 for SQL statements that return nothing
      Throws:
      SQLException - thrown on failure.
    • executeUpdate

      public final int executeUpdate(String sql, int autoGenKeys) throws SQLException
      Description copied from class: EmbedStatement
      JDBC 3.0 Execute the given SQL statement and signals the driver with the given flag about whether the auto-generated keys produced by this Statement object should be made available for retrieval.
      Specified by:
      executeUpdate in interface Statement
      Overrides:
      executeUpdate in class EmbedStatement
      Parameters:
      sql - a SQL INSERT, UPDATE or DELETE statement or a SQL statement that returns nothing
      autoGenKeys - - a flag indicating whether auto-generated keys should be made available for retrieval; one of the following constants: Statement.RETURN_GENERATED_KEYS Statement.NO_GENERATED_KEYS
      Returns:
      either the row count for INSERT, UPDATE or DELETE; or 0 for SQL statements that return nothing
      Throws:
      SQLException - if a database access error occurs
    • executeUpdate

      public final int executeUpdate(String sql, int[] columnIndexes) throws SQLException
      Description copied from class: EmbedStatement
      JDBC 3.0 Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. The driver will ignore the array if the SQL statement is not an INSERT statement
      Specified by:
      executeUpdate in interface Statement
      Overrides:
      executeUpdate in class EmbedStatement
      Parameters:
      sql - a SQL INSERT, UPDATE or DELETE statement or a SQL statement that returns nothing
      columnIndexes - - an array of column indexes indicating the columns that should be returned from the inserted row
      Returns:
      either the row count for INSERT, UPDATE or DELETE; or 0 for SQL statements that return nothing
      Throws:
      SQLException - if a database access error occurs
    • executeUpdate

      public final int executeUpdate(String sql, String[] columnNames) throws SQLException
      Description copied from class: EmbedStatement
      JDBC 3.0 Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. The driver will ignore the array if the SQL statement is not an INSERT statement
      Specified by:
      executeUpdate in interface Statement
      Overrides:
      executeUpdate in class EmbedStatement
      Parameters:
      sql - a SQL INSERT, UPDATE or DELETE statement or a SQL statement that returns nothing
      columnNames - - an array of the names of the columns that should be returned from the inserted row
      Returns:
      either the row count for INSERT, UPDATE or DELETE; or 0 for SQL statements that return nothing
      Throws:
      SQLException - if a database access error occurs
    • addBatch

      public final void addBatch(String sql) throws SQLException
      Description copied from class: EmbedStatement
      JDBC 2.0 Adds a SQL command to the current batch of commmands for the statement. This method is optional.
      Specified by:
      addBatch in interface Statement
      Overrides:
      addBatch in class EmbedStatement
      Parameters:
      sql - typically this is a static SQL INSERT or UPDATE statement
      Throws:
      SQLException - if a database-access error occurs, or the driver does not support batch statements
    • closeActions

      void closeActions() throws SQLException
      Additional close to close our activation. In the case that a XAConnection is involved in the creation of this PreparedStatement for e.g in the following case XAConnection xaconn = xadatasource.getXAConnection();//where xadatasource is an object of XADataSource Connection conn = xaconnection.getConnection(); PreparedStatement ps = conn.preparedStatement("values 1"); In the above case the PreparedStatement will actually be a BrokeredPreparedStatement object. Hence when we call bcc.onStatementClose and pass the PreparedStatement that caused it applicationStatement will be the appropriate choice since it will contain the appropriate instance of PreparedStatement in each case
      Overrides:
      closeActions in class EmbedStatement
      Throws:
      SQLException - upon failure
    • executeQuery

      public final ResultSet executeQuery() throws SQLException
      A prepared SQL query is executed and its ResultSet is returned.
      Specified by:
      executeQuery in interface PreparedStatement
      Returns:
      a ResultSet that contains the data produced by the query; never null
      Throws:
      SQLException - thrown on failure.
    • executeUpdate

      public final int executeUpdate() 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 PreparedStatement
      Returns:
      either the row count for INSERT, UPDATE or DELETE; or 0 for SQL statements that return nothing
      Throws:
      SQLException - thrown on failure.
    • executeLargeUpdate

      public final long executeLargeUpdate() 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. For use with statements which may touch more than Integer.MAX_VALUE rows.
      Specified by:
      executeLargeUpdate in interface EnginePreparedStatement
      Specified by:
      executeLargeUpdate in interface PreparedStatement
      Throws:
      SQLException
    • setNull

      public void setNull(int parameterIndex, int sqlType) throws SQLException
      Set a parameter to SQL NULL.

      Note: You must specify the parameter's SQL type.

      Specified by:
      setNull in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      sqlType - SQL type code defined by java.sql.Types
      Throws:
      SQLException - thrown on failure.
    • setBoolean

      public void setBoolean(int parameterIndex, boolean x) throws SQLException
      Set a parameter to a Java boolean value. According to the JDBC API spec, the driver converts this to a SQL BIT value when it sends it to the database. But we don't have to do this, since the database engine supports a boolean type.
      Specified by:
      setBoolean in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
      Throws:
      SQLException - thrown on failure.
    • setByte

      public void setByte(int parameterIndex, byte x) throws SQLException
      Set a parameter to a Java byte value. The driver converts this to a SQL TINYINT value when it sends it to the database.
      Specified by:
      setByte in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
      Throws:
      SQLException - thrown on failure.
    • setShort

      public void setShort(int parameterIndex, short x) throws SQLException
      Set a parameter to a Java short value. The driver converts this to a SQL SMALLINT value when it sends it to the database.
      Specified by:
      setShort in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
      Throws:
      SQLException - thrown on failure.
    • setInt

      public void setInt(int parameterIndex, int x) throws SQLException
      Set a parameter to a Java int value. The driver converts this to a SQL INTEGER value when it sends it to the database.
      Specified by:
      setInt in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
      Throws:
      SQLException - thrown on failure.
    • setLong

      public void setLong(int parameterIndex, long x) throws SQLException
      Set a parameter to a Java long value. The driver converts this to a SQL BIGINT value when it sends it to the database.
      Specified by:
      setLong in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
      Throws:
      SQLException - thrown on failure.
    • setBigDecimal

      public final void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException
      Set a parameter to a java.lang.BigDecimal value. The driver converts this to a SQL NUMERIC value when it sends it to the database.
      Specified by:
      setBigDecimal in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
      Throws:
      SQLException - thrown on failure.
    • setFloat

      public void setFloat(int parameterIndex, float x) throws SQLException
      Set a parameter to a Java float value. The driver converts this to a SQL FLOAT value when it sends it to the database.
      Specified by:
      setFloat in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
      Throws:
      SQLException - thrown on failure.
    • setDouble

      public void setDouble(int parameterIndex, double x) throws SQLException
      Set a parameter to a Java double value. The driver converts this to a SQL DOUBLE value when it sends it to the database.
      Specified by:
      setDouble in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
      Throws:
      SQLException - thrown on failure.
    • setString

      public void setString(int parameterIndex, String x) throws SQLException
      Set a parameter to a Java String value. The driver converts this to a SQL VARCHAR or LONGVARCHAR value (depending on the arguments size relative to the driver's limits on VARCHARs) when it sends it to the database.
      Specified by:
      setString in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
      Throws:
      SQLException - thrown on failure.
    • setBytes

      public void setBytes(int parameterIndex, byte[] x) throws SQLException
      Set a parameter to a Java array of bytes. The driver converts this to a SQL VARBINARY or LONGVARBINARY (depending on the argument's size relative to the driver's limits on VARBINARYs) when it sends it to the database.
      Specified by:
      setBytes in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
      Throws:
      SQLException - thrown on failure.
    • setDate

      public void setDate(int parameterIndex, Date x) throws SQLException
      Set a parameter to a java.sql.Date value. The driver converts this to a SQL DATE value when it sends it to the database.
      Specified by:
      setDate in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
      Throws:
      SQLException - thrown on failure.
    • setTime

      public void setTime(int parameterIndex, Time x) throws SQLException
      Set a parameter to a java.sql.Time value. The driver converts this to a SQL TIME value when it sends it to the database.
      Specified by:
      setTime in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
      Throws:
      SQLException - thrown on failure.
    • setTimestamp

      public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException
      Set a parameter to a java.sql.Timestamp value. The driver converts this to a SQL TIMESTAMP value when it sends it to the database.
      Specified by:
      setTimestamp in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
      Throws:
      SQLException - thrown on failure.
    • setAsciiStream

      public final void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException
      We do this inefficiently and read it all in here. The target type is assumed to be a String.
      Specified by:
      setAsciiStream in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the java input stream which contains the ASCII parameter value
      length - the number of bytes in the stream
      Throws:
      SQLException - thrown on failure.
    • setAsciiStream

      public final void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException
      We do this inefficiently and read it all in here. The target type is assumed to be a String.
      Specified by:
      setAsciiStream in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the java input stream which contains the ASCII parameter value
      length - the number of bytes in the stream
      Throws:
      SQLException - thrown on failure.
    • setUnicodeStream

      public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException
      Deprecated.
      Deprecated in JDBC 3.0
      Specified by:
      setUnicodeStream in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the java input stream which contains the UNICODE parameter value
      length - the number of bytes in the stream
      Throws:
      SQLException - thrown on failure.
    • setCharacterStream

      public final void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException
      When a very large UNICODE value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.Reader. JDBC will read the data from the stream as needed, until it reaches end-of-file. The JDBC driver will do any necessary conversion from UNICODE to the database char format.

      Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.

      Specified by:
      setCharacterStream in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      reader - the java reader which contains the UNICODE data
      length - the number of characters in the stream
      Throws:
      SQLException - if a database-access error occurs.
    • setCharacterStream

      public final void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException
      When a very large UNICODE value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.Reader. JDBC will read the data from the stream as needed, until it reaches end-of-file. The JDBC driver will do any necessary conversion from UNICODE to the database char format.

      Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.

      Specified by:
      setCharacterStream in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      reader - the java reader which contains the UNICODE data
      length - the number of characters in the stream
      Throws:
      SQLException - if a database-access error occurs.
    • checkCharacterStreamConditions

      private final void checkCharacterStreamConditions(int parameterIndex) throws SQLException
      Check general preconditions for setCharacterStream methods.
      Parameters:
      parameterIndex - 1-based index of the parameter.
      Throws:
      SQLException
    • checkAsciiStreamConditions

      private final void checkAsciiStreamConditions(int parameterIndex) throws SQLException
      Check general preconditions for setAsciiStream methods.
      Parameters:
      parameterIndex - 1-based index of the parameter.
      Throws:
      SQLException
    • setCharacterStreamInternal

      private void setCharacterStreamInternal(int parameterIndex, Reader reader, boolean lengthLess, long length) throws SQLException
      Set the given character stream for the specified parameter. If lengthLess is true, the following conditions are either not checked or verified at the execution time of the prepared statement:
      1. If the stream length is negative.
      2. If the stream's actual length equals the specified length.
      The lengthLess variable was added to differentiate between streams with invalid lengths and streams without known lengths.
      Parameters:
      parameterIndex - the 1-based index of the parameter to set.
      reader - the data.
      lengthLess - tells whether we know the length of the data or not.
      length - the length of the data. Ignored if lengthLess is true.
      Throws:
      SQLException
    • usePreTenFiveHdrFormat

      private Boolean usePreTenFiveHdrFormat() throws StandardException
      Determines which header format to use for CLOBs when writing them to the store.
      Returns:
      true if the pre Derby 10.5 header format is to be used, false if the new header format can be used (10.5 or newer)
      Throws:
      StandardException - if obtaining the access mode fails
    • setBinaryStream

      public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException
      Sets the designated parameter to the given input stream. When a very large binary value is input to a LONGVARBINARY parameter, it may be more practical to send it via a java.io.InputStream object. The data will be read from the stream as needed until end-of-file is reached. Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
      Specified by:
      setBinaryStream in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the java input stream which contains the binary parameter value
      Throws:
      SQLException - if a database access error occurs or this method is called on a closed PreparedStatement
    • setBinaryStream

      public final void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException
      sets the parameter to the Binary stream
      Specified by:
      setBinaryStream in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the java input stream which contains the binary parameter value
      length - the number of bytes in the stream
      Throws:
      SQLException - thrown on failure.
    • setBinaryStream

      public final void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException
      sets the parameter to the binary stream
      Specified by:
      setBinaryStream in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the java input stream which contains the binary parameter value
      length - the number of bytes in the stream
      Throws:
      SQLException - thrown on failure.
    • setBinaryStreamInternal

      private void setBinaryStreamInternal(int parameterIndex, InputStream x, boolean lengthLess, long length) throws SQLException
      Set the given stream for the specified parameter. If lengthLess is true, the following conditions are either not checked or verified at the execution time of the prepared statement:
      1. If the stream length is negative.
      2. If the stream's actual length equals the specified length.
      The lengthLess variable was added to differentiate between streams with invalid lengths and streams without known lengths.
      Parameters:
      parameterIndex - the 1-based index of the parameter to set.
      x - the data.
      lengthLess - tells whether we know the length of the data or not.
      length - the length of the data. Ignored if lengthLess is true.
      Throws:
      SQLException
    • checkBinaryStreamConditions

      private final void checkBinaryStreamConditions(int parameterIndex) throws SQLException
      Check general preconditions for setBinaryStream methods.
      Parameters:
      parameterIndex - 1-based index of the parameter.
      Throws:
      SQLException
    • setNull

      public void setNull(int paramIndex, int sqlType, String typeName) throws SQLException
      JDBC 2.0 Sets the designated parameter to SQL NULL. This version of the method setNull should be used for user-defined types and REF type parameters. Examples of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and named array types.
      Specified by:
      setNull in interface PreparedStatement
      Parameters:
      paramIndex - the first parameter is 1, the second is 2, ...
      sqlType - a value from java.sql.Types
      typeName - the fully-qualified name of an SQL user-defined type; ignored if the parameter is not a user-defined type or REF
      Throws:
      SQLException - if a database access error occurs or this method is called on a closed PreparedStatement
      SQLFeatureNotSupportedException - if Derby does not support the type specified in the sqlType parameter
    • addBatch

      public void addBatch() throws SQLException
      JDBC 2.0 Add a set of parameters to the batch.
      Specified by:
      addBatch in interface PreparedStatement
      Throws:
      SQLException - if a database-access error occurs.
    • executeBatchElement

      boolean executeBatchElement(Object batchElement) throws SQLException, StandardException
      Description copied from class: EmbedStatement
      Execute a single element of the batch. Overridden by EmbedPreparedStatement
      Overrides:
      executeBatchElement in class EmbedStatement
      Throws:
      SQLException
      StandardException
    • clearParameters

      public 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 clearParameters.

      Specified by:
      clearParameters in interface PreparedStatement
      Throws:
      SQLException - thrown on failure.
    • getMetaData

      public ResultSetMetaData getMetaData() throws SQLException
      JDBC 2.0 The number, types and properties of a ResultSet's columns are provided by the getMetaData method.
      Specified by:
      getMetaData in interface PreparedStatement
      Returns:
      the description of a ResultSet's columns
      Throws:
      SQLException - Feature not implemented for now.
    • setRef

      public final void setRef(int i, Ref x) throws SQLException
      JDBC 2.0 Set a REF(<structured-type>) parameter.
      Specified by:
      setRef in interface PreparedStatement
      Parameters:
      i - the first parameter is 1, the second is 2, ...
      x - an object representing data of an SQL REF Type
      Throws:
      SQLException - Feature not implemented for now.
    • setArray

      public final void setArray(int i, Array x) throws SQLException
      JDBC 2.0 Set an Array parameter.
      Specified by:
      setArray in interface PreparedStatement
      Parameters:
      i - the first parameter is 1, the second is 2, ...
      x - an object representing an SQL array
      Throws:
      SQLException - Feature not implemented for now.
    • setObject

      public final void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException
      The interface says that the type of the Object parameter must be compatible with the type of the targetSqlType. We check that, and if it flies, we expect the underlying engine to do the required conversion once we pass in the value using its type. So, an Integer converting to a CHAR is done via setInteger() support on the underlying CHAR type.

      If x is null, it won't tell us its type, so we pass it on to setNull

      Specified by:
      setObject in interface PreparedStatement
      Parameters:
      parameterIndex - The first parameter is 1, the second is 2, ...
      x - The object containing the input parameter value
      targetSqlType - The SQL type (as defined in java.sql.Types) to be sent to the database. The scale argument may further qualify this type.
      scale - For java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types this is the number of digits after the decimal. For all other types this value will be ignored,
      Throws:
      SQLException - thrown on failure.
    • setObject

      public final void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException
      This method is like setObject above, but assumes a scale of zero.
      Specified by:
      setObject in interface PreparedStatement
      Throws:
      SQLException - thrown on failure.
    • setObject

      public final void setObject(int parameterIndex, Object x) throws SQLException

      Set the value of a parameter using an object; use the java.lang equivalent objects for integral values.

      The JDBC specification specifies a standard mapping from Java Object types to SQL types. The given argument java object will be converted to the corresponding SQL type before being sent to the database.

      Note that this method may be used to pass datatabase specific abstract data types, by using a Driver specific Java type.

      Specified by:
      setObject in interface PreparedStatement
      Parameters:
      parameterIndex - The first parameter is 1, the second is 2, ...
      x - The object containing the input parameter value
      Throws:
      SQLException - thrown on failure.
    • execute

      public final boolean execute() throws SQLException
      Specified by:
      execute in interface PreparedStatement
      Throws:
      SQLException - thrown on failure.
      See Also:
    • setDate

      public final void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException
      Set a parameter to a java.sql.Date value. The driver converts this to a SQL DATE value when it sends it to the database.
      Specified by:
      setDate in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
      Throws:
      SQLException - Feature not implemented for now.
    • setTime

      public final void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException
      Set a parameter to a java.sql.Time value. The driver converts this to a SQL TIME value when it sends it to the database.
      Specified by:
      setTime in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
      Throws:
      SQLException - Feature not implemented for now.
    • setTimestamp

      public final void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException
      Set a parameter to a java.sql.Timestamp value. The driver converts this to a SQL TIMESTAMP value when it sends it to the database.
      Specified by:
      setTimestamp in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the parameter value
      Throws:
      SQLException - Feature not implemented for now.
    • setBlob

      public void setBlob(int i, Blob x) throws SQLException
      JDBC 2.0 Set a BLOB parameter.
      Specified by:
      setBlob in interface PreparedStatement
      Parameters:
      i - the first parameter is 1, the second is 2, ...
      x - an object representing a BLOB
      Throws:
      SQLException
    • checkClobConditions

      private final void checkClobConditions(int parameterIndex) throws SQLException
      Check general (pre)conditions for setClob methods.
      Parameters:
      parameterIndex - 1-based index of the parameter.
      Throws:
      SQLException
    • setClob

      public void setClob(int i, Clob x) throws SQLException
      JDBC 2.0 Set a CLOB parameter.
      Specified by:
      setClob in interface PreparedStatement
      Parameters:
      i - the first parameter is 1, the second is 2, ...
      x - an object representing a CLOB
      Throws:
      SQLException
    • getParms

      public final ParameterValueSet getParms()
      Get the ParameterValueSet from the activation. The caller of this method should be aware that the activation associated with a Statement can change and hence the ParameterValueSet returned by this call should not be hold onto. An example of this can be seen in EmbedCallableStatement.executeStatement where at the beginning of the method, we check the validity of the parameters. But we donot keep the parameters in a local variable to use later. The reason for this is that the next call in the method, super.executeStatement can recompile the statement and create a new activation if the statement plan has been invalidated. To account for this possibility, EmbedCallableStatement.executeStatement makes another call to get the ParameterValueSet before stuffing the output parameter value into the ParameterValueSet object.
      Returns:
      The ParameterValueSet for the activation
    • getParameterJDBCType

      protected int getParameterJDBCType(int parameterIndex) throws SQLException
      Get the target JDBC type for a parameter. Will throw exceptions if the parameter index is out of range. The parameterIndex is 1-based.
      Throws:
      SQLException - parameter is out of range
    • getParameterSQLType

      protected final String getParameterSQLType(int parameterIndex) throws SQLException
      Return the SQL type name for the parameter.
      Parameters:
      parameterIndex - the 1-based index of the parameter
      Returns:
      SQL name of the parameter
      Throws:
      SQLException - if parameter is out of range
    • setScale

      private void setScale(int parameterIndex, int scale) throws SQLException
      Set the scale of a parameter.
      Parameters:
      parameterIndex - The first parameter is 1, the second is 2, ...
      scale - The scale
      Throws:
      SQLException - thrown on failure.
    • setURL

      public final void setURL(int parameterIndex, URL x) throws SQLException
      JDBC 3.0 Sets the designated parameter to the given java.net.URL value. The driver converts this to an SQL DATALINK value when it sends it to the database.
      Specified by:
      setURL in interface PreparedStatement
      Parameters:
      parameterIndex - - the first parameter is 1, the second is 2, ...
      x - - the java.net.URL object to be set
      Throws:
      SQLException - Feature not implemented for now.
    • getParameterMetaData

      public final ParameterMetaData getParameterMetaData() throws SQLException
      JDBC 3.0 Retrieves the number, types and properties of this PreparedStatement object's parameters.
      Specified by:
      getParameterMetaData in interface PreparedStatement
      Returns:
      a ParameterMetaData object that contains information about the number, types and properties of this PreparedStatement object's parameters.
      Throws:
      SQLException - if a database access error occurs
    • newEmbedResultSetMetaData

      protected EmbedResultSetMetaData newEmbedResultSetMetaData(ResultDescription resultDesc)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • transferParameters

      public void transferParameters(EmbedPreparedStatement newStatement) throws SQLException
      Throws:
      SQLException
    • executeStatement

      boolean executeStatement(Activation a, boolean executeQuery, boolean executeUpdate) throws SQLException
      Description copied from class: EmbedStatement
      Execute the current statement.
      Overrides:
      executeStatement in class EmbedStatement
      Throws:
      SQLException - thrown on failure.
    • dataTypeConversion

      final SQLException dataTypeConversion(int column, String sourceType) throws SQLException
      Throws:
      SQLException
    • setBrokeredConnectionControl

      public void setBrokeredConnectionControl(BrokeredConnectionControl control)
      This method is used to initialize the BrokeredConnectionControl variable with its implementation. This method will be called in the BrokeredConnectionControl class
      Parameters:
      control - used to call the onStatementClose and onStatementErrorOccurred methods that have logic to raise StatementEvents for the close and error events on the PreparedStatement
    • checkStatementValidity

      private void checkStatementValidity(SQLException sqle) throws SQLException
      Method calls onStatementError occurred on the BrokeredConnectionControl class after checking the SQLState of the SQLException thrown. In the case that a XAConnection is involved in the creation of this PreparedStatement for e.g in the following case XAConnection xaconn = xadatasource.getXAConnection();//where xadatasource is an object of XADataSource Connection conn = xaconnection.getConnection(); PreparedStatement ps = conn.preparedStatement("values 1"); In the above case the PreparedStatement will actually be a BrokeredPreparedStatement object. Hence when we call bcc.onStatementClose and pass the PreparedStatement that caused it applicationStatement will be the appropriate choice since it will contain the appropriate instance of PreparedStatement in each case
      Throws:
      SQLException
    • setAsciiStream

      public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException
      Sets the designated parameter to the given input stream. When a very large ASCII value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.InputStream. Data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from ASCII to the database char format. Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
      Specified by:
      setAsciiStream in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      x - the Java input stream that contains the ASCII parameter value
      Throws:
      SQLException - if a database access error occurs or this method is called on a closed PreparedStatement
    • setCharacterStream

      public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException
      Sets the designated parameter to the given Reader object. When a very large UNICODE value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.Reader object. The data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from UNICODE to the database char format. Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface. Using this lengthless overload is not less effective than using one where the stream length is specified, but since there is no length specified, the exact length check will not be performed.
      Specified by:
      setCharacterStream in interface PreparedStatement
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      reader - the java.io.Reader object that contains the Unicode data
      Throws:
      SQLException - if a database access error occurs or this method is called on a closed PreparedStatement
    • setClob

      public void setClob(int parameterIndex, Reader reader) throws SQLException
      Sets the designated parameter to a Reader object. This method differs from the setCharacterStream(int,Reader) method because it informs the driver that the parameter value should be sent to the server as a CLOB. When the setCharacterStream method is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as a LONGVARCHAR or a CLOB.
      Specified by:
      setClob in interface PreparedStatement
      Parameters:
      parameterIndex - index of the first parameter is 1, the second is 2, ...
      reader - an object that contains the data to set the parameter value to.
      Throws:
      SQLException - if a database access error occurs, this method is called on a closed PreparedStatementor if parameterIndex does not correspond to a parameter marker in the SQL statement
    • setClob

      public void setClob(int parameterIndex, Reader reader, long length) throws SQLException
      Sets the designated parameter to a Reader object.
      Specified by:
      setClob in interface PreparedStatement
      Parameters:
      parameterIndex - index of the first parameter is 1, the second is 2, ...
      reader - An object that contains the data to set the parameter value to.
      length - the number of characters in the parameter data.
      Throws:
      SQLException - if parameterIndex does not correspond to a parameter marker in the SQL statement, or if the length specified is less than zero.
    • setBlob

      public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException
      Sets the designated parameter to a InputStream object. This method differs from the setBinaryStream(int, InputStream) method because it informs the driver that the parameter value should be sent to the server as a BLOB. When the setBinaryStream method is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as a LONGVARBINARY or a BLOB
      Specified by:
      setBlob in interface PreparedStatement
      Parameters:
      parameterIndex - index of the first parameter is 1, the second is 2, ...
      inputStream - an object that contains the data to set the parameter value to.
      Throws:
      SQLException - if a database access error occurs, this method is called on a closed PreparedStatement or if parameterIndex does not correspond to a parameter marker in the SQL statement
    • setBlob

      public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException
      Sets the designated parameter to a InputStream object.
      Specified by:
      setBlob in interface PreparedStatement
      Parameters:
      parameterIndex - index of the first parameter is 1, the second is 2, ...
      inputStream - An object that contains the data to set the parameter value to.
      length - the number of bytes in the parameter data.
      Throws:
      SQLException - if parameterIndex does not correspond to a parameter marker in the SQL statement, if the length specified is less than zero or if the number of bytes in the inputstream does not match the specfied length.
    • checkBlobConditions

      private final void checkBlobConditions(int parameterIndex) throws SQLException
      Check general (pre)conditions for setBlob methods.
      Parameters:
      parameterIndex - 1-based index of the parameter.
      Throws:
      SQLException
    • setRowId

      public final void setRowId(int parameterIndex, RowId x) throws SQLException
      Specified by:
      setRowId in interface PreparedStatement
      Throws:
      SQLException
    • setNString

      public final void setNString(int index, String value) throws SQLException
      Specified by:
      setNString in interface PreparedStatement
      Throws:
      SQLException
    • setNCharacterStream

      public final void setNCharacterStream(int parameterIndex, Reader value) throws SQLException
      Specified by:
      setNCharacterStream in interface PreparedStatement
      Throws:
      SQLException
    • setNCharacterStream

      public final void setNCharacterStream(int index, Reader value, long length) throws SQLException
      Specified by:
      setNCharacterStream in interface PreparedStatement
      Throws:
      SQLException
    • setNClob

      public final void setNClob(int parameterIndex, Reader reader) throws SQLException
      Specified by:
      setNClob in interface PreparedStatement
      Throws:
      SQLException
    • setNClob

      public final void setNClob(int index, NClob value) throws SQLException
      Specified by:
      setNClob in interface PreparedStatement
      Throws:
      SQLException
    • setNClob

      public final void setNClob(int parameterIndex, Reader reader, long length) throws SQLException
      Specified by:
      setNClob in interface PreparedStatement
      Throws:
      SQLException
    • setSQLXML

      public final void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException
      Specified by:
      setSQLXML in interface PreparedStatement
      Throws:
      SQLException
    • getVersionCounter

      public final long getVersionCounter() throws SQLException
      Description copied from interface: EnginePreparedStatement
      Get the version of the prepared statement. If this has not been changed, the caller may assume that a recompilation has not taken place, i.e. meta-data are (also) unchanged.
      Specified by:
      getVersionCounter in interface EnginePreparedStatement
      Returns:
      version counter
      Throws:
      SQLException