12 humberto 1.1.2.2 PEGASUS_NAMESPACE_BEGIN
13
14 /**
15 This class is derived from the SelectStatement base class.
16 The purpose of this class is to perform the select statement operations for
17 CIM Query Language (CQL).
18
19 Notes on CQLSelectStatement class:
20
21 (A) Contains a CQLPredicate for the WHERE clause
22 (B) Contains an array of CQLIdentifiers for the SELECT projection
23 (C) Contains an array of classpaths from the FROM clause
24
25
26 */
27 class PEGASUS_CQL_LINKAGE CQLSelectStatement : public SelectStatement
28 {
29 public:
30 /** This is the constructor for the CQLSelectStatement object.
31 The ctor requires 3 parameters:
32 query language (qlang) which is CQL,
33 humberto 1.1.2.2 the query itself,
34 and the name of the CIM namespace.
35 */
36 CQLSelectStatement(
37 /** The query language is needed so the
38 base class can retrieve the query language.
39 The class member variable where this data
40 is stored is located in the base SelectStatement
41 class.
42 */
43 String inQlang,
44 /** input parameter containing the query string.
45 */
46 String inQuery,
47
48 QueryContext& inCtx);
49
50 /** Implements the evaluate method from the
51 base SelectStatement class.
52
53 */
54 humberto 1.1.2.2 Boolean evaluate(
55 /** The CIM instance that will be evaluated.
56 The CIMInstance object is not modified by this method.
57 */
58 CIMInstance const inCI);
59
60 /** Implements the executeQuery method from the
61 base SelectStatement class.
62 */
63 Array<CIMInstance> executeQuery(
64 /** Input parameter that is an array of CIM Instance objects on which
65 to execute the query.
66 */
67 Array<CIMInstance> inCIMInstanceArray) throw(Exception);
68
69 /** Implements the applyProjection method from the
70 base SelectStatement class.
71 */
72 CIMInstance applyProjection(
73 /** Input the CIMInstance object in which to apply the
74 projection.
75 humberto 1.1.2.2 */
76 CIMInstance inCI) throw(Exception);
77
78 /** Implements the validatedClass method from the
79 base SelectStatement class.
80 */
81 void validateClass(const CIMObjectPath& inClassName) throw(Exception);
82
83 /** Implements the validatedProperties method from the
84 base SelectStatement class.
85 */
86 void validateProperties() throw(Exception);
87
88 /** Returns an array of CIMObjectPath objects that are the
89 class paths from the select statement in the FROM list.
90 */
91 Array<CIMObjectPath> const getClassPathList();
92
93 /** Returns the required properties from the combined SELECT and WHERE
94 clauses for the classname passed in.
95
96 humberto 1.1.2.2 If all the properties for the input classname are required, a null
97 CIMPropertyList is returned.
98 */
99 CIMPropertyList getPropertyList(
100 /** The input parameter className is one of the
101 classes from the FROM list.
102 */
103 const CIMObjectPath& inClassName);
104
105 /** Modifier. This method should not be called by the user (only by the
106 parser).
107 Appends a CQLIdentifier to an array of CIMObjectPaths from the FROM
108 statement.
109 */
110 void appendClassPath(
111 /**
112 */
113 const CQLIdentifier& inIdentifier);
114
115 /** Sets a predicate into this object. This method should only
116 be called by Bison.
117 humberto 1.1.2.2 */
118 void setPredicate(
119 // CQLOperation is an enum similar to the WQLOperation enum in CVS:
120 // enum CQLOperation
121 // {
122 // <,
123 // >,
124 // =,
125 // >=,
126 // <=,
127 // +,
128 // -,
129 // *,
130 // /,
131 // CQL_IS_NULL,
132 // CQL_IS_NOT_NULL,
133 // CQL_IS_A,
134 // CQL_LIKE
135 // };
136 CQLPredicate inPredicate);
137
138 humberto 1.1.2.2 /** This method calls QueryContext::insertClassPathAlias() to insert a
139 classpath-alias pair
140 into the hash table. The record is keyed by the class alias.
141
142 This method is used by Bison.
143
144 TODO: think about exceptions such as duplicate key.
145 */
146 void insertClassPathAlias(
147 /** The CQLIdentifier object that contains the class path.
148 */
149 const CQLIdentifier& inIdentifier,
150 /** The alias for the class.
151 */
152 String inAlias);
153
154 /** Appends a CQL chained identifier to the CQL identifier list. The user
155 should
156 not call this method; it should only be called by the Bison.
157 */
158 void appendSelectIdentifier(const CQLChainedIdentifier& x);
159 humberto 1.1.2.2
160 /** Appends a CQL Identifier to the where CQL identifier list. The user
161 should not call this method; it should only be called by Bison.
162
163 @param x the CQL identifier.
164 @return false if that identifier already exists.
165
166
167 Since the identifiers in the WHERE clause must be distinct,
168 a boolean is returned indicating if the identifier is not distinct.
169
170 TODO: THIS MAY BE NEEDED IN A FUTURE RELEASE.
171 NOT IMPLEMENTED IN PEGASUS V2.5
172 */
173 //##ModelId=40F42AED028E
174 Boolean appendWhereIdentifier(
175 /** Input the chained CQL identifiers to append.
176 */
177 const CQLChainedIdentifier& x);
178
179 protected:
180 humberto 1.1.2.2 /**
181 // The list of CQL identifiers being selected. For example, see
182 "firstName",
183 // and "lastName" below.
184 //
185 // SELECT firstName, lastName
186 // FROM TargetClass
187 // WHERE ...
188 //
189 // NOTE: duplicate identifiers are not removed from the select list
190 // (e.g. SELECT firstName, firstName FROM...) results in a list of
191 // two identifiers
192 //
193
194 */
195 Array<CQLIdentifier> _selectIdentifiers;
196
197 /**
198 // The unique list of CQL query identifiers appearing in the WHERE clause.
199 // Although a property may occur many times in the WHERE clause, it will
200 // only appear once in this list.
201 humberto 1.1.2.2 //
202
203 TODO: THIS MAY BE NEEDED IN A FUTURE RELEASE.
204 NOT IMPLEMENTED IN PEGASUS V2.5
205 */
206 Array<CQLIdentifier> _whereIdentifiers;
207
208 private:
209 CQLPredicate _predicate;
210
211 };
212
213 PEGASUS_NAMESPACE_END
214
215 #endif
|