Norbert,

Thanks for the response.  I am current using freetds 0.82.  I started
with version 0.91, but encountered a seg fault, so I went back to 0.82.
In digging through freetds, it appears to be a design oversight.  In
this case, the error handler is being called from
_dblib_handle_info_message().  This method does not capture the return
value from the error handler, therefore it does not cancel the
operation.  Maybe they are expecting to handle the processing of info
messages through some other mechanism other than an error handler.

In any case, I have posted a question to the freetds mail list.

Thanks, Brian.

-----Original Message-----
From: Norbert Sendetzky [mailto:norb...@linuxnetworks.de] 
Sent: Friday, October 04, 2013 12:08 PM
To: OpenDBX devel list
Subject: Re: [opendbx] Error handling

-----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-----

------------------------------------------------------------------------
------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most
from 
the latest Intel processors and coprocessors. See abstracts and register
>
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clk
trk
_______________________________________________
libopendbx-devel mailing list
libopendbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libopendbx-devel
http://www.linuxnetworks.de/doc/index.php/OpenDBX

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
libopendbx-devel mailing list
libopendbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libopendbx-devel
http://www.linuxnetworks.de/doc/index.php/OpenDBX

Reply via email to