> On 8/30/06, Kurt Hansen <[EMAIL PROTECTED]> wrote:
>> I need to do sum, max, avg, group by on columns in my database. However,
>> I'm not sure the best way to do it in RDBO.
John Siracusa wrote:
> If you want
> to support customization of the query, you can use some undocumented
> features of the Manager to help build the SQL:
>
> package My::Product::Manager;
> ...
> sub get_average_prices
> {
> my($class, %args) = @_;
>
> # group_by is an undocumented Manager parameter that
> # only works with get_objects_sql()
> $args{'group_by'} ||= 'type';
>
> $args{'select'} = "$args{'group_by'}, AVG(price)",
>
> my($sql, $bind) = $class->get_products_sql(%args);
Shouldn't this be:
my($sql, $bind) = $class->get_objects_sql(%args);
?
However, using this code gives me the following error:
Can't call method "meta" on an undefined value at
/usr/local/lib/perl5/site_perl/5.8.5/Rose/DB/Object/Manager.pm line 325.
line 325 is this:
my $meta = $object_class->meta;
in the get_objects method.
I'm using 0.75 of RDBO.
I did first try it with get_transactions_sql, but got an error saying
that get_transactions_sql could not be found in my Manager class, i.e.
DB::CWTrans::Manager::Transaction. That made sense after reading the
docs so I changed it to get_objects_sql, but I'm not sure what I'm doing
wrong now. get_transactions_count works fine.
Thanks!
Kurt
[EMAIL PROTECTED]
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object