Author: timbo
Date: Tue Jan 25 04:47:55 2005
New Revision: 840

Modified:
   dbi/trunk/Changes
   dbi/trunk/DBI.pm
   dbi/trunk/lib/DBD/Proxy.pm
   dbi/trunk/lib/DBI/Const/GetInfo/ODBC.pm
   dbi/trunk/lib/DBI/DBD.pm
   dbi/trunk/t/80proxy.t
Log:
Fixed DBD::Proxy method calls to not alter [EMAIL PROTECTED]
Fixed DBD::File problem with encoding pragma thanks to Erik Rijkers.
Added $GetInfoType{SQL_DATABASE_NAME} thanks to Steffen Goeldner.
Added DBD::JDBC as a registered driver.


Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes   (original)
+++ dbi/trunk/Changes   Tue Jan 25 04:47:55 2005
@@ -12,6 +12,8 @@
   Fixed potential undef warning from connect_cached().
   Fixed $DBI::lasth handling for DESTROY so lasth points to
     parent even if DESTROY called other methods.
+  Fixed DBD::Proxy method calls to not alter [EMAIL PROTECTED]
+  Fixed DBD::File problem with encoding pragma thanks to Erik Rijkers.
 
   Changed error handling so undef errstr doesn't cause warning.
   Changed DBI::DBD docs to use =head3/=head4 pod thanks to
@@ -20,6 +22,7 @@
   Changed DBD::Proxy to treat Username as a local attribute
     so recent DBI version can be used with old DBI::ProxyServer.
   Changed driver handle caching in DBD::File.
+  Added $GetInfoType{SQL_DATABASE_NAME} thanks to Steffen Goeldner.
 
   Updated docs to recommend some common DSN string attributes.
   Updated docs for NULL Value placeholders thanks to Brian Campbell.
@@ -27,6 +30,7 @@
   Updated err/errstr/state docs for DBD authors thanks to Steffen Goeldner.
   Updated handle/attribute docs for DBD authors thanks to Steffen Goeldner.
   Corrected and updated LongReadLen docs thanks to Bart Lateur.
+  Added DBD::JDBC as a registered driver.
 
 =head2 Changes in DBI 1.46 (svn rev 584),    16th November 2004
 

Modified: dbi/trunk/DBI.pm
==============================================================================
--- dbi/trunk/DBI.pm    (original)
+++ dbi/trunk/DBI.pm    Tue Jan 25 04:47:55 2005
@@ -306,6 +306,7 @@
   ib_      => { class => 'DBD::InterBase',     },
   ing_     => { class => 'DBD::Ingres',                },
   ix_      => { class => 'DBD::Informix',      },
+  jdbc_    => { class => 'DBD::JDBC',          },
   msql_    => { class => 'DBD::mSQL',          },
   mysql_   => { class => 'DBD::mysql',         },
   mx_      => { class => 'DBD::Multiplex',     },
@@ -3524,7 +3525,8 @@
 You may need to take extra care if the table can be modified between
 the first select and the second being executed. You may also need to
 use a different function if OCTET_LENGTH() does not work for long
-types in your database. For example, for Sybase use DATALENGTH().
+types in your database. For example, for Sybase use DATALENGTH() and
+for Oracle use LENGTHB().
 
 See also L</LongTruncOk> for information on truncation of long types.
 

Modified: dbi/trunk/lib/DBD/Proxy.pm
==============================================================================
--- dbi/trunk/lib/DBD/Proxy.pm  (original)
+++ dbi/trunk/lib/DBD/Proxy.pm  Tue Jan 25 04:47:55 2005
@@ -237,7 +237,6 @@
          'type' => $type,
          'h' => "DBI::_::$type"
        );
-    local $SIG{__DIE__} = 'DEFAULT';
     my $method_code = UNIVERSAL::can($expand{'h'}, $method) ?
        q/package ~class~;
           sub ~method~ {
@@ -260,8 +259,9 @@
           }
          /;
     $method_code =~ s/\~(\w+)\~/$expand{$1}/eg;
-    eval $method_code;
-    die $@ if $@;
+    local $SIG{__DIE__} = 'DEFAULT';
+    my $err = do { local $@; eval $method_code.2; $@ };
+    die $err if $err;
     goto &$AUTOLOAD;
 }
 
@@ -307,6 +307,7 @@
 
     if ($type eq 'remote'  ||  $type eq 'cached') {
         local $SIG{__DIE__} = 'DEFAULT';
+       local $@;
        my $result = eval { $dbh->{'proxy_dbh'}->STORE($attr => $val) };
        return DBD::Proxy::proxy_set_err($dbh, $@) if $@; # returns undef
        $dbh->{$attr} = $val if $type eq 'cached';
@@ -327,6 +328,7 @@
     return $dbh->SUPER::FETCH($attr) unless $type eq 'remote';
 
     local $SIG{__DIE__} = 'DEFAULT';
+    local $@;
     my $result = eval { $dbh->{'proxy_dbh'}->FETCH($attr) };
     return DBD::Proxy::proxy_set_err($dbh, $@) if $@;
     return $result;
@@ -346,6 +348,7 @@
       $sth->{'proxy_attr_cache'} = {cache_filled => 0};
       my $rdbh = $dbh->{'proxy_dbh'};
       local $SIG{__DIE__} = 'DEFAULT';
+      local $@;
       my $rsth = eval { $rdbh->prepare($sth->{'Statement'}, 
$sth->{'proxy_attr'}, undef, $proto_ver) };
       return DBD::Proxy::proxy_set_err($sth, $@) if $@;
       return DBD::Proxy::proxy_set_err($sth, "Constructor didn't return a 
handle: $rsth")
@@ -384,6 +387,7 @@
     # for example.
     # Jochen
     local $SIG{__DIE__} = 'DEFAULT';
+    local $@;
     my $result = eval { $dbh->{'proxy_dbh'}->quote(@_) };
     return DBD::Proxy::proxy_set_err($dbh, $@) if $@;
     return $result;
@@ -394,6 +398,7 @@
     my $rdbh = $dbh->{'proxy_dbh'};
     #warn "table_info(@_)";
     local $SIG{__DIE__} = 'DEFAULT';
+    local $@;
     my($numFields, $names, $types, @rows) = eval { $rdbh->table_info(@_) };
     return DBD::Proxy::proxy_set_err($dbh, $@) if $@;
     my ($sth, $inner) = DBI::_new_sth($dbh, {
@@ -427,6 +432,7 @@
 sub type_info_all {
     my $dbh = shift;
     local $SIG{__DIE__} = 'DEFAULT';
+    local $@;
     my $result = eval { $dbh->{'proxy_dbh'}->type_info_all(@_) };
     return DBD::Proxy::proxy_set_err($dbh, $@) if $@;
     return $result;
@@ -478,6 +484,7 @@
     my ($numRows, @outData);
 
     local $SIG{__DIE__} = 'DEFAULT';
+    local $@;
     if ( $proto_ver > 1 ) {
       ($numRows, @outData) = eval { $rsth->execute($params, $proto_ver) };
       return DBD::Proxy::proxy_set_err($sth, $@) if $@;
@@ -558,6 +565,7 @@
        }
        my $num_rows = $sth->FETCH('RowCacheSize') || 20;
        local $SIG{__DIE__} = 'DEFAULT';
+       local $@;
        my @rows = eval { $rsth->fetch($num_rows) };
        return DBD::Proxy::proxy_set_err($sth, $@) if $@;
        unless (@rows == $num_rows) {
@@ -591,6 +599,7 @@
        : $sth->FETCH('Database')->{'proxy_no_finish'};
     unless ($no_finish) {
         local $SIG{__DIE__} = 'DEFAULT';
+       local $@;
        my $result = eval { $rsth->finish() };
        return DBD::Proxy::proxy_set_err($sth, $@) if $@;
        return $result;
@@ -614,6 +623,7 @@
     if ($type eq 'remote') {
        my $rsth = $sth->{'proxy_sth'}  or  return undef;
         local $SIG{__DIE__} = 'DEFAULT';
+       local $@;
        my $result = eval { $rsth->STORE($attr => $val) };
        return DBD::Proxy::proxy_set_err($sth, $@) if ($@);
        return $result;
@@ -644,6 +654,7 @@
     if ($type ne 'local') {
        my $rsth = $sth->{'proxy_sth'}  or  return undef;
         local $SIG{__DIE__} = 'DEFAULT';
+       local $@;
        my $result = eval { $rsth->FETCH($attr) };
        return DBD::Proxy::proxy_set_err($sth, $@) if $@;
        return $result;

Modified: dbi/trunk/lib/DBI/Const/GetInfo/ODBC.pm
==============================================================================
--- dbi/trunk/lib/DBI/Const/GetInfo/ODBC.pm     (original)
+++ dbi/trunk/lib/DBI/Const/GetInfo/ODBC.pm     Tue Jan 25 04:47:55 2005
@@ -99,6 +99,7 @@
 , SQL_CURSOR_SENSITIVITY              => 10001
 , SQL_DATA_SOURCE_NAME                =>     2
 , SQL_DATA_SOURCE_READ_ONLY           =>    25
+, SQL_DATABASE_NAME                   =>    16 
 , SQL_DATETIME_LITERALS               =>   119
 , SQL_DBMS_NAME                       =>    17
 , SQL_DBMS_VER                        =>    18

Modified: dbi/trunk/lib/DBI/DBD.pm
==============================================================================
--- dbi/trunk/lib/DBI/DBD.pm    (original)
+++ dbi/trunk/lib/DBI/DBD.pm    Tue Jan 25 04:47:55 2005
@@ -1091,10 +1091,6 @@
 A trivial C<finish> method to discard the stored data and do
 $sth->SUPER::finish;
 
-A C<table_info> method to return details of available tables.
-
-A C<type_info_all> method to return details of supported types.
-
 If you've defined a parse_trace_flag() method in ::db you'll also want
 it in ::st, so just alias it in:
 

Modified: dbi/trunk/t/80proxy.t
==============================================================================
--- dbi/trunk/t/80proxy.t       (original)
+++ dbi/trunk/t/80proxy.t       Tue Jan 25 04:47:55 2005
@@ -1,4 +1,5 @@
 #!perl -w                                         # -*- perl -*-
+# vim:sw=4:ts=8
 
 require 5.004;
 use strict;
@@ -70,7 +71,7 @@
     or die "Failed to create config file $config_file: $!";
 
 my($handle, $port);
-my $numTests = 117;
+my $numTests = 119;
 if (@ARGV) {
     $port = $ARGV[0];
 } else {
@@ -118,10 +119,18 @@
 Test($dbh->{example_driver_path});
 
 print "Setting AutoCommit\n";
+$@ = "old-error";      # should be preserved across DBI calls
 Test($dbh->{AutoCommit} = 1);
 Test($dbh->{AutoCommit});
+Test($@ eq "old-error", "\$@ now '$@'");
 #$dbh->trace(2);
 
+eval {
+    local $dbh->{ AutoCommit } = 1;   # This breaks die!
+    die "BANG!!!\n";
+};
+Test($@ eq "BANG!!!\n", "\$@ value lost");
+
 print "Doing a ping.\n";
 Test($dbh->ping);
 

Reply via email to