| java.lang.Object com.versant.core.jdbc.sql.exp.SqlExp
All known Subclasses: com.versant.core.jdbc.sql.exp.InExp, com.versant.core.jdbc.sql.exp.MultiplyExp, com.versant.core.jdbc.sql.exp.GroupByThisExp, com.versant.core.jdbc.sql.exp.AndExp, com.versant.core.jdbc.sql.exp.AggregateCountStarExp, com.versant.core.jdbc.sql.exp.InlineSqlExp, com.versant.core.jdbc.sql.exp.BetweenExp, com.versant.core.jdbc.sql.exp.UnaryExp, com.versant.core.jdbc.sql.exp.OrExp, com.versant.core.jdbc.sql.exp.AddExp, com.versant.core.jdbc.sql.exp.LeafExp, com.versant.core.jdbc.sql.exp.BinaryExp,
SqlExp | public class SqlExp (Code) | | An expression in an SQL query.
|
Field Summary | |
final public static int | NO Do not convert this expression into a join. | final public static int | YES Convert into a join. | final public static int | YES_DISTINCT Convert into a join and select distinct. | final public static int | YES_DISTINCT_NOT Convert into an outer join with is null check and select distinct. | public SqlExp | childList Linked list of children formed using their next fields. | public SqlExp | next This makes it easy to form linked lists of expressions. |
Method Summary | |
public void | append(SqlExp extra) Add a list of expressions to the end of our childList. | final public void | appendSQL(SqlDriver driver, CharBuf s, SqlExp leftSibling) Append SQL for this node to s. | protected void | appendSQLImp(SqlDriver driver, CharBuf s, SqlExp leftSibling) Append SQL for this node to s. | public static SqlExp | appendWithAnd(SqlExp base, SqlExp e) Append e to base using an AndExp. | public int | createAlias(int index) Create an aliases for any subtables we may have. | public static SqlExp | createBinaryOpExp(SqlExp left, int op, SqlExp right) Create an expression comparing the left and right exp with an
operator. | public static SqlExp | createClone(SqlExp sqlExp) Use this to clone a SqlExp tree. | public static SqlExp | createClone(SqlExp inst, Map cloneMap) This is a util method that decides if a instance should be cloned. | public SqlExp | createInstance() | public void | dump(String indent) Dump debugging info to System.out. | public void | dumpList(String indent) Dump us and our list to System.out. | public int | getClassIndex() | public SqlExp | getClone(SqlExp clone, Map cloneMap) Clone the current instance. | public int | getConvertToJoin() | public int | getFirstCharIndex() Get the index of first character of the 'is null' parameter
replacement span for this expression. | public int | getJavaTypeCode() | public int | getJdbcType() | final public int | getLastCharIndex() Get the index of the character after the last character of the
'is null' parameter replacement span for this expression. | final public int | getPreFirstCharIndex() Get the index of first character of the this expression in the output
buffer. | public SelectExp | getSingleSelectExp(SelectExp exclude) If this expression involves a single table (other than exclude) only
then return the SelectExp for the table (e.g. | public boolean | isNegative() | public SqlExp | normalize(SqlDriver driver, SelectExp sel, boolean convertExists) Normalize this node i.e. | public void | replaceSelectExpRef(SelectExp old, SelectExp nw) Replace any references to old with nw. | public boolean | requiresParensInAnd() | public boolean | requiresParensInMultiply() | public void | setOuter(boolean on) Make us an outer join or not. | public String | toString() |
NO | final public static int NO(Code) | | Do not convert this expression into a join. *
|
YES | final public static int YES(Code) | | Convert into a join. *
|
YES_DISTINCT | final public static int YES_DISTINCT(Code) | | Convert into a join and select distinct. *
|
YES_DISTINCT_NOT | final public static int YES_DISTINCT_NOT(Code) | | Convert into an outer join with is null check and select distinct. *
|
childList | public SqlExp childList(Code) | | Linked list of children formed using their next fields.
|
next | public SqlExp next(Code) | | This makes it easy to form linked lists of expressions. This is
faster and uses less memory than arrays of expressions.
|
append | public void append(SqlExp extra)(Code) | | Add a list of expressions to the end of our childList.
|
appendSQL | final public void appendSQL(SqlDriver driver, CharBuf s, SqlExp leftSibling)(Code) | | Append SQL for this node to s.
Parameters: driver - The driver being used Parameters: s - Append the SQL here Parameters: leftSibling - The SqlExp to the left of us or null if none |
appendSQLImp | protected void appendSQLImp(SqlDriver driver, CharBuf s, SqlExp leftSibling)(Code) | | Append SQL for this node to s. This is the method that subclasses
should override.
Parameters: driver - The driver being used Parameters: s - Append the SQL here Parameters: leftSibling - The SqlExp to the left of us or null if none |
appendWithAnd | public static SqlExp appendWithAnd(SqlExp base, SqlExp e)(Code) | | Append e to base using an AndExp. If base is already an AndExp then
e is simply appended. If base is null then e becomes base. Otherwise
base becomes a a new AndExp created from the old base and e.
New value for base |
createAlias | public int createAlias(int index)(Code) | | Create an aliases for any subtables we may have.
|
createBinaryOpExp | public static SqlExp createBinaryOpExp(SqlExp left, int op, SqlExp right)(Code) | | Create an expression comparing the left and right exp with an
operator. Only == and != really make sense. If left and right are
lists then comparing matching exp's joined together in an 'and'
list.
|
createClone | public static SqlExp createClone(SqlExp sqlExp)(Code) | | Use this to clone a SqlExp tree.
Parameters: sqlExp - |
createClone | public static SqlExp createClone(SqlExp inst, Map cloneMap)(Code) | | This is a util method that decides if a instance should be cloned. If the
instance was already cloned then the already cloned instance is returned.
Parameters: inst - Parameters: cloneMap - A cloned instance. |
dump | public void dump(String indent)(Code) | | Dump debugging info to System.out.
|
dumpList | public void dumpList(String indent)(Code) | | Dump us and our list to System.out.
|
getClassIndex | public int getClassIndex()(Code) | | What is the class index for this expression (-1 if unknown)?
See Also: ParamNode |
getClone | public SqlExp getClone(SqlExp clone, Map cloneMap)(Code) | | Clone the current instance. This method is called by subclassed to create a clone of its
superclass.
Parameters: clone - The instance it must set the cloned values on. Parameters: cloneMap - This map is used to avoid creating multiple clones for a singel instance. The update SqlExp |
getFirstCharIndex | public int getFirstCharIndex()(Code) | | Get the index of first character of the 'is null' parameter
replacement span for this expression.
|
getJavaTypeCode | public int getJavaTypeCode()(Code) | | What is the java type code of this expression (0 if unknown)?
|
getJdbcType | public int getJdbcType()(Code) | | What is the JDBC type of this expression (0 if unknown)?
|
getLastCharIndex | final public int getLastCharIndex()(Code) | | Get the index of the character after the last character of the
'is null' parameter replacement span for this expression.
|
getPreFirstCharIndex | final public int getPreFirstCharIndex()(Code) | | Get the index of first character of the this expression in the output
buffer. This is used when the whole expression needs to be replaced.
|
getSingleSelectExp | public SelectExp getSingleSelectExp(SelectExp exclude)(Code) | | If this expression involves a single table (other than exclude) only
then return the SelectExp for the table (e.g. a.col1 == 10 returns a,
a.col1 = b.col2 returns null, a.col1 = b.col2 with exclude = b returns
a). This is used to detect expressions that can be moved
into the ON list for the join to the table involved.
|
isNegative | public boolean isNegative()(Code) | | Is this a negative expression for the purposes of replacing parameter
values with 'is null' (false) or 'is not null' (true)?
|
normalize | public SqlExp normalize(SqlDriver driver, SelectExp sel, boolean convertExists)(Code) | | Normalize this node i.e. transform it into its simplist possible form.
This will turn sub selects into joins and so on. Return expression to
replace us with or null if no change.
|
replaceSelectExpRef | public void replaceSelectExpRef(SelectExp old, SelectExp nw)(Code) | | Replace any references to old with nw. This is used when redundant
joins are removed.
|
requiresParensInAnd | public boolean requiresParensInAnd()(Code) | | If this expression is added to an AndExp should it be enclosed in
parenthesis?
|
requiresParensInMultiply | public boolean requiresParensInMultiply()(Code) | | If this expression is added to an MultiplyExp should it be enclosed in
parenthesis?
|
setOuter | public void setOuter(boolean on)(Code) | | Make us an outer join or not. This is a NOP except for JoinExp and
AndJoinExp.
See Also: JoinExp See Also: AndJoinExp |
|
|