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

  1 karl  1.7 //%2006////////////////////////////////////////////////////////////////////////
  2 mike  1.2 //
  3 karl  1.5 // 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.4 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.5 // 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.6 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10           // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.7 // 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.3 // 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           // 
 21 kumpf 1.3 // 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.3 // 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           #ifndef Pegasus_WQLOperation_h
 35           #define Pegasus_WQLOperation_h
 36           
 37           #include <Pegasus/Common/Config.h>
 38           #include <Pegasus/WQL/Linkage.h>
 39           
 40           PEGASUS_NAMESPACE_BEGIN
 41           
 42           /** Represents SQL where clause operators.
 43           
 44               These operators include the following:
 45           
 46               <ul>
 47 karl  1.8         <li>OR</li>
 48                   <li>AND</li>
 49                   <li>NOT</li>
 50                   <li>=</li>
 51                   <li>&lt;&gt;</li>
 52                   <li>&lt;</li>
 53                   <li>&le;</li>
 54                   <li>&gt;</li>
 55                   <li>&ge;</li>
 56                   <li>IS NULL</li>
 57                   <li>IS NOT NULL</li>
 58                   <li>IS TRUE</li>
 59                   <li>IS NOT TRUE</li>
 60                   <li>IS FALSE</li>
 61                   <li>IS NOT FALSE</li>
 62 mike  1.2     </ul>
 63           
 64               Here's an example of a SQL query that uses some of these operations.
 65           
 66               <pre>
 67 karl  1.8         SELECT *
 68                   FROM MyClass
 69                   WHERE (x &gt; 10 OR y &le; 1.5) OR z = 19 AND name IS NOT NULL
 70 mike  1.2     </pre>
 71           
 72               As the parser recognizes these operations, it adds the corresponding
 73               WQLOperation enumeration tag to the WQLSelectStatement by calling
 74               WQLSelectStatement::appendOperation().
 75           
 76               Operators may be converted to string by calling WQLOperationToString().
 77           
 78               Note that in expressions like this one:
 79           
 80               <pre>
 81 karl  1.8         count IS TRUE
 82 mike  1.2     </pre>
 83           
 84               The IS operator is NOT treated as a binary operator (which would take
 85               count and TRUE as its operands). Instead, the IS operator and TRUE operand
 86               are combined to form a single unary operation called "IS_TRUE". In this 
 87               way, evaluation may be implemented by more efficiently (the TRUE operand
 88               is eliminated and therefore need not be handled). Conceptually, the above
 89               expression is equivalent to the following psuedo expression:
 90           
 91               <pre>
 92 karl  1.8         IS_TRUE(count)
 93 mike  1.2     </pre>
 94           
 95               Note that this technique is applied the following operations (also 
 96               combined to be unary operations).
 97           
 98               <ul>
 99 karl  1.8         <li>WQL_IS_NULL</li>
100                   <li>WQL_IS_NOT_NULL</li>
101                   <li>WQL_IS_TRUE</li>
102                   <li>WQL_IS_NOT_TRUE</li>
103                   <li>WQL_IS_FALSE</li>
104                   <li>WQL_IS_NOT_FALSE</li>
105 mike  1.2     </ul>
106           */
107           enum WQLOperation
108           {
109               WQL_OR,
110               WQL_AND,
111               WQL_NOT,
112               WQL_EQ,
113               WQL_NE,
114               WQL_LT,
115               WQL_LE,
116               WQL_GT,
117               WQL_GE,
118               WQL_IS_NULL,
119               WQL_IS_NOT_NULL,
120               WQL_IS_TRUE,
121               WQL_IS_NOT_TRUE,
122               WQL_IS_FALSE,
123               WQL_IS_NOT_FALSE
124           };
125           
126 mike  1.2 PEGASUS_WQL_LINKAGE const char* WQLOperationToString(WQLOperation x);
127           
128           PEGASUS_NAMESPACE_END
129           
130           #endif /* Pegasus_WQLOperation_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2