ODBC crashes on stored procedure result sets

Paul Oliver puzza007@REDACTED
Fri Nov 27 10:31:42 CET 2009


Hi,

Has anyone observed problems with stored procedures that return
result-sets?  It seems (at least with unixodbc and the informix ODBC
driver) that SQLDescribeCol returns a name_len < 0 which then causes a
crash on calling SQLBindCol.  Since I'm not expected these columns to
be named I've fixed it by doing:

	if(!sql_success(SQLDescribeCol(statement_handle(state),
				       (SQLSMALLINT)(i+1),
				       name, sizeof(name), &name_len,
				       &sql_type, &size, &dec_digits,
				       &nullable)))
	    DO_EXIT(EXIT_DESC);

	/* Don't let the driver tell us that the name_len is negative, it
	   can crash SQLBindCol below */
	if (name_len < 0)
		name_len = 0;

The patch is available here
http://github.com/puzza007/otp/tree/stored_proc_colname_has_bad_length.

Does anyone have any advice?

Cheers,
Paul.


More information about the erlang-questions mailing list