=== modified file 'driver/results.c' --- driver/results.c 2010-03-13 18:38:29 +0000 +++ driver/results.c 2010-03-19 20:44:16 +0000 @@ -616,8 +616,10 @@ szToken[n] = '\0'; - if ( strcmp( szToken, "SELECT" ) == 0 || strcmp( szToken, "SHOW" ) == 0 ) - return TRUE; + /* Took from Jess' "ssps rsmd" patch - "CALL" was missing here */ + if (!strcmp(szToken, "SELECT") || !strcmp(szToken, "SHOW") || + !strcmp(szToken, "CALL")) + return TRUE; return FALSE; } @@ -641,8 +643,12 @@ case ST_PREPARED: if ( isStatementForRead( stmt ) ) { + SQLULEN real_max_rows= stmt->stmt_options.max_rows; + stmt->stmt_options.max_rows= 1; + /* select limit will be restored back to max_rows before real execution */ if ( (error= my_SQLExecute(stmt)) == SQL_SUCCESS ) stmt->state= ST_PRE_EXECUTED; /* mark for execute */ + stmt->stmt_options.max_rows= real_max_rows; } else error = SQL_SUCCESS; @@ -1050,7 +1056,7 @@ if (SQL_SUCCEEDED(rc)) set_current_cursor_data(stmt,0); - return rc; + return rc != 0; } === modified file 'test/my_result.c' --- test/my_result.c 2010-03-17 18:47:45 +0000 +++ test/my_result.c 2010-03-19 21:19:05 +0000 @@ -399,6 +399,7 @@ { SQLRETURN rc; SQLUINTEGER i; + SQLSMALLINT cc; ok_sql(hstmt, "DROP TABLE IF EXISTS t_max_rows"); @@ -467,6 +468,27 @@ SQLFreeStmt(hstmt,SQL_CLOSE); + /* Patch for Bug#46411 uses SQL_ATTR_MAX_ROWS attribute to minimize number of + rows to pre-fetch(sets to 1). Following fragment ensures that it attribute + value preserved and works. */ + rc = SQLSetStmtAttr(hstmt,SQL_ATTR_MAX_ROWS,(SQLPOINTER)3,0); + mystmt(hstmt,rc); + + rc = tmysql_prepare(hstmt,"select * from t_max_rows where id > ?"); + mystmt(hstmt,rc); + rc = SQLBindParameter(hstmt,1,SQL_PARAM_INPUT,SQL_C_ULONG,SQL_INTEGER,0,0,&i,0,NULL); + mystmt(hstmt,rc); + i= 6; + + ok_stmt(hstmt, SQLNumResultCols(hstmt, &cc)); + + rc = SQLExecute(hstmt); + mystmt(hstmt,rc); + + myassert( 3 == myrowcount(hstmt)); + + SQLFreeStmt(hstmt,SQL_CLOSE); + rc = SQLSetStmtAttr(hstmt,SQL_ATTR_MAX_ROWS,(SQLPOINTER)0,0); mystmt(hstmt,rc);