Link to home
Start Free TrialLog in
Avatar of eban
eban

asked on

BDE specific

Hello
I am using C++ -> BDE -> SQL links -> MSSQL

I need a BDE specific answer. When using BDE to access MSSQL, how should I go about getting the result sets. As far as I can tell you have to call a series of DBI functions, i.e.
(In this order of calling)
DbiQAlloc
DbiQPrepare
DbiQSetParams
DbiQExec
DbiQInstantiateAnswer

Is this the right way to go about using BDE to get the result sets from MSSQL, or is there another way?

Thanks Eban.
Avatar of eban
eban

ASKER

Adjusted points to 100
ASKER CERTIFIED SOLUTION
Avatar of Pegasus100397
Pegasus100397

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of eban

ASKER

Thank for your comment Pegasus,

Is this the way you use BDE with MSSQL? I am not sure but are there any other ways of doing it. Is it better to use native handles to the tables? I read that it could be but I really don't understand what native handles are. I am finding the operations slow doing it with the above calls and I need to speed things up.

Just a clarifictaion, you said to release the DB handle when I don't need it anymore, do you mean to release it after each result set or after I have finished with the table? (I assume you mean when I have finished with the table)

Thanks for your time
Eban.
Eban,

Free the handle after you have finished all operations on the table. While opening and closing the handle often can free resources (handlers) on the server, it's usually better performance-wise to keep the handle available until you don't need the table anymore.

My C++ is very rusty (mainly Delphi now) but you seem to be on the right track. Remember that you only need to Alloc, Prepare, SetParams,  Exec and instantiate once (unless the query changes). If you just need to set some different params (but the query remains the same) then just SetParams, Exec and Instantiate. Since the handle has already been Alloc'd and the basic query has not changed, there is no need to re-Alloc & re-Prepare the query.

Good luck :)
Pegasus