[svn:dbd-oracle] r14698 - dbd-oracle/trunk

[email protected] Thu, 10 Feb 2011 07:01:27 -0800 (PST)
Newsgroups perl.dbd.oracle.changes
Message-ID <[email protected]>
Author: byterock
Date: Thu Feb 10 07:01:26 2011
New Revision: 14698

Modified:
   dbd-oracle/trunk/Changes
   dbd-oracle/trunk/Oracle.pm

Log:
  Added connection attribute 'ora_connect_with_default_signals' that will localize Perl's $SIG{INT} handeler from Brian Phillips and T. Bunce


Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes	(original)
+++ dbd-oracle/trunk/Changes	Thu Feb 10 07:01:26 2011
@@ -1,5 +1,6 @@
 =head1 Changes in DBD-Oracle 1.28 (svn rev xxxxx)
 
+  Added connection attribute 'ora_connect_with_default_signals' that will localize Perl's $SIG{INT} handeler from Brian Phillips and T. Bunce
   Fix in execute_array to stop possible endless loop when using a fetch sub by by Martin J. Evans 
   Adapted Martin J. Evans' ODBC 70execute_array.t into t/26exe_array.t by John Scoles
   Fix for execute_array to bring it up to spec. by Martin J. Evans and John Scoles

Modified: dbd-oracle/trunk/Oracle.pm
==============================================================================
--- dbd-oracle/trunk/Oracle.pm	(original)
+++ dbd-oracle/trunk/Oracle.pm	Thu Feb 10 07:01:26 2011
@@ -271,8 +271,12 @@
 	   $attr->{ora_drcp_incr} = $ENV{ORA_DRCP_INCR}
 	}
 	
-	DBD::Oracle::db::_login($dbh, $dbname, $user, $auth, $attr)
-	    or return undef;
+	{
+	   local @SIG{ @{ $attr->{ora_connect_with_default_signals} } }
+          if $attr->{ora_connect_with_default_signals};
+	   DBD::Oracle::db::_login($dbh, $dbname, $user, $auth, $attr)
+	      or return undef;
+	}
 
 	unless (length $user_only) {
 	    $user_only = $dbh->selectrow_array(q{
@@ -344,7 +348,7 @@
 	return $v;
     }
 
-    sub private_attribute_info {
+    sub private_attribute_info { #this should only be for ones that have setters and getters
         return { ora_max_nested_cursors	=> undef,
                  ora_array_chunk_size	=> undef,
                  ora_ph_type		=> undef,
@@ -375,6 +379,7 @@
                  ora_client_info	=> undef,
                  ora_client_identifier	=> undef,
                  ora_action		=> undef,
+               
                  };
     }
    
@@ -1899,6 +1904,22 @@
 Note that this attribute also applies to C<execute_array>, since that
 method is implemented using C<execute_for_fetch>.
 
+=item ora_connect_with_default_signals
+
+Sometimes the Oracle client seems to change some of the signal handlers
+of the process during the connect phase.  For instance, some users have
+observed Perl's default C<$SIG{INT}> handler being ignored after 
+connecting to an Oracle database.  If this causes problems in your 
+application, set this attribute to an array reference of signals you 
+would like to be localized during the connect process.  Once the connect
+is complete, the signal handlers should be returned to their previous state.
+
+For example:
+
+  $dbh = DBI->connect ($dsn, $user, $passwd,
+                       {ora_connect_with_default_signals => [ 'INT' ] });
+
+
 =back
 
 =head2 Prepare Attributes