ParameterExpression
The ParameterExpression is part of the Dynamic Where feature; it represents a parameter
in where
expressions.
№ Implementation
- ParameterExpression (.NET)
- ParameterExpression (Java)
- TDAParameterExpression (Delphi)
- ParameterExpression (JavaScript)
Example
Target SQL where
clause:
WHERE LASTNAME LIKE :p
WhereExpression where = new BinaryExpression(
new FieldExpression("SALESMEN","lastname"),
new ParameterExpression("p", DataType.String, 120),
BinaryOperator.Equal);
let whereExpression = BinaryExpression(
FieldExpression("SALESMEN", "lastname"),
ParameterExpression("p", DataType.String, 120),
BinaryOperator.Equal)
WhereExpression where = new BinaryExpression(
new FieldExpression("SALESMEN","lastname"),
new ParameterExpression("p", DataType.String, 120),
BinaryOperator.Equal);
let whereExpression = BinaryExpression(
FieldExpression("SALESMEN", "lastname"),
ParameterExpression("p", DataType.String, 120),
BinaryOperator.Equal)
with ClientDataModule.tbl_SALESMEN,DynamicWhere do begin
Expression:=NewBinaryExpression(
NewField(LogicalName,'lastname'),
NewParameter('p', datString),
dboLike);
end;
myTable.dynamicWhere = new RemObjects.DataAbstract.DynamicWhere(
new RemObjects.DataAbstract.BinaryExpression(
new RemObjects.DataAbstract.FieldExpression("LastName"),
new RemObjects.DataAbstract.ParameterExpression("p", "String", 120), "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="Like">
<field tablename="SALESMEN">lastname</field>
<parameter type="String">p</parameter>
</binaryoperation>
</where>
</query>
{
"type": "query.where",
"expression": {
"type": "binaryoperation",
"left": {
"type": "field",
"field": "lastname",
"table": "SALESMEN"
},
"operator": "Like",
"right": {
"type": "parameter",
"name": "p",
"datatype": "String"
}
}
}