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

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