GLOBAL SITES
 首页 > 产品 > DObject O/R Mapping 套件 > 代码示例

更多示例请参考在线文档

插入新对象

customer := TCustomer.Create(objectManager);

// ...

customer.Save;

 

order := customer.NewOrder;

order.OrderDate := Now;

order.ShipCity := city;

// ...

order.Save;

批量更新

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);

对象查询语言 (OQL)

// == 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"

概述
特点
下载
购买
系统需求
代码示例
DObject 用户手册
DObject 帮助
Word to HTML help Word to Web help CHM to Web help CHM to Word CHM to HTML/MHTML .NET assembly Obfuscator