public abstract class Statement extends Object implements Cloneable
| Modifier and Type | Field and Description |
|---|---|
protected ArrayList |
columns
array of ColumnRef
|
protected InputDesc |
inputDesc |
protected static ResourceBundle |
messages
I18N message handler
|
protected static int |
OP_BINOP_MASK |
protected static int |
OP_FUNC_MASK |
protected static int |
OP_INFIX_MASK |
protected static int |
OP_IRREGULAR_MASK |
protected static int |
OP_ORDERBY_MASK |
protected static int |
OP_OTHER_MASK |
protected static int |
OP_PARAM_MASK |
protected static int |
OP_PAREN_MASK |
protected static int |
OP_PCOUNT_MASK |
protected static int |
OP_POSTFIX_MASK |
protected static int |
OP_PREFIX_MASK |
protected static int |
OP_WHERE_MASK |
protected ArrayList |
secondaryTableStatements |
protected StringBuilder |
statementText |
ArrayList |
tableList
array of QueryTable
|
protected DBVendorType |
vendorType |
| Constructor and Description |
|---|
Statement(DBVendorType vendorType) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addColumnRef(ColumnRef columnRef) |
void |
addConstraint(LocalFieldDesc lf,
Object value)
Adds a comparison on local field
lf and value value. |
void |
addQueryTable(QueryTable table) |
void |
addSecondaryTableStatement(Statement s) |
protected void |
appendQuotedText(StringBuilder buffer,
String text)
Append
text surrounded by quote char to buffer |
void |
appendTableText(StringBuilder text,
QueryTable table) |
void |
bindInputValues(DBStatement s)
Binds input valus corrsponding to this
Statement object to
database statement s. |
Object |
clone() |
protected QueryTable |
findQueryTable(org.netbeans.modules.dbschema.TableElement tableElement)
Matches the table element
tableElement to the
corresponding query table from the list tableList. |
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.
|
protected void |
generateColumnText(LocalFieldDesc desc,
QueryPlan thePlan,
StringBuilder sb)
Generates the column text for field
desc. |
protected void |
generateInputValueForConstraintValueNode(ConstraintValue node)
Generates InputValue for
node. |
protected abstract void |
generateStatementText()
Generates the SQL text for the query described by this object.
|
int |
getAction() |
protected ColumnRef |
getColumnRef(org.netbeans.modules.dbschema.ColumnElement columnElement) |
ArrayList |
getColumnRefs() |
String |
getFormattedSQLText()
Gets formatted sql text corrsponding to this statement object.
|
protected QueryPlan |
getOriginalPlan(ConstraintField fieldNode) |
abstract QueryPlan |
getQueryPlan()
Get QueryPlan for this statement
|
ArrayList |
getQueryTables() |
ArrayList |
getSecondaryTableStatements() |
String |
getText()
Returns the SQL text for the query described by this object.
|
DBVendorType |
getVendorType() |
protected String |
getWhereText(List stack)
Constructs the where clause for the statement from
the constraint stack.
|
protected String |
infixOperator(int operation,
int position) |
protected int |
operationFormat(int operation) |
protected String |
postfixOperator(int operation) |
protected String |
prefixOperator(int operation) |
protected void |
processConstraintParamIndex(ConstraintParamIndex node,
StringBuilder result) |
StringBuilder |
processConstraints()
Processes the constraint stack and adds it to the query.
|
protected void |
processConstraintValue(ConstraintValue node,
StringBuilder result) |
protected void |
processIrregularOperation(ConstraintOperation opNode,
int opCode,
List stack,
StringBuilder result) |
protected void |
processRootConstraint(ConstraintOperation opNode,
List stack,
StringBuilder whereText) |
void |
setAction(int action) |
protected static final int OP_PREFIX_MASK
protected static final int OP_INFIX_MASK
protected static final int OP_POSTFIX_MASK
protected static final int OP_PAREN_MASK
protected static final int OP_ORDERBY_MASK
protected static final int OP_WHERE_MASK
protected static final int OP_IRREGULAR_MASK
protected static final int OP_OTHER_MASK
protected static final int OP_PARAM_MASK
protected static final int OP_BINOP_MASK
protected static final int OP_FUNC_MASK
protected static final int OP_PCOUNT_MASK
protected StringBuilder statementText
protected ArrayList columns
protected InputDesc inputDesc
public ArrayList tableList
protected DBVendorType vendorType
protected ArrayList secondaryTableStatements
protected static final ResourceBundle messages
public Statement(DBVendorType vendorType)
public void addQueryTable(QueryTable table)
protected ColumnRef getColumnRef(org.netbeans.modules.dbschema.ColumnElement columnElement)
protected void addColumnRef(ColumnRef columnRef)
public void addConstraint(LocalFieldDesc lf, Object value)
lf and value value.public DBVendorType getVendorType()
public void appendTableText(StringBuilder text, QueryTable table)
protected void appendQuotedText(StringBuilder buffer, String text)
text surrounded by quote char to bufferbuffer - The given buffertext - The given textpublic String getText()
protected abstract void generateStatementText()
public StringBuilder processConstraints()
protected void processRootConstraint(ConstraintOperation opNode, List stack, StringBuilder whereText)
public abstract QueryPlan getQueryPlan()
protected String getWhereText(List stack)
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).protected void processConstraintParamIndex(ConstraintParamIndex node, StringBuilder result)
protected void processConstraintValue(ConstraintValue node, StringBuilder result)
protected QueryPlan getOriginalPlan(ConstraintField fieldNode)
protected void generateColumnText(LocalFieldDesc desc, QueryPlan thePlan, StringBuilder sb)
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.desc - Local field descriptor to be included in the constraint text.thePlan - Query plan corresponding to desc.sb - String buffer taking the resulting text.protected QueryTable findQueryTable(org.netbeans.modules.dbschema.TableElement tableElement)
tableElement to the
corresponding query table from the list tableList.tableElement - Table element to be found.QueryPlan.findQueryTable(TableElement)protected void processIrregularOperation(ConstraintOperation opNode, int opCode, List stack, StringBuilder result)
protected void generateInputValueForConstraintValueNode(ConstraintValue node)
node.node - The input node.protected String infixOperator(int operation, int position)
protected int operationFormat(int operation)
protected String postfixOperator(int operation)
protected String prefixOperator(int operation)
public void addSecondaryTableStatement(Statement s)
public ArrayList getSecondaryTableStatements()
public ArrayList getQueryTables()
public ArrayList getColumnRefs()
public void setAction(int action)
public int getAction()
public void bindInputValues(DBStatement s) throws SQLException
Statement object to
database statement s.s - The database statementSQLExceptionpublic String getFormattedSQLText()
protected static String formatSqlText(String sqlText, Object[] input)
sqlText - Specifies the text of the SQL statement to be executed.input - Holds the input values used for the SQL statement.Copyright © 2019. All rights reserved.