=== modified file 'driver/utility.c' --- driver/utility.c 2009-08-12 04:56:20 +0000 +++ driver/utility.c 2009-10-12 15:27:46 +0000 @@ -2053,6 +2053,7 @@ my_free(dbc->database,MYF(0)); if ( odbc_stmt(dbc, "select database()") ) { + dbc->database= NULL; return 1; } else === modified file 'test/my_desc.c' --- test/my_desc.c 2009-06-16 10:29:02 +0000 +++ test/my_desc.c 2009-08-31 19:30:44 +0000 @@ -311,7 +311,6 @@ { SQLHANDLE desc1, desc2; SQLHANDLE expapd; - SQLHANDLE hdbc2; SQLHANDLE hstmt2; /* TODO using an exp from a different dbc */ @@ -380,7 +379,7 @@ DECLARE_TEST(t_mult_stmt_free) { #define mult_count 3 - SQLHANDLE expard, expapd, desc; + SQLHANDLE expard, expapd; SQLHANDLE stmt[mult_count]; SQLINTEGER i; SQLINTEGER imp_params[mult_count]; === modified file 'test/my_info.c' --- test/my_info.c 2008-10-24 19:24:30 +0000 +++ test/my_info.c 2009-10-12 14:02:07 +0000 @@ -352,6 +352,46 @@ } +/* +Bug#46910 +MyODBC 5 - calling SQLGetConnectAttr before getting all results of "CALL ..." statement +*/ +DECLARE_TEST(t_bug46910) +{ + SQLCHAR catalog[30]; + SQLINTEGER len, i; + + SQLCHAR * initStmt[]= {"DROP PROCEDURE IF EXISTS `spbug46910_1`", + "CREATE PROCEDURE `spbug46910_1`()\ + BEGIN\ + SELECT 1 AS ret;\ + END"}; + + SQLCHAR * clenUpStmt= "DROP PROCEDURE IF EXISTS `spbug46910_1`;"; + + for (i= 0; i < 2; ++i) + ok_stmt(hstmt, SQLExecDirect(hstmt, initStmt[i], SQL_NTS)); + + SQLExecDirect(hstmt, "CALL spbug46910_1()", SQL_NTS); + /* + SQLRowCount(hstmt, &i); + SQLNumResultCols(hstmt, &i);*/ + + SQLGetConnectAttr(hdbc, SQL_ATTR_CURRENT_CATALOG, catalog, + sizeof(catalog), &len); + //is_num(len, 4); + //is_str(catalog, "test", 4); + + /*ok_con(hdbc, */ + SQLGetConnectAttr(hdbc, SQL_ATTR_CURRENT_CATALOG, catalog, + sizeof(catalog), &len); + + ok_stmt(hstmt, SQLExecDirect(hstmt, clenUpStmt, SQL_NTS)); + + return OK; +} + + BEGIN_TESTS ADD_TEST(sqlgetinfo) ADD_TEST(t_gettypeinfo) @@ -363,6 +403,7 @@ ADD_TEST(t_bug3780) ADD_TEST(t_bug16653) ADD_TEST(t_bug30626) + ADD_TEST(t_bug46910) END_TESTS === modified file 'test/my_result.c' --- test/my_result.c 2009-10-07 20:43:23 +0000 +++ test/my_result.c 2009-10-12 11:20:26 +0000 @@ -2332,7 +2332,7 @@ { SQLCHAR buff[10]; SQLLEN len= 0; - SQLSMALLINT namelen, type, digits, nullable; + ok_stmt(hstmt, SQLPrepare(hstmt, (SQLCHAR *) "SELECT ?", SQL_NTS)); strcpy((char *)buff, "2.0"); @@ -2375,7 +2375,6 @@ SQLULEN count; UWORD status; SQLULEN colSize; - SQLRETURN rc; ok_sql(hstmt, "drop table if exists bug24131"); === modified file 'test/odbctap.h' --- test/odbctap.h 2009-01-14 21:47:51 +0000 +++ test/odbctap.h 2009-10-12 07:46:12 +0000 @@ -1094,8 +1094,9 @@ */ int using_unixodbc_version(SQLHANDLE henv, SQLCHAR *ver) { + +#ifdef SQL_ATTR_UNIXODBC_VERSION SQLCHAR buf[10]; -#ifdef SQL_ATTR_UNIXODBC_VERSION if(SQLGetEnvAttr(henv, SQL_ATTR_UNIXODBC_VERSION, buf, 10, NULL) != SQL_SUCCESS) return 0; if(!strcmp(buf, ver))