Log::ger::DBI::Query - Log DBI queries (and results)
This document describes version 0.001 of Log::ger::DBI::Query (from Perl distribution Log-ger-DBI-Query), released on 2017-06-19.
use DBI; use Log::ger::DBI::Query; # now SQL queries will be logged my $dbh = DBI->connect("dbi:...", $user, $pass); $dbh->do("INSERT INTO table VALUES (...)");
From command-line:
% TRACE=1 perl -MLog::ger::Output::Screen -MLog::ger::DBI::Query your-dbi-app.pl
To also log SQL results:
% TRACE=1 LOG_SQL_RESULT=1 \ perl -MLog::ger::Output::Screen -MLog::ger::DBI::Query your-dbi-app.pl
Sample log output:
SQL query: {{INSERT INTO table VALUES (...)}
This is a simple module you can do to log SQL queries for your DBI-based applications.
For queries, it logs calls to prepare(), do(), select*.
prepare()
do()
select*
For results, it logs calls to do(), select*, fetch*.
fetch*
Compared to Log::ger::For::DBI, it produces a bit less noise if you are only concerned with logging queries.
Please visit the project's homepage at https://metacpan.org/release/Log-ger-DBI-Query.
Source repository is at https://github.com/perlancar/perl-Log-ger-DBI-Query.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Log-ger-DBI-Query
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
Log::ger::DBI::QueryResult
Log::ger::For::DBI which logs more methods, including connect(), etc..
connect()
perlancar <perlancar@cpan.org>
This software is copyright (c) 2017 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Log::ger::DBI::Query, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::ger::DBI::Query
CPAN shell
perl -MCPAN -e shell install Log::ger::DBI::Query
For more information on module installation, please visit the detailed CPAN module installation guide.