DateTimeNowExpression
The DateTimeNowExpression is part of the Dynamic Where feature; it represents current database server date and time.
No operands are used by this expression.
Implementations
- DateTimeNowExpression (.NET)
- DateTimeNowExpression (Java)
- TDADateTimeNowExpression (Delphi)
- DateTimeNowExpression (JavaScript)
Example
Target SQL where
clause:
WHERE order_date = GETDATE()
WhereExpression whereExpression = new BinaryExpression(
new FieldExpression("ORDERS", "order_date"),
new DateTimeNowExpression(),
BinaryOperator.Equal);
let whereExpression = BinaryExpression(
FieldExpression("ORDERS", "order_date"),
DateTimeNowExpression(),
BinaryOperator.Equal)
WhereExpression where = new BinaryExpression(
new FieldExpression("ORDERS","order_date"),
new DateTimeNowExpression(),
BinaryOperator.Equal);
let whereExpression = BinaryExpression(
FieldExpression("ORDERS", "order_date"),
DateTimeNowExpression(),
BinaryOperator.Equal)
with ClientDataModule.tbl_ORDERS, DynamicWhere do begin
Expression := NewBinaryExpression(
NewField(LogicalName, 'order_date'),
NewNow(),
dboEqual);
end;
myTable.dynamicWhere = new RemObjects.DataAbstract.DynamicWhere(
new RemObjects.DataAbstract.BinaryExpression(
new RemObjects.DataAbstract.FieldExpression("order_date"),
new RemObjects.DataAbstract.DateTimeNowExpression(),
"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">
<field tablename="ORDERS">order_date</field>
<datetimenow/>
</binaryoperation>
</where>
</query>
{
"type": "query.where",
"expression": {
"type": "binaryoperation",
"left": {
"type": "field",
"field": "order_date",
"table": "ORDERS"
},
"operator": "Equal",
"right": {
"type": "datetimenow"
}
}
}