and it assumes that you actually use "transactions" which which mysql
and isam i do not :)
mainly because some databases can't be switched that easily
so i prefer using a complete app-based approach


On 27 Mrz., 04:59, Ryan Schmidt <google-2...@ryandesign.com> wrote:
> On Mar 26, 2011, at 21:45, euromark wrote:
>
> > On 27 Mrz., 03:26, Ryan Schmidt wrote:
> >> If the title is supposed to be unique, put a UNIQUE index on the title 
> >> column in the database. That will prevent duplicates from being inserted. 
> >> Though it won't necessarily help you get a user-friendly error message, if 
> >> that's what you're after.
>
> > exactly, ryan
> > thats too late if you want to validate all of em first before starting
> > to insert them into the database
>
> I wouldn't say it's "too late". Assuming you start a transaction before 
> inserting anything, and roll back the transaction if any of them fails, your 
> batch of inserts is still atomic. If any of them fails, none of them are 
> inserted. I just don't know if you can get a meaningful user-friendly error 
> message based on a failure to insert. Though you might be able to. I assume 
> the database has a specific error code for duplicate key, which you could 
> check for and return a nice error message.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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

Reply via email to