Author: turnstep
Date: Mon Aug 18 19:30:39 2008
New Revision: 11667
Modified:
DBD-Pg/trunk/Changes
DBD-Pg/trunk/Pg.pm
Log:
More variations of the 'DBD' tracing, and turn off the pgprefix.
Modified: DBD-Pg/trunk/Changes
==============================================================================
--- DBD-Pg/trunk/Changes (original)
+++ DBD-Pg/trunk/Changes Mon Aug 18 19:30:39 2008
@@ -2,7 +2,9 @@
2.10.0
- - Add the 'DBD' trace setting to output only non-DBI trace messages. [GSM]
+ - Add the 'DBD' trace setting to output only non-DBI trace messages,
+ and allow 'dbd_verbose' as a connection attribute for the same
+ effect. [GSM]
2.9.2 Released August 18, 2008 (subversion r11664)
Modified: DBD-Pg/trunk/Pg.pm
==============================================================================
--- DBD-Pg/trunk/Pg.pm (original)
+++ DBD-Pg/trunk/Pg.pm Mon Aug 18 19:30:39 2008
@@ -80,7 +80,7 @@
## These two methods are here to allow calling before connect()
sub parse_trace_flag {
my ($class, $flag) = @_;
- return 0x7FFFFF00 if $flag eq 'DBD';
+ return (0x7FFFFF00 - 0x08000000) if $flag eq 'DBD'; ## all but the prefix
return 0x01000000 if $flag eq 'pglibpq';
return 0x02000000 if $flag eq 'pgstart';
return 0x04000000 if $flag eq 'pgend';
@@ -185,7 +185,7 @@
sub connect { ## no critic (ProhibitBuiltinHomonyms)
- my ($drh, $dbname, $user, $pass)= @_;
+ my ($drh, $dbname, $user, $pass, $attr) = @_;
## Allow "db" and "database" as synonyms for "dbname"
$dbname =~ s/\b(?:db|database)\s*=/dbname=/;
@@ -214,6 +214,12 @@
my $version = $dbh->{pg_server_version};
$dbh->{private_dbdpg}{version} = $version;
+ if ($attr) {
+ if ($attr->{dbd_verbose}) {
+ $dbh->trace('DBD');
+ }
+ }
+
return $dbh;
}
@@ -1806,6 +1812,11 @@
$password,
{AutoCommit => 0, RaiseError => 1});
+The attribute hash can also contain a key named C<dbd_verbose>, which
+simply calls C<$dbh->trace('DBD')> after the handle is created. This attribute
+is not recommended, as it is clearer to simply explicitly call C<trace> explicitly
+in your script.
+
=head3 B<connect_cached>
$dbh = DBI->connect_cached("dbi:Pg:dbname=$dbname", $username, $password, \%options);
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.