I prefer combination of the following methods: 1. Check the uniqueness using a SELECT query. 2. Display error 3. After fixing error, execute data modification statemenet. 4. In case of error I can do either of the following: 4.1. parse error message and display error or if it fails 4.2. just show the general database error message and optionally 4.3. show the general database error message with recording exact message text to log
Sincerely, Alex On 9/29/07, lauren49 <[EMAIL PROTECTED]> wrote: > > Hi, > > I understand that checking for a value's uniqueness against a db table > within in application is not a stable method and should not be relied upon > but the exception message thrown by a save attempt when a value is not > unique really doesn't make much sense to the user > > Caught exception: Zend_Db_Statement_Exception > Message: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate > entry '12-Report 21' for key 2 > > Instead I'd rather report a more user-friendly error message to the user > such as > > 'Report 21' already exists > > I'm very curious to hear how other's may have handled this problem. > > Thank you, > Lauren > > > -- > View this message in context: > http://www.nabble.com/Validation-for-multi-column-unique-constraints-tf4537684s16154.html#a12951118 > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
