On 6/1/06 5:43 PM, John Siracusa wrote:
>> also there since isnt anything like insert_or_update should i :
>> $class->insert unless $class->update;
>> 
>> or is save smart enough for that?
> 
> The save() method will do the right thing.

Actually, it'll only do the right thing when it knows if an object is in the
db (e.g., if it was previously load()ed.  I'll add an insert_or_update()
helper.

>> any plans for supporting on duplicate key update?
> 
> I'm not sure what you mean by this...

Okay, now I do know what you mean, and it appears to be a MySQL-ism.  It
shouldn't be hard to add, however.  Any ideas on an interface?  I'm leaning
towards making two helpers instead of just one: insert_or_update() and
insert_and_on_duplicate_key_update(), which you can rename to whatever you
want when you use them, naturally:

    package MyDB::Base;
    ...
    use Rose::DB::Object::Helpers
    {
      insert_and_on_duplicate_key_update => 'insert_or_update',
    };

Or should I just make the insert_or_update() method use "on duplicate key"
automatically when running against mysql version <whatever> or later?  Hm, I
don't want to have to check the db version once per db object, though.  Any
better ideas?

-John




-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to