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

  1 karl  1.10 //%2004////////////////////////////////////////////////////////////////////////
  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 mike  1.2  //
 10            // Permission is hereby granted, free of charge, to any person obtaining a copy
 11 kumpf 1.4  // of this software and associated documentation files (the "Software"), to
 12            // deal in the Software without restriction, including without limitation the
 13            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 14 mike  1.2  // sell copies of the Software, and to permit persons to whom the Software is
 15            // furnished to do so, subject to the following conditions:
 16            // 
 17 kumpf 1.4  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 18 mike  1.2  // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 19            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 20 kumpf 1.4  // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 21            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 22            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 23 mike  1.2  // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 24            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 25            //
 26            //==============================================================================
 27            //
 28            // Author: Mike Brasher (mbrasher@bmc.com)
 29            //
 30 kumpf 1.6  // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
 31            //                (carolann_graves@hp.com)
 32 mike  1.2  //
 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             class PEGASUS_WQL_LINKAGE WQLSelectStatementRep;
 55             
 56 mike   1.2  /** This class represents a compiled WQL1 select statement. 
 57             
 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             	SELECT &lt;property&gt;...
 64             	FROM &lt;class name&gt;
 65             	WHERE &lt;where clause&gt;
 66                 </pre>
 67             
 68                 There are methods for obtaining the various elements of the select
 69                 statement.
 70                 
 71                 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 chuck  1.11 	
 80             
 81                 WQLSelectStatement(String& queryLang, String& query);
 82             
 83                 WQLSelectStatement(String& queryLang, String& query, QueryContext& inCtx);
 84 mike   1.2  
 85                 /** Default constructor. 
 86                 */
 87                 WQLSelectStatement();
 88             
 89 chuck  1.11     WQLSelectStatement(const WQLSelectStatement& statement);
 90             
 91 mike   1.2      /** Destructor.
 92                 */
 93                 ~WQLSelectStatement();
 94             
 95 chuck  1.11     WQLSelectStatement& operator=(const WQLSelectStatement& rhs);
 96             
 97 mike   1.2      /** Clears all data members of this object.
 98                 */
 99                 void clear();
100             
101                 /** Accessor.
102                 */
103 chuck  1.11     const CIMName& getClassName() const;
104 mike   1.2  
105                 /** Modifier. This method should not be called by the user (only by the
106             	parser).
107                 */
108 chuck  1.11     void setClassName(const CIMName& className);
109 mike   1.2  
110 kumpf  1.6      /** 
111                     Returns true if the query selects all properties ("*")
112                 */
113                 Boolean getAllProperties() const;
114             
115                 /** 
116                     Used by the parser to indicate the query selects all properties ("*")
117                     This method should not be called by the user (only by the parser).
118                 */
119                 void setAllProperties(const Boolean allProperties);
120             
121 mike   1.2      /** Returns the number of property names which were indicated in the
122             	selection list.
123 kumpf  1.6          This function should only be used if getAllProperties() returns false.
124 mike   1.2      */
125 chuck  1.11     Uint32 getSelectPropertyNameCount() const;
126 mike   1.2  
127                 /** Gets the i-th selected property name in the list.
128 kumpf  1.6          This function should only be used if getAllProperties() returns false.
129 mike   1.2      */
130 chuck  1.11     const CIMName& getSelectPropertyName(Uint32 i) const;
131 mike   1.2  
132 kumpf  1.6      /** 
133                     Returns a CIMPropertyList containing the selected properties.
134                     The list is NULL if the query selects all properties (SELECT * FROM...).
135                 */
136                 const CIMPropertyList getSelectPropertyList() const;
137             
138                 /** Appends a property name to the property name list. The user should
139 mike   1.2  	not call this method; it should only be called by the parser.
140                 */
141 chuck  1.11     void appendSelectPropertyName(const CIMName& x);
142 mike   1.2  
143                 /** Returns the number of unique property names from the where clause.
144                 */
145 chuck  1.11     Uint32 getWherePropertyNameCount() const;
146 mike   1.2  
147                 /** Gets the i-th unique property appearing in the where clause.
148                 */
149 chuck  1.11     const CIMName& getWherePropertyName(Uint32 i) const;
150 mike   1.2  
151 kumpf  1.6      /** 
152                     Returns a CIMPropertyList containing the unique properties used in the 
153                     WHERE clause
154                 */
155                 const CIMPropertyList getWherePropertyList() const;
156             
157                 /** Appends a property name to the where property name list. The user 
158 mike   1.2  	should not call this method; it should only be called by the parser.
159             
160             	@param x name of the property.
161             	@return false if a property with that name already exists.
162                 */
163 kumpf  1.6      Boolean appendWherePropertyName(const CIMName& x);
164 mike   1.2  
165                 /** Appends an operation to the operation array. This method should only
166             	be called by the parser itself.
167                 */
168 chuck  1.11     void appendOperation(WQLOperation x);
169 mike   1.2  
170                 /** Appends an operand to the operation array. This method should only
171             	be called by the parser itself.
172                 */
173 chuck  1.11     void appendOperand(const WQLOperand& x);
174 mike   1.2  
175                 /** Returns true if this class has a where clause.
176                 */
177 chuck  1.11     Boolean hasWhereClause() const;
178 mike   1.2  
179                 /** Evalautes the where clause using the symbol table to resolve symbols.
180                 */
181                 Boolean evaluateWhereClause(const WQLPropertySource* source) const;
182             
183 schuur 1.9      /** Inspect an instance and remove properties not listed in Select projection.
184                 */
185 chuck  1.11     void applyProjection(CIMInstance& inst) throw (Exception);
186 schuur 1.9      void applyProjection(CIMObject& inst);
187                 
188 mike   1.2      /** Prints out the members of this class.
189                 */
190                 void print() const;
191             
192 schuur 1.9      static const WQLSelectStatement EMPTY;
193 chuck  1.11 
194                 Boolean evaluate(const CIMInstance& inCI);
195             
196                 void validate() throw (Exception);
197             
198                 CIMPropertyList getPropertyList(const CIMObjectPath& inClassName = CIMObjectPath());
199             
200                 Array<CIMObjectPath> getClassPathList();
201             
202 mike   1.2  private:
203             
204 chuck  1.11     WQLSelectStatementRep* _rep;
205 mike   1.2  
206 chuck  1.11     //void f() const { }
207 schuur 1.8      
208                 friend class CMPI_Wql2Dnf;
209 mike   1.2  };
210             
211             PEGASUS_NAMESPACE_END
212             
213             #endif /* Pegasus_WQLSelectStatement_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2