?
Solved

TstoredProc.prepare and unprepare... when do that

Posted on 1998-08-16
4
Medium Priority
?
1,388 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 400 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month15 days, 8 hours left to enroll

741 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