On Fri, Feb 08, 2002 at 03:16:38PM +0100, Steffen Goeldner wrote:
> Tim Bunce wrote:
> > 
> > On Thu, Feb 07, 2002 at 11:13:22AM +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;
> > > + }
> > 
> > Probably need a $sth->finish in there.
> 
> Ok. Or, I'm thinking about a method ado_schema_dbinfo_literal(), caching
> all data of the adSchemaDBInfoLiterals pseudo-table, ...
> Attached are some results for the MSDAORA and Jet Provider.

Seems like a good idea.

> > > + 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)||[] };
> 
> It doesn't work. It would work if I drop the execute() in
> selectcol_arrayref() ... ???

Ah, maybe I should add a fetchcol_array* methods.

FYI, the guts of selectcol_arrayref look like:

        my @columns = ($attr->{Columns}) ? @{$attr->{Columns}} : (1);
        my @values  = (undef) x @columns;
        my $idx = 0;
        for (@columns) {
            $sth->bind_col($_, \$values[$idx++]) || return;
        }
        my @col;
        push @col, @values while $sth->fetch; # fetch fetch loop
        return \@col;

Which is kind'a cute :)

But it's not worth worrying about here as it all gets cached anyway.

Tim.

Reply via email to