[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1419
  • Last Modified:

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.
0
golem
Asked:
golem
  • 2
1 Solution
 
bozo7Commented:
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
0
 
golemAuthor Commented:
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?????





0
 
MarciusCommented:
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.
0
 
MarciusCommented:
Try this:

with dtmtest.storedprocTest do begin
     parambyname("INTESTNO").AsInteger := _iDummy;
     if not prepared then prepare;
     execproc;
end;

I makes sense that if you prepare the query without the correct parameters set, if will not function correctly.

Good luck, Marcius :)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now