mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Manual merge.
This commit is contained in:
@ -5353,12 +5353,11 @@ void mysql_parse(THD *thd, const char *inBuf, uint length,
|
||||
sp_cache_flush_obsolete(&thd->sp_func_cache);
|
||||
|
||||
Lex_input_stream lip(thd, inBuf, length);
|
||||
thd->m_lip= &lip;
|
||||
|
||||
int err= MYSQLparse(thd);
|
||||
bool err= parse_sql(thd, &lip);
|
||||
*found_semicolon= lip.found_semicolon;
|
||||
|
||||
if (!err && ! thd->is_fatal_error)
|
||||
if (!err)
|
||||
{
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
if (mqh_used && thd->user_connect &&
|
||||
@ -5381,8 +5380,8 @@ void mysql_parse(THD *thd, const char *inBuf, uint length,
|
||||
PROCESSLIST.
|
||||
Note that we don't need LOCK_thread_count to modify query_length.
|
||||
*/
|
||||
if (lip.found_semicolon &&
|
||||
(thd->query_length= (ulong)(lip.found_semicolon - thd->query)))
|
||||
if (*found_semicolon &&
|
||||
(thd->query_length= (ulong)(*found_semicolon - thd->query)))
|
||||
thd->query_length--;
|
||||
/* Actually execute the query */
|
||||
mysql_execute_command(thd);
|
||||
@ -5436,12 +5435,10 @@ bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length)
|
||||
DBUG_ENTER("mysql_test_parse_for_slave");
|
||||
|
||||
Lex_input_stream lip(thd, inBuf, length);
|
||||
thd->m_lip= &lip;
|
||||
lex_start(thd);
|
||||
mysql_reset_thd_for_next_command(thd);
|
||||
int err= MYSQLparse((void*) thd);
|
||||
|
||||
if (!err && ! thd->is_fatal_error &&
|
||||
if (!parse_sql(thd, &lip) &&
|
||||
all_tables_not_ok(thd,(TABLE_LIST*) lex->select_lex.table_list.first))
|
||||
error= 1; /* Ignore question */
|
||||
thd->end_statement();
|
||||
@ -5466,7 +5463,7 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type,
|
||||
List<String> *interval_list, CHARSET_INFO *cs,
|
||||
uint uint_geom_type)
|
||||
{
|
||||
register create_field *new_field;
|
||||
register Create_field *new_field;
|
||||
LEX *lex= thd->lex;
|
||||
DBUG_ENTER("add_field_to_list");
|
||||
|
||||
@ -5479,7 +5476,7 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type,
|
||||
if (type_modifier & PRI_KEY_FLAG)
|
||||
{
|
||||
Key *key;
|
||||
lex->col_list.push_back(new key_part_spec(field_name->str, 0));
|
||||
lex->col_list.push_back(new Key_part_spec(field_name->str, 0));
|
||||
key= new Key(Key::PRIMARY, NullS,
|
||||
&default_key_create_info,
|
||||
0, lex->col_list);
|
||||
@ -5489,7 +5486,7 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type,
|
||||
if (type_modifier & (UNIQUE_FLAG | UNIQUE_KEY_FLAG))
|
||||
{
|
||||
Key *key;
|
||||
lex->col_list.push_back(new key_part_spec(field_name->str, 0));
|
||||
lex->col_list.push_back(new Key_part_spec(field_name->str, 0));
|
||||
key= new Key(Key::UNIQUE, NullS,
|
||||
&default_key_create_info, 0,
|
||||
lex->col_list);
|
||||
@ -5547,7 +5544,7 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type,
|
||||
WARN_DEPRECATED(thd, "5.2", buf, "'TIMESTAMP'");
|
||||
}
|
||||
|
||||
if (!(new_field= new create_field()) ||
|
||||
if (!(new_field= new Create_field()) ||
|
||||
new_field->init(thd, field_name->str, type, length, decimals, type_modifier,
|
||||
default_value, on_update_value, comment, change,
|
||||
interval_list, cs, uint_geom_type))
|
||||
@ -7133,3 +7130,34 @@ bool check_string_char_length(LEX_STRING *str, const char *err_msg,
|
||||
my_error(ER_WRONG_STRING_LENGTH, MYF(0), str->str, err_msg, max_char_length);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
extern int MYSQLparse(void *thd); // from sql_yacc.cc
|
||||
|
||||
|
||||
/**
|
||||
This is a wrapper of MYSQLparse(). All the code should call parse_sql()
|
||||
instead of MYSQLparse().
|
||||
|
||||
@param thd Thread context.
|
||||
@param lip Lexer context.
|
||||
|
||||
@return Error status.
|
||||
@retval FALSE on success.
|
||||
@retval TRUE on parsing error.
|
||||
*/
|
||||
|
||||
bool parse_sql(THD *thd, Lex_input_stream *lip)
|
||||
{
|
||||
bool err_status;
|
||||
|
||||
DBUG_ASSERT(thd->m_lip == NULL);
|
||||
|
||||
thd->m_lip= lip;
|
||||
|
||||
err_status= MYSQLparse(thd) != 0 || thd->is_fatal_error;
|
||||
|
||||
thd->m_lip= NULL;
|
||||
|
||||
return err_status;
|
||||
}
|
||||
|
Reference in New Issue
Block a user