Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

DBI trace and Apache

by Anonymous Monk
on Sep 14, 2019 at 06:55 UTC ( [id://11106161]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm redirecting DBI trace to a file from within a CGI script.
The script contains some info but not the sql query.
There has to be something wrong with the environment becuase in other servers I can see the sql output
Any htoughts?

Replies are listed 'Best First'.
Re: DBI trace and Apache
by Corion (Patriarch) on Sep 14, 2019 at 07:21 UTC

    Maybe it is your version of DBI on that machine?

    You can output that by using

    print "Installed DB driver versions, and DBI version:\n"; DBI->installed_versions;

    This will output something like:

    Perl : 5.028001 (x86_64-linux-gnu-thread-multi) OS : linux (4.9.0) DBI : 1.642 DBD::Sponge : 12.010003 DBD::SQLite : 1.64 DBD::Proxy : install_driver(Proxy) failed: Can't locate RPC/PlC +lient.pm in @INC (you may need to install the RPC::PlClient module) DBD::Mem : 0.001 DBD::Gofer : 0.015327 DBD::File : 0.44 DBD::ExampleP : 12.014311 DBD::DBM : 0.08

    Alternatively, you can hook into the execution of SQL statements and output them yourself (if the version of DBI is recent enough):

    sub dbh_install( $self, $dbh ) { my $previous_handler = $dbh->{HandleError}; $dbh->{Callbacks} = { prepare => sub { my ($dbh, $query, $attrs) = @_; print "Preparing q{$query}\n" }, execute => sub { print "Executing ", shift->{Statement}, "\n"; } }; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11106161]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-25 20:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found