不是问题的问题(50分)

  • 主题发起人 主题发起人 zyx1122
  • 开始时间 开始时间
Z

zyx1122

Unregistered / Unconfirmed
GUEST, unregistred user!
Whatdo
es delphido
when running "select * from ..." in server side ?
And whatdo
es delphido
in client side?
Whether when running in client side, delphi will run it in server side
and get all data from database and send the data to client side.
I mean every time running in client side, delphi will run it in server side.
eg:
select * from orders where CustNo = '001'
Now run it in client side, and delphi will run it in server side, is it?
And then
run
select * from orders where CustNo = '002'
Whether delphi runs it in server side again or
delhpi run only one time "select from orders' without "where CustNo = '001''
and gets all data to client side. So when client side runs sql it just gets
data from its own memory.
why I ask this because I write code like follow, I want to know whether delphi
will run very time in server side when I change CommandText.
/////////////////////// AfterScroll //////////////////////
procedure TdmMDC.cdsMasterAfterScroll(DataSet: TDataSet);
var
strMasterField : string;
begin
cdsDetail.Close;
strMasterField := cdsMaster.FieldByName('CustNo').AsString;
cdsDetail.CommandText := 'select * from orders where CustNo = "'
+ strMasterField + '"';
cdsDetail.Open;
end;
 
在服务器端执行你的查询代码,本地只负责向服务器端传递确切的SQL 语句!
的出的结果返回一个结果集到本地!由本地的数据控件显示出来.但对于相同的
SQL 语句如果仅仅是参数不同的则由于在服务器端已经有了该语句的缓冲,所以
服务器端将替换参数进行查询,速度会比第一次查询快!但需要你在OPEN语句前
加上prepared
 
应该每次都在服务端执行,除非有缓冲。
 
后退
顶部