Re: [opendbx] Error handling
Brought to you by:
nose
From: Norbert S. <no...@li...> - 2013-10-04 17:08:18
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Brian > Thanks for the quick response. Below is the SQL statement that is > getting executed and below that is code. It appears that the > issue might revolve around the dbsqlok(). When dbsqlok() is called > in mssql_odbx_result() the following sequence occurs 1) > mssql_msg_handler() is called with the primary key violation > message, 2) mssql_err_handler() is called, and 3) > mssql_msg_handler() is called indicating that the statement has > been terminated. Then dbsqlok() returns with a return value other > than FAIL. Since dbsqlok() does not return FAIL, -ODBX_ERR_BACKEND > is not returned and an exception is not raised. Thanks for debugging the problem. I think it's OK that dbsqlok() does not return "FAIL" because the SQL statement is correct. Only the execution fails due to the primary key constraint so I would expect that dbresults() should return something else than "SUCCEED" or "NO_MORE_RESULTS". The mssql_err_handler function returns "INT_CANCEL" in your case which should case a "FAIL" in the function that encountered the error. Do you use FreeTDS? Which version? I had a look into the latest version (0.92.79) but I'm not sure how this problem is handled there. The documentation of the functions doesn't help either: dbsqlok(): Wait for results of a query from the server. \retval FAIL SQL syntax error, typically. dbresult(): Call dbresults() after calling dbsqlexec() or dbsqlok(), or dbrpcsend() returns SUCCEED. Unless one of them fails, dbresults will return either SUCCEED or NO_MORE_RESULTS. SUCCEED does not imply that DBROWS() will return TRUE or even that dbnumcols() will return nonzero. dbperror(): Call client-installed error handler. the handler's return code, subject to correction and adjustment for vendor style: - INT_CANCEL The db-lib function that encountered the error will return FAIL. So according to the documentation it should work this way :-/ Maybe you should ask on the FreeTDS list too if this is a bug in the FreeTDS library. Norbert -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJSTvXeAAoJEA3e3tWv2uU+69kQAKZyo0FuoznPHgCEM8LIOpk3 tHitmXLbE3ywGv9JdNraKEERfqQx+9gfoViIbjygD6G2bOJKgyZ+lZXWyZDZojCD nGq5p8HE6LMdyB9dmnewjjVHp675mzfliD7W4zK/JHtq9JjPWGEaybIEwgNUrz+n sqnKObwjyzuA47nxT9WsmT2Et9t/awv07Vn91kN8NLQtHqye02Cfbhs+piE9/5zy 90+lKGgNl6htyVGhqVSvI5vHGbxOD84eE36Iux8VAMNc/AYU1PvZlP+wcNGr60zR U9kop0iRS8ZEvdQ9Q9NQeRQtQm0ekLGeceBzGOXBPESfxwiG6OQrD1bCfBswHEwp 269gSYi+6gzo33+YtUdeVZf8wFPwoRzKvE3w4QQ35HPtXjmxKNaLL879+1O026dj fHvqnoTHuWHGCpPanx5Fbt3LWd92rExDzBSybWUjXxkwhIQL67JWpft8crcPUOcR YIkYoDPamGSGwfGCINetnh5ttTzjxa1X/FYfNtcy/FLEUUN61TmqVwoCdElLzVUz AXDCwXXohdVJjdGobDOF5j0tuk3IkiBIwzyDVBUafZDSEOf0l5dLKzd0TaDP3z5H yiIbk0AkvvLseHAQCQKCJJWLA9BOab/LandE7Rq8WtnrdC/JeCD55kFKJug1a2A/ bndImUrR0qtxR28hwTty =YTTi -----END PGP SIGNATURE----- |