01: /*
02: * Copyright (c) 1998 - 2005 Versant Corporation
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Versant Corporation - initial API and implementation
10: */
11: package com.versant.core.jdbc.sql.exp;
12:
13: import com.versant.core.util.CharBuf;
14: import com.versant.core.jdbc.sql.SqlDriver;
15:
16: /**
17: * COUNT(*).
18: */
19: public class AggregateCountStarExp extends SqlExp {
20:
21: private String expAlias;
22:
23: public AggregateCountStarExp(String expAlias) {
24: if (expAlias != null && expAlias.length() > 0) {
25: this .expAlias = expAlias;
26: }
27: }
28:
29: /**
30: * Append SQL for this node to s.
31: *
32: * @param driver The driver being used
33: * @param s Append the SQL here
34: * @param leftSibling
35: */
36: public void appendSQLImp(SqlDriver driver, CharBuf s,
37: SqlExp leftSibling) {
38: s.append("COUNT(*)");
39: if (expAlias != null) {
40: s.append(driver.getAliasPrepend());
41: s.append(" " + expAlias + " ");
42: }
43: }
44:
45: }
|