GLOBAL SITES
 Home > Products > DObject O/R Mapping Suite > Code Examples

Please refer to online documents for more examples.

Insert new object

customer := TCustomer.Create(objectManager);

// ...

customer.Save;

 

order := customer.NewOrder;

order.OrderDate := Now;

order.ShipCity := city;

// ...

order.Save;

Batch Update

filter := TOrder.Create(objectManager);

filter.ShipVia := 1;

filter.EmployeeID := 7;

 

value := TOrder.Create(objectManager);

value.ShipVia := 3;

 

// BatchUpdate : using object filter

objectManager.UpdateMatch(filter, value);

 

upd := TUpdateQuery.Create;

upd.Update(NW.Order)

  .Set_(NW.Order.ShipVia, 3)

  .Where(OQL.Criteria(

     NW.Order.ShipVia).EQ(1)

    .And_(NW.Order.EmployeeID).EQ(7));

 

// BatchUpdate : using OQL

objectManager.ExecuteCommand(upd);

Object Query Language

// == Delphi Code ===================================================

sel := TSelectQuery.Create;

sel.Select(NW.Order.OrderID)._(NW.Order.OrderDate)

._(NW.Order.RequiredDate)._(NW.OrderDetail)

.From(NW.Order)._(NW.OrderDetail)

.Where(OQL.Criteria(NW.Order.EmployeeID).EQ(5)

  .And_(NW.Order.ShipVia).EQ(1)

  .And_(NW.Order.OrderID).EQ(NW.OrderDetail.OrderID))

.OrderBy(NW.Order.OrderID);

 

==== sql output for Microsoft Sql Server ============================

SELECT

  [Orders].[OrderID] , [Orders].[OrderDate] , [Orders].[RequiredDate]

  , [Order Details].*

FROM

  [Orders] , [Order Details]

WHERE

  [Orders].[EmployeeID] = 5 AND

  [Orders].[ShipVia] = 1 AND

  [Orders].[OrderID] = [Order Details].[OrderID]

ORDER BY [Orders].[OrderID]

 

==== sql output for Oracle =========================================

SELECT

  "Orders"."OrderID" , "Orders"."OrderDate" , "Orders"."RequiredDate"

  , "Order Details".*

FROM

  "Orders" , "Order Details"

WHERE

  "Orders"."EmployeeID" = 5 AND

  "Orders"."ShipVia" = 1 AND

  "Orders"."OrderID" = "Order Details"."OrderID"

ORDER BY "Orders"."OrderID"

Overview
Features
Download
Purchase
Requirements
Code Examples
DObject Manual
DObject Help
Word to HTML help Word to Web help CHM to Web help CHM to Word CHM to HTML/MHTML .NET assembly Obfuscator