This commit is contained in:
Leonard Zhou 2009-03-27 11:19:48 +08:00
commit f606cfeae3
196 changed files with 3593 additions and 2246 deletions

View File

@ -29,5 +29,5 @@ typedef struct st_line_buffer
extern LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file);
extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, my_string str);
extern char *batch_readline(LINE_BUFFER *buffer);
extern char *batch_readline(LINE_BUFFER *buffer, bool *truncated);
extern void batch_readline_end(LINE_BUFFER *buffer);

View File

@ -112,6 +112,8 @@ extern "C" {
#define PROMPT_CHAR '\\'
#define DEFAULT_DELIMITER ";"
#define MAX_BATCH_BUFFER_SIZE (1024L * 1024L)
typedef struct st_status
{
int exit_status;
@ -1035,7 +1037,7 @@ static void fix_history(String *final_command);
static COMMANDS *find_command(char *name,char cmd_name);
static bool add_line(String &buffer,char *line,char *in_string,
bool *ml_comment);
bool *ml_comment, bool truncated);
static void remove_cntrl(String &buffer);
static void print_table_data(MYSQL_RES *result);
static void print_table_data_html(MYSQL_RES *result);
@ -1117,7 +1119,7 @@ int main(int argc,char *argv[])
exit(1);
}
if (status.batch && !status.line_buff &&
!(status.line_buff=batch_readline_init(opt_max_allowed_packet+512,stdin)))
!(status.line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, stdin)))
{
free_defaults(defaults_argv);
my_end(0);
@ -1197,7 +1199,7 @@ int main(int argc,char *argv[])
#endif
sprintf(buff, "%s",
#ifndef NOT_YET
"Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n");
"Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n");
#else
"Type 'help [[%]function name[%]]' to get help on usage of function.\n");
#endif
@ -1226,7 +1228,7 @@ sig_handler mysql_sigint(int sig)
goto err;
/* kill_buffer is always big enough because max length of %lu is 15 */
sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql));
mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer));
mysql_real_query(kill_mysql, kill_buffer, (uint) strlen(kill_buffer));
mysql_close(kill_mysql);
tee_fprintf(stdout, "Query aborted by Ctrl+C\n");
@ -1766,13 +1768,14 @@ static int read_and_execute(bool interactive)
ulong line_number=0;
bool ml_comment= 0;
COMMANDS *com;
bool truncated= 0;
status.exit_status=1;
for (;;)
{
if (!interactive)
{
line=batch_readline(status.line_buff);
line=batch_readline(status.line_buff, &truncated);
/*
Skip UTF8 Byte Order Marker (BOM) 0xEFBBBF.
Editors like "notepad" put this marker in
@ -1891,7 +1894,7 @@ static int read_and_execute(bool interactive)
#endif
continue;
}
if (add_line(glob_buffer,line,&in_string,&ml_comment))
if (add_line(glob_buffer,line,&in_string,&ml_comment, truncated))
break;
}
/* if in batch mode, send last query even if it doesn't end with \g or go */
@ -1977,7 +1980,7 @@ static COMMANDS *find_command(char *name,char cmd_char)
static bool add_line(String &buffer,char *line,char *in_string,
bool *ml_comment)
bool *ml_comment, bool truncated)
{
uchar inchar;
char buff[80], *pos, *out;
@ -2224,9 +2227,10 @@ static bool add_line(String &buffer,char *line,char *in_string,
{
uint length=(uint) (out-line);
if (length < 9 ||
if (!truncated &&
(length < 9 ||
my_strnncoll (charset_info,
(uchar *)line, 9, (const uchar *) "delimiter", 9))
(uchar *)line, 9, (const uchar *) "delimiter", 9)))
{
/*
Don't add a new line in case there's a DELIMITER command to be
@ -2639,7 +2643,7 @@ static void get_current_db()
(res= mysql_use_result(&mysql)))
{
MYSQL_ROW row= mysql_fetch_row(res);
if (row[0])
if (row && row[0])
current_db= my_strdup(row[0], MYF(MY_WME));
mysql_free_result(res);
}
@ -3463,7 +3467,7 @@ static void print_warnings()
/* Get the warnings */
query= "show warnings";
mysql_real_query_for_lazy(query, strlen(query));
mysql_real_query_for_lazy(query, (uint) strlen(query));
mysql_store_result_for_lazy(&result);
/* Bail out when no warnings */
@ -3886,7 +3890,7 @@ static int com_source(String *buffer, char *line)
return put_info(buff, INFO_ERROR, 0);
}
if (!(line_buff=batch_readline_init(opt_max_allowed_packet+512,sql_file)))
if (!(line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, sql_file)))
{
my_fclose(sql_file,MYF(0));
return put_info("Can't initialize batch_readline", INFO_ERROR, 0);
@ -4343,7 +4347,8 @@ server_version_string(MYSQL *con)
MYSQL_ROW cur = mysql_fetch_row(result);
if (cur && cur[0])
{
bufp = strxnmov(bufp, sizeof buf - (bufp - buf), " ", cur[0], NullS);
bufp = strxnmov(bufp, (uint) (sizeof buf - (bufp - buf)), " ", cur[0],
NullS);
}
mysql_free_result(result);
}

View File

@ -429,7 +429,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
MYF(MY_WME))) < 0)
die("Failed to create temporary file for defaults");
if (my_write(fd, query, strlen(query),
if (my_write(fd, query, (uint) strlen(query),
MYF(MY_FNABP | MY_WME)))
{
my_close(fd, MYF(0));

View File

@ -844,7 +844,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
bool old= (find_type(argv[0], &command_typelib, 2) ==
ADMIN_OLD_PASSWORD);
#ifdef __WIN__
uint pw_len= strlen(pw);
uint pw_len= (uint) strlen(pw);
if (pw_len > 1 && pw[0] == '\'' && pw[pw_len-1] == '\'')
printf("Warning: single quotes were not trimmed from the password by"
" your command\nline client, as you might have expected.\n");

View File

@ -105,7 +105,7 @@ static MYSQL* safe_connect();
class Load_log_processor
{
char target_dir_name[FN_REFLEN];
int target_dir_name_len;
size_t target_dir_name_len;
/*
When we see first event corresponding to some LOAD DATA statement in
@ -275,7 +275,7 @@ File Load_log_processor::prepare_new_file_for_old_format(Load_log_event *le,
File file;
fn_format(filename, le->fname, target_dir_name, "", 1);
len= strlen(filename);
len= (uint) strlen(filename);
tail= filename + len;
if ((file= create_unique_file(filename,tail)) < 0)
@ -284,7 +284,7 @@ File Load_log_processor::prepare_new_file_for_old_format(Load_log_event *le,
return -1;
}
le->set_fname_outside_temp_buf(filename,len+strlen(tail));
le->set_fname_outside_temp_buf(filename,len+(uint) strlen(tail));
return file;
}
@ -369,7 +369,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen,
uint file_id,
Create_file_log_event *ce)
{
uint full_len= target_dir_name_len + blen + 9 + 9 + 1;
size_t full_len= target_dir_name_len + blen + 9 + 9 + 1;
int error= 0;
char *fname, *ptr;
File file;
@ -403,7 +403,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen,
}
if (ce)
ce->set_fname_outside_temp_buf(fname, strlen(fname));
ce->set_fname_outside_temp_buf(fname, (uint) strlen(fname));
if (my_write(file, (byte*)block, block_len, MYF(MY_WME|MY_NABP)))
error= -1;
@ -416,7 +416,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen,
int Load_log_processor::process(Create_file_log_event *ce)
{
const char *bname= ce->fname + dirname_length(ce->fname);
uint blen= ce->fname_len - (bname-ce->fname);
uint blen= (uint) (ce->fname_len - (bname-ce->fname));
return process_first_event(bname, blen, ce->block, ce->block_len,
ce->file_id, ce);
@ -864,7 +864,7 @@ static my_time_t convert_str_to_timestamp(const char* str)
long dummy_my_timezone;
my_bool dummy_in_dst_time_gap;
/* We require a total specification (date AND time) */
if (str_to_datetime(str, strlen(str), &l_time, 0, &was_cut) !=
if (str_to_datetime(str, (uint) strlen(str), &l_time, 0, &was_cut) !=
MYSQL_TIMESTAMP_DATETIME || was_cut)
{
fprintf(stderr, "Incorrect date and time argument: %s\n", str);
@ -1109,7 +1109,7 @@ could be out of memory");
int4store(buf, (uint32)start_position);
int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags);
size_s tlen = strlen(logname);
size_t tlen= strlen(logname);
if (tlen > UINT_MAX)
{
fprintf(stderr,"Log name too long\n");

View File

@ -328,7 +328,7 @@ static int get_options(int *argc, char ***argv)
if (!what_to_do)
{
int pnlen = strlen(my_progname);
size_t pnlen= strlen(my_progname);
if (pnlen < 6) /* name too short */
what_to_do = DO_CHECK;
@ -414,7 +414,8 @@ static int process_selected_tables(char *db, char **table_names, int tables)
space is for more readable output in logs and in case of error
*/
char *table_names_comma_sep, *end;
int i, tot_length = 0;
size_t tot_length= 0;
int i= 0;
for (i = 0; i < tables; i++)
tot_length+= fixed_name_length(*(table_names + i)) + 2;
@ -430,7 +431,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
*end++= ',';
}
*--end = 0;
handle_request_for_tables(table_names_comma_sep + 1, tot_length - 1);
handle_request_for_tables(table_names_comma_sep + 1, (uint) (tot_length - 1));
my_free(table_names_comma_sep, MYF(0));
}
else
@ -452,7 +453,7 @@ static uint fixed_name_length(const char *name)
else if (*p == '.')
extra_length+= 2;
}
return (p - name) + extra_length;
return (uint) ((p - name) + extra_length);
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000 MySQL AB
/* Copyright 2000-2008 MySQL AB, 2009 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -662,7 +662,7 @@ static void free_table_ent(char *key)
byte* get_table_key(const char *entry, uint *length,
my_bool not_used __attribute__((unused)))
{
*length= strlen(entry);
*length= (uint) strlen(entry);
return (byte*) entry;
}
@ -778,7 +778,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_set_charset= 0;
opt_compatible_mode_str= argument;
opt_compatible_mode= find_set(&compatible_mode_typelib,
argument, strlen(argument),
argument, (uint) strlen(argument),
&err_ptr, &err_len);
if (err_len)
{
@ -791,7 +791,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
uint size_for_sql_mode= 0;
const char **ptr;
for (ptr= compatible_mode_names; *ptr; ptr++)
size_for_sql_mode+= strlen(*ptr);
size_for_sql_mode+= (uint) strlen(*ptr);
size_for_sql_mode+= sizeof(compatible_mode_names)-1;
DBUG_ASSERT(sizeof(compatible_mode_normal_str)>=size_for_sql_mode);
}
@ -1039,7 +1039,7 @@ static int switch_character_set_results(MYSQL *mysql, const char *cs_name)
"SET SESSION character_set_results = '%s'",
(const char *) cs_name);
return mysql_real_query(mysql, query_buffer, query_length);
return mysql_real_query(mysql, query_buffer, (uint) query_length);
}
@ -1372,7 +1372,8 @@ static void print_xml_tag(FILE * xml_file, const char* sbeg,
fputs(attribute_name, xml_file);
fputc('\"', xml_file);
print_quoted_xml(xml_file, attribute_value, strlen(attribute_value));
print_quoted_xml(xml_file, attribute_value,
(uint) strlen(attribute_value));
fputc('\"', xml_file);
attribute_name= va_arg(arg_list, char *);
@ -1412,7 +1413,7 @@ static void print_xml_null_tag(FILE * xml_file, const char* sbeg,
fputs("<", xml_file);
fputs(stag_atr, xml_file);
fputs("\"", xml_file);
print_quoted_xml(xml_file, sval, strlen(sval));
print_quoted_xml(xml_file, sval, (uint) strlen(sval));
fputs("\" xsi:nil=\"true\" />", xml_file);
fputs(line_end, xml_file);
check_io(xml_file);
@ -1510,7 +1511,7 @@ static uint dump_routines_for_db(char *db)
DBUG_ENTER("dump_routines_for_db");
DBUG_PRINT("enter", ("db: '%s'", db));
mysql_real_escape_string(mysql, db_name_buff, db, strlen(db));
mysql_real_escape_string(mysql, db_name_buff, db, (uint) strlen(db));
/* nice comments */
if (opt_comments)
@ -1602,13 +1603,13 @@ static uint dump_routines_for_db(char *db)
Allocate memory for new query string: original string
from SHOW statement and version-specific comments.
*/
query_str= alloc_query_str(strlen(row[2]) + 23);
query_str= alloc_query_str((uint) strlen(row[2]) + 23);
query_str_tail= strnmov(query_str, row[2],
definer_begin - row[2]);
(uint) (definer_begin - row[2]));
query_str_tail= strmov(query_str_tail, "*/ /*!50020");
query_str_tail= strnmov(query_str_tail, definer_begin,
definer_end - definer_begin);
(uint) (definer_end - definer_begin));
query_str_tail= strxmov(query_str_tail, "*/ /*!50003",
definer_end, NullS);
}
@ -2217,7 +2218,7 @@ static void dump_triggers_for_table(char *table,
char host_name_str[HOSTNAME_LENGTH + 1];
char quoted_host_name_str[HOSTNAME_LENGTH * 2 + 3];
parse_user(row[7], strlen(row[7]), user_name_str, &user_name_len,
parse_user(row[7], (uint) strlen(row[7]), user_name_str, &user_name_len,
host_name_str, &host_name_len);
fprintf(sql_file,
@ -3055,7 +3056,7 @@ static int dump_all_tables_in_db(char *database)
while ((table= getTableName(0)))
{
char *end= strmov(afterdot, table);
if (include_table(hash_key, end - hash_key))
if (include_table(hash_key, (uint) (end - hash_key)))
{
dump_table(table,database);
my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
@ -3104,6 +3105,11 @@ static my_bool dump_all_views_in_db(char *database)
char *table;
uint numrows;
char table_buff[NAME_LEN*2+3];
char hash_key[2*NAME_LEN+2]; /* "db.tablename" */
char *afterdot;
afterdot= strmov(hash_key, database);
*afterdot++= '.';
if (init_dumping(database, init_dumping_views))
return 1;
@ -3113,11 +3119,16 @@ static my_bool dump_all_views_in_db(char *database)
{
DYNAMIC_STRING query;
init_dynamic_string_checked(&query, "LOCK TABLES ", 256, 1024);
for (numrows= 0 ; (table= getTableName(1)); numrows++)
for (numrows= 0 ; (table= getTableName(1)); )
{
char *end= strmov(afterdot, table);
if (include_table((uchar*) hash_key,end - hash_key))
{
numrows++;
dynstr_append_checked(&query, quote_name(table, table_buff, 1));
dynstr_append_checked(&query, " READ /*!32311 LOCAL */,");
}
}
if (numrows && mysql_real_query(mysql, query.str, query.length-1))
DB_error(mysql, "when using LOCK TABLES");
/* We shall continue here, if --force was given */
@ -3130,7 +3141,11 @@ static my_bool dump_all_views_in_db(char *database)
/* We shall continue here, if --force was given */
}
while ((table= getTableName(0)))
{
char *end= strmov(afterdot, table);
if (include_table((uchar*) hash_key, end - hash_key))
get_view_structure(table, database);
}
if (opt_xml)
{
fputs("</database>\n", md_result_file);
@ -3200,7 +3215,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
DBUG_ENTER("dump_selected_tables");
if (init_dumping(db, init_dumping_tables))
return 1;
DBUG_RETURN(1);
init_alloc_root(&root, 8192, 0);
if (!(dump_tables= pos= (char**) alloc_root(&root, tables * sizeof(char *))))
@ -3562,7 +3577,8 @@ char check_if_ignore_table(const char *table_name, char *table_type)
If these two types, we do want to skip dumping the table
*/
if (!opt_no_data &&
(!strcmp(table_type,"MRG_MyISAM") || !strcmp(table_type,"MRG_ISAM")))
(!strcmp(table_type,"MRG_MyISAM") || !strcmp(table_type,"MRG_ISAM") ||
!strcmp(table_type,"FEDERATED")))
result= IGNORE_DATA;
}
mysql_free_result(res);
@ -3623,7 +3639,7 @@ static char *primary_key_fields(const char *table_name)
do
{
quoted_field= quote_name(row[4], buff, 0);
result_length+= strlen(quoted_field) + 1; /* + 1 for ',' or \0 */
result_length+= (uint) strlen(quoted_field) + 1; /* + 1 for ',' or \0 */
} while ((row= mysql_fetch_row(res)) && atoi(row[3]) > 1);
}
@ -3683,7 +3699,8 @@ static int replace(DYNAMIC_STRING *ds_str,
return 1;
init_dynamic_string_checked(&ds_tmp, "",
ds_str->length + replace_len, 256);
dynstr_append_mem_checked(&ds_tmp, ds_str->str, start - ds_str->str);
dynstr_append_mem_checked(&ds_tmp, ds_str->str,
(uint) (start - ds_str->str));
dynstr_append_mem_checked(&ds_tmp, replace_str, replace_len);
dynstr_append_checked(&ds_tmp, start + search_len);
dynstr_set_checked(ds_str, ds_tmp.str);

View File

@ -134,7 +134,6 @@ void get_pass(char* pw, int len)
int main(int argc, char** argv)
{
FILE* fp;
my_MD5_CTX context;
uchar digest[16];
char pw[17];
uint i;
@ -147,9 +146,7 @@ int main(int argc, char** argv)
if (!(fp=fopen(outfile,"w")))
die("Could not open '%s'(errno=%d)",outfile,errno);
get_pass(pw,sizeof(pw)-1);
my_MD5Init(&context);
my_MD5Update(&context,(uchar*) pw,sizeof(pw)-1);
my_MD5Final(digest,&context);
MY_MD5_HASH(digest,(uchar*) pw,sizeof(pw)-1);
fprintf(fp,"%s:",user);
for (i=0;i<sizeof(digest);i++)
fprintf(fp,"%02x",digest[i]);

View File

@ -801,7 +801,7 @@ void check_command_args(struct st_command *command,
ptr++;
if (ptr > start)
{
init_dynamic_string(arg->ds, 0, ptr-start, 32);
init_dynamic_string(arg->ds, 0, (uint) (ptr - start), 32);
do_eval(arg->ds, start, ptr, FALSE);
}
else
@ -1156,16 +1156,16 @@ void warning_msg(const char *fmt, ...)
len= my_snprintf(buff, sizeof(buff), "in included file %s ",
cur_file->file_name);
dynstr_append_mem(&ds_warning_messages,
buff, len);
buff, (uint) len);
}
len= my_snprintf(buff, sizeof(buff), "at line %d: ",
start_lineno);
dynstr_append_mem(&ds_warning_messages,
buff, len);
buff, (uint) len);
}
len= my_vsnprintf(buff, sizeof(buff), fmt, args);
dynstr_append_mem(&ds_warning_messages, buff, len);
dynstr_append_mem(&ds_warning_messages, buff, (uint) len);
dynstr_append(&ds_warning_messages, "\n");
va_end(args);
@ -1185,7 +1185,7 @@ void log_msg(const char *fmt, ...)
len= my_vsnprintf(buff, sizeof(buff)-1, fmt, args);
va_end(args);
dynstr_append_mem(&ds_res, buff, len);
dynstr_append_mem(&ds_res, buff, (uint) len);
dynstr_append(&ds_res, "\n");
DBUG_VOID_RETURN;
@ -1222,7 +1222,7 @@ void cat_file(DYNAMIC_STRING* ds, const char* filename)
/* Add fake newline instead of cr and output the line */
*p= '\n';
p++; /* Step past the "fake" newline */
dynstr_append_mem(ds, start, p-start);
dynstr_append_mem(ds, start, (uint) (p - start));
p++; /* Step past the "fake" newline */
start= p;
}
@ -1230,7 +1230,7 @@ void cat_file(DYNAMIC_STRING* ds, const char* filename)
p++;
}
/* Output any chars that migh be left */
dynstr_append_mem(ds, start, p-start);
dynstr_append_mem(ds, start, (uint) (p - start));
}
my_close(fd, MYF(0));
}
@ -1770,9 +1770,9 @@ VAR *var_init(VAR *v, const char *name, int name_len, const char *val,
int val_alloc_len;
VAR *tmp_var;
if (!name_len && name)
name_len = strlen(name);
name_len = (uint) strlen(name);
if (!val_len && val)
val_len = strlen(val) ;
val_len = (uint) strlen(val) ;
val_alloc_len = val_len + 16; /* room to grow */
if (!(tmp_var=v) && !(tmp_var = (VAR*)my_malloc(sizeof(*tmp_var)
+ name_len+1, MYF(MY_WME))))
@ -1815,7 +1815,7 @@ VAR* var_from_env(const char *name, const char *def_val)
if (!(tmp = getenv(name)))
tmp = def_val;
v = var_init(0, name, strlen(name), tmp, strlen(tmp));
v = var_init(0, name, (uint) strlen(name), tmp, (uint) strlen(tmp));
my_hash_insert(&var_hash, (byte*)v);
return v;
}
@ -1864,7 +1864,7 @@ VAR* var_get(const char *var_name, const char **var_name_end, my_bool raw,
{
sprintf(v->str_val, "%d", v->int_val);
v->int_dirty = 0;
v->str_val_len = strlen(v->str_val);
v->str_val_len = (uint) strlen(v->str_val);
}
if (var_name_end)
*var_name_end = var_name ;
@ -1927,7 +1927,7 @@ void var_set(const char *var_name, const char *var_name_end,
{
sprintf(v->str_val, "%d", v->int_val);
v->int_dirty= 0;
v->str_val_len= strlen(v->str_val);
v->str_val_len= (uint) strlen(v->str_val);
}
my_snprintf(buf, sizeof(buf), "%.*s=%.*s",
v->name_len, v->name,
@ -2006,7 +2006,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
++query;
/* Eval the query, thus replacing all environment variables */
init_dynamic_string(&ds_query, 0, (end - query) + 32, 256);
init_dynamic_string(&ds_query, 0, (uint) ((end - query) + 32), 256);
do_eval(&ds_query, query, end, FALSE);
if (mysql_real_query(mysql, ds_query.str, ds_query.length))
@ -2223,7 +2223,7 @@ void eval_expr(VAR *v, const char *p, const char **p_end)
struct st_command command;
memset(&command, 0, sizeof(command));
command.query= (char*)p;
command.first_word_len= len;
command.first_word_len= (uint) len;
command.first_argument= command.query + len;
command.end= (char*)*p_end;
var_set_query_get_value(&command, v);
@ -2413,7 +2413,7 @@ static int replace(DYNAMIC_STRING *ds_str,
return 1;
init_dynamic_string(&ds_tmp, "",
ds_str->length + replace_len, 256);
dynstr_append_mem(&ds_tmp, ds_str->str, start - ds_str->str);
dynstr_append_mem(&ds_tmp, ds_str->str, (uint) (start - ds_str->str));
dynstr_append_mem(&ds_tmp, replace_str, replace_len);
dynstr_append(&ds_tmp, start + search_len);
dynstr_set(ds_str, ds_tmp.str);
@ -2468,7 +2468,7 @@ void do_exec(struct st_command *command)
if (builtin_echo[0] && strncmp(cmd, "echo", 4) == 0)
{
/* Replace echo with our "builtin" echo */
replace(&ds_cmd, "echo", 4, builtin_echo, strlen(builtin_echo));
replace(&ds_cmd, "echo", 4, builtin_echo, (uint) strlen(builtin_echo));
}
#ifdef __WIN__
@ -4627,7 +4627,7 @@ void do_delimiter(struct st_command* command)
die("Can't set empty delimiter");
strmake(delimiter, p, sizeof(delimiter) - 1);
delimiter_length= strlen(delimiter);
delimiter_length= (uint) strlen(delimiter);
DBUG_PRINT("exit", ("delimiter: %s", delimiter));
command->last_argument= p + delimiter_length;
@ -4753,9 +4753,11 @@ int read_line(char *buf, int size)
}
else if ((c == '{' &&
(!my_strnncoll_simple(charset_info, (const uchar*) "while", 5,
(uchar*) buf, min(5, p - buf), 0) ||
(uchar*) buf, min(5, (uint) (p - buf)),
0) ||
!my_strnncoll_simple(charset_info, (const uchar*) "if", 2,
(uchar*) buf, min(2, p - buf), 0))))
(uchar*) buf, min(2, (uint) (p - buf)),
0))))
{
/* Only if and while commands can be terminated by { */
*p++= c;
@ -5117,7 +5119,7 @@ int read_command(struct st_command** command_ptr)
command->first_argument= p;
command->end= strend(command->query);
command->query_len= (command->end - command->query);
command->query_len= (uint) (command->end - command->query);
parser.read_lines++;
DBUG_RETURN(0);
}
@ -6459,7 +6461,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
else
{
query = command->query;
query_len = strlen(query);
query_len = (uint) strlen(query);
}
/*
@ -6520,7 +6522,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
*/
view_created= 1;
query= (char*)"SELECT * FROM mysqltest_tmp_v";
query_len = strlen(query);
query_len = (uint) strlen(query);
/*
Collect warnings from create of the view that should otherwise
@ -6568,7 +6570,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
sp_created= 1;
query= (char*)"CALL mysqltest_tmp_sp()";
query_len = strlen(query);
query_len = (uint) strlen(query);
}
dynstr_free(&query_str);
}
@ -6661,9 +6663,9 @@ void init_re_comp(my_regex_t *re, const char* str)
if (err)
{
char erbuf[100];
int len= my_regerror(err, re, erbuf, sizeof(erbuf));
size_t len= my_regerror(err, re, erbuf, sizeof(erbuf));
die("error %s, %d/%d `%s'\n",
re_eprint(err), len, (int)sizeof(erbuf), erbuf);
re_eprint(err), (int)len, (int)sizeof(erbuf), erbuf);
}
}
@ -6717,9 +6719,9 @@ int match_re(my_regex_t *re, char *str)
{
char erbuf[100];
int len= my_regerror(err, re, erbuf, sizeof(erbuf));
size_t len= my_regerror(err, re, erbuf, sizeof(erbuf));
die("error %s, %d/%d `%s'\n",
re_eprint(err), len, (int)sizeof(erbuf), erbuf);
re_eprint(err), (int)len, (int)sizeof(erbuf), erbuf);
}
return 0;
}
@ -7579,7 +7581,7 @@ void replace_strings_append(REPLACE *rep, DYNAMIC_STRING* ds,
if (!(rep_str = ((REPLACE_STRING*) rep_pos))->replace_string)
{
/* No match found */
dynstr_append_mem(ds, start, from - start - 1);
dynstr_append_mem(ds, start, (uint) (from - start - 1));
DBUG_PRINT("exit", ("Found no more string to replace, appended: %s", start));
DBUG_VOID_RETURN;
}
@ -7590,11 +7592,11 @@ void replace_strings_append(REPLACE *rep, DYNAMIC_STRING* ds,
rep_str->from_offset, rep_str->replace_string));
/* Append part of original string before replace string */
dynstr_append_mem(ds, start, (from - rep_str->to_offset) - start);
dynstr_append_mem(ds, start, (uint) ((from - rep_str->to_offset) - start));
/* Append replace string */
dynstr_append_mem(ds, rep_str->replace_string,
strlen(rep_str->replace_string));
(uint) strlen(rep_str->replace_string));
if (!*(from-=rep_str->from_offset) && rep_pos->found != 2)
{
@ -7689,7 +7691,7 @@ struct st_replace_regex* init_replace_regex(char* expr)
char* buf,*expr_end;
char* p;
char* buf_p;
uint expr_len= strlen(expr);
size_t expr_len= strlen(expr);
char last_c = 0;
struct st_regex reg;
@ -7866,7 +7868,7 @@ void free_replace_regex()
*/
#define SECURE_REG_BUF if (buf_len < need_buf_len) \
{ \
int off= res_p - buf; \
size_t off= res_p - buf; \
buf= (char*)my_realloc(buf,need_buf_len,MYF(MY_WME+MY_FAE)); \
res_p= buf + off; \
buf_len= need_buf_len; \
@ -7898,7 +7900,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
char *res_p,*str_p,*str_end;
buf_len= *buf_len_p;
len= strlen(string);
len= (uint) strlen(string);
str_end= string + len;
/* start with a buffer of a reasonable size that hopefully will not
@ -7950,7 +7952,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
we need at least what we have so far in the buffer + the part
before this match
*/
need_buf_len= (res_p - buf) + (int) subs[0].rm_so;
need_buf_len= (uint) (res_p - buf) + (int) subs[0].rm_so;
/* on this pass, calculate the memory for the result buffer */
while (expr_p < replace_end)
@ -8040,8 +8042,8 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
}
else /* no match this time, just copy the string as is */
{
int left_in_str= str_end-str_p;
need_buf_len= (res_p-buf) + left_in_str;
size_t left_in_str= str_end-str_p;
need_buf_len= (uint) ((res_p-buf) + left_in_str);
SECURE_REG_BUF
memcpy(res_p,str_p,left_in_str);
res_p += left_in_str;
@ -8708,7 +8710,7 @@ void replace_dynstr_append_mem(DYNAMIC_STRING *ds,
if (!multi_reg_replace(glob_replace_regex, (char*)val))
{
val= glob_replace_regex->buf;
len= strlen(val);
len= (uint) strlen(val);
}
}
@ -8725,7 +8727,7 @@ void replace_dynstr_append_mem(DYNAMIC_STRING *ds,
/* Append zero-terminated string to ds, with optional replace */
void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val)
{
replace_dynstr_append_mem(ds, val, strlen(val));
replace_dynstr_append_mem(ds, val, (uint) strlen(val));
}
/* Append uint to ds, with optional replace */
@ -8733,7 +8735,7 @@ void replace_dynstr_append_uint(DYNAMIC_STRING *ds, uint val)
{
char buff[22]; /* This should be enough for any int */
char *end= longlong10_to_str(val, buff, 10);
replace_dynstr_append_mem(ds, buff, end - buff);
replace_dynstr_append_mem(ds, buff, (uint) (end - buff));
}
@ -8771,7 +8773,7 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input)
while (*start && *start != '\n')
start++;
start++; /* Skip past \n */
dynstr_append_mem(ds, ds_input->str, start - ds_input->str);
dynstr_append_mem(ds, ds_input->str, (uint) (start - ds_input->str));
/* Insert line(s) in array */
while (*start)

View File

@ -24,7 +24,7 @@ static bool init_line_buffer(LINE_BUFFER *buffer,File file,ulong size,
ulong max_size);
static bool init_line_buffer_from_string(LINE_BUFFER *buffer,my_string str);
static uint fill_buffer(LINE_BUFFER *buffer);
static char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length);
static char *intern_read_line(LINE_BUFFER *buffer, ulong *out_length, bool *truncated);
LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
@ -42,12 +42,13 @@ LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
}
char *batch_readline(LINE_BUFFER *line_buff)
char *batch_readline(LINE_BUFFER *line_buff, bool *truncated)
{
char *pos;
ulong out_length;
DBUG_ASSERT(truncated != NULL);
if (!(pos=intern_read_line(line_buff,&out_length)))
if (!(pos=intern_read_line(line_buff,&out_length, truncated)))
return 0;
if (out_length && pos[out_length-1] == '\n')
if (--out_length && pos[out_length-1] == '\r') /* Remove '\n' */
@ -149,6 +150,14 @@ static uint fill_buffer(LINE_BUFFER *buffer)
read_count=(buffer->bufread - bufbytes)/IO_SIZE;
if ((read_count*=IO_SIZE))
break;
if (buffer->bufread * 2 > buffer->max_size)
{
/*
So we must grow the buffer but we cannot due to the max_size limit.
Return 0 w/o setting buffer->eof to signal this condition.
*/
return 0;
}
buffer->bufread *= 2;
if (!(buffer->buffer = (char*) my_realloc(buffer->buffer,
buffer->bufread+1,
@ -172,12 +181,16 @@ static uint fill_buffer(LINE_BUFFER *buffer)
DBUG_PRINT("fill_buff", ("Got %d bytes", read_count));
/* Kludge to pretend every nonempty file ends with a newline. */
if (!read_count && bufbytes && buffer->end[-1] != '\n')
if (!read_count)
{
buffer->eof = read_count = 1;
buffer->eof = 1;
/* Kludge to pretend every nonempty file ends with a newline. */
if (bufbytes && buffer->end[-1] != '\n')
{
read_count = 1;
*buffer->end = '\n';
}
}
buffer->end_of_line=(buffer->start_of_line=buffer->buffer)+bufbytes;
buffer->end+=read_count;
*buffer->end=0; /* Sentinel */
@ -186,7 +199,7 @@ static uint fill_buffer(LINE_BUFFER *buffer)
char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length)
char *intern_read_line(LINE_BUFFER *buffer, ulong *out_length, bool *truncated)
{
char *pos;
uint length;
@ -200,14 +213,23 @@ char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length)
pos++;
if (pos == buffer->end)
{
if ((uint) (pos - buffer->start_of_line) < buffer->max_size)
{
/*
fill_buffer() can return 0 either on EOF in which case we abort
or when the internal buffer has hit the size limit. In the latter case
return what we have read so far and signal string truncation.
*/
if (!(length=fill_buffer(buffer)) || length == (uint) -1)
{
if (buffer->eof)
DBUG_RETURN(0);
}
else
continue;
}
pos--; /* break line here */
*truncated= 1;
}
else
*truncated= 0;
buffer->end_of_line=pos+1;
*out_length=(ulong) (pos + 1 - buffer->eof - buffer->start_of_line);
DBUG_RETURN(buffer->start_of_line);

View File

@ -465,7 +465,7 @@ bool String::append(const char *s,uint32 arg_length)
bool String::append(const char *s)
{
return append(s, strlen(s));
return append(s, (uint) strlen(s));
}

View File

@ -358,16 +358,19 @@ esac
AC_DEFUN([MYSQL_CHECK_LIB_TERMCAP],
[
AC_CACHE_VAL(mysql_cv_termcap_lib,
[AC_CHECK_LIB(ncursesw, tgetent, mysql_cv_termcap_lib=libncursesw,
[AC_CHECK_LIB(ncurses, tgetent, mysql_cv_termcap_lib=libncurses,
[AC_CHECK_LIB(curses, tgetent, mysql_cv_termcap_lib=libcurses,
[AC_CHECK_LIB(termcap, tgetent, mysql_cv_termcap_lib=libtermcap,
[AC_CHECK_LIB(tinfo, tgetent, mysql_cv_termcap_lib=libtinfo,
mysql_cv_termcap_lib=NOT_FOUND)])])])])
mysql_cv_termcap_lib=NOT_FOUND)])])])])])
AC_MSG_CHECKING(for termcap functions library)
if test "$mysql_cv_termcap_lib" = "NOT_FOUND"; then
AC_MSG_ERROR([No curses/termcap library found])
elif test "$mysql_cv_termcap_lib" = "libtermcap"; then
TERMCAP_LIB=-ltermcap
elif test "$mysql_cv_termcap_lib" = "libncursesw"; then
TERMCAP_LIB=-lncursesw
elif test "$mysql_cv_termcap_lib" = "libncurses"; then
TERMCAP_LIB=-lncurses
elif test "$mysql_cv_termcap_lib" = "libtinfo"; then

View File

@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb
AM_INIT_AUTOMAKE(mysql, 5.0.79)
AM_INIT_AUTOMAKE(mysql, 5.0.80)
AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10
@ -23,7 +23,7 @@ NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0
# ndb version
NDB_VERSION_MAJOR=5
NDB_VERSION_MINOR=0
NDB_VERSION_BUILD=79
NDB_VERSION_BUILD=80
NDB_VERSION_STATUS=""
# Set all version vars based on $VERSION. How do we do this more elegant ?
@ -2094,6 +2094,27 @@ esac
AC_MSG_CHECKING(for isinf in <math.h>)
AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
AC_MSG_RESULT(yes)
AC_MSG_CHECKING(whether isinf() is safe to use in C code)
AC_TRY_RUN([
#include <math.h>
int main()
{
double a= 10.0;
double b= 1e308;
return !isinf(a * b);
}
],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
AC_DEFINE([HAVE_BROKEN_ISINF], [1],
[Define to 1 if isinf() uses 80-bit register for intermediate values])
],
[
# Let's be optimistic when cross-compiling, since the only compiler known
# to be affected by this isinf() bug is GCC 4.3 on 32-bit x86.
AC_MSG_RESULT([[cross-compiling, assuming 'yes']])
])
AC_MSG_CHECKING(whether isinf() can be used in C++ code)
AC_LANG_SAVE
AC_LANG_CPLUSPLUS

View File

@ -660,7 +660,7 @@ static ha_checksum checksum_format_specifier(const char* msg)
case 'u':
case 'x':
case 's':
chksum= my_checksum(chksum, start, p-start);
chksum= my_checksum(chksum, start, (uint) (p - start));
start= 0; /* Not in format specifier anymore */
break;

View File

@ -106,7 +106,7 @@ void input_buffer::add_size(uint i)
uint input_buffer::get_capacity() const
{
return end_ - buffer_;
return (uint) (end_ - buffer_);
}
@ -223,7 +223,7 @@ uint output_buffer::get_size() const
uint output_buffer::get_capacity() const
{
return end_ - buffer_;
return (uint) (end_ - buffer_);
}

View File

@ -236,7 +236,7 @@ uint CertManager::get_privateKeyLength() const
int CertManager::Validate()
{
CertList::reverse_iterator last = peerList_.rbegin();
int count = peerList_.size();
size_t count= peerList_.size();
while ( count > 1 ) {
TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length());
@ -269,13 +269,13 @@ int CertManager::Validate()
else
peerKeyType_ = dsa_sa_algo;
int iSz = strlen(cert.GetIssuer()) + 1;
int sSz = strlen(cert.GetCommonName()) + 1;
int bSz = strlen(cert.GetBeforeDate()) + 1;
int aSz = strlen(cert.GetAfterDate()) + 1;
size_t iSz= strlen(cert.GetIssuer()) + 1;
size_t sSz= strlen(cert.GetCommonName()) + 1;
size_t bSz= strlen(cert.GetBeforeDate()) + 1;
size_t aSz= strlen(cert.GetAfterDate()) + 1;
peerX509_ = NEW_YS X509(cert.GetIssuer(), iSz, cert.GetCommonName(),
sSz, cert.GetBeforeDate(), bSz,
cert.GetAfterDate(), aSz);
sSz, cert.GetBeforeDate(), (int) bSz,
cert.GetAfterDate(), (int) aSz);
}
return 0;
}

View File

@ -604,13 +604,13 @@ char* X509_NAME_oneline(X509_NAME* name, char* buffer, int sz)
{
if (!name->GetName()) return buffer;
int len = strlen(name->GetName()) + 1;
int copySz = min(len, sz);
size_t len= strlen(name->GetName()) + 1;
int copySz = min((int) len, sz);
if (!buffer) {
buffer = (char*)malloc(len);
if (!buffer) return buffer;
copySz = len;
copySz = (int) len;
}
if (copySz == 0)

View File

@ -532,7 +532,7 @@ void Parameters::SetCipherNames()
for (int j = 0; j < suites; j++) {
int index = suites_[j*2 + 1]; // every other suite is suite id
int len = strlen(cipher_names[index]) + 1;
size_t len = strlen(cipher_names[index]) + 1;
strncpy(cipher_list_[pos++], cipher_names[index], len);
}
cipher_list_[pos][0] = 0;

View File

@ -1034,7 +1034,7 @@ void SSL::fillData(Data& data)
{
if (GetError()) return;
uint dataSz = data.get_length(); // input, data size to fill
uint elements = buffers_.getData().size();
size_t elements = buffers_.getData().size();
data.set_length(0); // output, actual data filled
dataSz = min(dataSz, bufferedData());
@ -1064,7 +1064,7 @@ void SSL::PeekData(Data& data)
{
if (GetError()) return;
uint dataSz = data.get_length(); // input, data size to fill
uint elements = buffers_.getData().size();
size_t elements = buffers_.getData().size();
data.set_length(0); // output, actual data filled
dataSz = min(dataSz, bufferedData());
@ -1098,7 +1098,7 @@ void SSL::flushBuffer()
buffers_.getHandShake().end(),
SumBuffer()).total_;
output_buffer out(sz);
uint elements = buffers_.getHandShake().size();
size_t elements = buffers_.getHandShake().size();
for (uint i = 0; i < elements; i++) {
output_buffer* front = buffers_.getHandShake().front();
@ -1906,7 +1906,7 @@ bool SSL_CTX::SetCipherList(const char* list)
int idx = 0;
for(;;) {
int len;
size_t len;
prev = haystack;
haystack = strstr(haystack, needle);
@ -2354,10 +2354,10 @@ ASN1_STRING* X509_NAME::GetEntry(int i)
memcpy(entry_.data, &name_[i], sz_ - i);
if (entry_.data[sz_ -i - 1]) {
entry_.data[sz_ - i] = 0;
entry_.length = sz_ - i;
entry_.length = (int) (sz_ - i);
}
else
entry_.length = sz_ - i - 1;
entry_.length = (int) (sz_ - i - 1);
entry_.type = 0;
return &entry_;

View File

@ -78,7 +78,7 @@ typename A::pointer StdReallocate(A& a, T* p, typename A::size_type oldSize,
if (preserve) {
A b = A();
typename A::pointer newPointer = b.allocate(newSize, 0);
memcpy(newPointer, p, sizeof(T) * min(oldSize, newSize));
memcpy(newPointer, p, sizeof(T) * min((word32) oldSize, (word32) newSize));
a.deallocate(p, oldSize);
STL::swap(a, b);
return newPointer;

View File

@ -288,7 +288,7 @@ void AbstractGroup::SimultaneousMultiply(Integer *results, const Integer &base,
r = buckets[i][buckets[i].size()-1];
if (buckets[i].size() > 1)
{
for (int j = buckets[i].size()-2; j >= 1; j--)
for (int j= (unsigned int) (buckets[i].size()) - 2; j >= 1; j--)
{
Accumulate(buckets[i][j], buckets[i][j+1]);
Accumulate(r, buckets[i][j]);

View File

@ -213,7 +213,7 @@ void PublicKey::AddToEnd(const byte* data, word32 len)
Signer::Signer(const byte* k, word32 kSz, const char* n, const byte* h)
: key_(k, kSz)
{
int sz = strlen(n);
size_t sz = strlen(n);
memcpy(name_, n, sz);
name_[sz] = 0;

View File

@ -69,7 +69,7 @@ int heap_write(HP_INFO *info, const byte *record)
err:
if (my_errno == HA_ERR_FOUND_DUPP_KEY)
DBUG_PRINT("info",("Duplicate key: %d", (int) (keydef - share->keydef)));
info->errkey= keydef - share->keydef;
info->errkey= (int) (keydef - share->keydef);
/*
We don't need to delete non-inserted key from rb-tree. Also, if
we got ENOMEM, the key wasn't inserted, so don't try to delete it

View File

@ -831,9 +831,19 @@ typedef SOCKET_SIZE_TYPE size_socket;
#endif
#ifdef HAVE_ISINF
/* isinf() can be used in both C and C++ code */
#define my_isinf(X) isinf(X)
/* Check if C compiler is affected by GCC bug #39228 */
#if !defined(__cplusplus) && defined(HAVE_BROKEN_ISINF)
/* Force store/reload of the argument to/from a 64-bit double */
static inline double my_isinf(double x)
{
volatile double t= x;
return isinf(t);
}
#else
/* System-provided isinf() is available and safe to use */
#define my_isinf(X) isinf(X)
#endif
#else /* !HAVE_ISINF */
#define my_isinf(X) (!finite(X) && !isnan(X))
#endif

View File

@ -13,80 +13,42 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* See md5.c for explanation and copyright information. */
/* MD5.H - header file for MD5C.C
/*
* $FreeBSD: src/contrib/cvs/lib/md5.h,v 1.2 1999/12/11 15:10:02 peter Exp $
*/
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
/* Unlike previous versions of this code, uint32 need not be exactly
32 bits, merely 32 bits or more. Choosing a data type which is 32
bits instead of 64 is not important; speed is considerably more
important. ANSI guarantees that "unsigned long" will be big enough,
and always using it seems to have few disadvantages. */
typedef uint32 cvs_uint32;
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
/* GLOBAL.H - RSAREF types and constants
*/
/* PROTOTYPES should be set to one if and only if the compiler supports
function argument prototyping.
The following makes PROTOTYPES default to 0 if it has not already
been defined with C compiler flags.
*/
/* egcs 1.1.2 under linux didn't defined it.... :( */
#ifndef PROTOTYPES
#define PROTOTYPES 1 /* Assume prototypes */
#endif
/* POINTER defines a generic pointer type */
typedef unsigned char *POINTER;
/* UINT2 defines a two byte word */
typedef uint16 UINT2; /* Fix for MySQL / Alpha */
/* UINT4 defines a four byte word */
typedef uint32 UINT4; /* Fix for MySQL / Alpha */
/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
returns an empty list.
*/
#if PROTOTYPES
#define PROTO_LIST(list) list
#else
#define PROTO_LIST(list) ()
#endif
/* MD5 context. */
typedef struct {
UINT4 state[4]; /* state (ABCD) */
UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
unsigned char buffer[64]; /* input buffer */
} my_MD5_CTX;
cvs_uint32 buf[4];
cvs_uint32 bits[2];
unsigned char in[64];
} my_MD5Context;
#ifdef __cplusplus
extern "C" {
#endif
void my_MD5Init PROTO_LIST ((my_MD5_CTX *));
void my_MD5Update PROTO_LIST
((my_MD5_CTX *, unsigned char *, unsigned int));
void my_MD5Final PROTO_LIST ((unsigned char [16], my_MD5_CTX *));
void my_MD5Init (my_MD5Context *context);
void my_MD5Update (my_MD5Context *context,
unsigned char const *buf, unsigned len);
void my_MD5Final (unsigned char digest[16],
my_MD5Context *context);
#ifdef __cplusplus
}
#endif
#define MY_MD5_HASH(digest,buf,len) \
do { \
my_MD5Context ctx; \
my_MD5Init (&ctx); \
my_MD5Update (&ctx, buf, len); \
my_MD5Final (digest, &ctx); \
} while (0)

View File

@ -250,7 +250,7 @@ extern int NEAR my_umask, /* Default creation mask */
NEAR my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */
NEAR my_dont_interrupt; /* call remember_intr when set */
extern my_bool NEAR mysys_uses_curses, my_use_symdir;
extern ulong sf_malloc_cur_memory, sf_malloc_max_memory;
extern size_t sf_malloc_cur_memory, sf_malloc_max_memory;
extern ulong my_default_record_cache_size;
extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io,
@ -636,6 +636,7 @@ extern int nt_share_delete(const char *name,myf MyFlags);
extern void TERMINATE(FILE *file);
#endif
extern void init_glob_errs(void);
extern void wait_for_free_space(const char *filename, int errors);
extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
extern int my_fclose(FILE *fd,myf MyFlags);

View File

@ -484,7 +484,7 @@ struct for_node_struct{
definition */
que_node_t* loop_start_limit;/* initial value of loop variable */
que_node_t* loop_end_limit; /* end value of loop variable */
int loop_end_value; /* evaluated value for the end value:
lint loop_end_value; /* evaluated value for the end value:
it is calculated only when the loop
is entered, and will not change within
the loop */

View File

@ -1679,8 +1679,8 @@ pars_get_lex_chars(
{
int len;
len = pars_sym_tab_global->string_len
- pars_sym_tab_global->next_char_pos;
len= (uint) (pars_sym_tab_global->string_len
- pars_sym_tab_global->next_char_pos);
if (len == 0) {
#ifdef YYDEBUG
/* fputs("SQL string ends\n", stderr); */

View File

@ -587,7 +587,7 @@ cmp_dtuple_rec_with_match(
dtuple_byte = cmp_collate(dtuple_byte);
}
ret = dtuple_byte - rec_byte;
ret = (uint) (dtuple_byte - rec_byte);
if (UNIV_UNLIKELY(ret)) {
if (ret < 0) {
ret = -1;

View File

@ -3552,7 +3552,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
*/
char *start= value + param->offset;
char *end= value + length;
ulong copy_length;
size_t copy_length;
if (start < end)
{
copy_length= end - start;
@ -3807,11 +3807,11 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
if (field->flags & ZEROFILL_FLAG && length < field->length &&
field->length < MAX_DOUBLE_STRING_REP_LENGTH - 1)
{
bmove_upp((char*) buff + field->length, buff + length, length);
bmove_upp((char*) buff + field->length, buff + length, (uint) length);
bfill((char*) buff, field->length - length, '0');
length= field->length;
}
fetch_string_with_conversion(param, buff, length);
fetch_string_with_conversion(param, buff, (uint) length);
}
break;

View File

@ -159,7 +159,7 @@ MYSQL_MANAGER* STDCALL mysql_manager_connect(MYSQL_MANAGER* con,
goto err;
}
sprintf(msg_buf,"%-.16s %-.16s\n",user,passwd);
msg_len=strlen(msg_buf);
msg_len= (uint) strlen(msg_buf);
if (my_net_write(&con->net,msg_buf,msg_len) || net_flush(&con->net))
{
con->last_errno=con->net.last_errno;
@ -219,7 +219,7 @@ int STDCALL mysql_manager_command(MYSQL_MANAGER* con,const char* cmd,
int cmd_len)
{
if (!cmd_len)
cmd_len=strlen(cmd);
cmd_len= (uint) strlen(cmd);
if (my_net_write(&con->net,(char*)cmd,cmd_len) || net_flush(&con->net))
{
con->last_errno=errno;

View File

@ -659,7 +659,7 @@ void mi_collect_stats_nonulls_first(HA_KEYSEG *keyseg, ulonglong *notnull,
uchar *key)
{
uint first_null, kp;
first_null= ha_find_null(keyseg, key) - keyseg;
first_null= (uint) (ha_find_null(keyseg, key) - keyseg);
/*
All prefix tuples that don't include keypart_{first_null} are not-null
tuples (and all others aren't), increment counters for them.
@ -715,7 +715,7 @@ int mi_collect_stats_nonulls_next(HA_KEYSEG *keyseg, ulonglong *notnull,
seg= keyseg + diffs[0] - 1;
/* Find first NULL in last_key */
first_null_seg= ha_find_null(seg, last_key + diffs[1]) - keyseg;
first_null_seg= (uint) (ha_find_null(seg, last_key + diffs[1]) - keyseg);
for (kp= 0; kp < first_null_seg; kp++)
notnull[kp]++;
@ -3913,7 +3913,7 @@ static int sort_ft_key_write(MI_SORT_PARAM *sort_param, const void *a)
key_block++;
sort_info->key_block=key_block;
sort_param->keyinfo=& sort_info->info->s->ft2_keyinfo;
ft_buf->count=(ft_buf->buf - p)/val_len;
ft_buf->count=(uint) (ft_buf->buf - p)/val_len;
/* flushing buffer to second-level tree */
for (error=0; !error && p < ft_buf->buf; p+= val_len)

View File

@ -112,7 +112,8 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
share_buff.state.rec_per_key_part=rec_per_key_part;
share_buff.state.key_root=key_root;
share_buff.state.key_del=key_del;
share_buff.key_cache= multi_key_cache_search(name_buff, strlen(name_buff));
share_buff.key_cache= multi_key_cache_search(name_buff,
(uint) strlen(name_buff));
DBUG_EXECUTE_IF("myisam_pretend_crashed_table_on_open",
if (strstr(name, "/t1"))
@ -314,7 +315,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
(char*) key_del, (sizeof(my_off_t) *
share->state.header.max_block_size));
strmov(share->unique_file_name, name_buff);
share->unique_name_length= strlen(name_buff);
share->unique_name_length= (uint) strlen(name_buff);
strmov(share->index_file_name, index_name);
strmov(share->data_file_name, data_name);

View File

@ -254,7 +254,7 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
MYF(MY_HOLD_ON_ERROR));
/* Fix the table addresses in the tree heads. */
{
long diff=PTR_BYTE_DIFF(decode_table,share->decode_tables);
my_ptrdiff_t diff=PTR_BYTE_DIFF(decode_table,share->decode_tables);
share->decode_tables=decode_table;
for (i=0 ; i < trees ; i++)
share->decode_trees[i].table=ADD_TO_PTR(share->decode_trees[i].table,
@ -1430,6 +1430,32 @@ static void fill_buffer(MI_BIT_BUFF *bit_buff)
bit_buff->current_byte=0;
return;
}
else
{
uint len= 0;
uint i= 0;
/*
Check if the remaining buffer/record to read is less than the word size.
If so read byte by byte
Note: if this branch becomes a bottleneck it can be removed, assuming
that the second memory segment allocates 7 extra bytes (see
_mi_read_pack_info()).
*/
len= bit_buff->end - bit_buff->pos;
if (len < (BITS_SAVED / 8))
{
bit_buff->current_byte= 0;
for (i=0 ; i < len ; i++)
{
bit_buff->current_byte+= (((uint) ((uchar) bit_buff->pos[len - i - 1]))
<< (8 * i));
}
bit_buff->pos= bit_buff->end;
return;
}
}
#if BITS_SAVED == 64
bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) +
(((uint) ((uchar) bit_buff->pos[6])) << 8) +

View File

@ -408,7 +408,7 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
}
from+=keyseg->length;
page=from+nod_flag;
length=from-vseg;
length= (uint) (from - vseg);
}
if (page > end)

View File

@ -95,7 +95,7 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag,
_mi_kpos(nod_flag, k), level + 1)))
{
case 0: /* found - exit from recursion */
*saved_key = k - page_buf;
*saved_key = (uint) (k - page_buf);
goto ok;
case 1: /* not found - continue searching */
info->rtree_recursion_depth = level;
@ -117,7 +117,7 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag,
info->lastkey_length = k_len + info->s->base.rec_reflength;
memcpy(info->lastkey, k, info->lastkey_length);
info->rtree_recursion_depth = level;
*saved_key = last - page_buf;
*saved_key = (uint) (last - page_buf);
if (after_key < last)
{
@ -314,7 +314,7 @@ static int rtree_get_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint key_length,
_mi_kpos(nod_flag, k), level + 1)))
{
case 0: /* found - exit from recursion */
*saved_key = k - page_buf;
*saved_key = (uint) (k - page_buf);
goto ok;
case 1: /* not found - continue searching */
info->rtree_recursion_depth = level;
@ -333,7 +333,7 @@ static int rtree_get_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint key_length,
memcpy(info->lastkey, k, info->lastkey_length);
info->rtree_recursion_depth = level;
*saved_key = k - page_buf;
*saved_key = (uint) (k - page_buf);
if (after_key < last)
{
@ -420,7 +420,7 @@ int rtree_get_next(MI_INFO *info, uint keynr, uint key_length)
info->lastkey_length = k_len + info->s->base.rec_reflength;
memcpy(info->lastkey, key, k_len + info->s->base.rec_reflength);
*(int*)info->int_keypos = key - info->buff;
*(uint*)info->int_keypos = (uint) (key - info->buff);
if (after_key >= info->int_maxpos)
{
info->buff_used = 1;

View File

@ -3,29 +3,49 @@
# in test cases and can be reused. #
######################################################
# Bug#41307: Tests using include/ndb_backup.inc won't work on Windows due to
# 'grep' call
# This test is disabled on Windows via the next line until the above bug is
# resolved
--source include/not_windows.inc
--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
# there is no neat way to find the backupid, this is a hack to find it...
# To find the backupid, we must dump this data to a table, and SELECT
# what we want into an outfile. This could be accomplished with grep, but
# grep isn't Windows-portable
--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
--disable_query_log
# create a table to help us out
--disable_warnings # leave this on until done with the entire process
# cleanup
DROP TABLE IF EXISTS helper1;
CREATE TABLE helper1(c1 VARCHAR(20));
# dump raw data to file
let $ndb_backup_file1= $MYSQLTEST_VARDIR/ndb_backup_tmp.dat;
let $ndb_backup_file2= $MYSQLTEST_VARDIR/tmp.dat;
--error 0,1
--remove_file $ndb_backup_file1
--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 > $ndb_backup_file1
# load the table from the raw data file
eval LOAD DATA INFILE '$ndb_backup_file1' INTO TABLE helper1;
--remove_file $ndb_backup_file1
# output what we need
eval SELECT * FROM helper1 WHERE c1 LIKE '%520093696%'
INTO OUTFILE '$ndb_backup_file2';
# cleanup
DROP TABLE helper1;
--enable_warnings
--enable_query_log
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
(id INT, backup_id INT) ENGINE = MEMORY;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
eval LOAD DATA INFILE '$ndb_backup_file2'
INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
--remove_file $ndb_backup_file2
--replace_column 1 <the_backup_id>
SELECT @the_backup_id:=backup_id FROM test.backup_info;
let the_backup_id=`select @the_backup_id`;
let $the_backup_id=`SELECT @the_backup_id`;
DROP TABLE test.backup_info;

View File

@ -2,11 +2,20 @@
#
# SUMMARY
#
# Waits until the passed number ($count_sessions) of concurrent sessions was
# observed via
# Waits until the passed number ($count_sessions) of concurrent sessions or
# a smaller number was observed via
# SHOW STATUS LIKE 'Threads_connected'
# or the operation times out.
# Note: Starting with 5.1 we could also use
# Note:
# 1. We wait for $current_sessions <= $count_sessions because in the use case
# with count_sessions.inc before and wait_until_count_sessions.inc after
# the core of the test it could happen that the disconnects of sessions
# belonging to the preceeding test are not finished.
# sessions at test begin($count_sessions) = m + n
# sessions of the previous test which will be soon disconnected = n (n >= 0)
# sessions at test end ($current sessions, assuming the test disconnects
# all additional sessions) = m
# 2. Starting with 5.1 we could also use
# SELECT COUNT(*) FROM information_schema.processlist
# I stay with "SHOW STATUS LIKE 'Threads_connected'" because this
# runs in all versions 5.0+
@ -19,7 +28,7 @@
#
# OR typical example of a test which uses more than one session
# Such a test could harm successing tests if there is no server shutdown
# and start between.cw
# and start between.
#
# If the testing box is slow than the disconnect of sessions belonging to
# the current test might happen when the successing test gets executed.
@ -79,7 +88,11 @@
# backup.test, grant3.test
#
#
# Created: 2009-01-14 mleich
# Created:
# 2009-01-14 mleich
# Modified:
# 2009-02-24 mleich Fix Bug#43114 wait_until_count_sessions too restrictive,
# random PB failures
#
let $wait_counter= 100;
@ -93,7 +106,7 @@ let $wait_timeout= 0;
while ($wait_counter)
{
let $current_sessions= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1);
let $success= `SELECT $current_sessions = $count_sessions`;
let $success= `SELECT $current_sessions <= $count_sessions`;
if ($success)
{
let $wait_counter= 0;
@ -107,7 +120,7 @@ while ($wait_counter)
if (!$success)
{
--echo # Timeout in wait_until_count_sessions.inc
--echo # Number of sessions expected: $count_sessions found: $current_sessions
--echo # Number of sessions expected: <= $count_sessions found: $current_sessions
SHOW PROCESSLIST;
}

View File

@ -0,0 +1,21 @@
#
# Include this script to wait until the connection to the
# server has been dropped
--disable_result_log
--disable_query_log
let $counter= 500;
let $mysql_errno= 0;
while (!$mysql_errno)
{
--error 0,1053,2002,2006,2013
show status;
dec $counter;
if (!$counter)
{
--die Server failed to dissapear
}
--sleep 0.1
}
--enable_query_log
--enable_result_log

View File

@ -1,15 +1,23 @@
drop table if exists t1;
create table t1 (a int) engine=innodb;
start transaction with consistent snapshot;
insert into t1 values(1);
select * from t1;
DROP TABLE IF EXISTS t1;
# Establish connection con1 (user=root)
# Establish connection con2 (user=root)
# Switch to connection con1
CREATE TABLE t1 (a INT) ENGINE=innodb;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
# Switch to connection con2
INSERT INTO t1 VALUES(1);
# Switch to connection con1
SELECT * FROM t1;
a
commit;
delete from t1;
start transaction;
insert into t1 values(1);
select * from t1;
COMMIT;
DELETE FROM t1;
START TRANSACTION;
# Switch to connection con2
INSERT INTO t1 VALUES(1);
# Switch to connection con1
SELECT * FROM t1;
a
1
commit;
drop table t1;
COMMIT;
# Switch to connection default + close connections con1 and con2
DROP TABLE t1;

View File

@ -611,3 +611,22 @@ check table t1 extended;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci)
a
create table t1
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` varchar(1) character set latin5 NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate
latin5_turkish_ci then 2 else 3 end;
case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate
latin5_turkish_ci then 2 else 3 end
3
select concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci)
abc

View File

@ -1,9 +1,9 @@
drop table if exists t1;
create table t1 (n int);
insert into t1 values (1),(2),(3);
select * from t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (n INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT * FROM t1;
n
1
2
3
drop table t1;
DROP TABLE t1;

View File

@ -155,3 +155,7 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
DROP TABLE t1,t2;
CREATE TABLE t1 (a INT PRIMARY KEY);
EXPLAIN EXTENDED SELECT COUNT(a) FROM t1 USE KEY(a);
ERROR HY000: Key 'a' doesn't exist in table 't1'
DROP TABLE t1;

View File

@ -2094,6 +2094,26 @@ SELECT t1.a FROM t1, t1 as t2 WHERE t2.b NOT LIKE t1.b;
a
DROP TABLE t1;
DROP TABLE t1;
#
# BUG#21360 - mysqldump error on federated tables
#
#Switch to Connection Slave
CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id));
INSERT INTO t1 VALUES ('text1'),('text2'),('text3'),('text4');
#Switch to Connection Master
CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id)) ENGINE=FEDERATED
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
# Dump table t1 using mysqldump tool
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
`id` varchar(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE t1;
#Switch to Connection Slave
DROP TABLE t1;
End of 5.0 tests
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_MASTER_CONCURRENT_INSERT;
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;

View File

@ -1,39 +1,57 @@
drop table if exists t1;
create table t1 (a int) engine=innodb;
begin;
insert into t1 values(1);
flush tables with read lock;
select * from t1;
# Establish connection con1 (user=root)
# Establish connection con2 (user=root)
# Establish connection con3 (user=root)
# Switch to connection con1
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT) ENGINE=innodb;
BEGIN;
INSERT INTO t1 VALUES(1);
# Switch to connection con2
FLUSH TABLES WITH READ LOCK;
SELECT * FROM t1;
a
commit;
select * from t1;
# Switch to connection con1
COMMIT;
# Switch to connection con2
SELECT * FROM t1;
a
unlock tables;
begin;
select * from t1 for update;
UNLOCK TABLES;
# Switch to connection con1
# Switch to connection con1
BEGIN;
SELECT * FROM t1 FOR UPDATE;
a
1
begin;
select * from t1 for update;
flush tables with read lock;
commit;
# Switch to connection con2
BEGIN;
SELECT * FROM t1 FOR UPDATE;
# Switch to connection con3
FLUSH TABLES WITH READ LOCK;
# Switch to connection con1
COMMIT;
# Switch to connection con2
a
1
unlock tables;
commit;
begin;
insert into t1 values(10);
flush tables with read lock;
commit;
unlock tables;
flush tables with read lock;
unlock tables;
begin;
select * from t1;
# Switch to connection con3
UNLOCK TABLES;
# Switch to connection con2
COMMIT;
# Switch to connection con1
BEGIN;
INSERT INTO t1 VALUES(10);
FLUSH TABLES WITH READ LOCK;
COMMIT;
UNLOCK TABLES;
# Switch to connection con2
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;
BEGIN;
SELECT * FROM t1;
a
1
10
show create database test;
SHOW CREATE DATABASE test;
Database Create Database
test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */
drop table t1;
DROP TABLE t1;
# Switch to connection default and close connections con1, con2, con3

View File

@ -1,15 +1,23 @@
create table t1 (a int) engine=innodb;
reset master;
set autocommit=0;
insert t1 values (1);
flush tables with read lock;
show master status;
# Establish connection con1 (user=root)
# Establish connection con2 (user=root)
# Switch to connection con1
CREATE TABLE t1 (a INT) ENGINE=innodb;
RESET MASTER;
SET AUTOCOMMIT=0;
INSERT t1 VALUES (1);
# Switch to connection con2
FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 98
commit;
show master status;
# Switch to connection con1
COMMIT;
# Switch to connection con2
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 98
unlock tables;
drop table t1;
set autocommit=1;
UNLOCK TABLES;
# Switch to connection con1
DROP TABLE t1;
SET AUTOCOMMIT=1;
# Switch to connection default and close connections con1 and con2

View File

@ -1,9 +1,12 @@
drop table if exists t1;
create table t1 (kill_id int);
insert into t1 values(connection_id());
flush tables with read lock;
select ((@id := kill_id) - kill_id) from t1;
SET @old_concurrent_insert= @@global.concurrent_insert;
SET @@global.concurrent_insert= 0;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (kill_id INT);
INSERT INTO t1 VALUES(connection_id());
FLUSH TABLES WITH READ LOCK;
SELECT ((@id := kill_id) - kill_id) FROM t1;
((@id := kill_id) - kill_id)
0
kill connection @id;
drop table t1;
KILL CONNECTION @id;
DROP TABLE t1;
SET @@global.concurrent_insert= @old_concurrent_insert;

View File

@ -51,10 +51,10 @@ ERROR HY000: Can't execute the query because you have a conflicting read lock
UNLOCK TABLES;
DROP DATABASE mysqltest_1;
ERROR HY000: Can't drop database 'mysqltest_1'; database doesn't exist
use mysql;
USE mysql;
LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
FLUSH TABLES;
use mysql;
USE mysql;
SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
OPTIMIZE TABLES columns_priv, db, host, user;
Table Op Msg_type Msg_text
@ -65,7 +65,7 @@ mysql.user optimize status OK
UNLOCK TABLES;
Select_priv
N
use test;
USE test;
use test;
CREATE TABLE t1 (c1 int);
LOCK TABLE t1 WRITE;
@ -93,7 +93,7 @@ create table t1 (a int);
connection: locker
lock tables t1 read;
connection: writer
create table t2 like t1;;
create table t2 like t1;
connection: default
kill query
ERROR 70100: Query execution was interrupted

View File

@ -0,0 +1,19 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1( a INT, b INT );
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4);
# 1. test regular tables
# 1.1. test altering of columns that multiupdate doesn't use
# 1.1.1. normal mode
# 1.1.2. PS mode
# 1.2. test altering of columns that multiupdate uses
# 1.2.1. normal mode
# 1.2.2. PS mode
ALTER TABLE t1 ADD COLUMN a INT;
# 2. test UNIONs
# 2.1. test altering of columns that multiupdate doesn't use
# 2.1.1. normal mode
# 2.1.2. PS mode
# 2.2. test altering of columns that multiupdate uses
# 2.2.1. normal mode
# 2.2.2. PS mode
DROP TABLE t1;

View File

@ -0,0 +1,17 @@
DROP TABLE IF EXISTS t1,t2,t3;
CREATE TABLE t1 (
a int(11) unsigned default NULL,
b varchar(255) default NULL,
UNIQUE KEY a (a),
KEY b (b)
);
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
CREATE TABLE t2 SELECT * FROM t1;
CREATE TABLE t3 SELECT * FROM t1;
# test altering of columns that multiupdate doesn't use
# normal mode
# PS mode
# test altering of columns that multiupdate uses
# normal mode
# PS mode
DROP TABLE t1, t2, t3;

View File

@ -27,3 +27,14 @@ CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
#
# BUG#41541 - Valgrind warnings on packed MyISAM table
#
CREATE TABLE t1(f1 VARCHAR(200), f2 TEXT);
INSERT INTO t1 VALUES ('foo', 'foo1'), ('bar', 'bar1');
FLUSH TABLE t1;
# Compress the table using MYISAMPACK tool
SELECT COUNT(*) FROM t1;
COUNT(*)
1024
DROP TABLE t1;

View File

@ -0,0 +1,10 @@
DROP TABLE IF EXISTS t1;
SET @old_max_allowed_packet= @@global.max_allowed_packet;
SET @@global.max_allowed_packet = 2 * 1024 * 1024 + 1024;
CREATE TABLE t1(data LONGBLOB);
INSERT INTO t1 SELECT REPEAT('1', 2*1024*1024);
SELECT LENGTH(data) FROM t1;
LENGTH(data)
2097152
DROP TABLE t1;
SET @@global.max_allowed_packet = @old_max_allowed_packet;

View File

@ -349,9 +349,9 @@ DELIMITER ;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
CREATE TABLE t1 (c1 CHAR(10));
flush logs;
FLUSH LOGS;
INSERT INTO t1 VALUES ('0123456789');
flush logs;
FLUSH LOGS;
DROP TABLE t1;
We expect this value to be 1
The bug being tested was that 'Query' lines were not preceded by '#'
@ -361,23 +361,23 @@ SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
BUG#28293_expect_1
1
DROP TABLE patch;
flush logs;
create table t1(a int);
insert into t1 values(connection_id());
flush logs;
drop table t1;
FLUSH LOGS;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(connection_id());
FLUSH LOGS;
DROP TABLE t1;
1
drop table t1;
DROP TABLE t1;
shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql
set @@global.server_id= 4294967295;
reset master;
flush logs;
select
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
is not null;
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
is not null
SET @@global.server_id= 4294967295;
RESET MASTER;
FLUSH LOGS;
SELECT
(@a:=LOAD_FILE("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
IS NOT NULL;
(@a:=LOAD_FILE("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
IS NOT NULL
1
*** Unsigned server_id 4294967295 is found: 1 ***
set @@global.server_id= 1;
SET @@global.server_id= 1;
End of 5.0 tests

View File

@ -3559,6 +3559,60 @@ DROP TABLE t1,t2;
-- Dump completed on DATE
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
#
# Bug #42635: mysqldump includes views that were excluded using
# the --ignore-table option
#
create database db42635;
use db42635;
create table t1 (id int);
create view db42635.v1 (c) as select * from db42635.t1;
create view db42635.v2 (c) as select * from db42635.t1;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
`id` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` (
`c` int(11)
) ENGINE=MyISAM */;
/*!50001 DROP TABLE `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v2` AS select `t1`.`id` AS `c` from `t1` */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
use test;
drop database db42635;
#
# Bug#33550 mysqldump 4.0 compatibility broken
#
SET NAMES utf8;

View File

@ -129,9 +129,11 @@ create table t7 engine=myisam as select * from t7_c;
create table t8 engine=myisam as select * from t8_c;
create table t9 engine=myisam as select * from t9_c;
create table t10 engine=myisam as select * from t10_c;
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
(id INT, backup_id INT) ENGINE = MEMORY;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat'
INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id
<the_backup_id>

View File

@ -227,9 +227,11 @@ hex(h3) NULL
hex(i1) NULL
hex(i2) NULL
hex(i3) NULL
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
(id INT, backup_id INT) ENGINE = MEMORY;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat'
INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
@ -261,9 +263,11 @@ create table t4 (pk int key, a int) engine ndb;
insert into t2 values (1,11),(2,12),(3,13),(4,14),(5,15);
insert into t3 values (1,21),(2,22),(3,23),(4,24),(5,25);
insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35);
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
(id INT, backup_id INT) ENGINE = MEMORY;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat'
INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
@ -305,9 +309,11 @@ create table t1
insert into t1 values(1, 8388607, 16777215);
insert into t1 values(2, -8388608, 0);
insert into t1 values(3, -1, 1);
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
(id INT, backup_id INT) ENGINE = MEMORY;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat'
INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id
<the_backup_id>

View File

@ -153,4 +153,23 @@ a b
SET @@session.time_zone = default;
DROP TABLE t1;
SET @@session.time_zone = default;
reset master;
CREATE TABLE t1 (date timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, a int(11) default NULL);
SET @@session.time_zone='+01:00';
insert into t1 values('2008-12-23 19:39:39',1);
SET @@session.time_zone='+02:00';
insert delayed into t1 values ('2008-12-23 19:39:39',2);
flush table t1;
flush logs;
select * from t1;
date a
2008-12-23 20:39:39 1
2008-12-23 19:39:39 2
DROP TABLE t1;
select * from t1 order by a;
date a
2008-12-23 20:39:39 1
2008-12-23 19:39:39 2
DROP TABLE t1;
SET @@session.time_zone = default;
End of 5.0 tests

View File

@ -2152,4 +2152,11 @@ Warnings:
Warning 1052 Column 'kundentyp' in group statement is ambiguous
drop table t1;
mysqld is alive
SET @max_allowed_packet= @@global.max_allowed_packet;
SET @net_buffer_length= @@global.net_buffer_length;
SET GLOBAL max_allowed_packet= 1024;
SET GLOBAL net_buffer_length= 1024;
ERROR 1153 (08S01) at line 1: Got a packet bigger than 'max_allowed_packet' bytes
SET GLOBAL max_allowed_packet= @max_allowed_packet;
SET GLOBAL net_buffer_length= @net_buffer_length;
End of 5.0 tests.

View File

@ -5,10 +5,10 @@ GRANT USAGE ON *.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255'
GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255'
REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255';
DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
select user();
user()
SELECT USER();
USER()
#
show processlist;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
<id> root <host> test <command> <time> <state> <info>
<id> root <host> test <command> <time> <state> <info>

View File

@ -332,7 +332,7 @@ ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table
drop user user_bug14533@localhost;
drop database db_bug14533;
CREATE DATABASE db_bug7787;
use db_bug7787;
USE db_bug7787;
CREATE PROCEDURE p1()
SHOW INNODB STATUS;
Warnings:
@ -352,12 +352,12 @@ GRANT SUPER ON *.* TO mysqltest_2@localhost;
GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
---> connection: mysqltest_2_con
use mysqltest;
USE mysqltest;
CREATE PROCEDURE wl2897_p1() SELECT 1;
CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1;
---> connection: mysqltest_1_con
use mysqltest;
USE mysqltest;
CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2;
ERROR 42000: Access denied; you need the SUPER privilege for this operation
CREATE DEFINER=root@localhost FUNCTION wl2897_f2() RETURNS INT RETURN 2;
@ -373,7 +373,7 @@ Warnings:
Note 1449 There is no 'a @ b @ c'@'localhost' registered
---> connection: con1root
use mysqltest;
USE mysqltest;
SHOW CREATE PROCEDURE wl2897_p1;
Procedure sql_mode Create Procedure
wl2897_p1 CREATE DEFINER=`mysqltest_2`@`localhost` PROCEDURE `wl2897_p1`()
@ -403,7 +403,7 @@ CREATE USER mysqltest_2@localhost;
GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
---> connection: mysqltest_1_con
use mysqltest;
USE mysqltest;
CREATE PROCEDURE bug13198_p1()
SELECT 1;
CREATE FUNCTION bug13198_f1() RETURNS INT
@ -416,7 +416,7 @@ bug13198_f1()
1
---> connection: mysqltest_2_con
use mysqltest;
USE mysqltest;
CALL bug13198_p1();
1
1
@ -428,7 +428,7 @@ bug13198_f1()
DROP USER mysqltest_1@localhost;
---> connection: mysqltest_2_con
use mysqltest;
USE mysqltest;
CALL bug13198_p1();
ERROR HY000: There is no 'mysqltest_1'@'localhost' registered
SELECT bug13198_f1();
@ -445,7 +445,7 @@ Host User Password
localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C
---> connection: mysqltest_2_con
use test;
USE test;
CREATE PROCEDURE sp19857() DETERMINISTIC
BEGIN
DECLARE a INT;

View File

@ -1447,12 +1447,12 @@ SELECT a FROM t1
UNION
SELECT a FROM t1
) alias;
SELECT a INTO OUTFILE 'union.out.file' FROM (
SELECT a INTO OUTFILE '<MYSQLTEST_VARDIR>/tmp/union.out.file' FROM (
SELECT a FROM t1
UNION
SELECT a FROM t1 WHERE 0
) alias;
SELECT a INTO DUMPFILE 'union.out.file2' FROM (
SELECT a INTO DUMPFILE '<MYSQLTEST_VARDIR>/tmp/union.out.file' FROM (
SELECT a FROM t1
UNION
SELECT a FROM t1 WHERE 0
@ -1465,21 +1465,21 @@ SELECT a INTO @v FROM t1
SELECT a FROM (
SELECT a FROM t1
UNION
SELECT a INTO OUTFILE 'union.out.file3' FROM t1
SELECT a INTO OUTFILE '<MYSQLTEST_VARDIR>/tmp/union.out.file' FROM t1
) alias;
SELECT a FROM (
SELECT a FROM t1
UNION
SELECT a INTO DUMPFILE 'union.out.file4' FROM t1
SELECT a INTO DUMPFILE '<MYSQLTEST_VARDIR>/tmp/union.out.file' FROM t1
) alias;
SELECT a FROM t1 UNION SELECT a INTO @v FROM t1;
SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file5' FROM t1;
SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file6' FROM t1;
SELECT a FROM t1 UNION SELECT a INTO OUTFILE '<MYSQLTEST_VARDIR>/tmp/union.out.file' FROM t1;
SELECT a FROM t1 UNION SELECT a INTO DUMPFILE '<MYSQLTEST_VARDIR>/tmp/union.out.file' FROM t1;
SELECT a INTO @v FROM t1 UNION SELECT a FROM t1;
ERROR HY000: Incorrect usage of UNION and INTO
SELECT a INTO OUTFILE 'union.out.file7' FROM t1 UNION SELECT a FROM t1;
SELECT a INTO OUTFILE '<MYSQLTEST_VARDIR>/tmp/union.out.file' FROM t1 UNION SELECT a FROM t1;
ERROR HY000: Incorrect usage of UNION and INTO
SELECT a INTO DUMPFILE 'union.out.file8' FROM t1 UNION SELECT a FROM t1;
SELECT a INTO DUMPFILE '<MYSQLTEST_VARDIR>/tmp/union.out.file' FROM t1 UNION SELECT a FROM t1;
ERROR HY000: Incorrect usage of UNION and INTO
DROP TABLE t1;
CREATE TABLE t1 (a INT);

View File

@ -3603,7 +3603,7 @@ DROP VIEW v2;
DROP VIEW v3;
DROP TABLE t1;
#
# Bug#29477: Not all fields of the target table were checked to have
# Bug#29477 Not all fields of the target table were checked to have
# a default value when inserting into a view.
#
create table t1(f1 int, f2 int not null);
@ -3643,7 +3643,7 @@ MAX(a) COUNT(DISTINCT a)
DROP VIEW v1;
DROP TABLE t1;
# -----------------------------------------------------------------
# -- Bug#34337: Server crash when Altering a view using a table name.
# -- Bug#34337 Server crash when Altering a view using a table name.
# -----------------------------------------------------------------
DROP TABLE IF EXISTS t1;
@ -3660,7 +3660,7 @@ DROP TABLE t1;
# -- End of test case for Bug#34337.
# -----------------------------------------------------------------
# -- Bug#35193: VIEW query is rewritten without "FROM DUAL",
# -- Bug#35193 VIEW query is rewritten without "FROM DUAL",
# -- causing syntax error
# -----------------------------------------------------------------

View File

@ -788,7 +788,7 @@ v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
DROP USER u26813@localhost;
DROP DATABASE db26813;
#
# Bug#29908: A user can gain additional access through the ALTER VIEW.
# Bug#29908 A user can gain additional access through the ALTER VIEW.
#
CREATE DATABASE mysqltest_29908;
USE mysqltest_29908;

View File

@ -5245,7 +5245,7 @@ WHERE select_id = 1 OR select_id IS NULL order by id;
sqrt(my_bigint) my_bigint id
NULL NULL 1
NULL -9223372036854775808 2
3037000499.976 9223372036854775807 3
3037000499.97605 9223372036854775807 3
0 0 4
NULL -1 5
2 4 6
@ -5259,7 +5259,7 @@ WHERE select_id = 1 OR select_id IS NULL) order by id;
sqrt(my_bigint) my_bigint id
NULL NULL 1
NULL -9223372036854775808 2
3037000499.976 9223372036854775807 3
3037000499.97605 9223372036854775807 3
0 0 4
NULL -1 5
2 4 6

View File

@ -22824,7 +22824,7 @@ f1 f2
ABC 3
SELECT * FROM v1 order by 2;
f1 my_sqrt
ABC 1.7320508075689
ABC 1.73205080756888
ALTER TABLE t1 CHANGE COLUMN f2 f2 VARCHAR(30);
INSERT INTO t1 SET f1 = 'ABC', f2 = 'DEF';
DESCRIBE t1;
@ -22842,7 +22842,7 @@ ABC DEF
SELECT * FROM v1 order by 2;
f1 my_sqrt
ABC 0
ABC 1.7320508075689
ABC 1.73205080756888
SELECT SQRT('DEF');
SQRT('DEF')
0
@ -22862,7 +22862,7 @@ my_sqrt double YES NULL
SELECT * FROM v2 order by 2;
f1 my_sqrt
ABC 0
ABC 1.7320508075689
ABC 1.73205080756888
CREATE TABLE t2 AS SELECT f1, SQRT(f2) my_sqrt FROM t1;
SELECT * FROM t2 order by 2;
f1 ABC

View File

@ -23043,7 +23043,7 @@ ERROR 42S02: Table 'test.v1' doesn't exist
CHECK TABLE v1;
Table Op Msg_type Msg_text
test.v1 check Error Table 'test.v1' doesn't exist
test.v1 check error Corrupt
test.v1 check status Operation failed
DESCRIBE v1;
ERROR 42S02: Table 'test.v1' doesn't exist
EXPLAIN SELECT * FROM v1;

View File

@ -1,4 +1,4 @@
# In order to be more or less robust test for bug#25044 has to take
# In order to be more or less robust test for Bug#25044 has to take
# significant time (e.g. about 9 seconds on my (Dmitri's) computer)
# so we probably want execute it only in --big-test mode.
# Also in 5.1 this test will require statement-based binlog.
@ -6,8 +6,8 @@
#
# Test for bug #25044 "ALTER TABLE ... ENABLE KEYS acquires global
# 'opening tables' lock".
# Test for Bug#25044 ALTER TABLE ... ENABLE KEYS acquires global
# 'opening tables' lock
#
# ALTER TABLE ... ENABLE KEYS should not acquire LOCK_open mutex for
# the whole its duration as it prevents other queries from execution.
@ -57,6 +57,7 @@ show binlog events in 'master-bin.000001' from 98;
# Clean up
drop tables t1, t2;
disconnect addconroot;
--echo End of 5.0 tests

View File

@ -18,12 +18,16 @@ connect (con2,localhost,root,,test);
show tables;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,root,z,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,root,z,);
connection default;
disconnect con1;
disconnect con2;
grant ALL on *.* to test@localhost identified by "gambling";
grant ALL on *.* to test@127.0.0.1 identified by "gambling";
@ -35,20 +39,23 @@ show tables;
connect (con4,localhost,test,gambling,test);
show tables;
connection default;
disconnect con3;
disconnect con4;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,"");
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,);
# check if old password version also works
update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges;
@ -57,30 +64,34 @@ connect (con10,localhost,test,gambling2,);
connect (con5,localhost,test,gambling2,mysql);
connection con5;
set password="";
--error 1372
--error ER_PASSWD_LENGTH
set password='gambling3';
set password=old_password('gambling3');
show tables;
connect (con6,localhost,test,gambling3,test);
show tables;
connection default;
disconnect con10;
disconnect con5;
disconnect con6;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,);
# remove user 'test' so that other tests which may use 'test'
# do not depend on this test.
delete from mysql.user where user=_binary"test";
flush privileges;
@ -98,4 +109,5 @@ disconnect con7;
connection default;
drop table t1;
# End of 4.1 tests

View File

@ -1,43 +1,61 @@
--source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
drop table if exists t1;
DROP TABLE IF EXISTS t1;
--enable_warnings
--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,);
--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,);
### Test 1:
### - While a consistent snapshot transaction is executed,
### no external inserts should be visible to the transaction.
--echo # Switch to connection con1
connection con1;
create table t1 (a int) engine=innodb;
start transaction with consistent snapshot;
CREATE TABLE t1 (a INT) ENGINE=innodb;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
--echo # Switch to connection con2
connection con2;
insert into t1 values(1);
INSERT INTO t1 VALUES(1);
--echo # Switch to connection con1
connection con1;
select * from t1; # if consistent snapshot was set as expected, we
SELECT * FROM t1; # if consistent snapshot was set as expected, we
# should see nothing.
commit;
COMMIT;
### Test 2:
### - For any non-consistent snapshot transaction, external
### committed inserts should be visible to the transaction.
delete from t1;
start transaction; # Now we omit WITH CONSISTENT SNAPSHOT
DELETE FROM t1;
START TRANSACTION; # Now we omit WITH CONSISTENT SNAPSHOT
--echo # Switch to connection con2
connection con2;
insert into t1 values(1);
INSERT INTO t1 VALUES(1);
--echo # Switch to connection con1
connection con1;
select * from t1; # if consistent snapshot was not set, as expected, we
SELECT * FROM t1; # if consistent snapshot was not set, as expected, we
# should see 1.
commit;
COMMIT;
drop table t1;
--echo # Switch to connection default + close connections con1 and con2
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t1;
# End of 4.1 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -229,3 +229,17 @@ insert into t1 set a=0x6c;
insert into t1 set a=0x4c98;
check table t1 extended;
drop table t1;
#
# Bug#41627 Illegal mix of collations in LEAST / GREATEST / CASE
#
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
create table t1
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1;
show create table t1;
drop table t1;
select case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate
latin5_turkish_ci then 2 else 3 end;
select concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);

View File

@ -1,3 +1,7 @@
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
@ -5,12 +9,19 @@ dirty_close con1;
connection con2;
--disable_warnings
drop table if exists t1;
DROP TABLE IF EXISTS t1;
--enable_warnings
create table t1 (n int);
insert into t1 values (1),(2),(3);
select * from t1;
drop table t1;
CREATE TABLE t1 (n INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT * FROM t1;
DROP TABLE t1;
connection default;
disconnect con2;
# End of 4.1 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -123,4 +123,17 @@ execute s1;
DROP TABLE t1,t2;
#
# Bug #43354: Use key hint can crash server in explain extended query
#
CREATE TABLE t1 (a INT PRIMARY KEY);
--error ER_KEY_DOES_NOT_EXITS
EXPLAIN EXTENDED SELECT COUNT(a) FROM t1 USE KEY(a);
DROP TABLE t1;
# End of 5.0 tests.

View File

@ -1843,6 +1843,28 @@ DROP TABLE t1;
connection master;
DROP TABLE t1;
--echo #
--echo # BUG#21360 - mysqldump error on federated tables
--echo #
connection slave;
--echo #Switch to Connection Slave
CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id));
INSERT INTO t1 VALUES ('text1'),('text2'),('text3'),('text4');
connection master;
--echo #Switch to Connection Master
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id)) ENGINE=FEDERATED
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
--echo # Dump table t1 using mysqldump tool
--replace_result $SLAVE_MYPORT SLAVE_PORT
--exec $MYSQL_DUMP --compact test t1
DROP TABLE t1;
connection slave;
--echo #Switch to Connection Slave
DROP TABLE t1;
connection default;
--echo End of 5.0 tests

View File

@ -6,72 +6,104 @@
# And it requires InnoDB
--source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,);
--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,);
--echo # Establish connection con3 (user=root)
connect (con3,localhost,root,,);
--echo # Switch to connection con1
connection con1;
--disable_warnings
drop table if exists t1;
DROP TABLE IF EXISTS t1;
--enable_warnings
create table t1 (a int) engine=innodb;
CREATE TABLE t1 (a INT) ENGINE=innodb;
# blocks COMMIT ?
begin;
insert into t1 values(1);
BEGIN;
INSERT INTO t1 VALUES(1);
--echo # Switch to connection con2
connection con2;
flush tables with read lock;
select * from t1;
FLUSH TABLES WITH READ LOCK;
SELECT * FROM t1;
--echo # Switch to connection con1
connection con1;
send commit; # blocked by con2
send COMMIT; # blocked by con2
sleep 1;
--echo # Switch to connection con2
connection con2;
select * from t1; # verify con1 was blocked and data did not move
unlock tables;
SELECT * FROM t1; # verify con1 was blocked and data did not move
UNLOCK TABLES;
--echo # Switch to connection con1
connection con1;
reap;
# No deadlock ?
--echo # Switch to connection con1
connection con1;
begin;
select * from t1 for update;
BEGIN;
SELECT * FROM t1 FOR UPDATE;
--echo # Switch to connection con2
connection con2;
begin;
send select * from t1 for update; # blocked by con1
BEGIN;
send SELECT * FROM t1 FOR UPDATE; # blocked by con1
sleep 1;
--echo # Switch to connection con3
connection con3;
send flush tables with read lock; # blocked by con2
send FLUSH TABLES WITH READ LOCK; # blocked by con2
--echo # Switch to connection con1
connection con1;
commit; # should not be blocked by con3
COMMIT; # should not be blocked by con3
--echo # Switch to connection con2
connection con2;
reap;
--echo # Switch to connection con3
connection con3;
reap;
unlock tables;
UNLOCK TABLES;
# BUG#6732 FLUSH TABLES WITH READ LOCK + COMMIT hangs later FLUSH TABLES
# Bug#6732 FLUSH TABLES WITH READ LOCK + COMMIT hangs later FLUSH TABLES
# WITH READ LOCK
--echo # Switch to connection con2
connection con2;
commit; # unlock InnoDB row locks to allow insertions
COMMIT; # unlock InnoDB row locks to allow insertions
--echo # Switch to connection con1
connection con1;
begin;
insert into t1 values(10);
flush tables with read lock;
commit;
unlock tables;
BEGIN;
INSERT INTO t1 VALUES(10);
FLUSH TABLES WITH READ LOCK;
COMMIT;
UNLOCK TABLES;
--echo # Switch to connection con2
connection con2;
flush tables with read lock; # bug caused hang here
unlock tables;
FLUSH TABLES WITH READ LOCK; # bug caused hang here
UNLOCK TABLES;
# BUG#7358 SHOW CREATE DATABASE fails if open transaction
# Bug#7358 SHOW CREATE DATABASE fails if open transaction
begin;
select * from t1;
show create database test;
BEGIN;
SELECT * FROM t1;
SHOW CREATE DATABASE test;
drop table t1;
DROP TABLE t1;
# Cleanup
--echo # Switch to connection default and close connections con1, con2, con3
connection default;
disconnect con1;
disconnect con2;
disconnect con3;
# End of 4.1 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -9,26 +9,45 @@
--source include/have_log_bin.inc
--source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,);
--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,);
# FLUSH TABLES WITH READ LOCK should block writes to binlog too
--echo # Switch to connection con1
connection con1;
create table t1 (a int) engine=innodb;
reset master;
set autocommit=0;
insert t1 values (1);
CREATE TABLE t1 (a INT) ENGINE=innodb;
RESET MASTER;
SET AUTOCOMMIT=0;
INSERT t1 VALUES (1);
--echo # Switch to connection con2
connection con2;
flush tables with read lock;
show master status;
FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;
--echo # Switch to connection con1
connection con1;
send commit;
send COMMIT;
--echo # Switch to connection con2
connection con2;
sleep 1;
show master status;
unlock tables;
SHOW MASTER STATUS;
UNLOCK TABLES;
--echo # Switch to connection con1
connection con1;
reap;
drop table t1;
set autocommit=1;
DROP TABLE t1;
SET AUTOCOMMIT=1;
--echo # Switch to connection default and close connections con1 and con2
connection default;
disconnect con1;
disconnect con2;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -12,15 +12,23 @@
--source include/have_debug.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# Disable concurrent inserts to avoid test failures when reading the
# connection id which was inserted into a table by another thread.
SET @old_concurrent_insert= @@global.concurrent_insert;
SET @@global.concurrent_insert= 0;
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
--disable_warnings
drop table if exists t1;
DROP TABLE IF EXISTS t1;
--enable_warnings
create table t1 (kill_id int);
insert into t1 values(connection_id());
CREATE TABLE t1 (kill_id INT);
INSERT INTO t1 VALUES(connection_id());
# Thanks to the parameter we passed to --debug, this FLUSH will
# block on a debug build running with our --debug=make_global... It
@ -28,14 +36,14 @@ insert into t1 values(connection_id());
# --debug) it will succeed immediately
connection con1;
send flush tables with read lock;
send FLUSH TABLES WITH READ LOCK;
# kill con1
connection con2;
select ((@id := kill_id) - kill_id) from t1;
SELECT ((@id := kill_id) - kill_id) FROM t1;
--sleep 2 # leave time for FLUSH to block
kill connection @id;
KILL CONNECTION @id;
connection con1;
# On debug builds it will be error 1053 (killed); on non-debug, or
@ -46,4 +54,13 @@ connection con1;
reap;
connection con2;
drop table t1;
DROP TABLE t1;
connection default;
disconnect con2;
# Restore global concurrent_insert value
SET @@global.concurrent_insert= @old_concurrent_insert;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -5,6 +5,9 @@
# should work with embedded server after mysqltest is fixed
--source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--source include/add_anonymous_users.inc
connect (con0,localhost,root,,);
@ -233,7 +236,8 @@ connect (con1,localhost,mysqltest1,,);
connection con1;
select * from t1;
connection con0;
connection default;
disconnect con0;
disconnect con1;
drop trigger trg1;
@ -244,3 +248,7 @@ set global init_connect="set @a='a\\0c'";
revoke all privileges, grant option from mysqltest1@localhost;
drop user mysqltest1@localhost;
drop table t1, t2;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,4 +1,8 @@
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
@ -14,12 +18,23 @@ create table t1(n int);
insert into t1 values (1);
lock tables t1 write;
connection writer;
send update low_priority t1 set n = 4;
send
update low_priority t1 set n = 4;
connection reader;
--sleep 2
send select n from t1;
# Sleep a bit till the update of connection writer is in work and hangs
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Locked';
--source include/wait_show_condition.inc
send
select n from t1;
connection locker;
--sleep 2
# Sleep a bit till the select of connection reader is in work and hangs
# Here we cannot use include/wait_show_condition.inc because this routine
# cannot count the number of 'Locked' sessions or access two columns within
# the same query_get_value call.
--sleep 3
unlock tables;
connection writer;
reap;
@ -32,12 +47,23 @@ create table t1(n int);
insert into t1 values (1);
lock tables t1 read;
connection writer;
send update low_priority t1 set n = 4;
send
update low_priority t1 set n = 4;
connection reader;
--sleep 2
send select n from t1;
# Sleep a bit till the update of connection writer is in work and hangs
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Locked';
--source include/wait_show_condition.inc
#
send
select n from t1;
connection locker;
--sleep 2
# Sleep a bit till the select of connection reader is in work and hangs
# Here we cannot use include/wait_show_condition.inc.
--sleep 3
#
unlock tables;
connection writer;
reap;
@ -58,10 +84,13 @@ insert into t1 values(2,2);
insert into t2 values(1,2);
lock table t1 read;
connection writer;
--sleep 2
send update t1,t2 set c=a where b=d;
send
update t1,t2 set c=a where b=d;
connection reader;
--sleep 2
# Sleep a bit till the update of connection writer is finished
# Here we cannot use include/wait_show_condition.inc.
--sleep 3
#
select c from t2;
connection writer;
reap;
@ -70,7 +99,7 @@ drop table t1;
drop table t2;
#
# Test problem when using locks on many tables and droping a table that
# Test problem when using locks on many tables and dropping a table that
# is to-be-locked by another thread
#
@ -79,11 +108,18 @@ create table t1 (a int);
create table t2 (a int);
lock table t1 write, t2 write;
connection reader;
send insert t1 select * from t2;
send
insert t1 select * from t2;
connection locker;
# Sleep a bit till the insert of connection reader is in work and hangs
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Locked';
--source include/wait_show_condition.inc
drop table t2;
connection reader;
--error 1146
--error ER_NO_SUCH_TABLE
reap;
connection locker;
drop table t1;
@ -91,7 +127,7 @@ drop table t1;
# End of 4.1 tests
#
# BUG#9998 - MySQL client hangs on USE "database"
# Bug#9998 MySQL client hangs on USE "database"
#
create table t1(a int);
lock tables t1 write;
@ -102,7 +138,7 @@ unlock tables;
drop table t1;
#
# Bug#19815 - CREATE/RENAME/DROP DATABASE can deadlock on a global read lock
# Bug#19815 CREATE/RENAME/DROP DATABASE can deadlock on a global read lock
#
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
@ -114,12 +150,18 @@ FLUSH TABLES WITH READ LOCK;
# With bug in place: acquire LOCK_mysql_create_table and
# wait in wait_if_global_read_lock().
connection con2;
send DROP DATABASE mysqltest_1;
--sleep 1
send
DROP DATABASE mysqltest_1;
#
# With bug in place: try to acquire LOCK_mysql_create_table...
# When fixed: Reject dropping db because of the read lock.
connection con1;
# Wait a bit so that the session con2 is in state "Waiting for release of readlock"
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Waiting for release of readlock';
--source include/wait_show_condition.inc
--error ER_CANT_UPDATE_WITH_READLOCK
DROP DATABASE mysqltest_1;
UNLOCK TABLES;
@ -135,26 +177,33 @@ disconnect con2;
--error ER_DB_DROP_EXISTS
DROP DATABASE mysqltest_1;
#
# Bug#16986 - Deadlock condition with MyISAM tables
# Bug#16986 Deadlock condition with MyISAM tables
#
# Need a matching user in mysql.user for multi-table select
--source include/add_anonymous_users.inc
connection locker;
use mysql;
USE mysql;
LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
FLUSH TABLES;
--sleep 1
#
connection reader;
use mysql;
#NOTE: This must be a multi-table select, otherwise the deadlock will not occur
send SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
--sleep 1
USE mysql;
# Note: This must be a multi-table select, otherwise the deadlock will not occur
send
SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
#
connection locker;
# Sleep a bit till the select of connection reader is in work and hangs
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Locked';
--source include/wait_show_condition.inc
# Make test case independent from earlier grants.
--replace_result "Table is already up to date" "OK"
OPTIMIZE TABLES columns_priv, db, host, user;
@ -162,7 +211,7 @@ UNLOCK TABLES;
#
connection reader;
reap;
use test;
USE test;
#
connection locker;
use test;
@ -177,11 +226,17 @@ LOCK TABLE t1 WRITE;
#
# This waits until t1 is unlocked.
connection locker;
send FLUSH TABLES WITH READ LOCK;
--sleep 1
send
FLUSH TABLES WITH READ LOCK;
#
# This must not block.
connection writer;
# Sleep a bit till the flush of connection locker is in work and hangs
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Flushing tables';
--source include/wait_show_condition.inc
CREATE TABLE t2 (c1 int);
UNLOCK TABLES;
#
@ -201,12 +256,18 @@ LOCK TABLE t1 WRITE;
#
# This waits until t1 is unlocked.
connection locker;
send FLUSH TABLES WITH READ LOCK;
--sleep 1
send
FLUSH TABLES WITH READ LOCK;
#
# This must not block.
connection writer;
--error 1100
# Sleep a bit till the flush of connection locker is in work and hangs
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Flushing tables';
--source include/wait_show_condition.inc
--error ER_TABLE_NOT_LOCKED
CREATE TABLE t2 AS SELECT * FROM t1;
UNLOCK TABLES;
#
@ -220,8 +281,9 @@ DROP TABLE t1;
--source include/delete_anonymous_users.inc
#
# Bug #17264: MySQL Server freeze
# Bug#17264 MySQL Server freeze
#
connection locker;
# Disable warnings to allow test to run also without InnoDB
@ -230,17 +292,29 @@ create table t1 (f1 int(12) unsigned not null auto_increment, primary key(f1)) e
--enable_warnings
lock tables t1 write;
connection writer;
--sleep 2
# mleich: I have doubts if the next sleep is really necessary
# Therefore I set it to comment but don't remove it
# in case it hat to be enabled again.
# --sleep 2
delimiter //;
send alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
send
alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
delimiter ;//
connection reader;
--sleep 2
# Wait till connection writer is blocked
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Locked';
--source include/wait_show_condition.inc
delimiter //;
send alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
send
alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
delimiter ;//
connection locker;
--sleep 2
# Wait till connection reader is blocked
# Here we cannot use include/wait_show_condition.inc.
--sleep 3
unlock tables;
connection writer;
reap;
@ -263,7 +337,7 @@ lock tables t1 read;
--echo connection: writer
connection writer;
let $ID= `select connection_id()`;
--send create table t2 like t1;
send create table t2 like t1;
--echo connection: default
connection default;
let $show_type= open tables where in_use=2 and name_locked=1;
@ -282,7 +356,7 @@ connection default;
drop table t1;
#
# Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
# Bug#38691 segfault/abort in ``UPDATE ...JOIN'' while
# ``FLUSH TABLES WITH READ LOCK''
#
@ -354,7 +428,7 @@ while ($i) {
dec $i;
--connection locker
--error 0,1060
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t2 SET a=b;
@ -362,11 +436,11 @@ while ($i) {
--send UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) SET a = NULL WHERE t1.b <> t2.b
--connection locker
--error 0,1091
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP COLUMN a;
--connection writer
--error 0,1054
--error 0,ER_BAD_FIELD_ERROR
--reap
}
--enable_query_log
@ -379,7 +453,7 @@ while ($i) {
dec $i;
--connection locker
--error 0,1060
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t2 SET a=b;
@ -388,11 +462,11 @@ while ($i) {
--send EXECUTE stmt
--connection locker
--error 0,1091
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP COLUMN a;
--connection writer
--error 0,1054
--error 0,ER_BAD_FIELD_ERROR
--reap
}
@ -400,6 +474,7 @@ while ($i) {
--connection default
DROP TABLE t1, t2, t3;
#
# Bug#38499: flush tables and multitable table update with derived table cause
# crash
@ -460,7 +535,7 @@ while ($i) {
dec $i;
--connection locker
--error 0,1060
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t1 SET a=b;
@ -468,11 +543,11 @@ while ($i) {
--send UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0;
--connection locker
--error 0,1091
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,1054 # unknown column error
--error 0,ER_BAD_FIELD_ERROR # unknown column error
--reap
}
--enable_query_log
@ -485,7 +560,7 @@ while ($i) {
dec $i;
--connection locker
--error 0,1060
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a INT;
UPDATE t1 SET a=b;
@ -494,11 +569,11 @@ while ($i) {
--send EXECUTE stmt
--connection locker
--error 0,1091
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,1054 # Unknown column 'a' in 'field list'
--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap
}
--enable_query_log
@ -557,7 +632,7 @@ while ($i) {
dec $i;
--connection locker
--error 0,1060
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t1 SET a=b;
@ -565,11 +640,11 @@ while ($i) {
--send UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0;
--connection locker
--error 0,1091
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,1054 # Unknown column 'a' in 'field list'
--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap
}
--enable_query_log
@ -582,7 +657,7 @@ while ($i) {
dec $i;
--connection locker
--error 0,1060
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a INT;
UPDATE t1 SET a=b;
@ -591,15 +666,25 @@ while ($i) {
--send EXECUTE stmt
--connection locker
--error 0,1091
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,1054 # Unknown column 'a' in 'field list'
--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap
}
--enable_query_log
--connection default
DROP TABLE t1;
# Close connections used in many subtests
--disconnect reader
--disconnect locker
--disconnect writer
# End of 5.0 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -0,0 +1,221 @@
# Bug38499 flush tables and multitable table update with derived table cause crash
# MySQL >= 5.0
#
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (locker,localhost,root,,);
connect (writer,localhost,root,,);
--connection default
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1( a INT, b INT );
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4);
--echo # 1. test regular tables
--echo # 1.1. test altering of columns that multiupdate doesn't use
--echo # 1.1.1. normal mode
--disable_query_log
let $i = 100;
while ($i) {
--dec $i
--connection writer
send UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0;
--connection locker
ALTER TABLE t1 ADD COLUMN (c INT);
ALTER TABLE t1 DROP COLUMN c;
--connection writer
--reap
}
--echo # 1.1.2. PS mode
--connection writer
PREPARE stmt FROM 'UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0';
let $i = 100;
while ($i) {
--dec $i
--connection writer
--send EXECUTE stmt
--connection locker
ALTER TABLE t1 ADD COLUMN (c INT);
ALTER TABLE t1 DROP COLUMN c;
--connection writer
--reap
}
--enable_query_log
--echo # 1.2. test altering of columns that multiupdate uses
--echo # 1.2.1. normal mode
--connection default
--disable_query_log
let $i = 100;
while ($i) {
dec $i;
--connection locker
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t1 SET a=b;
--connection writer
--send UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0;
--connection locker
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,ER_BAD_FIELD_ERROR # unknown column error
--reap
}
--enable_query_log
--echo # 1.2.2. PS mode
--disable_query_log
let $i = 100;
while ($i) {
dec $i;
--connection locker
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a INT;
UPDATE t1 SET a=b;
--connection writer
PREPARE stmt FROM 'UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0';
--send EXECUTE stmt
--connection locker
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap
}
--enable_query_log
--connection default
ALTER TABLE t1 ADD COLUMN a INT;
--echo # 2. test UNIONs
--echo # 2.1. test altering of columns that multiupdate doesn't use
--echo # 2.1.1. normal mode
--disable_query_log
let $i = 100;
while ($i) {
--dec $i
--connection writer
send UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0;
--connection locker
ALTER TABLE t1 ADD COLUMN (c INT);
ALTER TABLE t1 DROP COLUMN c;
--connection writer
--reap
}
--echo # 2.1.2. PS mode
--connection writer
PREPARE stmt FROM 'UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0';
let $i = 100;
while ($i) {
--dec $i
--connection writer
--send EXECUTE stmt
--connection locker
ALTER TABLE t1 ADD COLUMN (c INT);
ALTER TABLE t1 DROP COLUMN c;
--connection writer
--reap
}
--enable_query_log
--echo # 2.2. test altering of columns that multiupdate uses
--echo # 2.2.1. normal mode
--connection default
--disable_query_log
let $i = 100;
while ($i) {
dec $i;
--connection locker
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t1 SET a=b;
--connection writer
--send UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0;
--connection locker
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap
}
--enable_query_log
--echo # 2.2.2. PS mode
--disable_query_log
let $i = 100;
while ($i) {
dec $i;
--connection locker
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a INT;
UPDATE t1 SET a=b;
--connection writer
PREPARE stmt FROM 'UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0';
--send EXECUTE stmt
--connection locker
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap
}
--enable_query_log
--connection default
DROP TABLE t1;
# Close connections
--disconnect locker
--disconnect writer
# End of 5.0 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -0,0 +1,141 @@
#
# Bug#38691 segfault/abort in ``UPDATE ...JOIN'' while
# ``FLUSH TABLES WITH READ LOCK''
# MySQL >= 5.0
#
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# Test to see if select will get the lock ahead of low priority update
connect (locker,localhost,root,,);
connect (writer,localhost,root,,);
--connection default
--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3;
--enable_warnings
CREATE TABLE t1 (
a int(11) unsigned default NULL,
b varchar(255) default NULL,
UNIQUE KEY a (a),
KEY b (b)
);
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
CREATE TABLE t2 SELECT * FROM t1;
CREATE TABLE t3 SELECT * FROM t1;
--echo # test altering of columns that multiupdate doesn't use
--echo # normal mode
--disable_query_log
let $i = 100;
while ($i) {
--dec $i
--connection writer
send UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a)
SET a = NULL WHERE t1.b <> t2.b;
--connection locker
ALTER TABLE t2 ADD COLUMN (c INT);
ALTER TABLE t2 DROP COLUMN c;
--connection writer
--reap
}
--echo # PS mode
--connection writer
PREPARE stmt FROM 'UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a)
SET a = NULL WHERE t1.b <> t2.b';
let $i = 100;
while ($i) {
--dec $i
--connection writer
--send EXECUTE stmt
--connection locker
ALTER TABLE t2 ADD COLUMN (c INT);
ALTER TABLE t2 DROP COLUMN c;
--connection writer
--reap
}
--enable_query_log
--echo # test altering of columns that multiupdate uses
--echo # normal mode
--connection default
--disable_query_log
let $i = 100;
while ($i) {
dec $i;
--connection locker
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t2 SET a=b;
--connection writer
--send UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) SET a = NULL WHERE t1.b <> t2.b
--connection locker
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP COLUMN a;
--connection writer
--error 0,ER_BAD_FIELD_ERROR
--reap
}
--enable_query_log
--echo # PS mode
--disable_query_log
let $i = 100;
while ($i) {
dec $i;
--connection locker
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t2 SET a=b;
--connection writer
PREPARE stmt FROM 'UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) SET a = NULL WHERE t1.b <> t2.b';
--send EXECUTE stmt
--connection locker
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP COLUMN a;
--connection writer
--error 0,ER_BAD_FIELD_ERROR
--reap
}
--enable_query_log
--connection default
DROP TABLE t1, t2, t3;
# Close connections
--disconnect locker
--disconnect writer
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -31,3 +31,22 @@ FLUSH TABLES;
--exec $MYISAMCHK -s --unpack $MYSQLTEST_VARDIR/master-data/test/t1
CHECK TABLE t1 EXTENDED;
DROP TABLE t1;
--echo #
--echo # BUG#41541 - Valgrind warnings on packed MyISAM table
--echo #
CREATE TABLE t1(f1 VARCHAR(200), f2 TEXT);
INSERT INTO t1 VALUES ('foo', 'foo1'), ('bar', 'bar1');
let $i=9;
--disable_query_log
while ($i)
{
INSERT INTO t1 SELECT * FROM t1;
dec $i;
}
--enable_query_log
FLUSH TABLE t1;
--echo # Compress the table using MYISAMPACK tool
--exec $MYISAMPACK $MYSQLTEST_VARDIR/master-data/test/t1
SELECT COUNT(*) FROM t1;
DROP TABLE t1;

View File

@ -0,0 +1,45 @@
#
# Bug#41486 extra character appears in BLOB for every ~40Mb after
# mysqldump/import
#
# This test consumes a significant amount of resources.
# Therefore it should be kept separated from other tests.
# Otherwise we might suffer from problems like
# Bug#43801 mysql.test takes too long, fails due to expired timeout
# on debx86-b in PB
#
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
# Have to change the global variable as the session variable is
# read-only.
SET @old_max_allowed_packet= @@global.max_allowed_packet;
# 2 MB blob length + some space for the rest of INSERT query
SET @@global.max_allowed_packet = 2 * 1024 * 1024 + 1024;
# Create a new connection since the global max_allowed_packet
# has no effect for the current connection
connect (con1, localhost, root,,);
CREATE TABLE t1(data LONGBLOB);
INSERT INTO t1 SELECT REPEAT('1', 2*1024*1024);
let $outfile= $MYSQLTEST_VARDIR/tmp/bug41486.sql;
--error 0,1
remove_file $outfile;
--exec $MYSQL_DUMP test t1 > $outfile
# Check that the mysql client does not insert extra newlines when loading
# strings longer than client's max_allowed_packet
--exec $MYSQL --max_allowed_packet=1M test < $outfile 2>&1
SELECT LENGTH(data) FROM t1;
DROP TABLE t1;
# Cleanup
disconnect con1;
--source include/wait_until_disconnected.inc
remove_file $outfile;
connection default;
SET @@global.max_allowed_packet = @old_max_allowed_packet;

View File

@ -103,7 +103,7 @@ select "--- --position --" as "";
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=231 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
# Bug#7853 (mysqlbinlog does not accept input from stdin)
# Bug#7853 mysqlbinlog does not accept input from stdin
--disable_query_log
select "--- reading stdin --" as "";
--enable_query_log
@ -117,7 +117,7 @@ select "--- reading stdin --" as "";
drop table t1,t2;
#
#BUG#14157: utf8 encoding in binlog without set character_set_client
# Bug#14157 utf8 encoding in binlog without set character_set_client
#
flush logs;
--write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
@ -174,7 +174,6 @@ flush logs;
call p1();
drop procedure p1;
--error ER_SP_DOES_NOT_EXIST
call p1();
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007
@ -222,9 +221,9 @@ flush logs;
CREATE TABLE t1 (c1 CHAR(10));
# we need this for getting fixed timestamps inside of this test
flush logs;
FLUSH LOGS;
INSERT INTO t1 VALUES ('0123456789');
flush logs;
FLUSH LOGS;
DROP TABLE t1;
# We create a table, patch, and load the output into it
@ -233,10 +232,10 @@ DROP TABLE t1;
# as described in the original bug
--disable_query_log
CREATE TABLE patch (a blob);
CREATE TABLE patch (a BLOB);
--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000011 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat'
INTO TABLE patch FIELDS TERMINATED by '' LINES STARTING BY '#';
INTO TABLE patch FIELDS TERMINATED BY '' LINES STARTING BY '#';
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
--enable_query_log
@ -248,49 +247,51 @@ SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
DROP TABLE patch;
#
# Bug #29928: incorrect connection_id() restoring from mysqlbinlog out
# Bug#29928 incorrect connection_id() restoring from mysqlbinlog out
#
flush logs;
create table t1(a int);
insert into t1 values(connection_id());
let $a= `select a from t1`;
flush logs;
FLUSH LOGS;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(connection_id());
let $a= `SELECT a FROM t1`;
FLUSH LOGS;
--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000013 > $MYSQLTEST_VARDIR/tmp/bug29928.sql
drop table t1;
DROP TABLE t1;
connect (con1, localhost, root, , test);
connection con1;
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug29928.sql
--remove_file $MYSQLTEST_VARDIR/tmp/bug29928.sql
let $b= `select a from t1`;
let $b= `SELECT a FROM t1`;
disconnect con1;
connection default;
let $c= `select $a=$b`;
let $c= `SELECT $a=$b`;
--echo $c
drop table t1;
DROP TABLE t1;
echo shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql;
error 1;
exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql;
remove_file $MYSQLTEST_VARDIR/tmp/bug31793.sql;
#
# Bug#37313 BINLOG Contains Incorrect server id
#
let $save_server_id= `select @@global.server_id`;
let $s_id_max=`select (1 << 32) - 1`;
eval set @@global.server_id= $s_id_max;
let $binlog_file= $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog;
let $save_server_id= `SELECT @@global.server_id`;
let $s_id_max= `SELECT (1 << 32) - 1`;
eval SET @@global.server_id= $s_id_max;
reset master;
flush logs;
--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog
RESET MASTER;
FLUSH LOGS;
--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $binlog_file
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
is not null;
let $s_id_unsigned= `select @a like "%server id $s_id_max%" /* must return 1 */`;
eval SELECT
(@a:=LOAD_FILE("$binlog_file"))
IS NOT NULL;
let $s_id_unsigned= `SELECT @a LIKE "%server id $s_id_max%" /* must return 1 */`;
echo *** Unsigned server_id $s_id_max is found: $s_id_unsigned ***;
eval set @@global.server_id= $save_server_id;
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog
eval SET @@global.server_id= $save_server_id;
--remove_file $binlog_file
--echo End of 5.0 tests

View File

@ -1649,6 +1649,20 @@ DROP TABLE t1,t2;
# We reset concurrent_inserts value to whatever it was at the start of the test
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
--echo #
--echo # Bug #42635: mysqldump includes views that were excluded using
--echo # the --ignore-table option
--echo #
create database db42635;
use db42635;
create table t1 (id int);
create view db42635.v1 (c) as select * from db42635.t1;
create view db42635.v2 (c) as select * from db42635.t1;
--exec $MYSQL_DUMP --skip-comments --ignore-table=db42635.v1 db42635
use test;
drop database db42635;
--echo #
--echo # Bug#33550 mysqldump 4.0 compatibility broken

View File

@ -6,6 +6,9 @@
# This test uses chmod, can't be run with root permissions
-- source include/not_as_root.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# ============================================================================
#
# Test of mysqltest itself
@ -2154,3 +2157,5 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir;
--echo End of tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -4,6 +4,9 @@
# should work with embedded server after mysqltest is fixed
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3;
--enable_warnings
@ -40,24 +43,24 @@ connection con1;
select @@global.read_only;
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
create table t3 (a int);
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
insert into t1 values(1);
# if a statement, after parse stage, looks like it will update a
# non-temp table, it will be rejected, even if at execution it would
# have turned out that 0 rows would be updated
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
update t1 set a=1 where 1=0;
# multi-update is special (see sql_parse.cc) so we test it
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
update t1,t2 set t1.a=t2.a+1 where t1.a=t2.a;
# check multi-delete to be sure
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
delete t1,t2 from t1,t2 where t1.a=t2.a;
# With temp tables updates should be accepted:
@ -71,7 +74,7 @@ insert into t3 values(1);
insert into t4 select * from t3;
# a non-temp table updated:
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a;
# no non-temp table updated (just swapped):
@ -79,7 +82,7 @@ update t1,t3 set t3.a=t1.a+1 where t1.a=t3.a;
update t4,t3 set t4.a=t3.a+1 where t4.a=t3.a;
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
delete t1 from t1,t3 where t1.a=t3.a;
delete t3 from t1,t3 where t1.a=t3.a;
@ -98,11 +101,11 @@ delete t1 from t1,t3 where t1.a=t3.a;
drop table t1;
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
insert into t1 values(1);
#
# BUG #22077 "DROP TEMPORARY TABLE fails with wrong error if read_only is set"
# Bug#22077 DROP TEMPORARY TABLE fails with wrong error if read_only is set
#
# check if DROP TEMPORARY on a non-existing temporary table returns the right
# error
@ -114,6 +117,7 @@ drop temporary table ttt;
drop temporary table if exists ttt;
connection default;
disconnect con1;
drop table t1,t2;
drop user test@localhost;
@ -151,3 +155,7 @@ delete from mysql.columns_priv where User like 'mysqltest_%';
flush privileges;
drop database mysqltest_db1;
set global read_only=0;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -154,5 +154,31 @@ connection master;
DROP TABLE t1;
SET @@session.time_zone = default;
# Bug#41719 delayed INSERT into timestamp col needs set time_zone for concurrent binlogging
# To test that time_zone is correctly binloging for 'insert delayed' statement
# Insert 2 values into timestamp col with different time_zone. Check result.
--connection master
reset master;
CREATE TABLE t1 (date timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, a int(11) default NULL);
SET @@session.time_zone='+01:00';
insert into t1 values('2008-12-23 19:39:39',1);
--connection master1
SET @@session.time_zone='+02:00';
insert delayed into t1 values ('2008-12-23 19:39:39',2);
# Forces table t1 to be closed and flushes the query cache.
# This makes sure that 'delayed insert' is executed before next statement.
flush table t1;
flush logs;
select * from t1;
DROP TABLE t1;
--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 | $MYSQL
--connection master1
select * from t1 order by a;
DROP TABLE t1;
SET @@session.time_zone = default;
--echo End of 5.0 tests

View File

@ -16,4 +16,23 @@ if (`SELECT '$shm' != 'ON'`){
#
--exec $MYSQLADMIN --no-defaults --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --shared-memory-base-name=HeyMrBaseNameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ping
#
# Bug #33899: Deadlock in mysql_real_query with shared memory connections
#
let $name= query_get_value("SHOW GLOBAL VARIABLES LIKE 'shared_memory_base_name'", Value, 1);
let $stmt= `SELECT REPEAT('a', 2048)`;
SET @max_allowed_packet= @@global.max_allowed_packet;
SET @net_buffer_length= @@global.net_buffer_length;
SET GLOBAL max_allowed_packet= 1024;
SET GLOBAL net_buffer_length= 1024;
--error 1
--exec echo SELECT '$stmt'| $MYSQL --protocol=memory --shared-memory-base-name=$name 2>&1
SET GLOBAL max_allowed_packet= @max_allowed_packet;
SET GLOBAL net_buffer_length= @net_buffer_length;
--echo End of 5.0 tests.

View File

@ -1,6 +1,9 @@
# Uses GRANT commands that usually disabled in embedded server
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
#
# Test of some show commands
#
@ -33,7 +36,7 @@ check table t1 medium;
check table t1 extended;
show index from t1;
--disable_metadata
--error 1062
--error ER_DUP_ENTRY
insert into t1 values (5,5,5);
--echo -- Here we enable metadata just to check that the collation of the
@ -191,14 +194,14 @@ show columns from t1;
drop table t1;
#
# Test for Bug #2593 "SHOW CREATE TABLE doesn't properly double quotes"
# Test for Bug#2593 SHOW CREATE TABLE doesn't properly double quotes
#
SET @old_sql_mode= @@sql_mode, sql_mode= '';
SET @old_sql_quote_show_create= @@sql_quote_show_create, sql_quote_show_create= OFF;
######### hook for WL#1324 #
--error 1103
--error ER_WRONG_TABLE_NAME
CREATE TABLE `a/b` (i INT);
# the above test should WORK when WL#1324 is done,
# it should be removed and
@ -252,7 +255,7 @@ SET sql_quote_show_create= @old_sql_quote_show_create;
SET sql_mode= @old_sql_mode;
#
# Test for bug #2719 "Heap tables status shows wrong or missing data."
# Test for Bug#2719 Heap tables status shows wrong or missing data.
#
select @@max_heap_table_size;
@ -313,7 +316,7 @@ show table status;
drop table t1, t2, t3;
#
# Test for bug #3342 SHOW CREATE DATABASE seems to require DROP privilege
# Test for Bug#3342 SHOW CREATE DATABASE seems to require DROP privilege
#
create database mysqltest;
@ -328,30 +331,33 @@ connect (con1,localhost,mysqltest_1,,mysqltest);
connection con1;
select * from t1;
show create database mysqltest;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
drop table t1;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
drop database mysqltest;
disconnect con1;
connect (con2,localhost,mysqltest_2,,test);
connection con2;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
select * from mysqltest.t1;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
show create database mysqltest;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
drop table mysqltest.t1;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
drop database mysqltest;
disconnect con2;
connect (con3,localhost,mysqltest_3,,test);
connection con3;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
select * from mysqltest.t1;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
show create database mysqltest;
drop table mysqltest.t1;
drop database mysqltest;
disconnect con3;
connection default;
set names binary;
@ -402,7 +408,7 @@ ALTER TABLE t1 ENGINE=MEMORY;
SHOW CREATE TABLE t1;
DROP TABLE t1;
# Test for BUG#9439 "Reporting wrong datatype for sub_part on show index"
# Test for Bug#9439 Reporting wrong datatype for sub_part on show index
CREATE TABLE t1(
field1 text NOT NULL,
PRIMARY KEY(field1(1000))
@ -412,7 +418,7 @@ show index from t1;
--disable_metadata
drop table t1;
# Test for BUG#11635: mysqldump exports TYPE instead of USING for HASH
# Test for Bug#11635 mysqldump exports TYPE instead of USING for HASH
create table t1 (
c1 int NOT NULL,
c2 int NOT NULL,
@ -422,7 +428,7 @@ create table t1 (
SHOW CREATE TABLE t1;
DROP TABLE t1;
# Test for BUG#93: 4.1 protocl crash on corupted frm and SHOW TABLE STATUS
# Test for Bug#93 4.1 protocl crash on corupted frm and SHOW TABLE STATUS
flush tables;
@ -430,7 +436,7 @@ flush tables;
system echo "this is a junk file for test" >> $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
--replace_column 6 # 7 # 8 # 9 #
SHOW TABLE STATUS like 't1';
--error 1033
--error ER_NOT_FORM_FILE
show create table t1;
drop table t1;
@ -438,7 +444,7 @@ drop table t1;
--echo End of 4.1 tests
#
# BUG 12183 - SHOW OPEN TABLES behavior doesn't match grammar
# Bug#12183 SHOW OPEN TABLES behavior doesn't match grammar
# First we close all open tables with FLUSH tables and then we open some.
CREATE TABLE txt1(a int);
CREATE TABLE tyt2(a int);
@ -456,14 +462,14 @@ DROP TABLE txt1;
DROP TABLE tyt2;
DROP TABLE urkunde;
#
# BUG #12591 (SHOW TABLES FROM dbname produces wrong error message)
# Bug#12591 SHOW TABLES FROM dbname produces wrong error message
#
--error 1049
--error ER_BAD_DB_ERROR
SHOW TABLES FROM non_existing_database;
#
# Bug#17203: "sql_no_cache sql_cache" in views created from prepared
# Bug#17203 "sql_no_cache sql_cache" in views created from prepared
# statement
#
# The problem was that initial user setting was forgotten, and current
@ -543,7 +549,7 @@ SHOW COLUMNS FROM no_such_table;
#
# Bug #19764: SHOW commands end up in the slow log as table scans
# Bug#19764 SHOW commands end up in the slow log as table scans
#
flush status;
show status like 'slow_queries';
@ -555,7 +561,7 @@ select 1 from information_schema.tables limit 1;
show status like 'slow_queries';
#
# BUG#10491: Server returns data as charset binary SHOW CREATE TABLE or SELECT
# BUG#10491 Server returns data as charset binary SHOW CREATE TABLE or SELECT
# FROM I_S.
#
@ -827,7 +833,7 @@ DROP DATABASE mysqltest1;
use test;
#
# Bug #28808: log_queries_not_using_indexes variable dynamic change is ignored
# Bug#28808 log_queries_not_using_indexes variable dynamic change is ignored
#
flush status;
show variables like "log_queries_not_using_indexes";
@ -843,7 +849,7 @@ select 1 from information_schema.tables limit 1;
show status like 'slow_queries';
#
# Bug #30088: Can't disable myisam-recover by a value of ""
# Bug#30088 Can't disable myisam-recover by a value of ""
#
show variables like 'myisam_recover_options';
@ -868,3 +874,7 @@ show create table t1;
drop table t1;
--echo End of 5.0 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,7 +1,10 @@
# Can't be tested with embedded server
--source include/not_embedded.inc
# Bug #8471: IP address with mask fail when skip-name-resolve is on
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# Bug#8471 IP address with mask fail when skip-name-resolve is on
GRANT ALL ON test.* TO mysqltest_1@'127.0.0.1/255.255.255.255';
SHOW GRANTS FOR mysqltest_1@'127.0.0.1/255.255.255.255';
REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255';
@ -9,12 +12,17 @@ DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
# End of 4.1 tests
# Bug #13407 "Remote connecting crashes server".
# Bug#13407 Remote connecting crashes server
# Server crashed when one used USER() function in connection for which
# was impossible to obtain peer hostname.
connect (con1, 127.0.0.1, root, , test, $MASTER_MYPORT, );
--replace_column 1 #
select user();
SELECT USER();
--replace_column 1 <id> 3 <host> 5 <command> 6 <time> 7 <state> 8 <info>
show processlist;
SHOW PROCESSLIST;
connection default;
disconnect con1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -5,6 +5,9 @@
# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (con1root,localhost,root,,);
connection con1root;
@ -156,7 +159,7 @@ call db1_secret.stamp(6);
select db1_secret.db();
#
# BUG#2777
# Bug#2777 Stored procedure doesn't observe definer's rights
#
connection con1root;
@ -215,7 +218,7 @@ call q();
select * from t2;
#
# BUG#6030: Stored procedure has no appropriate DROP privilege
# Bug#6030 Stored procedure has no appropriate DROP privilege
# (or ALTER for that matter)
# still connection con2user1 in db2
@ -330,7 +333,7 @@ flush privileges;
drop table t1;
#
# BUG#9503: reseting correct parameters of thread after error in SP function
# Bug#9503 reseting correct parameters of thread after error in SP function
#
connect (root,localhost,root,,test);
connection root;
@ -366,10 +369,12 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
drop function bug_9503;
use test;
drop database mysqltest;
connection default;
disconnect root;
#
# correct value from current_user() in function run from "security definer"
# (BUG#7291)
# (Bug#7291 Stored procedures: wrong CURRENT_USER value)
#
connection con1root;
use test;
@ -398,7 +403,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
drop user user1@localhost;
#
# Bug #12318: Wrong error message when accessing an inaccessible stored
# Bug#12318 Wrong error message when accessing an inaccessible stored
# procedure in another database when the current database is
# information_schema.
#
@ -438,7 +443,7 @@ revoke usage on *.* from mysqltest_1@localhost;
drop user mysqltest_1@localhost;
#
# BUG#12812 create view calling a function works without execute right
# Bug#12812 create view calling a function works without execute right
# on function
delimiter |;
--disable_warnings
@ -464,7 +469,7 @@ delimiter ;|
#
# BUG#14834: Server denies to execute Stored Procedure
# Bug#14834 Server denies to execute Stored Procedure
#
# The problem here was with '_' in the database name.
#
@ -507,7 +512,7 @@ drop database db_bug14834;
#
# BUG#14533: 'desc tbl' in stored procedure causes error
# Bug#14533 'desc tbl' in stored procedure causes error
# ER_TABLEACCESS_DENIED_ERROR
#
create database db_bug14533;
@ -546,13 +551,13 @@ drop database db_bug14533;
#
# BUG#7787: Stored procedures: improper warning for "grant execute" statement
# Bug#7787 Stored procedures: improper warning for "grant execute" statement
#
# Prepare.
CREATE DATABASE db_bug7787;
use db_bug7787;
USE db_bug7787;
# Test.
@ -569,7 +574,7 @@ use test;
#
# WL#2897: Complete definer support in the stored routines.
# WL#2897 Complete definer support in the stored routines.
#
# The following cases are tested:
# 1. check that if DEFINER-clause is not explicitly specified, stored routines
@ -614,7 +619,7 @@ GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
--echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con
use mysqltest;
USE mysqltest;
CREATE PROCEDURE wl2897_p1() SELECT 1;
@ -626,7 +631,7 @@ CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1;
--echo ---> connection: mysqltest_1_con
--connection mysqltest_1_con
use mysqltest;
USE mysqltest;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2;
@ -652,7 +657,7 @@ CREATE DEFINER='a @ b @ c'@localhost FUNCTION wl2897_f3() RETURNS INT RETURN 3;
--echo ---> connection: con1root
--connection con1root
use mysqltest;
USE mysqltest;
SHOW CREATE PROCEDURE wl2897_p1;
SHOW CREATE PROCEDURE wl2897_p3;
@ -672,7 +677,7 @@ DROP DATABASE mysqltest;
#
# BUG#13198: SP executes if definer does not exist
# Bug#13198 SP executes if definer does not exist
#
# Prepare environment.
@ -702,7 +707,7 @@ GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
--echo ---> connection: mysqltest_1_con
--connection mysqltest_1_con
use mysqltest;
USE mysqltest;
CREATE PROCEDURE bug13198_p1()
SELECT 1;
@ -720,7 +725,7 @@ SELECT bug13198_f1();
--echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con
use mysqltest;
USE mysqltest;
CALL bug13198_p1();
@ -742,7 +747,7 @@ DROP USER mysqltest_1@localhost;
--echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con
use mysqltest;
USE mysqltest;
--error ER_NO_SUCH_USER
CALL bug13198_p1();
@ -764,7 +769,7 @@ DROP DATABASE mysqltest;
#
# Bug#19857 - When a user with CREATE ROUTINE priv creates a routine,
# Bug#19857 When a user with CREATE ROUTINE priv creates a routine,
# it results in NULL p/w
#
@ -780,7 +785,7 @@ SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
--echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con
use test;
USE test;
DELIMITER //;
CREATE PROCEDURE sp19857() DETERMINISTIC
@ -814,8 +819,7 @@ DROP USER user19857@localhost;
#
# BUG#18630: Arguments of suid routine calculated in wrong security
# context
# Bug#18630 Arguments of suid routine calculated in wrong security context
#
# Arguments of suid routines were calculated in definer's security
# context instead of caller's context thus creating security hole.
@ -886,3 +890,7 @@ DROP FUNCTION f_suid;
DROP TABLE t1;
--echo End of 5.0 tests.
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,14 +1,17 @@
# Can't test with embedded server
-- source include/not_embedded.inc
--sleep 2
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
drop table if exists t1,t3;
--enable_warnings
delimiter |;
#
# BUG#4902: Stored procedure with SHOW WARNINGS leads to packet error
# Bug#4902: Stored procedure with SHOW WARNINGS leads to packet error
#
# Added tests for show grants command
--disable_warnings
@ -47,7 +50,7 @@ drop procedure bug4902_2|
#
# BUG#5278: Stored procedure packets out of order if SET PASSWORD.
# Bug#5278: Stored procedure packets out of order if SET PASSWORD.
#
--disable_warnings
drop function if exists bug5278|
@ -58,13 +61,16 @@ begin
return 'okay';
end|
--error 1133
--error ER_PASSWORD_NO_MATCH
select bug5278()|
--error 1133
--error ER_PASSWORD_NO_MATCH
select bug5278()|
drop function bug5278|
#
# Bug#3583: query cache doesn't work for stored procedures
#
--disable_warnings
drop table if exists t1|
--enable_warnings
@ -72,9 +78,6 @@ create table t1 (
id char(16) not null default '',
data int not null
)|
#
# BUG#3583: query cache doesn't work for stored procedures
#
--disable_warnings
drop procedure if exists bug3583|
--enable_warnings
@ -110,8 +113,9 @@ delete from t1|
drop procedure bug3583|
drop table t1|
#
# BUG#6807: Stored procedure crash if CREATE PROCEDURE ... KILL QUERY
# Bug#6807: Stored procedure crash if CREATE PROCEDURE ... KILL QUERY
#
--disable_warnings
drop procedure if exists bug6807|
@ -125,16 +129,16 @@ begin
select 'Not reached';
end|
--error 1317
--error ER_QUERY_INTERRUPTED
call bug6807()|
--error 1317
--error ER_QUERY_INTERRUPTED
call bug6807()|
drop procedure bug6807|
#
# BUG#10100: function (and stored procedure?) recursivity problem
# Bug#10100: function (and stored procedure?) recursivity problem
#
--disable_warnings
drop function if exists bug10100f|
@ -266,6 +270,7 @@ drop table t3|
delimiter ;|
#
# Bug#15298 SHOW GRANTS FOR CURRENT_USER: Incorrect output in DEFINER context
#
@ -282,6 +287,11 @@ call 15298_1();
call 15298_2();
connection default;
disconnect con1;
drop user mysqltest_1@localhost;
drop procedure 15298_1;
drop procedure 15298_2;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -4,6 +4,9 @@
-- source include/have_ssl.inc
-- source include/big_test.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
@ -53,4 +56,9 @@ while ($count)
connect (ssl_con,localhost,root,,,,,SSL);
drop table t1;
connection default;
disconnect ssl_con;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -3,6 +3,9 @@
-- source include/have_ssl.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (ssl_con,localhost,root,,,,,SSL);
# Check ssl turned on
@ -14,4 +17,9 @@ SHOW STATUS LIKE 'Ssl_cipher';
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
connection default;
disconnect ssl_con;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -4,6 +4,9 @@
-- source include/have_ssl.inc
-- source include/have_compress.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS);
# Check ssl turned on
@ -20,3 +23,10 @@ SHOW STATUS LIKE 'Ssl_cipher';
# Check compression turned on
SHOW STATUS LIKE 'Compression';
connection default;
disconnect ssl_compress_con;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,6 +1,9 @@
# embedded server causes different stat
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# PS causes different statistics
--disable_ps_protocol
@ -208,3 +211,7 @@ DROP PROCEDURE p1;
DROP FUNCTION f1;
# End of 5.0 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -40,7 +40,9 @@ drop table t1;
create table t1 (a bit) engine=innodb;
insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001');
select hex(a) from t1;
--error 1062
# It is not deterministic which duplicate will be seen first
--replace_regex /(.*Duplicate entry )'.*'( for key.*)/\1''\2/
--error ER_DUP_ENTRY
alter table t1 add unique (a);
drop table t1;

View File

@ -933,17 +933,25 @@ SELECT a INTO @v FROM (
SELECT a FROM t1
) alias;
SELECT a INTO OUTFILE 'union.out.file' FROM (
SELECT a FROM t1
UNION
SELECT a FROM t1 WHERE 0
) alias;
--let $outfile = $MYSQLTEST_VARDIR/tmp/union.out.file
--error 0,1
--remove_file $outfile
SELECT a INTO DUMPFILE 'union.out.file2' FROM (
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
eval SELECT a INTO OUTFILE '$outfile' FROM (
SELECT a FROM t1
UNION
SELECT a FROM t1 WHERE 0
) alias;
--remove_file $outfile
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
eval SELECT a INTO DUMPFILE '$outfile' FROM (
SELECT a FROM t1
UNION
SELECT a FROM t1 WHERE 0
) alias;
--remove_file $outfile
#
# INTO will not be allowed in subqueries in version 5.1 and above.
@ -954,27 +962,42 @@ SELECT a FROM (
SELECT a INTO @v FROM t1
) alias;
SELECT a FROM (
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
eval SELECT a FROM (
SELECT a FROM t1
UNION
SELECT a INTO OUTFILE 'union.out.file3' FROM t1
SELECT a INTO OUTFILE '$outfile' FROM t1
) alias;
--remove_file $outfile
SELECT a FROM (
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
eval SELECT a FROM (
SELECT a FROM t1
UNION
SELECT a INTO DUMPFILE 'union.out.file4' FROM t1
SELECT a INTO DUMPFILE '$outfile' FROM t1
) alias;
--remove_file $outfile
SELECT a FROM t1 UNION SELECT a INTO @v FROM t1;
SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file5' FROM t1;
SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file6' FROM t1;
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
eval SELECT a FROM t1 UNION SELECT a INTO OUTFILE '$outfile' FROM t1;
--remove_file $outfile
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
eval SELECT a FROM t1 UNION SELECT a INTO DUMPFILE '$outfile' FROM t1;
--remove_file $outfile
--error ER_WRONG_USAGE
SELECT a INTO @v FROM t1 UNION SELECT a FROM t1;
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
--error ER_WRONG_USAGE
SELECT a INTO OUTFILE 'union.out.file7' FROM t1 UNION SELECT a FROM t1;
eval SELECT a INTO OUTFILE '$outfile' FROM t1 UNION SELECT a FROM t1;
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
--error ER_WRONG_USAGE
SELECT a INTO DUMPFILE 'union.out.file8' FROM t1 UNION SELECT a FROM t1;
eval SELECT a INTO DUMPFILE '$outfile' FROM t1 UNION SELECT a FROM t1;
DROP TABLE t1;

View File

@ -5,6 +5,9 @@
# Requires privileges to be enabled
--source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# Prepare play-ground
--disable_warnings
drop table if exists t1;
@ -28,11 +31,11 @@ connect (mqph, localhost, mysqltest_1,,);
connection mqph;
select * from t1;
select * from t1;
--error 1226
--error ER_USER_LIMIT_REACHED
select * from t1;
connect (mqph2, localhost, mysqltest_1,,);
connection mqph2;
--error 1226
--error ER_USER_LIMIT_REACHED
select * from t1;
# cleanup
connection default;
@ -50,12 +53,12 @@ select * from t1;
select * from t1;
delete from t1;
delete from t1;
--error 1226
--error ER_USER_LIMIT_REACHED
delete from t1;
select * from t1;
connect (muph2, localhost, mysqltest_1,,);
connection muph2;
--error 1226
--error ER_USER_LIMIT_REACHED
delete from t1;
select * from t1;
# Cleanup
@ -74,7 +77,7 @@ connect (mcph2, localhost, mysqltest_1,,);
connection mcph2;
select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226
--error ER_USER_LIMIT_REACHED
connect (mcph3, localhost, mysqltest_1,,);
# Old connection is still ok
select * from t1;
@ -83,7 +86,7 @@ select * from t1;
disconnect mcph1;
disconnect mcph2;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226
--error ER_USER_LIMIT_REACHED
connect (mcph3, localhost, mysqltest_1,,);
# Cleanup
connection default;
@ -101,7 +104,7 @@ connect (muc2, localhost, mysqltest_1,,);
connection muc2;
select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226
--error ER_USER_LIMIT_REACHED
connect (muc3, localhost, mysqltest_1,,);
# Closing of one of connections should help
disconnect muc1;
@ -115,7 +118,7 @@ connect (muc4, localhost, mysqltest_1,,);
connection muc4;
select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226
--error ER_USER_LIMIT_REACHED
connect (muc5, localhost, mysqltest_1,,);
# Clean up
connection default;
@ -129,7 +132,7 @@ drop user mysqltest_1@localhost;
select @@session.max_user_connections, @@global.max_user_connections;
# Local max_user_connections variable can't be set directly
# since this limit is per-account
--error 1229
--error ER_GLOBAL_VARIABLE
set session max_user_connections= 2;
# But it is ok to set global max_user_connections
set global max_user_connections= 2;
@ -144,7 +147,7 @@ connect (muca2, localhost, mysqltest_1,,);
connection muca2;
select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1203
--error ER_TOO_MANY_USER_CONNECTIONS
connect (muca3, localhost, mysqltest_1,,);
# Now we are testing that per-account limit prevails over gloabl limit
connection default;
@ -154,7 +157,7 @@ connect (muca3, localhost, mysqltest_1,,);
connection muca3;
select @@session.max_user_connections, @@global.max_user_connections;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226
--error ER_USER_LIMIT_REACHED
connect (muca4, localhost, mysqltest_1,,);
# Cleanup
connection default;
@ -167,3 +170,7 @@ drop user mysqltest_1@localhost;
# Final cleanup
drop table t1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More