org.gibello.zql
Class ZSelectItem

java.lang.Object
  extended by org.gibello.zql.ZAliasedName
      extended by org.gibello.zql.ZSelectItem
All Implemented Interfaces:
java.io.Serializable

public class ZSelectItem
extends ZAliasedName

ZSelectItem: an item in the SELECT part of an SQL query. (The SELECT part of a query is a Vector of ZSelectItem).

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.gibello.zql.ZAliasedName
FORM_COLUMN, FORM_TABLE
 
Constructor Summary
ZSelectItem()
          Create a new SELECT item
ZSelectItem(java.lang.String fullname)
          Create a new SELECT item, given its name (for column names and wildcards).
 
Method Summary
 java.lang.String getAggregate()
          If this item is an aggregate function, return the function name.
 ZExp getExpression()
           
 boolean isExpression()
           
 void setAggregate(java.lang.String a)
          Initialize an aggregate function on this item (generally SUM, AVG, MAX, MIN) Example: SELECT AVG(age) FROM people; -> The aggregate function is AVG.
 void setExpression(ZExp e)
          Initialize this SELECT item as an SQL expression (not a column name nor wildcard) Example: SELECT a+b FROM table1; (a+b is an expression)
 
Methods inherited from class org.gibello.zql.ZAliasedName
getAlias, getColumn, getSchema, getTable, isWildcard, setAlias, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ZSelectItem

public ZSelectItem()
Create a new SELECT item


ZSelectItem

public ZSelectItem(java.lang.String fullname)
Create a new SELECT item, given its name (for column names and wildcards).

Parameters:
fullname - A string that represents a column name or wildcard (example: a.*).
Method Detail

getExpression

public ZExp getExpression()
Returns:
An SQL Expression if this SELECT item is an expression, a ZConstant if it is a column name, null if it is a wildcard

setExpression

public void setExpression(ZExp e)
Initialize this SELECT item as an SQL expression (not a column name nor wildcard) Example: SELECT a+b FROM table1; (a+b is an expression)


isExpression

public boolean isExpression()
Returns:
true if this item is an SQL expression, false if not. (Example: SELECT a+b, c FROM num; -> a+b is an expression, not c)

setAggregate

public void setAggregate(java.lang.String a)
Initialize an aggregate function on this item (generally SUM, AVG, MAX, MIN) Example: SELECT AVG(age) FROM people; -> The aggregate function is AVG.

Parameters:
a - The name of the aggregate function (a String, like SUM, AVG, MAX, MIN)

getAggregate

public java.lang.String getAggregate()
If this item is an aggregate function, return the function name.

Returns:
The name of an aggregate function (generally SUM, AVG, MAX, MIN), or null if there's no aggregate. Example: SELECT name, AVG(age) FROM people; -> null for the "name" item, and "AVG" for the "AVG(age)" item.