summaryrefslogtreecommitdiff
path: root/sql/lex.h
diff options
context:
space:
mode:
authorRucha Deodhar <rucha.deodhar@mariadb.com>2021-07-31 12:55:21 +0530
committerSergei Golubchik <serg@mariadb.org>2021-09-15 08:39:04 +0200
commit1be5520a3be38fd17850e4e908bc3225a145906b (patch)
treebd9bb41ceddd4383b8265bcccb8d1c380aa5fbaf /sql/lex.h
parent8d08971c84036b2c4e508035ad93ad11021abdee (diff)
downloadmariadb-git-preview-10.7-MDEV-10075-insert-error-index.tar.gz
MDEV-10075: Provide index of error causing error in array INSERTpreview-10.7-MDEV-10075-insert-error-index
Extended the parser for GET DIAGNOSTICS to use ERROR_INDEX to get warning/error index. Error information is stored in Sql_condition. So it can be used to store the index of warning/error too. THD::current_insert_index keeps a track of count for each row that is processed or going to be inserted in the table (or first row in case of prepare phase). When an error occurs, first we need to fetch corrected error index (using correct_error_index()) for an error number. This is needed because in prepare phase, the error may not be because of rows/values. In such case, correct value of error_index should be 0. Once correct value if fetched, assign it to Sql_condition::error_index when the object is created during error/warning. This error_index variable is returned when ERROR_INDEX is used in GET DIAGNOSTICS.
Diffstat (limited to 'sql/lex.h')
-rw-r--r--sql/lex.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/lex.h b/sql/lex.h
index 8643197e862..57d8d807909 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -222,6 +222,7 @@ SYMBOL symbols[] = {
{ "ENUM", SYM(ENUM)},
{ "ERROR", SYM(ERROR_SYM)},
{ "ERRORS", SYM(ERRORS)},
+ { "ERROR_INDEX", SYM(ERROR_INDEX_SYM)},
{ "ESCAPE", SYM(ESCAPE_SYM)},
{ "ESCAPED", SYM(ESCAPED)},
{ "EVENT", SYM(EVENT_SYM)},