summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc12
1 files changed, 5 insertions, 7 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index ad324fed4fe..cccb715bd5e 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -634,14 +634,12 @@ bool open_and_lock_for_insert_delayed(THD *thd, TABLE_LIST *table_list)
static int
create_insert_stmt_from_insert_delayed(THD *thd, String *buf)
{
- /* Append the part of thd->query before "DELAYED" keyword */
- if (buf->append(thd->query(),
- thd->lex->keyword_delayed_begin - thd->query()))
+ /* Make a copy of thd->query() and then remove the "DELAYED" keyword */
+ if (buf->append(thd->query()) ||
+ buf->replace(thd->lex->keyword_delayed_begin_offset,
+ thd->lex->keyword_delayed_end_offset -
+ thd->lex->keyword_delayed_begin_offset, 0))
return 1;
- /* Append the part of thd->query after "DELAYED" keyword */
- if (buf->append(thd->lex->keyword_delayed_begin + 7))
- return 1;
-
return 0;
}