Tim Bunce wrote:
> 
> On Tue, Feb 05, 2002 at 04:37:48PM +0100, Steffen Goeldner wrote:
> > + sub sql_identifier_quote_char {
> > +     my $dbh = shift;
> > +     my $sth = $dbh->func('adSchemaDBInfoLiterals','OpenSchema');
> > +     while ( my $row = $sth->fetch ) {
> > +             return $row->[1] if $row->[0] eq 'QUOTE'; # XXX QUOTE_PREFIX, 
>QUOTE_SUFFIX
> > +     }
> > +     return undef;
> > + }
> 
> Umm, expensive. Need a way to cache these...

O.k., but see below ...

> 
> > +     sub get_info {
> > +             my($dbh, $info_type) = @_;
> > +             require DBD::ADO::GetInfo;
> > +             if ( exists $DBD::ADO::GetInfo::odbc2ado{$info_type} ) {
> > +                     return 
>$dbh->{ado_conn}->Properties->{$DBD::ADO::GetInfo::odbc2ado{$info_type}}{Value};
> > +             }
> > +             my $v = $DBD::ADO::GetInfo::info{int($info_type)};
> > +             $v = $v->($dbh) if ref $v eq 'CODE';
> 
> How about we change that last line to
> 
>                 if (ref $v eq 'CODE') {
>                     my $get_info_cache = $dbh->{dbd_get_info_cache} ||= {};
>                     return $get_info_cache->{int($info_type)} if exists 
>$get_info_cache->{int($info_type)};
>                     $v = $get_info_cache->{int($info_type)} = $v->($dbh);

I'm not sure if we can cache *every* value. Is it possible that a DBMS
allows to change some properties at runtime (something like 'ALTER
SESSION SET ...')?

>                 }
> 
> There should probably be a
>                 $info_type = int($info_type)
> at the top to save the multiple ones later.

O.k.


Steffen

Reply via email to