Author: mjevans
Date: Mon Oct 8 02:49:04 2012
New Revision: 15435
Modified:
dbi/trunk/Changes
dbi/trunk/DBI.pm
dbi/trunk/TODO_2005.txt
dbi/trunk/t/08keeperr.t
Log:
RT64330 - ping wipes out errstr - new test cases and fix which removed _not_impl
which was a TO_DO anyway.
Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes (original)
+++ dbi/trunk/Changes Mon Oct 8 02:49:04 2012
@@ -18,6 +18,12 @@
Corrected typo in DBI->installed_versions docs RT#78825
thanks to Jan Dubois.
+ Added new tests to 08keeperr for RT#64330
+ thanks to Kenichi Ishigaki.
+
+ Fix RT#64330 - ping wipes out errstr.
+ Removed _not_impl (Martin J. Evans).
+
=head2 Changes in DBI 1.622 (svn r15327) 6th June 2012
Fixed lack of =encoding in non-ASCII pod docs. RT#77588
@@ -297,7 +303,7 @@
Fixed DBD_ATTRIB_DELETE macro for driver authors
and updated DBI::DBD docs thanks to Martin J. Evans.
Fixed 64bit issues in trace messages thanks to Charles Jardine.
- Fixed FETCH_many() method to work with drivers that incorrectly return
+ Fixed FETCH_many() method to work with drivers that incorrectly return
an empty list from $h->FETCH. Affected gofer.
Added 'sqlite_' as registered prefix for DBD::SQLite.
@@ -473,7 +479,7 @@
=head2 Changes in DBI 1.56 (svn rev 9660), 18th June 2007
Fixed printf arg warnings thanks to JDHEDDEN.
- Fixed returning driver-private sth attributes via gofer.
+ Fixed returning driver-private sth attributes via gofer.
Changed pod docs docs to use =head3 instead of =item
so now in html you get links to individual methods etc.
@@ -724,7 +730,7 @@
(driver authors who have used it should rerun it).
Updated docs for NULL Value placeholders thanks to Brian Campbell.
-
+
Added multi-keyfield nested hash fetching to fetchall_hashref()
thanks to Zhuang (John) Li for polishing up my draft.
Added registered driver prefixes: amzn_ for DBD::Amazon and yaswi_ for
DBD::Yaswi.
@@ -1265,7 +1271,7 @@
: This does not affect statements that only select one column, which is
: usually the case when fetchrow_array is called in a scalar context.
: FYI, this change was triggered by discovering that the fetchrow_array
- : implementation in Driver.xst (used by most compiled drivers)
+ : implementation in Driver.xst (used by most compiled drivers)
: didn't match the DBI specification. Rather than change the code
: to match, and risk breaking existing applications, I've changed the
: specification (that part was always of dubious value anyway).
@@ -2008,12 +2014,12 @@
DBI scripts no longer need to be modified to make use of Apache::DBI.
Added a ping method and an experimental connect_test_perf method.
Added a fetchhash and fetch_all methods.
- The func method no longer pre-clears err and errstr.
+ The func method no longer pre-clears err and errstr.
Added ChopBlanks attribute (currently defaults to off, that may change).
Support for the attribute needs to be implemented by individual drivers.
Reworked tests into standard t/*.t form.
Added more pod text. Fixed assorted bugs.
-
+
=head2 Changes in DBI 0.79, 7th Apr 1997
Modified: dbi/trunk/DBI.pm
==============================================================================
--- dbi/trunk/DBI.pm (original)
+++ dbi/trunk/DBI.pm Mon Oct 8 02:49:04 2012
@@ -390,7 +390,6 @@
'FIRSTKEY' => $keeperr,
'NEXTKEY' => $keeperr,
'STORE' => { O=>0x0418 | 0x4 },
- _not_impl => undef,
can => { O=>0x0100 }, # special case, see dispatch
debug => { U =>[1,2,'[$debug_level]'], O=>0x0004 }, #
old name for trace
dump_handle => { U =>[1,3,'[$message [, $level]]'], O=>0x0004 },
@@ -1344,12 +1343,6 @@
# methods common to all handle types:
- sub _not_impl {
- my ($h, $method) = @_;
- $h->trace_msg("Driver does not implement the $method method.\n");
- return; # empty list / undef
- }
-
# generic TIEHASH default methods:
sub FIRSTKEY { }
sub NEXTKEY { }
@@ -1711,7 +1704,6 @@
sub ping {
my $dbh = shift;
- $dbh->_not_impl('ping');
# "0 but true" is a special kind of true 0 that is used here so
# applications can check if the ping was a real ping or not
($dbh->FETCH('Active')) ? "0 but true" : 0;
Modified: dbi/trunk/TODO_2005.txt
==============================================================================
--- dbi/trunk/TODO_2005.txt (original)
+++ dbi/trunk/TODO_2005.txt Mon Oct 8 02:49:04 2012
@@ -142,7 +142,7 @@
pre and post call hooks via ima structure?
-Remove _not_impl. Alias debug to trace in DBI::(dr/db/st) and remove
+Alias debug to trace in DBI::(dr/db/st) and remove
debug() method from internals.
DBD::Multiplex enhancements (Thomas Kishel <[email protected]>):
Modified: dbi/trunk/t/08keeperr.t
==============================================================================
--- dbi/trunk/t/08keeperr.t (original)
+++ dbi/trunk/t/08keeperr.t Mon Oct 8 02:49:04 2012
@@ -2,7 +2,7 @@
use strict;
-use Test::More tests => 79;
+use Test::More tests => 89;
## ----------------------------------------------------------------------------
## 08keeperr.t
@@ -90,6 +90,31 @@
# so here we just test that there is an error
ok $dbh->err, "err true after failed ping";
ok $dbh->errstr, "errstr true after failed ping";
+
+
+ # for a driver which doesn't have its own ping
+ $dbh = DBI->connect('DBI:Sponge:', undef, undef, { PrintError => 0 });
+ $dbh->STORE(Active => 1);
+
+ $dbh->set_err(42, "ERROR 42");
+ is $dbh->err, 42;
+ is $dbh->errstr, "ERROR 42";
+ ok $dbh->ping, "ping returns true: ".$dbh->ping;
+ is $dbh->err, 42, "err unchanged after ping";
+ is $dbh->errstr, "ERROR 42", "errstr unchanged after ping";
+
+ $dbh->disconnect;
+ $dbh->STORE(Active => 0);
+
+ $dbh->set_err(42, "ERROR 42");
+ is $dbh->err, 42, "err unchanged after ping";
+ is $dbh->errstr, "ERROR 42", "errstr unchanged after ping";
+ ok !$dbh->ping, "ping returns false";
+ # it's reasonable for ping() to set err/errstr if it fails
+ # so here we just test that there is an error
+ ok $dbh->err, "err true after failed ping";
+ ok $dbh->errstr, "errstr true after failed ping";
+
}
## ----------------------------------------------------------------------------