Class Statement

    • Constructor Detail

    • Method Detail

      • addQueryTable

        public void addQueryTable​(QueryTable table)
      • getColumnRef

        protected ColumnRef getColumnRef​(org.netbeans.modules.dbschema.ColumnElement columnElement)
      • addColumnRef

        protected void addColumnRef​(ColumnRef columnRef)
      • addConstraint

        public void addConstraint​(LocalFieldDesc lf,
                                  Object value)
        Adds a comparison on local field lf and value value.
      • appendQuotedText

        protected void appendQuotedText​(StringBuilder buffer,
                                        String text)
        Append text surrounded by quote char to buffer
        Parameters:
        buffer - The given buffer
        text - The given text
      • getText

        public String getText()
        Returns the SQL text for the query described by this object.
        Returns:
        The text of the SQL query described by this object.
      • generateStatementText

        protected abstract void generateStatementText()
        Generates the SQL text for the query described by this object.
      • processConstraints

        public StringBuilder processConstraints()
        Processes the constraint stack and adds it to the query. This means turning the constraint stack into SQL text and adding it to the where clause.
        Returns:
        Where clause based on the constraint stack.
      • getQueryPlan

        public abstract QueryPlan getQueryPlan()
        Get QueryPlan for this statement
        Returns:
        QueryPlan for this statement
      • getWhereText

        protected String getWhereText​(List stack)
        Constructs the where clause for the statement from the constraint stack.
        Parameters:
        stack - The stack parameter holds the constraint stack to be decoded. RESOLVE: We don't support constraints on multiple statements yet. We would need to sort constraints out by statement and do something about constraints that span statements (e.g. t1.c1 = t2.c2).
      • generateColumnText

        protected void generateColumnText​(LocalFieldDesc desc,
                                          QueryPlan thePlan,
                                          StringBuilder sb)
        Generates the column text for field desc. The column has to be associated to the corresponding query table from the list tableList. For fields mapped to multiple columns choose one column to be included, as all mapped columns should have the same value.
        Parameters:
        desc - Local field descriptor to be included in the constraint text.
        thePlan - Query plan corresponding to desc.
        sb - String buffer taking the resulting text.
      • findQueryTable

        protected QueryTable findQueryTable​(org.netbeans.modules.dbschema.TableElement tableElement)
        Matches the table element tableElement to the corresponding query table from the list tableList.
        Parameters:
        tableElement - Table element to be found.
        Returns:
        Query table object corresponding to table element.
        See Also:
        QueryPlan.findQueryTable(TableElement)
      • generateInputValueForConstraintValueNode

        protected void generateInputValueForConstraintValueNode​(ConstraintValue node)
        Generates InputValue for node.
        Parameters:
        node - The input node.
      • infixOperator

        protected String infixOperator​(int operation,
                                       int position)
      • operationFormat

        protected int operationFormat​(int operation)
      • postfixOperator

        protected String postfixOperator​(int operation)
      • prefixOperator

        protected String prefixOperator​(int operation)
      • addSecondaryTableStatement

        public void addSecondaryTableStatement​(Statement s)
      • getSecondaryTableStatements

        public ArrayList getSecondaryTableStatements()
      • getQueryTables

        public ArrayList getQueryTables()
      • getColumnRefs

        public ArrayList getColumnRefs()
      • setAction

        public void setAction​(int action)
      • getAction

        public int getAction()
      • bindInputValues

        public void bindInputValues​(DBStatement s)
                             throws SQLException
        Binds input valus corrsponding to this Statement object to database statement s.
        Parameters:
        s - The database statement
        Throws:
        SQLException
      • getFormattedSQLText

        public String getFormattedSQLText()
        Gets formatted sql text corrsponding to this statement object. The text also contains values for input to the statement.
        Returns:
        formatted sql text corrsponding to this statement object.
      • formatSqlText

        protected static String formatSqlText​(String sqlText,
                                              Object[] input)
        The formatSqlText method returns a string containing the text of the SQL statement about to be executed and the input values for the placeholders.
        Parameters:
        sqlText - Specifies the text of the SQL statement to be executed.
        input - Holds the input values used for the SQL statement.
        Returns:
        The SQL text and the input values formatted into a printable string.