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