It would be simpler to

        $h->{PrintWarn} = 0;

at the right spot. (Perhaps in a block and using local.)

Tim.

On Wed, Sep 06, 2006 at 10:13:15AM -0400, Garrett, Philip (MAN-Corporate) wrote:
> John Scoles wrote:
> >
> >> t/26exe_array...........DBD::Oracle::st execute_array warning:
> >> ORA-24381: error(s) in array DML (DBD SUCCESS_WITH_INFO: error
> >> possibly near <*> indicator at char 66 in 'INSERT INTO
> >> dbd_ora__drop_me ( row_1, row_2, row_3) VALUES (:p1,:<*>p2,:p3)')
> >> [for Statement "INSERT INTO dbd_ora__drop_me ( row_1,  row_2, row_3)
> >> VALUES (?,?,?)" with ParamValues: :p3=undef, :p1=undef, :p2=undef]
> >> at t/26exe_array.t line 
> >> 77.
> >> 
> > 
> >> Again, this doesn't seem to be particularly serious, and the install
> >> proceeds anyway.
> > 
> > You are right this is a deliberate error that is testing to see if an
> > error in the tuple is returned. So you can ignore it.
> 
> Hi John,
> 
> The following patch hides the warning but still checks for its
> existence.
> If the long lines get wrapped, you can get the pristine patch here:
> http://www.pgarrett.net/DBD-Oracle-ExeArray.patch
> 
> Regards,
> Philip
> 
> 
> --- 26exe_array.t.orig  2006-09-07 00:08:58.091338000 +1000
> +++ 26exe_array.t       2006-09-07 00:07:29.814842000 +1000
> @@ -4,7 +4,7 @@
>  use DBD::Oracle qw(ORA_RSET SQLCS_NCHAR);
>  use strict;
>  
> -use Test::More tests =>13 ;
> +use Test::More tests =>14 ;
>  unshift @INC ,'t';
>  require 'nchar_test_lib.pl';
>  
> @@ -74,18 +74,35 @@
>  
>  @var2         = (2,2,2,2,'s',2,2,2,2,2);
>  
> -ok (!$sth->execute_array(
> -      {ArrayTupleStatus => $tuple_status},
> -        [EMAIL PROTECTED],
> -        [EMAIL PROTECTED],
> -       [EMAIL PROTECTED],
> - ), '... execute_array should return flase');
> +{
> +  # trap the intentional failure of one of these rows
> +  my $warn_count = 0;
> +  local $SIG{__WARN__} = sub {
> +    my $msg = shift;
> +    if ($warn_count++ == 0 && $msg =~ /ORA-24381/) {
> +      # this is the first warning, and it's the expected one
> +      return;
> +    }
> +
> +    # unexpected warning, pass it through
> +    warn $msg;
> +  };
> +  
> +  ok (!$sth->execute_array(
> +        {ArrayTupleStatus => $tuple_status},
> +          [EMAIL PROTECTED],
> +          [EMAIL PROTECTED],
> +         [EMAIL PROTECTED],
> +   ), '... execute_array should return flase');
> +  
> +    cmp_ok(scalar @{$tuple_status}, '==', 10, '... we should have 10
> tuple_status');
> +  
> +    cmp_ok( $tuple_status->[4]->[1],'ne','-1','... we should get
> text');
> +  
> +    cmp_ok( $tuple_status->[3],'==',-1,'... we should get -1');
>  
> -  cmp_ok(scalar @{$tuple_status}, '==', 10, '... we should have 10
> tuple_status');
> -
> -  cmp_ok( $tuple_status->[4]->[1],'ne','-1','... we should get text');
> -
> -  cmp_ok( $tuple_status->[3],'==',-1,'... we should get -1');
> +    is($warn_count, 1, "... we should get a warning");
> +}
>  
>  
>  # siple test with execute_for_fetch

Reply via email to