1 martin 1.12 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.13 //
|
3 martin 1.12 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.13 //
|
10 martin 1.12 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.13 //
|
17 martin 1.12 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.13 //
|
20 martin 1.12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.13 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.12 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.13 //
|
28 martin 1.12 //////////////////////////////////////////////////////////////////////////
|
29 chuck 1.2 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #include "CQLSelectStatement.h"
33 #include "CQLSelectStatementRep.h"
34 #include <Pegasus/Common/InternalException.h>
|
35 david.dillard 1.6 #include <Pegasus/CQL/CQLPredicate.h>
|
36 chuck 1.2
37 PEGASUS_NAMESPACE_BEGIN
38
39 CQLSelectStatement::CQLSelectStatement()
|
40 karl 1.8 :SelectStatement()
|
41 chuck 1.2 {
|
42 karl 1.8 _rep = new CQLSelectStatementRep();
|
43 david.dillard 1.6
|
44 karl 1.8 // Set the _rep into the base class also
45 SelectStatement::_rep = _rep;
|
46 chuck 1.2 }
47
|
48 kumpf 1.10 CQLSelectStatement::CQLSelectStatement(
49 const String& inQlang,
50 const String& inQuery,
51 const QueryContext& inCtx)
|
52 karl 1.8 :SelectStatement()
|
53 chuck 1.2 {
|
54 karl 1.8 _rep = new CQLSelectStatementRep(inQlang,inQuery,inCtx);
|
55 kumpf 1.14
|
56 karl 1.8 // Set the _rep into the base class also
57 SelectStatement::_rep = _rep;
|
58 chuck 1.2 }
59
|
60 kumpf 1.10 CQLSelectStatement::CQLSelectStatement(
61 const String& inQlang,
62 const String& inQuery)
|
63 karl 1.8 :SelectStatement()
|
64 chuck 1.2 {
|
65 karl 1.8 _rep = new CQLSelectStatementRep(inQlang,inQuery);
|
66 kumpf 1.14
|
67 karl 1.8 // Set the _rep into the base class also
68 SelectStatement::_rep = _rep;
|
69 chuck 1.2 }
70
71 CQLSelectStatement::CQLSelectStatement(const CQLSelectStatement& statement)
|
72 karl 1.8 :SelectStatement()
|
73 chuck 1.2 {
|
74 karl 1.8 _rep = new CQLSelectStatementRep(*statement._rep);
|
75 kumpf 1.14
|
76 karl 1.8 // Set the _rep into the base class also
77 SelectStatement::_rep = _rep;
|
78 chuck 1.2 }
79
80 CQLSelectStatement::~CQLSelectStatement()
81 {
|
82 karl 1.8 if(_rep)
83 delete _rep;
|
84 chuck 1.2
|
85 karl 1.8 // Note - no need to delete the rep in the base class
|
86 chuck 1.2 }
87
88 CQLSelectStatement& CQLSelectStatement::operator=(const CQLSelectStatement& rhs)
89 {
|
90 karl 1.8 if(&rhs != this)
91 {
92 if(_rep)
93 delete _rep;
94 _rep = new CQLSelectStatementRep(*rhs._rep);
|
95 kumpf 1.14
|
96 karl 1.8 // Set the _rep into the base class also
97 SelectStatement::_rep = _rep;
98 }
99 return *this;
|
100 chuck 1.2 }
101
102 Boolean CQLSelectStatement::evaluate(const CIMInstance& inCI)
103 {
|
104 karl 1.8 PEGASUS_ASSERT(_rep != NULL);
|
105 kumpf 1.14
|
106 karl 1.8 return _rep->evaluate(inCI);
|
107 chuck 1.2 }
108
|
109 kumpf 1.9 void CQLSelectStatement::applyProjection(
110 CIMInstance& inCI,
|
111 david.dillard 1.6 Boolean allowMissing)
|
112 chuck 1.2 {
|
113 karl 1.8 PEGASUS_ASSERT(_rep != NULL);
|
114 kumpf 1.14
|
115 karl 1.8 _rep->applyProjection(inCI, allowMissing);
|
116 chuck 1.2 }
117
|
118 david.dillard 1.6 void CQLSelectStatement::validate()
|
119 chuck 1.2 {
|
120 karl 1.8 PEGASUS_ASSERT(_rep != NULL);
|
121 kumpf 1.14
|
122 karl 1.8 _rep->validate();
|
123 chuck 1.2 }
124
|
125 kumpf 1.9 Array<CIMObjectPath> CQLSelectStatement::getClassPathList() const
|
126 chuck 1.2 {
|
127 karl 1.8 PEGASUS_ASSERT(_rep != NULL);
|
128 kumpf 1.14
|
129 karl 1.8 return _rep->getClassPathList();
|
130 chuck 1.2 }
131
|
132 karl 1.8 CIMPropertyList CQLSelectStatement::getPropertyList(
133 const CIMObjectPath& inClassName)
|
134 chuck 1.2 {
|
135 karl 1.8 // Should be set by the concrete sub-classes
136 PEGASUS_ASSERT(_rep != NULL);
|
137 kumpf 1.14
|
138 karl 1.8 return _rep->getPropertyList(inClassName);
|
139 chuck 1.2 }
140
|
141 karl 1.8 CIMPropertyList CQLSelectStatement::getSelectPropertyList(
142 const CIMObjectPath& inClassName)
|
143 chuck 1.2 {
|
144 karl 1.8 // Should be set by the concrete sub-classes
145 PEGASUS_ASSERT(_rep != NULL);
|
146 kumpf 1.14
|
147 karl 1.8 return _rep->getSelectPropertyList(inClassName);
|
148 chuck 1.2 }
149
|
150 karl 1.8 CIMPropertyList CQLSelectStatement::getWherePropertyList(
151 const CIMObjectPath& inClassName)
|
152 chuck 1.2 {
|
153 karl 1.8 // Should be set by the concrete sub-classes
154 PEGASUS_ASSERT(_rep != NULL);
|
155 kumpf 1.14
|
156 karl 1.8 return _rep->getWherePropertyList(inClassName);
|
157 chuck 1.2 }
158
159 Array<CQLChainedIdentifier> CQLSelectStatement::getSelectChainedIdentifiers()
160 {
|
161 karl 1.8 // Should be set by the concrete sub-classes
162 PEGASUS_ASSERT(_rep != NULL);
|
163 kumpf 1.14
|
164 karl 1.8 return _rep->getSelectChainedIdentifiers();
|
165 chuck 1.2 }
166
167 Array<CQLChainedIdentifier> CQLSelectStatement::getWhereChainedIdentifiers()
168 {
|
169 karl 1.8 // Should be set by the concrete sub-classes
170 PEGASUS_ASSERT(_rep != NULL);
|
171 kumpf 1.14
|
172 karl 1.8 return _rep->getWhereChainedIdentifiers();
|
173 chuck 1.2 }
174
175 void CQLSelectStatement::appendClassPath(const CQLIdentifier& inIdentifier)
176 {
|
177 karl 1.8 PEGASUS_ASSERT(_rep != NULL);
|
178 kumpf 1.14
|
179 karl 1.8 _rep->appendClassPath(inIdentifier);
|
180 chuck 1.2 }
181
182 void CQLSelectStatement::setPredicate(const CQLPredicate& inPredicate)
183 {
|
184 karl 1.8 PEGASUS_ASSERT(_rep != NULL);
|
185 kumpf 1.14
|
186 karl 1.8 _rep->setPredicate(inPredicate);
|
187 chuck 1.2 }
188
189 CQLPredicate CQLSelectStatement::getPredicate() const
190 {
|
191 karl 1.8 PEGASUS_ASSERT(_rep != NULL);
|
192 kumpf 1.14
|
193 karl 1.8 return _rep->getPredicate();
|
194 chuck 1.2 }
195
|
196 karl 1.8 void CQLSelectStatement::insertClassPathAlias(
|
197 kumpf 1.11 const CQLIdentifier& inIdentifier,
198 const String& inAlias)
|
199 chuck 1.2 {
|
200 karl 1.8 PEGASUS_ASSERT(_rep != NULL);
|
201 kumpf 1.14
|
202 karl 1.8 _rep->insertClassPathAlias(inIdentifier,inAlias);
|
203 chuck 1.2 }
204
205 void CQLSelectStatement::appendSelectIdentifier(const CQLChainedIdentifier& x)
206 {
|
207 karl 1.8 PEGASUS_ASSERT(_rep != NULL);
|
208 kumpf 1.14
|
209 karl 1.8 _rep->appendSelectIdentifier(x);
|
210 chuck 1.2 }
211
212 void CQLSelectStatement::applyContext()
213 {
|
214 karl 1.8 PEGASUS_ASSERT(_rep != NULL);
|
215 kumpf 1.14
|
216 karl 1.8 _rep->applyContext();
|
217 chuck 1.2 }
218
219 void CQLSelectStatement::normalizeToDOC()
220 {
|
221 karl 1.8 PEGASUS_ASSERT(_rep != NULL);
|
222 kumpf 1.14
|
223 karl 1.8 _rep->normalizeToDOC();
|
224 chuck 1.2 }
225
226 void CQLSelectStatement::setHasWhereClause()
227 {
|
228 karl 1.8 PEGASUS_ASSERT(_rep != NULL);
|
229 kumpf 1.14
|
230 karl 1.8 _rep->setHasWhereClause();
|
231 chuck 1.2 }
232
|
233 kumpf 1.9 Boolean CQLSelectStatement::hasWhereClause() const
|
234 chuck 1.2 {
|
235 karl 1.8 PEGASUS_ASSERT(_rep != NULL);
|
236 kumpf 1.14
|
237 karl 1.8 return _rep->hasWhereClause();
|
238 chuck 1.2 }
239
|
240 kumpf 1.9 String CQLSelectStatement::toString() const
|
241 chuck 1.2 {
|
242 karl 1.8 PEGASUS_ASSERT(_rep != NULL);
|
243 kumpf 1.14
|
244 karl 1.8 return _rep->toString();
|
245 chuck 1.2 }
246
|
247 kumpf 1.9 void CQLSelectStatement::clear()
248 {
|
249 karl 1.8 PEGASUS_ASSERT(_rep != NULL);
|
250 kumpf 1.14
|
251 karl 1.8 _rep->clear();
|
252 chuck 1.2 }
253
254 PEGASUS_NAMESPACE_END
|