diff options
author | Alexander Nozdrin <alik@sun.com> | 2010-05-14 09:28:51 +0400 |
---|---|---|
committer | Alexander Nozdrin <alik@sun.com> | 2010-05-14 09:28:51 +0400 |
commit | 4333980a493e7062e108899b34cc809b03862c34 (patch) | |
tree | f19fd6d634984242eb5cb0583cf805e7ec43ebc9 /sql/sql_signal.cc | |
parent | f9101d98b73f8353bc1de0959c6a1a35a91a9f7b (diff) | |
download | mariadb-git-4333980a493e7062e108899b34cc809b03862c34.tar.gz |
Patch for Bug#21818 (Return value of ROW_COUNT() is incorrect
for ALTER TABLE, LOAD DATA).
ROW_COUNT is now assigned according to the following rules:
- In my_ok():
- for DML statements: to the number of affected rows;
- for DDL statements: to 0.
- In my_eof(): to -1 to indicate that there was a result set.
We derive this semantics from the JDBC specification, where int
java.sql.Statement.getUpdateCount() is defined to (sic) "return the
current result as an update count; if the result is a ResultSet
object or there are no more results, -1 is returned".
- In my_error(): to -1 to be compatible with the MySQL C API and
MySQL ODBC driver.
- For SIGNAL statements: to 0 per WL#2110 specification. Zero is used
since that's the "default" value of ROW_COUNT in the diagnostics area.
sql/protocol.cc:
Fix a typo.
sql/sql_class.h:
- Introduce THD::get_row_count_func() / THD::set_row_count_func();
- Remove the CF_HAS_ROW_COUNT define
sql/sql_parse.cc:
CF_HAS_ROW_COUNT was eliminated.
Diffstat (limited to 'sql/sql_signal.cc')
-rw-r--r-- | sql/sql_signal.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/sql_signal.cc b/sql/sql_signal.cc index 8ae77f3645b..8ba9cb369aa 100644 --- a/sql/sql_signal.cc +++ b/sql/sql_signal.cc @@ -458,8 +458,20 @@ bool Signal_statement::execute(THD *thd) DBUG_ENTER("Signal_statement::execute"); + /* + WL#2110 SIGNAL specification says: + + When SIGNAL is executed, it has five effects, in the following order: + + (1) First, the diagnostics area is completely cleared. So if the + SIGNAL is in a DECLARE HANDLER then any pending errors or warnings + are gone. So is 'row count'. + + This has roots in the SQL standard specification for SIGNAL. + */ + thd->stmt_da->reset_diagnostics_area(); - thd->row_count_func= 0; + thd->set_row_count_func(0); thd->warning_info->clear_warning_info(thd->query_id); result= raise_condition(thd, &cond); |