Author: timbo
Date: Wed Jun 30 06:14:47 2004
New Revision: 374
Modified:
dbi/trunk/Changes
dbi/trunk/DBI.pm
dbi/trunk/ToDo
dbi/trunk/lib/DBI/Profile.pm
dbi/trunk/t/40profile.t
Log:
Fixed last_insert_id(...) thanks to Rudy Lippan.
Fixed DBI_AUTOPROXY to work more than once thanks to Steven Hirsch.
Change DBI::Profile header to include timestamp.
Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes (original)
+++ dbi/trunk/Changes Wed Jun 30 06:14:47 2004
@@ -12,7 +12,7 @@
Fixed "trace level set to" trace message thanks to H.Merijn Brand.
Fixed DBD::DBM $dbh->{dbm_tables}->{...} to be keyed by the
table name not the file name thanks to Jeff Zucker.
- Fixed last_insert_id(...) usage check thanks to Rudy Lippan.
+ Fixed last_insert_id(...) thanks to Rudy Lippan.
Fixed propagation of scalar/list context into proxied methods.
Fixed DBI::Profile::DESTROY to not alter [EMAIL PROTECTED]
Fixed DBI::ProfileDumper new() docs thanks to Michael Schwern.
@@ -20,12 +20,14 @@
Fixed compile warnings on Win32 thanks to Robert Baron.
Fixed problem building with recent versions of MakeMaker.
Fixed DBD::Sponge not to generate warning with threads.
+ Fixed DBI_AUTOPROXY to work more than once thanks to Steven Hirsch.
Changed selectall_arrayref() to call finish() if
$attr->{MaxRows} is defined.
Changed all tests to use Test::More and enhanced the tests thanks
to Stevan Little and Andy Lester. See http://qa.perl.org/phalanx/
Changed Test::More minimum prerequisite version to 0.40 (2001).
+ Change DBI::Profile header to include timestamp.
Added DBI->parse_dsn($dsn) method.
Added warning if build directory path contains whitespace.
Modified: dbi/trunk/DBI.pm
==============================================================================
--- dbi/trunk/DBI.pm (original)
+++ dbi/trunk/DBI.pm Wed Jun 30 06:14:47 2004
@@ -382,7 +382,7 @@
commit => { U =>[1,1], O=>0x0480|0x0800 },
rollback => { U =>[1,1], O=>0x0480|0x0800 },
'do' => { U =>[2,0,'$statement [, \%attr [, @bind_params ] ]'],
O=>0x3200 },
- last_insert_id => { U =>[5,6,'$catalog, $schema, $table_name, $field_name [,
\%attr ]'], O=>0x2100 },
+ last_insert_id => { U =>[5,6,'$catalog, $schema, $table_name, $field_name [,
\%attr ]'], O=>0x2800 },
preparse => { }, # XXX
prepare => { U =>[2,3,'$statement [, \%attr]'],
O=>0x2200 },
prepare_cached => { U =>[2,4,'$statement [, \%attr [, $if_active ] ]'],
O=>0x2200 },
@@ -442,12 +442,10 @@
},
);
-my($class, $method);
-foreach $class (keys %DBI::DBI_methods){
- my %pkgif = %{ $DBI::DBI_methods{$class} };
- foreach $method (keys %pkgif){
- DBI->_install_method("DBI::${class}::$method", 'DBI.pm',
- $pkgif{$method});
+while ( my ($class, $meths) = each %DBI::DBI_methods ) {
+ while ( my ($method, $info) = each %$meths ) {
+ my $fullmeth = "DBI::${class}::$method";
+ DBI->_install_method($fullmeth, 'DBI.pm', $info);
}
}
@@ -542,13 +540,14 @@
."and DBI_DSN env var not set");
if ($ENV{DBI_AUTOPROXY} && $driver ne 'Proxy' && $driver ne 'Sponge' && $driver
ne 'Switch') {
+ my $dbi_autoproxy = $ENV{DBI_AUTOPROXY};
my $proxy = 'Proxy';
- if ($ENV{DBI_AUTOPROXY} =~ s/^dbi:(\w*?)(?:\((.*?)\))?://i) {
+ if ($dbi_autoproxy =~ s/^dbi:(\w*?)(?:\((.*?)\))?://i) {
$proxy = $1;
my $attr_spec = $2 || '';
$driver_attrib_spec = ($driver_attrib_spec) ?
"$driver_attrib_spec,$attr_spec" : $attr_spec;
}
- $dsn = "$ENV{DBI_AUTOPROXY};dsn=dbi:$driver:$dsn";
+ $dsn = "$dbi_autoproxy;dsn=dbi:$driver:$dsn";
$driver = $proxy;
DBI->trace_msg(" DBI_AUTOPROXY:
dbi:$driver($driver_attrib_spec):$dsn\n");
}
Modified: dbi/trunk/ToDo
==============================================================================
--- dbi/trunk/ToDo (original)
+++ dbi/trunk/ToDo Wed Jun 30 06:14:47 2004
@@ -57,7 +57,8 @@
$sth->{ParamAttr} eg { "1" => SQL_VARCHAR, "2" => { TYPE=>SQL_VARCHAR, ora_type=>99
}};
$h->{KidsHandles} = ref to cache (array or hash?)
-of weakrefs to child handles.
+of weakrefs to child handles (bugs pre 5.8.5 with CLONE and weakrefs,
+see Perl changes 21936 and 22106)
Document DbTypeSubclass (ala DBIx::AnyDBD)
Polish up and document _dbtype_names with an external interface and using get_info.
Modified: dbi/trunk/lib/DBI/Profile.pm
==============================================================================
--- dbi/trunk/lib/DBI/Profile.pm (original)
+++ dbi/trunk/lib/DBI/Profile.pm Wed Jun 30 06:14:47 2004
@@ -302,7 +302,7 @@
The default results format looks like this:
- DBI::Profile: 0.001015 seconds (5 method calls) programname
+ DBI::Profile: 0.001015s (5 calls) programname @ YYYY-MM-DD HH:MM:SS
'' =>
0.000024s / 2 = 0.000012s avg (first 0.000015s, min 0.000009s, max 0.000015s)
'SELECT mode,size,name FROM table' =>
@@ -573,11 +573,14 @@
my ($count, $dbi_time) = @$totals;
(my $progname = $0) =~ s:.*/::;
if ($count) {
- $prologue .= sprintf "%f seconds ", $dbi_time;
+ $prologue .= sprintf "%fs ", $dbi_time;
my $perl_time = dbi_time() - $^T;
$prologue .= sprintf "%.2f%% ", $dbi_time/$perl_time*100
if $DBI::PERL_ENDING && $perl_time;
- $prologue .= sprintf "(%d method calls) $progname\n", $count;
+ my @lt = localtime(time);
+ my $ts = sprintf "%d-%02d-%02d %02d:%02d:%02d",
+ 1900+$lt[5], $lt[4]+1, @lt[3,2,1,0];
+ $prologue .= sprintf "(%d calls) $progname \@ $ts\n", $count;
}
if (@$leaves == 1 && $self->{Data}->{DBI}) {
Modified: dbi/trunk/t/40profile.t
==============================================================================
--- dbi/trunk/t/40profile.t (original)
+++ dbi/trunk/t/40profile.t Wed Jun 30 06:14:47 2004
@@ -122,7 +122,7 @@
# check that output was produced in the expected format
ok(length $output);
ok($output =~ /^DBI::Profile:/);
-ok($output =~ /\((\d+) method calls\)/);
+ok($output =~ /\((\d+) calls\)/);
ok($1 >= $count);
# try statement and method name path