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 | <table>Staff</table> <sql>select * from Staff</sql> |
combined with a record selector, gives a column or field; e.g. $staff[0].name, $staff[0].@1 | a row or record; e.g. the first employee: $staff[1] |
XML | <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 |
java | new java.io.File("myfile") | a public field | defined only for AbstractList |
list | [1,"yes",3.2] | list element |
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;