Skip to Content.
Sympa Menu

freetds - [freetds] bug in odbc driver (SQLNumResultCols) ??

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Nilesh Dhawale <ndhawale AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: [freetds] bug in odbc driver (SQLNumResultCols) ??
  • Date: Thu, 14 Oct 2004 18:03:33 -0400

It seems like SQLNumResultCols is not working right in the freeTDS
ODBC driver. I am on Solaris. The function returns 0 for the number of
columns in a table which has some columns. Return code is SQL_SUCCESS.
This happens if the statement is only "prepared", not "executed". I
tried on 6 different databases on windows and DB2 driver on AIX and
they all seem to work fine without having to "execute"! I am using
freetds-0.62.4 odbc driver. Is this a known issue?
A complete test program is attached. Here is a code snippet that shows
the problem.

/* Prepare the SQL statement */
retcode = SQLPrepare(hstmt1, "select * from MYTBL", SQL_NTS);
checkStatus(retcode, "SQLPrepare", SQL_HANDLE_STMT, hstmt1, 0);
/*
// WITHOUT THIS EXECUTE, SQLNumResultCols does not return
// THE CORRECT NUMBER OF COLS; MOREOVER THE RETURN
// CODE FROM SQLNumResultCols indicates success
// execute
retcode = SQLExecute(hstmt1);
printf("SQLExecute RET CODE : %d\n", retcode);
checkStatus(retcode, "SQLExecute", SQL_HANDLE_STMT, hstmt1, 0);
*/
retcode = SQLNumResultCols(hstmt1, &numberOfColumns);
checkStatus(retcode, "SQLNumResultCols", SQL_HANDLE_STMT, hstmt1, 0);
printf("numberOfColumns: %d\n", numberOfColumns);
printf("RET VALUE: %d\n", retcode);

Rgds,
Nilesh
--
Nilesh Dhawale
http://www.cs.albany.edu/~nilesh
--




Archive powered by MHonArc 2.6.24.

Top of Page