[erlang-questions] 12B4 ODBC bug
Wed Sep 17 16:36:33 CEST 2008
Environment: Erlang 12B4, unixODBC 2.2.11, postgresql-odbc 08.01.0200
Refer to odbcserver.c, line 551 and following.
I ran an INSERT statement that violated a unique constraint. This resulted in
the result code -1 = SQL_NULL_DATA and an error message
[unixODBC]Error while executing the query (non-fatal);\nERROR: duplicate key
violates unique constraint \"tfleet_config_fleet_id_key\" SQLSTATE IS: 00000
The code tries to recognise the ERROR at the beginning of the message but
fails since it is on line 2. The execution then ends up at line 585 where it
tries to encode a normal result. In encode_result() we get a fatal error at
the DO_EXIT(EXIT_COLS); line. The Erlang code gets a connection_closed error.
Two fixes are needed.
1. Look for ERROR using something like the gcc strcasestr() function. You may
need to write your own for portability.
2. Handle the SQL_NULL_DATA result. I don't know what this code is supposed
Anthony Shipman Mamas don't let your babies
grow up to be outsourced.
More information about the erlang-questions