diff options
author | Yorhel <git@yorhel.nl> | 2011-01-21 12:52:00 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2011-01-21 12:52:00 +0100 |
commit | bb90f3b7d80485e2290ae3a6b229bc6aa5bd2a72 (patch) | |
tree | 0a65616a54de941c764539de129b293cf055da31 /lib/TUWF/DB.pm | |
parent | 6063a0dad55541d7026d4d62dc7e9fc6025bcf95 (diff) |
TUWF::DB: Use DBI's neat_list() function for log_queries
Rather neat function (pun intended).
Diffstat (limited to 'lib/TUWF/DB.pm')
-rw-r--r-- | lib/TUWF/DB.pm | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/TUWF/DB.pm b/lib/TUWF/DB.pm index 16057ce..00d1aa0 100644 --- a/lib/TUWF/DB.pm +++ b/lib/TUWF/DB.pm @@ -15,6 +15,7 @@ our @EXPORT_OK = ('sqlprint'); sub dbInit { my $self = shift; + require DBI; my $login = $self->{_TUWF}{db_login}; my $sql; if(ref($login) eq 'CODE') { @@ -143,10 +144,8 @@ sub sqlhelper { # type, query, @list # count and log, if requested my $itv = Time::HiRes::tv_interval($start) if $self->debug || $self->{_TUWF}{log_slow_pages} || $self->{_TUWF}{log_queries}; - $self->log(sprintf '[%7.2ms] %s | %s', - $q[0], $itv*1000, - join(', ', map defined($_)?"'$_'":'NULL', @q[1..$#q]) - ) if $self->{_TUWF}{log_queries}; + $self->log(sprintf '[%7.2ms] %s | %s', $q[0], $itv*1000, DBI::neat_list([@q[1..$#q]])) + if $self->{_TUWF}{log_queries}; push(@{$self->{_TUWF}{DB}{queries}}, [ \@q, ]) if $self->debug || $self->{_TUWF}{log_slow_pages}; |