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

  1 martin 1.9 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.10 //
  3 martin 1.9  // Licensed to The Open Group (TOG) under one or more contributor license
  4             // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5             // this work for additional information regarding copyright ownership.
  6             // Each contributor licenses this file to you under the OpenPegasus Open
  7             // Source License; you may not use this file except in compliance with the
  8             // License.
  9 martin 1.10 //
 10 martin 1.9  // Permission is hereby granted, free of charge, to any person obtaining a
 11             // copy of this software and associated documentation files (the "Software"),
 12             // to deal in the Software without restriction, including without limitation
 13             // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14             // and/or sell copies of the Software, and to permit persons to whom the
 15             // Software is furnished to do so, subject to the following conditions:
 16 martin 1.10 //
 17 martin 1.9  // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.10 //
 20 martin 1.9  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.10 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.9  // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23             // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24             // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25             // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26             // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.10 //
 28 martin 1.9  //////////////////////////////////////////////////////////////////////////
 29 mike   1.2  //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32             #ifndef Pegasus_WQLOperation_h
 33             #define Pegasus_WQLOperation_h
 34             
 35             #include <Pegasus/Common/Config.h>
 36             #include <Pegasus/WQL/Linkage.h>
 37             
 38             PEGASUS_NAMESPACE_BEGIN
 39             
 40             /** Represents SQL where clause operators.
 41             
 42                 These operators include the following:
 43             
 44                 <ul>
 45 karl   1.8          <li>OR</li>
 46                     <li>AND</li>
 47                     <li>NOT</li>
 48                     <li>=</li>
 49                     <li>&lt;&gt;</li>
 50                     <li>&lt;</li>
 51                     <li>&le;</li>
 52                     <li>&gt;</li>
 53                     <li>&ge;</li>
 54                     <li>IS NULL</li>
 55                     <li>IS NOT NULL</li>
 56                     <li>IS TRUE</li>
 57                     <li>IS NOT TRUE</li>
 58                     <li>IS FALSE</li>
 59                     <li>IS NOT FALSE</li>
 60 mike   1.2      </ul>
 61             
 62                 Here's an example of a SQL query that uses some of these operations.
 63             
 64                 <pre>
 65 karl   1.8          SELECT *
 66                     FROM MyClass
 67                     WHERE (x &gt; 10 OR y &le; 1.5) OR z = 19 AND name IS NOT NULL
 68 mike   1.2      </pre>
 69             
 70                 As the parser recognizes these operations, it adds the corresponding
 71                 WQLOperation enumeration tag to the WQLSelectStatement by calling
 72                 WQLSelectStatement::appendOperation().
 73             
 74                 Operators may be converted to string by calling WQLOperationToString().
 75             
 76                 Note that in expressions like this one:
 77             
 78                 <pre>
 79 karl   1.8          count IS TRUE
 80 mike   1.2      </pre>
 81             
 82                 The IS operator is NOT treated as a binary operator (which would take
 83                 count and TRUE as its operands). Instead, the IS operator and TRUE operand
 84 kumpf  1.11     are combined to form a single unary operation called "IS_TRUE". In this
 85 mike   1.2      way, evaluation may be implemented by more efficiently (the TRUE operand
 86                 is eliminated and therefore need not be handled). Conceptually, the above
 87                 expression is equivalent to the following psuedo expression:
 88             
 89                 <pre>
 90 karl   1.8          IS_TRUE(count)
 91 mike   1.2      </pre>
 92             
 93 kumpf  1.11     Note that this technique is applied the following operations (also
 94 mike   1.2      combined to be unary operations).
 95             
 96                 <ul>
 97 karl   1.8          <li>WQL_IS_NULL</li>
 98                     <li>WQL_IS_NOT_NULL</li>
 99                     <li>WQL_IS_TRUE</li>
100                     <li>WQL_IS_NOT_TRUE</li>
101                     <li>WQL_IS_FALSE</li>
102                     <li>WQL_IS_NOT_FALSE</li>
103 mike   1.2      </ul>
104             */
105             enum WQLOperation
106             {
107                 WQL_OR,
108                 WQL_AND,
109                 WQL_NOT,
110                 WQL_EQ,
111                 WQL_NE,
112                 WQL_LT,
113                 WQL_LE,
114                 WQL_GT,
115                 WQL_GE,
116                 WQL_IS_NULL,
117                 WQL_IS_NOT_NULL,
118                 WQL_IS_TRUE,
119                 WQL_IS_NOT_TRUE,
120                 WQL_IS_FALSE,
121                 WQL_IS_NOT_FALSE
122             };
123             
124 mike   1.2  PEGASUS_WQL_LINKAGE const char* WQLOperationToString(WQLOperation x);
125             
126             PEGASUS_NAMESPACE_END
127             
128             #endif /* Pegasus_WQLOperation_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2