At Fri, 21 Jun 2002 02:56:31 -0400, Kee Hinckley wrote:
> Currently if you do something like:
>       select year(pubdate) as year;
> you can't refer to $set->{year}, instead it's $set->{'year(pubdate) 
> as year'}.

i have used column aliasing (or whatever its called) without even
thinking about it, and its worked fine (using postgres/DBD::Pg).

iirc, DBIx::Recordset uses the column names as returned by
fetchrow_hashref (or similar), so you might want to check that your
database/driver correctly supports column alia there.

> Note however that there is a bug that has existed before this. 
> Namely if the expression to the left of the AS has a comma in it, the 
> whole field parsing code is going to fall apart.

i posted a patch for that in january (message id:
<[EMAIL PROTECTED]>). it didn't actually fix
the problem, just made it a little more robust by ignoring things that
weren't column names..


one line patch repeated here:

Index: Recordset.pm
===================================================================
RCS file: /var/lib/cvs/debian/libdbix-recordset-perl/Recordset.pm,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 Recordset.pm
--- Recordset.pm        23 Dec 2001 07:01:03 -0000      1.1.1.2
+++ Recordset.pm        2 Jan 2002 01:39:40 -0000
@@ -1801,7 +1801,7 @@
     if (defined ($fields) && !($fields =~ /^\s*\*\s*$/))
         {
         #@allfields = map { (/\./)?$_:"$tab4f->{$_}.$_" } split (/\s*,\s*/, $fields) ;
-        @allfields = map { (/\./)?$_:"$tab4f->{$_}.$_" } quotewords ('\s*,\s*', 0, 
$fields) ;
+        @allfields = map { (/\./ || !$tab4f->{$_})?$_:"$tab4f->{$_}.$_" } quotewords 
+('\s*,\s*', 0, $fields) ;
         #print LOG "###allfields = @allfields\n" ;
        }
     else

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to