Simon Oliver wrote:
>
> But my point is that tables() makes some assumptions and not others - it
> quotes some identifiers and not others, it includes some identifiers and
> not others!
>
I absolutely agree that tables() need to be patched. Furthermore,
I (mostly) agree with your implementation. The only doubt I have
concerns TableIdentifiers():
sub tables {
my ($dbh, @args) = @_;
my $sth = $dbh->table_info(@args);
return unless $sth;
my ($row, @tables);
while($row = $sth->fetch) {
my @ids = ();
/*
foreach (@{$dbh->{TableIdentifiers}}) {
*/
foreach (0..2) {
if (defined $row->[$_]) {
push @ids, $dbh->quote_identifier($row->[$_]);
}
}
push @tables, join('.',@ids);
}
return @tables;
}
The result is the same, if the SQL in table_info() returns NULL for
an unsupported part of the identifier. And it should do so according
to the standard!
> > If a DBD Writer knows, the database does not support catalog names in
> > SQL statements, then table_info() should return NULL for TABLE_CAT.
> That assumes that the DBD provides its own tables() method - most don't
> and rely on the default DBI::tables method.
>
Only its own table_info(). (Assumed, tables() is patched, see above.)
> > In this case, tables() does not need TableIdentifiers()!
> > O.k., DBD::ODBC may cause troubles, because it depends on (possible
> > buggy) ODBC drivers. In this case, the user would be able to provide
> > a workaround via TableIdentifiers().
> My idea is that TableIdentifiers would be set by the DBD and then the
> DBD would not need to override the DBI::tables method.
See above. We need a standard conforming table_info() in each DBD
and a patched tables() in DBI.
Steffen G�ldner
Olga Voronova