KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > jdbc > sql > exp > AggregateCountStarExp


1
2 /*
3  * Copyright (c) 1998 - 2005 Versant Corporation
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  * Versant Corporation - initial API and implementation
11  */

12 package com.versant.core.jdbc.sql.exp;
13
14 import com.versant.core.util.CharBuf;
15 import com.versant.core.jdbc.sql.SqlDriver;
16
17 /**
18  * COUNT(*).
19  */

20 public class AggregateCountStarExp extends SqlExp {
21
22     private String JavaDoc expAlias;
23
24     public AggregateCountStarExp(String JavaDoc expAlias) {
25         if (expAlias != null && expAlias.length() > 0) {
26             this.expAlias = expAlias;
27         }
28     }
29
30     /**
31      * Append SQL for this node to s.
32      *
33      * @param driver The driver being used
34      * @param s Append the SQL here
35      * @param leftSibling
36      */

37     public void appendSQLImp(SqlDriver driver, CharBuf s, SqlExp leftSibling) {
38         s.append("COUNT(*)");
39         if (expAlias != null) {
40             s.append(driver.getAliasPrepend());
41             s.append(" " + expAlias + " ");
42         }
43     }
44
45 }
46
Popular Tags