[freetds] SQLDescribeCol, current_statement and TDS_NO_MORE_RESULTS

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Tue Jan 27 11:42:33 EST 2004


About this change:
http://cvs.sourceforge.net/viewcvs.py/freetds/freetds/src/odbc/odbc.c?r1
=1.291&r2=1.292&sortby=date

I don't really understand the problem and I don't think change is
correct...
The only reason SQLDescribeCol should fail with former code is when we
fetched all results, however why SQLDescribeCol should success in this
situation? Peter state that this was caused by a empty rowset with a
numeric but looking at the code and doing some tests do not help
(problem do not occur).
current_statement is used to store current statement, if statement is no
more active it's nosense to still retain old statement. Also issuing
another query on another statement cause current_statement to change so
SQLDescribeCol on first statement fails too.
A better workaround would be to comment these lines in SQLDescribeCol:

	if (stmt->dbc->current_statement != stmt) {
		odbc_errs_add(&stmt->errs, "24000", NULL, NULL);
		ODBC_RETURN(stmt, SQL_ERROR);
	}
	IRD_CHECK;

so SQLDescribeCol return data from IRD without any check.
Naturally it would be better to understand the real problem... why and
when does SQLDescribeCol fail??

freddy77



More information about the FreeTDS mailing list