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

  1 karl  1.9 //%2006////////////////////////////////////////////////////////////////////////
  2 chuck 1.2 //
  3 karl  1.6 // 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 chuck 1.2 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.6 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8           // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9           // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10           // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.9 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12           // EMC Corporation; Symantec Corporation; The Open Group.
 13 chuck 1.2 //
 14           // Permission is hereby granted, free of charge, to any person obtaining a copy
 15           // 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           // 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           // 
 21           // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22           // 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           // 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           // 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: Humberto Rivero (hurivero@us.ibm.com)
 33           //
 34 david.dillard 1.5 // Modified By: David Dillard, VERITAS Software Corp.
 35                   //                  (david.dillard@veritas.com)
 36 chuck         1.2 //
 37                   //%/////////////////////////////////////////////////////////////////////////////
 38                   
 39                   #ifndef Pegasus_CQLParser_h
 40                   #define Pegasus_CQLParser_h
 41                   
 42 david.dillard 1.7 #include <Pegasus/CQL/Linkage.h>
 43 chuck         1.2 #include <Pegasus/Common/ArrayInternal.h>
 44                   #include <Pegasus/CQL/CQLSelectStatement.h>
 45 mike          1.8 #include <Pegasus/Common/Buffer.h>
 46 chuck         1.2 
 47                   #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
 48                   
 49                   PEGASUS_NAMESPACE_BEGIN
 50                   
 51 humberto      1.3 /** This class is the main interface to the CQL parser used for parsing CQL compliant statements.
 52 chuck         1.2 
 53                       Here's an example which parses a SELECT statement:
 54                   
 55                       <pre>
 56 david.dillard 1.7         const char TEXT[] = "SELECT X,Y FROM MyClass WHERE X > 10 AND Y < 3";
 57 chuck         1.2 
 58 david.dillard 1.7         // Note that this array must be null-terminated (sizeof(TEXT) includes
 59                           // the null-terminator in the count).
 60 chuck         1.2 
 61 mike          1.8         Buffer text(TEXT, sizeof(TEXT));
 62 chuck         1.2 
 63 david.dillard 1.7         CQLSelectStatement selectStatement;
 64 chuck         1.2 
 65 david.dillard 1.7         try
 66                           {
 67                               CQLParser::parse(text, selectStatement);
 68                           }
 69                           catch (QueryException&)
 70                           {
 71                               ...
 72                           }
 73 chuck         1.2     </pre>
 74                   
 75                       The text is read and the result is left in the selectStatement output
 76                       argument.
 77                   
 78                   */
 79                   class PEGASUS_CQL_LINKAGE CQLParser
 80                   {
 81                   public:
 82                   
 83                       /** Parse the SELECT statement given by the text parameter and initialize
 84 david.dillard 1.7         the statement parameter accordingly.
 85 chuck         1.2 
 86 david.dillard 1.7         Please note that this method is not thread safe. It must be guarded 
 87                           with mutexes by the caller.
 88 chuck         1.2 
 89 david.dillard 1.7         @param text null-terminated C-string which points to CQL statement.
 90                           @param statement object which holds the compiled version of the SELECT
 91                               statement upon return.
 92                           @exception CQLSyntaxErrorException if text is not a valid SELECT statement.
 93                           @exception MissingNullTerminator if text argument is not 
 94                               terminated with a null. 
 95 chuck         1.2     */
 96                       static void parse(
 97 david.dillard 1.7         const char* text,
 98                           CQLSelectStatement& statement);
 99 chuck         1.2 
100                       /** Version of parse() taking an array of characters.
101                       */
102                       static void parse(
103 mike          1.8         const Buffer& text,
104 david.dillard 1.7         CQLSelectStatement& statement);
105 chuck         1.2 
106                       /** Version of parse() taking a string.
107                       */
108                       static void parse(
109 david.dillard 1.7         const String& text,
110                           CQLSelectStatement& statement);
111 chuck         1.2 
112                   private:
113                   
114                       /** This method cleans up all the strings which were created by LEX and
115 david.dillard 1.7         passed to YACC. These strings cannot be cleaned up by YACC actions
116                           since the actions that clean up certain strings are not always reached
117                           when errors occur.
118 chuck         1.2     */
119                       static void cleanup();
120                   
121                       /** Private constructor to avoid user from creating instance of this class.
122                       */
123                       CQLParser() { }
124                   };
125                   
126                   PEGASUS_NAMESPACE_END
127                   #endif
128 humberto      1.3 #endif /* Pegasus_CQLParser_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2