PDA

View Full Version : sql Exceptions



peace_comp
10th October 2008, 00: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 !!

thx...

yuriry
10th October 2008, 01: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.

tpf80
10th October 2008, 02: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.