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

  1 martin 1.20 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.21 //
  3 martin 1.20 // 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.21 //
 10 martin 1.20 // 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.21 //
 17 martin 1.20 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.21 //
 20 martin 1.20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.21 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.20 // 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.21 //
 28 martin 1.20 //////////////////////////////////////////////////////////////////////////
 29 mike   1.2  //
 30             //
 31             //%/////////////////////////////////////////////////////////////////////////////
 32             
 33             #ifndef Pegasus_WQLSelectStatement_h
 34             #define Pegasus_WQLSelectStatement_h
 35             
 36             #include <Pegasus/Common/Config.h>
 37 chuck  1.11 #include <Pegasus/WQL/Linkage.h>
 38 kumpf  1.5  #include <Pegasus/Common/ArrayInternal.h>
 39 kumpf  1.6  #include <Pegasus/Common/CIMName.h>
 40             #include <Pegasus/Common/CIMPropertyList.h>
 41 schuur 1.9  #include <Pegasus/Common/CIMInstance.h>
 42             #include <Pegasus/Common/CIMObject.h>
 43 mike   1.2  #include <Pegasus/WQL/WQLOperation.h>
 44             #include <Pegasus/WQL/WQLOperand.h>
 45             #include <Pegasus/WQL/WQLPropertySource.h>
 46 chuck  1.11 #include <Pegasus/Query/QueryCommon/SelectStatement.h>
 47             #include <Pegasus/Query/QueryCommon/QueryContext.h>
 48 mike   1.2  
 49             PEGASUS_NAMESPACE_BEGIN
 50             
 51 chuck  1.11 
 52 mike   1.16 class WQLSelectStatementRep;
 53 chuck  1.11 
 54 david.dillard 1.14 /** This class represents a compiled WQL1 select statement.
 55 mike          1.2  
 56                        An instance of WQLSelectStatement is passed to WQLParser::parse() which
 57                        parses the WQL1 SELECT statement and initializes the WQLSelectStatement
 58                        instance. A WQL1 SELECT statement has the following form:
 59                    
 60                        <pre>
 61 karl          1.17         SELECT &lt;property&gt;...
 62                            FROM &lt;class name&gt;
 63                            WHERE &lt;where clause&gt;
 64 mike          1.2      </pre>
 65                    
 66                        There are methods for obtaining the various elements of the select
 67                        statement.
 68 david.dillard 1.14 
 69 mike          1.2      The components of the where clause are stored in two arrays: one for
 70                        operands and one for operators (these are placed in proper order by the
 71                        YACC parser). Evaluation is performed using a Boolean stack. See the
 72                        implementation of evaluateWhereClause() for details.
 73                    */
 74 chuck         1.11 class PEGASUS_WQL_LINKAGE WQLSelectStatement: public SelectStatement
 75 mike          1.2  {
 76                    public:
 77 david.dillard 1.14 
 78 kumpf         1.19     WQLSelectStatement(
 79                            const String& queryLang,
 80                            const String& query);
 81                    
 82                        WQLSelectStatement(
 83                            const String& queryLang,
 84                            const String& query,
 85                            const QueryContext& inCtx);
 86 mike          1.2  
 87 david.dillard 1.14     /** Default constructor.
 88 mike          1.2      */
 89                        WQLSelectStatement();
 90                    
 91 chuck         1.11     WQLSelectStatement(const WQLSelectStatement& statement);
 92                    
 93 mike          1.2      /** Destructor.
 94                        */
 95                        ~WQLSelectStatement();
 96                    
 97 chuck         1.11     WQLSelectStatement& operator=(const WQLSelectStatement& rhs);
 98                    
 99 mike          1.2      /** Clears all data members of this object.
100                        */
101                        void clear();
102                    
103                        /** Accessor.
104                        */
105 chuck         1.11     const CIMName& getClassName() const;
106 mike          1.2  
107                        /** Modifier. This method should not be called by the user (only by the
108 karl          1.17     parser).
109 mike          1.2      */
110 chuck         1.11     void setClassName(const CIMName& className);
111 mike          1.2  
112 david.dillard 1.14     /**
113 kumpf         1.6          Returns true if the query selects all properties ("*")
114                        */
115                        Boolean getAllProperties() const;
116                    
117 david.dillard 1.14     /**
118 kumpf         1.6          Used by the parser to indicate the query selects all properties ("*")
119                            This method should not be called by the user (only by the parser).
120                        */
121                        void setAllProperties(const Boolean allProperties);
122                    
123 mike          1.2      /** Returns the number of property names which were indicated in the
124 karl          1.17     selection list.
125 kumpf         1.6          This function should only be used if getAllProperties() returns false.
126 mike          1.2      */
127 chuck         1.11     Uint32 getSelectPropertyNameCount() const;
128 mike          1.2  
129                        /** Gets the i-th selected property name in the list.
130 kumpf         1.6          This function should only be used if getAllProperties() returns false.
131 mike          1.2      */
132 chuck         1.11     const CIMName& getSelectPropertyName(Uint32 i) const;
133 mike          1.2  
134 david.dillard 1.14     /**
135 carolann.graves 1.13         Returns the required properties from the SELECT clause for the specified
136                              class.
137                      
138                              @param  inClassName  name of the class; must be one of the classes from
139                                                   the FROM clause
140                      
141                              @return  CIMPropertyList containing the required properties from the
142                                       SELECT clause for the specified class;
143                                       or a null CIMPropertyList if all properties of the specified
144                                       class are required
145 kumpf           1.6      */
146 kumpf           1.18     CIMPropertyList getSelectPropertyList(
147                              const CIMObjectPath& inClassName = CIMObjectPath());
148 kumpf           1.6  
149                          /** Appends a property name to the property name list. The user should
150 karl            1.17         not call this method; it should only be called by the parser.
151 mike            1.2      */
152 chuck           1.11     void appendSelectPropertyName(const CIMName& x);
153 mike            1.2  
154                          /** Returns the number of unique property names from the where clause.
155                          */
156 chuck           1.11     Uint32 getWherePropertyNameCount() const;
157 mike            1.2  
158                          /** Gets the i-th unique property appearing in the where clause.
159                          */
160 chuck           1.11     const CIMName& getWherePropertyName(Uint32 i) const;
161 mike            1.2  
162 david.dillard   1.14     /**
163 carolann.graves 1.13         Returns the required properties from the WHERE clause for the specified
164                              class.
165                      
166                              @param  inClassName  name of the class; must be one of the classes from
167                                                   the FROM clause
168                      
169                              @return  CIMPropertyList containing the required properties from the
170                                       WHERE clause for the specified class;
171                                       or a null CIMPropertyList if all properties of the specified
172                                       class are required
173 kumpf           1.6      */
174 kumpf           1.18     CIMPropertyList getWherePropertyList(
175                              const CIMObjectPath& inClassName = CIMObjectPath());
176 kumpf           1.6  
177 david.dillard   1.14     /** Appends a property name to the where property name list. The user
178 karl            1.17         should not call this method; it should only be called by the parser.
179 kumpf           1.22 
180 karl            1.17         @param x name of the property.
181                              @return false if a property with that name already exists.
182 mike            1.2      */
183 kumpf           1.6      Boolean appendWherePropertyName(const CIMName& x);
184 mike            1.2  
185                          /** Appends an operation to the operation array. This method should only
186 karl            1.17         be called by the parser itself.
187 mike            1.2      */
188 chuck           1.11     void appendOperation(WQLOperation x);
189 mike            1.2  
190                          /** Appends an operand to the operation array. This method should only
191 karl            1.17         be called by the parser itself.
192 mike            1.2      */
193 chuck           1.11     void appendOperand(const WQLOperand& x);
194 mike            1.2  
195                          /** Returns true if this class has a where clause.
196                          */
197 chuck           1.11     Boolean hasWhereClause() const;
198 mike            1.2  
199                          /** Evalautes the where clause using the symbol table to resolve symbols.
200                          */
201                          Boolean evaluateWhereClause(const WQLPropertySource* source) const;
202                      
203 karl            1.17     /** Inspect an instance and remove properties not listed in Select
204                              projection.
205 carolann.graves 1.13 
206                              @param  allowMissing  Boolean specifying whether missing project
207                                                    properties are allowed
208 david.dillard   1.14         @exception Exception
209 schuur          1.9      */
210 kumpf           1.18     void applyProjection(
211                              CIMInstance& inst,
212 david.dillard   1.14         Boolean allowMissing);
213 kumpf           1.18     void applyProjection(
214                              CIMObject& inst,
215 carolann.graves 1.13         Boolean allowMissing);
216 david.dillard   1.14 
217 mike            1.2      /** Prints out the members of this class.
218                          */
219                          void print() const;
220                      
221 schuur          1.9      static const WQLSelectStatement EMPTY;
222 chuck           1.11 
223                          Boolean evaluate(const CIMInstance& inCI);
224                      
225 david.dillard   1.14     void validate();
226 chuck           1.11 
227 karl            1.17     CIMPropertyList getPropertyList(
228                              const CIMObjectPath& inClassName = CIMObjectPath());
229 chuck           1.11 
230 kumpf           1.18     Array<CIMObjectPath> getClassPathList() const;
231 chuck           1.11 
232 mike            1.2  private:
233                      
234 chuck           1.11     WQLSelectStatementRep* _rep;
235 mike            1.2  
236 chuck           1.11     //void f() const { }
237 david.dillard   1.14 
238 schuur          1.8      friend class CMPI_Wql2Dnf;
239 mike            1.2  };
240                      
241                      PEGASUS_NAMESPACE_END
242                      
243                      #endif /* Pegasus_WQLSelectStatement_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2