On Thu, Feb 07, 2002 at 11:13:22AM +0100, Steffen Goeldner wrote:
> Tim Bunce wrote:
> >
> > On Wed, Feb 06, 2002 at 09:48:54AM +0100, Steffen Goeldner wrote:
> [...]
>
> > > 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 ...')?
> >
> > Umm [grumble], you're right. How about this:
> >
> > if (ref $v eq 'CODE') {
> > my $get_info_cache = $dbh->{dbd_get_info_cache} ||= {};
> > return $get_info_cache->{$info_type} if exists
>$get_info_cache->{$info_type};
> > $v = $v->($dbh);
> > $get_info_cache->{$info_type} = ($v=$$v) if ref $v eq 'SCALAR';
> ---------------------
> Here, the SCALAR-ref indicates: Cache it! (missing 'not'?)
> I'd rather replace the pragma 'use short;' with 'no obfuscate;' ;-)
:-)
> + 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;
> + }
Probably need a $sth->finish in there.
> + sub sql_keywords {
> + my $dbh = shift;
> + my $sth = $dbh->func('adSchemaDBInfoKeywords','OpenSchema');
> + my @Keywords = ();
> + while ( my $row = $sth->fetch ) {
> + push @Keywords, $row->[0];
> + }
> + return join ',', @Keywords;
> + }
Or maybe:
return join ',', @{ $dbh->selectcol_arrayref($sth)||[] };
> + %info = (
> + 22 => \&sql_concat_null_behavior # SQL_CONCAT_NULL_BEHAVIOR
> + , 6 => 'DBD/ADO.pm' # SQL_DRIVER_NAME # XXX
Maybe $INC{"DBD/ADO.pm"} instead.
> --- DBD-ADO-2.4.02/lib/DBD/ADO.pm Wed Feb 06 20:20:22 2002
>
> + sub get_info {
> + my($dbh, $info_type) = @_;
> + require DBD::ADO::GetInfo;
> + if ( exists $DBD::ADO::GetInfo::odbc2ado{$info_type} ) {
int($info_type) like:
> + my $v = $DBD::ADO::GetInfo::info{int($info_type)};
Many thanks again Steffen.
Tim.