KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > tests > jfun > parsec > mssql > Select


1 /*
2  * Created on 2004-11-16
3  *
4  * Author Ben Yu
5  */

6 package tests.jfun.parsec.mssql;
7
8 /**
9  * @author Ben Yu
10  *
11  * 2004-11-16
12  */

13 public final class Select {
14   private final SelectExpr[] select;
15   private final Relation[] from;
16   private final BoolExpression where;
17   private final GroupBy groupby;
18   private final OrderExpr[] orderby;
19   public String JavaDoc toString(){
20     final StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
21     buf.append("select ")
22     .append(ShowUtils.showList(select, ","));
23     if(from!=null)
24       buf.append(" from ").append(ShowUtils.showList(from, ","));
25     if(where != null)
26       buf.append(" where ").append(where);
27     if(groupby != null)
28       buf.append(" ").append(groupby);
29     if(orderby != null)
30       buf.append(" order by ").append(ShowUtils.showList(orderby, ","));
31     return buf.toString();
32   }
33   /**
34    * @param select
35    * @param from
36    * @param where
37    * @param groupby
38    * @param having
39    * @param orderby
40    */

41   Select(final SelectExpr[] select, final Relation[] from,
42       final BoolExpression where, final GroupBy groupby,
43       final OrderExpr[] orderby) {
44     this.select = select;
45     this.from = from;
46     this.where = where;
47     this.groupby = groupby;
48     this.orderby = orderby;
49   }
50   /**
51    * @return Returns the groupby.
52    */

53   public GroupBy getGroupby() {
54     return groupby;
55   }
56
57   /**
58    * @return Returns the orderby.
59    */

60   public OrderExpr[] getOrderby() {
61     return orderby;
62   }
63   /**
64    * @return Returns the select.
65    */

66   public SelectExpr[] getSelect() {
67     return select;
68   }
69   /**
70    * @return Returns the where.
71    */

72   public BoolExpression getWhere() {
73     return where;
74   }
75 }
76
Popular Tags