1 karl 1.2 //%2005////////////////////////////////////////////////////////////////////////
|
2 chuck 1.1 //
3 // 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.;
6 // IBM Corp.; EMC Corporation, The Open Group.
7 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 karl 1.2 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 chuck 1.1 //
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 david.dillard 1.3 //
|
19 chuck 1.1 // 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 // Author: Mike Brasher (mbrasher@bmc.com)
31 //
32 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
|
33 david.dillard 1.3 // (carolann_graves@hp.com)
34 // David Dillard, VERITAS Software Corp.
35 // (david.dillard@veritas.com)
|
36 chuck 1.1 //
37 //%/////////////////////////////////////////////////////////////////////////////
38
39 #include <iostream>
40 #include <Pegasus/Common/Stack.h>
41 #include "WQLSelectStatementRep.h"
42 #include <Pegasus/Query/QueryCommon/QueryContext.h>
43 #include <Pegasus/Query/QueryCommon/QueryException.h>
44 #include "WQLInstancePropertySource.h"
45 PEGASUS_USING_STD;
46
47 PEGASUS_NAMESPACE_BEGIN
48
49 template<class T>
50 inline static Boolean _Compare(const T& x, const T& y, WQLOperation op)
51 {
52 switch (op)
53 {
|
54 david.dillard 1.3 case WQL_EQ:
|
55 chuck 1.1 return x == y;
56
|
57 david.dillard 1.3 case WQL_NE:
|
58 chuck 1.1 return x != y;
59
|
60 david.dillard 1.3 case WQL_LT:
|
61 chuck 1.1 return x < y;
|
62 david.dillard 1.3 case WQL_LE:
|
63 chuck 1.1 return x <= y;
64
|
65 david.dillard 1.3 case WQL_GT:
|
66 chuck 1.1 return x > y;
67
|
68 david.dillard 1.3 case WQL_GE:
|
69 chuck 1.1 return x >= y;
70
71 default:
72 PEGASUS_ASSERT(0);
73 }
74
|
75 gs.keenan 1.6 return false;
|
76 chuck 1.1 }
77
78 static Boolean _Evaluate(
|
79 david.dillard 1.3 const WQLOperand& lhs,
80 const WQLOperand& rhs,
|
81 chuck 1.1 WQLOperation op)
82 {
83 switch (lhs.getType())
84 {
85 case WQLOperand::NULL_VALUE:
86 {
87 // This cannot happen since expressions of the form
88 // OPERAND OPERATOR NULL are converted to unary form.
89 // For example: "count IS NULL" is treated as a unary
90 // operation in which IS_NULL is the unary operation
91 // and count is the the unary operand.
92
93 PEGASUS_ASSERT(0);
94 break;
95 }
96
97 case WQLOperand::INTEGER_VALUE:
98 {
99 return _Compare(
100 lhs.getIntegerValue(),
101 rhs.getIntegerValue(),
102 chuck 1.1 op);
103 }
104
105 case WQLOperand::DOUBLE_VALUE:
106 {
107 return _Compare(
108 lhs.getDoubleValue(),
109 rhs.getDoubleValue(),
110 op);
111 }
112
113 case WQLOperand::BOOLEAN_VALUE:
114 {
115 return _Compare(
116 lhs.getBooleanValue(),
117 rhs.getBooleanValue(),
118 op);
119 }
120
121 case WQLOperand::STRING_VALUE:
122 {
123 chuck 1.1 return _Compare(
124 lhs.getStringValue(),
125 rhs.getStringValue(),
126 op);
127 }
128
129 default:
130 PEGASUS_ASSERT(0);
131 }
132
133 return false;
134 }
135
136 WQLSelectStatementRep::WQLSelectStatementRep(String& queryLang, String& query)
137 :SelectStatementRep(queryLang,query)
138 {
139 _operations.reserveCapacity(16);
140 _operands.reserveCapacity(16);
141
142 _allProperties = false;
143 }
144 chuck 1.1
145 WQLSelectStatementRep::WQLSelectStatementRep(String& queryLang, String& query, QueryContext& inCtx)
146 :SelectStatementRep(queryLang,query,inCtx)
147 {
148 _operations.reserveCapacity(16);
149 _operands.reserveCapacity(16);
150
151 _allProperties = false;
152 }
153
154 WQLSelectStatementRep::WQLSelectStatementRep()
155 :SelectStatementRep()
156 {
157 //
158 // Reserve space for a where clause with up to sixteen terms.
159 //
160
161 _operations.reserveCapacity(16);
162 _operands.reserveCapacity(16);
163
164 _allProperties = false;
165 chuck 1.1 }
166
167 WQLSelectStatementRep::WQLSelectStatementRep(const WQLSelectStatementRep& rep)
168 :SelectStatementRep(rep),
169 _className(rep._className),
170 _allProperties(rep._allProperties),
171 _selectPropertyNames(rep._selectPropertyNames),
172 _wherePropertyNames(rep._wherePropertyNames),
173 _operations(rep._operations),
174 _operands(rep._operands)
175 {
176 }
177
178 WQLSelectStatementRep::~WQLSelectStatementRep()
179 {
180
181 }
182
183 void WQLSelectStatementRep::clear()
184 {
185 _className.clear();
186 chuck 1.1 _allProperties = false;
187 _selectPropertyNames.clear();
188 _operations.clear();
189 _operands.clear();
190 }
191
192 Boolean WQLSelectStatementRep::getAllProperties() const
193 {
194 return _allProperties;
195 }
196
197 void WQLSelectStatementRep::setAllProperties(const Boolean allProperties)
198 {
199 _allProperties = allProperties;
200 }
201
|
202 david.dillard 1.7 const CIMPropertyList WQLSelectStatementRep::getSelectPropertyList
|
203 carolann.graves 1.4 (const CIMObjectPath& inClassName) const
|
204 chuck 1.1 {
205 //
206 // Check for "*"
207 //
208 if (_allProperties)
209 {
210 //
211 // Return null CIMPropertyList for all properties
212 //
213 return CIMPropertyList ();
214 }
|
215 carolann.graves 1.4
216 CIMName className = inClassName.getClassName();
217 if (className.isNull())
218 {
219 //
|
220 david.dillard 1.7 // If the caller passed in an empty className, then the FROM class is
|
221 carolann.graves 1.4 // to be used
222 //
223 className = _className;
224 }
225
226 //
227 // Check if inClassName is the FROM class
228 //
229 if (!(className == _className))
|
230 chuck 1.1 {
231 //
|
232 carolann.graves 1.4 // Check for NULL Query Context
233 //
234 if (_ctx == NULL)
235 {
236 MessageLoaderParms parms
237 ("WQL.WQLSelectStatementRep.QUERY_CONTEXT_IS_NULL",
238 "Trying to process a query with a NULL Query Context.");
|
239 david.dillard 1.7 throw QueryRuntimeException(parms);
|
240 carolann.graves 1.4 }
241
242 //
243 // Check if inClassName is a subclass of the FROM class
|
244 chuck 1.1 //
|
245 carolann.graves 1.4 if (!_ctx->isSubClass(_className,className))
246 {
247 MessageLoaderParms parms
248 ("WQL.WQLSelectStatementRep.CLASS_NOT_FROM_LIST_CLASS",
249 "Class $0 does not match the FROM class or any of its "
250 "subclasses.",
251 className.getString());
252 throw QueryRuntimeException(parms);
253 }
|
254 chuck 1.1 }
|
255 carolann.graves 1.4
256 //
|
257 david.dillard 1.7 // Return CIMPropertyList for properties referenced in the projection
|
258 carolann.graves 1.4 // list (SELECT clause)
259 //
260 return CIMPropertyList (_selectPropertyNames);
|
261 chuck 1.1 }
262
|
263 david.dillard 1.7 const CIMPropertyList WQLSelectStatementRep::getWherePropertyList
|
264 carolann.graves 1.4 (const CIMObjectPath& inClassName) const
|
265 chuck 1.1 {
|
266 carolann.graves 1.4 CIMName className = inClassName.getClassName();
267 if (className.isNull())
268 {
269 //
|
270 david.dillard 1.7 // If the caller passed in an empty className, then the FROM class is
|
271 carolann.graves 1.4 // to be used
272 //
273 className = _className;
274 }
275
276 //
277 // Check if inClassName is the FROM class
278 //
279 if (!(className == _className))
280 {
281 //
282 // Check for NULL Query Context
283 //
284 if (_ctx == NULL)
285 {
286 MessageLoaderParms parms
287 ("WQL.WQLSelectStatementRep.QUERY_CONTEXT_IS_NULL",
288 "Trying to process a query with a NULL Query Context.");
|
289 david.dillard 1.7 throw QueryRuntimeException(parms);
|
290 carolann.graves 1.4 }
291
292 //
293 // Check if inClassName is a subclass of the FROM class
294 //
295 if (!_ctx->isSubClass(_className,className))
296 {
297 MessageLoaderParms parms
298 ("WQL.WQLSelectStatementRep.CLASS_NOT_FROM_LIST_CLASS",
299 "Class $0 does not match the FROM class or any of its "
300 "subclasses.",
301 className.getString());
302 throw QueryRuntimeException(parms);
303 }
304 }
305
|
306 chuck 1.1 //
|
307 david.dillard 1.3 // Return CIMPropertyList for properties referenced in the condition
|
308 chuck 1.1 // (WHERE clause)
309 // The list may be empty, but may not be NULL
310 //
311 return CIMPropertyList (_wherePropertyNames);
312 }
313
314 Boolean WQLSelectStatementRep::appendWherePropertyName(const CIMName& x)
315 {
316 //
317 // Reject duplicate property names by returning false.
318 //
319
320 for (Uint32 i = 0, n = _wherePropertyNames.size(); i < n; i++)
321 {
322 if (_wherePropertyNames[i] == x)
323 return false;
324 }
325
326 //
327 // Append the new property.
328 //
329 chuck 1.1
330 _wherePropertyNames.append(x);
331 return true;
332 }
333
334 static inline void _ResolveProperty(
335 WQLOperand& op,
336 const WQLPropertySource* source)
337 {
338 //
339 // Resolve the operand: if it's a property name, look up its value:
340 //
341
342 if (op.getType() == WQLOperand::PROPERTY_NAME)
343 {
344 const CIMName& propertyName = op.getPropertyName();
345
346 if (!source->getValue(propertyName, op))
347 op = WQLOperand();
348 }
349 }
350 chuck 1.1
351 Boolean WQLSelectStatementRep::evaluateWhereClause(
352 const WQLPropertySource* source) const
353 {
354 if (!hasWhereClause())
355 return true;
356
357 Stack<Boolean> stack;
358 stack.reserveCapacity(16);
359
|
360 david.dillard 1.3 //
|
361 chuck 1.1 // Counter for operands:
362 //
363
364 Uint32 j = 0;
365
366 //
367 // Process each of the operations:
368 //
369
370 for (Uint32 i = 0, n = _operations.size(); i < n; i++)
371 {
372 WQLOperation op = _operations[i];
373
374 switch (op)
375 {
376 case WQL_OR:
377 {
378 PEGASUS_ASSERT(stack.size() >= 2);
379
380 Boolean op1 = stack.top();
381 stack.pop();
382 chuck 1.1
383 Boolean op2 = stack.top();
384
385 stack.top() = op1 || op2;
386 break;
387 }
388
389 case WQL_AND:
390 {
391 PEGASUS_ASSERT(stack.size() >= 2);
392
393 Boolean op1 = stack.top();
394 stack.pop();
395
396 Boolean op2 = stack.top();
397
398 stack.top() = op1 && op2;
399 break;
400 }
401
402 case WQL_NOT:
403 chuck 1.1 {
404 PEGASUS_ASSERT(stack.size() >= 1);
405
406 Boolean op = stack.top();
407 stack.top() = !op;
408 break;
409 }
410
411 case WQL_EQ:
412 case WQL_NE:
413 case WQL_LT:
414 case WQL_LE:
415 case WQL_GT:
416 case WQL_GE:
417 {
418 Array<WQLOperand> whereOperands(_operands);
419 PEGASUS_ASSERT(whereOperands.size() >= 2);
420
421 //
422 // Resolve the left-hand-side to a value (if not already
423 // a value).
424 chuck 1.1 //
425
426 WQLOperand& lhs = whereOperands[j++];
427 _ResolveProperty(lhs, source);
428
429 //
430 // Resolve the right-hand-side to a value (if not already
431 // a value).
432 //
433
434 WQLOperand& rhs = whereOperands[j++];
435 _ResolveProperty(rhs, source);
436
437 //
438 // Check for a type mismatch:
439 //
440
441 // PEGASUS_OUT(lhs.toString());
442 // PEGASUS_OUT(rhs.toString());
443
444 if (rhs.getType() != lhs.getType())
445 chuck 1.1 throw TypeMismatchException();
446
447 //
448 // Now that the types are known to be alike, apply the
449 // operation:
450 //
451
452 stack.push(_Evaluate(lhs, rhs, op));
453 break;
454 }
455
456 case WQL_IS_TRUE:
457 case WQL_IS_NOT_FALSE:
458 {
459 PEGASUS_ASSERT(stack.size() >= 1);
460 break;
461 }
462
463 case WQL_IS_FALSE:
464 case WQL_IS_NOT_TRUE:
465 {
466 chuck 1.1 PEGASUS_ASSERT(stack.size() >= 1);
467 stack.top() = !stack.top();
468 break;
469 }
470
471 case WQL_IS_NULL:
472 {
473 Array<WQLOperand> whereOperands(_operands);
474 PEGASUS_ASSERT(whereOperands.size() >= 1);
475 WQLOperand& op = whereOperands[j++];
476 _ResolveProperty(op, source);
477 stack.push(op.getType() == WQLOperand::NULL_VALUE);
478 break;
479 }
480
481 case WQL_IS_NOT_NULL:
482 {
483 Array<WQLOperand> whereOperands(_operands);
484 PEGASUS_ASSERT(whereOperands.size() >= 1);
485 WQLOperand& op = whereOperands[j++];
486 _ResolveProperty(op, source);
487 chuck 1.1 stack.push(op.getType() != WQLOperand::NULL_VALUE);
488 break;
489 }
490 }
491 }
492
493 PEGASUS_ASSERT(stack.size() == 1);
494 return stack.top();
495 }
496
|
497 kumpf 1.9 template<class T>
498 inline void wqlSelectStatementApplyProjection(
499 T& object,
500 Boolean allowMissing,
501 const Array<CIMName>& selectPropertyNames)
502 {
503 for (int i=object.getPropertyCount(); i!=0; i--)
504 {
505 CIMName pn=object.getProperty(i-1).getName();
506 Boolean foundInSel = false;
507 for (int ii=0,mm=selectPropertyNames.size(); ii<mm; ii++)
508 {
509 if (selectPropertyNames[ii]==pn)
510 {
511 foundInSel = true;
512 break;
513 }
514 }
515
516 if (!foundInSel)
517 {
518 kumpf 1.9 object.removeProperty(i-1);
519 }
520 }
521
522 //check for properties on select list missing from the instance
523 if (!allowMissing)
524 {
525 Boolean foundInInst;
526 for (Uint32 i=0; i < selectPropertyNames.size(); i++)
527 {
528 foundInInst = false;
529 CIMName sn=selectPropertyNames[i];
530 for (Uint32 j = object.getPropertyCount(); j != 0; j--)
531 {
532 CIMName in = object.getProperty(j-1).getName();
533 if (sn == in) foundInInst = true;
534 }
535
536 if(!foundInInst)
537 {
538 MessageLoaderParms parms
539 kumpf 1.9 ("WQL.WQLSelectStatementRep.MISSING_PROPERTY_ON_INSTANCE",
540 "A property in the Select list is missing from the "
541 "instance");
542 throw QueryRuntimePropertyException(parms);
543 }
544 }
545 }
546 }
547
|
548 carolann.graves 1.4 void WQLSelectStatementRep::applyProjection(CIMInstance& ci,
|
549 david.dillard 1.7 Boolean allowMissing)
|
550 chuck 1.1 {
|
551 kumpf 1.9 if (_allProperties)
552 {
553 return;
554 }
555
556 wqlSelectStatementApplyProjection(ci, allowMissing, _selectPropertyNames);
|
557 chuck 1.8 }
558
559 void WQLSelectStatementRep::applyProjection(CIMObject& ci,
560 Boolean allowMissing)
561 {
|
562 kumpf 1.9 if (_allProperties)
563 {
564 return;
565 }
|
566 chuck 1.1
|
567 kumpf 1.9 wqlSelectStatementApplyProjection(ci, allowMissing, _selectPropertyNames);
|
568 chuck 1.1 }
569
570 void WQLSelectStatementRep::print() const
571 {
572 //
573 // Print the header:
574 //
|
575 david.dillard 1.3
|
576 chuck 1.1 cout << "WQLSelectStatement" << endl;
577 cout << "{" << endl;
578
579 //
580 // Print the class name:
581 //
582
583 cout << " _className: \"" << _className.getString() << '"' << endl;
584
|
585 david.dillard 1.3 //
|
586 chuck 1.1 // Print the select properties:
587 //
588
589 if (_allProperties)
590 {
591 cout << endl;
592 cout << " _allProperties: TRUE" << endl;
593 }
594
595 else for (Uint32 i = 0; i < _selectPropertyNames.size(); i++)
596 {
597 if (i == 0)
598 cout << endl;
599
600 cout << " _selectPropertyNames[" << i << "]: ";
601 cout << '"' << _selectPropertyNames[i].getString() << '"' << endl;
602 }
603
604 //
605 // Print the operations:
606 //
607 chuck 1.1
608 for (Uint32 i = 0; i < _operations.size(); i++)
609 {
610 if (i == 0)
611 cout << endl;
612
613 cout << " _operations[" << i << "]: ";
614 cout << '"' << WQLOperationToString(_operations[i]) << '"' << endl;
615 }
616
617 //
618 // Print the operands:
619 //
620
621 for (Uint32 i = 0; i < _operands.size(); i++)
622 {
623 if (i == 0)
624 cout << endl;
625
626 cout << " _operands[" << i << "]: ";
627 cout << '"' << _operands[i].toString() << '"' << endl;
628 chuck 1.1 }
629
630 //
631 // Print the trailer:
632 //
633
634 cout << "}" << endl;
635 }
636
637 Boolean WQLSelectStatementRep::evaluate(const CIMInstance& inCI)
638 {
639 WQLInstancePropertySource source(inCI);
640 return evaluateWhereClause(&source);
641 }
|
642 david.dillard 1.3
|
643 david.dillard 1.7 void WQLSelectStatementRep::validate()
|
644 chuck 1.1 {
645 if(_ctx == NULL){
646 MessageLoaderParms parms("WQL.WQLSelectStatementRep.QUERY_CONTEXT_IS_NULL",
647 "Trying to process a query with a NULL Query Context.");
648 throw QueryValidationException(parms);
649 }
650 CIMClass fromClass;
651 try
652 {
653 fromClass = _ctx->getClass(_className);
|
654 david.dillard 1.7
|
655 carolann.graves 1.4 CIMObjectPath className (String::EMPTY, _ctx->getNamespace (), _className);
|
656 david.dillard 1.7 Array<CIMName> whereProps =
|
657 carolann.graves 1.4 getWherePropertyList(className).getPropertyNameArray();
|
658 david.dillard 1.7 Array<CIMName> selectProps =
|
659 carolann.graves 1.4 getSelectPropertyList(className).getPropertyNameArray();
|
660 david.dillard 1.3
|
661 carolann.graves 1.4 // make sure all properties match properties on the from class
|
662 chuck 1.1 for(Uint32 i = 0; i < whereProps.size(); i++){
663 Uint32 index = fromClass.findProperty(whereProps[i]);
664 if(index == PEG_NOT_FOUND){
665 MessageLoaderParms parms("WQL.WQLSelectStatementRep.PROP_NOT_FOUND",
666 "The property $0 was not found in the FROM class $1",
667 whereProps[i].getString(),
668 fromClass.getClassName().getString());
669 throw QueryMissingPropertyException(parms);
670 }
671 else
672 {
673 //
674 // Property exists in class
675 // Verify it is not an array property
676 //
677 CIMProperty classProperty = fromClass.getProperty(index);
678 if (classProperty.isArray ())
679 {
680 MessageLoaderParms parms("WQL.WQLSelectStatementRep.WHERE_PROP_IS_ARRAY",
681 "Array property $0 is not supported in the WQL WHERE clause.",
682 whereProps[i].getString());
683 chuck 1.1 throw QueryValidationException(parms);
684 }
685 }
686 }
687
688 for(Uint32 i = 0; i < selectProps.size(); i++){
689 if(fromClass.findProperty(selectProps[i]) == PEG_NOT_FOUND){
690 MessageLoaderParms parms("WQL.WQLSelectStatementRep.PROP_NOT_FOUND",
691 "The property $0 was not found in the FROM class $1",
692 selectProps[i].getString(),
693 fromClass.getClassName().getString());
694 throw QueryMissingPropertyException(parms);
695 }
696 }
697 }
|
698 david.dillard 1.3 catch (const CIMException& ce)
|
699 chuck 1.1 {
700 if (ce.getCode() == CIM_ERR_INVALID_CLASS ||
701 ce.getCode() == CIM_ERR_NOT_FOUND)
702 {
703 MessageLoaderParms parms("WQL.WQLSelectStatementRep.CLASSNAME_NOT_IN_REPOSITORY",
704 "The class name $0 was not found in the repository.",
705 _className.getString());
706 throw QueryValidationException(parms);
707 }
708 else
709 {
|
710 david.dillard 1.3 throw;
|
711 chuck 1.1 }
712 }
713 }
|
714 david.dillard 1.3
|
715 chuck 1.1 CIMPropertyList WQLSelectStatementRep::getPropertyList(const CIMObjectPath& inClassName)
716 {
717 if(_ctx == NULL){
718 MessageLoaderParms parms("WQL.WQLSelectStatementRep.QUERY_CONTEXT_IS_NULL",
719 "Trying to process a query with a NULL Query Context.");
|
720 david.dillard 1.3 throw QueryRuntimeException(parms);
|
721 chuck 1.1 }
722
723 if(_allProperties)
724 return CIMPropertyList();
725
726 CIMName className = inClassName.getClassName();
727 if (className.isNull())
728 {
729 // If the caller passed in an empty className, then the
730 // FROM class is to be used.
731 className = _className;
732 }
733
734 // check if inClassName is the From class
735 if(!(className == _className)){
736 // check if inClassName is a subclass of the From class
737 if(!_ctx->isSubClass(_className,className)){
738 MessageLoaderParms parms("WQL.WQLSelectStatementRep.CLASS_NOT_FROM_LIST_CLASS",
739 "Class $0 does not match the FROM class or any of its subclasses.",
740 className.getString());
741 throw QueryRuntimeException(parms);
742 chuck 1.1 }
743 }
744
|
745 david.dillard 1.7 Array<CIMName> names =
|
746 carolann.graves 1.4 getWherePropertyList(inClassName).getPropertyNameArray();
|
747 david.dillard 1.7 Array<CIMName> selectList =
|
748 carolann.graves 1.4 getSelectPropertyList(inClassName).getPropertyNameArray();
|
749 david.dillard 1.7
|
750 chuck 1.1 // check for duplicates and remove them
751 for(Uint32 i = 0; i < names.size(); i++){
752 for(Uint32 j = 0; j < selectList.size(); j++){
753 if(names[i] == selectList[j])
754 selectList.remove(j);
755 }
756 }
757
758 names.appendArray(selectList);
759 CIMPropertyList list = CIMPropertyList();
760 list.set(names);
761 return list;
762 }
763
764 Array<CIMObjectPath> WQLSelectStatementRep::getClassPathList()
765 {
766 if(_ctx == NULL){
767 MessageLoaderParms parms("WQL.WQLSelectStatementRep.QUERY_CONTEXT_IS_NULL",
768 "Trying to process a query with a NULL Query Context.");
769 throw QueryRuntimeException(parms);
770 }
771 chuck 1.1 CIMObjectPath path(String::EMPTY, _ctx->getNamespace(), _className);
772 Array<CIMObjectPath> paths;
773 paths.append(path);
774 return paths;
775 }
776
777 PEGASUS_NAMESPACE_END
|