1 martin 1.20 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.21 //
|
3 martin 1.20 // 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.21 //
|
10 martin 1.20 // 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.21 //
|
17 martin 1.20 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.21 //
|
20 martin 1.20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.21 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.20 // 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.21 //
|
28 martin 1.20 //////////////////////////////////////////////////////////////////////////
|
29 mike 1.2 //
30 //%/////////////////////////////////////////////////////////////////////////////
|
31 chuck 1.12 #include "WQLSelectStatement.h"
32 #include "WQLSelectStatementRep.h"
|
33 mike 1.2 #include <iostream>
34 #include <Pegasus/Common/Stack.h>
35
36 PEGASUS_USING_STD;
37
38 PEGASUS_NAMESPACE_BEGIN
39
|
40 chuck 1.12 const WQLSelectStatement WQLSelectStatement::EMPTY=WQLSelectStatement();
41
|
42 kumpf 1.19 WQLSelectStatement::WQLSelectStatement(
43 const String& queryLang,
44 const String& query)
45 : SelectStatement()
|
46 mike 1.2 {
|
47 karl 1.17 _rep = new WQLSelectStatementRep(queryLang,query);
48 // Set the _rep into the base class also
49 SelectStatement::_rep = _rep;
|
50 chuck 1.12 }
|
51 mike 1.2
|
52 kumpf 1.19 WQLSelectStatement::WQLSelectStatement(
53 const String& queryLang,
54 const String& query,
55 const QueryContext& inCtx)
56 : SelectStatement()
|
57 chuck 1.12 {
|
58 karl 1.17 _rep = new WQLSelectStatementRep(queryLang,query,inCtx);
59 // Set the _rep into the base class also
60 SelectStatement::_rep = _rep;
|
61 chuck 1.12 }
|
62 mike 1.2
|
63 chuck 1.12 WQLSelectStatement::WQLSelectStatement()
64 :SelectStatement()
65 {
|
66 karl 1.17 _rep = new WQLSelectStatementRep();
67 // Set the _rep into the base class also
68 SelectStatement::_rep = _rep;
|
69 mike 1.2 }
70
|
71 chuck 1.12 WQLSelectStatement::WQLSelectStatement(const WQLSelectStatement& statement)
72 :SelectStatement()
|
73 mike 1.2 {
|
74 karl 1.17 _rep = new WQLSelectStatementRep(*statement._rep);
|
75 kumpf 1.22
|
76 karl 1.17 // Set the _rep into the base class also
77 SelectStatement::_rep = _rep;
|
78 mike 1.2 }
79
|
80 chuck 1.12 WQLSelectStatement& WQLSelectStatement::operator=(const WQLSelectStatement& rhs)
|
81 mike 1.2 {
|
82 karl 1.17 if(&rhs != this)
83 {
84 if(_rep) delete _rep;
85 _rep = new WQLSelectStatementRep(*rhs._rep);
|
86 kumpf 1.22
|
87 karl 1.17 // Set the _rep into the base class also
88 SelectStatement::_rep = _rep;
89 }
|
90 kumpf 1.6
|
91 chuck 1.12 return *this;
|
92 mike 1.2 }
93
|
94 chuck 1.12
|
95 mike 1.2 WQLSelectStatement::~WQLSelectStatement()
96 {
|
97 karl 1.17 delete _rep;
|
98 mike 1.2 }
99
100 void WQLSelectStatement::clear()
101 {
|
102 karl 1.17 _rep->clear();
|
103 mike 1.2 }
104
|
105 kumpf 1.6 Boolean WQLSelectStatement::getAllProperties() const
106 {
|
107 chuck 1.12 return _rep->getAllProperties();
|
108 kumpf 1.6 }
109
110 void WQLSelectStatement::setAllProperties(const Boolean allProperties)
111 {
|
112 chuck 1.12 _rep->setAllProperties(allProperties);
|
113 kumpf 1.6 }
114
|
115 kumpf 1.18 CIMPropertyList WQLSelectStatement::getSelectPropertyList(
116 const CIMObjectPath& inClassName)
|
117 kumpf 1.6 {
|
118 karl 1.17 return _rep->getSelectPropertyList(inClassName);
|
119 kumpf 1.6 }
120
|
121 kumpf 1.18 CIMPropertyList WQLSelectStatement::getWherePropertyList(
122 const CIMObjectPath& inClassName)
|
123 kumpf 1.6 {
|
124 carolann.graves 1.14 return _rep->getWherePropertyList(inClassName);
|
125 kumpf 1.6 }
126
127 Boolean WQLSelectStatement::appendWherePropertyName(const CIMName& x)
|
128 mike 1.2 {
|
129 chuck 1.12 return _rep->appendWherePropertyName(x);
130 }
|
131 mike 1.2
|
132 chuck 1.12 Boolean WQLSelectStatement::evaluateWhereClause(
133 const WQLPropertySource* source) const
134 {
|
135 karl 1.17 return _rep->evaluateWhereClause(source);
|
136 chuck 1.12 }
|
137 mike 1.2
|
138 carolann.graves 1.14 void WQLSelectStatement::applyProjection(CIMInstance& ci,
|
139 david.dillard 1.15 Boolean allowMissing)
|
140 chuck 1.12 {
|
141 karl 1.17 _rep->applyProjection(ci, allowMissing);
|
142 chuck 1.12 }
|
143 mike 1.2
|
144 carolann.graves 1.14 void WQLSelectStatement::applyProjection(CIMObject& ci,
|
145 david.dillard 1.15 Boolean allowMissing)
|
146 chuck 1.12 {
|
147 karl 1.17 _rep->applyProjection(ci, allowMissing);
|
148 mike 1.2 }
149
|
150 chuck 1.12 void WQLSelectStatement::print() const
|
151 mike 1.2 {
|
152 karl 1.17 _rep->print();
|
153 chuck 1.12 }
|
154 mike 1.2
|
155 chuck 1.12 Boolean WQLSelectStatement::evaluate(const CIMInstance& inCI)
156 {
|
157 karl 1.17 return _rep->evaluate(inCI);
|
158 chuck 1.12 }
|
159 david.dillard 1.15
160 void WQLSelectStatement::validate()
|
161 chuck 1.12 {
|
162 karl 1.17 _rep->validate();
|
163 mike 1.2 }
|
164 david.dillard 1.15
|
165 karl 1.17 CIMPropertyList WQLSelectStatement::getPropertyList(
166 const CIMObjectPath& inClassName)
|
167 mike 1.2 {
|
168 karl 1.17 return _rep->getPropertyList(inClassName);
|
169 schuur 1.10 }
170
|
171 kumpf 1.18 Array<CIMObjectPath> WQLSelectStatement::getClassPathList() const
|
172 schuur 1.10 {
|
173 karl 1.17 return _rep->getClassPathList();
|
174 schuur 1.10 }
175
|
176 chuck 1.12 Uint32 WQLSelectStatement::getSelectPropertyNameCount() const
|
177 schuur 1.10 {
|
178 chuck 1.12 return _rep->getSelectPropertyNameCount();
|
179 mike 1.2 }
|
180 david.dillard 1.15
|
181 kumpf 1.18 /** Gets the i-th selected property name in the list.
182 This function should only be used if getAllProperties() returns false.
183 */
|
184 chuck 1.12 const CIMName& WQLSelectStatement::getSelectPropertyName(Uint32 i) const
|
185 mike 1.2 {
|
186 chuck 1.12 return _rep->getSelectPropertyName(i);
187 }
|
188 mike 1.2
|
189 chuck 1.12 const CIMName& WQLSelectStatement::getClassName() const
|
190 kumpf 1.18 {
191 return _rep->getClassName();
192 }
193
194 /** Modifier. This method should not be called by the user (only by the
195 parser).
196 */
197 void WQLSelectStatement::setClassName(const CIMName& className)
198 {
199 _rep->setClassName(className);
200 }
|
201 kumpf 1.6
|
202 chuck 1.12 void WQLSelectStatement::appendSelectPropertyName(const CIMName& x)
|
203 kumpf 1.18 {
204 _rep->appendSelectPropertyName(x);
205 }
206
207 /** Returns the number of unique property names from the where clause.
208 */
209 Uint32 WQLSelectStatement::getWherePropertyNameCount() const
210 {
211 return _rep->getWherePropertyNameCount();
212 }
213
214 /** Gets the i-th unique property appearing in the where clause.
215 */
216 const CIMName& WQLSelectStatement::getWherePropertyName(Uint32 i) const
217 {
218 return _rep->getWherePropertyName(i);
219 }
|
220 mike 1.2
|
221 chuck 1.12 void WQLSelectStatement::appendOperation(WQLOperation x)
|
222 kumpf 1.18 {
223 _rep->appendOperation(x);
224 }
225
226 /** Appends an operand to the operation array. This method should only
227 be called by the parser itself.
228 */
229 void WQLSelectStatement::appendOperand(const WQLOperand& x)
230 {
231 _rep->appendOperand(x);
232 }
233
234 /** Returns true if this class has a where clause.
235 */
236 Boolean WQLSelectStatement::hasWhereClause() const
237 {
238 return _rep->hasWhereClause();
239 }
|
240 mike 1.2
241 PEGASUS_NAMESPACE_END
|