TDataSetProvider 元件的設定

探讨了TDataSetProvider元件的UpdateMode特性如何影响SQL更新语句的生成,包括upWhereAll与upWhereKeyOnly的区别,以及ResolveToDataSet特性如何决定更新资料的方式。分析了不同设置下SQL语句的效率,提出最高效的数据更新策略。

 

TDataSetProvider 元件的設定

 

TDataSetProvider 元件的 UpdateMode 特性值會影響 TDataSetProvider 元件

產生什麼樣的 SQL 敘述來更新資料。在內定上 TDataSetProvider 元件的

UpdateMode upWhereAll

由於在尋找資料時也必須比對所有的欄位數值,所以是比較緩慢的更新方式。

 

UpdateMode 設定為 upWhereKeyOnly 那麼應用程式伺服器將會執行的

快一點。UpdateMode 設定為 upWhereKeyOnly 是表示當 TDataSetProvider

件在資料庫中尋找要被更新的資料時,是直接使用資料的索引值來搜尋資料

的。

 

TDataSetProvider 元件是使用它連結的資料集來更

新資料時,自動產生的 SQL 敘述是由資料集的設定值來控制的,

TDataSetProvider 元件的設定值不再有影響力

 

ResolveToDataSet 特性是 False 時,TDataSetProvider 元件是自己產生更新資料的 SQL 敘述把異動的資料更新回資料庫,而當 ResolveToDataSet 特性是 True時,它則呼叫它連結的資料集元件把異動的資料更新回資料庫。

 

TDataSetProvider 元件自動產生的 SQL 敘述對於

一次異動的所有資料只會要求資料庫 prepare 一次 SQL 敘述。每次更新資料

時,只是代入不同的動態參數,這種執行方式非常的快速。

 

TDataSetProvider 元件使用資料集更新資

料時。對於每一筆更新的資料都會要求資料庫 prepare 一次 SQL 敘述。這比起

前面讓 TDataSetProvider 元件自動產生 SQL 敘述的方式來得非常沒有效率。

因為更新多筆資料時,每一筆資料的資料表綱要應該是一樣的,並不需要為相

同的 SQL 敘述準備 prepare 這麼多次。但是如果你仔細觀察使用資料集更新資

料時,它在更新之後,只會取回異動的資料,而不是像前面是取得所有的資

料。所以使用資料集更新資料的方式雖然在執行更新資料的 SQL 敘述比較沒

有效率,但是在從資料庫取得異動之後的資料卻是有效率的多了。

 

TDataSetProvider 元件使用資料集元件更新資料,再配合執行已經

Prepare 好的 SQL 敘述會是最有效率的方式。可以考慮使用

另外的 TQuery 元件執行事先寫好的 SQL 敘述,並且在應用程式伺服器啟

動時先 prepare 這些 TQuery 元件的 SQL 敘述,並且在應用程式伺服器結

束時 UnPrepare 這些 TQuery 元件的 SQL 敘述。

 

 

 

 

Delphi 7.1 Update Release Notes=======================================================This file contains important supplemental and late-breakinginformation that may not appear in the main productdocumentation, and supersedes information contained in otherdocuments, including previously installed release notes.Borland recommends that you read this file in its entirety.NOTE: If you are updating a localized version of Delphi 7, visit the Borland Registered User web site to obtain a localized readme file that may contain important late- breaking information not included in this readme file.IMPORTANT: Delphi must be closed before installing this update. =====================================================CONTENTS * INSTALLING THIS UPDATE * UPDATING LOCALIZED VERSIONS OF DELPHI 7 * KNOWN ISSUES * ISSUES ADDRESSED BY THIS UPDATE - IDE - CORE DATABASE - DATASNAP - DBGO (ADO COMPONENTS) - dbExpress - dbExpress COMPONENTS AND DB VCL - dbExpress CORE DRIVER AND METADATA - dbExpress VENDOR ISSUES - dbExpress CERTIFICATION - WEB SNAP - ACTIVEX - COMPILER - RTL - VCL - THIRD PARTY - BOLD FOR DELPHI * VERIFYING THAT THE UPDATE WAS SUCCESSFUL * FILES INSTALLED BY THIS UPDATE =======================================================INSTALLING THIS UPDATE* This update can not be applied to Delphi 7 Architect Trial version. * This update can not be removed after it is installed.* You will need the original Delphi 7 installation CD available to install this update.* To install this update from the CD, insert the CD, and launch the d7_ent_upd1.exe file appropriate for your locale.* To install this update from the Web, double-click the self-executing installation file and follow the prompts. * The Delphi 7 documentation PDF files are available on the update CD.========================================================UPDATING LOCALIZED VERSIONS OF DELPHI 7* This update can be applied only to the English version of Delphi 7. There are separate updates for the German, French and Japanese ver
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值