On Nov 15, 8:57 am, sco...@pythian.com (John Scoles) wrote: > I can add in an 'ora_' type attribute that could take care of it. I > have done it for other little things as well. > I do not think this will go against the spec in any way. > > You can send me the patch and I will apply it. See below for a patch that does not change the default behavior but allows the user to specify a list of signals to be localized during the connect phase. This could easily be default to localize the "INT" handler but since there's some concern over breaking existing applications, I've left the default behavior alone.
I've confirmed that this change fixes the behavior I'm seeing in my environment. The patch is based on the 1.27 RC tarball that was posted a few days ago (http://svn.perl.org/modules/dbd-oracle/branches/ polute/DBD_ORACLE_1_27_RC_1.tar.zip). Please let me know if I can provide any more details, explanations or tweaks to this patch. diff --git a/Oracle.pm b/Oracle.pm index 4daa010..974c9df 100644 --- a/Oracle.pm +++ b/Oracle.pm @@ -271,8 +271,12 @@ my $ORACLE_ENV = ($^O eq 'VMS') ? 'ORA_ROOT' : 'ORACLE_HOME'; $attr->{ora_drcp_incr} = $ENV{ORA_DRCP_INCR} } - DBD::Oracle::db::_login($dbh, $dbname, $user, $auth, $attr) - or return undef; + { + my @local_signals = @{ $attr->{ora_local_signals} || [] }; + local @s...@local_signals} if @local_signals; + DBD::Oracle::db::_login($dbh, $dbname, $user, $auth, $attr) + or return undef; + } if ($attr && $attr->{ora_module_name}) { eval { @@ -370,6 +374,7 @@ my $ORACLE_ENV = ($^O eq 'VMS') ? 'ORA_ROOT' : 'ORACLE_HOME'; ora_oci_success_warn => undef, ora_objects => undef, ora_ncs_buff_mtpl => undef, + ora_local_signals => undef, }; } @@ -1813,10 +1818,6 @@ If the previous error was from a failed C<prepare> due to a syntax error, this attribute gives the offset into the C<Statement> attribute where the error was found. -=back - -=over 4 - =item ora_array_chunk_size Because of OCI limitations, DBD::Oracle needs to buffer up rows of @@ -1831,6 +1832,21 @@ used to limit or extend the number of rows processed at a time. Note that this attribute also applies to C<execute_array>, since that method is implemented using C<execute_for_fetch>. +=item ora_local_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_local_signals => [ 'INT' ] }); + =back =head2 Prepare Attributes