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...

> +     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);
                }

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

Tim.

Reply via email to