Author: turnstep
Date: Sat Mar 1 18:43:41 2008
New Revision: 10863
Modified:
DBD-Pg/trunk/.perlcriticrc
DBD-Pg/trunk/Changes
DBD-Pg/trunk/Pg.pm
DBD-Pg/trunk/t/04misc.t
Log:
Localized trace_flag names should be lowercase.
Modified: DBD-Pg/trunk/.perlcriticrc
==============================================================================
--- DBD-Pg/trunk/.perlcriticrc (original)
+++ DBD-Pg/trunk/.perlcriticrc Sat Mar 1 18:43:41 2008
@@ -2,7 +2,7 @@
profile-strictness = quiet
[Documentation::PodSpelling]
-stop_words = ActiveKids AutoCommit CachedKids ChildHandles ChopBlanks
CompatMode CursorName DBD DBI Datatype dbdpg ErrCount FetchHashKeyName
HandleError HandleSetErr InactiveDestroy LongReadLen LongTruncOk Mergl Momjian
Mullane NULLABLE OID PgBouncer PGEND PGERROR PGLIBPQ PGLOGIN PGNOPREFIX
PGPREFIX PGQUOTE PGSTART PGWARN Postgres PostgreSQL PrintError PrintWarn README
RaiseError RowCache RowCacheSize SQL SQLSTATE SSL STDIN STDERR STDOUT Sabino
Savepoints ShowErrorStatement TaintIn TaintOut TraceLevel UTF Username
afterwards arrayrefs attr autocommit backend bitmask cancelled datatype dbd dbh
errstr fd filename getfd getline largeobject len libpq pgbuiltin pgsql runtime
savepoint savepoints schemas sslmode tablename tablespace tablespaces typename
username varchar
+stop_words = ActiveKids AutoCommit CachedKids ChildHandles ChopBlanks
CompatMode CursorName DBD DBI Datatype dbdpg ErrCount FetchHashKeyName
HandleError HandleSetErr InactiveDestroy LongReadLen LongTruncOk Mergl Momjian
Mullane NULLABLE OID PgBouncer pgend pglibpq pglogin pgprefix pgquote pgstart
Postgres PostgreSQL PrintError PrintWarn README RaiseError RowCache
RowCacheSize SQL SQLSTATE SSL STDIN STDERR STDOUT Sabino Savepoints
ShowErrorStatement TaintIn TaintOut TraceLevel UTF Username afterwards
arrayrefs attr autocommit backend bitmask cancelled datatype dbd dbh errstr fd
filename getfd getline largeobject len libpq pgbuiltin pgsql runtime savepoint
savepoints schemas sslmode tablename tablespace tablespaces typename username
varchar
[-Bangs::ProhibitCommentedOutCode]
[-Bangs::ProhibitFlagComments]
Modified: DBD-Pg/trunk/Changes
==============================================================================
--- DBD-Pg/trunk/Changes (original)
+++ DBD-Pg/trunk/Changes Sat Mar 1 18:43:41 2008
@@ -8,6 +8,7 @@
[Alexey Tourbin]
- Fixed char count in Renew() (CPAN bug #33738)
[Alexey Tourbin]
+ - Change local trace_flags to lowercase.
2.2.0 Released February 27, 2008 (subversion r10849)
Modified: DBD-Pg/trunk/Pg.pm
==============================================================================
--- DBD-Pg/trunk/Pg.pm (original)
+++ DBD-Pg/trunk/Pg.pm Sat Mar 1 18:43:41 2008
@@ -80,12 +80,12 @@
## These two methods are here to allow calling before connect()
sub parse_trace_flag {
my ($class, $flag) = @_;
- return 0x01000000 if $flag eq 'PGLIBPQ';
- return 0x02000000 if $flag eq 'PGSTART';
- return 0x04000000 if $flag eq 'PGEND';
- return 0x08000000 if $flag eq 'PGPREFIX';
- return 0x10000000 if $flag eq 'PGLOGIN';
- return 0x20000000 if $flag eq 'PGQUOTE';
+ return 0x01000000 if $flag eq 'pglibpq';
+ return 0x02000000 if $flag eq 'pgstart';
+ return 0x04000000 if $flag eq 'pgend';
+ return 0x08000000 if $flag eq 'pgprefix';
+ return 0x10000000 if $flag eq 'pglogin';
+ return 0x20000000 if $flag eq 'pgquote';
return DBI::parse_trace_flag($dbh, $flag);
}
sub parse_trace_flags {
@@ -1849,10 +1849,7 @@
variable C<DBI_TRACE>.
The value is either a numeric level or a named flag. For the
-flags, see L<param_trace_flag>. Note that flag levels usually
-cause DBD::Pg to start most items with "dbdpg: " to help
-distinguish it from DBI tracing output, although this can be turned
-off with the PGNOPREFIX flag.
+flags that DBD::Pg uses, see L<param_trace_flag>.
=item B<trace_msg>
@@ -1863,10 +1860,10 @@
=item B<parse_trace_flag> and B<parse_trace_flags>
- $dbh->trace($dbh->parse_trace_flag('SQL|PGLIBPQ'));
- $dbh->trace($dbh->parse_trace_flag('1|PGSTART'));
+ $dbh->trace($dbh->parse_trace_flag('SQL|pglibpq'));
+ $dbh->trace($dbh->parse_trace_flag('1|pgstart'));
- my $value = DBD::Pg->parse_trace_flags('PGLIBPQ');
+ my $value = DBD::Pg->parse_trace_flags('pglibpq');
DBI->trace($value);
The parse_trace_flags method is used to convert one or more named
@@ -1895,36 +1892,36 @@
For maximum portability of output (but with a potential small performance
hit), use $dbh->{pg_server_prepare} = 0;
-=item PGLIBPQ
+=item pglibpq
Outputs the name of each libpq function (without arguments) immediately
before running it. This is a good way to trace the flow of your program
at a low level. This information is also output if the trace level
is set to 4 or greater.
-=item PGSTART
+=item pgstart
Outputs the name of each internal DBD::Pg function, and other information such
as
the function arguments or important global variables, as each function starts.
This
information is also output if the trace level is set to 4 or greater.
-=item PGEND
+=item pgend
Outputs a simple message at the very end of each function. This is also output
if the
trace level is set to 4 or greater.
-=item PGPREFIX
+=item pgprefix
Forces each line of trace output to begin with the string "dbdpg: ". This
helps to
differentiate it from the DBI tracing output.
-=item PGLOGIN
+=item pglogin
Outputs a message showing the connection string right before a new database
connection
is attempted, a message when the connection was successful, and a message
right after
the database has been disconnected. Also output if trace level is 5 or greater.
-=item PGQUOTE
+=item pgquote
Outputs a message at the start of each quoting function. Not very useful
outside of
DBD::Pg internal debugging purposes.
Modified: DBD-Pg/trunk/t/04misc.t
==============================================================================
--- DBD-Pg/trunk/t/04misc.t (original)
+++ DBD-Pg/trunk/t/04misc.t Sat Mar 1 18:43:41 2008
@@ -34,8 +34,8 @@
$num = DBD::Pg->parse_trace_flag('SQL');
is( $num, 0x00000100, $t);
-$t = q{Method 'server_trace_flag' returns 0x01000000 for DBD::Pg flag
'PGLIBPQ'};
-$num = DBD::Pg->parse_trace_flag('PGLIBPQ');
+$t = q{Method 'server_trace_flag' returns 0x01000000 for DBD::Pg flag
'pglibpq'};
+$num = DBD::Pg->parse_trace_flag('pglibpq');
is( $num, 0x01000000, $t);
$t = q{Database handle method 'server_trace_flag' returns undef on bogus
argument};
@@ -46,16 +46,16 @@
$num = $dbh->parse_trace_flag('SQL');
is( $num, 0x00000100, $t);
-$t = q{Database handle method 'server_trace_flags' returns 0x01000100 for
'SQL|PGLIBPQ'};
-$num = $dbh->parse_trace_flags('SQL|PGLIBPQ');
+$t = q{Database handle method 'server_trace_flags' returns 0x01000100 for
'SQL|pglibpq'};
+$num = $dbh->parse_trace_flags('SQL|pglibpq');
is( $num, 0x01000100, $t);
-$t = q{Database handle method 'server_trace_flags' returns 0x03000100 for
'SQL|PGLIBPQ|PGSTART'};
-$num = $dbh->parse_trace_flags('SQL|PGLIBPQ|PGSTART');
+$t = q{Database handle method 'server_trace_flags' returns 0x03000100 for
'SQL|pglibpq|pgstart'};
+$num = $dbh->parse_trace_flags('SQL|pglibpq|pgstart');
is( $num, 0x03000100, $t);
my $flagexp = 24;
-for my $flag (qw/PGLIBPQ PGSTART PGEND PGPREFIX PGLOGIN PGQUOTE/) {
+for my $flag (qw/pglibpq pgstart pgend pgprefix pglogin pgquote/) {
my $hex = 2**$flagexp++;
$t = qq{Database handle method 'server_trace_flags' returns $hex for
flag $flag};
$num = $dbh->parse_trace_flags($flag);
@@ -84,10 +84,10 @@
$expected = qq{begin;\n\n$SQL;\n\ncommit;\n\n};
is($info, $expected, $t);
- $t=q{Trace flag 'PGLIBPQ' works as expected};
+ $t=q{Trace flag 'pglibpq' works as expected};
seek $fh, 0, 0;
truncate $fh, tell($fh);
- $dbh->trace($dbh->parse_trace_flag('PGLIBPQ'), $filename);
+ $dbh->trace($dbh->parse_trace_flag('pglibpq'), $filename);
$dbh->do($SQL);
$dbh->commit();
$dbh->trace(0);
@@ -111,10 +111,10 @@
};
is($info, $expected, $t);
- $t=q{Trace flag 'PGSTART' works as expected};
+ $t=q{Trace flag 'pgstart' works as expected};
seek $fh, 0, 0;
truncate $fh, tell($fh);
- $dbh->trace($dbh->parse_trace_flags('PGSTART'), $filename);
+ $dbh->trace($dbh->parse_trace_flags('pgstart'), $filename);
$dbh->do($SQL);
$dbh->commit();
$dbh->trace(0);
@@ -132,10 +132,10 @@
};
is($info, $expected, $t);
- $t=q{Trace flag 'PGPREFIX' works as expected};
+ $t=q{Trace flag 'pgprefix' works as expected};
seek $fh, 0, 0;
truncate $fh, tell($fh);
- $dbh->trace($dbh->parse_trace_flags('PGSTART|PGPREFIX'), $filename);
+ $dbh->trace($dbh->parse_trace_flags('pgstart|pgprefix'), $filename);
$dbh->do($SQL);
$dbh->commit();
$dbh->trace(0);
@@ -153,10 +153,10 @@
};
is($info, $expected, $t);
- $t=q{Trace flag 'PGEND' works as expected};
+ $t=q{Trace flag 'pgend' works as expected};
seek $fh, 0, 0;
truncate $fh, tell($fh);
- $dbh->trace($dbh->parse_trace_flags('PGEND'), $filename);
+ $dbh->trace($dbh->parse_trace_flags('pgend'), $filename);
$dbh->do($SQL);
$dbh->commit();
$dbh->trace(0);
@@ -175,10 +175,10 @@
};
is($info, $expected, $t);
- $t=q{Trace flag 'PGLOGIN' returns undef if no activity};
+ $t=q{Trace flag 'pglogin' returns undef if no activity};
seek $fh, 0, 0;
truncate $fh, tell($fh);
- $dbh->trace($dbh->parse_trace_flags('PGLOGIN'), $filename);
+ $dbh->trace($dbh->parse_trace_flags('pglogin'), $filename);
$dbh->do($SQL);
$dbh->commit();
$dbh->trace(0);
@@ -187,9 +187,9 @@
$expected = undef;
is($info, $expected, $t);
- $t=q{Trace flag 'PGLOGIN' works as expected with
DBD::Pg->parse_trace_flag()};
+ $t=q{Trace flag 'pglogin' works as expected with
DBD::Pg->parse_trace_flag()};
$dbh->disconnect();
- my $flagval = DBD::Pg->parse_trace_flag('PGLOGIN');
+ my $flagval = DBD::Pg->parse_trace_flag('pglogin');
seek $fh, 0, 0;
truncate $fh, tell($fh);
DBI->trace($flagval, $filename);
@@ -208,7 +208,7 @@
$info =~ s/(Login connection string: ).+/$1/g;
is($info, "$expected$expected", $t);
- $t=q{Trace flag 'PGLOGIN' works as expected with
DBD::Pg->parse_trace_flags()};
+ $t=q{Trace flag 'pglogin' works as expected with
DBD::Pg->parse_trace_flags()};
seek $fh, 0, 0;
truncate $fh, tell($fh);
DBI->trace($flagval, $filename);
@@ -224,13 +224,13 @@
$info =~ s/(Login connection string: ).+/$1/g;
is($info, "$expected", $t);
- $t=q{Trace flag 'PGPREFIX' and 'PGSTART' append to 'PGLOGIN' work as
expected};
+ $t=q{Trace flag 'pgprefix' and 'pgstart' appended to 'pglogin' work as
expected};
seek $fh, 0, 0;
truncate $fh, tell($fh);
DBI->trace($flagval, $filename);
$dbh = connect_database({nosetup => 1});
$dbh->do($SQL);
- $flagval += $dbh->parse_trace_flags('PGPREFIX|PGSTART');
+ $flagval += $dbh->parse_trace_flags('pgprefix|pgstart');
$dbh->trace($flagval);
$dbh->do($SQL);
$dbh->trace(0);