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

  1 karl  1.12 //%2005////////////////////////////////////////////////////////////////////////
  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 mike  1.2  //
 12            // Permission is hereby granted, free of charge, to any person obtaining a copy
 13 kumpf 1.4  // of this software and associated documentation files (the "Software"), to
 14            // deal in the Software without restriction, including without limitation the
 15            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 16 mike  1.2  // sell copies of the Software, and to permit persons to whom the Software is
 17            // furnished to do so, subject to the following conditions:
 18 david.dillard 1.14 //
 19 kumpf         1.4  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 20 mike          1.2  // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 21                    // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 22 kumpf         1.4  // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 23                    // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 24                    // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 25 mike          1.2  // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 26                    // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27                    //
 28                    //==============================================================================
 29                    //
 30                    // Author: Mike Brasher (mbrasher@bmc.com)
 31                    //
 32 kumpf         1.6  // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
 33 david.dillard 1.14 //                  (carolann_graves@hp.com)
 34                    //              David Dillard, VERITAS Software Corp.
 35                    //                  (david.dillard@veritas.com)
 36 mike          1.2  //
 37                    //%/////////////////////////////////////////////////////////////////////////////
 38                    
 39                    #ifndef Pegasus_WQLSelectStatement_h
 40                    #define Pegasus_WQLSelectStatement_h
 41                    
 42                    #include <Pegasus/Common/Config.h>
 43 chuck         1.11 #include <Pegasus/WQL/Linkage.h>
 44 kumpf         1.5  #include <Pegasus/Common/ArrayInternal.h>
 45 kumpf         1.6  #include <Pegasus/Common/CIMName.h>
 46                    #include <Pegasus/Common/CIMPropertyList.h>
 47 schuur        1.9  #include <Pegasus/Common/CIMInstance.h>
 48                    #include <Pegasus/Common/CIMObject.h>
 49 mike          1.2  #include <Pegasus/WQL/WQLOperation.h>
 50                    #include <Pegasus/WQL/WQLOperand.h>
 51                    #include <Pegasus/WQL/WQLPropertySource.h>
 52 chuck         1.11 #include <Pegasus/Query/QueryCommon/SelectStatement.h>
 53                    #include <Pegasus/Query/QueryCommon/QueryContext.h>
 54 mike          1.2  
 55                    PEGASUS_NAMESPACE_BEGIN
 56                    
 57 chuck         1.11 
 58                    class PEGASUS_WQL_LINKAGE WQLSelectStatementRep;
 59                    
 60 david.dillard 1.14 /** This class represents a compiled WQL1 select statement.
 61 mike          1.2  
 62                        An instance of WQLSelectStatement is passed to WQLParser::parse() which
 63                        parses the WQL1 SELECT statement and initializes the WQLSelectStatement
 64                        instance. A WQL1 SELECT statement has the following form:
 65                    
 66                        <pre>
 67                    	SELECT &lt;property&gt;...
 68                    	FROM &lt;class name&gt;
 69                    	WHERE &lt;where clause&gt;
 70                        </pre>
 71                    
 72                        There are methods for obtaining the various elements of the select
 73                        statement.
 74 david.dillard 1.14 
 75 mike          1.2      The components of the where clause are stored in two arrays: one for
 76                        operands and one for operators (these are placed in proper order by the
 77                        YACC parser). Evaluation is performed using a Boolean stack. See the
 78                        implementation of evaluateWhereClause() for details.
 79                    */
 80 chuck         1.11 class PEGASUS_WQL_LINKAGE WQLSelectStatement: public SelectStatement
 81 mike          1.2  {
 82                    public:
 83 david.dillard 1.14 
 84 chuck         1.11 
 85                        WQLSelectStatement(String& queryLang, String& query);
 86                    
 87                        WQLSelectStatement(String& queryLang, String& query, 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                    	parser).
111                        */
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                    	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 david.dillard   1.14     CIMPropertyList getSelectPropertyList
149 carolann.graves 1.13         (const CIMObjectPath& inClassName = CIMObjectPath ());
150 kumpf           1.6  
151                          /** Appends a property name to the property name list. The user should
152 mike            1.2  	not call this method; it should only be called by the parser.
153                          */
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 david.dillard   1.14     CIMPropertyList getWherePropertyList
177 carolann.graves 1.13         (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 mike            1.2  	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                          */
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                      	be called by the parser itself.
189                          */
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                      	be called by the parser itself.
194                          */
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 schuur          1.9      /** Inspect an instance and remove properties not listed in Select projection.
206 carolann.graves 1.13 
207                              @param  allowMissing  Boolean specifying whether missing project
208                                                    properties are allowed
209 david.dillard   1.14         @exception Exception
210 schuur          1.9      */
211 carolann.graves 1.13     void applyProjection(CIMInstance& inst,
212 david.dillard   1.14         Boolean allowMissing);
213 carolann.graves 1.13     void applyProjection(CIMObject& inst,
214                              Boolean allowMissing);
215 david.dillard   1.14 
216 mike            1.2      /** Prints out the members of this class.
217                          */
218                          void print() const;
219                      
220 schuur          1.9      static const WQLSelectStatement EMPTY;
221 chuck           1.11 
222                          Boolean evaluate(const CIMInstance& inCI);
223                      
224 david.dillard   1.14     void validate();
225 chuck           1.11 
226                          CIMPropertyList getPropertyList(const CIMObjectPath& inClassName = CIMObjectPath());
227                      
228                          Array<CIMObjectPath> getClassPathList();
229                      
230 mike            1.2  private:
231                      
232 chuck           1.11     WQLSelectStatementRep* _rep;
233 mike            1.2  
234 chuck           1.11     //void f() const { }
235 david.dillard   1.14 
236 schuur          1.8      friend class CMPI_Wql2Dnf;
237 mike            1.2  };
238                      
239                      PEGASUS_NAMESPACE_END
240                      
241                      #endif /* Pegasus_WQLSelectStatement_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2