| Upgrade Guides for Genero BDL / 2.2x upgrade guide | |
When a unique or primary key constraint is violated, the IBM® Informix® driver returns -268 if the database uses transaction logging, and -239 if the database uses no logging.
Regarding non-Informix drivers, all 2.21 drivers now return SQLCA.SQLCODE -268 when a unique constraint or primary key constraint is violated. Before 2.21, the Oracle and SQL Server / Sybase drivers returned error -239, which is only returned by IBM Informix databases without transaction logging. Returning error -268 for all drivers is the best choice in a context of transactional databases.
FUNCTION isUniqueConstraintError()
IF (SQLCA.SQLCODE==-239 OR SQLCA.SQLCODE==-268)
OR (SQLCA.SQLCODE==-346 AND SQLCA.SQLERRD[2]==-100)
THEN
RETURN TRUE
ELSE
RETURN FALSE
END IF
END FUNCTION