Author: timbo
Date: Wed Oct 25 14:47:51 2006
New Revision: 7981
Modified:
dbi/trunk/Changes
dbi/trunk/DBI.xs
dbi/trunk/t/40profile.t
Log:
Fixed to be more robust against drivers not handling multiple result sets
properly thanks to Gisle Aas.
Make t/40profile.t portable to windows thanks to Dean Arnold.
Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes (original)
+++ dbi/trunk/Changes Wed Oct 25 14:47:51 2006
@@ -13,6 +13,8 @@
thanks to Jamie McCarthy.
Fixed to work with current 'bleadperl' (~5.9.5) thanks to Steve Peters.
Users of Perl >= 5.9.5 will require DBI >= 1.53.
+ Fixed to be more robust against drivers not handling multiple result
+ sets properly thanks to Gisle Aas.
Changed to no longer inherit from Exporter thanks to jvanasco.
Modified: dbi/trunk/DBI.xs
==============================================================================
--- dbi/trunk/DBI.xs (original)
+++ dbi/trunk/DBI.xs Wed Oct 25 14:47:51 2006
@@ -1368,13 +1368,20 @@
{
AV *av;
- if ( (av = DBIc_FIELDS_AV(imp_sth)) == Nullav)
+ if ( (av = DBIc_FIELDS_AV(imp_sth)) == Nullav) {
av = dbih_setup_fbav(imp_sth);
-
- if (1) { /* XXX turn into option later */
- int i = DBIc_NUM_FIELDS(imp_sth);
+ }
+ else {
+ dTHX;
+ int i = av_len(av) + 1;
+ if (i != DBIc_NUM_FIELDS(imp_sth)) {
+ /* warn via PrintWarn */
+ set_err_char(DBIc_MY_H(imp_sth), imp_sth, "0", 0, "Number of row
fields inconsistent with NUM_FIELDS, NUM_FIELDS updated", "", "_get_fbav");
+ DBIc_NUM_FIELDS(imp_sth) = i;
+ }
/* don't let SvUTF8 flag persist from one row to the next */
/* (only affects drivers that use sv_setpv, but most XS do) */
+ /* XXX turn into option later */
while(i--) /* field 1 stored at index 0 */
SvUTF8_off(AvARRAY(av)[i]);
}
Modified: dbi/trunk/t/40profile.t
==============================================================================
--- dbi/trunk/t/40profile.t (original)
+++ dbi/trunk/t/40profile.t Wed Oct 25 14:47:51 2006
@@ -228,8 +228,8 @@
$dbh->{Profile}->{Path} = [ '!File', '!File2', '!Caller', '!Caller2' ];
$dbh->{Profile}->{Data} = undef;
-my ($file, $line1, $line2) = (__FILE__, undef, undef);
-$file =~ s:.*/::;
+my $file = (File::Spec->splitpath(__FILE__))[2]; # '40profile.t'
+my ($line1, $line2);
sub a_sub {
$sth = $dbh->prepare("select name from ."); $line2 = __LINE__;
}