|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eigenbase.sql.SqlNode
org.eigenbase.sql.SqlCall
public class SqlCall
A SqlCall is a call to an operator.
(Operators can be used to describe any syntactic construct, so in practice,
every non-leaf node in a SQL parse tree is a SqlCall of some
kind.)
| Field Summary | |
|---|---|
private boolean |
expanded
|
private SqlLiteral |
functionQuantifier
|
SqlNode[] |
operands
|
private SqlOperator |
operator
|
| Fields inherited from class org.eigenbase.sql.SqlNode |
|---|
emptyArray |
| Constructor Summary | |
|---|---|
|
SqlCall(SqlOperator operator,
SqlNode[] operands,
SqlParserPos pos)
|
protected |
SqlCall(SqlOperator operator,
SqlNode[] operands,
SqlParserPos pos,
boolean expanded,
SqlLiteral functionQualifier)
|
| Method Summary | ||
|---|---|---|
|
accept(SqlVisitor<R> visitor)
Accepts a generic visitor. |
|
SqlNode |
clone(SqlParserPos pos)
Clones a SqlNode with a different position. |
|
boolean |
equalsDeep(SqlNode node,
boolean fail)
Returns whether this node is structurally equivalent to another node. |
|
void |
findValidOptions(SqlValidator validator,
SqlValidatorScope scope,
SqlParserPos pos,
List<SqlMoniker> hintList)
Lists all the valid alternatives for this node if the parse position of the node matches that of pos. |
|
protected String |
getCallSignature(SqlValidator validator,
SqlValidatorScope scope)
Returns a string describing the actual argument types of a call, e.g. |
|
SqlLiteral |
getFunctionQuantifier()
|
|
SqlKind |
getKind()
Returns the type of node this is, or SqlKind.Other if it's nothing special. |
|
SqlMonotonicity |
getMonotonicity(SqlValidatorScope scope)
Returns whether expression is always ascending, descending or constant. |
|
SqlNode[] |
getOperands()
|
|
SqlOperator |
getOperator()
|
|
boolean |
isA(SqlKind kind)
Returns whether this node is a particular kind. |
|
boolean |
isCountStar()
Test to see if it is the function COUNT(*) |
|
boolean |
isExpanded()
Whether this call was created by expanding a parentheses-free call to what was syntactically an identifier. |
|
boolean |
isName(String name)
Tests whether operator name matches supplied value. |
|
void |
setOperand(int i,
SqlNode operand)
|
|
void |
setOperator(SqlOperator operator)
|
|
void |
unparse(SqlWriter writer,
int leftPrec,
int rightPrec)
Writes a SQL representation of this node to a writer. |
|
void |
validate(SqlValidator validator,
SqlValidatorScope scope)
Validates this call. |
|
| Methods inherited from class org.eigenbase.sql.SqlNode |
|---|
clone, cloneArray, equalDeep, getParserPosition, toSqlString, toSqlString, toString, validateExpr |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private SqlOperator operator
public final SqlNode[] operands
private final SqlLiteral functionQuantifier
private final boolean expanded
| Constructor Detail |
|---|
public SqlCall(SqlOperator operator,
SqlNode[] operands,
SqlParserPos pos)
protected SqlCall(SqlOperator operator,
SqlNode[] operands,
SqlParserPos pos,
boolean expanded,
SqlLiteral functionQualifier)
| Method Detail |
|---|
public boolean isA(SqlKind kind)
SqlNode
isA in class SqlNodekind - a SqlKind valuepublic SqlKind getKind()
SqlNodeSqlKind.Other if it's nothing special.
getKind in class SqlNodeSqlKind value, never nullpublic boolean isExpanded()
public void setOperand(int i,
SqlNode operand)
public void setOperator(SqlOperator operator)
public SqlOperator getOperator()
public SqlNode[] getOperands()
public SqlNode clone(SqlParserPos pos)
SqlNode
clone in class SqlNode
public void unparse(SqlWriter writer,
int leftPrec,
int rightPrec)
SqlNodeThe leftPrec and rightPrec parameters give
us enough context to decide whether we need to enclose the expression in
parentheses. For example, we need parentheses around "2 + 3" if preceded
by "5 *". This is because the precedence of the "*" operator is greater
than the precedence of the "+" operator.
The algorithm handles left- and right-associative operators by giving them slightly different left- and right-precedence.
If SqlWriter.isAlwaysUseParentheses() is true, we use
parentheses even when they are not required by the precedence rules.
For the details of this algorithm, see unparse(org.eigenbase.sql.SqlWriter, int, int).
unparse in class SqlNodewriter - Target writerleftPrec - The precedence of the SqlNode immediately
preceding this node in a depth-first scan of the parse treerightPrec - The precedence of the SqlNode immediately
public void validate(SqlValidator validator,
SqlValidatorScope scope)
The default implementation delegates the validation to the operator's
SqlOperator.validateCall(org.eigenbase.sql.SqlCall, org.eigenbase.sql.validate.SqlValidator, org.eigenbase.sql.validate.SqlValidatorScope, org.eigenbase.sql.validate.SqlValidatorScope). Derived classes may override (as do,
for example SqlSelect and SqlUpdate).
validate in class SqlNodescope - Validator
public void findValidOptions(SqlValidator validator,
SqlValidatorScope scope,
SqlParserPos pos,
List<SqlMoniker> hintList)
SqlNode
findValidOptions in class SqlNodevalidator - Validatorscope - Validation scopepos - SqlParserPos indicating the cursor position at which competion
hints are requested forhintList - list of valid optionspublic <R> R accept(SqlVisitor<R> visitor)
SqlNodeImplementations of this method in subtypes simply call the appropriate
visit method on the visitor object.
The type parameter R must be consistent with the type
parameter of the visitor.
accept in class SqlNode
public boolean equalsDeep(SqlNode node,
boolean fail)
SqlNode
equalsDeep in class SqlNode
protected String getCallSignature(SqlValidator validator,
SqlValidatorScope scope)
public SqlMonotonicity getMonotonicity(SqlValidatorScope scope)
SqlNodeThe default implementation returns SqlMonotonicity.NotMonotonic.
getMonotonicity in class SqlNodepublic boolean isName(String name)
name - Test string
public boolean isCountStar()
public SqlLiteral getFunctionQuantifier()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||