|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.sql.SqlNode org.eigenbase.sql.SqlDynamicParam
public class SqlDynamicParam
A SqlDynamicParam
represents a dynamic parameter marker in an
SQL statement. The textual order in which dynamic parameters appear within an
SQL statement is the only property which distinguishes them, so this 0-based
index is recorded as soon as the parameter is encountered.
Field Summary | |
---|---|
private int |
index
|
Fields inherited from class org.eigenbase.sql.SqlNode |
---|
emptyArray |
Constructor Summary | |
---|---|
SqlDynamicParam(int index,
SqlParserPos pos)
|
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. |
|
int |
getIndex()
|
|
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. |
|
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 node. |
Methods inherited from class org.eigenbase.sql.SqlNode |
---|
clone, cloneArray, equalDeep, findValidOptions, getParserPosition, isA, toSqlString, toSqlString, toString, validateExpr |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final int index
Constructor Detail |
---|
public SqlDynamicParam(int index, SqlParserPos pos)
Method Detail |
---|
public SqlNode clone(SqlParserPos pos)
SqlNode
clone
in class SqlNode
public SqlKind getKind()
SqlNode
SqlKind.Other
if it's nothing special.
getKind
in class SqlNode
SqlKind
value, never nullpublic int getIndex()
public void unparse(SqlWriter writer, int leftPrec, int rightPrec)
SqlNode
The 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 SqlCall.unparse(org.eigenbase.sql.SqlWriter, int, int)
.
unparse
in class SqlNode
writer
- 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
immediatelypublic void validate(SqlValidator validator, SqlValidatorScope scope)
SqlNode
The typical implementation of this method will make a callback to the
validator appropriate to the node type and context. The validator has
methods such as SqlValidator.validateLiteral(org.eigenbase.sql.SqlLiteral)
for these purposes.
validate
in class SqlNode
scope
- Validatorpublic SqlMonotonicity getMonotonicity(SqlValidatorScope scope)
SqlNode
The default implementation returns SqlMonotonicity.NotMonotonic
.
getMonotonicity
in class SqlNode
public <R> R accept(SqlVisitor<R> visitor)
SqlNode
Implementations 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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |