[EMAIL PROTECTED] wrote:
> 
> In Oracle.pm:
> 
>  $Id: Oracle.pm,v 1.92 2001/08/31 16:23:59 timbo Exp $
>  $DBD::Oracle::VERSION = 1.12
> 
> Perl: v5.6.1 built for sun4-solaris
> Oracle: v.8.1.7
> 
> I get these four as undef values, which barfs the uninitialized variable
> message on line 327.
> 
>  320  # SQL/CLI (ISO/IEC JTC 1/SC 32 N 0595), 6.63 Tables
>  321: my $CatVal = $attr->{TABLE_CAT};
>  322: my $SchVal = $attr->{TABLE_SCHEM};
>  323: my $TblVal = $attr->{TABLE_NAME};
>  324: my $TypVal = $attr->{TABLE_TYPE};
>  325: my @Where = ();
>  326: my $Sql;
>  327: if ( $CatVal eq '%' && $SchVal eq '' && $TblVal eq '') { # Rule 19a
> 
> Would the obvious fix of adding a default of the empty string work? e.g.
> 
>   my $CatVal = $attr->{TABLE_CAT} || '';
> 

Because there are some tests for 'defined' in the method,
I would not use the empty string as default. Rather, I
would include more 'defined' tests.
(A simpler approach would be: no warnings 'uninitialized';)

The attached patch includes the changes from

  http:[EMAIL PROTECTED]/msg00385.html


Steffen
*** F:\tmp\DBD-Oracle-1.12.orig\Oracle.pm       Fri Aug 31 18:27:18 2001
--- Oracle.pm   Tue Dec 11 20:43:56 2001
***************
*** 314,330 ****
  
  
      sub table_info {
!       my($dbh, $attr) = @_;
        # XXX add knowledge of temp tables, etc
- 
        # SQL/CLI (ISO/IEC JTC 1/SC 32 N 0595), 6.63 Tables
!       my $CatVal = $attr->{TABLE_CAT};
!       my $SchVal = $attr->{TABLE_SCHEM};
!       my $TblVal = $attr->{TABLE_NAME};
!       my $TypVal = $attr->{TABLE_TYPE};
        my @Where = ();
        my $Sql;
!       if ( $CatVal eq '%' && $SchVal eq '' && $TblVal eq '') { # Rule 19a
                $Sql = <<'SQL';
  SELECT NULL TABLE_CAT
       , NULL TABLE_SCHEM
--- 314,329 ----
  
  
      sub table_info {
!       my($dbh, $CatVal, $SchVal, $TblVal, $TypVal) = @_;
        # XXX add knowledge of temp tables, etc
        # SQL/CLI (ISO/IEC JTC 1/SC 32 N 0595), 6.63 Tables
!       if (ref $CatVal eq 'HASH') {
!           ($CatVal, $SchVal, $TblVal, $TypVal) =
!               @$CatVal{'TABLE_CAT','TABLE_SCHEM','TABLE_NAME','TABLE_TYPE'};
!       }
        my @Where = ();
        my $Sql;
!       if ( defined $CatVal && $CatVal eq '%' && (!defined $SchVal || $SchVal eq '') 
&& (!defined $TblVal || $TblVal eq '')) { # Rule 19a
                $Sql = <<'SQL';
  SELECT NULL TABLE_CAT
       , NULL TABLE_SCHEM
***************
*** 334,340 ****
    FROM DUAL
  SQL
        }
!       elsif ( $SchVal eq '%' && $CatVal eq '' && $TblVal eq '') { # Rule 19b
                $Sql = <<'SQL';
  SELECT NULL      TABLE_CAT
       , USERNAME  TABLE_SCHEM
--- 333,339 ----
    FROM DUAL
  SQL
        }
!       elsif ( defined $SchVal && $SchVal eq '%' && (!defined $CatVal || $CatVal eq 
'') && (!defined $TblVal || $TblVal eq '')) { # Rule 19b
                $Sql = <<'SQL';
  SELECT NULL      TABLE_CAT
       , USERNAME  TABLE_SCHEM
***************
*** 345,351 ****
   ORDER BY 2
  SQL
        }
!       elsif ( $TypVal eq '%' && $CatVal eq '' && $SchVal eq '' && $TblVal eq '') { # 
Rule 19c
                $Sql = <<'SQL';
  SELECT NULL TABLE_CAT
       , NULL TABLE_SCHEM
--- 344,350 ----
   ORDER BY 2
  SQL
        }
!       elsif ( defined $TypVal && $TypVal eq '%' && (!defined $CatVal || $CatVal eq 
'') && (!defined $SchVal || $SchVal eq '') && (!defined $TblVal || $TblVal eq '')) { # 
Rule 19c
                $Sql = <<'SQL';
  SELECT NULL TABLE_CAT
       , NULL TABLE_SCHEM

Reply via email to