#include "odbctap.h" DECLARE_TEST(t_bug32420) { HDBC hdbc1; HSTMT hstmt1; SQLINTEGER nData[4]; SQLCHAR szData[4][16]; SQLUSMALLINT rgfRowStatus[4]; SQLCHAR conn[256], conn_out[256]; SQLSMALLINT conn_out_len; sprintf((char *)conn, "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;" \ "UID=%s;PASSWORD=%s;DATABASE=test;OPTION=1048576", myuid, mypwd); if (mysock != NULL) { strcat((char *)conn, ";SOCKET="); strcat((char *)conn, (char *)mysock); } ok_env(henv, SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc1)); ok_con(hdbc1, SQLDriverConnect(hdbc1, NULL, conn, sizeof(conn), conn_out, sizeof(conn_out), &conn_out_len, SQL_DRIVER_NOPROMPT)); ok_con(hdbc1, SQLAllocStmt(hdbc1, &hstmt1)); ok_sql(hstmt1, "drop table if exists bug32420"); ok_sql(hstmt1, "CREATE TABLE bug32420 ("\ "tt_int INT PRIMARY KEY auto_increment,"\ "tt_varchar VARCHAR(128) NOT NULL)"); ok_sql(hstmt1, "INSERT INTO bug32420 VALUES "\ "(100, 'string 1'),"\ "(200, 'string 2'),"\ "(300, 'string 3'),"\ "(400, 'string 4')"); ok_stmt(hstmt1, SQLFreeStmt(hstmt1, SQL_CLOSE)); ok_stmt(hstmt1, SQLSetStmtOption(hstmt1, SQL_ROWSET_SIZE, 4)); ok_sql(hstmt1, "select * from bug32420"); ok_stmt(hstmt1, SQLBindCol(hstmt1, 1, SQL_C_LONG, nData, 0, NULL)); ok_stmt(hstmt1, SQLBindCol(hstmt1, 2, SQL_C_CHAR, szData, sizeof(szData[0]), NULL)); ok_stmt(hstmt1, SQLExtendedFetch(hstmt1, SQL_FETCH_NEXT, 0, NULL, rgfRowStatus)); is_num(nData[0], 100); is_str(szData[0], "string 1", 8); is_num(nData[1], 200); is_str(szData[1], "string 2", 8); is_num(nData[2], 300); is_str(szData[2], "string 3", 8); is_num(nData[3], 400); is_str(szData[3], "string 4", 8); ok_stmt(hstmt1, SQLFreeStmt(hstmt1, SQL_CLOSE)); ok_sql(hstmt1, "drop table if exists bug32420"); ok_stmt(hstmt1, SQLFreeStmt(hstmt1, SQL_DROP)); ok_con(hdbc1, SQLDisconnect(hdbc1)); ok_con(hdbc1, SQLFreeHandle(SQL_HANDLE_DBC, hdbc1)); return OK; } BEGIN_TESTS ADD_TEST(t_bug32420) END_TESTSRUN_TESTS