Hi,
I am trying to find the number of rows in a DB2 table using ODBC
SQLStatistics. Although, the documentation claims that this is
supported, I am getting SQL_ERROR when the data is fetched (simplified
code shown below). When I run it against SQLServer, Access, Excel it
runs fine but not against DB2 and red Brick. Can anyone tell me if
this is a driver bug or am I missing something?
// Allocate a statement handle.
retcode = SQLAllocHandle(SQL_HANDLE_STMT, hdbc1, &hstmt1);
// get stats
retcode = SQLStatistics(hstmt1, NULL, 0, NULL, 0, "xyz", SQL_NTS,
SQL_INDEX_UNIQUE, SQL_QUICK /* SQL_ENSURE */); // tried both ENSURE
and QUICK
// Bind columns
SQLBindCol(hstmt1, 7, SQL_C_SSHORT, &DataType, 0, &cbDataType);
SQLBindCol(hstmt1, 11, SQL_C_SLONG, &Cardinality, 0,&cbCardinality);
// fetch results in a loop
retcode = SQLFetch(hstmt1);
FOR DB2: [IBM][CLI Driver] CLI0110E Invalid output or indicator
buffer specified. SQLSTATE=22002
FOR RedBrick: [Red Brick][ODBC Driver]** ERROR ** (10002) NULL value
in column 11, but no indicator.
TIA,
Niles