On Mon, 3 Mar 2003, Tim Bunce wrote:
> $sth = $dbh->prepare("SELECT table.field FROM table"); # note table.field
> $sth->execute;
> print "NAME_lc = '$sth->{NAME_lc}->[0]' \n";
>
> for the drivers you use?
>
> Is it 'field' or 'table.field'?
For DBD::Pg I get field.
> If it's 'table.field', does it only return that if the select
> explicitl names the table with the field, as in the example above,
> or does it always return the table even if the field is not qualified
> with the table name?
>
> I've just discovered that DBD::mysql returns 'table.field' and that
> came as a bit of a surprise.
>
> I'm pondering clarifying the DBI spec to ...
> a) say that drivers should only return the field name, or
> b) say that NAME may contain the table,
> but that NAME_lc & NAME_uc won't (because the DBI will remove it), or
b) sounds better.
I can see a) causing problems if you want the driver to remove the
table name. eg., SELECT 1 AS "table.field", 2 as "This.That";
With b. you are already mucking with the table name so you probably could
get away with it there.
-r