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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2