ADO + Joined SQL + BatchUpdate = 无解?(200分)

  • 主题发起人 主题发起人 pclover
  • 开始时间 开始时间
P

pclover

Unregistered / Unconfirmed
GUEST, unregistred user!
做个两层的MIS系统,经常要用到4,5个表关联,如客户,定单,产品,货币,单位等等,
同时因为UI的需要,要保留客户代码,产品代码等给用户显示/选择,同时想用缓存更新
模式,怎么解决呢?
下面是Borland NewsGroup的讨论,无解,各位高手给个方案吧。
Sanyo,

I know exactly what you are trying to achieve. Unfortunately ADO is not
as flexible as the Borland's T(Client)DataSet model. There's no en efficient
way to achieve TUpdateSQL functionality with ADO that I know of.

There are 3 possible workarounds though.
1. Use client-side lookup fields instead of a joined SQL select statement.
我的理解:用Lookup,假设你有几千个客户,产品,性能会很差。
2. Insert a Provider and a ClientDataSet between the ADODataSet and the
DataSource.
我的理解:若是父子表,得用8个Component,恐怖,也放慢打开速度。
3. Intercept the UpdateBatch call, apply the pending updates via a separate
command object and then Requery the original ADODataSet.
我的理解:等于加个"TAdoUpdateSQL",更新完了还得Requery,更恐怖。
All techniques have their pros and cons but the 1st and the second one are
much simpler to implement and are mostly client-side.
I've seen some third party implementations of a TADOUpdateSQL component
which all employ technique 3 above but they all suffer the overhead imposed by
the additional Requery operation.
Note that not all techniques are applicable in all situations. Things get much more
complicated when BatchUpdates are combined with joined SQL and master/detail.
All these complications descend from the simple fact that MS won't allow us developers
to interfere with the internal generation of their precious update statements. ADO
doesn't even respect its own [Unique Table] property for inserts and updates.

There may be a perfect data connectivity layer but I have yet to see it. <g>

HTH
--
Vassil Nazarov
http://web.orbitel.bg/vassil/
 
ADO在多表连接时的更新问题也一直困扰着我,原来缓存更新,但ADO实在太“智能”了,它不
分青红皂白就一古脑儿全部更新它认为修改过的字段,不管是在哪个表中,这样如果我有的表只
是用作Lookup查询而不需要更新的话就没有办法。我原来试过用原生的ADO函数,但还是解决不了
问题。所以后来我全部改用SQL语句手工更新了。用Lookup字段?确实能够解决这个问题,但如果
关联的表很大呢?有没有想过速度跟系统开销的问题。ADO不同于BDE,如果不加任何限制条件
的话,它会完全把数据库中的数据读到内存中。
ADO + Joined SQL + BatchUpdate = 无解,本人认为确实是这样。究其原因,无非就是Delphi无
法很好地驾奴ADO的缘故,毕竟这是两大开发工具商的竞争行为。所以我建议做小程序或者用
微软自身的开发工具(如VB、VC)时,用ADO是一个不错的选择;但如果使用Delphi或者BCB开发
大型项目,我强烈推荐还是使用BDE比较好。ADO可能会省那么一点功夫,但以后出现的麻烦会
让你头痛不已。
 
对啊,有些自己用SQL语句更新,控制更灵活。
 
forgot2002的话我也认同,但大家做企业系统好象较多使用Delphi+Ado吧,
那大家怎么解决这个问题呢?
 
多人接受答案了。
 
后退
顶部