#include "mytest3.h" /* MyODBC 3.51 sample utility header */ #define NAME_LEN 50 #define PHONE_LEN 50 void bug16300(SQLHSTMT hstmt) { SQLINTEGER param; SQLINTEGER j=500; SQLINTEGER i, count; SQLRETURN retcode; retcode = SQLPrepare(hstmt, "SELECT id from test.bug16300 WHERE id = ?", SQL_NTS); if (retcode == SQL_SUCCESS) { SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &j, 0, &j); param = 5; retcode = SQLExecute(hstmt); } } void createEnvironment(SQLHSTMT hstmt) { SQLExecDirect(hstmt, "DROP TABLE IF EXISTS test.bug16300", SQL_NTS); SQLExecDirect(hstmt, "CREATE TABLE test.bug16300(id int)", SQL_NTS); SQLExecDirect(hstmt, "INSERT INTO test.bug16300 VALUES (1), (2), (3), (4), (5), (6), (7)", SQL_NTS); } void cleanEnvironment(SQLHSTMT hstmt) { SQLExecDirect(hstmt, "DROP TABLE test.bug16300", SQL_NTS); } int main(int argc, char *argv[]) { SQLHENV henv; SQLHDBC hdbc; SQLHSTMT hstmt; SQLINTEGER narg; printMessageHeader(); /* * if connection string supplied through arguments, overrite * the default one.. */ for (narg = 1; narg < argc; narg++) { if ( narg == 1 ) mydsn = argv[1]; else if ( narg == 2 ) myuid = argv[2]; else if ( narg == 3 ) mypwd = argv[3]; } /* * connect to MySQL server */ myconnect(&henv,&hdbc,&hstmt); createEnvironment(hstmt); bug16300(hstmt); cleanEnvironment(hstmt); printMessageFooter(1); return(0); //cl -I../include -I. /G5 -DWINDOWS -DWIN32 -o3 /nologo bug16300.c C:\WINDOWS\system32\myodbc3.lib -obug16300.exe }