From the docs and a quick chat on IRC I understand that the following:

package My::Schema::Order_Product;
...
__PACKAGE__->table('order_product');
__PACKAGE__->add_columns(qw/ id product quantity unitprice /);

...

my $rs = $c->model('Order_Product')->search(
 {},
 {
   +select => ['quantity * unitprice'],
   +as => ['line_total']
 }
);

should cause DBIC to generate something like:

SELECT id, product, quantity, unitprice, quantity * unitprice FROM
order_product me

It's only giving me the following though:

SELECT quantity * unitprice FROM order_product me

The only way I can get the other columns is to add them manually using
the "select" attribute.

What have I done wrong here?

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to