rkg has asked for the wisdom of the Perl Monks concerning the following question:
Hi folks --
I'm using Class::DBI, and I need an aggregate function, so as per the docs I'm using set_sql, as Class::DBI inherits from Ima::DBI. This works fine
However, the Class::DBI docs indicate this shorter form might work too:Rk::M->set_sql(maxid => q(select max(m) from m)); my $sth = Rk::M->sql_maxid; $sth->execute; my ($max) = $sth->fetchrow_array;
It doesn't, complaining it can't locate object method 'maxid' via package Rk::M.Rk::M->set_sql(maxid => q(select max(m) from m)); my $max = Rk::M->maxid;
Am I reading the docs wrong here? I get the sense Class::DBI always wants to return a Rk::M (or whatever) object, not a simple int, but perhaps that's a second problem here -- for now, I am wondering why Class::DBI isn't even executing the method.
Thanks for your advice.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Class::DBI and Ima::DBI and ints and objects
by broquaint (Abbot) on Aug 20, 2003 at 09:32 UTC | |
Re: Class::DBI and Ima::DBI and ints and objects
by PodMaster (Abbot) on Aug 20, 2003 at 09:50 UTC | |
Re: Class::DBI and Ima::DBI and ints and objects
by trs80 (Priest) on Aug 20, 2003 at 21:13 UTC | |
Re: Class::DBI and Ima::DBI and ints and objects
by perrin (Chancellor) on Aug 20, 2003 at 14:58 UTC |
Back to
Seekers of Perl Wisdom