On 2/1/07 2:03 PM, Mike Schilli wrote:
> On Thu, 1 Feb 2007, John Siracusa wrote:
>> I question the wisdom of not supplying a sort_by paramater, however.
> You're right, in the general case, sort_by is essential, but often
> times, the application knows that there's either exactly one matching
> record in the database or none.

Maybe you should share that information with the database... :)

> It's something that I'm running into quite frequently:
> I want to find out whether a matching record exists or not, and
> load it if so. I guess it comes from using Class::DBI previously,
> which allowed calls like
>     my $cd = Music::CD->find_or_create({ artist => 'U2', title => 'Boy' });
> Just speculating: Could this be added to the new find() method?

It's something entirely different.  The only thing in common is the word
"find".  There's already a load_or_save() Helper method, but with the word
"load" in there, it of course needs a unique key.  I think I'd have to see
some more requests and usage examples before adding something like the
db_find_or_create() method posted earlier.  Right now, it seems very odd to
me.  What does everyone else think?


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
Rose-db-object mailing list

Reply via email to