AQL - operators and types (Version 4_7h)

Arithmetic operators `+' `-' `*' `/'

The table shows which combinations of value types are allowed for arithmetic operators.

Int Float Object String Date Type Boolean
Int * O(1) - - - -
Float O(1) * - - - -
Object - - - - - -
String - - - - - -
Date Type - - - - -(2) -
Boolean - - - - - -

Value type combinations showing a '-' will raise error code 896.

Unary minus operator -

Only numeric value-types (i.e. Int, Float) are allowed to be negated in this way.

Modulo operator %

Both sides of the modulo expression have to be integers. Other value types will raise error code 897.

The modulo operator can be written as an infix operator as :
 x % y
or as a function :
 modulo (x, y)
 mod (x, y)

All versions are evaluated in the same way.

Comparison operators `==' `!=' `>' `<' `>=' `<=' (and 'like')

The table shows which combinations of value types are allowed for comparisons.

Int Float Object String Date Type Boolean
Int * O(1) - - - O(5,6)
Float O(1) * - - - O(6,7)
Object - - *(4) O(2,3) - O(6,7)
String - - O(2,3) *(3) - O(6,7)
Date Type - - - - * O(6,7)
Boolean O(5,6) O(6,7) O(6,7) O(6,7) O(6,7) *(6)

Value type combinations showing a '-' will raise error code 884.

The value type of the comparison itself is Boolean. Therefore expressions such as 'not ((val1 = val2) = false)' are legal.

Boolean operators `and' `or' `xor'

Rules (4) and (6) about comparison operators apply also to boolean operators. The operator's result is itself an expression returning a boolean value.


acedb@sanger.ac.uk