Delphi.MIDAS.ClientDataSet. General Knowledge

Delphi.MIDAS.ClientDataSet. General Knowledge


TClientDataSet
-------------
Aggregates

=======================
ResolveToDataSet = false
 1) TDataSetProvider generate SQL to update DataBase.
 2) Prepare SQL once
 3) Execute update SQL (many one)
 4) select ALL Data to Client

ResolveToDataSet = true,
 1) TDataSetProvider.DataSet(TADOQuery...) update Data
 2) Prepare SQL and Execute SQL (Prapare many times)
 4) select Only changed Data to Client

=============================================================================
Milti-tier Application Server
=============================================================================
(Once you add a Remote Data Module in your project, your project is a Application Server)

EXE
---
1) New -> Application -> Add Remote Data Module -> (Add TADOQuery, TDataSetProvider ...)
2) Run (register)

COM+ DLL
------
1) New -> ActiveX library -> Add Remote Data Module -> (Add TADOQuery, TDataSetProvider ...)
2) build into a dll
3) execute dcomcnfg.exe
  new COM+ application -> new COM Object -> select the dll above

=============================================================================
Client
=============================================================================
(in program's view of point, TDCOMConnection and TSocketConnection are not very
distinctive, if you are using TSocketConnection, run scktsrvr.exe beforehand, just set
ComputerName, and select a ServerName, not matter the Server is a COM DLL or EXE)

------
1) New -> Application
2) Add TDCOMConnection, set ComputerName to '127.0.0.1', select a ServerName from
  DropDown, you can see the COM Object
3) Add TClientDataSet, set RemoteServer, ProviderName
4) call TClientDataSet.ApplyUpdate(-1) when update DB


=============================================================================
How Data is pass to Client Application (auto)
=============================================================================
Client Send Request
1) ClientDataSet.BeforeGetRecords
2) DataSetProvider.BeforeGetRecords
3) DataSetProvider.OnGetData
4) DataSetProvider.AfterGetRecords
5) ClientDataSet.AfterGetRecords

=============================================================================
How Data is pass to Client Application (manual)
=============================================================================
1) Implement TDataSetProvider.OnDataRequest
2) Call ClientDataSet.Provider.DataRequest

=============================================================================
Data synchronization with Database
=============================================================================
0. Invoke TClientDataSet.ApplyUpdate
1. Fire TDataSetProvider.OnUpdateData (Event)
// for each changed record
2. TDataSetProvider.BeforeUpdateRecord (Event)
3. Verify the "Applied" parameter of TDataSetProvider.BeforeUpdateRecord
4a. (Applied = false) Update DataBase Recrod (according TDataSetProvider.ResolveToDataSet feature etc..)
4b. (Applied = true) Handled by Programmer
5a. In the case of error, Fire TDataSetProvider.OnUpdateError
5b. Fire TClientDataSet.OnReconcileError


=============================================================================
Important properties of TDataSetProvider
=============================================================================
TDataSetProvider.Options: (poPropogateChanges, poAllowCommandText)
TDataSetProvider.UpdateMode: upWhereKeyOnly
=============================================================================
Important properties of TField
=============================================================================
ProviderFlags 

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值