1 chuck 1.1.2.3 //%2004////////////////////////////////////////////////////////////////////////
2 //
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) 2004 BMC Software; Hewlett-Packard Development Company, L. P.;
6 // IBM Corp.; EMC Corporation, The Open Group.
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to
10 // deal in the Software without restriction, including without limitation the
11 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 // sell copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
16 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
17 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
18 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 chuck 1.1.2.3 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 //
24 //==============================================================================
25 //
26 // Authors: David Rosckes (rosckes@us.ibm.com)
27 // Bert Rivero (hurivero@us.ibm.com)
28 // Chuck Carmack (carmack@us.ibm.com)
29 // Brian Lucier (lucier@us.ibm.com)
30 //
31 // Modified By:
32 //
33 //%/////////////////////////////////////////////////////////////////////////////
34
|
35 humberto 1.1.2.1 #ifndef Pegasus_CQLSelectStatementRep_h
36 #define Pegasus_CQLSelectStatementRep_h
37
38 #include <Pegasus/Common/Config.h>
39 #include <Pegasus/CQL/SelectStatementRep.h>
40 #include <Pegasus/CQL/CQLChainedIdentifier.h>
41 #include <Pegasus/CQL/CQLIdentifier.h>
42 #include <Pegasus/CQL/Linkage.h>
43
44
45 PEGASUS_NAMESPACE_BEGIN
46
47 /**
48 This class is derived from the SelectStatement base class.
49 The purpose of this class is to perform the select statement operations for
50 CIM Query Language (CQL).
51
52 Notes on CQLSelectStatement class:
53
54 (A) Contains a CQLPredicate for the WHERE clause
55 (B) Contains an array of CQLIdentifiers for the SELECT projection
56 humberto 1.1.2.1 (C) Contains an array of classpaths from the FROM clause
57
58
59 */
60 class PEGASUS_CQL_LINKAGE CQLSelectStatementRep : public SelectStatementRep
61 {
62 public:
63
|
64 chuck 1.1.2.3 CQLSelectStatementRep();
65
|
66 humberto 1.1.2.1 /** This is the constructor for the CQLSelectStatement object.
67 The ctor requires 3 parameters:
68 query language (qlang) which is CQL,
69 the query itself,
70 and the name of the CIM namespace.
71 */
72 CQLSelectStatementRep(
73 /** The query language is needed so the
74 base class can retrieve the query language.
75 The class member variable where this data
76 is stored is located in the base SelectStatement
77 class.
78 */
|
79 chuck 1.1.2.3 String& inQlang,
|
80 humberto 1.1.2.1 /** input parameter containing the query string.
81 */
|
82 chuck 1.1.2.3 String& inQuery,
|
83 humberto 1.1.2.1
|
84 chuck 1.1.2.3 QueryContext* inCtx);
|
85 humberto 1.1.2.1
|
86 chuck 1.1.2.3 CQLSelectStatementRep(const CQLSelectStatementRep& rep);
|
87 humberto 1.1.2.2
|
88 chuck 1.1.2.3 ~CQLSelectStatementRep();
89
90 CQLSelectStatementRep& operator=(const CQLSelectStatementRep& cqlss);
91
|
92 humberto 1.1.2.1 /** Implements the evaluate method from the
93 base SelectStatement class.
94
95 */
96 Boolean evaluate(
97 /** The CIM instance that will be evaluated.
98 The CIMInstance object is not modified by this method.
99 */
|
100 chuck 1.1.2.3 const CIMInstance& inCI);
|
101 humberto 1.1.2.1
102
103 /** Implements the applyProjection method from the
104 base SelectStatement class.
105 */
|
106 chuck 1.1.2.3 void applyProjection(
|
107 humberto 1.1.2.1 /** Input the CIMInstance object in which to apply the
108 projection.
109 */
|
110 chuck 1.1.2.3 CIMInstance& inCI) throw(Exception);
|
111 humberto 1.1.2.1
112 /** Implements the validatedClass method from the
113 base SelectStatement class.
114 */
115 void validateClass(const CIMObjectPath& inClassName) throw(Exception);
116
117 /** Implements the validatedProperties method from the
118 base SelectStatement class.
119 */
120 void validateProperties() throw(Exception);
121
122 /** Returns an array of CIMObjectPath objects that are the
123 class paths from the select statement in the FROM list.
124 */
|
125 chuck 1.1.2.3 Array<CIMObjectPath> getClassPathList();
|
126 humberto 1.1.2.1
127 /** Returns the required properties from the combined SELECT and WHERE
128 clauses for the classname passed in.
129
130 If all the properties for the input classname are required, a null
131 CIMPropertyList is returned.
132 */
133 CIMPropertyList getPropertyList(
134 /** The input parameter className is one of the
135 classes from the FROM list.
136 */
137 const CIMObjectPath& inClassName);
138
139 /** Modifier. This method should not be called by the user (only by the
140 parser).
141 Appends a CQLIdentifier to an array of CIMObjectPaths from the FROM
142 statement.
143 */
144 void appendClassPath(
145 /**
146 */
147 humberto 1.1.2.1 const CQLIdentifier& inIdentifier);
148
149 /** Sets a predicate into this object. This method should only
150 be called by Bison.
151 */
152 void setPredicate(
153 // CQLOperation is an enum similar to the WQLOperation enum in CVS:
154 // enum CQLOperation
155 // {
156 // <,
157 // >,
158 // =,
159 // >=,
160 // <=,
161 // +,
162 // -,
163 // *,
164 // /,
165 // CQL_IS_NULL,
166 // CQL_IS_NOT_NULL,
167 // CQL_IS_A,
168 humberto 1.1.2.1 // CQL_LIKE
169 // };
170 CQLPredicate inPredicate);
171
172 /** This method calls QueryContext::insertClassPathAlias() to insert a
173 classpath-alias pair
174 into the hash table. The record is keyed by the class alias.
175
176 This method is used by Bison.
177
178 TODO: think about exceptions such as duplicate key.
179 */
180 void insertClassPathAlias(
181 /** The CQLIdentifier object that contains the class path.
182 */
183 const CQLIdentifier& inIdentifier,
184 /** The alias for the class.
185 */
186 String inAlias);
187
188 /** Appends a CQL chained identifier to the CQL identifier list. The user
189 humberto 1.1.2.1 should
190 not call this method; it should only be called by the Bison.
191 */
192 void appendSelectIdentifier(const CQLChainedIdentifier& x);
193
194 /** Appends a CQL Identifier to the where CQL identifier list. The user
195 should not call this method; it should only be called by Bison.
196
197 @param x the CQL identifier.
198 @return false if that identifier already exists.
199
200
201 Since the identifiers in the WHERE clause must be distinct,
202 a boolean is returned indicating if the identifier is not distinct.
203
204 TODO: THIS MAY BE NEEDED IN A FUTURE RELEASE.
205 NOT IMPLEMENTED IN PEGASUS V2.5
206 */
207 Boolean appendWhereIdentifier(
208 /** Input the chained CQL identifiers to append.
209 */
210 humberto 1.1.2.1 const CQLChainedIdentifier& x);
211
|
212 chuck 1.1.2.4 String toString();
213
214 void setHasWhereClause();
215
216 Boolean hasWhereClause();
217
218 void clear();
219
|
220 humberto 1.1.2.1 protected:
221 /**
222 // The list of CQL identifiers being selected. For example, see
223 "firstName",
224 // and "lastName" below.
225 //
226 // SELECT firstName, lastName
227 // FROM TargetClass
228 // WHERE ...
229 //
230 // NOTE: duplicate identifiers are not removed from the select list
231 // (e.g. SELECT firstName, firstName FROM...) results in a list of
232 // two identifiers
233 //
234
235 */
|
236 chuck 1.1.2.3 Array<CQLChainedIdentifier> _selectIdentifiers;
|
237 humberto 1.1.2.1
238 /**
239 // The unique list of CQL query identifiers appearing in the WHERE clause.
240 // Although a property may occur many times in the WHERE clause, it will
241 // only appear once in this list.
242 //
243
244 TODO: THIS MAY BE NEEDED IN A FUTURE RELEASE.
245 NOT IMPLEMENTED IN PEGASUS V2.5
246 */
|
247 chuck 1.1.2.3 Array<CQLChainedIdentifier> _whereIdentifiers;
|
248 humberto 1.1.2.1
|
249 chuck 1.1.2.4 Boolean _hasWhereClause;
250
|
251 humberto 1.1.2.1 private:
252 CQLPredicate _predicate;
253 };
254
255 PEGASUS_NAMESPACE_END
256
257 #endif
|