org.d2rq.db.expr
Class SQLExpression

java.lang.Object
  extended by org.d2rq.db.expr.Expression
      extended by org.d2rq.db.expr.SQLExpression

public class SQLExpression
extends Expression

An Expression defined directly by a raw SQL string. The SQL may be just a constant expression, or it may be an alternating list of literal parts an column parts, in which case the actual SQL expression is formed by concatenating all parts, renaming the columns if necessary.

Author:
Richard Cyganiak (richard@cyganiak.de)

Field Summary
 
Fields inherited from class org.d2rq.db.expr.Expression
FALSE, TRUE
 
Method Summary
static SQLExpression create(List<String> literalParts, List<ColumnName> columns, DataType.GenericType dataType)
          Creates a SQL expression that may contain column references.
static Expression create(String sql, DataType.GenericType dataType)
          Only usable for expressions that don't mention any columns
 boolean equals(Object other)
           
 Set<ColumnName> getColumns()
           
 DataType getDataType(DatabaseOp table, Vendor vendor)
           
 int hashCode()
           
 boolean isFalse()
           
 boolean isTrue()
           
 Expression rename(Renamer renamer)
           
 String toSQL(DatabaseOp table, Vendor vendor)
           
 String toString()
           
 
Methods inherited from class org.d2rq.db.expr.Expression
and, or
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static Expression create(String sql,
                                DataType.GenericType dataType)
Only usable for expressions that don't mention any columns


create

public static SQLExpression create(List<String> literalParts,
                                   List<ColumnName> columns,
                                   DataType.GenericType dataType)
Creates a SQL expression that may contain column references. The actual SQL expression is obtained by alternating a literal part with a column part. There must be one more literal parts than column parts.


isTrue

public boolean isTrue()
Specified by:
isTrue in class Expression

isFalse

public boolean isFalse()
Specified by:
isFalse in class Expression

getColumns

public Set<ColumnName> getColumns()
Specified by:
getColumns in class Expression

rename

public Expression rename(Renamer renamer)
Specified by:
rename in class Expression

toSQL

public String toSQL(DatabaseOp table,
                    Vendor vendor)
Specified by:
toSQL in class Expression

getDataType

public DataType getDataType(DatabaseOp table,
                            Vendor vendor)
Specified by:
getDataType in class Expression

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object