Debian Codegraph @

whelp/AQL/semantics.shtml

raw
1 <HTML>
2
3 <HEAD>
4 <TITLE>AQL - operators and types (Version 4_7h)</TITLE>
5 <LINK REL="stylesheet" TYPE="text/css" HREF="./aql.css" TITLE="Style sheet for AQL docs">
6 </HEAD>
7 <BODY>
8
9
10 <H2>AQL - operators and types (Version 4_7h)</H2>
11
12 <H3>Arithmetic operators `+' `-' `*' `/'</h3>
13
14 <P>The table shows which combinations of value types are allowed for arithmetic operators.</P>
15
16 <TABLE BORDER=1 WIDTH=100%>
17
18 <TR ALIGN=CENTER> <TH></TH>
19 <TH WIDTH=13%>Int</TH>
20 <TH WIDTH=13%>Float</TH>
21 <TH WIDTH=13%>Object</TH>
22 <TH WIDTH=13%>String</TH>
23 <TH WIDTH=13%>Date Type</TH>
24 <TH WIDTH=13%>Boolean</TH>
25 </TR>
26
27 <TR ALIGN=CENTER> <TH>Int</TH>
28 <TD BGCOLOR=#a0a0a0>*</TD> <!-- int/int -->
29 <TD BGCOLOR=#e0e0e0>O<SUP>(1)</SUP></TD> <!-- int/float -->
30 <TD>-</TD> <!-- int/obj -->
31 <TD>-</TD> <!-- int/string -->
32 <TD>-</TD> <!-- int/date -->
33 <TD>-</TD> <!-- int/boolean -->
34 </TR>
35
36 <TR ALIGN=CENTER> <TH>Float</TH>
37 <TD BGCOLOR=#e0e0e0>O<SUP>(1)</SUP></TD> <!-- float/int -->
38 <TD BGCOLOR=#a0a0a0>*</TD> <!-- float/float -->
39 <TD>-</TD> <!-- float/Object -->
40 <TD>-</TD> <!-- float/string -->
41 <TD>-</TD> <!-- float/date -->
42 <TD>-</TD> <!-- float/boolean -->
43 </TR>
44
45 <TR ALIGN=CENTER> <TH>Object</TH>
46 <TD>-</TD>
47 <TD>-</TD>
48 <TD>-</TD>
49 <TD>-</TD>
50 <TD>-</TD>
51 <TD>-</TD>
52 </TR>
53
54 <TR ALIGN=CENTER> <TH>String</TH>
55 <TD>-</TD>
56 <TD>-</TD>
57 <TD>-</TD>
58 <TD>-</TD>
59 <TD>-</TD>
60 <TD>-</TD>
61 </TR>
62
63 <TR ALIGN=CENTER> <TH>Date Type</TH>
64 <TD>-</TD>
65 <TD>-</TD>
66 <TD>-</TD>
67 <TD>-</TD>
68 <TD>-<SUP>(2)</SUP></TD>
69 <TD>-</TD>
70 </TR>
71
72 <TR ALIGN=CENTER> <TH>Boolean</TH>
73 <TD>-</TD>
74 <TD>-</TD>
75 <TD>-</TD>
76 <TD>-</TD>
77 <TD>-</TD>
78 <TD>-</TD>
79 </TR>
80
81 </TABLE>
82
83 <P>Value type combinations showing a '-' will raise error code <A HREF=errorcodes.shtml#ERRNO896>896</A>.</P>
84
85 <UL>
86 <LI>(1) - Integers are treated as Floats in mixed expressions.
87 <LI>(2) Special <A HREF=overview.shtml#DATE_FUNC>date-functions</A>
88 to provide operations on date/time values.
89 </UL>
90
91 <P>
92
93 <H3>Unary minus operator -</H3>
94
95 Only numeric value-types (i.e. Int, Float) are allowed to be negated in this way.
96
97 <H3>Modulo operator %</H3>
98
99 <P>Both sides of the modulo expression have to be integers.
100 Other value types will raise error code <A HREF=errorcodes.shtml#ERRNO897>897</A>.</P>
101
102 <P>The modulo operator can be written as an infix operator as :<BR>
103 <TT>&nbsp;x % y</TT><BR>
104 or as a function :<BR>
105 <TT>&nbsp;<EM>modulo</EM> (x, y)<BR>
106 &nbsp;<EM>mod</EM> (x, y)</TT>
107
108 <P>All versions are evaluated in the same way.</P>
109
110 <H3>Comparison operators `==' `!=' `&gt;' `&lt;' `&gt;=' `&lt;=' (and 'like')</H3>
111
112 <P>The table shows which combinations of value types are allowed for comparisons.</P>
113
114 <TABLE BORDER=1 WIDTH=100%>
115
116 <TR ALIGN=CENTER> <TH></TH>
117 <TH WIDTH=13%>Int</TH>
118 <TH WIDTH=13%>Float</TH>
119 <TH WIDTH=13%>Object</TH>
120 <TH WIDTH=13%>String</TH>
121 <TH WIDTH=13%>Date Type</TH>
122 <TH WIDTH=13%>Boolean</TH>
123 </TR>
124
125 <TR ALIGN=CENTER> <TH>Int</TH>
126 <TD BGCOLOR=#a0a0a0>*</TD> <!-- int/int -->
127 <TD BGCOLOR=#e0e0e0>O<SUP>(1)</SUP></TD> <!-- int/float -->
128 <TD>-</TD> <!-- int/Object -->
129 <TD>-</TD> <!-- int/string -->
130 <TD>-</TD> <!-- int/date -->
131 <TD BGCOLOR=#e0e0e0>O<SUP>(5,6)</SUP></TD> <!-- int/boolean -->
132 </TR>
133
134 <TR ALIGN=CENTER> <TH>Float</TH>
135 <TD BGCOLOR=#e0e0e0>O<SUP>(1)</SUP></TD> <!-- float/int -->
136 <TD BGCOLOR=#a0a0a0>*</TD> <!-- float/float -->
137 <TD>-</TD> <!-- float/Object -->
138 <TD>-</TD> <!-- float/string -->
139 <TD>-</TD> <!-- float/date -->
140 <TD BGCOLOR=#e0e0e0>O<SUP>(6,7)</SUP></TD> <!-- float/boolean -->
141 </TR>
142
143 <TR ALIGN=CENTER> <TH>Object</TH>
144 <TD>-</TD>
145 <TD>-</TD>
146 <TD BGCOLOR=#a0a0a0>*<SUP>(4)</SUP></TD> <!-- Object/Object -->
147 <TD BGCOLOR=#e0e0e0>O<SUP>(2,3)</SUP></TD> <!-- Object/String -->
148 <TD>-</TD>
149 <TD BGCOLOR=#e0e0e0>O<SUP>(6,7)</SUP></TD><!-- Object/Boolean -->
150 </TR>
151
152 <TR ALIGN=CENTER> <TH>String</TH>
153 <TD>-</TD>
154 <TD>-</TD>
155 <TD BGCOLOR=#e0e0e0>O<SUP>(2,3)</SUP></TD><!-- String/Object -->
156 <TD BGCOLOR=#a0a0a0>*<SUP>(3)</TD> <!-- String/String -->
157 <TD>-</TD>
158 <TD BGCOLOR=#e0e0e0>O<SUP>(6,7)</SUP></TD>
159 </TR>
160
161 <TR ALIGN=CENTER> <TH>Date Type</TH>
162 <TD>-</TD>
163 <TD>-</TD>
164 <TD>-</TD>
165 <TD>-</TD>
166 <TD BGCOLOR=#a0a0a0>*</TD>
167 <TD BGCOLOR=#e0e0e0>O<SUP>(6,7)</SUP></TD>
168 </TR>
169 <TR ALIGN=CENTER> <TH>Boolean</TH>
170 <TD BGCOLOR=#e0e0e0>O<SUP>(5,6)</SUP></TD>
171 <TD BGCOLOR=#e0e0e0>O<SUP>(6,7)</SUP></TD>
172 <TD BGCOLOR=#e0e0e0>O<SUP>(6,7)</SUP></TD>
173 <TD BGCOLOR=#e0e0e0>O<SUP>(6,7)</SUP></TD>
174 <TD BGCOLOR=#e0e0e0>O<SUP>(6,7)</SUP></TD>
175 <TD BGCOLOR=#a0a0a0>*<SUP>(6)</SUP></TD>
176 </TR>
177 </TABLE>
178
179 <P>Value type combinations showing a '-' will raise error code <A HREF=errorcodes.shtml#ERRNO884>884</A>.</P>
180
181 <UL>
182 <LI>(1) - integers are treated as floats.
183 <LI>(2) - The object's name is compared to the text value.
184 <LI>(3) - The operator <B>like</B> is allowed for comparisons involving string-types to perform wildcard matching.<BR>
185 Possible wildcards are '*' which matches any number of any characters, and '?' which matches any one character.
186 <LI>(4) - Only '=' and '!=' operators are allowed, when two Object values are compared to each other,
187 otherwise error code <A HREF=errorcodes.shtml#ERRNO886>886</A> is raised.
188 <LI>(5) - Integers are converted to Booleans - zero = FALSE, non-zero is TRUE. A NULL integer value is FALSE.
189 <LI>(6) - Only '=' and '!=' operators are allowed, when a comparison involves a boolean value,
190 otherwise error code <A HREF=errorcodes.shtml#ERRNO885>885</A> is raised.
191 <LI>(7) - Comparison between a Boolean and a non-boolean value (Float/Object/String/DateType) :
192 <BR>
193 Any non-boolean value is said to be TRUE if a value exists, a NULL-value is treated as FALSE.
194 </UL>
195
196 <P>The value type of the comparison itself is Boolean. Therefore expressions such as
197 'not ((val1 = val2) = false)' are legal. </P>
198
199
200
201 <H3>Boolean operators `and' `or' `xor'</H3>
202
203 <P>Rules (4) and (6) about comparison operators apply also to boolean operators.
204 The operator's result is itself an expression returning a boolean value.</P>
205
206
207 <HR>
208 <ADDRESS><A HREF="mailto:[email protected]">[email protected]</A></ADDRESS>
209
210 </BODY>
211 </HTML>