111 |
111 |
112 Mathematical operators |
112 Mathematical operators |
113 `````````````````````` |
113 `````````````````````` |
114 :: |
114 :: |
115 |
115 |
116 +, -, *, / |
116 +==========+=====================+===========+========+ |
117 |
117 | Operator | Description | Example | Result | |
118 Those should behave as you expect. |
118 +==========+=====================+===========+========+ |
|
119 | + | addition | 2 + 3 | 5 | |
|
120 +----------+---------------------+-----------+--------+ |
|
121 | - | subtraction | 2 - 3 | -1 | |
|
122 +----------+---------------------+-----------+--------+ |
|
123 | * | multiplication | 2 * 3 | 6 | |
|
124 +----------+---------------------+-----------+--------+ |
|
125 | / | division | 4 / 2 | 2 | |
|
126 +----------+---------------------+-----------+--------+ |
|
127 | % | modulo (remainder) | 5 % 4 | 1 | |
|
128 +----------+---------------------+-----------+--------+ |
|
129 | ^ | exponentiation | 2.0 ^ 3.0 | 8 | |
|
130 +----------+---------------------+-----------+--------+ |
|
131 | & | bitwise AND | 91 & 15 | 11 | |
|
132 +----------+---------------------+-----------+--------+ |
|
133 | | | bitwise OR | 32 | 3 | 35 | |
|
134 +----------+---------------------+-----------+--------+ |
|
135 | # | bitwise XOR | 17 # 5 | 20 | |
|
136 +----------+---------------------+-----------+--------+ |
|
137 | ~ | bitwise NOT | ~1 | -2 | |
|
138 +----------+---------------------+-----------+--------+ |
|
139 | << | bitwise shift left | 1 << 4 | 16 | |
|
140 +----------+---------------------+-----------+--------+ |
|
141 | >> | bitwise shift right | 8 >> 2 | 2 | |
|
142 +----------+---------------------+-----------+--------+ |
|
143 |
|
144 +, -, *, / |
|
145 |
|
146 Notice integer division truncates results depending on the backend behaviour. For |
|
147 instance, postgresql does. |
119 |
148 |
120 |
149 |
121 .. _RQLComparisonOperators: |
150 .. _RQLComparisonOperators: |
122 |
151 |
123 Comparison operators |
152 Comparison operators |
326 join-condition does not find any matching record in the "right" table (B). |
356 join-condition does not find any matching record in the "right" table (B). |
327 |
357 |
328 You must use the `?` behind a variable to specify that the relation toward it |
358 You must use the `?` behind a variable to specify that the relation toward it |
329 is optional. For instance: |
359 is optional. For instance: |
330 |
360 |
331 - Anomalies of a project attached or not to a version :: |
361 - Bugs of a project attached or not to a version :: |
332 |
362 |
333 Any X, V WHERE X concerns P, P eid 42, X corrected_in V? |
363 Any X, V WHERE X concerns P, P eid 42, X corrected_in V? |
334 |
364 |
335 You will get a result set containing all the project's tickets, with either the |
365 You will get a result set containing all the project's tickets, with either the |
336 version in which it's corrected or None for tickets not related to a version. |
366 version in which it's corrected or None for tickets not related to a version. |
337 |
367 |
338 |
368 |
339 - All cards and the project they document if any :: |
369 - All cards and the project they document if any :: |
340 |
370 |
341 Any C, P WHERE C is Card, P? documented_by C |
371 Any C, P WHERE C is Card, P? documented_by C |
|
372 |
|
373 Notice you may also use outer join: |
|
374 |
|
375 - on the RHS of attribute relation, e.g. :: |
|
376 |
|
377 Any X WHERE X ref XR, Y name XR? |
|
378 |
|
379 so that Y is outer joined on X by ref/name attributes comparison |
|
380 |
|
381 |
|
382 - on any side of an `HAVING` expression, e.g. :: |
|
383 |
|
384 Any X WHERE X creation_date XC, Y creation_date YC |
|
385 HAVING YEAR(XC)=YEAR(YC)? |
|
386 |
|
387 so that Y is outer joined on X by comparison of the year extracted from their |
|
388 creation date. :: |
|
389 |
|
390 Any X WHERE X creation_date XC, Y creation_date YC |
|
391 HAVING YEAR(XC)?=YEAR(YC) |
|
392 |
|
393 would outer join X on Y instead. |
342 |
394 |
343 |
395 |
344 Having restrictions |
396 Having restrictions |
345 ``````````````````` |
397 ``````````````````` |
346 |
398 |