Solved

TstoredProc.prepare and unprepare... when do that

Posted on 1998-08-16
4
1,322 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
  • 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now