Hi,
When it comes to database application we always have to trap DB error messages in order to provide messages to the users, which as I understand PHPR does this add_error_handler for new records, edit_error_handler for updating and deleting records.
Those handlers trap back the error message coming from MySQL, therefore PHPR can show the error message provided by the DB.
1st issue I have is that in our case, we do not use English language, therefore the messages coming from MySQL, even if we change the language to Greek in MySQL come in a mixed character set. Of course this is fixed with MySQL 5.5. (error messages provided to client with pre-defined character set, rather than mixed), but 5.5 is still not an option for most of the hosting service providers. On the other hand the English messages coming from MySQL are not so explanatory for non IT users (e.g, Duplicate entry 'xxx' for key 'strIRS' for duplicates).
One first thought would be if we could create our own custom error messages for given MySQL error codes. I understand that would be easy to do in add_error_handler, but I was wondering if you could provide an event for error handling for every table, so that we could customize each tables resulting messages for any kind of error.
On the other hand a question to consider: is it better to do a duplicate record check before posting the insert/update SQL, or let the query run on the server and handle the resulting error in a more sophisticated way? I mean since DB's have so much intelligence and a developer might change unique keys for a table based on a project's or a customer's needs, if we let the DB come back with an error message that we later on handle to provide visual feedback to the user, it would be better, rather than rewrite our duplicate record SQL check every time.