Subject | Re: [IBO] How to log a SQL with filled params? |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2006-07-10T07:11:33Z |
Four days and no answers? OK, I'll have a go, though there may be
mistakes in my answer...
I don't think the values of parameters are ever put together with the
sql! Of course they are somehow associated with the sql statement, but I
don't think
select birthdate from mytable where name = :nameparam
is ever replaced by
select birthdate from mytable where name = 'Ronni'
by IBO. IBO is responsible for parameter names, and Firebird knows about
parameter ordering (but not names) after prepare. IBO fills the value of
parameters in a structure (not the sql itself) and sends a request to
Firebird.
My guess is that you have to do the 'parameter replacement' yourself. It
shouldn't be too difficult unless you use ':' for other things than
parameter names or use a parameter that starts with the name of another
parameter (e.g. :paramname and :paramname_new). Get the IB_Query's SQL,
use a for loop and ParamCount or something like that, find the name of
the parameter and replace with the value.
HTH,
Set
ronald_greven wrote:
mistakes in my answer...
I don't think the values of parameters are ever put together with the
sql! Of course they are somehow associated with the sql statement, but I
don't think
select birthdate from mytable where name = :nameparam
is ever replaced by
select birthdate from mytable where name = 'Ronni'
by IBO. IBO is responsible for parameter names, and Firebird knows about
parameter ordering (but not names) after prepare. IBO fills the value of
parameters in a structure (not the sql itself) and sends a request to
Firebird.
My guess is that you have to do the 'parameter replacement' yourself. It
shouldn't be too difficult unless you use ':' for other things than
parameter names or use a parameter that starts with the name of another
parameter (e.g. :paramname and :paramname_new). Get the IB_Query's SQL,
use a for loop and ParamCount or something like that, find the name of
the parameter and replace with the value.
HTH,
Set
ronald_greven wrote:
> Hi there,
>
> I use Delphi5, Firebird 1.0/1.5 (both) and IB_Objects.
>
> For excample we use a loop, where each time, new values be set to a sql.
> (ParamByName)
> Is there a way to log each of this sql's with all params like
> "savetofile" or something like that?
>
> Or maybe another way?
>
> It's really easy to save a IB_Query SQL, but only with the Paramnames,
> not the values..
>
> Best greetings..
>
> Ronni