Subject | Re: BeforePrepare and IBObjects 4.5 |
---|---|
Author | Svein Erling Tysvær |
Post date | 2005-01-26T14:32:27Z |
Hi Gerard!
First of all, I never use TIBO components, just TIB_ components, so
I'm not really qualified to answer.
To me, assigning parameters in BeforePrepare sounds like assigning
values to an object before creating it - i.e. something that doesn't
work. I call prepare in order to make the dataset ready for assigning
parameters etc, and before that's done, there is no place to put the
values. Changing the SQL itself in BeforePrepare sounds fine -
including assigning a constant to where you would otherwise have a
parameter, but not assigning a value to a parameter that doesn't yet
exist.
My guess is that when IBO discovers ParamByName, it knows that it has
to prepare the statement, tries to do so and discovers the ParamByName
in the BeforePrepare yet again and so the loop is already started and
continues until the memory is exhausted.
Now, if I remember correctly, the BDE (which TIBO tries to emulate)
used to have persistent fields, and that is what makes me puzzled
about my reasoning above and makes me question whether it in fact
should be possible to use the BeforePrepare method to assign values to
parametres. Since no-one has answered you, I still thought writing
this answer would be better than continued silence.
Sorry for not having a solution or great explanation,
Set
First of all, I never use TIBO components, just TIB_ components, so
I'm not really qualified to answer.
To me, assigning parameters in BeforePrepare sounds like assigning
values to an object before creating it - i.e. something that doesn't
work. I call prepare in order to make the dataset ready for assigning
parameters etc, and before that's done, there is no place to put the
values. Changing the SQL itself in BeforePrepare sounds fine -
including assigning a constant to where you would otherwise have a
parameter, but not assigning a value to a parameter that doesn't yet
exist.
My guess is that when IBO discovers ParamByName, it knows that it has
to prepare the statement, tries to do so and discovers the ParamByName
in the BeforePrepare yet again and so the loop is already started and
continues until the memory is exhausted.
Now, if I remember correctly, the BDE (which TIBO tries to emulate)
used to have persistent fields, and that is what makes me puzzled
about my reasoning above and makes me question whether it in fact
should be possible to use the BeforePrepare method to assign values to
parametres. Since no-one has answered you, I still thought writing
this answer would be better than continued silence.
Sorry for not having a solution or great explanation,
Set
--- In IBObjects@yahoogroups.com, Gerard J.M.Houtenbos wrote:
> The problem I'm encountering is very easy to reproduce:
>
> Just make an new application with a TIBODatabase, a TIBOStoredProc
> and a TButton component. The SP must point to a FireBird-SP with
> input pararmeters. Give the parameters a value in the
> BeforePrepare-event of the TIBOStoredProc and execute the SP with
> the TButton. That will give a "Stack overflow" because it is called
> many times!?
>
> If you give the parameters a value in the AfterPrepare-event then
> all goes well.
>
> If I use version 4.2 all goes well also.