This commit is contained in:
Leonard Zhou 2009-03-24 15:29:04 +08:00
commit dad07ffe9e
187 changed files with 3578 additions and 2231 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_init(ulong max_size,FILE *file);
extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, my_string str); 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); extern void batch_readline_end(LINE_BUFFER *buffer);

View File

@ -112,6 +112,8 @@ extern "C" {
#define PROMPT_CHAR '\\' #define PROMPT_CHAR '\\'
#define DEFAULT_DELIMITER ";" #define DEFAULT_DELIMITER ";"
#define MAX_BATCH_BUFFER_SIZE (1024L * 1024L)
typedef struct st_status typedef struct st_status
{ {
int exit_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 COMMANDS *find_command(char *name,char cmd_name);
static bool add_line(String &buffer,char *line,char *in_string, 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 remove_cntrl(String &buffer);
static void print_table_data(MYSQL_RES *result); static void print_table_data(MYSQL_RES *result);
static void print_table_data_html(MYSQL_RES *result); static void print_table_data_html(MYSQL_RES *result);
@ -1117,7 +1119,7 @@ int main(int argc,char *argv[])
exit(1); exit(1);
} }
if (status.batch && !status.line_buff && 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); free_defaults(defaults_argv);
my_end(0); my_end(0);
@ -1197,7 +1199,7 @@ int main(int argc,char *argv[])
#endif #endif
sprintf(buff, "%s", sprintf(buff, "%s",
#ifndef NOT_YET #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 #else
"Type 'help [[%]function name[%]]' to get help on usage of function.\n"); "Type 'help [[%]function name[%]]' to get help on usage of function.\n");
#endif #endif
@ -1226,7 +1228,7 @@ sig_handler mysql_sigint(int sig)
goto err; goto err;
/* kill_buffer is always big enough because max length of %lu is 15 */ /* kill_buffer is always big enough because max length of %lu is 15 */
sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql)); 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); mysql_close(kill_mysql);
tee_fprintf(stdout, "Query aborted by Ctrl+C\n"); tee_fprintf(stdout, "Query aborted by Ctrl+C\n");
@ -1766,13 +1768,14 @@ static int read_and_execute(bool interactive)
ulong line_number=0; ulong line_number=0;
bool ml_comment= 0; bool ml_comment= 0;
COMMANDS *com; COMMANDS *com;
bool truncated= 0;
status.exit_status=1; status.exit_status=1;
for (;;) for (;;)
{ {
if (!interactive) if (!interactive)
{ {
line=batch_readline(status.line_buff); line=batch_readline(status.line_buff, &truncated);
/* /*
Skip UTF8 Byte Order Marker (BOM) 0xEFBBBF. Skip UTF8 Byte Order Marker (BOM) 0xEFBBBF.
Editors like "notepad" put this marker in Editors like "notepad" put this marker in
@ -1891,7 +1894,7 @@ static int read_and_execute(bool interactive)
#endif #endif
continue; continue;
} }
if (add_line(glob_buffer,line,&in_string,&ml_comment)) if (add_line(glob_buffer,line,&in_string,&ml_comment, truncated))
break; break;
} }
/* if in batch mode, send last query even if it doesn't end with \g or go */ /* 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, static bool add_line(String &buffer,char *line,char *in_string,
bool *ml_comment) bool *ml_comment, bool truncated)
{ {
uchar inchar; uchar inchar;
char buff[80], *pos, *out; 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); uint length=(uint) (out-line);
if (length < 9 || if (!truncated &&
(length < 9 ||
my_strnncoll (charset_info, 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 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))) (res= mysql_use_result(&mysql)))
{ {
MYSQL_ROW row= mysql_fetch_row(res); MYSQL_ROW row= mysql_fetch_row(res);
if (row[0]) if (row && row[0])
current_db= my_strdup(row[0], MYF(MY_WME)); current_db= my_strdup(row[0], MYF(MY_WME));
mysql_free_result(res); mysql_free_result(res);
} }
@ -3463,7 +3467,7 @@ static void print_warnings()
/* Get the warnings */ /* Get the warnings */
query= "show 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); mysql_store_result_for_lazy(&result);
/* Bail out when no warnings */ /* Bail out when no warnings */
@ -3886,7 +3890,7 @@ static int com_source(String *buffer, char *line)
return put_info(buff, INFO_ERROR, 0); 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)); my_fclose(sql_file,MYF(0));
return put_info("Can't initialize batch_readline", INFO_ERROR, 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); MYSQL_ROW cur = mysql_fetch_row(result);
if (cur && cur[0]) 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); 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) MYF(MY_WME))) < 0)
die("Failed to create temporary file for defaults"); 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))) MYF(MY_FNABP | MY_WME)))
{ {
my_close(fd, MYF(0)); 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) == bool old= (find_type(argv[0], &command_typelib, 2) ==
ADMIN_OLD_PASSWORD); ADMIN_OLD_PASSWORD);
#ifdef __WIN__ #ifdef __WIN__
uint pw_len= strlen(pw); uint pw_len= (uint) strlen(pw);
if (pw_len > 1 && pw[0] == '\'' && pw[pw_len-1] == '\'') if (pw_len > 1 && pw[0] == '\'' && pw[pw_len-1] == '\'')
printf("Warning: single quotes were not trimmed from the password by" printf("Warning: single quotes were not trimmed from the password by"
" your command\nline client, as you might have expected.\n"); " your command\nline client, as you might have expected.\n");

View File

@ -105,7 +105,7 @@ static MYSQL* safe_connect();
class Load_log_processor class Load_log_processor
{ {
char target_dir_name[FN_REFLEN]; 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 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; File file;
fn_format(filename, le->fname, target_dir_name, "", 1); fn_format(filename, le->fname, target_dir_name, "", 1);
len= strlen(filename); len= (uint) strlen(filename);
tail= filename + len; tail= filename + len;
if ((file= create_unique_file(filename,tail)) < 0) 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; 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; return file;
} }
@ -369,7 +369,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen,
uint file_id, uint file_id,
Create_file_log_event *ce) 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; int error= 0;
char *fname, *ptr; char *fname, *ptr;
File file; File file;
@ -403,7 +403,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen,
} }
if (ce) 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))) if (my_write(file, (byte*)block, block_len, MYF(MY_WME|MY_NABP)))
error= -1; 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) int Load_log_processor::process(Create_file_log_event *ce)
{ {
const char *bname= ce->fname + dirname_length(ce->fname); 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, return process_first_event(bname, blen, ce->block, ce->block_len,
ce->file_id, ce); ce->file_id, ce);
@ -864,7 +864,7 @@ static my_time_t convert_str_to_timestamp(const char* str)
long dummy_my_timezone; long dummy_my_timezone;
my_bool dummy_in_dst_time_gap; my_bool dummy_in_dst_time_gap;
/* We require a total specification (date AND time) */ /* 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) MYSQL_TIMESTAMP_DATETIME || was_cut)
{ {
fprintf(stderr, "Incorrect date and time argument: %s\n", str); fprintf(stderr, "Incorrect date and time argument: %s\n", str);
@ -1109,7 +1109,7 @@ could be out of memory");
int4store(buf, (uint32)start_position); int4store(buf, (uint32)start_position);
int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags); int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags);
size_s tlen = strlen(logname); size_t tlen= strlen(logname);
if (tlen > UINT_MAX) if (tlen > UINT_MAX)
{ {
fprintf(stderr,"Log name too long\n"); 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) if (!what_to_do)
{ {
int pnlen = strlen(my_progname); size_t pnlen= strlen(my_progname);
if (pnlen < 6) /* name too short */ if (pnlen < 6) /* name too short */
what_to_do = DO_CHECK; 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 space is for more readable output in logs and in case of error
*/ */
char *table_names_comma_sep, *end; 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++) for (i = 0; i < tables; i++)
tot_length+= fixed_name_length(*(table_names + i)) + 2; 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++= ',';
} }
*--end = 0; *--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)); my_free(table_names_comma_sep, MYF(0));
} }
else else
@ -452,7 +453,7 @@ static uint fixed_name_length(const char *name)
else if (*p == '.') else if (*p == '.')
extra_length+= 2; 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 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 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, byte* get_table_key(const char *entry, uint *length,
my_bool not_used __attribute__((unused))) my_bool not_used __attribute__((unused)))
{ {
*length= strlen(entry); *length= (uint) strlen(entry);
return (byte*) 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_set_charset= 0;
opt_compatible_mode_str= argument; opt_compatible_mode_str= argument;
opt_compatible_mode= find_set(&compatible_mode_typelib, opt_compatible_mode= find_set(&compatible_mode_typelib,
argument, strlen(argument), argument, (uint) strlen(argument),
&err_ptr, &err_len); &err_ptr, &err_len);
if (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; uint size_for_sql_mode= 0;
const char **ptr; const char **ptr;
for (ptr= compatible_mode_names; *ptr; 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; size_for_sql_mode+= sizeof(compatible_mode_names)-1;
DBUG_ASSERT(sizeof(compatible_mode_normal_str)>=size_for_sql_mode); 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'", "SET SESSION character_set_results = '%s'",
(const char *) cs_name); (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); fputs(attribute_name, xml_file);
fputc('\"', 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); fputc('\"', xml_file);
attribute_name= va_arg(arg_list, char *); 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("<", xml_file);
fputs(stag_atr, xml_file); fputs(stag_atr, xml_file);
fputs("\"", 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("\" xsi:nil=\"true\" />", xml_file);
fputs(line_end, xml_file); fputs(line_end, xml_file);
check_io(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_ENTER("dump_routines_for_db");
DBUG_PRINT("enter", ("db: '%s'", 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 */ /* nice comments */
if (opt_comments) if (opt_comments)
@ -1602,13 +1603,13 @@ static uint dump_routines_for_db(char *db)
Allocate memory for new query string: original string Allocate memory for new query string: original string
from SHOW statement and version-specific comments. 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], 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= strmov(query_str_tail, "*/ /*!50020");
query_str_tail= strnmov(query_str_tail, definer_begin, 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", query_str_tail= strxmov(query_str_tail, "*/ /*!50003",
definer_end, NullS); definer_end, NullS);
} }
@ -2217,7 +2218,7 @@ static void dump_triggers_for_table(char *table,
char host_name_str[HOSTNAME_LENGTH + 1]; char host_name_str[HOSTNAME_LENGTH + 1];
char quoted_host_name_str[HOSTNAME_LENGTH * 2 + 3]; 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); host_name_str, &host_name_len);
fprintf(sql_file, fprintf(sql_file,
@ -3055,7 +3056,7 @@ static int dump_all_tables_in_db(char *database)
while ((table= getTableName(0))) while ((table= getTableName(0)))
{ {
char *end= strmov(afterdot, table); 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); dump_table(table,database);
my_free(order_by, MYF(MY_ALLOW_ZERO_PTR)); 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; char *table;
uint numrows; uint numrows;
char table_buff[NAME_LEN*2+3]; 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)) if (init_dumping(database, init_dumping_views))
return 1; return 1;
@ -3113,11 +3119,16 @@ static my_bool dump_all_views_in_db(char *database)
{ {
DYNAMIC_STRING query; DYNAMIC_STRING query;
init_dynamic_string_checked(&query, "LOCK TABLES ", 256, 1024); 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, quote_name(table, table_buff, 1));
dynstr_append_checked(&query, " READ /*!32311 LOCAL */,"); dynstr_append_checked(&query, " READ /*!32311 LOCAL */,");
} }
}
if (numrows && mysql_real_query(mysql, query.str, query.length-1)) if (numrows && mysql_real_query(mysql, query.str, query.length-1))
DB_error(mysql, "when using LOCK TABLES"); DB_error(mysql, "when using LOCK TABLES");
/* We shall continue here, if --force was given */ /* 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 */ /* We shall continue here, if --force was given */
} }
while ((table= getTableName(0))) while ((table= getTableName(0)))
{
char *end= strmov(afterdot, table);
if (include_table((uchar*) hash_key, end - hash_key))
get_view_structure(table, database); get_view_structure(table, database);
}
if (opt_xml) if (opt_xml)
{ {
fputs("</database>\n", md_result_file); 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"); DBUG_ENTER("dump_selected_tables");
if (init_dumping(db, init_dumping_tables)) if (init_dumping(db, init_dumping_tables))
return 1; DBUG_RETURN(1);
init_alloc_root(&root, 8192, 0); init_alloc_root(&root, 8192, 0);
if (!(dump_tables= pos= (char**) alloc_root(&root, tables * sizeof(char *)))) 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 these two types, we do want to skip dumping the table
*/ */
if (!opt_no_data && 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; result= IGNORE_DATA;
} }
mysql_free_result(res); mysql_free_result(res);
@ -3623,7 +3639,7 @@ static char *primary_key_fields(const char *table_name)
do do
{ {
quoted_field= quote_name(row[4], buff, 0); 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); } while ((row= mysql_fetch_row(res)) && atoi(row[3]) > 1);
} }
@ -3683,7 +3699,8 @@ static int replace(DYNAMIC_STRING *ds_str,
return 1; return 1;
init_dynamic_string_checked(&ds_tmp, "", init_dynamic_string_checked(&ds_tmp, "",
ds_str->length + replace_len, 256); 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_mem_checked(&ds_tmp, replace_str, replace_len);
dynstr_append_checked(&ds_tmp, start + search_len); dynstr_append_checked(&ds_tmp, start + search_len);
dynstr_set_checked(ds_str, ds_tmp.str); 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) int main(int argc, char** argv)
{ {
FILE* fp; FILE* fp;
my_MD5_CTX context;
uchar digest[16]; uchar digest[16];
char pw[17]; char pw[17];
uint i; uint i;
@ -147,9 +146,7 @@ int main(int argc, char** argv)
if (!(fp=fopen(outfile,"w"))) if (!(fp=fopen(outfile,"w")))
die("Could not open '%s'(errno=%d)",outfile,errno); die("Could not open '%s'(errno=%d)",outfile,errno);
get_pass(pw,sizeof(pw)-1); get_pass(pw,sizeof(pw)-1);
my_MD5Init(&context); MY_MD5_HASH(digest,(uchar*) pw,sizeof(pw)-1);
my_MD5Update(&context,(uchar*) pw,sizeof(pw)-1);
my_MD5Final(digest,&context);
fprintf(fp,"%s:",user); fprintf(fp,"%s:",user);
for (i=0;i<sizeof(digest);i++) for (i=0;i<sizeof(digest);i++)
fprintf(fp,"%02x",digest[i]); fprintf(fp,"%02x",digest[i]);

View File

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

View File

@ -24,7 +24,7 @@ static bool init_line_buffer(LINE_BUFFER *buffer,File file,ulong size,
ulong max_size); ulong max_size);
static bool init_line_buffer_from_string(LINE_BUFFER *buffer,my_string str); static bool init_line_buffer_from_string(LINE_BUFFER *buffer,my_string str);
static uint fill_buffer(LINE_BUFFER *buffer); 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) 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; char *pos;
ulong out_length; 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; return 0;
if (out_length && pos[out_length-1] == '\n') if (out_length && pos[out_length-1] == '\n')
if (--out_length && pos[out_length-1] == '\r') /* Remove '\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; read_count=(buffer->bufread - bufbytes)/IO_SIZE;
if ((read_count*=IO_SIZE)) if ((read_count*=IO_SIZE))
break; 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; buffer->bufread *= 2;
if (!(buffer->buffer = (char*) my_realloc(buffer->buffer, if (!(buffer->buffer = (char*) my_realloc(buffer->buffer,
buffer->bufread+1, buffer->bufread+1,
@ -172,12 +181,16 @@ static uint fill_buffer(LINE_BUFFER *buffer)
DBUG_PRINT("fill_buff", ("Got %d bytes", read_count)); DBUG_PRINT("fill_buff", ("Got %d bytes", read_count));
/* Kludge to pretend every nonempty file ends with a newline. */ if (!read_count)
if (!read_count && bufbytes && buffer->end[-1] != '\n')
{ {
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 = '\n';
} }
}
buffer->end_of_line=(buffer->start_of_line=buffer->buffer)+bufbytes; buffer->end_of_line=(buffer->start_of_line=buffer->buffer)+bufbytes;
buffer->end+=read_count; buffer->end+=read_count;
*buffer->end=0; /* Sentinel */ *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; char *pos;
uint length; uint length;
@ -200,14 +213,23 @@ char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length)
pos++; pos++;
if (pos == buffer->end) 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 (!(length=fill_buffer(buffer)) || length == (uint) -1)
{
if (buffer->eof)
DBUG_RETURN(0); DBUG_RETURN(0);
}
else
continue; continue;
}
pos--; /* break line here */ pos--; /* break line here */
*truncated= 1;
} }
else
*truncated= 0;
buffer->end_of_line=pos+1; buffer->end_of_line=pos+1;
*out_length=(ulong) (pos + 1 - buffer->eof - buffer->start_of_line); *out_length=(ulong) (pos + 1 - buffer->eof - buffer->start_of_line);
DBUG_RETURN(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) bool String::append(const char *s)
{ {
return append(s, strlen(s)); return append(s, (uint) strlen(s));
} }

View File

@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line! # The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb # 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]) AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10 PROTOCOL_VERSION=10
@ -23,7 +23,7 @@ NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0
# ndb version # ndb version
NDB_VERSION_MAJOR=5 NDB_VERSION_MAJOR=5
NDB_VERSION_MINOR=0 NDB_VERSION_MINOR=0
NDB_VERSION_BUILD=79 NDB_VERSION_BUILD=80
NDB_VERSION_STATUS="" NDB_VERSION_STATUS=""
# Set all version vars based on $VERSION. How do we do this more elegant ? # Set all version vars based on $VERSION. How do we do this more elegant ?

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -78,7 +78,7 @@ typename A::pointer StdReallocate(A& a, T* p, typename A::size_type oldSize,
if (preserve) { if (preserve) {
A b = A(); A b = A();
typename A::pointer newPointer = b.allocate(newSize, 0); 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); a.deallocate(p, oldSize);
STL::swap(a, b); STL::swap(a, b);
return newPointer; return newPointer;

View File

@ -288,7 +288,7 @@ void AbstractGroup::SimultaneousMultiply(Integer *results, const Integer &base,
r = buckets[i][buckets[i].size()-1]; r = buckets[i][buckets[i].size()-1];
if (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(buckets[i][j], buckets[i][j+1]);
Accumulate(r, buckets[i][j]); 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) Signer::Signer(const byte* k, word32 kSz, const char* n, const byte* h)
: key_(k, kSz) : key_(k, kSz)
{ {
int sz = strlen(n); size_t sz = strlen(n);
memcpy(name_, n, sz); memcpy(name_, n, sz);
name_[sz] = 0; name_[sz] = 0;

View File

@ -69,7 +69,7 @@ int heap_write(HP_INFO *info, const byte *record)
err: err:
if (my_errno == HA_ERR_FOUND_DUPP_KEY) if (my_errno == HA_ERR_FOUND_DUPP_KEY)
DBUG_PRINT("info",("Duplicate key: %d", (int) (keydef - share->keydef))); 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 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 we got ENOMEM, the key wasn't inserted, so don't try to delete it

View File

@ -13,80 +13,42 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 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 /* Unlike previous versions of this code, uint32 need not be exactly
rights reserved. 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 { typedef struct {
UINT4 state[4]; /* state (ABCD) */ cvs_uint32 buf[4];
UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ cvs_uint32 bits[2];
unsigned char buffer[64]; /* input buffer */ unsigned char in[64];
} my_MD5_CTX; } my_MD5Context;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void my_MD5Init PROTO_LIST ((my_MD5_CTX *)); void my_MD5Init (my_MD5Context *context);
void my_MD5Update PROTO_LIST void my_MD5Update (my_MD5Context *context,
((my_MD5_CTX *, unsigned char *, unsigned int)); unsigned char const *buf, unsigned len);
void my_MD5Final PROTO_LIST ((unsigned char [16], my_MD5_CTX *)); void my_MD5Final (unsigned char digest[16],
my_MD5Context *context);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #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_safe_to_handle_signal, /* Set when allowed to SIGTSTP */
NEAR my_dont_interrupt; /* call remember_intr when set */ NEAR my_dont_interrupt; /* call remember_intr when set */
extern my_bool NEAR mysys_uses_curses, my_use_symdir; 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 ulong my_default_record_cache_size;
extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io, 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); extern void TERMINATE(FILE *file);
#endif #endif
extern void init_glob_errs(void); 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_fopen(const char *FileName,int Flags,myf MyFlags);
extern FILE *my_fdopen(File Filedes,const char *name, 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); extern int my_fclose(FILE *fd,myf MyFlags);

View File

@ -484,7 +484,7 @@ struct for_node_struct{
definition */ definition */
que_node_t* loop_start_limit;/* initial value of loop variable */ que_node_t* loop_start_limit;/* initial value of loop variable */
que_node_t* loop_end_limit; /* end 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 it is calculated only when the loop
is entered, and will not change within is entered, and will not change within
the loop */ the loop */

View File

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

View File

@ -587,7 +587,7 @@ cmp_dtuple_rec_with_match(
dtuple_byte = cmp_collate(dtuple_byte); dtuple_byte = cmp_collate(dtuple_byte);
} }
ret = dtuple_byte - rec_byte; ret = (uint) (dtuple_byte - rec_byte);
if (UNIV_UNLIKELY(ret)) { if (UNIV_UNLIKELY(ret)) {
if (ret < 0) { if (ret < 0) {
ret = -1; 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 *start= value + param->offset;
char *end= value + length; char *end= value + length;
ulong copy_length; size_t copy_length;
if (start < end) if (start < end)
{ {
copy_length= end - start; 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 && if (field->flags & ZEROFILL_FLAG && length < field->length &&
field->length < MAX_DOUBLE_STRING_REP_LENGTH - 1) 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'); bfill((char*) buff, field->length - length, '0');
length= field->length; length= field->length;
} }
fetch_string_with_conversion(param, buff, length); fetch_string_with_conversion(param, buff, (uint) length);
} }
break; break;

View File

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

View File

@ -659,7 +659,7 @@ void mi_collect_stats_nonulls_first(HA_KEYSEG *keyseg, ulonglong *notnull,
uchar *key) uchar *key)
{ {
uint first_null, kp; 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 All prefix tuples that don't include keypart_{first_null} are not-null
tuples (and all others aren't), increment counters for them. 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; seg= keyseg + diffs[0] - 1;
/* Find first NULL in last_key */ /* 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++) for (kp= 0; kp < first_null_seg; kp++)
notnull[kp]++; notnull[kp]++;
@ -3913,7 +3913,7 @@ static int sort_ft_key_write(MI_SORT_PARAM *sort_param, const void *a)
key_block++; key_block++;
sort_info->key_block=key_block; sort_info->key_block=key_block;
sort_param->keyinfo=& sort_info->info->s->ft2_keyinfo; 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 */ /* flushing buffer to second-level tree */
for (error=0; !error && p < ft_buf->buf; p+= val_len) 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.rec_per_key_part=rec_per_key_part;
share_buff.state.key_root=key_root; share_buff.state.key_root=key_root;
share_buff.state.key_del=key_del; 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", DBUG_EXECUTE_IF("myisam_pretend_crashed_table_on_open",
if (strstr(name, "/t1")) 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) * (char*) key_del, (sizeof(my_off_t) *
share->state.header.max_block_size)); share->state.header.max_block_size));
strmov(share->unique_file_name, name_buff); 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->index_file_name, index_name);
strmov(share->data_file_name, data_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)); MYF(MY_HOLD_ON_ERROR));
/* Fix the table addresses in the tree heads. */ /* 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; share->decode_tables=decode_table;
for (i=0 ; i < trees ; i++) for (i=0 ; i < trees ; i++)
share->decode_trees[i].table=ADD_TO_PTR(share->decode_trees[i].table, share->decode_trees[i].table=ADD_TO_PTR(share->decode_trees[i].table,

View File

@ -408,7 +408,7 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
} }
from+=keyseg->length; from+=keyseg->length;
page=from+nod_flag; page=from+nod_flag;
length=from-vseg; length= (uint) (from - vseg);
} }
if (page > end) 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))) _mi_kpos(nod_flag, k), level + 1)))
{ {
case 0: /* found - exit from recursion */ case 0: /* found - exit from recursion */
*saved_key = k - page_buf; *saved_key = (uint) (k - page_buf);
goto ok; goto ok;
case 1: /* not found - continue searching */ case 1: /* not found - continue searching */
info->rtree_recursion_depth = level; 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; info->lastkey_length = k_len + info->s->base.rec_reflength;
memcpy(info->lastkey, k, info->lastkey_length); memcpy(info->lastkey, k, info->lastkey_length);
info->rtree_recursion_depth = level; info->rtree_recursion_depth = level;
*saved_key = last - page_buf; *saved_key = (uint) (last - page_buf);
if (after_key < last) 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))) _mi_kpos(nod_flag, k), level + 1)))
{ {
case 0: /* found - exit from recursion */ case 0: /* found - exit from recursion */
*saved_key = k - page_buf; *saved_key = (uint) (k - page_buf);
goto ok; goto ok;
case 1: /* not found - continue searching */ case 1: /* not found - continue searching */
info->rtree_recursion_depth = level; 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); memcpy(info->lastkey, k, info->lastkey_length);
info->rtree_recursion_depth = level; info->rtree_recursion_depth = level;
*saved_key = k - page_buf; *saved_key = (uint) (k - page_buf);
if (after_key < last) 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; info->lastkey_length = k_len + info->s->base.rec_reflength;
memcpy(info->lastkey, key, 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) if (after_key >= info->int_maxpos)
{ {
info->buff_used = 1; info->buff_used = 1;

View File

@ -3,29 +3,49 @@
# in test cases and can be reused. # # 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 --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; 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> --replace_column 1 <the_backup_id>
SELECT @the_backup_id:=backup_id FROM test.backup_info; 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; DROP TABLE test.backup_info;

View File

@ -2,11 +2,20 @@
# #
# SUMMARY # SUMMARY
# #
# Waits until the passed number ($count_sessions) of concurrent sessions was # Waits until the passed number ($count_sessions) of concurrent sessions or
# observed via # a smaller number was observed via
# SHOW STATUS LIKE 'Threads_connected' # SHOW STATUS LIKE 'Threads_connected'
# or the operation times out. # 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 # SELECT COUNT(*) FROM information_schema.processlist
# I stay with "SHOW STATUS LIKE 'Threads_connected'" because this # I stay with "SHOW STATUS LIKE 'Threads_connected'" because this
# runs in all versions 5.0+ # runs in all versions 5.0+
@ -19,7 +28,7 @@
# #
# OR typical example of a test which uses more than one session # 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 # 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 # If the testing box is slow than the disconnect of sessions belonging to
# the current test might happen when the successing test gets executed. # the current test might happen when the successing test gets executed.
@ -79,7 +88,11 @@
# backup.test, grant3.test # 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; let $wait_counter= 100;
@ -93,7 +106,7 @@ let $wait_timeout= 0;
while ($wait_counter) while ($wait_counter)
{ {
let $current_sessions= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1); 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) if ($success)
{ {
let $wait_counter= 0; let $wait_counter= 0;
@ -107,7 +120,7 @@ while ($wait_counter)
if (!$success) if (!$success)
{ {
--echo # Timeout in wait_until_count_sessions.inc --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; SHOW PROCESSLIST;
} }

View File

@ -1,15 +1,23 @@
drop table if exists t1; DROP TABLE IF EXISTS t1;
create table t1 (a int) engine=innodb; # Establish connection con1 (user=root)
start transaction with consistent snapshot; # Establish connection con2 (user=root)
insert into t1 values(1); # Switch to connection con1
select * from t1; 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 a
commit; COMMIT;
delete from t1; DELETE FROM t1;
start transaction; START TRANSACTION;
insert into t1 values(1); # Switch to connection con2
select * from t1; INSERT INTO t1 VALUES(1);
# Switch to connection con1
SELECT * FROM t1;
a a
1 1
commit; COMMIT;
drop table t1; # 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 Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
drop table t1; 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; DROP TABLE IF EXISTS t1;
create table t1 (n int); CREATE TABLE t1 (n INT);
insert into t1 values (1),(2),(3); INSERT INTO t1 VALUES (1),(2),(3);
select * from t1; SELECT * FROM t1;
n n
1 1
2 2
3 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: 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` 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; 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 a
DROP TABLE t1; DROP TABLE t1;
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 End of 5.0 tests
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_MASTER_CONCURRENT_INSERT; SET @@GLOBAL.CONCURRENT_INSERT= @OLD_MASTER_CONCURRENT_INSERT;
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT; SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;

View File

@ -1,39 +1,57 @@
drop table if exists t1; # Establish connection con1 (user=root)
create table t1 (a int) engine=innodb; # Establish connection con2 (user=root)
begin; # Establish connection con3 (user=root)
insert into t1 values(1); # Switch to connection con1
flush tables with read lock; DROP TABLE IF EXISTS t1;
select * from 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 a
commit; # Switch to connection con1
select * from t1; COMMIT;
# Switch to connection con2
SELECT * FROM t1;
a a
unlock tables; UNLOCK TABLES;
begin; # Switch to connection con1
select * from t1 for update; # Switch to connection con1
BEGIN;
SELECT * FROM t1 FOR UPDATE;
a a
1 1
begin; # Switch to connection con2
select * from t1 for update; BEGIN;
flush tables with read lock; SELECT * FROM t1 FOR UPDATE;
commit; # Switch to connection con3
FLUSH TABLES WITH READ LOCK;
# Switch to connection con1
COMMIT;
# Switch to connection con2
a a
1 1
unlock tables; # Switch to connection con3
commit; UNLOCK TABLES;
begin; # Switch to connection con2
insert into t1 values(10); COMMIT;
flush tables with read lock; # Switch to connection con1
commit; BEGIN;
unlock tables; INSERT INTO t1 VALUES(10);
flush tables with read lock; FLUSH TABLES WITH READ LOCK;
unlock tables; COMMIT;
begin; UNLOCK TABLES;
select * from t1; # Switch to connection con2
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;
BEGIN;
SELECT * FROM t1;
a a
1 1
10 10
show create database test; SHOW CREATE DATABASE test;
Database Create Database Database Create Database
test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ 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; # Establish connection con1 (user=root)
reset master; # Establish connection con2 (user=root)
set autocommit=0; # Switch to connection con1
insert t1 values (1); CREATE TABLE t1 (a INT) ENGINE=innodb;
flush tables with read lock; RESET MASTER;
show master status; 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 File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 98 master-bin.000001 98
commit; # Switch to connection con1
show master status; COMMIT;
# Switch to connection con2
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 98 master-bin.000001 98
unlock tables; UNLOCK TABLES;
drop table t1; # Switch to connection con1
set autocommit=1; 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; SET @old_concurrent_insert= @@global.concurrent_insert;
create table t1 (kill_id int); SET @@global.concurrent_insert= 0;
insert into t1 values(connection_id()); DROP TABLE IF EXISTS t1;
flush tables with read lock; CREATE TABLE t1 (kill_id INT);
select ((@id := kill_id) - kill_id) from t1; INSERT INTO t1 VALUES(connection_id());
FLUSH TABLES WITH READ LOCK;
SELECT ((@id := kill_id) - kill_id) FROM t1;
((@id := kill_id) - kill_id) ((@id := kill_id) - kill_id)
0 0
kill connection @id; KILL CONNECTION @id;
drop table t1; 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; UNLOCK TABLES;
DROP DATABASE mysqltest_1; DROP DATABASE mysqltest_1;
ERROR HY000: Can't drop database 'mysqltest_1'; database doesn't exist 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; LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
FLUSH TABLES; FLUSH TABLES;
use mysql; USE mysql;
SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1; SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
OPTIMIZE TABLES columns_priv, db, host, user; OPTIMIZE TABLES columns_priv, db, host, user;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
@ -65,7 +65,7 @@ mysql.user optimize status OK
UNLOCK TABLES; UNLOCK TABLES;
Select_priv Select_priv
N N
use test; USE test;
use test; use test;
CREATE TABLE t1 (c1 int); CREATE TABLE t1 (c1 int);
LOCK TABLE t1 WRITE; LOCK TABLE t1 WRITE;
@ -93,7 +93,7 @@ create table t1 (a int);
connection: locker connection: locker
lock tables t1 read; lock tables t1 read;
connection: writer connection: writer
create table t2 like t1;; create table t2 like t1;
connection: default connection: default
kill query kill query
ERROR 70100: Query execution was interrupted 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

@ -192,4 +192,13 @@ delimiter
1 1
1 1
1 1
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;
End of 5.0 tests End of 5.0 tests

View File

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

View File

@ -3559,6 +3559,60 @@ DROP TABLE t1,t2;
-- Dump completed on DATE -- Dump completed on DATE
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT; 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 # Bug#33550 mysqldump 4.0 compatibility broken
# #
SET NAMES utf8; 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 t8 engine=myisam as select * from t8_c;
create table t9 engine=myisam as select * from t9_c; create table t9 engine=myisam as select * from t9_c;
create table t10 engine=myisam as select * from t10_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; 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; SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id @the_backup_id:=backup_id
<the_backup_id> <the_backup_id>

View File

@ -227,9 +227,11 @@ hex(h3) NULL
hex(i1) NULL hex(i1) NULL
hex(i2) NULL hex(i2) NULL
hex(i3) 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; 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; SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id @the_backup_id:=backup_id
<the_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 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 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); 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; 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; SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id @the_backup_id:=backup_id
<the_backup_id> <the_backup_id>
@ -305,9 +309,11 @@ create table t1
insert into t1 values(1, 8388607, 16777215); insert into t1 values(1, 8388607, 16777215);
insert into t1 values(2, -8388608, 0); insert into t1 values(2, -8388608, 0);
insert into t1 values(3, -1, 1); 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; 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; SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id @the_backup_id:=backup_id
<the_backup_id> <the_backup_id>

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' 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'; 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'; DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
select user(); SELECT USER();
user() USER()
# #
show processlist; SHOW PROCESSLIST;
Id User Host db Command Time State Info Id User Host db Command Time State Info
<id> root <host> test <command> <time> <state> <info> <id> root <host> test <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 user user_bug14533@localhost;
drop database db_bug14533; drop database db_bug14533;
CREATE DATABASE db_bug7787; CREATE DATABASE db_bug7787;
use db_bug7787; USE db_bug7787;
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
SHOW INNODB STATUS; SHOW INNODB STATUS;
Warnings: Warnings:
@ -352,12 +352,12 @@ GRANT SUPER ON *.* TO mysqltest_2@localhost;
GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost; GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
---> connection: mysqltest_2_con ---> connection: mysqltest_2_con
use mysqltest; USE mysqltest;
CREATE PROCEDURE wl2897_p1() SELECT 1; CREATE PROCEDURE wl2897_p1() SELECT 1;
CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1; CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1;
---> connection: mysqltest_1_con ---> connection: mysqltest_1_con
use mysqltest; USE mysqltest;
CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2; CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2;
ERROR 42000: Access denied; you need the SUPER privilege for this operation ERROR 42000: Access denied; you need the SUPER privilege for this operation
CREATE DEFINER=root@localhost FUNCTION wl2897_f2() RETURNS INT RETURN 2; 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 Note 1449 There is no 'a @ b @ c'@'localhost' registered
---> connection: con1root ---> connection: con1root
use mysqltest; USE mysqltest;
SHOW CREATE PROCEDURE wl2897_p1; SHOW CREATE PROCEDURE wl2897_p1;
Procedure sql_mode Create Procedure Procedure sql_mode Create Procedure
wl2897_p1 CREATE DEFINER=`mysqltest_2`@`localhost` PROCEDURE `wl2897_p1`() 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; GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
---> connection: mysqltest_1_con ---> connection: mysqltest_1_con
use mysqltest; USE mysqltest;
CREATE PROCEDURE bug13198_p1() CREATE PROCEDURE bug13198_p1()
SELECT 1; SELECT 1;
CREATE FUNCTION bug13198_f1() RETURNS INT CREATE FUNCTION bug13198_f1() RETURNS INT
@ -416,7 +416,7 @@ bug13198_f1()
1 1
---> connection: mysqltest_2_con ---> connection: mysqltest_2_con
use mysqltest; USE mysqltest;
CALL bug13198_p1(); CALL bug13198_p1();
1 1
1 1
@ -428,7 +428,7 @@ bug13198_f1()
DROP USER mysqltest_1@localhost; DROP USER mysqltest_1@localhost;
---> connection: mysqltest_2_con ---> connection: mysqltest_2_con
use mysqltest; USE mysqltest;
CALL bug13198_p1(); CALL bug13198_p1();
ERROR HY000: There is no 'mysqltest_1'@'localhost' registered ERROR HY000: There is no 'mysqltest_1'@'localhost' registered
SELECT bug13198_f1(); SELECT bug13198_f1();
@ -445,7 +445,7 @@ Host User Password
localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C
---> connection: mysqltest_2_con ---> connection: mysqltest_2_con
use test; USE test;
CREATE PROCEDURE sp19857() DETERMINISTIC CREATE PROCEDURE sp19857() DETERMINISTIC
BEGIN BEGIN
DECLARE a INT; DECLARE a INT;

View File

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

View File

@ -3603,7 +3603,7 @@ DROP VIEW v2;
DROP VIEW v3; DROP VIEW v3;
DROP TABLE t1; 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. # a default value when inserting into a view.
# #
create table t1(f1 int, f2 int not null); create table t1(f1 int, f2 int not null);
@ -3643,7 +3643,7 @@ MAX(a) COUNT(DISTINCT a)
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; 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; DROP TABLE IF EXISTS t1;
@ -3660,7 +3660,7 @@ DROP TABLE t1;
# -- End of test case for Bug#34337. # -- 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 # -- 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 USER u26813@localhost;
DROP DATABASE db26813; 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; CREATE DATABASE mysqltest_29908;
USE 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 sqrt(my_bigint) my_bigint id
NULL NULL 1 NULL NULL 1
NULL -9223372036854775808 2 NULL -9223372036854775808 2
3037000499.976 9223372036854775807 3 3037000499.97605 9223372036854775807 3
0 0 4 0 0 4
NULL -1 5 NULL -1 5
2 4 6 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 sqrt(my_bigint) my_bigint id
NULL NULL 1 NULL NULL 1
NULL -9223372036854775808 2 NULL -9223372036854775808 2
3037000499.976 9223372036854775807 3 3037000499.97605 9223372036854775807 3
0 0 4 0 0 4
NULL -1 5 NULL -1 5
2 4 6 2 4 6

View File

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

View File

@ -23043,7 +23043,7 @@ ERROR 42S02: Table 'test.v1' doesn't exist
CHECK TABLE v1; CHECK TABLE v1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.v1 check Error Table 'test.v1' doesn't exist test.v1 check Error Table 'test.v1' doesn't exist
test.v1 check error Corrupt test.v1 check status Operation failed
DESCRIBE v1; DESCRIBE v1;
ERROR 42S02: Table 'test.v1' doesn't exist ERROR 42S02: Table 'test.v1' doesn't exist
EXPLAIN SELECT * FROM v1; 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) # significant time (e.g. about 9 seconds on my (Dmitri's) computer)
# so we probably want execute it only in --big-test mode. # so we probably want execute it only in --big-test mode.
# Also in 5.1 this test will require statement-based binlog. # 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 # Test for Bug#25044 ALTER TABLE ... ENABLE KEYS acquires global
# 'opening tables' lock". # 'opening tables' lock
# #
# ALTER TABLE ... ENABLE KEYS should not acquire LOCK_open mutex for # ALTER TABLE ... ENABLE KEYS should not acquire LOCK_open mutex for
# the whole its duration as it prevents other queries from execution. # 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 # Clean up
drop tables t1, t2; drop tables t1, t2;
disconnect addconroot;
--echo End of 5.0 tests --echo End of 5.0 tests

View File

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

View File

@ -1,43 +1,61 @@
--source include/have_innodb.inc --source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings --disable_warnings
drop table if exists t1; DROP TABLE IF EXISTS t1;
--enable_warnings --enable_warnings
--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
### Test 1: ### Test 1:
### - While a consistent snapshot transaction is executed, ### - While a consistent snapshot transaction is executed,
### no external inserts should be visible to the transaction. ### no external inserts should be visible to the transaction.
--echo # Switch to connection con1
connection con1; connection con1;
create table t1 (a int) engine=innodb; CREATE TABLE t1 (a INT) ENGINE=innodb;
start transaction with consistent snapshot; START TRANSACTION WITH CONSISTENT SNAPSHOT;
--echo # Switch to connection con2
connection con2; connection con2;
insert into t1 values(1); INSERT INTO t1 VALUES(1);
--echo # Switch to connection con1
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. # should see nothing.
commit; COMMIT;
### Test 2: ### Test 2:
### - For any non-consistent snapshot transaction, external ### - For any non-consistent snapshot transaction, external
### committed inserts should be visible to the transaction. ### committed inserts should be visible to the transaction.
delete from t1; DELETE FROM t1;
start transaction; # Now we omit WITH CONSISTENT SNAPSHOT START TRANSACTION; # Now we omit WITH CONSISTENT SNAPSHOT
--echo # Switch to connection con2
connection con2; connection con2;
insert into t1 values(1); INSERT INTO t1 VALUES(1);
--echo # Switch to connection con1
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. # 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 # 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; insert into t1 set a=0x4c98;
check table t1 extended; check table t1 extended;
drop table t1; 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 (con1,localhost,root,,);
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
connection con1; connection con1;
@ -5,12 +9,19 @@ dirty_close con1;
connection con2; connection con2;
--disable_warnings --disable_warnings
drop table if exists t1; DROP TABLE IF EXISTS t1;
--enable_warnings --enable_warnings
create table t1 (n int); CREATE TABLE t1 (n INT);
insert into t1 values (1),(2),(3); INSERT INTO t1 VALUES (1),(2),(3);
select * from t1; SELECT * FROM t1;
drop table t1; DROP TABLE t1;
connection default;
disconnect con2;
# End of 4.1 tests # 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; 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. # End of 5.0 tests.

View File

@ -1843,6 +1843,28 @@ DROP TABLE t1;
connection master; connection master;
DROP TABLE t1; 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; connection default;
--echo End of 5.0 tests --echo End of 5.0 tests

View File

@ -6,72 +6,104 @@
# And it requires InnoDB # And it requires InnoDB
--source include/have_innodb.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,,); connect (con1,localhost,root,,);
--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
--echo # Establish connection con3 (user=root)
connect (con3,localhost,root,,); connect (con3,localhost,root,,);
--echo # Switch to connection con1
connection con1; connection con1;
--disable_warnings --disable_warnings
drop table if exists t1; DROP TABLE IF EXISTS t1;
--enable_warnings --enable_warnings
create table t1 (a int) engine=innodb; CREATE TABLE t1 (a INT) ENGINE=innodb;
# blocks COMMIT ? # blocks COMMIT ?
begin; BEGIN;
insert into t1 values(1); INSERT INTO t1 VALUES(1);
--echo # Switch to connection con2
connection con2; connection con2;
flush tables with read lock; FLUSH TABLES WITH READ LOCK;
select * from t1; SELECT * FROM t1;
--echo # Switch to connection con1
connection con1; connection con1;
send commit; # blocked by con2 send COMMIT; # blocked by con2
sleep 1; sleep 1;
--echo # Switch to connection con2
connection con2; connection con2;
select * from t1; # verify con1 was blocked and data did not move SELECT * FROM t1; # verify con1 was blocked and data did not move
unlock tables; UNLOCK TABLES;
--echo # Switch to connection con1
connection con1; connection con1;
reap; reap;
# No deadlock ? # No deadlock ?
--echo # Switch to connection con1
connection con1; connection con1;
begin; BEGIN;
select * from t1 for update; SELECT * FROM t1 FOR UPDATE;
--echo # Switch to connection con2
connection con2; connection con2;
begin; BEGIN;
send select * from t1 for update; # blocked by con1 send SELECT * FROM t1 FOR UPDATE; # blocked by con1
sleep 1; sleep 1;
--echo # Switch to connection con3
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; connection con1;
commit; # should not be blocked by con3 COMMIT; # should not be blocked by con3
--echo # Switch to connection con2
connection con2; connection con2;
reap; reap;
--echo # Switch to connection con3
connection con3; connection con3;
reap; 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 # WITH READ LOCK
--echo # Switch to connection con2
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; connection con1;
begin; BEGIN;
insert into t1 values(10); INSERT INTO t1 VALUES(10);
flush tables with read lock; FLUSH TABLES WITH READ LOCK;
commit; COMMIT;
unlock tables; UNLOCK TABLES;
--echo # Switch to connection con2
connection con2; connection con2;
flush tables with read lock; # bug caused hang here FLUSH TABLES WITH READ LOCK; # bug caused hang here
unlock tables; UNLOCK TABLES;
# BUG#7358 SHOW CREATE DATABASE fails if open transaction # Bug#7358 SHOW CREATE DATABASE fails if open transaction
begin; BEGIN;
select * from t1; SELECT * FROM t1;
show create database test; 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 # 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_log_bin.inc
--source include/have_innodb.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,,); connect (con1,localhost,root,,);
--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
# FLUSH TABLES WITH READ LOCK should block writes to binlog too # FLUSH TABLES WITH READ LOCK should block writes to binlog too
--echo # Switch to connection con1
connection con1; connection con1;
create table t1 (a int) engine=innodb; CREATE TABLE t1 (a INT) ENGINE=innodb;
reset master; RESET MASTER;
set autocommit=0; SET AUTOCOMMIT=0;
insert t1 values (1); INSERT t1 VALUES (1);
--echo # Switch to connection con2
connection con2; connection con2;
flush tables with read lock; FLUSH TABLES WITH READ LOCK;
show master status; SHOW MASTER STATUS;
--echo # Switch to connection con1
connection con1; connection con1;
send commit; send COMMIT;
--echo # Switch to connection con2
connection con2; connection con2;
sleep 1; sleep 1;
show master status; SHOW MASTER STATUS;
unlock tables; UNLOCK TABLES;
--echo # Switch to connection con1
connection con1; connection con1;
reap; reap;
drop table t1; DROP TABLE t1;
set autocommit=1; 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 --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 (con1,localhost,root,,);
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
connection con1; connection con1;
--disable_warnings --disable_warnings
drop table if exists t1; DROP TABLE IF EXISTS t1;
--enable_warnings --enable_warnings
create table t1 (kill_id int); CREATE TABLE t1 (kill_id INT);
insert into t1 values(connection_id()); INSERT INTO t1 VALUES(connection_id());
# Thanks to the parameter we passed to --debug, this FLUSH will # Thanks to the parameter we passed to --debug, this FLUSH will
# block on a debug build running with our --debug=make_global... It # 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 # --debug) it will succeed immediately
connection con1; connection con1;
send flush tables with read lock; send FLUSH TABLES WITH READ LOCK;
# kill con1 # kill con1
connection con2; 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 --sleep 2 # leave time for FLUSH to block
kill connection @id; KILL CONNECTION @id;
connection con1; connection con1;
# On debug builds it will be error 1053 (killed); on non-debug, or # On debug builds it will be error 1053 (killed); on non-debug, or
@ -46,4 +54,13 @@ connection con1;
reap; reap;
connection con2; 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 # should work with embedded server after mysqltest is fixed
--source include/not_embedded.inc --source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--source include/add_anonymous_users.inc --source include/add_anonymous_users.inc
connect (con0,localhost,root,,); connect (con0,localhost,root,,);
@ -233,7 +236,8 @@ connect (con1,localhost,mysqltest1,,);
connection con1; connection con1;
select * from t1; select * from t1;
connection con0; connection default;
disconnect con0;
disconnect con1; disconnect con1;
drop trigger trg1; drop trigger trg1;
@ -244,3 +248,7 @@ set global init_connect="set @a='a\\0c'";
revoke all privileges, grant option from mysqltest1@localhost; revoke all privileges, grant option from mysqltest1@localhost;
drop user mysqltest1@localhost; drop user mysqltest1@localhost;
drop table t1, t2; 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 -- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings --disable_warnings
drop table if exists t1,t2; drop table if exists t1,t2;
--enable_warnings --enable_warnings
@ -14,12 +18,23 @@ create table t1(n int);
insert into t1 values (1); insert into t1 values (1);
lock tables t1 write; lock tables t1 write;
connection writer; connection writer;
send update low_priority t1 set n = 4; send
update low_priority t1 set n = 4;
connection reader; connection reader;
--sleep 2 # Sleep a bit till the update of connection writer is in work and hangs
send select n from t1; 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; 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; unlock tables;
connection writer; connection writer;
reap; reap;
@ -32,12 +47,23 @@ create table t1(n int);
insert into t1 values (1); insert into t1 values (1);
lock tables t1 read; lock tables t1 read;
connection writer; connection writer;
send update low_priority t1 set n = 4; send
update low_priority t1 set n = 4;
connection reader; connection reader;
--sleep 2 # Sleep a bit till the update of connection writer is in work and hangs
send select n from t1; 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; 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; unlock tables;
connection writer; connection writer;
reap; reap;
@ -58,10 +84,13 @@ insert into t1 values(2,2);
insert into t2 values(1,2); insert into t2 values(1,2);
lock table t1 read; lock table t1 read;
connection writer; connection writer;
--sleep 2 send
send update t1,t2 set c=a where b=d; update t1,t2 set c=a where b=d;
connection reader; 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; select c from t2;
connection writer; connection writer;
reap; reap;
@ -70,7 +99,7 @@ drop table t1;
drop table t2; 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 # is to-be-locked by another thread
# #
@ -79,11 +108,18 @@ create table t1 (a int);
create table t2 (a int); create table t2 (a int);
lock table t1 write, t2 write; lock table t1 write, t2 write;
connection reader; connection reader;
send insert t1 select * from t2; send
insert t1 select * from t2;
connection locker; 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; drop table t2;
connection reader; connection reader;
--error 1146 --error ER_NO_SUCH_TABLE
reap; reap;
connection locker; connection locker;
drop table t1; drop table t1;
@ -91,7 +127,7 @@ drop table t1;
# End of 4.1 tests # 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); create table t1(a int);
lock tables t1 write; lock tables t1 write;
@ -102,7 +138,7 @@ unlock tables;
drop table t1; 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 (con1,localhost,root,,);
connect (con2,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 # With bug in place: acquire LOCK_mysql_create_table and
# wait in wait_if_global_read_lock(). # wait in wait_if_global_read_lock().
connection con2; connection con2;
send DROP DATABASE mysqltest_1; send
--sleep 1 DROP DATABASE mysqltest_1;
# #
# With bug in place: try to acquire LOCK_mysql_create_table... # With bug in place: try to acquire LOCK_mysql_create_table...
# When fixed: Reject dropping db because of the read lock. # When fixed: Reject dropping db because of the read lock.
connection con1; 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 --error ER_CANT_UPDATE_WITH_READLOCK
DROP DATABASE mysqltest_1; DROP DATABASE mysqltest_1;
UNLOCK TABLES; UNLOCK TABLES;
@ -135,26 +177,33 @@ disconnect con2;
--error ER_DB_DROP_EXISTS --error ER_DB_DROP_EXISTS
DROP DATABASE mysqltest_1; 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 # Need a matching user in mysql.user for multi-table select
--source include/add_anonymous_users.inc --source include/add_anonymous_users.inc
connection locker; connection locker;
use mysql; USE mysql;
LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE; LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
FLUSH TABLES; FLUSH TABLES;
--sleep 1
#
connection reader; connection reader;
use mysql; USE mysql;
#NOTE: This must be a multi-table select, otherwise the deadlock will not occur # 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; send
--sleep 1 SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
# #
connection locker; 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. # Make test case independent from earlier grants.
--replace_result "Table is already up to date" "OK" --replace_result "Table is already up to date" "OK"
OPTIMIZE TABLES columns_priv, db, host, user; OPTIMIZE TABLES columns_priv, db, host, user;
@ -162,7 +211,7 @@ UNLOCK TABLES;
# #
connection reader; connection reader;
reap; reap;
use test; USE test;
# #
connection locker; connection locker;
use test; use test;
@ -177,11 +226,17 @@ LOCK TABLE t1 WRITE;
# #
# This waits until t1 is unlocked. # This waits until t1 is unlocked.
connection locker; connection locker;
send FLUSH TABLES WITH READ LOCK; send
--sleep 1 FLUSH TABLES WITH READ LOCK;
# #
# This must not block. # This must not block.
connection writer; 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); CREATE TABLE t2 (c1 int);
UNLOCK TABLES; UNLOCK TABLES;
# #
@ -201,12 +256,18 @@ LOCK TABLE t1 WRITE;
# #
# This waits until t1 is unlocked. # This waits until t1 is unlocked.
connection locker; connection locker;
send FLUSH TABLES WITH READ LOCK; send
--sleep 1 FLUSH TABLES WITH READ LOCK;
# #
# This must not block. # This must not block.
connection writer; 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; CREATE TABLE t2 AS SELECT * FROM t1;
UNLOCK TABLES; UNLOCK TABLES;
# #
@ -220,8 +281,9 @@ DROP TABLE t1;
--source include/delete_anonymous_users.inc --source include/delete_anonymous_users.inc
# #
# Bug #17264: MySQL Server freeze # Bug#17264 MySQL Server freeze
# #
connection locker; connection locker;
# Disable warnings to allow test to run also without InnoDB # 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 --enable_warnings
lock tables t1 write; lock tables t1 write;
connection writer; 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 //; 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 ;// delimiter ;//
connection reader; 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 //; 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 ;// delimiter ;//
connection locker; connection locker;
--sleep 2 # Wait till connection reader is blocked
# Here we cannot use include/wait_show_condition.inc.
--sleep 3
unlock tables; unlock tables;
connection writer; connection writer;
reap; reap;
@ -263,7 +337,7 @@ lock tables t1 read;
--echo connection: writer --echo connection: writer
connection writer; connection writer;
let $ID= `select connection_id()`; let $ID= `select connection_id()`;
--send create table t2 like t1; send create table t2 like t1;
--echo connection: default --echo connection: default
connection default; connection default;
let $show_type= open tables where in_use=2 and name_locked=1; let $show_type= open tables where in_use=2 and name_locked=1;
@ -282,7 +356,7 @@ connection default;
drop table t1; drop table t1;
# #
# Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while # Bug#38691 segfault/abort in ``UPDATE ...JOIN'' while
# ``FLUSH TABLES WITH READ LOCK'' # ``FLUSH TABLES WITH READ LOCK''
# #
@ -354,7 +428,7 @@ while ($i) {
dec $i; dec $i;
--connection locker --connection locker
--error 0,1060 --error 0,ER_DUP_FIELDNAME
ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL; ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t2 SET a=b; 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 --send UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) SET a = NULL WHERE t1.b <> t2.b
--connection locker --connection locker
--error 0,1091 --error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP COLUMN a; ALTER TABLE t2 DROP COLUMN a;
--connection writer --connection writer
--error 0,1054 --error 0,ER_BAD_FIELD_ERROR
--reap --reap
} }
--enable_query_log --enable_query_log
@ -379,7 +453,7 @@ while ($i) {
dec $i; dec $i;
--connection locker --connection locker
--error 0,1060 --error 0,ER_DUP_FIELDNAME
ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL; ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t2 SET a=b; UPDATE t2 SET a=b;
@ -388,11 +462,11 @@ while ($i) {
--send EXECUTE stmt --send EXECUTE stmt
--connection locker --connection locker
--error 0,1091 --error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP COLUMN a; ALTER TABLE t2 DROP COLUMN a;
--connection writer --connection writer
--error 0,1054 --error 0,ER_BAD_FIELD_ERROR
--reap --reap
} }
@ -400,6 +474,7 @@ while ($i) {
--connection default --connection default
DROP TABLE t1, t2, t3; DROP TABLE t1, t2, t3;
# #
# Bug#38499: flush tables and multitable table update with derived table cause # Bug#38499: flush tables and multitable table update with derived table cause
# crash # crash
@ -460,7 +535,7 @@ while ($i) {
dec $i; dec $i;
--connection locker --connection locker
--error 0,1060 --error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL; ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t1 SET a=b; 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; --send UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0;
--connection locker --connection locker
--error 0,1091 --error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a; ALTER TABLE t1 DROP COLUMN a;
--connection writer --connection writer
--error 0,1054 # unknown column error --error 0,ER_BAD_FIELD_ERROR # unknown column error
--reap --reap
} }
--enable_query_log --enable_query_log
@ -485,7 +560,7 @@ while ($i) {
dec $i; dec $i;
--connection locker --connection locker
--error 0,1060 --error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a INT; ALTER TABLE t1 ADD COLUMN a INT;
UPDATE t1 SET a=b; UPDATE t1 SET a=b;
@ -494,11 +569,11 @@ while ($i) {
--send EXECUTE stmt --send EXECUTE stmt
--connection locker --connection locker
--error 0,1091 --error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a; ALTER TABLE t1 DROP COLUMN a;
--connection writer --connection writer
--error 0,1054 # Unknown column 'a' in 'field list' --error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap --reap
} }
--enable_query_log --enable_query_log
@ -557,7 +632,7 @@ while ($i) {
dec $i; dec $i;
--connection locker --connection locker
--error 0,1060 --error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL; ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t1 SET a=b; 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; --send UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0;
--connection locker --connection locker
--error 0,1091 --error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a; ALTER TABLE t1 DROP COLUMN a;
--connection writer --connection writer
--error 0,1054 # Unknown column 'a' in 'field list' --error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap --reap
} }
--enable_query_log --enable_query_log
@ -582,7 +657,7 @@ while ($i) {
dec $i; dec $i;
--connection locker --connection locker
--error 0,1060 --error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a INT; ALTER TABLE t1 ADD COLUMN a INT;
UPDATE t1 SET a=b; UPDATE t1 SET a=b;
@ -591,15 +666,25 @@ while ($i) {
--send EXECUTE stmt --send EXECUTE stmt
--connection locker --connection locker
--error 0,1091 --error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a; ALTER TABLE t1 DROP COLUMN a;
--connection writer --connection writer
--error 0,1054 # Unknown column 'a' in 'field list' --error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap --reap
} }
--enable_query_log --enable_query_log
--connection default --connection default
DROP TABLE t1; DROP TABLE t1;
# Close connections used in many subtests
--disconnect reader
--disconnect locker
--disconnect writer
# End of 5.0 tests # 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

@ -341,4 +341,37 @@ EOF
remove_file $MYSQLTEST_VARDIR/tmp/bug31060.sql; remove_file $MYSQLTEST_VARDIR/tmp/bug31060.sql;
#
# Bug #41486: extra character appears in BLOB for every ~40Mb after
# mysqldump/import
#
# 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,,);
connection con1;
CREATE TABLE t1(data LONGBLOB);
INSERT INTO t1 SELECT REPEAT('1', 2*1024*1024);
--exec $MYSQL_DUMP test t1 >$MYSQLTEST_VARDIR/tmp/bug41486.sql
# 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 < $MYSQLTEST_VARDIR/tmp/bug41486.sql 2>&1
SELECT LENGTH(data) FROM t1;
remove_file $MYSQLTEST_VARDIR/tmp/bug41486.sql;
DROP TABLE t1;
connection default;
disconnect con1;
set @@global.max_allowed_packet = @old_max_allowed_packet;
--echo End of 5.0 tests --echo End of 5.0 tests

View File

@ -103,7 +103,7 @@ select "--- --position --" as "";
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ --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 --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 --disable_query_log
select "--- reading stdin --" as ""; select "--- reading stdin --" as "";
--enable_query_log --enable_query_log
@ -117,7 +117,7 @@ select "--- reading stdin --" as "";
drop table t1,t2; 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; flush logs;
--write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql --write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
@ -174,7 +174,6 @@ flush logs;
call p1(); call p1();
drop procedure p1; drop procedure p1;
--error ER_SP_DOES_NOT_EXIST --error ER_SP_DOES_NOT_EXIST
call p1(); call p1();
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007 --exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007
@ -222,9 +221,9 @@ flush logs;
CREATE TABLE t1 (c1 CHAR(10)); CREATE TABLE t1 (c1 CHAR(10));
# we need this for getting fixed timestamps inside of this test # we need this for getting fixed timestamps inside of this test
flush logs; FLUSH LOGS;
INSERT INTO t1 VALUES ('0123456789'); INSERT INTO t1 VALUES ('0123456789');
flush logs; FLUSH LOGS;
DROP TABLE t1; DROP TABLE t1;
# We create a table, patch, and load the output into it # We create a table, patch, and load the output into it
@ -233,10 +232,10 @@ DROP TABLE t1;
# as described in the original bug # as described in the original bug
--disable_query_log --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 --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' 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 --remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
--enable_query_log --enable_query_log
@ -248,49 +247,51 @@ SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
DROP TABLE patch; DROP TABLE patch;
# #
# Bug #29928: incorrect connection_id() restoring from mysqlbinlog out # Bug#29928 incorrect connection_id() restoring from mysqlbinlog out
# #
flush logs; FLUSH LOGS;
create table t1(a int); CREATE TABLE t1(a INT);
insert into t1 values(connection_id()); INSERT INTO t1 VALUES(connection_id());
let $a= `select a from t1`; let $a= `SELECT a FROM t1`;
flush logs; FLUSH LOGS;
--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000013 > $MYSQLTEST_VARDIR/tmp/bug29928.sql --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); connect (con1, localhost, root, , test);
connection con1; connection con1;
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug29928.sql --exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug29928.sql
--remove_file $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; disconnect con1;
connection default; connection default;
let $c= `select $a=$b`; let $c= `SELECT $a=$b`;
--echo $c --echo $c
drop table t1; DROP TABLE t1;
echo shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql; echo shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql;
error 1; error 1;
exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql; 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 # Bug#37313 BINLOG Contains Incorrect server id
# #
let $save_server_id= `select @@global.server_id`; let $binlog_file= $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog;
let $s_id_max=`select (1 << 32) - 1`; let $save_server_id= `SELECT @@global.server_id`;
eval set @@global.server_id= $s_id_max; let $s_id_max= `SELECT (1 << 32) - 1`;
eval SET @@global.server_id= $s_id_max;
reset master; RESET MASTER;
flush logs; FLUSH LOGS;
--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog --exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $binlog_file
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select eval SELECT
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog")) (@a:=LOAD_FILE("$binlog_file"))
is not null; IS NOT NULL;
let $s_id_unsigned= `select @a like "%server id $s_id_max%" /* must return 1 */`; 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 ***; echo *** Unsigned server_id $s_id_max is found: $s_id_unsigned ***;
eval set @@global.server_id= $save_server_id; eval SET @@global.server_id= $save_server_id;
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog --remove_file $binlog_file
--echo End of 5.0 tests --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 # We reset concurrent_inserts value to whatever it was at the start of the test
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT; 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 #
--echo # Bug#33550 mysqldump 4.0 compatibility broken --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 # This test uses chmod, can't be run with root permissions
-- source include/not_as_root.inc -- source include/not_as_root.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# ============================================================================ # ============================================================================
# #
# Test of mysqltest itself # Test of mysqltest itself
@ -2154,3 +2157,5 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir;
--echo End of tests --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 # should work with embedded server after mysqltest is fixed
-- source include/not_embedded.inc -- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1,t2,t3; DROP TABLE IF EXISTS t1,t2,t3;
--enable_warnings --enable_warnings
@ -40,24 +43,24 @@ connection con1;
select @@global.read_only; select @@global.read_only;
--error 1290 --error ER_OPTION_PREVENTS_STATEMENT
create table t3 (a int); create table t3 (a int);
--error 1290 --error ER_OPTION_PREVENTS_STATEMENT
insert into t1 values(1); insert into t1 values(1);
# if a statement, after parse stage, looks like it will update a # 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 # non-temp table, it will be rejected, even if at execution it would
# have turned out that 0 rows would be updated # have turned out that 0 rows would be updated
--error 1290 --error ER_OPTION_PREVENTS_STATEMENT
update t1 set a=1 where 1=0; update t1 set a=1 where 1=0;
# multi-update is special (see sql_parse.cc) so we test it # 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; update t1,t2 set t1.a=t2.a+1 where t1.a=t2.a;
# check multi-delete to be sure # check multi-delete to be sure
--error 1290 --error ER_OPTION_PREVENTS_STATEMENT
delete t1,t2 from t1,t2 where t1.a=t2.a; delete t1,t2 from t1,t2 where t1.a=t2.a;
# With temp tables updates should be accepted: # With temp tables updates should be accepted:
@ -71,7 +74,7 @@ insert into t3 values(1);
insert into t4 select * from t3; insert into t4 select * from t3;
# a non-temp table updated: # 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; update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a;
# no non-temp table updated (just swapped): # 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; 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 t1 from t1,t3 where t1.a=t3.a;
delete t3 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; drop table t1;
--error 1290 --error ER_OPTION_PREVENTS_STATEMENT
insert into t1 values(1); 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 # check if DROP TEMPORARY on a non-existing temporary table returns the right
# error # error
@ -114,6 +117,7 @@ drop temporary table ttt;
drop temporary table if exists ttt; drop temporary table if exists ttt;
connection default; connection default;
disconnect con1;
drop table t1,t2; drop table t1,t2;
drop user test@localhost; drop user test@localhost;
@ -151,3 +155,7 @@ delete from mysql.columns_priv where User like 'mysqltest_%';
flush privileges; flush privileges;
drop database mysqltest_db1; drop database mysqltest_db1;
set global read_only=0; set global read_only=0;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,6 +1,9 @@
# Uses GRANT commands that usually disabled in embedded server # Uses GRANT commands that usually disabled in embedded server
-- source include/not_embedded.inc -- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# #
# Test of some show commands # Test of some show commands
# #
@ -33,7 +36,7 @@ check table t1 medium;
check table t1 extended; check table t1 extended;
show index from t1; show index from t1;
--disable_metadata --disable_metadata
--error 1062 --error ER_DUP_ENTRY
insert into t1 values (5,5,5); insert into t1 values (5,5,5);
--echo -- Here we enable metadata just to check that the collation of the --echo -- Here we enable metadata just to check that the collation of the
@ -191,14 +194,14 @@ show columns from t1;
drop table 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_mode= @@sql_mode, sql_mode= '';
SET @old_sql_quote_show_create= @@sql_quote_show_create, sql_quote_show_create= OFF; SET @old_sql_quote_show_create= @@sql_quote_show_create, sql_quote_show_create= OFF;
######### hook for WL#1324 # ######### hook for WL#1324 #
--error 1103 --error ER_WRONG_TABLE_NAME
CREATE TABLE `a/b` (i INT); CREATE TABLE `a/b` (i INT);
# the above test should WORK when WL#1324 is done, # the above test should WORK when WL#1324 is done,
# it should be removed and # 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; 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; select @@max_heap_table_size;
@ -313,7 +316,7 @@ show table status;
drop table t1, t2, t3; 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; create database mysqltest;
@ -328,30 +331,33 @@ connect (con1,localhost,mysqltest_1,,mysqltest);
connection con1; connection con1;
select * from t1; select * from t1;
show create database mysqltest; show create database mysqltest;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
drop table t1; drop table t1;
--error 1044 --error ER_DBACCESS_DENIED_ERROR
drop database mysqltest; drop database mysqltest;
disconnect con1;
connect (con2,localhost,mysqltest_2,,test); connect (con2,localhost,mysqltest_2,,test);
connection con2; connection con2;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
select * from mysqltest.t1; select * from mysqltest.t1;
--error 1044 --error ER_DBACCESS_DENIED_ERROR
show create database mysqltest; show create database mysqltest;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
drop table mysqltest.t1; drop table mysqltest.t1;
--error 1044 --error ER_DBACCESS_DENIED_ERROR
drop database mysqltest; drop database mysqltest;
disconnect con2;
connect (con3,localhost,mysqltest_3,,test); connect (con3,localhost,mysqltest_3,,test);
connection con3; connection con3;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
select * from mysqltest.t1; select * from mysqltest.t1;
--error 1044 --error ER_DBACCESS_DENIED_ERROR
show create database mysqltest; show create database mysqltest;
drop table mysqltest.t1; drop table mysqltest.t1;
drop database mysqltest; drop database mysqltest;
disconnect con3;
connection default; connection default;
set names binary; set names binary;
@ -402,7 +408,7 @@ ALTER TABLE t1 ENGINE=MEMORY;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP 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( CREATE TABLE t1(
field1 text NOT NULL, field1 text NOT NULL,
PRIMARY KEY(field1(1000)) PRIMARY KEY(field1(1000))
@ -412,7 +418,7 @@ show index from t1;
--disable_metadata --disable_metadata
drop table t1; 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 ( create table t1 (
c1 int NOT NULL, c1 int NOT NULL,
c2 int NOT NULL, c2 int NOT NULL,
@ -422,7 +428,7 @@ create table t1 (
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP 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; flush tables;
@ -430,7 +436,7 @@ flush tables;
system echo "this is a junk file for test" >> $MYSQLTEST_VARDIR/master-data/test/t1.frm ; system echo "this is a junk file for test" >> $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
--replace_column 6 # 7 # 8 # 9 # --replace_column 6 # 7 # 8 # 9 #
SHOW TABLE STATUS like 't1'; SHOW TABLE STATUS like 't1';
--error 1033 --error ER_NOT_FORM_FILE
show create table t1; show create table t1;
drop table t1; drop table t1;
@ -438,7 +444,7 @@ drop table t1;
--echo End of 4.1 tests --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. # First we close all open tables with FLUSH tables and then we open some.
CREATE TABLE txt1(a int); CREATE TABLE txt1(a int);
CREATE TABLE tyt2(a int); CREATE TABLE tyt2(a int);
@ -456,14 +462,14 @@ DROP TABLE txt1;
DROP TABLE tyt2; DROP TABLE tyt2;
DROP TABLE urkunde; 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; 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 # statement
# #
# The problem was that initial user setting was forgotten, and current # 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; flush status;
show status like 'slow_queries'; show status like 'slow_queries';
@ -555,7 +561,7 @@ select 1 from information_schema.tables limit 1;
show status like 'slow_queries'; 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. # FROM I_S.
# #
@ -827,7 +833,7 @@ DROP DATABASE mysqltest1;
use test; 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; flush status;
show variables like "log_queries_not_using_indexes"; 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'; 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'; show variables like 'myisam_recover_options';
@ -868,3 +874,7 @@ show create table t1;
drop table t1; drop table t1;
--echo End of 5.0 tests --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 # Can't be tested with embedded server
--source include/not_embedded.inc --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'; 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'; 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'; 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 # 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 # Server crashed when one used USER() function in connection for which
# was impossible to obtain peer hostname. # was impossible to obtain peer hostname.
connect (con1, 127.0.0.1, root, , test, $MASTER_MYPORT, ); connect (con1, 127.0.0.1, root, , test, $MASTER_MYPORT, );
--replace_column 1 # --replace_column 1 #
select user(); SELECT USER();
--replace_column 1 <id> 3 <host> 5 <command> 6 <time> 7 <state> 8 <info> --replace_column 1 <id> 3 <host> 5 <command> 6 <time> 7 <state> 8 <info>
show processlist; SHOW PROCESSLIST;
connection default; 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 # Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc -- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (con1root,localhost,root,,); connect (con1root,localhost,root,,);
connection con1root; connection con1root;
@ -156,7 +159,7 @@ call db1_secret.stamp(6);
select db1_secret.db(); select db1_secret.db();
# #
# BUG#2777 # Bug#2777 Stored procedure doesn't observe definer's rights
# #
connection con1root; connection con1root;
@ -215,7 +218,7 @@ call q();
select * from t2; 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) # (or ALTER for that matter)
# still connection con2user1 in db2 # still connection con2user1 in db2
@ -330,7 +333,7 @@ flush privileges;
drop table t1; 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); connect (root,localhost,root,,test);
connection root; connection root;
@ -366,10 +369,12 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
drop function bug_9503; drop function bug_9503;
use test; use test;
drop database mysqltest; drop database mysqltest;
connection default;
disconnect root;
# #
# correct value from current_user() in function run from "security definer" # correct value from current_user() in function run from "security definer"
# (BUG#7291) # (Bug#7291 Stored procedures: wrong CURRENT_USER value)
# #
connection con1root; connection con1root;
use test; use test;
@ -398,7 +403,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
drop user 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 # procedure in another database when the current database is
# information_schema. # information_schema.
# #
@ -438,7 +443,7 @@ revoke usage on *.* from mysqltest_1@localhost;
drop user 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 # on function
delimiter |; delimiter |;
--disable_warnings --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. # 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 # ER_TABLEACCESS_DENIED_ERROR
# #
create database db_bug14533; 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. # Prepare.
CREATE DATABASE db_bug7787; CREATE DATABASE db_bug7787;
use db_bug7787; USE db_bug7787;
# Test. # 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: # The following cases are tested:
# 1. check that if DEFINER-clause is not explicitly specified, stored routines # 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 --echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con --connection mysqltest_2_con
use mysqltest; USE mysqltest;
CREATE PROCEDURE wl2897_p1() SELECT 1; CREATE PROCEDURE wl2897_p1() SELECT 1;
@ -626,7 +631,7 @@ CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1;
--echo ---> connection: mysqltest_1_con --echo ---> connection: mysqltest_1_con
--connection mysqltest_1_con --connection mysqltest_1_con
use mysqltest; USE mysqltest;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR --error ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2; 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 --echo ---> connection: con1root
--connection con1root --connection con1root
use mysqltest; USE mysqltest;
SHOW CREATE PROCEDURE wl2897_p1; SHOW CREATE PROCEDURE wl2897_p1;
SHOW CREATE PROCEDURE wl2897_p3; 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. # Prepare environment.
@ -702,7 +707,7 @@ GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
--echo ---> connection: mysqltest_1_con --echo ---> connection: mysqltest_1_con
--connection mysqltest_1_con --connection mysqltest_1_con
use mysqltest; USE mysqltest;
CREATE PROCEDURE bug13198_p1() CREATE PROCEDURE bug13198_p1()
SELECT 1; SELECT 1;
@ -720,7 +725,7 @@ SELECT bug13198_f1();
--echo ---> connection: mysqltest_2_con --echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con --connection mysqltest_2_con
use mysqltest; USE mysqltest;
CALL bug13198_p1(); CALL bug13198_p1();
@ -742,7 +747,7 @@ DROP USER mysqltest_1@localhost;
--echo ---> connection: mysqltest_2_con --echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con --connection mysqltest_2_con
use mysqltest; USE mysqltest;
--error ER_NO_SUCH_USER --error ER_NO_SUCH_USER
CALL bug13198_p1(); 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 # 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 --echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con --connection mysqltest_2_con
use test; USE test;
DELIMITER //; DELIMITER //;
CREATE PROCEDURE sp19857() DETERMINISTIC CREATE PROCEDURE sp19857() DETERMINISTIC
@ -814,8 +819,7 @@ DROP USER user19857@localhost;
# #
# BUG#18630: Arguments of suid routine calculated in wrong security # Bug#18630 Arguments of suid routine calculated in wrong security context
# context
# #
# Arguments of suid routines were calculated in definer's security # Arguments of suid routines were calculated in definer's security
# context instead of caller's context thus creating security hole. # context instead of caller's context thus creating security hole.
@ -886,3 +890,7 @@ DROP FUNCTION f_suid;
DROP TABLE t1; DROP TABLE t1;
--echo End of 5.0 tests. --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 # Can't test with embedded server
-- source include/not_embedded.inc -- source include/not_embedded.inc
--sleep 2 # Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings --disable_warnings
drop table if exists t1,t3; drop table if exists t1,t3;
--enable_warnings --enable_warnings
delimiter |; 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 # Added tests for show grants command
--disable_warnings --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 --disable_warnings
drop function if exists bug5278| drop function if exists bug5278|
@ -58,13 +61,16 @@ begin
return 'okay'; return 'okay';
end| end|
--error 1133 --error ER_PASSWORD_NO_MATCH
select bug5278()| select bug5278()|
--error 1133 --error ER_PASSWORD_NO_MATCH
select bug5278()| select bug5278()|
drop function bug5278| drop function bug5278|
#
# Bug#3583: query cache doesn't work for stored procedures
#
--disable_warnings --disable_warnings
drop table if exists t1| drop table if exists t1|
--enable_warnings --enable_warnings
@ -72,9 +78,6 @@ create table t1 (
id char(16) not null default '', id char(16) not null default '',
data int not null data int not null
)| )|
#
# BUG#3583: query cache doesn't work for stored procedures
#
--disable_warnings --disable_warnings
drop procedure if exists bug3583| drop procedure if exists bug3583|
--enable_warnings --enable_warnings
@ -110,8 +113,9 @@ delete from t1|
drop procedure bug3583| drop procedure bug3583|
drop table t1| 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 --disable_warnings
drop procedure if exists bug6807| drop procedure if exists bug6807|
@ -125,16 +129,16 @@ begin
select 'Not reached'; select 'Not reached';
end| end|
--error 1317 --error ER_QUERY_INTERRUPTED
call bug6807()| call bug6807()|
--error 1317 --error ER_QUERY_INTERRUPTED
call bug6807()| call bug6807()|
drop procedure bug6807| drop procedure bug6807|
# #
# BUG#10100: function (and stored procedure?) recursivity problem # Bug#10100: function (and stored procedure?) recursivity problem
# #
--disable_warnings --disable_warnings
drop function if exists bug10100f| drop function if exists bug10100f|
@ -266,6 +270,7 @@ drop table t3|
delimiter ;| delimiter ;|
# #
# Bug#15298 SHOW GRANTS FOR CURRENT_USER: Incorrect output in DEFINER context # Bug#15298 SHOW GRANTS FOR CURRENT_USER: Incorrect output in DEFINER context
# #
@ -282,6 +287,11 @@ call 15298_1();
call 15298_2(); call 15298_2();
connection default; connection default;
disconnect con1;
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
drop procedure 15298_1; drop procedure 15298_1;
drop procedure 15298_2; 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/have_ssl.inc
-- source include/big_test.inc -- source include/big_test.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1, t2; DROP TABLE IF EXISTS t1, t2;
--enable_warnings --enable_warnings
@ -53,4 +56,9 @@ while ($count)
connect (ssl_con,localhost,root,,,,,SSL); connect (ssl_con,localhost,root,,,,,SSL);
drop table t1; 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 -- source include/have_ssl.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (ssl_con,localhost,root,,,,,SSL); connect (ssl_con,localhost,root,,,,,SSL);
# Check ssl turned on # Check ssl turned on
@ -14,4 +17,9 @@ SHOW STATUS LIKE 'Ssl_cipher';
# Check ssl turned on # Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher'; 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_ssl.inc
-- source include/have_compress.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); connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS);
# Check ssl turned on # Check ssl turned on
@ -20,3 +23,10 @@ SHOW STATUS LIKE 'Ssl_cipher';
# Check compression turned on # Check compression turned on
SHOW STATUS LIKE 'Compression'; 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 # embedded server causes different stat
-- source include/not_embedded.inc -- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# PS causes different statistics # PS causes different statistics
--disable_ps_protocol --disable_ps_protocol
@ -208,3 +211,7 @@ DROP PROCEDURE p1;
DROP FUNCTION f1; DROP FUNCTION f1;
# End of 5.0 tests # 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; create table t1 (a bit) engine=innodb;
insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001'); insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001');
select hex(a) from t1; 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); alter table t1 add unique (a);
drop table t1; drop table t1;

View File

@ -933,17 +933,25 @@ SELECT a INTO @v FROM (
SELECT a FROM t1 SELECT a FROM t1
) alias; ) alias;
SELECT a INTO OUTFILE 'union.out.file' FROM ( --let $outfile = $MYSQLTEST_VARDIR/tmp/union.out.file
SELECT a FROM t1 --error 0,1
UNION --remove_file $outfile
SELECT a FROM t1 WHERE 0
) alias;
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 SELECT a FROM t1
UNION UNION
SELECT a FROM t1 WHERE 0 SELECT a FROM t1 WHERE 0
) alias; ) 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. # 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 SELECT a INTO @v FROM t1
) alias; ) alias;
SELECT a FROM ( --replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
eval SELECT a FROM (
SELECT a FROM t1 SELECT a FROM t1
UNION UNION
SELECT a INTO OUTFILE 'union.out.file3' FROM t1 SELECT a INTO OUTFILE '$outfile' FROM t1
) alias; ) alias;
--remove_file $outfile
SELECT a FROM ( --replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
eval SELECT a FROM (
SELECT a FROM t1 SELECT a FROM t1
UNION UNION
SELECT a INTO DUMPFILE 'union.out.file4' FROM t1 SELECT a INTO DUMPFILE '$outfile' FROM t1
) alias; ) alias;
--remove_file $outfile
SELECT a FROM t1 UNION SELECT a INTO @v FROM t1; 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 --error ER_WRONG_USAGE
SELECT a INTO @v FROM t1 UNION SELECT a FROM t1; SELECT a INTO @v FROM t1 UNION SELECT a FROM t1;
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
--error ER_WRONG_USAGE --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 --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; DROP TABLE t1;

View File

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

View File

@ -1,6 +1,9 @@
# Can't test with embedded server # Can't test with embedded server
-- source include/not_embedded.inc -- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# simple test of grants # simple test of grants
grant create view on test.* to test@localhost; grant create view on test.* to test@localhost;
show grants for test@localhost; show grants for test@localhost;
@ -30,15 +33,15 @@ connection user1;
create definer=root@localhost view v1 as select * from mysqltest.t1; create definer=root@localhost view v1 as select * from mysqltest.t1;
create view v1 as select * from mysqltest.t1; create view v1 as select * from mysqltest.t1;
# try to modify view without DROP privilege on it # try to modify view without DROP privilege on it
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
alter view v1 as select * from mysqltest.t1; alter view v1 as select * from mysqltest.t1;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
create or replace view v1 as select * from mysqltest.t1; create or replace view v1 as select * from mysqltest.t1;
# no CRETE VIEW privilege # no CRETE VIEW privilege
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
create view mysqltest.v2 as select * from mysqltest.t1; create view mysqltest.v2 as select * from mysqltest.t1;
# no SELECT privilege # no SELECT privilege
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
create view v2 as select * from mysqltest.t2; create view v2 as select * from mysqltest.t2;
connection root; connection root;
@ -48,7 +51,7 @@ show create view v1;
grant create view,drop,select on test.* to mysqltest_1@localhost; grant create view,drop,select on test.* to mysqltest_1@localhost;
connection user1; connection user1;
# following 'use' command is workaround of bug #9582 and should be removed # following 'use' command is workaround of Bug#9582 and should be removed
# when that bug will be fixed # when that bug will be fixed
use test; use test;
alter view v1 as select * from mysqltest.t1; alter view v1 as select * from mysqltest.t1;
@ -76,7 +79,7 @@ grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
connection user1; connection user1;
select c from mysqltest.v1; select c from mysqltest.v1;
# there are no privileges on column 'd' # there are no privileges on column 'd'
-- error 1143 --error ER_COLUMNACCESS_DENIED_ERROR
select d from mysqltest.v1; select d from mysqltest.v1;
connection root; connection root;
@ -96,7 +99,7 @@ grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
connection user1; connection user1;
select c from mysqltest.v1; select c from mysqltest.v1;
# there are no privileges on column 'd' # there are no privileges on column 'd'
-- error 1143 --error ER_COLUMNACCESS_DENIED_ERROR
select d from mysqltest.v1; select d from mysqltest.v1;
connection root; connection root;
@ -133,21 +136,21 @@ select c from mysqltest.v4;
show columns from mysqltest.v1; show columns from mysqltest.v1;
show columns from mysqltest.v2; show columns from mysqltest.v2;
# but explain/show do not # but explain/show do not
-- error 1345 --error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v1; explain select c from mysqltest.v1;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v1; show create view mysqltest.v1;
-- error 1345 --error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v2; explain select c from mysqltest.v2;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v2; show create view mysqltest.v2;
-- error 1345 --error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v3; explain select c from mysqltest.v3;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v3; show create view mysqltest.v3;
-- error 1345 --error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v4; explain select c from mysqltest.v4;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v4; show create view mysqltest.v4;
# allow to see one of underlying table # allow to see one of underlying table
@ -156,19 +159,19 @@ grant select on mysqltest.t1 to mysqltest_1@localhost;
connection user1; connection user1;
# EXPLAIN of view on above table works # EXPLAIN of view on above table works
explain select c from mysqltest.v1; explain select c from mysqltest.v1;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v1; show create view mysqltest.v1;
explain select c from mysqltest.v2; explain select c from mysqltest.v2;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v2; show create view mysqltest.v2;
# but other EXPLAINs do not # but other EXPLAINs do not
-- error 1345 --error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v3; explain select c from mysqltest.v3;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v3; show create view mysqltest.v3;
-- error 1345 --error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v4; explain select c from mysqltest.v4;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v4; show create view mysqltest.v4;
# allow to see any view in mysqltest database # allow to see any view in mysqltest database
@ -222,14 +225,14 @@ select * from t1;
update v2 set a=a+c; update v2 set a=a+c;
select * from t1; select * from t1;
# no rights on column # no rights on column
-- error 1143 --error ER_COLUMNACCESS_DENIED_ERROR
update t2,v2 set v2.c=v2.a+v2.c where t2.x=v2.c; update t2,v2 set v2.c=v2.a+v2.c where t2.x=v2.c;
-- error 1143 --error ER_COLUMNACCESS_DENIED_ERROR
update v2 set c=a+c; update v2 set c=a+c;
# no rights for view # no rights for view
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
update t2,v3 set v3.a=v3.a+v3.c where t2.x=v3.c; update t2,v3 set v3.a=v3.a+v3.c where t2.x=v3.c;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
update v3 set a=a+c; update v3 set a=a+c;
use test; use test;
@ -263,9 +266,9 @@ select * from t1;
delete v1 from t2,v1 where t2.x=v1.c; delete v1 from t2,v1 where t2.x=v1.c;
select * from t1; select * from t1;
# no rights for view # no rights for view
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
delete v2 from t2,v2 where t2.x=v2.c; delete v2 from t2,v2 where t2.x=v2.c;
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
delete from v2 where c < 4; delete from v2 where c < 4;
use test; use test;
@ -299,9 +302,9 @@ select * from t1;
insert into v1 select x,y from t2; insert into v1 select x,y from t2;
select * from t1; select * from t1;
# no rights for view # no rights for view
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
insert into v2 values (5,6); insert into v2 values (5,6);
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
insert into v2 select x,y from t2; insert into v2 select x,y from t2;
use test; use test;
@ -329,10 +332,10 @@ connection user1;
create view v1 as select * from mysqltest.t1; create view v1 as select * from mysqltest.t1;
create view v2 as select b from mysqltest.t2; create view v2 as select b from mysqltest.t2;
# There are not rights on mysqltest.v1 # There are not rights on mysqltest.v1
-- error 1142 --error ER_TABLEACCESS_DENIED_ERROR
create view mysqltest.v1 as select * from mysqltest.t1; create view mysqltest.v1 as select * from mysqltest.t1;
# There are not any rights on mysqltest.t2.a # There are not any rights on mysqltest.t2.a
-- error 1143 --error ER_COLUMNACCESS_DENIED_ERROR
create view v3 as select a from mysqltest.t2; create view v3 as select a from mysqltest.t2;
# give CREATE VIEW privileges (without any privileges for result column) # give CREATE VIEW privileges (without any privileges for result column)
@ -352,13 +355,13 @@ create view mysqltest.v3 as select b from mysqltest.t2;
# Expression need select privileges # Expression need select privileges
-- error 1143 --error ER_COLUMNACCESS_DENIED_ERROR
create view v4 as select b+1 from mysqltest.t2; create view v4 as select b+1 from mysqltest.t2;
connection root; connection root;
grant create view,update,select on test.* to mysqltest_1@localhost; grant create view,update,select on test.* to mysqltest_1@localhost;
connection user1; connection user1;
-- error 1143 --error ER_COLUMNACCESS_DENIED_ERROR
create view v4 as select b+1 from mysqltest.t2; create view v4 as select b+1 from mysqltest.t2;
connection root; connection root;
@ -420,7 +423,7 @@ drop view v1;
drop database mysqltest; drop database mysqltest;
# #
# rights on execution of view underlying functiond (BUG#9505) # rights on execution of view underlying functiond (Bug#9505)
# #
connection root; connection root;
--disable_warnings --disable_warnings
@ -604,7 +607,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop database mysqltest; drop database mysqltest;
# #
# BUG#14256: definer in view definition is not fully qualified # Bug#14256 definer in view definition is not fully qualified
# #
--disable_warnings --disable_warnings
drop view if exists v1; drop view if exists v1;
@ -641,6 +644,7 @@ drop view v1;
select @v1def1, @v1def2, @v1def1=@v1def2; select @v1def1, @v1def2, @v1def1=@v1def2;
connection root; connection root;
disconnect test14256;
drop user test14256; drop user test14256;
# Restore the anonymous users. # Restore the anonymous users.
@ -650,8 +654,8 @@ flush privileges;
drop table t1; drop table t1;
# #
# BUG#14726: freeing stack variable in case of an error of opening # Bug#14726 freeing stack variable in case of an error of opening a view when
# a view when we have locked tables with LOCK TABLES statement. # we have locked tables with LOCK TABLES statement.
# #
connection root; connection root;
--disable_warnings --disable_warnings
@ -679,7 +683,7 @@ drop user mysqltest_1@localhost;
drop database mysqltest; drop database mysqltest;
# #
# switch to default connaction # switch to default connection
# #
disconnect user1; disconnect user1;
disconnect root; disconnect root;
@ -696,7 +700,7 @@ drop view v1;
drop view v2; drop view v2;
# #
# Bug#18681: View privileges are broken # Bug#18681 View privileges are broken
# #
CREATE DATABASE mysqltest1; CREATE DATABASE mysqltest1;
CREATE USER readonly@localhost; CREATE USER readonly@localhost;
@ -717,54 +721,55 @@ GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly@localhost;
GRANT DELETE ON mysqltest1.v_td TO readonly@localhost; GRANT DELETE ON mysqltest1.v_td TO readonly@localhost;
GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly@localhost; GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly@localhost;
CONNECT (n1,localhost,readonly,,); connect (n1,localhost,readonly,,);
CONNECTION n1; connection n1;
--error 1356 --error ER_VIEW_INVALID
SELECT * FROM mysqltest1.v_t1; SELECT * FROM mysqltest1.v_t1;
--error 1356 --error ER_VIEW_INVALID
INSERT INTO mysqltest1.v_t1 VALUES(4); INSERT INTO mysqltest1.v_t1 VALUES(4);
--error 1356 --error ER_VIEW_INVALID
DELETE FROM mysqltest1.v_t1 WHERE x = 1; DELETE FROM mysqltest1.v_t1 WHERE x = 1;
--error 1356 --error ER_VIEW_INVALID
UPDATE mysqltest1.v_t1 SET x = 3 WHERE x = 2; UPDATE mysqltest1.v_t1 SET x = 3 WHERE x = 2;
--error 1356 --error ER_VIEW_INVALID
UPDATE mysqltest1.v_t1 SET x = 3; UPDATE mysqltest1.v_t1 SET x = 3;
--error 1356 --error ER_VIEW_INVALID
DELETE FROM mysqltest1.v_t1; DELETE FROM mysqltest1.v_t1;
--error 1356 --error ER_VIEW_INVALID
SELECT 1 FROM mysqltest1.v_t1; SELECT 1 FROM mysqltest1.v_t1;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM mysqltest1.t1; SELECT * FROM mysqltest1.t1;
SELECT * FROM mysqltest1.v_ts; SELECT * FROM mysqltest1.v_ts;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM mysqltest1.v_ts, mysqltest1.t1 WHERE mysqltest1.t1.x = mysqltest1.v_ts.x; SELECT * FROM mysqltest1.v_ts, mysqltest1.t1 WHERE mysqltest1.t1.x = mysqltest1.v_ts.x;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM mysqltest1.v_ti; SELECT * FROM mysqltest1.v_ti;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
INSERT INTO mysqltest1.v_ts VALUES (100); INSERT INTO mysqltest1.v_ts VALUES (100);
INSERT INTO mysqltest1.v_ti VALUES (100); INSERT INTO mysqltest1.v_ti VALUES (100);
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
UPDATE mysqltest1.v_ts SET x= 200 WHERE x = 100; UPDATE mysqltest1.v_ts SET x= 200 WHERE x = 100;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
UPDATE mysqltest1.v_ts SET x= 200; UPDATE mysqltest1.v_ts SET x= 200;
UPDATE mysqltest1.v_tu SET x= 200 WHERE x = 100; UPDATE mysqltest1.v_tu SET x= 200 WHERE x = 100;
UPDATE mysqltest1.v_tus SET x= 200 WHERE x = 100; UPDATE mysqltest1.v_tus SET x= 200 WHERE x = 100;
UPDATE mysqltest1.v_tu SET x= 200; UPDATE mysqltest1.v_tu SET x= 200;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
DELETE FROM mysqltest1.v_ts WHERE x= 200; DELETE FROM mysqltest1.v_ts WHERE x= 200;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
DELETE FROM mysqltest1.v_ts; DELETE FROM mysqltest1.v_ts;
--error 1143 --error ER_COLUMNACCESS_DENIED_ERROR
DELETE FROM mysqltest1.v_td WHERE x= 200; DELETE FROM mysqltest1.v_td WHERE x= 200;
DELETE FROM mysqltest1.v_tds WHERE x= 200; DELETE FROM mysqltest1.v_tds WHERE x= 200;
DELETE FROM mysqltest1.v_td; DELETE FROM mysqltest1.v_td;
CONNECTION default; connection default;
disconnect n1;
DROP VIEW mysqltest1.v_tds; DROP VIEW mysqltest1.v_tds;
DROP VIEW mysqltest1.v_td; DROP VIEW mysqltest1.v_td;
DROP VIEW mysqltest1.v_tus; DROP VIEW mysqltest1.v_tus;
@ -777,21 +782,21 @@ DROP USER readonly@localhost;
DROP DATABASE mysqltest1; DROP DATABASE mysqltest1;
# #
# BUG#14875: Bad view DEFINER makes SHOW CREATE VIEW fail # Bug#14875 Bad view DEFINER makes SHOW CREATE VIEW fail
# #
CREATE TABLE t1 (a INT PRIMARY KEY); CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (1), (2), (3); INSERT INTO t1 VALUES (1), (2), (3);
CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1; CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1;
#--warning 1448 #--warning ER_VIEW_OTHER_USER
SHOW CREATE VIEW v; SHOW CREATE VIEW v;
--error 1449 --error ER_NO_SUCH_USER
SELECT * FROM v; SELECT * FROM v;
DROP VIEW v; DROP VIEW v;
DROP TABLE t1; DROP TABLE t1;
USE test; USE test;
# #
# Bug#20363: Create view on just created view is now denied # Bug#20363 Create view on just created view is now denied
# #
eval CREATE USER mysqltest_db1@localhost identified by 'PWD'; eval CREATE USER mysqltest_db1@localhost identified by 'PWD';
eval GRANT ALL ON mysqltest_db1.* TO mysqltest_db1@localhost WITH GRANT OPTION; eval GRANT ALL ON mysqltest_db1.* TO mysqltest_db1@localhost WITH GRANT OPTION;
@ -822,6 +827,7 @@ SELECT * FROM view2;
SELECT * from view3; SELECT * from view3;
connection default; connection default;
disconnect session1;
DROP VIEW mysqltest_db1.view3; DROP VIEW mysqltest_db1.view3;
DROP VIEW mysqltest_db1.view2; DROP VIEW mysqltest_db1.view2;
DROP VIEW mysqltest_db1.view1; DROP VIEW mysqltest_db1.view1;
@ -829,7 +835,7 @@ DROP TABLE mysqltest_db1.t1;
DROP SCHEMA mysqltest_db1; DROP SCHEMA mysqltest_db1;
DROP USER mysqltest_db1@localhost; DROP USER mysqltest_db1@localhost;
# #
# BUG#20482: failure on Create join view with sources views/tables # Bug#20482 failure on Create join view with sources views/tables
# in different schemas # in different schemas
# #
--disable_warnings --disable_warnings
@ -851,8 +857,8 @@ DROP DATABASE test1;
# #
# BUG#20570: CURRENT_USER() in a VIEW with SQL SECURITY DEFINER # Bug#20570 CURRENT_USER() in a VIEW with SQL SECURITY DEFINER returns
# returns invoker name # invoker name
# #
--disable_warnings --disable_warnings
DROP VIEW IF EXISTS v1; DROP VIEW IF EXISTS v1;
@ -911,7 +917,7 @@ DROP USER mysqltest_u1@localhost;
# #
# Bug#17254: Error for DEFINER security on VIEW provides too much info # Bug#17254 Error for DEFINER security on VIEW provides too much info
# #
connect (root,localhost,root,,); connect (root,localhost,root,,);
connection root; connection root;
@ -935,12 +941,12 @@ DROP USER def_17254@localhost;
connect (inv,localhost,inv_17254,,db17254); connect (inv,localhost,inv_17254,,db17254);
connection inv; connection inv;
--echo for a user --echo for a user
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM v1; SELECT * FROM v1;
connection root; connection root;
--echo for a superuser --echo for a superuser
--error 1449 --error ER_NO_SUCH_USER
SELECT * FROM v1; SELECT * FROM v1;
DROP USER inv_17254@localhost; DROP USER inv_17254@localhost;
DROP DATABASE db17254; DROP DATABASE db17254;
@ -949,7 +955,7 @@ disconnect inv;
# #
# BUG#24404: strange bug with view+permission+prepared statement # Bug#24404 strange bug with view+permission+prepared statement
# #
--disable_warnings --disable_warnings
DROP DATABASE IF EXISTS mysqltest_db1; DROP DATABASE IF EXISTS mysqltest_db1;
@ -1017,7 +1023,7 @@ DROP USER mysqltest_u1@localhost;
DROP USER mysqltest_u2@localhost; DROP USER mysqltest_u2@localhost;
# #
# Bug#26813: The SUPER privilege is wrongly required to alter a view created # Bug#26813 The SUPER privilege is wrongly required to alter a view created
# by another user. # by another user.
# #
connection root; connection root;
@ -1050,7 +1056,7 @@ DROP DATABASE db26813;
disconnect u1; disconnect u1;
--echo # --echo #
--echo # Bug#29908: A user can gain additional access through the ALTER VIEW. --echo # Bug#29908 A user can gain additional access through the ALTER VIEW.
--echo # --echo #
connection root; connection root;
CREATE DATABASE mysqltest_29908; CREATE DATABASE mysqltest_29908;
@ -1095,7 +1101,7 @@ disconnect u2;
--echo ####################################################################### --echo #######################################################################
# #
# BUG#24040: Create View don't succed with "all privileges" on a database. # Bug#24040 Create View don't succed with "all privileges" on a database.
# #
# Prepare. # Prepare.
@ -1179,7 +1185,7 @@ SELECT * FROM mysqltest1.t4;
# Cleanup. # Cleanup.
-- disconnect bug24040_con disconnect bug24040_con;
DROP DATABASE mysqltest1; DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2; DROP DATABASE mysqltest2;
@ -1187,7 +1193,7 @@ DROP USER mysqltest_u1@localhost;
# #
# Bug #41354: Access control is bypassed when all columns of a view are # Bug#41354 Access control is bypassed when all columns of a view are
# selected by * wildcard # selected by * wildcard
CREATE DATABASE db1; CREATE DATABASE db1;
@ -1202,7 +1208,6 @@ connect (addconfoo, localhost, foo,,);
connection addconfoo; connection addconfoo;
USE db1; USE db1;
SELECT f1 FROM t1; SELECT f1 FROM t1;
--error ER_COLUMNACCESS_DENIED_ERROR --error ER_COLUMNACCESS_DENIED_ERROR
SELECT f2 FROM t1; SELECT f2 FROM t1;
@ -1216,8 +1221,9 @@ SELECT f2 FROM v1;
SELECT * FROM v1; SELECT * FROM v1;
connection default; connection default;
USE test; disconnect root;
disconnect addconfoo; disconnect addconfoo;
USE test;
REVOKE SELECT (f1) ON db1.t1 FROM foo; REVOKE SELECT (f1) ON db1.t1 FROM foo;
REVOKE SELECT (f1) ON db1.v1 FROM foo; REVOKE SELECT (f1) ON db1.v1 FROM foo;
DROP USER foo; DROP USER foo;
@ -1225,4 +1231,8 @@ DROP VIEW db1.v1;
DROP TABLE db1.t1; DROP TABLE db1.t1;
DROP DATABASE db1; DROP DATABASE db1;
connection default;
--echo End of 5.0 tests. --echo End of 5.0 tests.
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -2,7 +2,7 @@
-- source include/not_embedded.inc -- source include/not_embedded.inc
# #
# Bug #8731: wait_timeout does not work on Mac OS X # Bug#8731 wait_timeout does not work on Mac OS X
# #
@ -87,6 +87,7 @@ while (!`select @aborted_clients`)
} }
} }
--enable_query_log --enable_query_log
disconnect wait_con;
connection con1; connection con1;
# When the connection is closed in this way, the error code should # When the connection is closed in this way, the error code should
@ -97,3 +98,5 @@ select 2;
--enable_reconnect --enable_reconnect
select 3; select 3;
disconnect con1; disconnect con1;
# The last connect is to keep tools checking the current test happy.
connect (default,localhost,root,,test,,);

View File

@ -2,6 +2,10 @@
# WL#1756 # WL#1756
# #
-- source include/have_innodb.inc -- source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings --disable_warnings
drop table if exists t1, t2; drop table if exists t1, t2;
--enable_warnings --enable_warnings
@ -14,10 +18,10 @@ xa rollback 'test1';
select * from t1; select * from t1;
xa start 'test2'; xa start 'test2';
--error 1399 --error ER_XAER_RMFAIL
xa start 'test-bad'; xa start 'test-bad';
insert t1 values (20); insert t1 values (20);
--error 1399 --error ER_XAER_RMFAIL
xa prepare 'test2'; xa prepare 'test2';
xa end 'test2'; xa end 'test2';
xa prepare 'test2'; xa prepare 'test2';
@ -27,22 +31,22 @@ select * from t1;
xa start 'testa','testb'; xa start 'testa','testb';
insert t1 values (30); insert t1 values (30);
--error 1399 --error ER_XAER_RMFAIL
commit; commit;
xa end 'testa','testb'; xa end 'testa','testb';
--error 1399 --error ER_XAER_RMFAIL
begin; begin;
--error 1399 --error ER_XAER_RMFAIL
create table t2 (a int); create table t2 (a int);
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
connection con1; connection con1;
--error 1440 --error ER_XAER_DUPID
xa start 'testa','testb'; xa start 'testa','testb';
--error 1440 --error ER_XAER_DUPID
xa start 'testa','testb', 123; xa start 'testa','testb', 123;
# gtrid [ , bqual [ , formatID ] ] # gtrid [ , bqual [ , formatID ] ]
@ -51,7 +55,7 @@ insert t1 values (40);
xa end 'testb',' 0@P`',11; xa end 'testb',' 0@P`',11;
xa prepare 'testb',0x2030405060,11; xa prepare 'testb',0x2030405060,11;
--error 1399 --error ER_XAER_RMFAIL
start transaction; start transaction;
xa recover; xa recover;
@ -64,11 +68,11 @@ xa prepare 'testa','testb';
xa recover; xa recover;
--error 1397 --error ER_XAER_NOTA
xa commit 'testb',0x2030405060,11; xa commit 'testb',0x2030405060,11;
xa rollback 'testa','testb'; xa rollback 'testa','testb';
--error 1064 --error ER_PARSE_ERROR
xa start 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'; xa start 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz';
select * from t1; select * from t1;
@ -119,3 +123,7 @@ xa start 'a','c';
drop table t1; drop table t1;
--echo End of 5.0 tests --echo End of 5.0 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -193,7 +193,7 @@ base64_decode(const char *src, size_t size, void *dst)
{ {
return -1; return -1;
} }
return d - dst_base; return (int) (d - dst_base);
} }

View File

@ -182,7 +182,7 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
/* Handle --defaults-group-suffix= */ /* Handle --defaults-group-suffix= */
uint i; uint i;
const char **extra_groups; const char **extra_groups;
const uint instance_len= strlen(my_defaults_group_suffix); const size_t instance_len= strlen(my_defaults_group_suffix);
struct handle_option_ctx *ctx= (struct handle_option_ctx*) func_ctx; struct handle_option_ctx *ctx= (struct handle_option_ctx*) func_ctx;
char *ptr; char *ptr;
TYPELIB *group= ctx->group; TYPELIB *group= ctx->group;
@ -194,11 +194,11 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
for (i= 0; i < group->count; i++) for (i= 0; i < group->count; i++)
{ {
uint len; size_t len;
extra_groups[i]= group->type_names[i]; /** copy group */ extra_groups[i]= group->type_names[i]; /** copy group */
len= strlen(extra_groups[i]); len= strlen(extra_groups[i]);
if (!(ptr= alloc_root(ctx->alloc, len+instance_len+1))) if (!(ptr= alloc_root(ctx->alloc, (uint) (len+instance_len+1))))
goto err; goto err;
extra_groups[i+group->count]= ptr; extra_groups[i+group->count]= ptr;
@ -1083,7 +1083,7 @@ static const char **init_default_directories(MEM_ROOT *alloc)
if ((env= getenv("ETC"))) if ((env= getenv("ETC")))
errors += add_directory(alloc, env, dirs); errors += add_directory(alloc, env, dirs);
#elif defined(DEFAULT_SYSCONFDIR) #elif defined(DEFAULT_SYSCONFDIR)
if (DEFAULT_SYSCONFDIR != "") if (DEFAULT_SYSCONFDIR[0])
errors += add_directory(alloc, DEFAULT_SYSCONFDIR, dirs); errors += add_directory(alloc, DEFAULT_SYSCONFDIR, dirs);
#endif /* __EMX__ || __OS2__ */ #endif /* __EMX__ || __OS2__ */

View File

@ -39,7 +39,7 @@ const char * NEAR globerrs[GLOBERRS]=
"Can't change dir to '%s' (Errcode: %d)", "Can't change dir to '%s' (Errcode: %d)",
"Warning: '%s' had %d links", "Warning: '%s' had %d links",
"%d files and %d streams is left open\n", "%d files and %d streams is left open\n",
"Disk is full writing '%s' (Errcode: %d). Waiting for someone to free space... Retry in %d secs", "Disk is full writing '%s' (Errcode: %d). Waiting for someone to free space... (Expect up to %d secs delay for server to continue after freeing disk space)",
"Can't create directory '%s' (Errcode: %d)", "Can't create directory '%s' (Errcode: %d)",
"Character set '%s' is not a compiled character set and is not specified in the '%s' file", "Character set '%s' is not a compiled character set and is not specified in the '%s' file",
"Out of resources when opening file '%s' (Errcode: %d)", "Out of resources when opening file '%s' (Errcode: %d)",
@ -90,3 +90,17 @@ void init_glob_errs()
EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)"; EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)";
} }
#endif #endif
void wait_for_free_space(const char *filename, int errors)
{
if (errors == 0)
my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
filename,my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
if (!(errors % MY_WAIT_GIVE_USER_A_MESSAGE))
my_printf_error(EE_DISK_FULL,
"Retry in %d secs. Message reprinted in %d secs",
MYF(ME_BELL | ME_NOREFRESH),
MY_WAIT_FOR_USER_TO_FIX_PANIC,
MY_WAIT_GIVE_USER_A_MESSAGE * MY_WAIT_FOR_USER_TO_FIX_PANIC );
VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
}

View File

@ -13,356 +13,313 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
*/
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
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.
*/
/* /*
Changes by Monty: * This code implements the MD5 message-digest algorithm.
Replace of MD5_memset and MD5_memcpy with memset & memcpy * The algorithm is due to Ron Rivest. This code was
* written by Colin Plumb in 1993, no copyright is claimed.
* This code is in the public domain; do with it what you wish.
*
* Equivalent code is available from RSA Data Security, Inc.
* This code has been tested against that, and is equivalent,
* except that you don't need to include two pages of legalese
* with every copy.
*
* To compute the message digest of a chunk of bytes, declare an
* MD5Context structure, pass it to MD5Init, call MD5Update as
* needed on buffers full of bytes, and then call MD5Final, which
* will fill a supplied 16-byte array with the digest.
*/ */
/* This code was modified in 1997 by Jim Kingdon of Cyclic Software to
not require an integer type which is exactly 32 bits. This work
draws on the changes for the same purpose by Tatu Ylonen
<ylo@cs.hut.fi> as part of SSH, but since I didn't actually use
that code, there is no copyright issue. I hereby disclaim
copyright in any changes I have made; this code remains in the
public domain. */
#include <my_global.h> #include <my_global.h>
#include <m_string.h> #include <m_string.h>
#include "my_md5.h" #include "my_md5.h"
/* Constants for MD5Transform routine. */ #include <string.h> /* for memcpy() and memset() */
#define S11 7
#define S12 12
#define S13 17
#define S14 22
#define S21 5
#define S22 9
#define S23 14
#define S24 20
#define S31 4
#define S32 11
#define S33 16
#define S34 23
#define S41 6
#define S42 10
#define S43 15
#define S44 21
static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64])); static void
static void Encode PROTO_LIST my_MD5Transform (cvs_uint32 buf[4], const unsigned char in[64]);
((unsigned char *, UINT4 *, unsigned int));
static void Decode PROTO_LIST
((UINT4 *, unsigned char *, unsigned int));
#ifdef OLD_CODE
static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
#else
#define MD5_memcpy(A,B,C) memcpy((char*) (A),(char*) (B), (C))
#define MD5_memset(A,B,C) memset((char*) (A),(B), (C))
#endif
static unsigned char PADDING[64] = { /* Little-endian byte-swapping routines. Note that these do not
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, depend on the size of datatypes such as uint32, nor do they require
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, us to detect the endianness of the machine we are running on. It
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 is possible they should be macros for speed, but I would be
}; surprised if they were a performance bottleneck for MD5. */
/* F, G, H and I are basic MD5 functions. static uint32 getu32 (const unsigned char *addr)
*/
#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
#define H(x, y, z) ((x) ^ (y) ^ (z))
#define I(x, y, z) ((y) ^ ((x) | (~z)))
/* ROTATE_LEFT rotates x left n bits.
*/
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
Rotation is separate from addition to prevent recomputation.
*/
#define FF(a, b, c, d, x, s, ac) { \
(a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define GG(a, b, c, d, x, s, ac) { \
(a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define HH(a, b, c, d, x, s, ac) { \
(a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define II(a, b, c, d, x, s, ac) { \
(a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
/* MD5 initialization. Begins an MD5 operation, writing a new context.
*/
void my_MD5Init (my_MD5_CTX *context) /* context */
{ {
context->count[0] = context->count[1] = 0; return (((((unsigned long)addr[3] << 8) | addr[2]) << 8)
/* Load magic initialization constants. | addr[1]) << 8 | addr[0];
*/
context->state[0] = 0x67452301;
context->state[1] = 0xefcdab89;
context->state[2] = 0x98badcfe;
context->state[3] = 0x10325476;
} }
/* MD5 block update operation. Continues an MD5 message-digest static void
operation, processing another message block, and updating the putu32 (uint32 data, unsigned char *addr)
context.
*/
void my_MD5Update (
my_MD5_CTX *context, /* context */
unsigned char *input, /* input block */
unsigned int inputLen) /* length of input block */
{ {
unsigned int i, idx, partLen; addr[0] = (unsigned char)data;
addr[1] = (unsigned char)(data >> 8);
addr[2] = (unsigned char)(data >> 16);
addr[3] = (unsigned char)(data >> 24);
}
/*
Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
initialization constants.
*/
void
my_MD5Init (my_MD5Context *ctx)
{
ctx->buf[0] = 0x67452301;
ctx->buf[1] = 0xefcdab89;
ctx->buf[2] = 0x98badcfe;
ctx->buf[3] = 0x10325476;
ctx->bits[0] = 0;
ctx->bits[1] = 0;
}
/*
Update context to reflect the concatenation of another buffer full
of bytes.
*/
void
my_MD5Update (my_MD5Context *ctx, unsigned char const *buf, unsigned len)
{
uint32 t;
/* Update bitcount */
t = ctx->bits[0];
if ((ctx->bits[0] = (t + ((uint32)len << 3)) & 0xffffffff) < t)
ctx->bits[1]++; /* Carry from low to high */
ctx->bits[1] += len >> 29;
t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
/* Handle any leading odd-sized chunks */
if ( t ) {
unsigned char *p = ctx->in + t;
t = 64-t;
if (len < t) {
memcpy(p, buf, len);
return;
}
memcpy(p, buf, t);
my_MD5Transform (ctx->buf, ctx->in);
buf += t;
len -= t;
}
/* Process data in 64-byte chunks */
while (len >= 64) {
memcpy(ctx->in, buf, 64);
my_MD5Transform (ctx->buf, ctx->in);
buf += 64;
len -= 64;
}
/* Handle any remaining bytes of data. */
memcpy(ctx->in, buf, len);
}
/*
Final wrapup - pad to 64-byte boundary with the bit pattern
1 0* (64-bit count of bits processed, MSB-first)
*/
void
my_MD5Final (unsigned char digest[16], my_MD5Context *ctx)
{
unsigned count;
unsigned char *p;
/* Compute number of bytes mod 64 */ /* Compute number of bytes mod 64 */
idx = (unsigned int)((context->count[0] >> 3) & 0x3F); count = (ctx->bits[0] >> 3) & 0x3F;
/* Set the first char of padding to 0x80. This is safe since there is
always at least one byte free */
p = ctx->in + count;
*p++ = 0x80;
/* Update number of bits */ /* Bytes of padding needed to make 64 bytes */
if ((context->count[0] += ((UINT4)inputLen << 3)) count = 64 - 1 - count;
< ((UINT4)inputLen << 3))
context->count[1]++;
context->count[1] += ((UINT4)inputLen >> 29);
partLen = 64 - idx; /* Pad out to 56 mod 64 */
if (count < 8) {
/* Two lots of padding: Pad the first block to 64 bytes */
memset(p, 0, count);
my_MD5Transform (ctx->buf, ctx->in);
/* Transform as many times as possible. /* Now fill the next block with 56 bytes */
*/ memset(ctx->in, 0, 56);
if (inputLen >= partLen) { } else {
MD5_memcpy((POINTER)&context->buffer[idx], (POINTER)input, partLen); /* Pad block to 56 bytes */
MD5Transform(context->state, context->buffer); memset(p, 0, count-8);
for (i = partLen; i + 63 < inputLen; i += 64)
MD5Transform (context->state, &input[i]);
idx = 0;
}
else
i = 0;
/* Buffer remaining input */
MD5_memcpy((POINTER)&context->buffer[idx], (POINTER)&input[i],
inputLen-i);
} }
/* MD5 finalization. Ends an MD5 message-digest operation, writing the /* Append length in bits and transform */
the message digest and zeroizing the context. putu32(ctx->bits[0], ctx->in + 56);
*/ putu32(ctx->bits[1], ctx->in + 60);
void my_MD5Final ( my_MD5Transform (ctx->buf, ctx->in);
unsigned char digest[16], /* message digest */ putu32(ctx->buf[0], digest);
my_MD5_CTX *context) /* context */ putu32(ctx->buf[1], digest + 4);
putu32(ctx->buf[2], digest + 8);
putu32(ctx->buf[3], digest + 12);
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
}
#ifndef ASM_MD5
/* The four core functions - F1 is optimized somewhat */
/* #define F1(x, y, z) (x & y | ~x & z) */
#define F1(x, y, z) (z ^ (x & (y ^ z)))
#define F2(x, y, z) F1(z, x, y)
#define F3(x, y, z) (x ^ y ^ z)
#define F4(x, y, z) (y ^ (x | ~z))
/* This is the central step in the MD5 algorithm. */
#define MD5STEP(f, w, x, y, z, data, s) \
( w += f(x, y, z) + data, w &= 0xffffffff, w = w<<s | w>>(32-s), w += x )
/*
* The core of the MD5 algorithm, this alters an existing MD5 hash to
* reflect the addition of 16 longwords of new data. MD5Update blocks
* the data and converts bytes into longwords for this routine.
*/
static void
my_MD5Transform (uint32 buf[4], const unsigned char inraw[64])
{ {
unsigned char bits[8]; register uint32 a, b, c, d;
unsigned int idx, padLen; uint32 in[16];
int i;
/* Save number of bits */ for (i = 0; i < 16; ++i)
Encode (bits, context->count, 8); in[i] = getu32 (inraw + 4 * i);
/* Pad out to 56 mod 64. a = buf[0];
*/ b = buf[1];
idx = (unsigned int)((context->count[0] >> 3) & 0x3f); c = buf[2];
padLen = (idx < 56) ? (56 - idx) : (120 - idx); d = buf[3];
my_MD5Update (context, PADDING, padLen);
/* Append length (before padding) */ MD5STEP(F1, a, b, c, d, in[ 0]+0xd76aa478, 7);
my_MD5Update (context, bits, 8); MD5STEP(F1, d, a, b, c, in[ 1]+0xe8c7b756, 12);
MD5STEP(F1, c, d, a, b, in[ 2]+0x242070db, 17);
MD5STEP(F1, b, c, d, a, in[ 3]+0xc1bdceee, 22);
MD5STEP(F1, a, b, c, d, in[ 4]+0xf57c0faf, 7);
MD5STEP(F1, d, a, b, c, in[ 5]+0x4787c62a, 12);
MD5STEP(F1, c, d, a, b, in[ 6]+0xa8304613, 17);
MD5STEP(F1, b, c, d, a, in[ 7]+0xfd469501, 22);
MD5STEP(F1, a, b, c, d, in[ 8]+0x698098d8, 7);
MD5STEP(F1, d, a, b, c, in[ 9]+0x8b44f7af, 12);
MD5STEP(F1, c, d, a, b, in[10]+0xffff5bb1, 17);
MD5STEP(F1, b, c, d, a, in[11]+0x895cd7be, 22);
MD5STEP(F1, a, b, c, d, in[12]+0x6b901122, 7);
MD5STEP(F1, d, a, b, c, in[13]+0xfd987193, 12);
MD5STEP(F1, c, d, a, b, in[14]+0xa679438e, 17);
MD5STEP(F1, b, c, d, a, in[15]+0x49b40821, 22);
/* Store state in digest */ MD5STEP(F2, a, b, c, d, in[ 1]+0xf61e2562, 5);
Encode (digest, context->state, 16); MD5STEP(F2, d, a, b, c, in[ 6]+0xc040b340, 9);
MD5STEP(F2, c, d, a, b, in[11]+0x265e5a51, 14);
MD5STEP(F2, b, c, d, a, in[ 0]+0xe9b6c7aa, 20);
MD5STEP(F2, a, b, c, d, in[ 5]+0xd62f105d, 5);
MD5STEP(F2, d, a, b, c, in[10]+0x02441453, 9);
MD5STEP(F2, c, d, a, b, in[15]+0xd8a1e681, 14);
MD5STEP(F2, b, c, d, a, in[ 4]+0xe7d3fbc8, 20);
MD5STEP(F2, a, b, c, d, in[ 9]+0x21e1cde6, 5);
MD5STEP(F2, d, a, b, c, in[14]+0xc33707d6, 9);
MD5STEP(F2, c, d, a, b, in[ 3]+0xf4d50d87, 14);
MD5STEP(F2, b, c, d, a, in[ 8]+0x455a14ed, 20);
MD5STEP(F2, a, b, c, d, in[13]+0xa9e3e905, 5);
MD5STEP(F2, d, a, b, c, in[ 2]+0xfcefa3f8, 9);
MD5STEP(F2, c, d, a, b, in[ 7]+0x676f02d9, 14);
MD5STEP(F2, b, c, d, a, in[12]+0x8d2a4c8a, 20);
/* Zeroize sensitive information. MD5STEP(F3, a, b, c, d, in[ 5]+0xfffa3942, 4);
*/ MD5STEP(F3, d, a, b, c, in[ 8]+0x8771f681, 11);
MD5_memset ((POINTER)context, 0, sizeof (*context)); MD5STEP(F3, c, d, a, b, in[11]+0x6d9d6122, 16);
} MD5STEP(F3, b, c, d, a, in[14]+0xfde5380c, 23);
MD5STEP(F3, a, b, c, d, in[ 1]+0xa4beea44, 4);
MD5STEP(F3, d, a, b, c, in[ 4]+0x4bdecfa9, 11);
MD5STEP(F3, c, d, a, b, in[ 7]+0xf6bb4b60, 16);
MD5STEP(F3, b, c, d, a, in[10]+0xbebfbc70, 23);
MD5STEP(F3, a, b, c, d, in[13]+0x289b7ec6, 4);
MD5STEP(F3, d, a, b, c, in[ 0]+0xeaa127fa, 11);
MD5STEP(F3, c, d, a, b, in[ 3]+0xd4ef3085, 16);
MD5STEP(F3, b, c, d, a, in[ 6]+0x04881d05, 23);
MD5STEP(F3, a, b, c, d, in[ 9]+0xd9d4d039, 4);
MD5STEP(F3, d, a, b, c, in[12]+0xe6db99e5, 11);
MD5STEP(F3, c, d, a, b, in[15]+0x1fa27cf8, 16);
MD5STEP(F3, b, c, d, a, in[ 2]+0xc4ac5665, 23);
/* MD5 basic transformation. Transforms state based on block. MD5STEP(F4, a, b, c, d, in[ 0]+0xf4292244, 6);
*/ MD5STEP(F4, d, a, b, c, in[ 7]+0x432aff97, 10);
static void MD5Transform ( MD5STEP(F4, c, d, a, b, in[14]+0xab9423a7, 15);
UINT4 state[4], MD5STEP(F4, b, c, d, a, in[ 5]+0xfc93a039, 21);
unsigned char block[64]) MD5STEP(F4, a, b, c, d, in[12]+0x655b59c3, 6);
{ MD5STEP(F4, d, a, b, c, in[ 3]+0x8f0ccc92, 10);
UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; MD5STEP(F4, c, d, a, b, in[10]+0xffeff47d, 15);
MD5STEP(F4, b, c, d, a, in[ 1]+0x85845dd1, 21);
MD5STEP(F4, a, b, c, d, in[ 8]+0x6fa87e4f, 6);
MD5STEP(F4, d, a, b, c, in[15]+0xfe2ce6e0, 10);
MD5STEP(F4, c, d, a, b, in[ 6]+0xa3014314, 15);
MD5STEP(F4, b, c, d, a, in[13]+0x4e0811a1, 21);
MD5STEP(F4, a, b, c, d, in[ 4]+0xf7537e82, 6);
MD5STEP(F4, d, a, b, c, in[11]+0xbd3af235, 10);
MD5STEP(F4, c, d, a, b, in[ 2]+0x2ad7d2bb, 15);
MD5STEP(F4, b, c, d, a, in[ 9]+0xeb86d391, 21);
Decode (x, block, 64); buf[0] += a;
buf[1] += b;
/* Round 1 */ buf[2] += c;
FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ buf[3] += d;
FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
/* Round 2 */
GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */
GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
/* Round 3 */
HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
/* Round 4 */
II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
/* Zeroize sensitive information.
*/
MD5_memset ((POINTER)x, 0, sizeof (x));
}
/* Encodes input (UINT4) into output (unsigned char). Assumes len is
a multiple of 4.
*/
static void Encode (
unsigned char *output,
UINT4 *input,
unsigned int len)
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
output[j] = (unsigned char)(input[i] & 0xff);
output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
}
}
/* Decodes input (unsigned char) into output (UINT4). Assumes len is
a multiple of 4.
*/
static void Decode (
UINT4 *output,
unsigned char *input,
unsigned int len)
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4)
output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
(((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
}
/* Note: Replace "for loop" with standard memcpy if possible.
*/
#ifndef MD5_memcpy
static void MD5_memcpy (output, input, len)
POINTER output;
POINTER input;
unsigned int len;
{
unsigned int i;
for (i = 0; i < len; i++)
output[i] = input[i];
} }
#endif #endif
/* Note: Replace "for loop" with standard memset if possible. #ifdef TEST
/*
Simple test program. Can use it to manually run the tests from
RFC1321 for example.
*/ */
#include <stdio.h>
#ifndef MD5_memset int
static void MD5_memset (output, value, len) main (int argc, char **argv)
POINTER output;
int value;
unsigned int len;
{ {
unsigned int i; my_MD5Context context;
unsigned char checksum[16];
int i;
int j;
for (i = 0; i < len; i++) if (argc < 2)
((char *)output)[i] = (char)value; {
fprintf (stderr, "usage: %s string-to-hash\n", argv[0]);
exit (1);
} }
#endif for (j = 1; j < argc; ++j)
{
printf ("MD5 (\"%s\") = ", argv[j]);
my_MD5Init (&context);
my_MD5Update (&context, argv[j], strlen (argv[j]));
my_MD5Final (checksum, &context);
for (i = 0; i < 16; i++)
{
printf ("%02x", (unsigned int) checksum[i]);
}
printf ("\n");
}
return 0;
}
#endif /* TEST */

View File

@ -368,9 +368,9 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
else else
{ {
/* %% or unknown code */ /* %% or unknown code */
if (my_b_write(info, backtrack, fmt-backtrack)) if (my_b_write(info, backtrack, (uint) (fmt - backtrack)))
goto err; goto err;
out_length+= fmt-backtrack; out_length+= (uint) (fmt - backtrack);
} }
} }
return out_length; return out_length;

View File

@ -116,10 +116,8 @@ uint my_fwrite(FILE *stream, const byte *Buffer, uint Count, myf MyFlags)
if ((errno == ENOSPC || errno == EDQUOT) && if ((errno == ENOSPC || errno == EDQUOT) &&
(MyFlags & MY_WAIT_IF_FULL)) (MyFlags & MY_WAIT_IF_FULL))
{ {
if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE)) wait_for_free_space("[stream]", errors);
my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH), errors++;
"[stream]",my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
VOID(my_fseek(stream,seekptr,MY_SEEK_SET,MYF(0))); VOID(my_fseek(stream,seekptr,MY_SEEK_SET,MYF(0)));
continue; continue;
} }

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