Class SelectStatement
- java.lang.Object
-
- com.sun.jdo.spi.persistence.support.sqlstore.sql.generator.Statement
-
- com.sun.jdo.spi.persistence.support.sqlstore.sql.generator.SelectStatement
-
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
SelectOneStatement
public class SelectStatement extends Statement
This class generates select statements.
-
-
Field Summary
-
Fields inherited from class com.sun.jdo.spi.persistence.support.sqlstore.sql.generator.Statement
columns, inputDesc, messages, OP_BINOP_MASK, OP_FUNC_MASK, OP_INFIX_MASK, OP_IRREGULAR_MASK, OP_ORDERBY_MASK, OP_OTHER_MASK, OP_PARAM_MASK, OP_PAREN_MASK, OP_PCOUNT_MASK, OP_POSTFIX_MASK, OP_PREFIX_MASK, OP_WHERE_MASK, secondaryTableStatements, statementText, tableList, vendorType
-
-
Constructor Summary
Constructors Constructor Description SelectStatement(DBVendorType vendorType, SelectQueryPlan plan)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ColumnRefaddColumn(org.netbeans.modules.dbschema.ColumnElement columnElement, QueryTable queryTable)voidappendTableText(StringBuilder text, QueryTable table)voidbindInputValues(DBStatement s, ValueFetcher parameters)Binds input valus corrsponding to thisStatementobject to database statement s.voidcopyColumns(SelectStatement sourceStatement)protected StringBuildergenerateColumnText()protected voidgenerateStatementText()Generates the SQL text for the query described by this object.StringgetFormattedSQLText(ValueFetcher parameters)Gets formatted sql text corrsponding to this statement object.protected StringgetJoinOperator(int operation)Returns join operator for specified operation.QueryPlangetQueryPlan()Get QueryPlan for this statementbooleanisColumnTypeDefinitionNeeded()Determines if Column Type definition is needed for this statement.booleanisJoined()protected booleanisUpdateLockRequired(QueryTable table)voidmarkJoined()protected voidprocessIrregularOperation(ConstraintOperation opNode, int opCode, List stack, StringBuilder result)protected voidprocessRootConstraint(ConstraintOperation opNode, List stack, StringBuilder whereText)Processes Order By constraints and calls the super class method for all other constrains.-
Methods inherited from class com.sun.jdo.spi.persistence.support.sqlstore.sql.generator.Statement
addColumnRef, addConstraint, addQueryTable, addSecondaryTableStatement, appendQuotedText, bindInputValues, clone, findQueryTable, formatSqlText, generateColumnText, generateInputValueForConstraintValueNode, getAction, getColumnRef, getColumnRefs, getFormattedSQLText, getOriginalPlan, getQueryTables, getSecondaryTableStatements, getText, getVendorType, getWhereText, infixOperator, operationFormat, postfixOperator, prefixOperator, processConstraintParamIndex, processConstraints, processConstraintValue, setAction
-
-
-
-
Constructor Detail
-
SelectStatement
public SelectStatement(DBVendorType vendorType, SelectQueryPlan plan)
-
-
Method Detail
-
isJoined
public boolean isJoined()
-
markJoined
public void markJoined()
-
addColumn
public ColumnRef addColumn(org.netbeans.modules.dbschema.ColumnElement columnElement, QueryTable queryTable)
-
copyColumns
public void copyColumns(SelectStatement sourceStatement)
-
isUpdateLockRequired
protected boolean isUpdateLockRequired(QueryTable table)
-
appendTableText
public void appendTableText(StringBuilder text, QueryTable table)
- Overrides:
appendTableTextin classStatement
-
isColumnTypeDefinitionNeeded
public boolean isColumnTypeDefinitionNeeded()
Determines if Column Type definition is needed for this statement. Column Type definition is a performance optimization that allows defining Column Type for the resultset. If the query to be executed is counting pc instances, the column used inside COUNT() is one of the pk columns. If the pk column happens to be not convertable to an int (for example timestamp), database will throw an exception. To prevent this situation, column type definition should not be performed on such queries.- Returns:
- true if column type definition is needed, false otherwise.
-
getQueryPlan
public QueryPlan getQueryPlan()
Description copied from class:StatementGet QueryPlan for this statement- Specified by:
getQueryPlanin classStatement- Returns:
- QueryPlan for this statement
-
generateStatementText
protected void generateStatementText()
Description copied from class:StatementGenerates the SQL text for the query described by this object.- Specified by:
generateStatementTextin classStatement
-
generateColumnText
protected StringBuilder generateColumnText()
-
processRootConstraint
protected void processRootConstraint(ConstraintOperation opNode, List stack, StringBuilder whereText)
Processes Order By constraints and calls the super class method for all other constrains.- Overrides:
processRootConstraintin classStatement
-
processIrregularOperation
protected void processIrregularOperation(ConstraintOperation opNode, int opCode, List stack, StringBuilder result)
- Overrides:
processIrregularOperationin classStatement
-
getJoinOperator
protected String getJoinOperator(int operation)
Returns join operator for specified operation.- Parameters:
operation- The join operation. Should be one of ActionDesc.OP_EQUIJOIN, ActionDesc.OP_LEFTJOIN or ActionDesc.OP_RIGHTJOIN.- Returns:
- join operator for specified operation.
-
bindInputValues
public void bindInputValues(DBStatement s, ValueFetcher parameters) throws SQLException
Binds input valus corrsponding to thisStatementobject to database statement s.- Parameters:
s- The database statement.parameters- If an InputValue to be bound is a parameter, the actual value is contained in this.- Throws:
SQLException
-
getFormattedSQLText
public String getFormattedSQLText(ValueFetcher parameters)
Gets formatted sql text corrsponding to this statement object. The text also contains values for input to the statement.- Parameters:
parameters- The input paramters to this statement.- Returns:
- formatted sql text corrsponding to this statement object.
-
-