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