View Full Version : sql Exceptions

10th October 2008, 01:49
Hi ..
I would like to know if there's a class in Qt that hold the sql exceptions ..
when I want to delete or update data .. I would like to hold the sql error due to constraint as foreign keys !!


10th October 2008, 02:38
The closest thing I found was QSqlError::number(), which always returns -1 in case of PostgreSQL, and QSqlError::type(), which, in case of a PosgreSQL constraint violation, returns QSqlError::StatementError. I would also like to have more differentiation between various SQL errors.

10th October 2008, 03:51
returning these 2 items usually works well for me to figure out what happened:

QSqlError::databaseText ()
QSqlError::driverText ()

Usually these are more verbose and complete error messages.