From 0f64a6222edc0d0ded4e1b48fa428f8a7b44e67e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Nov 2005 14:57:26 -0800 Subject: Fix result of ROW_COUNT() after 'EXECUTE prepstmt'. (Bug #14956) mysql-test/r/ps.result: Add new results mysql-test/t/ps.test: Add new test sql/sql_parse.cc: Don't reset row_count after processing EXECUTE statement. --- sql/sql_parse.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'sql/sql_parse.cc') diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index c19d54feda5..4f45451ddc4 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4822,11 +4822,15 @@ end_with_restore_list: /* - The return value for ROW_COUNT() is "implementation dependent" if - the statement is not DELETE, INSERT or UPDATE (or a CALL executing - such a statement), but -1 is what JDBC and ODBC wants. + The return value for ROW_COUNT() is "implementation dependent" if the + statement is not DELETE, INSERT or UPDATE, but -1 is what JDBC and ODBC + wants. + + We do not change the value for a CALL or EXECUTE statement, so the value + generated by the last called (or executed) statement is preserved. */ - if (lex->sql_command != SQLCOM_CALL && uc_update_queries[lex->sql_command]<2) + if (lex->sql_command != SQLCOM_CALL && lex->sql_command != SQLCOM_EXECUTE && + uc_update_queries[lex->sql_command]<2) thd->row_count_func= -1; goto cleanup; -- cgit v1.2.1