[ODBC-41] Column count stays from previous query for queries not returning resultset Created: 2016-05-28  Updated: 2016-06-06  Resolved: 2016-06-06

Status: Closed
Project: MariaDB Connector/ODBC
Component/s: None
Affects Version/s: 2.0.10
Fix Version/s: 2.0.11

Type: Bug Priority: Major
Reporter: Lawrin Novitsky Assignee: Lawrin Novitsky
Resolution: Fixed Votes: 0
Labels: None


 Description   

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; }

 Comments   
Comment by Lawrin Novitsky [ 2016-06-06 ]

The fix and testcase have been pushed as revision c301508a9d

Generated at Thu Feb 08 03:25:48 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.