[CDBI] find_or_create() usage or feature request
"Carlos Ramirez" <[email protected]> Thu, 24 May 2007 14:01:57 -0700
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <[email protected]> |
I like the functionality of find_or_create() however, i think it could
be better if it allowed you specify the search criteria and the actual
record data as seperate parameters like:
## find_or_create(\%search_criteria [,\%new_record]);
Module->find_or_create({user_name => 'einstein'},
{ user_name => 'einstein', field => 'physics', fname => 'Albert'});
For instance, if I want to find or create a new record where I only want
to check that the user_name field doesn't already exist, before I insert
the record. The current implementation requires that you specify all the
new fields of the new record which are used as conditions for a search
... right?