I have not found any Cake function to handle it. I use query() to add an "...ON DUPLICATE KEY..." for the one single place I need it. It is a huge performance boost if you kan let MySQL do it compared to doing a find to check before saving.
/Martin On Aug 14, 3:58 am, Jamie <jamie....@gmail.com> wrote: > Basically, if the data you're saving has an id (or whatever the > primary key of the model is), then the code will execute an update > statement. Otherwise, it'll insert. You don't need to check > beforehand, in other words, since the Cake code will determine from > the data passed whether it should update or insert. > > > > Nancy wrote: > > MySQL lets you use replace syntax if you have data and you don't know > > if it's new or not. Is there anything in Cakephp that'll let you do > > that? In other words, I don't know if the data I'm putting into my > > database is brand spanking new or just updated. I'd rather not have > > to check and just let the database handle it, but not sure the > > framework supports that. > > > Anyone know? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---