On Tue, Sep 10, 2002 at 08:00:50AM -0400, Steven N. Hirsch wrote:
> On Tue, 10 Sep 2002, Tim Bunce wrote:
> 
> > > I'm not sure.  Wouldn't any fetch() method returning an array behave in 
> > > the same manner?  For whatever reason, we did not see this problem until 
> > > Perl 5.8.0, so I'm not convinced it's a problem with the DB2 driver.
> > 
> > fetch() is an alias for fetchrow_arrayref, so calling it in a scalar context
> > should make no difference. Can you look into that? May a trace log would help.
> 
> I'll let you know.

Thanks.

> > This has two advantages, first we can now set proxy attributes:
> > 
> >     DBI_AUTOPROXY=dbi:Proxy(proxy_lazy_prepare=>1):host=...
> > 
> > but also we can use DBI_AUTOPROXY to enable the use of any other
> > driver that works in a similar way:
> > 
> >     DBI_AUTOPROXY=dbi:MyCustomProxy:...
> 
> It also ensures that autoproxy mode works in the manner implied by the 
> documentation.  I wasted a lot of time trying to figure out why setting:
> 
> DBI_AUTOPROXY='dbi:Proxy:hostname=foo;port=1234'
> 
> caused a runtime error.  Accepting the driver spec is definitely goodness.

Yeap.

> Any way I can get a patch for that?

Appended.

> Can you grant r/o access to CVS or the like?

It's crossed my mind from time to time to go the sourceforge kind'a route
but it's never quite happened.

Tim.


*** DBI.pm      2002/07/18 14:23:44     11.18
--- DBI.pm      2002/09/10 10:57:43
***************
*** 471,480 ****
        or Carp::croak("Can't connect(@_), no database driver specified "
                ."and DBI_DSN env var not set");
  
!     if ($ENV{DBI_AUTOPROXY} && $driver ne 'Proxy' && $driver ne 'Switch') {
!       $dsn = "$ENV{DBI_AUTOPROXY};dsn=dbi:$driver:$dsn";
        $driver = 'Proxy';
!       DBI->trace_msg("       DBI_AUTOPROXY: dbi:$driver:$dsn\n");
      }
  
      my %attr; # take a copy we can delete from
--- 471,484 ----
        or Carp::croak("Can't connect(@_), no database driver specified "
                ."and DBI_DSN env var not set");
  
!     if ($ENV{DBI_AUTOPROXY} && $driver ne 'Proxy' && $driver ne 'Sponge' && $driver 
ne 'Switch') {
        $driver = 'Proxy';
!       if ($ENV{DBI_AUTOPROXY} =~ s/^dbi:(\w*?)(?:\((.*?)\))?://i) {
!           $driver = $1;
!           $driver_attrib_spec = ($driver_attrib_spec) ? "$driver_attrib_spec,$2" : 
$2;
!       }
!       $dsn = "$ENV{DBI_AUTOPROXY};dsn=dbi:$driver:$dsn";
!       DBI->trace_msg("       DBI_AUTOPROXY: 
dbi:$driver($driver_attrib_spec):$dsn\n");
      }
  
      my %attr; # take a copy we can delete from
***************
*** 2072,2085 ****
  to define a syntax for the C<$data_source>, it is recommended that
  they follow the ODBC style, shown in the last example above.)
  
! If the environment variable C<DBI_AUTOPROXY> is defined (and the driver in
! C<$data_source> is not "C<Proxy>") then the connect request will
! automatically be changed to:
! 
!   dbi:Proxy:$ENV{DBI_AUTOPROXY};dsn=$data_source
! 
! and passed to the DBD::Proxy module. C<DBI_AUTOPROXY> is typically set as
! "C<hostname=...;port=...>". See the DBD::Proxy documentation for more details.
  
  If C<$username> or C<$password> are undefined (rather than just empty),
  then the DBI will substitute the values of the C<DBI_USER> and C<DBI_PASS>
--- 2077,2092 ----
  to define a syntax for the C<$data_source>, it is recommended that
  they follow the ODBC style, shown in the last example above.)
  
! If the environment variable C<DBI_AUTOPROXY> is defined (and the
! driver in C<$data_source> is not "C<Proxy>") then the connect request
! will automatically be changed to:
! 
!   $ENV{DBI_AUTOPROXY};dsn=$data_source
! 
! C<DBI_AUTOPROXY> is typically set as "C<dbi:Proxy:hostname=...;port=...>".
! If $ENV{DBI_AUTOPROXY} doesn't begin with 'C<dbi:>' then "dbi:Proxy:"
! will be prepended to it first.  See the DBD::Proxy documentation
! for more details.
  
  If C<$username> or C<$password> are undefined (rather than just empty),
  then the DBI will substitute the values of the C<DBI_USER> and C<DBI_PASS>

Reply via email to