1 martin 1.7 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.8 //
|
3 martin 1.7 // 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.8 //
|
10 martin 1.7 // 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.8 //
|
17 martin 1.7 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.8 //
|
20 martin 1.7 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.8 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.7 // 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.8 //
|
28 martin 1.7 //////////////////////////////////////////////////////////////////////////
|
29 schuur 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #include "WQLQueryExpressionRep.h"
33 #include "WQLParser.h"
34 #include "WQLInstancePropertySource.h"
35
36 PEGASUS_NAMESPACE_BEGIN
37
38
39 const CIMPropertyList WQLQueryExpressionRep::getPropertyList() const
40 {
41 if (_stmt==NULL) ((WQLQueryExpressionRep*)this)->_parse();
42
43 return _stmt->getSelectPropertyList();
44 }
45
|
46 karl 1.6 WQLQueryExpressionRep::~WQLQueryExpressionRep()
47 {
|
48 schuur 1.1 if (_stmt) delete _stmt;
49 }
50
51 void WQLQueryExpressionRep::_parse()
52 {
|
53 karl 1.6 if (_queryLanguage=="WQL")
54 {
|
55 schuur 1.1 _stmt=new WQLSelectStatement();
56 WQLParser::parse(_query, *_stmt);
57 }
58 else throw
|
59 kumpf 1.9 PEGASUS_CIM_EXCEPTION(CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED,
|
60 karl 1.6 _queryLanguage);
|
61 schuur 1.1 }
62
63 Boolean WQLQueryExpressionRep::evaluate(const CIMInstance & inst) const
64 {
65 if (_stmt==NULL) ((WQLQueryExpressionRep*)this)->_parse();
66
67 WQLInstancePropertySource ips(inst);
|
68 karl 1.6 try
69 {
|
70 schuur 1.1 if (_stmt->evaluateWhereClause(&ips)) return true;
71 }
|
72 karl 1.6 catch (...)
73 {
|
74 schuur 1.1 return false;
75 }
|
76 kumpf 1.9 return false;
|
77 schuur 1.1 }
78
|
79 carolann.graves 1.4 void WQLQueryExpressionRep::applyProjection(CIMInstance & ci,
80 Boolean allowMissing)
81 {
|
82 schuur 1.1 if (_stmt==NULL) ((WQLQueryExpressionRep*)this)->_parse();
83
|
84 carolann.graves 1.4 _stmt->applyProjection(ci, allowMissing);
|
85 schuur 1.1 }
86
87 PEGASUS_NAMESPACE_END
|