|
If after SELECT(or catalog function, or SQLGetTypeInfo), application runs smth like UPSERT, and then examines SQLNumResultCols, it will return number of columns in previous resultset. This is what issue#4 from github boils down to.
The testcase:
ODBC_TEST(t_odbc41)
{
SQLSMALLINT cols_count;
OK_SIMPLE_STMT(Stmt, "drop table if exists t_odbc41");
OK_SIMPLE_STMT(Stmt, "SELECT 1, 2, 3, 4");
CHECK_STMT_RC(Stmt, SQLFetch(Stmt));
CHECK_STMT_RC(Stmt, SQLNumResultCols(Stmt, &cols_count));
is_num(cols_count, 4);
CHECK_STMT_RC(Stmt, SQLFreeStmt(Stmt, SQL_CLOSE));
OK_SIMPLE_STMT(Stmt, "CREATE TABLE t_odbc41 (id INT PRIMARY KEY auto_increment)");
CHECK_STMT_RC(Stmt, SQLNumResultCols(Stmt, &cols_count));
is_num(cols_count, 0);
OK_SIMPLE_STMT(Stmt, "drop table if exists t_odbc41");
return OK;
}
|