Link to home
Start Free TrialLog in
Avatar of golem
golem

asked on

TstoredProc.prepare and unprepare... when do that

HI, i´m begin using delphi 3.0 with Interbase 5.0 the perfomance
work fine, but recently one friend tell me that exist one bug in
delphi called "SQLDA BUG"... To avoid that bug this guy tell me
that I must unprepare the storeproc every time I used it.
I do that in this form :


 with dtmtest.storedprocTest do
   begin
         unprepare;
         prepare;
         parambyname("INTESTNO").AsInteger := _iDummy;
         execproc;
   end;

And I Found that the perfomance go to hell. I called my store in a cycle importing
 from text files, so i called the storep 30000 times or more. (To the EOF of file tha import).
So I tried to search the web for help, and to find the SQLD bug, but
I don´t see nothing of this in the web, so I write this email for help.
PLEASE send me a email as quickly as you can, I´m in very troubles...
the perfomance is not acceptable to my boss... (using the unprepare every time).
My old code was :
 with dtmtest.storedprocTest do
   begin
         prepare;
         parambyname("INTESTNO").AsInteger := _iDummy;
         execproc;
   end;

I read  the paper "Using Stored Procedures with Delphi and Interbase"
at http://www.inprise.com/delphi/papers/dl080/dl080.html and do
the job similar to my  old code.
I read the help from delphi 3 (Tstoredproc.Prepare) and I understood that I must
call prepare exactly once, use the store n-times, and when
no longer need the storeproc call exactly once unprepare. Are this correct???

PLEASE HELP ME!!!!

                                                    Oscar Golem


P.D.: I´m in Argentina, my english (as you can see) is very poor.
Sorry! :-)
P.P.D.: Thank you for your time.
Avatar of bozo7
bozo7
Flag of United States of America image

I have never heard of this SQLDA Bug.
What I have used in the past is

TStoredProc.Unprepare;
TStoredProc.Parambyname('1').asstring := 'Hello';
TStoredProc.prepare;
TStoredProc.ExecProc;

My Understanding  was that you call prepare after all the parameters are set. I would think that by calling prepare and setting parameters would unprepare the Proc again.

Maybe I am wrong though
bozo
Avatar of golem
golem

ASKER

Today (18-7) i change the code in this way:
with dtmtest.storedprocTest do
       begin
             if not prepared then prepare;
             parambyname("INTESTNO").AsInteger := _iDummy;
             execproc;
       end;
The program works fine and fast!!! BUT WHEN I test the program in client/server environment the SQLDA BUG Arise!!!
 The storeprocedure cancel with message :
  "General SQL error.
   SQLDA missing or incorret version, or incorrect number/type of variables"
But when i run the program in local mode (interbase server & my program in the same machine) thats works fine!!!.
I using BDE 4.00, SQL Links & Delphi 3.0, and Interbase 5.0...
Somebody knows if this bug was fixed in delphi 4.0 or bde 5.0?????





This may sound strange... but when we call stored procedures we do this:

begin
  // Set Parameters here
  if not Prepared then Prepare;
  execproc;
end;

I use Delphi 3.02 and BDE 4.51 and Oracle. I don't have any problems with performance or SQLDA bug.
ASKER CERTIFIED SOLUTION
Avatar of Marcius
Marcius

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