FunctionCallExpression
The FunctionCallExpression is part of the Dynamic Where feature; it expression represents a server-side call to a certain SQL function.
Supported SQL functions are:
Trim |
TrimLeft |
TrimRight |
Length |
UpperCase |
LowerCase |
Implementations
- FunctionCallExpression (.NET)
- FunctionCallExpression (Java)
- TDAFunctionCallExpression (Delphi)
- FunctionCallExpression (JavaScript)
Example
Target SQL where
clause:
WHERE LTRIM(customer_name) = "TEST"
WhereExpression whereExpression = new BinaryExpression(
new FunctionCallExpression(
new FieldExpression("customer_name"),
FunctionKind.TrimLeft)),
new ConstantExpression("TEST", DataType.String),
BinaryOperator.Equal);
let whereExpression = BinaryExpression(
FunctionCallExpression(
FieldExpression("customer_name"),
FunctionKind.TrimLeft)),
ConstantExpression("TEST", DataType.String),
BinaryOperator.Equal);
WhereExpression where = new BinaryExpression(
new FunctionCallExpression(
new FieldExpression("customer_name"),
FunctionKind.TrimLeft)),
new ConstantExpression("TEST", DataType.String),
BinaryOperator.Equal);
let whereExpression = BinaryExpression(
FunctionCallExpression(
FieldExpression("customer_name"),
FunctionKind.TrimLeft)),
ConstantExpression("TEST", DataType.String),
BinaryOperator.Equal);
with ClientDataModule.tbl_ORDERS, DynamicWhere do begin
Expression := NewBinaryExpression(
NewFunctionCall(
NewField('', 'customer_name'),
dfkTrimLeft),
NewConstant('TEST',datWideString),
dboEqual);
end;
myTable.dynamicWhere = new RemObjects.DataAbstract.DynamicWhere(
new RemObjects.DataAbstract.BinaryExpression(
new RemObjects.DataAbstract.FunctionCallExpression(
"TrimLeft",
new RemObjects.DataAbstract.FieldExpression("customer_name")),
new RemObjects.DataAbstract.ConstantExpression("String", "TEST")
"Equal")
);
Generated XML/JSON
<?xml version="1.0"?>
<query xmlns="http://www.remobjects.com/schemas/dataabstract/queries/5.0" version="5.0">
<where>
<binaryoperation operator="Equal">
<function kind="TrimLeft">
<field>customer_name</field>
</function>
<constant type="WideString" null="0">TEST</constant>
</binaryoperation>
</where>
</query>
{
"type": "query.where",
"expression": {
"type": "binaryoperation",
"left": {
"type": "function",
"kind": "TrimLeft",
"expression": {
"type": "field",
"field": "customer_name"
}
},
"operator": "Equal",
"right": {
"type": "constant",
"datatype": "WideString",
"value": "TEST"
}
}
}