Dynamic Where XML Format
From RemObjects Wiki
This is a Data Abstract Architecture topic
Feel free to add your notes to this topic below.
Query node
The root node of the DynamicWhere expression is the query node. It has two mandatory attributes: xmlns and version.
- The xmlns attribute has this value: http://www.remobjects.com/schemas/dataabstract/queries/5.0
- The version attribute specifies the format version of the DynamicWhere expression; the current version is 5.0
Sample
<query xmlns="http://www.remobjects.com/schemas/dataabstract/queries/5.0" version="5.0"> </query>
Where node
Each query node should have only one where node. The where node has no attributes. It can hold only one of the following nodes:
- binaryoperation - represents BinaryExpression;
- unaryoperation - represents UnaryExpression;
- constant - represents ConstantExpression;
- list - represents ListExpression;
- parameter - represents ParameterExpression;
- field - represents FieldExpression;
- null - represents NullExpression;
- macro - represents MacroExpression;
Sample
<query xmlns="http://www.remobjects.com/schemas/dataabstract/queries/5.0" version="5.0"> <where> ... </where> </query>
Binaryoperation node
The binaryoperation node represents a BinaryExpression instance. It must have exactly two nodes, representing the Left and the Right expressions that the operator applies to. The operator attribute can have the following values:
|
|
|
|
|
Sample
<binaryoperation operator="Equal"> <field>EmployeeID</field> <constant type="Integer" null="0">5</constant> </binaryoperation>
UnaryOperation node
The unaryoperation node represents the UnaryExpression instance. It can have only one node and operator attribute.
Sample
<unaryoperation operator="Not"> <null /> </unaryoperation>
or just
<unaryoperation> <null /> </unaryoperation>
Constant node
The constant node represents the ConstantExpression instance. Inside Dynamic Where it is usually used as right expression inside the binaryoperation node.
It has a type attribute that specifies the type of constant. The type can be any of following:
|
|
|
|
|
The null attribute shows the value null or not. It can take values 0 (which means the value is NOT null) or 1 (meaning the value IS null)
Sample
<constant type="Integer" null="0">5</constant>
or
<constant type="String" null="0">King</constant>
Parameter node
The parameter node represents ParameterExpression. The value of the parameter node is the parameter name. This node has the following attributes:
- type attribute that specifies the type of the parameter. Type can be any of following:
|
|
|
|
|
- The size attribute is optional and is usually used with String, WideString, Memo, WideMemo, Blob types. 0 � is the default value.
Sample
<parameter type="String" size="50">pEmployeeName</parameter>
or
<parameter type="Integer" size="0">pEmployeeID</parameter>
Field node
The field node represents the FieldExpression, which is the field reference of the table in the schema.
Sample
<field>EmployeeID</field>
or
<field>FirstName</field>
Null node
The null node represents the NullExpression. It is usually used as part of unary expressions.
Sample
<unaryoperation operator="Not"> <null /> </unaryoperation>
Macro node
The macro node represents the MacroExpression. It has a name attribute as the macros name. If the macros takes parameters, they should be listed as expression nodes inside the macro node, as you can see in the sample below:
Sample
<macro name="UpperCase"> <constant type="String" null="0">test</constant> </macro>
DataTypes formats
| AutoInc | 15 | integer value as string. |
| Blob | BF12F25POD4556KF | value encoded to Base64 string format. |
| Boolean | True | True or False. |
| Byte | 2 | value as string. |
| Cardinal | 1234 | in string format. |
| Currency | 123,45->1234500 | with accuracy 4 number after comma as integer in string format. |
| DateTime | 1231505053 | Unix/Linux style date-and-time value as int64 in string format. |
| Decimal | 125 | as decimal in string format. |
| Float | 12.34 | as double in string format. |
| Guid | 6C8DE133-9E4D-433A -BC4E-D4A1E49EAAB0 | as string in following format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx without braces. |
| Integer | 52 | value as string. |
| LargeAutoInc | 4585 | value as string. |
| LargeInt | 5414 | value as string. |
| LargeUInt | 41 | value as string. |
| Memo | "This is the long text" | value as string. |
| ShortInt | 15 | value as string. |
| SingleFloat | 32.14 | as double in string format. |
| String | "Just text value" | value as string. |
| Unknown | - | not supported in Dynamic Where. |
| WideMemo | "This is the long text" | value as string. |
| WideString | Just text value | value as string. |
| Word | 2 | value as string. |
| Xml | <node attr="1"> AAA</node> | outer xml as string. |
Some complex samples of the Dynamic Where expressions
<query xmlns="http://www.remobjects.com/schemas/dataabstract/queries/5.0" version="5.0"> <where> <binaryoperation operator="And"> <binaryoperation operator="Equal"> <field>EmployeeID</field> <parameter type="Integer" size="0">pEmployeeID</parameter> </binaryoperation> <binaryoperation operator="Equal"> <field>FirstName</field> <parameter type="String" size="50">pEmployeeName</parameter> </binaryoperation> </binaryoperation> </where> </query>
<query xmlns="http://www.remobjects.com/schemas/dataabstract/queries/5.0" version="5.0"> <where> <binaryoperation operator="Or"> <binaryoperation operator="And"> <binaryoperation operator="Equal"> <field>EmployeeID</field> <parameter type="Integer" size="0">pEmployeeID</parameter> </binaryoperation> <binaryoperation operator="Equal"> <field>FirstName</field> <parameter type="String" size="50">pEmployeeName</parameter> </binaryoperation> </binaryoperation> <binaryoperation operator="In"> <field>LastName</field> <list> <constant type="String" null="0">Fuller</constant> <constant type="String" null="0">King</constant> <constant type="String" null="0">Test</constant> </list> </binaryoperation> </binaryoperation> </where> </query>
Product: RemObjects Data Abstract
Available Editions: Data Abstract for .NET, Delphi and Xcode
Glossary — Architecture — Articles — Features — Library — Samples