summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-11-23 14:57:26 -0800
committerunknown <jimw@mysql.com>2005-11-23 14:57:26 -0800
commit0f64a6222edc0d0ded4e1b48fa428f8a7b44e67e (patch)
treea146f224908f931694d1c5b5ff20bd074f91bf5c /sql/sql_parse.cc
parentd9c7aaf23ff30675682775864c269bde84a3bc03 (diff)
downloadmariadb-git-0f64a6222edc0d0ded4e1b48fa428f8a7b44e67e.tar.gz
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.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc12
1 files changed, 8 insertions, 4 deletions
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;