|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.empire.commons.ErrorObject
org.apache.empire.db.DBObject
org.apache.empire.db.DBExpr
org.apache.empire.db.DBCommandExpr
public abstract class DBCommandExpr
This abstract class handles the creation of the SQL-Commands. There are inner classes to construct different SQL-Commands.
Nested Class Summary | |
---|---|
protected static class |
DBCommandExpr.DBCmdColumn
This class wrapps a column of sql command in a special command column object. |
protected static class |
DBCommandExpr.DBCmdQuery
|
Nested classes/interfaces inherited from class org.apache.empire.commons.ErrorObject |
---|
ErrorObject.ObjectErrorInfo |
Field Summary | |
---|---|
protected DBCommandExpr.DBCmdQuery |
cmdQuery
|
protected java.util.List<DBOrderByExpr> |
orderBy
|
Fields inherited from class org.apache.empire.db.DBExpr |
---|
CTX_ALIAS, CTX_ALL, CTX_DEFAULT, CTX_FULLNAME, CTX_NAME, CTX_NOPARENTHESES, CTX_VALUE, log |
Constructor Summary | |
---|---|
DBCommandExpr()
Constructs an empty DBCommandExpr object |
Method Summary | |
---|---|
protected void |
addListExpr(java.lang.StringBuilder buf,
java.util.List<? extends DBExpr> list,
long context,
java.lang.String separator)
Internally used to build a string from a list of database expressions |
void |
addSQL(java.lang.StringBuilder buf,
long context)
Creates the SQL-Command. |
void |
clearOrderBy()
Clears the list of order by expressions. |
protected DBColumnExpr |
getCmdColumn(DBColumnExpr col)
returns column expression that is specific for to this command and detached from its source. |
java.lang.String |
getInsertInto(DBTable table)
Create the insert into SQL-Command which copies data from a select statement to a destination table. |
protected java.lang.String |
getInsertInto(DBTable table,
DBColumnExpr[] select,
java.util.List<DBColumnExpr> columns)
Create the insert into SQL-Command which copies data from a select statement to a destination table. |
java.lang.String |
getInsertInto(DBTable table,
java.util.List<DBColumnExpr> columns)
Create the insert into SQL-Command which copies data from a select statement to a destination table. |
abstract java.lang.Object[] |
getParamValues()
returns an array holding all parameter values in the order of their occurrence. |
java.lang.String |
getSelect()
returns an SQL select command for querying records. |
abstract boolean |
getSelect(java.lang.StringBuilder buf)
|
abstract DBColumnExpr[] |
getSelectExprList()
|
DBCommandExpr |
intersect(DBCommandExpr other)
Constructs a new DBCombinedCmd object with this object, the key word= "INTERSECT" and the selected DBCommandExpr. |
abstract boolean |
isValid()
|
void |
orderBy(DBColumnExpr... exprs)
Adds a list of columns to the orderBy clause in ascending order |
void |
orderBy(DBColumnExpr expr,
boolean desc)
Adds an order by with ascending or descending order |
void |
orderBy(DBOrderByExpr... exprs)
Adds an order by expression the command |
DBCommandExpr |
union(DBCommandExpr other)
Constructs a new DBCombinedCmd object with this object, the key word= "UNION" and the selected DBCommandExpr. |
Methods inherited from class org.apache.empire.db.DBExpr |
---|
addReferencedColumns, getObjectValue, getValueClass |
Methods inherited from class org.apache.empire.db.DBObject |
---|
error, error, getDatabase |
Methods inherited from class org.apache.empire.commons.ErrorObject |
---|
clearError, clearErrorInfo, error, error, error, error, error, getErrorInfo, getErrorMessage, getErrorParams, getErrorSource, getErrorType, getMessage, hasError, internalSetError, isExceptionsEnabled, setExceptionsEnabled, success |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected DBCommandExpr.DBCmdQuery cmdQuery
protected java.util.List<DBOrderByExpr> orderBy
Constructor Detail |
---|
public DBCommandExpr()
Method Detail |
---|
public abstract boolean isValid()
public abstract boolean getSelect(java.lang.StringBuilder buf)
public abstract DBColumnExpr[] getSelectExprList()
public abstract java.lang.Object[] getParamValues()
protected DBColumnExpr getCmdColumn(DBColumnExpr col)
public java.lang.String getSelect()
protected void addListExpr(java.lang.StringBuilder buf, java.util.List<? extends DBExpr> list, long context, java.lang.String separator)
buf
- the sql target bufferlist
- list of database objectscontext
- the sql command contextseparator
- string to use as separator between list itemspublic void addSQL(java.lang.StringBuilder buf, long context)
addSQL
in class DBExpr
buf
- the SQL-Commandcontext
- the current SQL-Command contextpublic DBCommandExpr union(DBCommandExpr other)
other
- the secend DBCommandExpr
DBCombinedCmd
public DBCommandExpr intersect(DBCommandExpr other)
other
- the second DBCommandExpr
public void clearOrderBy()
public void orderBy(DBOrderByExpr... exprs)
exprs
- vararg of orderBy expressionsorderBy(DBColumnExpr, boolean)
public final void orderBy(DBColumnExpr... exprs)
exprs
- vararg of column expressionspublic final void orderBy(DBColumnExpr expr, boolean desc)
expr
- the DBColumnExpr objectdesc
- if true, the results from select statement will sort top downprotected java.lang.String getInsertInto(DBTable table, DBColumnExpr[] select, java.util.List<DBColumnExpr> columns)
public final java.lang.String getInsertInto(DBTable table, java.util.List<DBColumnExpr> columns)
table
- the tablecolumns
- the columns
public final java.lang.String getInsertInto(DBTable table)
table
- the table
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |