SQL Stored Procedures and Delphi
My latest project, another Regional Telemetry System upgrade, involves a Delphi front end which displays a tree view representing the structure of a site. It interfaces to SQL Server, which provides all of the data, and all of the transactions between the database and the front end use stored procedures. To simplify the calling of the procedures, I created a descendent of the TAdoStoredProcedure, with methods for InitName, AddParam, IntParam and OutParam. So the code becomes:
Getter.InitName := 'Live.sp_ui_get_site_info';
Getter.Addparam ('@SiteName', fSitename);
Getter.IntParam ('@Switch', 1);
Getter.ExecProc;
This works fine for normal procedures, which return quickly. For slower ones, I wanted to call the procedure asynchronously. There are three options: you can set the executeOptions to eoAsyncFetch, eoAsyncExecute or eoAsyncFetchNoBlocking. I have not found that these work very well. The only one that does is the eoAsyncExecute. So I use:
Getter.InitName := 'Live.sp_ui_rebuild_all_sites';
Getter.ExecuteOptions := [eoAsyncExecute];
Getter.Open;
Admittedly, it doesn’t actually return a proper dataset, but it does fire the ExecuteComplete event, and I use that to fetch the data if required.
Starting out with the Raspberry Pi »
Dear Bob,
have you ever received an answer? I have got the same problem.
Greetings
Thorsten