There are two main types of data in DSQL: scalars and objects. However, DSQL is 'loosely' typed: scalars are automatically converted, and objects share common access methods.
scalar | example(s) |
---|---|
string | 'static' "I'm $name" |
boolean | TRUE FALSE |
integer | 42 |
float | 3.1415927 |
All objects have fields, which can be accessed with
.field
. Some objects also have records,
accessed with [index]
.
object | example(s) | field select | record select |
---|---|---|---|
table | $s=<table>Staff</table> $s=<sql>select * from Staff</sql> |
combined with a record selector, gives a column or field; e.g. $s[1].name, $s[1].@1 | a row or record; e.g. the first employee: $s[1] |
XML | $x=<name><given>Etienne</given> <last>Paradis</last></name> | child of document element; e.g. $x.given or $x.@1 | child of document element; e.g. $x[1] is <given> element |
list | $l=[1,"yes",3.2] | list element, e.g. $l[2] is "yes" | |
hash | $h={'key'->'value','other'} | the value for a key, e.g. $h.other is NULL | N/A |
date | $d=sysdate | some convenience fields (see reference), e.g. $d.day | N/A |
java | new java.io.File("myfile") | a public field | only for AbstractList |
New fields can be set arbitrarily to any object, without prior "declaration". For example:
$f = new java.io.File("myfile");
if($f.isFile()) $f.toprocess = 1;