Solved

TstoredProc.prepare and unprepare... when do that

Posted on 1998-08-16
4
1,360 Views
Last Modified: 2012-08-13
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
Comment
Question by:golem
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Expert Comment

by:bozo7
ID: 1335954
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
 

Author Comment

by:golem
ID: 1335955
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
 
LVL 1

Expert Comment

by:Marcius
ID: 1335956
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
 
LVL 1

Accepted Solution

by:
Marcius earned 200 total points
ID: 1335957
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question