de.unidu.is.sql
Class SQL

java.lang.Object
  extended byde.unidu.is.sql.SQL

public class SQL
extends java.lang.Object

A class for storing abstract SQL "select" and "insert into" statements.

Since:
2003-10-08
Version:
$Revision: 1.5 $, $Date: 2005/03/14 17:33:14 $
Author:
Henrik Nottelmann

Field Summary
protected  java.util.List from
          A list of table names, or of strings of the form {tablename} {alias}.
protected  java.util.List group
          A list of group by expressions.
protected  java.lang.String insertTable
          The name of the table where values have to be inserted.
protected  boolean isDistinct
          A flag specifying if a distinct clause has to be used in the select part.
protected  int limit
          A maximum number of documents to be selected, or zero if there is no limit part.
protected  java.util.List order
          A list of columns specifiying the order of the rows.
protected  boolean orderDesc
          A flag specifying if the order is ascending (flag is false) or descending (flag is true).
protected  java.util.List select
          A list of expressions, forming the select part.
protected  java.util.List where
          A list of expressions, forming the where part.
 
Constructor Summary
SQL()
           
 
Method Summary
 java.util.List getFrom()
          Returns the from list.
 java.util.List getGroup()
          Returns the group list.
 java.lang.String getInsertTable()
          Returns the name of the name in which the selected data should be inserted into.
 int getLimit()
          Returns the maximum number of documents to retrieve.
 java.util.List getOrder()
          Returns the order list.
 java.util.List getSelect()
          Returns the list of select expression.
 java.util.List getWhere()
          Returns the list of where expressions.
 boolean isDistinct()
          Returns whether the rows have to be distinct.
 boolean isOrderDesc()
          Returns whether the order is descening, if ther is an order part.
 void setDistinct(boolean flag)
          Sets whether the rows have to be distinct.
 void setFrom(java.util.List list)
          Sets the from list.
 void setGroup(java.util.List list)
          Sets the group list
 void setInsertTable(java.lang.String name)
          Sets the name of the name in which the selected data should be inserted into.
 void setLimit(int limit)
          Sets the maximum number of documents to retrieve.
 void setOrder(java.util.List list)
          Sets the order list
 void setOrder(java.util.List list, boolean orderDesc)
          Sets the order list and if it is descending or ascending.
 void setOrderDesc(boolean b)
          Sets if it is descending or ascending.
 void setSelect(java.util.List list)
          Sets the list of select expressions.
 void setWhere(java.util.List list)
          Sets the list of where expressions.
 java.lang.String toString()
          Returns a textual description of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

insertTable

protected java.lang.String insertTable
The name of the table where values have to be inserted.


select

protected java.util.List select
A list of expressions, forming the select part.


from

protected java.util.List from
A list of table names, or of strings of the form {tablename} {alias}.


where

protected java.util.List where
A list of expressions, forming the where part.


group

protected java.util.List group
A list of group by expressions.


limit

protected int limit
A maximum number of documents to be selected, or zero if there is no limit part.


order

protected java.util.List order
A list of columns specifiying the order of the rows.


orderDesc

protected boolean orderDesc
A flag specifying if the order is ascending (flag is false) or descending (flag is true).


isDistinct

protected boolean isDistinct
A flag specifying if a distinct clause has to be used in the select part.

Constructor Detail

SQL

public SQL()
Method Detail

getInsertTable

public java.lang.String getInsertTable()
Returns the name of the name in which the selected data should be inserted into.

Returns:
table name

setInsertTable

public void setInsertTable(java.lang.String name)
Sets the name of the name in which the selected data should be inserted into.

Parameters:
name - table name

getSelect

public java.util.List getSelect()
Returns the list of select expression.

Returns:
list of select expressions

setSelect

public void setSelect(java.util.List list)
Sets the list of select expressions.

Parameters:
list - list of select expressions

isDistinct

public boolean isDistinct()
Returns whether the rows have to be distinct.

Returns:
true iff the rows have to be distinct

setDistinct

public void setDistinct(boolean flag)
Sets whether the rows have to be distinct.

Parameters:
flag - return true iff the rows have to be distinct

getFrom

public java.util.List getFrom()
Returns the from list.

Returns:
from list

setFrom

public void setFrom(java.util.List list)
Sets the from list.

Parameters:
list - from list

getWhere

public java.util.List getWhere()
Returns the list of where expressions.

Returns:
list of where expressions

setWhere

public void setWhere(java.util.List list)
Sets the list of where expressions.

Parameters:
list - list of where expressions

getGroup

public java.util.List getGroup()
Returns the group list.

Returns:
group list

setGroup

public void setGroup(java.util.List list)
Sets the group list

Parameters:
list - group list

getLimit

public int getLimit()
Returns the maximum number of documents to retrieve.

Returns:
maximum number of documents to retrieve, or zero if no limit is given

setLimit

public void setLimit(int limit)
Sets the maximum number of documents to retrieve.

Parameters:
limit - maximum number of documents to retrieve

getOrder

public java.util.List getOrder()
Returns the order list.

Returns:
order list

isOrderDesc

public boolean isOrderDesc()
Returns whether the order is descening, if ther is an order part.

Returns:
true iff the order is descening

setOrder

public void setOrder(java.util.List list)
Sets the order list

Parameters:
list - order list

setOrder

public void setOrder(java.util.List list,
                     boolean orderDesc)
Sets the order list and if it is descending or ascending.

Parameters:
list - order list
orderDesc - if true, then the order is descending

setOrderDesc

public void setOrderDesc(boolean b)
Sets if it is descending or ascending.

Parameters:
b - if true, then the order is descending

toString

public java.lang.String toString()
Returns a textual description of this object.

Returns:
textual description of this object