3 karl 1.4 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
11 chuck 1.2 //
12 // Permission is hereby granted, free of charge, to any person obtaining a copy
13 // of this software and associated documentation files (the "Software"), to
14 // deal in the Software without restriction, including without limitation the
15 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
16 // sell copies of the Software, and to permit persons to whom the Software is
17 // furnished to do so, subject to the following conditions:
18 //
19 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
20 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
21 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
22 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
23 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
25 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28 //==============================================================================
29 //
30 // Authors: David Rosckes (rosckes@us.ibm.com)
31 // Bert Rivero (hurivero@us.ibm.com)
32 chuck 1.2 // Chuck Carmack (carmack@us.ibm.com)
33 // Brian Lucier (lucier@us.ibm.com)
34 //
35 // Modified By:
36 //
37 //%/////////////////////////////////////////////////////////////////////////////
38
39 #include "CQLSelectStatement.h"
40 #include "CQLSelectStatementRep.h"
41 #include <Pegasus/Common/InternalException.h>
42
43 PEGASUS_NAMESPACE_BEGIN
44
45 CQLSelectStatement::CQLSelectStatement()
46 :SelectStatement()
47 {
48 _rep = new CQLSelectStatementRep();
49
50 // Set the _rep into the base class also
51 SelectStatement::_rep = _rep;
52 }
53 chuck 1.2
54 CQLSelectStatement::CQLSelectStatement(String& inQlang, String& inQuery, QueryContext& inCtx)
55 :SelectStatement()
56 {
57 _rep = new CQLSelectStatementRep(inQlang,inQuery,inCtx);
58
59 // Set the _rep into the base class also
60 SelectStatement::_rep = _rep;
61 }
62
63 CQLSelectStatement::CQLSelectStatement(String& inQlang, String& inQuery)
64 :SelectStatement()
65 {
66 _rep = new CQLSelectStatementRep(inQlang,inQuery);
67
68 // Set the _rep into the base class also
69 SelectStatement::_rep = _rep;
70 }
71
72 CQLSelectStatement::CQLSelectStatement(const CQLSelectStatement& statement)
73 :SelectStatement()
74 chuck 1.2 {
75 _rep = new CQLSelectStatementRep(*statement._rep);
76
77 // Set the _rep into the base class also
78 SelectStatement::_rep = _rep;
79 }
80
81 CQLSelectStatement::~CQLSelectStatement()
82 {
83 if(_rep)
84 delete _rep;
85
86 // Note - no need to delete the rep in the base class
87 }
88
89 CQLSelectStatement& CQLSelectStatement::operator=(const CQLSelectStatement& rhs)
90 {
91 if(&rhs != this)
92 {
93 if(_rep) delete _rep;
94 _rep = new CQLSelectStatementRep(*rhs._rep);
95 chuck 1.2
96 // Set the _rep into the base class also
97 SelectStatement::_rep = _rep;
98 }
99
100 return *this;
101 }
102
103 Boolean CQLSelectStatement::evaluate(const CIMInstance& inCI)
104 {
105 PEGASUS_ASSERT(_rep != NULL);
106
107 return _rep->evaluate(inCI);
108 }
109
110 void CQLSelectStatement::applyProjection(CIMInstance& inCI) throw(Exception)
111 {
112 PEGASUS_ASSERT(_rep != NULL);
113
114 _rep->applyProjection(inCI);
115 }
116 chuck 1.2
117 void CQLSelectStatement::validate() throw(Exception)
118 {
119 PEGASUS_ASSERT(_rep != NULL);
120
121 _rep->validate();
122 }
123
124 Array<CIMObjectPath> CQLSelectStatement::getClassPathList()
125 {
126 PEGASUS_ASSERT(_rep != NULL);
127
128 return _rep->getClassPathList();
129 }
130
131 CIMPropertyList CQLSelectStatement::getPropertyList(const CIMObjectPath& inClassName)
132 {
133 // Should be set by the concrete sub-classes
134 PEGASUS_ASSERT(_rep != NULL);
135
136 return _rep->getPropertyList(inClassName);
137 chuck 1.2 }
138
139 CIMPropertyList CQLSelectStatement::getSelectPropertyList(const CIMObjectPath& inClassName)
140 {
141 // Should be set by the concrete sub-classes
142 PEGASUS_ASSERT(_rep != NULL);
143
144 return _rep->getSelectPropertyList(inClassName);
145 }
146
147 CIMPropertyList CQLSelectStatement::getWherePropertyList(const CIMObjectPath& inClassName)
148 {
149 // Should be set by the concrete sub-classes
150 PEGASUS_ASSERT(_rep != NULL);
151
152 return _rep->getWherePropertyList(inClassName);
153 }
154
155 Array<CQLChainedIdentifier> CQLSelectStatement::getSelectChainedIdentifiers()
156 {
157 // Should be set by the concrete sub-classes
158 chuck 1.2 PEGASUS_ASSERT(_rep != NULL);
159
160 return _rep->getSelectChainedIdentifiers();
161 }
162
163 Array<CQLChainedIdentifier> CQLSelectStatement::getWhereChainedIdentifiers()
164 {
165 // Should be set by the concrete sub-classes
166 PEGASUS_ASSERT(_rep != NULL);
167
168 return _rep->getWhereChainedIdentifiers();
169 }
170
171 void CQLSelectStatement::appendClassPath(const CQLIdentifier& inIdentifier)
172 {
173 PEGASUS_ASSERT(_rep != NULL);
174
175 _rep->appendClassPath(inIdentifier);
176 }
177
178 void CQLSelectStatement::setPredicate(const CQLPredicate& inPredicate)
179 chuck 1.2 {
180 PEGASUS_ASSERT(_rep != NULL);
181
182 _rep->setPredicate(inPredicate);
183 }
184
185 CQLPredicate CQLSelectStatement::getPredicate() const
186 {
187 PEGASUS_ASSERT(_rep != NULL);
188
189 return _rep->getPredicate();
190 }
191
192 void CQLSelectStatement::insertClassPathAlias(const CQLIdentifier& inIdentifier, String inAlias)
193 {
194 PEGASUS_ASSERT(_rep != NULL);
195
196 _rep->insertClassPathAlias(inIdentifier,inAlias);
197 }
198
199 void CQLSelectStatement::appendSelectIdentifier(const CQLChainedIdentifier& x)
200 chuck 1.2 {
201 PEGASUS_ASSERT(_rep != NULL);
202
203 _rep->appendSelectIdentifier(x);
204 }
205
206 void CQLSelectStatement::applyContext()
207 {
208 PEGASUS_ASSERT(_rep != NULL);
209
210 _rep->applyContext();
211 }
212
213 void CQLSelectStatement::normalizeToDOC()
214 {
215 PEGASUS_ASSERT(_rep != NULL);
216
217 _rep->normalizeToDOC();
218 }
219
220 void CQLSelectStatement::setHasWhereClause()
221 chuck 1.2 {
222 PEGASUS_ASSERT(_rep != NULL);
223
224 _rep->setHasWhereClause();
225 }
226
227 Boolean CQLSelectStatement::hasWhereClause()
228 {
229 PEGASUS_ASSERT(_rep != NULL);
230
231 return _rep->hasWhereClause();
232 }
233
234 String CQLSelectStatement::toString()
235 {
236 PEGASUS_ASSERT(_rep != NULL);
237
238 return _rep->toString();
239 }
240
241 void CQLSelectStatement::clear(){
242 chuck 1.2 PEGASUS_ASSERT(_rep != NULL);
243
244 _rep->clear();
245 }
246
247 PEGASUS_NAMESPACE_END
|