Class DBStatement


  • public class DBStatement
    extends Object
    • Field Detail

      • BATCH_THRESHOLD_PROPERTY

        public static final String BATCH_THRESHOLD_PROPERTY
        Name of the batch threshold property.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DBStatement

        public DBStatement​(Connection conn,
                           String statementText,
                           int timeout)
                    throws SQLException
        This constructor is used for batched updates.
        Parameters:
        conn - the connection
        statementText - the statement text
        timeout - the query timeout
        Throws:
        SQLException
    • Method Detail

      • getStatementText

        public String getStatementText()
        Returns the SQL text.
      • getPreparedStatement

        public PreparedStatement getPreparedStatement()
        Returns the wrapped PreparedStatement.
      • exceedsBatchThreshold

        public boolean exceedsBatchThreshold()
        Checks whether the current number of batched commands exceeds the batch threshold defined by BATCH_THRESHOLD.
      • addBatch

        public void addBatch()
                      throws SQLException
        Increases the batch counter and delegates the addBatch call to the PreparedStatement wrapped by this DBStatement.
        Throws:
        SQLException
      • executeBatch

        public int[] executeBatch()
                           throws SQLException
        Delegates the executeBatch call to the PreparedStatement wrapped by this DBStatement and resets the batch counter.
        Throws:
        SQLException
      • executeUpdate

        public int executeUpdate()
                          throws SQLException
        Delegates the executeUpdate call to the PreparedStatement wrapped by this DBStatement.
        Throws:
        SQLException
      • executeQuery

        public ResultSet executeQuery()
                               throws SQLException
        Delegates the executeQuery call to the PreparedStatement wrapped by this DBStatement.
        Throws:
        SQLException
      • close

        public void close()
                   throws SQLException
        Delegates the close call to the PreparedStatement wrapped by this DBStatement.
        Throws:
        SQLException
      • bindInputColumn

        public void bindInputColumn​(int index,
                                    Object val,
                                    org.netbeans.modules.dbschema.ColumnElement columnElement,
                                    DBVendorType vendorType)
                             throws SQLException
        Binds the specified value to the column corresponding with the specified index reference.
        Parameters:
        index - the index
        val - the value
        columnElement - the columnElement corresponding to the parameter marker at specified index. This parameter will always contain correct value when called for sql statements corresponding to insert and update For select statements this parameter can be null if query compiler is not able to detect java field for a parameter or value passed to the query. Please see RetrieveDescImpl#addValueConstraint for more information
        vendorType - the vendor type
        Throws:
        SQLException - thrown by setter methods on java.sql.PreparedStatement
        See Also:
        RetrieveDescImpl.addValueConstraint(java.lang.String, java.lang.Object)