mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
upmerge 43005,48888,49837,49878,50471
This commit is contained in:
@ -134,6 +134,7 @@ struct st_block
|
||||
int line; /* Start line of block */
|
||||
my_bool ok; /* Should block be executed */
|
||||
enum block_cmd cmd; /* Command owning the block */
|
||||
char delim[MAX_DELIMITER_LENGTH]; /* Delimiter before block */
|
||||
};
|
||||
|
||||
static struct st_block block_stack[32];
|
||||
@ -2650,6 +2651,10 @@ void do_exec(struct st_command *command)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* exec command is interpreted externally and will not take newlines */
|
||||
while(replace(&ds_cmd, "\n", 1, " ", 1) == 0)
|
||||
;
|
||||
|
||||
DBUG_PRINT("info", ("Executing '%s' as '%s'",
|
||||
command->first_argument, ds_cmd.str));
|
||||
|
||||
@ -5109,6 +5114,12 @@ int do_done(struct st_command *command)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*cur_block->delim)
|
||||
{
|
||||
/* Restore "old" delimiter after false if block */
|
||||
strcpy (delimiter, cur_block->delim);
|
||||
delimiter_length= strlen(delimiter);
|
||||
}
|
||||
/* Pop block from stack, goto next line */
|
||||
cur_block--;
|
||||
parser.current_line++;
|
||||
@ -5167,6 +5178,7 @@ void do_block(enum block_cmd cmd, struct st_command* command)
|
||||
cur_block++;
|
||||
cur_block->cmd= cmd;
|
||||
cur_block->ok= FALSE;
|
||||
cur_block->delim[0]= '\0';
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@ -5203,6 +5215,15 @@ void do_block(enum block_cmd cmd, struct st_command* command)
|
||||
if (not_expr)
|
||||
cur_block->ok = !cur_block->ok;
|
||||
|
||||
if (cur_block->ok)
|
||||
{
|
||||
cur_block->delim[0]= '\0';
|
||||
} else
|
||||
{
|
||||
/* Remember "old" delimiter if entering a false if block */
|
||||
strcpy (cur_block->delim, delimiter);
|
||||
}
|
||||
|
||||
DBUG_PRINT("info", ("OK: %d", cur_block->ok));
|
||||
|
||||
var_free(&v);
|
||||
@ -7629,7 +7650,14 @@ int main(int argc, char **argv)
|
||||
1024, 0, 0, get_var_key, var_free, MYF(0)))
|
||||
die("Variable hash initialization failed");
|
||||
|
||||
var_set_string("$MYSQL_SERVER_VERSION", MYSQL_SERVER_VERSION);
|
||||
var_set_string("MYSQL_SERVER_VERSION", MYSQL_SERVER_VERSION);
|
||||
var_set_string("MYSQL_SYSTEM_TYPE", SYSTEM_TYPE);
|
||||
var_set_string("MYSQL_MACHINE_TYPE", MACHINE_TYPE);
|
||||
if (sizeof(void *) == 8) {
|
||||
var_set_string("MYSQL_SYSTEM_ARCHITECTURE", "64");
|
||||
} else {
|
||||
var_set_string("MYSQL_SYSTEM_ARCHITECTURE", "32");
|
||||
}
|
||||
|
||||
memset(&master_pos, 0, sizeof(master_pos));
|
||||
|
||||
@ -7759,7 +7787,8 @@ int main(int argc, char **argv)
|
||||
command->type= Q_COMMENT;
|
||||
}
|
||||
|
||||
my_bool ok_to_do= cur_block->ok;
|
||||
/* delimiter needs to be executed so we can continue to parse */
|
||||
my_bool ok_to_do= cur_block->ok || command->type == Q_DELIMITER;
|
||||
/*
|
||||
Some commands need to be "done" the first time if they may get
|
||||
re-iterated over in a true context. This can only happen if there's
|
||||
@ -9417,7 +9446,7 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
|
||||
if (pa->length+length >= pa->max_length)
|
||||
{
|
||||
if (!(new_pos= (uchar*) my_realloc((uchar*) pa->str,
|
||||
(uint) (pa->max_length+PS_MALLOC),
|
||||
(uint) (pa->length+length+PS_MALLOC),
|
||||
MYF(MY_WME))))
|
||||
DBUG_RETURN(1);
|
||||
if (new_pos != pa->str)
|
||||
@ -9428,7 +9457,7 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
|
||||
char*);
|
||||
pa->str=new_pos;
|
||||
}
|
||||
pa->max_length+=PS_MALLOC;
|
||||
pa->max_length= pa->length+length+PS_MALLOC;
|
||||
}
|
||||
if (pa->typelib.count >= pa->max_count-1)
|
||||
{
|
||||
|
Reference in New Issue
Block a user