Fra*_*anz 6 sql-server delphi ado
我可以使用DELPHI,dbgo数据库组件和SQL Server数据库服务器编写SQL查询,这些查询在处理时间方面受到限制吗?
喜欢
select * from table where ......
Run Code Online (Sandbox Code Playgroud)
和process_time_limit = 5 sec?
最好在一个时间限制内给出10%的行,而不是等待完整的查询数据集
ADO 组件:
我会尝试异步数据获取。当您执行查询时,您会记得何时开始,并且每次OnFetchProgress事件触发时,您都会检查该查询是否EventStatus仍处于esOK状态,并检查查询执行以来所用的时间。如果过期,您可以使用Cancel数据集上的方法取消数据获取。
我打算使用类似以下(未经测试)的伪代码:
var
FQueryStart: DWORD;
procedure TForm1.FormCreate(Sender: TObject);
begin
// configure the asynchronous data fetch for dataset
ADOQuery1.ExecuteOptions := [eoAsyncExecute, eoAsyncFetchNonBlocking];
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
// store the query execution starting time and execute a query
FQueryStart := GetTickCount;
ADOQuery1.SQL.Text := 'SELECT * FROM Table';
ADOQuery1.Open;
end;
procedure TForm1.ADOQuery1FetchProgress(DataSet: TCustomADODataSet; Progress,
MaxProgress: Integer; var EventStatus: TEventStatus);
begin
// if the fetch progress is in esOK (adStatusOK) status and the time since
// the query has been executed (5000 ms) elapsed, cancel the query
if (EventStatus = esOK) and (GetTickCount - FQueryStart >= 5000) then
DataSet.Cancel;
end;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1054 次 |
| 最近记录: |