001: /*
002: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com> and
003: * JR Boyens <gnu-jrb[remove] at gmx dot net>
004: * Distributed under the terms of either:
005: * - the common development and distribution license (CDDL), v1.0; or
006: * - the GNU Lesser General Public License, v2.1 or later
007: * $Id: CountQuery.java 3634 2007-01-08 21:42:24Z gbevin $
008: */
009: package com.uwyn.rife.database.querymanagers.generic;
010:
011: import com.uwyn.rife.database.capabilities.Capabilities;
012: import com.uwyn.rife.database.queries.AbstractWhereDelegateQuery;
013: import com.uwyn.rife.database.queries.QueryParameters;
014: import com.uwyn.rife.database.queries.ReadQuery;
015: import com.uwyn.rife.database.queries.Select;
016:
017: public class CountQuery extends
018: AbstractWhereDelegateQuery<CountQuery, Select> implements
019: ReadQuery, Cloneable {
020: private Select mDelegatePristine = null;
021:
022: public String toString() {
023: return getSql();
024: }
025:
026: public CountQuery clone() {
027: return new CountQuery(mDelegate.clone());
028: }
029:
030: public CountQuery(Select query) {
031: super (query.clone());
032: mDelegatePristine = query.clone();
033: }
034:
035: public void clear() {
036: mDelegate = mDelegatePristine.clone();
037: }
038:
039: public String getFrom() {
040: return mDelegate.getFrom();
041: }
042:
043: public QueryParameters getParameters() {
044: return mDelegate.getParameters();
045: }
046:
047: public String getSql() {
048: return mDelegate.getSql();
049: }
050:
051: public Capabilities getCapabilities() {
052: return mDelegate.getCapabilities();
053: }
054:
055: public void setExcludeUnsupportedCapabilities(boolean flag) {
056: mDelegate.setExcludeUnsupportedCapabilities(flag);
057: }
058:
059: public CountQuery join(String table) {
060: mDelegate.join(table);
061:
062: return this ;
063: }
064:
065: public CountQuery joinCross(String table) {
066: mDelegate.joinCross(table);
067:
068: return this ;
069: }
070:
071: public CountQuery joinCustom(String customJoin) {
072: mDelegate.joinCustom(customJoin);
073:
074: return this ;
075: }
076:
077: public CountQuery joinInner(String table,
078: Select.JoinCondition condition, String conditionExpression) {
079: mDelegate.joinInner(table, condition, conditionExpression);
080:
081: return this ;
082: }
083:
084: public CountQuery joinOuter(String table, Select.JoinType type,
085: Select.JoinCondition condition, String conditionExpression) {
086: mDelegate
087: .joinOuter(table, type, condition, conditionExpression);
088:
089: return this ;
090: }
091:
092: public CountQuery union(Select union) {
093: mDelegate.union(union);
094:
095: return this ;
096: }
097:
098: public CountQuery union(String union) {
099: mDelegate.union(union);
100:
101: return this ;
102: }
103:
104: public Select getDelegate() {
105: return mDelegate;
106: }
107: }
|