01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: AbstractQuery.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.database.queries;
09:
10: import com.uwyn.rife.database.Datasource;
11:
12: abstract class AbstractQuery implements Query, Cloneable {
13: protected Datasource mDatasource = null;
14: protected String mSql = null;
15: protected boolean mExcludeUnsupportedCapabilities = false;
16:
17: private AbstractQuery() {
18: }
19:
20: protected AbstractQuery(Datasource datasource) {
21: assert datasource != null;
22:
23: mDatasource = datasource;
24: }
25:
26: public Datasource getDatasource() {
27: return mDatasource;
28: }
29:
30: public QueryParameters getParameters() {
31: return null;
32: }
33:
34: public void setExcludeUnsupportedCapabilities(boolean flag) {
35: mExcludeUnsupportedCapabilities = flag;
36: }
37:
38: public void clear() {
39: mSql = null;
40: }
41:
42: protected void clearGenerated() {
43: mSql = null;
44: }
45:
46: public String toString() {
47: return getSql();
48: }
49:
50: public AbstractQuery clone() {
51: AbstractQuery new_instance = null;
52: try {
53: new_instance = (AbstractQuery) super .clone();
54: } catch (CloneNotSupportedException e) {
55: new_instance = null;
56: }
57:
58: return new_instance;
59: }
60: }
|