summaryrefslogtreecommitdiff
path: root/sql/sql_error.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2021-07-16 22:12:09 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2021-07-16 22:12:09 +0200
commite7f4daf88c4348bb018d04d298b104617554f310 (patch)
tree8cb54b53e75db7fa848ad93c4a3640736116c97e /sql/sql_error.cc
parent461cac890170c8a903972d4c8e6f4576cf8558e6 (diff)
parentfc2ec25733c6f1a305bf14df960ee7a02b48ef2c (diff)
downloadmariadb-git-e7f4daf88c4348bb018d04d298b104617554f310.tar.gz
merge 10.5 to 10.6
Diffstat (limited to 'sql/sql_error.cc')
-rw-r--r--sql/sql_error.cc22
1 files changed, 17 insertions, 5 deletions
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index bb47502b3ce..cef9e6cec00 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -371,7 +371,7 @@ Diagnostics_area::set_eof_status(THD *thd)
{
DBUG_ENTER("set_eof_status");
/* Only allowed to report eof if has not yet reported an error */
- DBUG_ASSERT(! is_set());
+ DBUG_ASSERT(!is_set() || (m_status == DA_EOF_BULK && is_bulk_op()));
/*
In production, refuse to overwrite an error or a custom response
with an EOF packet.
@@ -384,11 +384,23 @@ Diagnostics_area::set_eof_status(THD *thd)
number of warnings, since they are not available to the client
anyway.
*/
- m_statement_warn_count= (thd->spcont ?
- 0 :
- current_statement_warn_count());
+ if (m_status == DA_EOF_BULK)
+ {
+ if (!thd->spcont)
+ m_statement_warn_count+= current_statement_warn_count();
+ }
+ else
+ {
+ if (thd->spcont)
+ {
+ m_statement_warn_count= 0;
+ m_affected_rows= 0;
+ }
+ else
+ m_statement_warn_count= current_statement_warn_count();
+ m_status= (is_bulk_op() ? DA_EOF_BULK : DA_EOF);
+ }
- m_status= DA_EOF;
DBUG_VOID_RETURN;
}