Hi,

What if you took a look at how trace is implemented? But then again I don't
remember seeing values from any trace level until after the execute with
either.

Eric 

At 09:35 AM 8/30/02 -0400, Jeff Urlwin wrote:
>Did you look at the new ParamValues attribute?  Yes, many drivers probably
>do not support it yet, but that's what it's for. (Also, DBD::ODBC does
>support it and I believe that even if DBD::Oracle doesn't yet support it a
>small lift of the same/similar code from DBD::ODBC to DBD::Oracle should
>work...
>
>Regards,
>
>Jeff
>>
>> Hello,
>>
>> In an attempt to add some custom logging into DBI calls, I have
>> over-ridden
>> the execute method of DBI with a custom execute method.  The
>> project I have
>> includes writing out the SQL statement that is at fault if execute blows
>> up.  This needs to be transparent to the user, and must work with all
>> existing DBI code that has been writen.
>>
>> My approach is simple.  Override execute, add some error logging if $@
>> returns back anything from an eval calling the real DBI execute.
>> One piece
>> is missing though.
>>
>> While printing out the statement from $pkg->{'STATEMENT'}, the
>> placeholders
>> used (?) ends up coming in literally.  This is fine and I wouldn't mind
>> substituting the values passed for the bindings, but I cannot get to the
>> values.  Let me clear that up..
>>
>> If the user calls execute, binding the params within the execute,
>> I can get
>> them.  They are passed to my execute statement and I can grab
>> them from @_,
>> but if the params are passed using bind_param, I cannot get them, save for
>> overriding the bind_param statement as well (somthing I would rather not
>> do).
>>
>> To make a long story short, I would like to know if there is any way to
>> access the values passed in a bind_param method call.
>>
>> Here is the over-ridden execute method, this works except for the
>> parameter
>> part.
>>
>> Thanks in advance.
>>
>> -Mark
>>
>> sub execute {
>>   my $pkg = shift;
>>   my $statement = $pkg->{'Statement'};
>>
>>   # if RaiseError or PrintError are set to 1 (lets hope), lets make sure
>>   # we don't print the DBI error until we are ready to do so.
>>   {
>>     open TRAP, ">/dev/null";
>>     local *STDERR = *TRAP;
>>     eval { $pkg->SUPER::execute(@_); };
>>     close TRAP;
>>   }
>>
>>   my @params = @_;
>>   my $params = (@params) ? \@params : (
>>                my $tmp_p = $pkg->FETCH('driver_params') ? $tmp_p : [] ) ;
>>
>>   my $num_of_parms = $pkg->{'NUM_OF_PARAMS'};
>>
>>   print "Number of Parameters: $num_of_parms\n";
>>   print "Parms = @$params\n";
>>   print "Executing Statement -> \n";
>>   print "\n".&$pretty_print($statement)."\n";
>>
>>   if ($@) {
>>     warn "Could not execute statment -> \n";
>>     warn "\n".&$pretty_print($statement)."\n";
>>     die "$@\n";       # Yes this is intentional, die no matter what.
>>   }
>> }
>>
>>
>>
>>
>
>

http://www.kwinternet.com/eric
(250) 655 - 9513 (PST Time Zone)

"Inquiry is fatal to certainty." -- Will Durant 




Reply via email to