DBIx::Recordset seems to be a little overzealous when fully-qualifying
column names:

 *set =
  DBIx::Recordset->Setup({'!DataSource' => 'whirlwind',
                          '!Table' => 'orders',
                          '!LinkName' => 2,
                          '!Fields' => 'id, client, title, product,
 busday_minus(due_date, 1) AS dispatch_date, status',
                          '!Debug' => 2,
                         });

becomes:

DB:  'SELECT 
orders.title,orders.id,orders.client,orders.product,.busday_minus(due_date,.1) AS 
dispatch_date,orders.status,contacts.name,products.product,products.variant1,products.variant2,products.variant3
 FROM ((orders left join contacts on orders.client = contacts.id) left join products 
on orders.product = products.id)     ORDER BY orders.due_date DESC, orders.status  ' 
bind_values=<> bind_types=<>

note *both* the leading dots in ".busday_minus(due_date,.1)"
 
attached one-line patch only adds table qualifier only if the column name
exists in the $tab4f hash, which still isn't right, but its better.

-- 
 - Gus
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