In DObject O/R Mapping persistence layer, you can update objects by filtering objects with FilterObject. Two FilterObjects are needed; one for conditional expression and one for updated property value, a sample is as follows:
|
var filter : IOrder; value : IOrder; begin filter := TOrder.Create(nil); filter.CustomerID := 'ATEST'; filter.ShipVia := 1; value := TOrder.Create(nil); value.ShipVia := 3; ObjectManager.UpdateMatch(filter, value); end; |
The codes above creates a filter conditional expression first, and what assigned to its fields are the conditions, multi-field conditions are combined by "And". Then creates a value object, what is assigned to its field denotes the updated value.
The codes above equal to the following SQL:
|
UPDATE
[Orders] SET [Orders].[ShipVia] = 3 WHERE
[Orders].[CustomerID] = 'ATEST' AND
[Orders].[ShipVia] = 1 |
Related Topics