public class SelectCommand extends SQLCommand implements ResultsEstimatePlugin
SELECT [DISTINCT] column[,...] FROM table [INNER JOIN inner_join] [CROSS JOIN cross_join] [LEFT [OUTER] JOIN left_join] [WHERE criteria] [ROW_IS row_is_id] [GROUP BY group_by_column[,...]] [ORDER BY order] [ARCHIVE archive_dt] [TRANSACTION [BEFORE] trans_id]Usage
/* Will fetch the fields from person */ SELECT oi_shipping,avg(oi_value), max(oi_units) FROM Order_Items GROUP BY oi_shipping; /* Will fetch all fields from person */ SELECT * FROM Person /* Will fetch all files in a folder called 'web' */ SELECT name, size FROM DBFile WHERE folderId.name like 'web%' /* Will fetch all fields for a particular person */ SELECT * FROM Person ROW_IS 92934234423THREAD MODE: SINGLE THREADED command
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COL_CLASS_GID
Column type Class GID
|
static java.lang.String |
COL_CLASS_NAME
Column type Class name
|
static java.lang.String |
COL_GLOBAL_KEY
Column type Global Key
|
static java.lang.String |
COL_ROW_UID
Column type Row UID
|
static java.lang.String |
COL_XML_DATA
Column type XML data
|
static java.lang.String |
KEY_WORD_DISTINCT
create a distinct set of values
|
static java.lang.String |
KEY_WORD_GROUP
group the result by a set of columns
|
static java.lang.String |
PARAM_DISPLAY
The PARAMETER DISPLAY
|
static java.lang.String |
VARIABLE_CRITERIA
the criteria variable
|
static java.lang.String |
VARIABLE_ROW_IS
the ROW_IS variable
|
CURSOR_SIZE
Constructor and Description |
---|
SelectCommand(Connection connection,
Pattern pattern)
std.
|
Modifier and Type | Method and Description |
---|---|
static void |
disableHint(boolean flag)
disable the hint logic
|
protected void |
execute(Parser p)
execute the command.
|
java.lang.String |
getColumnName(int col)
the column name
|
java.lang.String |
getColumnType(int col)
Gets the column type for the given column index, starting at one
|
long |
getEstimatedRecordCount()
The estimate record count
|
java.lang.String |
getRecordID(int row)
the record ID
|
java.lang.Object |
getValue(int row,
int col)
the value for this row, column
|
boolean |
hasFunctionAndNoGroupBy()
Return whether the command contains function but no group by
|
static java.lang.String |
parseCondition(java.lang.String condition,
java.util.HashMap<java.lang.String,java.lang.String> alias)
parse the condition
|
static java.lang.String |
parseCrossJoin(VirtualDB layer,
java.lang.String table,
java.lang.String join,
java.lang.String conditions,
java.util.HashMap<java.lang.String,java.lang.String> alias)
Note: the below is actually a left join
parse the cross join
|
static void |
parseJoin(boolean leftJoin,
DBClassConcrete baseClass,
java.lang.String join,
java.util.HashMap alias)
parse the join
|
appendResult, appendResult, getCursorName, getRecordKey, isExecuteOnly
execute, extMakeThreadName, getConnection, getPattern, getRawTitle, getTitle, makeThreadName, recordCall, setTitle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRawTitle
public static final java.lang.String PARAM_DISPLAY
public static final java.lang.String COL_ROW_UID
public static final java.lang.String COL_GLOBAL_KEY
public static final java.lang.String COL_CLASS_GID
public static final java.lang.String COL_CLASS_NAME
public static final java.lang.String COL_XML_DATA
public static final java.lang.String KEY_WORD_GROUP
public static final java.lang.String KEY_WORD_DISTINCT
public static final java.lang.String VARIABLE_CRITERIA
public static final java.lang.String VARIABLE_ROW_IS
public SelectCommand(Connection connection, Pattern pattern)
connection
- the connectionpattern
- the patternpublic static void disableHint(boolean flag)
flag
- true to disable.protected void execute(@Nonnull Parser p) throws java.lang.Exception
public static void parseJoin(boolean leftJoin, DBClassConcrete baseClass, java.lang.String join, java.util.HashMap alias) throws java.sql.SQLException
tags tag2_ on this_.tag_id=tag2_.id left outer join wcm_content children2_ on this_.id=children2_.parent_id\http://en.wikipedia.org/wiki/Join_(SQL)#Inner_join
leftJoin
- is left joinbaseClass
- The base classjoin
- the conditionalias
- the aliasjava.sql.SQLException
- can't handle more than simple links.public static java.lang.String parseCrossJoin(VirtualDB layer, java.lang.String table, java.lang.String join, java.lang.String conditions, java.util.HashMap<java.lang.String,java.lang.String> alias) throws java.lang.Exception
SELECT id FROM wcm_content wcmblogent0_ cross join wcm_status wcmstatus1_ WHERE wcmblogent0_.class='org.weceem.blog.WcmBlogEntry' AND wcmblogent0_.status_id=wcmstatus1_.id AND wcmblogent0_.parent_id=1 AND wcmstatus1_.public_content=1http://en.wikipedia.org/wiki/Join_(SQL)#Cross_join
layer
- the layertable
- the base classjoin
- the conditionconditions
- the conditionsalias
- the aliasjava.lang.Exception
- can't handle more than simple links.public static java.lang.String parseCondition(@Nonnull java.lang.String condition, java.util.HashMap<java.lang.String,java.lang.String> alias)
condition
- the conditionalias
- the aliaspublic boolean hasFunctionAndNoGroupBy()
public java.lang.String getColumnName(int col)
getColumnName
in interface CommandBuildResultsPlugin
col
- the columnpublic java.lang.String getColumnType(int col) throws java.lang.Exception
getColumnType
in interface CommandBuildResultsPlugin
col
- the column indexjava.lang.Exception
- a serious problempublic java.lang.String getRecordID(int row)
getRecordID
in interface CommandBuildResultsPlugin
row
- the row indexpublic java.lang.Object getValue(int row, int col) throws java.lang.Exception
getValue
in interface CommandBuildResultsPlugin
row
- the row indexcol
- the columnjava.lang.Exception
- a serious problempublic long getEstimatedRecordCount()
ResultsEstimatePlugin
getEstimatedRecordCount
in interface ResultsEstimatePlugin
stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.