(file) Return to CQLSelectStatement.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / CQL

  1 karl  1.8 //%2006////////////////////////////////////////////////////////////////////////
  2 chuck 1.2 //
  3 karl  1.4 // 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 chuck 1.2 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.4 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8           // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9           // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10           // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.8 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12           // EMC Corporation; Symantec Corporation; The Open Group.
 13 chuck 1.2 //
 14           // Permission is hereby granted, free of charge, to any person obtaining a copy
 15           // of this software and associated documentation files (the "Software"), to
 16           // deal in the Software without restriction, including without limitation the
 17           // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 18           // sell copies of the Software, and to permit persons to whom the Software is
 19           // furnished to do so, subject to the following conditions:
 20 karl  1.8 // 
 21 chuck 1.2 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22           // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 23           // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 24           // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 25           // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 26           // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 27           // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 28           // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 29           //
 30           //==============================================================================
 31           //
 32           // Authors: David Rosckes (rosckes@us.ibm.com)
 33           //          Bert Rivero (hurivero@us.ibm.com)
 34           //          Chuck Carmack (carmack@us.ibm.com)
 35           //          Brian Lucier (lucier@us.ibm.com)
 36           //
 37 david.dillard 1.6 // Modified By: David Dillard, VERITAS Software Corp.
 38                   //                  (david.dillard@veritas.com)
 39 chuck         1.2 //
 40                   //%/////////////////////////////////////////////////////////////////////////////
 41                   
 42                   #ifndef Pegasus_CQLSelectStatement_h
 43                   #define Pegasus_CQLSelectStatement_h
 44                   
 45 david.dillard 1.7 #include <Pegasus/CQL/Linkage.h>
 46 chuck         1.2 #include <Pegasus/Common/AutoPtr.h>
 47                   #include <Pegasus/Query/QueryCommon/SelectStatement.h>
 48                   #include <Pegasus/CQL/CQLChainedIdentifier.h>
 49                   #include <Pegasus/CQL/CQLPredicate.h>
 50                   #include <Pegasus/CQL/CQLIdentifier.h>
 51                   
 52                   
 53                   #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
 54                   
 55                   PEGASUS_NAMESPACE_BEGIN
 56                   
 57                   class PEGASUS_CQL_LINKAGE CQLSelectStatementRep;
 58                   
 59 david.dillard 1.6 /**
 60                   This class is derived from the SelectStatement base class.
 61 chuck         1.2 The purpose of this class is to perform the select statement operations for
 62 david.dillard 1.6 CIM Query Language (CQL).
 63 chuck         1.3 */
 64 chuck         1.2 class PEGASUS_CQL_LINKAGE CQLSelectStatement : public SelectStatement
 65                   {
 66                     public:
 67 chuck         1.3 
 68 david.dillard 1.6     /**
 69 chuck         1.3       Constructs a CQLSelectStatement default object.
 70 david.dillard 1.6 
 71 chuck         1.3       @param  - None.
 72                         @return - None.
 73                         @throw  - None.
 74                   
 75                         <I><B>Experimental Interface</B></I><BR>
 76                       */
 77 chuck         1.2     CQLSelectStatement();
 78                   
 79 david.dillard 1.6     /**
 80 chuck         1.3       Constructs a CQLSelectStatement object.
 81 david.dillard 1.6 
 82 chuck         1.3       @param  inQlang - String containing the language of the query.
 83                         @param  inQuery - String containing the query.
 84                         @param  inCtx - Context in which the select statement is running.
 85                         @return - None.
 86                         @throw  - None.
 87                   
 88                         <I><B>Experimental Interface</B></I><BR>
 89                       */
 90 david.dillard 1.6     CQLSelectStatement(String& inQlang,
 91                                          String& inQuery,
 92 chuck         1.3                        QueryContext& inCtx);
 93                   
 94 david.dillard 1.6     /**
 95 chuck         1.3       Constructs a CQLSelectStatement object.
 96 david.dillard 1.6 
 97 chuck         1.3       @param  inQlang - String containing the language of the query.
 98                         @param  inQuery - String containing the query.
 99                         @return - None.
100                         @throw  - None.
101 chuck         1.2 
102 chuck         1.3       <I><B>Experimental Interface</B></I><BR>
103                       */
104 chuck         1.2     CQLSelectStatement(String& inQLang, String& inQuery);
105                   
106 david.dillard 1.6     /**
107 chuck         1.3       Copy constructs a CQLSelectStatement object.
108 david.dillard 1.6 
109 chuck         1.3       @param  statement - CQLSelectStatement to be copied.
110                         @return - None.
111                         @throw  - None.
112                   
113                         <I><B>Experimental Interface</B></I><BR>
114                       */
115 chuck         1.2     CQLSelectStatement(const CQLSelectStatement& statement);
116                   
117 david.dillard 1.6     /**
118 chuck         1.3       Destructs a CQLSelectStatement object.
119 david.dillard 1.6 
120 chuck         1.3       @param  - None.
121                         @return - None.
122                         @throw  - None.
123                   
124                         <I><B>Experimental Interface</B></I><BR>
125                       */
126 chuck         1.2     ~CQLSelectStatement();
127                   
128 david.dillard 1.6     /**
129 chuck         1.3       Assigns a CQLSelectStatement to this object.
130 david.dillard 1.6 
131 chuck         1.3       @param rhs - CQLSelectStatement to be assigned to this object.
132                         @return - Updated this object.
133                         @throw  - None.
134                   
135                         <I><B>Experimental Interface</B></I><BR>
136                       */
137 chuck         1.2     CQLSelectStatement& operator=(const CQLSelectStatement& rhs);
138                   
139 chuck         1.3     /**
140 david.dillard 1.6       Applies the class contexts from the FROM list to the
141 chuck         1.3       chained identifiers in the statement. This will transform
142                         each chained identifier into a normalized form.  The FROM
143                         classname is prepended if needed, and all class aliases are resolved.
144                   
145                         Note: there are cases where the FROM classname is not prepended.
146 david.dillard 1.6       This can occur for the classname on the right side of ISA,
147 chuck         1.3       or the classname at the beginning of a symbolic constant chained
148                         identifier.  Neither of these classnames need to be the FROM class.
149 david.dillard 1.6 
150 chuck         1.3       This function also validates that each chained identifier
151 david.dillard 1.6       is well-formed.  It is possible for a chained identifier
152 chuck         1.3       to be syntactically correct in the CQL language, but
153 david.dillard 1.6       cannot be processed by the CQL engine.
154                   
155 chuck         1.3       Pre-condition: QueryContext has been set into this object.
156                         Post-condition: Chained identifiers have been normalized.
157                   
158                         @param None.
159                         @return None
160                         @throw CQLRuntimeException if the QueryContext had not been set.
161                         @throw CQLValidationException if a chained identifier is not well formed.
162                         @throw CQLSyntaxErrorException if a chained identifier is not well formed.
163                   
164                         <I><B>Experimental Interface</B></I><BR>
165                        */
166                       void applyContext();
167 chuck         1.2 
168 david.dillard 1.6     /**
169 chuck         1.3       Evaluates the WHERE clause of the select statement using
170                         a CIM instance as the source of properties.
171                   
172                         Pre-condition: QueryContext has been set into this object.
173 david.dillard 1.6       Post-condition: Chained identifiers have been normalized
174 chuck         1.3       ie.applyContext has been called.  See the applyContext function.
175 david.dillard 1.6 
176 chuck         1.3       @param inCI - The instance to be evaluated.
177                         @return True, if the WHERE clause evaluates to true based on
178                                 the type of the instance and its properties.
179                         @throw CQLRuntimeException if the instance cannot be evaluated
180                         @throw CQLValidationException for applyContext error.
181                         @throw CQLSyntaxErrorException for applyContext error.
182                   
183                         <I><B>Experimental Interface</B></I><BR>
184                       */
185                       Boolean evaluate(const CIMInstance& inCI);
186                   
187                       /**
188                         Projects the properties in the SELECT list of the select
189                         statement onto the instance.  This involves checking that
190 david.dillard 1.6       all required properties exist on the instance passed in,
191 chuck         1.3       and removing any unneeded properties from that instance.
192                   
193                         Pre-condition: QueryContext has been set into this object.
194 david.dillard 1.6       Post-condition: Chained identifiers have been normalized
195 chuck         1.3       ie.applyContext has been called.  See the applyContext function.
196                   
197                         @param inCI - The instance to be projected.
198 david.dillard 1.6       @param allowMissing indicates whether missing project properties are
199 carolann.graves 1.5                           allowed
200 chuck           1.3       @return None
201                           @throw  CQLRuntimeException if the instance cannot be projected
202                           @throw CQLValidationException for applyContext error.
203                           @throw CQLSyntaxErrorException for applyContext error.
204                     
205                           <I><B>Experimental Interface</B></I><BR>
206                         */
207 david.dillard   1.6     void applyProjection(CIMInstance& inCI, Boolean allowMissing);
208 chuck           1.3 
209 david.dillard   1.6     /**
210 chuck           1.3       Validates the classes and properties used in the select statement
211                           against the class schema.  The existence of classes and properties
212                           are checked, along with class relationships defined in the CQL
213                           specification.
214                     
215                           Pre-condition: QueryContext has been set into this object.
216 david.dillard   1.6       Post-condition: Chained identifiers have been normalized
217 chuck           1.3       ie.applyContext has been called.  See the applyContext function.
218                     
219 david.dillard   1.6       @param None
220 chuck           1.3       @return None
221 david.dillard   1.6       @throw CQLValidationException for applyContext error, the select
222 chuck           1.3       statement is invalid against the schema, or the QueryContext has
223                           not been set.
224                           @throw CQLSyntaxErrorException for applyContext error.
225                     
226                           <I><B>Experimental Interface</B></I><BR>
227                         */
228 david.dillard   1.6     void validate();
229 chuck           1.2 
230 chuck           1.3     /**
231 david.dillard   1.6       Normalizes the predicates in the WHERE clause to a
232 chuck           1.3       disjunction of conjunctions.
233 chuck           1.2 
234 david.dillard   1.6       Post-condition: Chained identifiers have been normalized
235 chuck           1.3       ie.applyContext has been called.  See the applyContext function.
236 chuck           1.2 
237 david.dillard   1.6       @param None
238 chuck           1.3       @return None
239 david.dillard   1.6       @throw None
240 chuck           1.2 
241 chuck           1.3       <I><B>Experimental Interface</B></I><BR>
242                          */
243                         void normalizeToDOC();
244 chuck           1.2 
245 david.dillard   1.6     /**
246                           Returns an array of CIMObjectPath objects that are the
247 chuck           1.3       class paths in the FROM list of the select statement.
248 chuck           1.2 
249 chuck           1.3       Note:  Currently CQL only supports one class path in the
250                           FROM list.  This class path does not support WBEM-URI, so that
251                           only the namespace and classname parts are filled in.
252 chuck           1.2 
253 chuck           1.3       Pre-condition: QueryContext has been set into this object.
254 chuck           1.2 
255 david.dillard   1.6       @param None
256 chuck           1.3       @return Array of FROM list class paths.
257                           @throw CQLRuntimeException if the QueryContext had not been set.
258 chuck           1.2 
259 chuck           1.3       <I><B>Experimental Interface</B></I><BR>
260                          */
261                         Array<CIMObjectPath> getClassPathList();
262 chuck           1.2 
263 david.dillard   1.6     /**
264 chuck           1.3       Returns the required properties from the combined SELECT and WHERE
265                           clauses for the classname passed in.  The classname parameter is
266                           needed in case scoping operators are used in the select statement.
267                           This function does not return properties for the classname if they
268                           are required on embedded objects.  This function does not return
269                           required array indices.
270 david.dillard   1.6 
271 chuck           1.3       Pre-condition: QueryContext has been set into this object.
272 david.dillard   1.6       Post-condition: Chained identifiers have been normalized
273 chuck           1.3       ie.applyContext has been called.  See the applyContext function.
274                     
275                           @param inClassName - class to determine the required properties.  Defaults
276                           to the FROM class.
277                           @return CIMPropertyList containing the required properties for the class.
278                           If all the properties are required, a null CIMPropertyList is returned.
279                           If no properties are required, an empty CIMPropertyList is returned.
280                           @throw CQLRuntimeException if the QueryContext had not been set.
281                           @throw CQLValidationException for applyContext error.
282                           @throw CQLSyntaxErrorException for applyContext error.
283                     
284                           <I><B>Experimental Interface</B></I><BR>
285                         */
286                         CIMPropertyList getPropertyList(const CIMObjectPath& inClassName = CIMObjectPath());
287                     
288 david.dillard   1.6     /**
289 chuck           1.3       Returns the required properties from the SELECT clause for the
290                           classname passed in.  The classname parameter is needed in case
291                           scoping operators are used in the select statement.  This function
292                           does not return properties for the classname if they are required
293                           on embedded objects. This function does not return required array indices.
294 david.dillard   1.6 
295 chuck           1.3       Pre-condition: QueryContext has been set into this object.
296 david.dillard   1.6       Post-condition: Chained identifiers have been normalized
297 chuck           1.3       ie.applyContext has been called.  See the applyContext function.
298                     
299                           @param inClassName - class to determine the required properties.  Defaults
300                           to the FROM class.
301                           @return CIMPropertyList containing the required properties for the class.
302                           If all the properties are required, a null CIMPropertyList is returned.
303                           If no properties are required, an empty CIMPropertyList is returned.
304                           @throw CQLRuntimeException if the QueryContext had not been set.
305                           @throw CQLValidationException for applyContext error.
306                           @throw CQLSyntaxErrorException for applyContext error.
307                     
308                           <I><B>Experimental Interface</B></I><BR>
309                         */
310                         CIMPropertyList getSelectPropertyList(const CIMObjectPath& inClassName = CIMObjectPath());
311                     
312 david.dillard   1.6     /**
313 chuck           1.3       Returns the required properties from the WHERE clause for the
314                           classname passed in.  The classname parameter is needed in case
315                           scoping operators are used in the select statement.  This function
316                           does not return properties for the classname if they are required
317                           on embedded objects.  This function does not return required array indices.
318 david.dillard   1.6 
319 chuck           1.3       Pre-condition: QueryContext has been set into this object.
320 david.dillard   1.6       Post-condition: Chained identifiers have been normalized
321 chuck           1.3       ie.applyContext has been called.  See the applyContext function.
322                     
323                           @param inClassName - class to determine the required properties.  Defaults
324                           to the FROM class.
325                           @return CIMPropertyList containing the required properties for the class.
326                           If all the properties are required, a null CIMPropertyList is returned.
327                           If no properties are required, an empty CIMPropertyList is returned.
328                           @throw CQLRuntimeException if the QueryContext had not been set.
329                           @throw CQLValidationException for applyContext error.
330                           @throw CQLSyntaxErrorException for applyContext error.
331                     
332                           <I><B>Experimental Interface</B></I><BR>
333                         */
334                         CIMPropertyList getWherePropertyList(const CIMObjectPath& inClassName = CIMObjectPath());
335 chuck           1.2 
336                         /**
337 chuck           1.3       Returns the chained identifiers from the SELECT clause.  These chained
338                           identifiers contain the fully qualified property names, including embedded
339                           objects, array indices, scoping operators, and symbolic constants.
340                     
341 david.dillard   1.6       Post-condition: Chained identifiers have been normalized
342 chuck           1.3       ie.applyContext has been called.  See the applyContext function.
343                     
344                           @param None
345                           @return Array of chained identifiers.
346                           @throw CQLValidationException for applyContext error.
347                           @throw CQLSyntaxErrorException for applyContext error.
348                     
349                           <I><B>Experimental Interface</B></I><BR>
350 chuck           1.2      */
351 chuck           1.3     Array<CQLChainedIdentifier> getSelectChainedIdentifiers();
352 chuck           1.2 
353                         /**
354 chuck           1.3       Returns the chained identifiers from the WHERE clause.  These chained
355                           identifiers contain the fully qualified property names, including embedded
356                           objects, array indices, scoping operators, and symbolic constants.
357                     
358                           Pre-condition: QueryContext has been set into this object.
359 david.dillard   1.6       Post-condition: Chained identifiers have been normalized
360 chuck           1.3       ie.applyContext has been called.  See the applyContext function.
361                     
362                           @param None
363                           @return Array of chained identifiers.
364                           @throw CQLRuntimeException if the QueryContext had not been set.
365 david.dillard   1.6       @throw CQLValidationException for applyContext error.
366 chuck           1.3       @throw CQLSyntaxErrorException for applyContext error.
367                     
368                           <I><B>Experimental Interface</B></I><BR>
369 chuck           1.2      */
370 chuck           1.3     Array<CQLChainedIdentifier> getWhereChainedIdentifiers();
371                     
372 david.dillard   1.6     /**
373 chuck           1.3       Gets the top-level CQLPredicate of this object.
374                           This is the predicate that contains the top-level
375                           of any nested boolean operations in the WHERE clause.
376                     
377                           @param None.
378                           @return Top-level predicate
379                           @throw None.
380                     
381                           <I><B>Experimental Interface</B></I><BR>
382                         */
383                         CQLPredicate getPredicate() const;
384                     
385 david.dillard   1.6     /**
386 chuck           1.3       Determines whether the select statement has a WHERE clause.
387 chuck           1.2 
388 chuck           1.3       @param None
389                           @return True if there is a WHERE clause.
390                           @throw None
391 chuck           1.2 
392 chuck           1.3       <I><B>Experimental Interface</B></I><BR>
393                         */
394 chuck           1.2     Boolean hasWhereClause();
395                     
396 david.dillard   1.6     /**
397 chuck           1.3       Returns the select statement in string form.
398                           Note that this can be different than the original
399                           statement after it has been parsed, and applyContext
400                           has been called.
401                     
402                           Pre-condition: QueryContext has been set into this object.
403                     
404                           @param None
405                           @return String containing the select statement.
406 david.dillard   1.6       @throw
407 chuck           1.3 
408                           <I><B>Experimental Interface</B></I><BR>
409                         */
410 chuck           1.2     String toString();
411                     
412 david.dillard   1.6     /*
413 chuck           1.3        ATTN - the following methods should only be set by CQLParser.
414                            These should be made private, and CQLParser made a friend.
415                         */
416                     
417 david.dillard   1.6     /**
418 chuck           1.3       Appends a CQLIdentifier/alias combination into the FROM list of the
419                           statement. This method should only be called by the CQL parser.
420                     
421                           @param inIdentifier - CQLIdentifier to append.
422                           @param inAlias - Alias of the identifier.
423                           @return None
424                           @throw QueryException if the identifier/alias cannot be appended.
425                     
426                           <I><B>Experimental Interface</B></I><BR>
427                         */
428 david.dillard   1.6     void insertClassPathAlias(const CQLIdentifier& inIdentifier,
429 chuck           1.3                               String inAlias);
430                     
431 david.dillard   1.6     /**
432 chuck           1.3       Appends a CQLIdentifier into the FROM list of the statement.
433                           This method should only be called by the CQL parser.
434                     
435                           @param inIdentifier - CQLIdentifier to append.
436                           @return None
437                           @throw QueryException if the identifier cannot be appended.
438                     
439                           <I><B>Experimental Interface</B></I><BR>
440                         */
441                         void appendClassPath(const CQLIdentifier& inIdentifier);
442                     
443 david.dillard   1.6     /**
444 chuck           1.3       Appends a CQLChainedIdentifier to the select list.
445                           This method should only be called by the CQL parser.
446                     
447                           @param x - CQLChainedIdentifier to append.
448                           @return None
449                           @throw None
450                     
451                           <I><B>Experimental Interface</B></I><BR>
452                         */
453                         void appendSelectIdentifier(const CQLChainedIdentifier& x);
454                     
455                         /** Sets a predicate into this object. This method should only
456                                 be called by Bison.
457                             */
458 david.dillard   1.6     /**
459 chuck           1.3       Sets the top-level CQLPredicate into this object.
460                           This method should only be called by the CQL parser.
461                     
462                           @param Predicate to set into this object.
463                           @return None
464                           @throw None.
465                     
466                           <I><B>Experimental Interface</B></I><BR>
467                         */
468                         void setPredicate(const CQLPredicate& inPredicate);
469                     
470 david.dillard   1.6     /**
471 chuck           1.3       Sets the select statement to have a WHERE clause.
472                           This method should only be called by the CQL parser.
473                     
474                           @param None
475                           @return None
476                           @throw None
477                     
478                           <I><B>Experimental Interface</B></I><BR>
479                         */
480                         void setHasWhereClause();
481                     
482 david.dillard   1.6     /**
483 chuck           1.3       Clears the internal data structures.
484                           This method should only be called by the CQL parser.
485                     
486                           Pre-condition: QueryContext has been set into this object.
487                     
488                           @param None
489                           @return None.
490 david.dillard   1.6       @throw CQLRuntimeException if the QueryContext had not been set.
491 chuck           1.3 
492                           <I><B>Experimental Interface</B></I><BR>
493                         */
494 chuck           1.2     void clear();
495                     
496                       private:
497 david.dillard   1.6     CQLSelectStatementRep* _rep;
498 chuck           1.2 
499                     };
500                     
501                     PEGASUS_NAMESPACE_END
502                     #endif
503 david.dillard   1.6 #endif

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2