Tim,

The following bits of my Proxy patches seem to be missing from the
released DBI-1.31.  I can assure you that localizing the 'die' handler is
quite necessary to keep client behavior the same between direct connect
and proxy connect.  If you no longer have my message with the original
rationale, let me know and I can resend.

Regards,

Steve



--- DBI-1.31/lib/DBD/Proxy.pm.orig      Fri Oct 11 12:13:45 2002
+++ DBI-1.31/lib/DBD/Proxy.pm   Wed Sep 18 09:56:20 2002
@@ -234,6 +234,7 @@
          'type' => $type,
          'h' => "DBI::_::$type"
        );
+    local $SIG{__DIE__} = 'DEFAULT';
     my $method_code = UNIVERSAL::can($expand{'h'}, $method) ?
        q/package ~class~;
           sub ~method~ {
@@ -283,6 +284,7 @@
     }
 
     if ($type eq 'remote'  ||  $type eq 'cached') {
+        local $SIG{__DIE__} = 'DEFAULT';
        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';
@@ -302,6 +304,7 @@
 
     return $dbh->SUPER::FETCH($attr) unless $type eq 'remote';
 
+    local $SIG{__DIE__} = 'DEFAULT';
     my $result = eval { $dbh->{'proxy_dbh'}->FETCH($attr) };
     return DBD::Proxy::proxy_set_err($dbh, $@) if $@;
     return $result;
@@ -320,6 +323,7 @@
     if ( $proto_ver > 1 ) {
       $sth->{'proxy_attr_cache'} = {cache_filled => 0};
       my $rdbh = $dbh->{'proxy_dbh'};
+      local $SIG{__DIE__} = 'DEFAULT';
       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")
@@ -355,7 +359,7 @@
     #    $dbh->{'proxy_quote'} = 'backslash_escaped';
     # for example.
     # Jochen
-
+    local $SIG{__DIE__} = 'DEFAULT';
     my $result = eval { $dbh->{'proxy_dbh'}->quote(@_) };
     return DBD::Proxy::proxy_set_err($dbh, $@) if $@;
     return $result;
@@ -365,6 +369,7 @@
     my $dbh = shift;
     my $rdbh = $dbh->{'proxy_dbh'};
     #warn "table_info(@_)";
+    local $SIG{__DIE__} = 'DEFAULT';
     my($numFields, $names, $types, @rows) = eval { $rdbh->table_info(@_) };
     return DBD::Proxy::proxy_set_err($dbh, $@) if $@;
     my $sth = DBI::_new_sth($dbh, {
@@ -395,6 +400,7 @@
 
 sub type_info_all {
     my $dbh = shift;
+    local $SIG{__DIE__} = 'DEFAULT';
     my $result = eval { $dbh->{'proxy_dbh'}->type_info_all(@_) };
     return DBD::Proxy::proxy_set_err($dbh, $@) if $@;
     return $result;
@@ -450,6 +456,7 @@
 
     my ($numRows, @outData);
 
+    local $SIG{__DIE__} = 'DEFAULT';
     if ( $proto_ver > 1 ) {
       ($numRows, @outData) = eval { $rsth->execute($params, $proto_ver) };
       return DBD::Proxy::proxy_set_err($sth, $@) if $@;
@@ -527,6 +534,7 @@
            die "Attempt to fetch row without execute";
        }
        my $num_rows = $sth->FETCH('RowCacheSize') || 20;
+       local $SIG{__DIE__} = 'DEFAULT';
        my @rows = eval { $rsth->fetch($num_rows) };
        return DBD::Proxy::proxy_set_err($sth, $@) if $@;
        unless (@rows == $num_rows) {
@@ -559,6 +567,7 @@
        ? $sth->{'proxy_no_finish'}
        : $sth->FETCH('Database')->{'proxy_no_finish'};
     unless ($no_finish) {
+        local $SIG{__DIE__} = 'DEFAULT';
        my $result = eval { $rsth->finish() };
        return DBD::Proxy::proxy_set_err($sth, $@) if $@;
        return $result;
@@ -581,6 +590,7 @@
 
     if ($type eq 'remote') {
        my $rsth = $sth->{'proxy_sth'}  or  return undef;
+        local $SIG{__DIE__} = 'DEFAULT';
        my $result = eval { $rsth->STORE($attr => $val) };
        return DBD::Proxy::proxy_set_err($sth, $@) if ($@);
        return $result;
@@ -610,6 +620,7 @@
 
     if ($type ne 'local') {
        my $rsth = $sth->{'proxy_sth'}  or  return undef;
+        local $SIG{__DIE__} = 'DEFAULT';
        my $result = eval { $rsth->FETCH($attr) };
        return DBD::Proxy::proxy_set_err($sth, $@) if $@;
        return $result;
--- DBI-1.31/lib/DBI/ProxyServer.pm.orig        Tue Oct 29 05:00:57 2002
+++ DBI-1.31/lib/DBI/ProxyServer.pm     Tue Sep 17 13:20:02 2002
@@ -220,7 +220,7 @@
     my $msg = $@;
     undef $dbh->{'private_server'};
     if ($msg) {
-       $server->Error($msg);
+       $server->Debug("CallMethod died with: $@");
        die $msg;
     } else {
        $server->Debug("CallMethod: <= " . join(",", @result));

Reply via email to