summaryrefslogtreecommitdiff
path: root/sql/parse_file.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2005-07-28 22:39:11 +0300
committerunknown <bell@sanja.is.com.ua>2005-07-28 22:39:11 +0300
commita66928bb24d3f543593d092c085b915459ca5c88 (patch)
treee93bc8d2975b833cb357ca7658f47ed7c4100ac2 /sql/parse_file.cc
parent482cf550f9cb1bf060aba73ef64d85edee791118 (diff)
downloadmariadb-git-a66928bb24d3f543593d092c085b915459ca5c88.tar.gz
store/restore sql_mode which was in force during ctrigger creation (BUG#5891)
other sql_mode fixes mysql-test/r/information_schema.result: changes in information schema mysql-test/r/trigger.result: storing and restoring sql modes for triggers mysql-test/t/trigger.test: storing and restoring parsing modes for triggers sql/mysqld.cc: add length of mode names sql/parse_file.cc: new type of list (ulonglong) sql/parse_file.h: new type of list (ulonglong) sql/set_var.cc: mode output made as static method sql/set_var.h: mode output made as static method sql/sp_head.cc: added sql_mode storing/restoring during SP execution optimised sql_mode printing sql/sp_head.h: comment fixed according this changes sql/sql_show.cc: added sql_mode field sql/sql_trigger.cc: store/restore sql_mode which was in force during ctrigger creation sql/sql_trigger.h: store/restore sql_mode which was in force during ctrigger creation sql/sql_view.cc: fixed sql_mode
Diffstat (limited to 'sql/parse_file.cc')
-rw-r--r--sql/parse_file.cc68
1 files changed, 64 insertions, 4 deletions
diff --git a/sql/parse_file.cc b/sql/parse_file.cc
index abca8736916..82ce2f2d7b5 100644
--- a/sql/parse_file.cc
+++ b/sql/parse_file.cc
@@ -166,6 +166,25 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter,
}
break;
}
+ case FILE_OPTIONS_ULLLIST:
+ {
+ List_iterator_fast<ulonglong> it(*((List<ulonglong>*)
+ (base + parameter->offset)));
+ bool first= 1;
+ ulonglong *val;
+ while ((val= it++))
+ {
+ num.set(*val, &my_charset_bin);
+ // We need ' ' after string to detect list continuation
+ if ((!first && my_b_append(file, (const byte *)" ", 1)) ||
+ my_b_append(file, (const byte *)num.ptr(), num.length()))
+ {
+ DBUG_RETURN(TRUE);
+ }
+ first= 0;
+ }
+ break;
+ }
default:
DBUG_ASSERT(0); // never should happened
}
@@ -615,6 +634,8 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
char *eol;
LEX_STRING *str;
List<LEX_STRING> *list;
+ ulonglong *num;
+ List<ulonglong> *nlist;
DBUG_ENTER("File_parser::parse");
while (ptr < end && found < required)
@@ -719,7 +740,7 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
case FILE_OPTIONS_STRLIST:
{
list= (List<LEX_STRING>*)(base + parameter->offset);
-
+
list->empty();
// list parsing
while (ptr < end)
@@ -741,17 +762,56 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
goto list_err_w_message;
}
}
- end_of_list:
+
+end_of_list:
if (*(ptr++) != '\n')
goto list_err;
break;
- list_err_w_message:
+list_err_w_message:
my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
parameter->name.str, line);
- list_err:
+list_err:
DBUG_RETURN(TRUE);
}
+ case FILE_OPTIONS_ULLLIST:
+ {
+ nlist= (List<ulonglong>*)(base + parameter->offset);
+ nlist->empty();
+ // list parsing
+ while (ptr < end)
+ {
+ int not_used;
+ char *num_end= end;
+ if (!(num= (ulonglong*)alloc_root(mem_root, sizeof(ulonglong))) ||
+ nlist->push_back(num, mem_root))
+ goto nlist_err;
+ *num= my_strtoll10(ptr, &num_end, &not_used);
+ ptr= num_end;
+ switch (*ptr) {
+ case '\n':
+ goto end_of_nlist;
+ case ' ':
+ // we cant go over buffer bounds, because we have \0 at the end
+ ptr++;
+ break;
+ default:
+ goto nlist_err_w_message;
+ }
+ }
+
+end_of_nlist:
+ if (*(ptr++) != '\n')
+ goto nlist_err;
+ break;
+
+nlist_err_w_message:
+ my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
+ parameter->name.str, line);
+nlist_err:
+ DBUG_RETURN(TRUE);
+
+ }
default:
DBUG_ASSERT(0); // never should happened
}