# This is a patch for \dev\perlmods\orig\DBD-Oracle-1.12 to bring it up to \dev\perlmods\DBD-Oracle-1.12.

# To apply this patch, chdir to you \dev\perlmods\orig\DBD-Oracle-1.12 source directory and enter
#
#     patch -p1 -N < <this-file>

Index: /dev/perlmods/DBD-Oracle-1.12/Makefile.PL
####### /dev/perlmods/DBD-Oracle-1.12/ => DBD-Oracle-1.12/
*** /dev/perlmods/orig/DBD-Oracle-1.12/Makefile.PL	Fri Aug 31 12:27:15 2001
--- DBD-Oracle-1.12/Makefile.PL	Wed Dec  4 23:40:54 2002
***************
*** 564,569 ****
--- 564,570 ----
    my $oh = shift;
  
    my ($req_ok, $hkey, $Val, $Keys);
+   my $default_home;
    if ( ! $oh ) {
        if ( $Config{osname} eq "MSWin32") {
  	  # Win32::TieRegistry is prefered, but it requires Win32API::Registry
***************
*** 581,586 ****
--- 582,590 ----
  	      $hkey = $Tie::Registry::Registry->{"LMachine/SOFTWARE/Oracle/"};
  	  } unless $req_ok;
  	  eval {
+ 	     $default_home = $hkey->{ORACLE_HOME} || '';
+ 	  };
+ 	  eval {
  	      $Val = sub {
  		  # Return value
  		  my ($hkey) = @_;
***************
*** 604,609 ****
--- 608,618 ----
  	  require Win32::Registry;
  	  $main::HKEY_LOCAL_MACHINE->Open('SOFTWARE\\ORACLE', $hkey);
  	  my $dummy = $main::HKEY_LOCAL_MACHINE; # avoid single use complaint
+ 	  eval {
+ 	     my $hval;
+ 	     $hkey->GetValues($hval);
+ 	     $default_home = $hval->{ORACLE_HOME}[2] || '';
+ 	  };
  	  $Val = sub {
  	      # Return value
  	      my ($hkey) = @_;
***************
*** 629,655 ****
        eval {
  	  my ($oh1, %oh);
  	  my @hkey = ($hkey);
! 	  while (@hkey) {
! 	      $hkey = shift @hkey;
  	      $oh   = $oh1, $oh{$oh1} = 1
  		  if ($oh1 = &$Val($hkey)) && -d $oh1;
  	      push @hkey, &$Keys($hkey);
! 	  }
! 	  if (1 < keys %oh) {
! 	    # JLU: 8/21/01 Oracle's default home is the first one in
! 	    # the path, at least with 8i
! 	    print "\n\007Multiple Oracle homes: ", join(" ", sort keys %oh), "\n\n";
! 	    my @path = split(";", $ENV{PATH});
! 	    my $dir;
! 	    foreach $dir (@path) {
! 	       # the path will be c:\path\to\home\bin, so remove \bin if it's there.
! 	       $dir =~ s/\\bin$//;
! 	       if (defined($oh{$dir})) {
! 		  print "$dir is first in the PATH, so we'll use that as Oracle's default home.\n\n";
! 		  $oh = $dir;
! 		  last;
! 	       }
! 	    }
  	  }
        } if defined $Keys;
    }
--- 638,672 ----
        eval {
  	  my ($oh1, %oh);
  	  my @hkey = ($hkey);
! 	  # JLU: December 5, 2002: if the "default" home is set and has
! 	  # an OCI directory, then use it.
! 	  if ($default_home && -d $default_home && -d $default_home . "/oci") {
! 	     $oh = $default_home;
! 	  } else {
! 	     # use previous logic if default home doesn't have OCI
! 	     # directory
! 	     while (@hkey) {
! 		$hkey = shift @hkey;
  	      $oh   = $oh1, $oh{$oh1} = 1
  		  if ($oh1 = &$Val($hkey)) && -d $oh1;
  	      push @hkey, &$Keys($hkey);
! 	     }
! 	     if (1 < keys %oh) {
! 	        # JLU: 8/21/01 Oracle's default home is the first one in
! 	        # the path, at least with 8i
! 		print "\n\007Multiple Oracle homes: ", join(" ", sort keys %oh), "\n\n";
! 		my @path = split(";", $ENV{PATH});
! 		my $dir;
! 		foreach $dir (@path) {
! 	           # the path will be c:\path\to\home\bin, so remove \bin if it's there.
! 		   $dir =~ s/\\bin$//;
! 		   if (defined($oh{$dir})) {
! 		      print "$dir is first in the PATH, so we'll use that as Oracle's default home.\n\n";
! 		      $oh = $dir;
! 		      last;
! 		   }
! 		}
! 	     }
  	  }
        } if defined $Keys;
    }


End of Patch.
