Merge neptunus.(none):/home/msvensson/mysql/mysql-5.1

into  neptunus.(none):/home/msvensson/mysql/mysql-5.1-maint
This commit is contained in:
msvensson@neptunus.(none) 2007-02-06 15:46:17 +01:00
commit e4001b3b5a
305 changed files with 6041 additions and 3924 deletions

View File

@ -2081,6 +2081,7 @@ storage/archive/.deps/ha_archive_la-azio.Plo
storage/archive/.deps/ha_archive_la-ha_archive.Plo storage/archive/.deps/ha_archive_la-ha_archive.Plo
storage/archive/.deps/libarchive_a-azio.Po storage/archive/.deps/libarchive_a-azio.Po
storage/archive/.deps/libarchive_a-ha_archive.Po storage/archive/.deps/libarchive_a-ha_archive.Po
storage/archive/archive_reader
storage/archive/archive_test storage/archive/archive_test
storage/bdb/*.ds? storage/bdb/*.ds?
storage/bdb/*.vcproj storage/bdb/*.vcproj

View File

@ -93,6 +93,10 @@ if [ "x$warning_mode" != "xpedantic" ]; then
warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W" warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W"
warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare" warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare"
warnings="$warnings -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable" warnings="$warnings -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable"
# For more warnings, uncomment the following line
# warnings="$global_warnings -Wshadow"
# C warnings # C warnings
c_warnings="$warnings -Wunused-parameter" c_warnings="$warnings -Wunused-parameter"
# C++ warnings # C++ warnings
@ -139,9 +143,17 @@ fi
# #
base_configs="--prefix=$prefix --enable-assembler " base_configs="--prefix=$prefix --enable-assembler "
base_configs="$base_configs --with-extra-charsets=complex " base_configs="$base_configs --with-extra-charsets=complex "
base_configs="$base_configs --enable-thread-safe-client --with-readline " base_configs="$base_configs --enable-thread-safe-client "
base_configs="$base_configs --with-big-tables" base_configs="$base_configs --with-big-tables"
if test -d "$path/../cmd-line-utils/readline"
then
base_configs="$base_configs --with-readline"
elif test -d "$path/../cmd-line-utils/libedit"
then
base_configs="$base_configs --with-libedit"
fi
static_link="--with-mysqld-ldflags=-all-static " static_link="--with-mysqld-ldflags=-all-static "
static_link="$static_link --with-client-ldflags=-all-static" static_link="$static_link --with-client-ldflags=-all-static"
# we need local-infile in all binaries for rpl000001 # we need local-infile in all binaries for rpl000001
@ -183,6 +195,12 @@ fi
# (http://samba.org/ccache) is installed, use it. # (http://samba.org/ccache) is installed, use it.
# We use 'grep' and hope 'grep' will work as expected # We use 'grep' and hope 'grep' will work as expected
# (returns 0 if finds lines) # (returns 0 if finds lines)
if test "$USING_GCOV" != "1"
then
# Not using gcov; Safe to use ccache
CCACHE_GCOV_VERSION_ENABLED=1
fi
if ccache -V > /dev/null 2>&1 && test "$CCACHE_GCOV_VERSION_ENABLED" = "1" if ccache -V > /dev/null 2>&1 && test "$CCACHE_GCOV_VERSION_ENABLED" = "1"
then then
echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC" echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC"

19
BUILD/SETUP.sh.rej Normal file
View File

@ -0,0 +1,19 @@
***************
*** 39,46 ****
c_warnings="$global_warnings -Wunused"
cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
! alpha_cflags="-mcpu=ev6 -Wa,-mev6" # Not used yet
! pentium_cflags="-mcpu=pentiumpro"
sparc_cflags=""
# be as fast as we can be without losing our ability to backtrace
--- 39,46 ----
c_warnings="$global_warnings -Wunused"
cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
! #alpha_cflags="-mcpu=ev6 -Wa,-mev6" # Not used yet
! #pentium_cflags="-mcpu=pentiumpro"
sparc_cflags=""
# be as fast as we can be without losing our ability to backtrace

View File

@ -2,6 +2,7 @@
# Need to disable ccache, or we loose the gcov-needed compiler output files. # Need to disable ccache, or we loose the gcov-needed compiler output files.
USING_GCOV=1
CCACHE_GCOV_VERSION_ENABLED=0 CCACHE_GCOV_VERSION_ENABLED=0
if ccache -V > /dev/null 2>&1 if ccache -V > /dev/null 2>&1
then then
@ -26,8 +27,10 @@ export LDFLAGS="-fprofile-arcs -ftest-coverage"
# The -fprofile-arcs and -ftest-coverage options cause GCC to instrument the # The -fprofile-arcs and -ftest-coverage options cause GCC to instrument the
# code with profiling information used by gcov. # code with profiling information used by gcov.
# the -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl. # the -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl.
extra_flags="$pentium_cflags -fprofile-arcs -ftest-coverage -DDISABLE_TAO_ASM -DHAVE_MUTEX_THREAD_ONLY $debug_extra_flags" extra_flags="$pentium_cflags -fprofile-arcs -ftest-coverage -DDISABLE_TAO_ASM -DHAVE_MUTEX_THREAD_ONLY $debug_extra_flags $debug_cflags $max_cflags -DMYSQL_SERVER_SUFFIX=-gcov"
extra_configs="$pentium_configs $debug_configs --disable-shared $static_link" extra_configs="$pentium_configs $debug_configs --disable-shared $static_link"
extra_configs="$extra_configs $max_configs" extra_configs="$extra_configs $max_configs"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
. "$path/FINISH.sh" . "$path/FINISH.sh"

View File

@ -131,7 +131,7 @@ typedef enum enum_info_type INFO_TYPE;
static MYSQL mysql; /* The connection */ static MYSQL mysql; /* The connection */
static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0, static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
connected=0,opt_raw_data=0,unbuffered=0,output_tables=0, connected=0,opt_raw_data=0,unbuffered=0,output_tables=0,
rehash=1,skip_updates=0,safe_updates=0,one_database=0, opt_rehash=1,skip_updates=0,safe_updates=0,one_database=0,
opt_compress=0, using_opt_local_infile=0, opt_compress=0, using_opt_local_infile=0,
vertical=0, line_numbers=1, column_names=1,opt_html=0, vertical=0, line_numbers=1, column_names=1,opt_html=0,
opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0, opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0,
@ -591,7 +591,8 @@ static struct my_option my_long_options[] =
#endif #endif
{"auto-rehash", OPT_AUTO_REHASH, {"auto-rehash", OPT_AUTO_REHASH,
"Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. Disable with --disable-auto-rehash.", "Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. Disable with --disable-auto-rehash.",
(gptr*) &rehash, (gptr*) &rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, (gptr*) &opt_rehash, (gptr*) &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
0, 0},
{"no-auto-rehash", 'A', {"no-auto-rehash", 'A',
"No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead.", "No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -898,7 +899,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
} }
break; break;
case 'A': case 'A':
rehash= 0; opt_rehash= 0;
break; break;
case 'N': case 'N':
column_names= 0; column_names= 0;
@ -1408,7 +1409,7 @@ static char **new_mysql_completion (const char *text, int start, int end);
#if defined(USE_NEW_READLINE_INTERFACE) || defined(USE_LIBEDIT_INTERFACE) #if defined(USE_NEW_READLINE_INTERFACE) || defined(USE_LIBEDIT_INTERFACE)
char *no_completion(const char*,int) char *no_completion(const char*,int)
#else #else
int no_completion() char *no_completion()
#endif #endif
{ {
return 0; /* No filename completion */ return 0; /* No filename completion */
@ -1496,10 +1497,10 @@ static void initialize_readline (char *name)
setlocale(LC_ALL,""); /* so as libedit use isprint */ setlocale(LC_ALL,""); /* so as libedit use isprint */
#endif #endif
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion; rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
rl_completion_entry_function= (Function*)&no_completion; rl_completion_entry_function= &no_completion;
#else #else
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion; rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
rl_completion_entry_function= (Function*)&no_completion; rl_completion_entry_function= &no_completion;
#endif #endif
} }
@ -1756,15 +1757,17 @@ char *rindex(const char *s,int c)
static int reconnect(void) static int reconnect(void)
{ {
/* purecov: begin tested */
if (opt_reconnect) if (opt_reconnect)
{ {
put_info("No connection. Trying to reconnect...",INFO_INFO); put_info("No connection. Trying to reconnect...",INFO_INFO);
(void) com_connect((String *) 0, 0); (void) com_connect((String *) 0, 0);
if (rehash) if (opt_rehash)
com_rehash(NULL, NULL); com_rehash(NULL, NULL);
} }
if (!connected) if (!connected)
return put_info("Can't connect to the server\n",INFO_ERROR); return put_info("Can't connect to the server\n",INFO_ERROR);
/* purecov: end */
return 0; return 0;
} }
@ -2933,7 +2936,7 @@ static int
com_connect(String *buffer, char *line) com_connect(String *buffer, char *line)
{ {
char *tmp, buff[256]; char *tmp, buff[256];
bool save_rehash= rehash; bool save_rehash= opt_rehash;
int error; int error;
bzero(buff, sizeof(buff)); bzero(buff, sizeof(buff));
@ -2957,13 +2960,16 @@ com_connect(String *buffer, char *line)
} }
} }
else else
rehash= 0; // Quick re-connect {
/* Quick re-connect */
opt_rehash= 0; /* purecov: tested */
}
buffer->length(0); // command used buffer->length(0); // command used
} }
else else
rehash= 0; opt_rehash= 0;
error=sql_connect(current_host,current_db,current_user,opt_password,0); error=sql_connect(current_host,current_db,current_user,opt_password,0);
rehash= save_rehash; opt_rehash= save_rehash;
if (connected) if (connected)
{ {
@ -3125,7 +3131,7 @@ com_use(String *buffer __attribute__((unused)), char *line)
current_db=my_strdup(tmp,MYF(MY_WME)); current_db=my_strdup(tmp,MYF(MY_WME));
#ifdef HAVE_READLINE #ifdef HAVE_READLINE
if (select_db > 1) if (select_db > 1)
build_completion_hash(rehash, 1); build_completion_hash(opt_rehash, 1);
#endif #endif
} }
@ -3279,7 +3285,7 @@ sql_real_connect(char *host,char *database,char *user,char *password,
mysql.reconnect= 1; mysql.reconnect= 1;
#endif #endif
#ifdef HAVE_READLINE #ifdef HAVE_READLINE
build_completion_hash(rehash, 1); build_completion_hash(opt_rehash, 1);
#endif #endif
return 0; return 0;
} }
@ -3324,8 +3330,8 @@ static int
com_status(String *buffer __attribute__((unused)), com_status(String *buffer __attribute__((unused)),
char *line __attribute__((unused))) char *line __attribute__((unused)))
{ {
const char *status; const char *status_str;
char buff[22]; char buff[40];
ulonglong id; ulonglong id;
MYSQL_RES *result; MYSQL_RES *result;
LINT_INIT(result); LINT_INIT(result);
@ -3351,9 +3357,9 @@ com_status(String *buffer __attribute__((unused)),
mysql_free_result(result); mysql_free_result(result);
} }
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
if ((status= mysql_get_ssl_cipher(&mysql))) if ((status_str= mysql_get_ssl_cipher(&mysql)))
tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n", tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n",
status); status_str);
else else
#endif /* HAVE_OPENSSL */ #endif /* HAVE_OPENSSL */
tee_puts("SSL:\t\t\tNot in use", stdout); tee_puts("SSL:\t\t\tNot in use", stdout);
@ -3412,23 +3418,20 @@ com_status(String *buffer __attribute__((unused)),
tee_fprintf(stdout, "Protocol:\t\tCompressed\n"); tee_fprintf(stdout, "Protocol:\t\tCompressed\n");
#endif #endif
if ((status=mysql_stat(&mysql)) && !mysql_error(&mysql)[0]) if ((status_str= mysql_stat(&mysql)) && !mysql_error(&mysql)[0])
{ {
ulong sec; ulong sec;
char buff[40]; const char *pos= strchr(status_str,' ');
const char *pos= strchr(status,' ');
/* print label */ /* print label */
tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status), status); tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status_str), status_str);
if ((status=str2int(pos,10,0,LONG_MAX,(long*) &sec))) if ((status_str= str2int(pos,10,0,LONG_MAX,(long*) &sec)))
{ {
nice_time((double) sec,buff,0); nice_time((double) sec,buff,0);
tee_puts(buff, stdout); /* print nice time */ tee_puts(buff, stdout); /* print nice time */
while (*status == ' ') status++; /* to next info */ while (*status_str == ' ')
} status_str++; /* to next info */
if (status)
{
tee_putc('\n', stdout); tee_putc('\n', stdout);
tee_puts(status, stdout); tee_puts(status_str, stdout);
} }
} }
if (safe_updates) if (safe_updates)
@ -3448,7 +3451,7 @@ select_limit, max_join_size);
} }
static const char * static const char *
server_version_string(MYSQL *mysql) server_version_string(MYSQL *con)
{ {
static char buf[MAX_SERVER_VERSION_LENGTH] = ""; static char buf[MAX_SERVER_VERSION_LENGTH] = "";
@ -3458,11 +3461,11 @@ server_version_string(MYSQL *mysql)
char *bufp = buf; char *bufp = buf;
MYSQL_RES *result; MYSQL_RES *result;
bufp = strnmov(buf, mysql_get_server_info(mysql), sizeof buf); bufp= strnmov(buf, mysql_get_server_info(con), sizeof buf);
/* "limit 1" is protection against SQL_SELECT_LIMIT=0 */ /* "limit 1" is protection against SQL_SELECT_LIMIT=0 */
if (!mysql_query(mysql, "select @@version_comment limit 1") && if (!mysql_query(con, "select @@version_comment limit 1") &&
(result = mysql_use_result(mysql))) (result = mysql_use_result(con)))
{ {
MYSQL_ROW cur = mysql_fetch_row(result); MYSQL_ROW cur = mysql_fetch_row(result);
if (cur && cur[0]) if (cur && cur[0])
@ -3552,10 +3555,10 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate)
static int static int
put_error(MYSQL *mysql) put_error(MYSQL *con)
{ {
return put_info(mysql_error(mysql), INFO_ERROR, mysql_errno(mysql), return put_info(mysql_error(con), INFO_ERROR, mysql_errno(con),
mysql_sqlstate(mysql)); mysql_sqlstate(con));
} }
@ -3802,8 +3805,6 @@ static const char* construct_prompt()
break; break;
case 'D': case 'D':
char* dateTime; char* dateTime;
time_t lclock;
lclock = time(NULL);
dateTime = ctime(&lclock); dateTime = ctime(&lclock);
processed_prompt.append(strtok(dateTime,"\n")); processed_prompt.append(strtok(dateTime,"\n"));
break; break;

View File

@ -449,9 +449,9 @@ int main(int argc, char **argv)
char *forced_defaults_file; char *forced_defaults_file;
char *forced_extra_defaults; char *forced_extra_defaults;
char *defaults_group_suffix; char *local_defaults_group_suffix;
const char *script_line; const char *script_line;
char *upgrade_defaults_path; char *upgrade_defaults_path= 0;
char *defaults_to_use= NULL; char *defaults_to_use= NULL;
int upgrade_defaults_created= 0; int upgrade_defaults_created= 0;
@ -466,7 +466,7 @@ int main(int argc, char **argv)
/* Check if we are forced to use specific defaults */ /* Check if we are forced to use specific defaults */
get_defaults_options(argc, argv, get_defaults_options(argc, argv,
&forced_defaults_file, &forced_extra_defaults, &forced_defaults_file, &forced_extra_defaults,
&defaults_group_suffix); &local_defaults_group_suffix);
load_defaults("my", load_default_groups, &argc, &argv); load_defaults("my", load_default_groups, &argc, &argv);

View File

@ -94,15 +94,14 @@ static my_bool file_not_closed_error= 0;
This is because the event will be created (alloced) in read_log_event() This is because the event will be created (alloced) in read_log_event()
(which returns a pointer) in check_header(). (which returns a pointer) in check_header().
*/ */
Format_description_log_event* description_event; Format_description_log_event* glob_description_event;
static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info, static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
const char* logname); const char* logname);
static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info, static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
const char* logname); const char* logname);
static int dump_log_entries(const char* logname); static int dump_log_entries(const char* logname);
static int dump_remote_file(NET* net, const char* fname); static void die(const char* fmt, ...) __attribute__ ((__noreturn__));
static void die(const char* fmt, ...);
static MYSQL* safe_connect(); static MYSQL* safe_connect();
@ -603,7 +602,7 @@ int process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
ce->print(result_file, print_event_info, TRUE); ce->print(result_file, print_event_info, TRUE);
// If this binlog is not 3.23 ; why this test?? // If this binlog is not 3.23 ; why this test??
if (description_event->binlog_version >= 3) if (glob_description_event->binlog_version >= 3)
{ {
if (load_processor.process(ce)) if (load_processor.process(ce))
break; // Error break; // Error
@ -638,9 +637,10 @@ Create_file event for file_id: %u\n",exv->file_id);
break; break;
} }
case FORMAT_DESCRIPTION_EVENT: case FORMAT_DESCRIPTION_EVENT:
delete description_event; delete glob_description_event;
description_event= (Format_description_log_event*) ev; glob_description_event= (Format_description_log_event*) ev;
print_event_info->common_header_len= description_event->common_header_len; print_event_info->common_header_len=
glob_description_event->common_header_len;
ev->print(result_file, print_event_info); ev->print(result_file, print_event_info);
/* /*
We don't want this event to be deleted now, so let's hide it (I We don't want this event to be deleted now, so let's hide it (I
@ -650,7 +650,7 @@ Create_file event for file_id: %u\n",exv->file_id);
*/ */
ev= 0; ev= 0;
if (!force_if_open_opt && if (!force_if_open_opt &&
(description_event->flags & LOG_EVENT_BINLOG_IN_USE_F)) (glob_description_event->flags & LOG_EVENT_BINLOG_IN_USE_F))
{ {
file_not_closed_error= 1; file_not_closed_error= 1;
DBUG_RETURN(1); DBUG_RETURN(1);
@ -1037,7 +1037,7 @@ static int dump_log_entries(const char* logname)
This is not as smart as check_header() (used for local log); it will not work This is not as smart as check_header() (used for local log); it will not work
for a binlog which mixes format. TODO: fix this. for a binlog which mixes format. TODO: fix this.
*/ */
static int check_master_version(MYSQL* mysql, static int check_master_version(MYSQL *mysql_arg,
Format_description_log_event Format_description_log_event
**description_event) **description_event)
{ {
@ -1045,26 +1045,31 @@ static int check_master_version(MYSQL* mysql,
MYSQL_ROW row; MYSQL_ROW row;
const char* version; const char* version;
if (mysql_query(mysql, "SELECT VERSION()") || if (mysql_query(mysql_arg, "SELECT VERSION()") ||
!(res = mysql_store_result(mysql))) !(res = mysql_store_result(mysql_arg)))
{ {
/* purecov: begin inspected */
char errmsg[256]; char errmsg[256];
strmake(errmsg, mysql_error(mysql), sizeof(errmsg)-1); strmake(errmsg, mysql_error(mysql_arg), sizeof(errmsg)-1);
mysql_close(mysql); mysql_close(mysql_arg);
die("Error checking master version: %s", errmsg); die("Error checking master version: %s", errmsg);
/* purecov: end */
} }
if (!(row = mysql_fetch_row(res))) if (!(row = mysql_fetch_row(res)))
{ {
/* purecov: begin inspected */
mysql_free_result(res); mysql_free_result(res);
mysql_close(mysql); mysql_close(mysql);
die("Master returned no rows for SELECT VERSION()"); die("Master returned no rows for SELECT VERSION()");
return 1; /* purecov: end */
} }
if (!(version = row[0])) if (!(version = row[0]))
{ {
/* purecov: begin inspected */
mysql_free_result(res); mysql_free_result(res);
mysql_close(mysql); mysql_close(mysql_arg);
die("Master reported NULL for the version"); die("Master reported NULL for the version");
/* purecov: end */
} }
switch (*version) { switch (*version) {
@ -1083,11 +1088,11 @@ static int check_master_version(MYSQL* mysql,
*description_event= new Format_description_log_event(3); *description_event= new Format_description_log_event(3);
break; break;
default: default:
sql_print_error("Master reported unrecognized MySQL version '%s'", /* purecov: begin inspected */
version);
mysql_free_result(res); mysql_free_result(res);
mysql_close(mysql); mysql_close(mysql_arg);
return 1; die("Master reported unrecognized MySQL version '%s'", version);
/* purecov: end */
} }
mysql_free_result(res); mysql_free_result(res);
return 0; return 0;
@ -1115,12 +1120,12 @@ static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
mysql= safe_connect(); mysql= safe_connect();
net= &mysql->net; net= &mysql->net;
if (check_master_version(mysql, &description_event)) if (check_master_version(mysql, &glob_description_event))
{ {
fprintf(stderr, "Could not find server version"); fprintf(stderr, "Could not find server version");
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (!description_event || !description_event->is_valid()) if (!glob_description_event || !glob_description_event->is_valid())
{ {
fprintf(stderr, "Invalid Format_description log event; \ fprintf(stderr, "Invalid Format_description log event; \
could be out of memory"); could be out of memory");
@ -1170,7 +1175,7 @@ could be out of memory");
len, net->read_pos[5])); len, net->read_pos[5]));
if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 , if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 ,
len - 1, &error_msg, len - 1, &error_msg,
description_event))) glob_description_event)))
{ {
fprintf(stderr, "Could not construct log event object\n"); fprintf(stderr, "Could not construct log event object\n");
error= 1; error= 1;
@ -1178,7 +1183,7 @@ could be out of memory");
} }
Log_event_type type= ev->get_type_code(); Log_event_type type= ev->get_type_code();
if (description_event->binlog_version >= 3 || if (glob_description_event->binlog_version >= 3 ||
(type != LOAD_EVENT && type != CREATE_FILE_EVENT)) (type != LOAD_EVENT && type != CREATE_FILE_EVENT))
{ {
/* /*
@ -1384,7 +1389,7 @@ static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
my_close(fd, MYF(MY_WME)); my_close(fd, MYF(MY_WME));
return 1; return 1;
} }
check_header(file, &description_event); check_header(file, &glob_description_event);
} }
else // reading from stdin; else // reading from stdin;
{ {
@ -1406,7 +1411,7 @@ static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
if (init_io_cache(file, fileno(stdin), 0, READ_CACHE, (my_off_t) 0, if (init_io_cache(file, fileno(stdin), 0, READ_CACHE, (my_off_t) 0,
0, MYF(MY_WME | MY_NABP | MY_DONT_CHECK_FILESIZE))) 0, MYF(MY_WME | MY_NABP | MY_DONT_CHECK_FILESIZE)))
return 1; return 1;
check_header(file, &description_event); check_header(file, &glob_description_event);
if (start_position) if (start_position)
{ {
/* skip 'start_position' characters from stdin */ /* skip 'start_position' characters from stdin */
@ -1424,7 +1429,7 @@ static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
} }
} }
if (!description_event || !description_event->is_valid()) if (!glob_description_event || !glob_description_event->is_valid())
die("Invalid Format_description log event; could be out of memory"); die("Invalid Format_description log event; could be out of memory");
if (!start_position && my_b_read(file, tmp_buff, BIN_LOG_HEADER_SIZE)) if (!start_position && my_b_read(file, tmp_buff, BIN_LOG_HEADER_SIZE))
@ -1437,14 +1442,14 @@ static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
char llbuff[21]; char llbuff[21];
my_off_t old_off = my_b_tell(file); my_off_t old_off = my_b_tell(file);
Log_event* ev = Log_event::read_log_event(file, description_event); Log_event* ev = Log_event::read_log_event(file, glob_description_event);
if (!ev) if (!ev)
{ {
/* /*
if binlog wasn't closed properly ("in use" flag is set) don't complain if binlog wasn't closed properly ("in use" flag is set) don't complain
about a corruption, but treat it as EOF and move to the next binlog. about a corruption, but treat it as EOF and move to the next binlog.
*/ */
if (description_event->flags & LOG_EVENT_BINLOG_IN_USE_F) if (glob_description_event->flags & LOG_EVENT_BINLOG_IN_USE_F)
file->error= 0; file->error= 0;
else if (file->error) else if (file->error)
{ {
@ -1469,7 +1474,7 @@ end:
if (fd >= 0) if (fd >= 0)
my_close(fd, MYF(MY_WME)); my_close(fd, MYF(MY_WME));
end_io_cache(file); end_io_cache(file);
delete description_event; delete glob_description_event;
return error; return error;
} }

View File

@ -115,7 +115,7 @@ static char compatible_mode_normal_str[255];
static ulong opt_compatible_mode= 0; static ulong opt_compatible_mode= 0;
#define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1 #define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1
#define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2 #define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2
static uint opt_mysql_port= 0, err_len= 0, opt_master_data; static uint opt_mysql_port= 0, opt_master_data;
static my_string opt_mysql_unix_port=0; static my_string opt_mysql_unix_port=0;
static int first_error=0; static int first_error=0;
static DYNAMIC_STRING extended_row; static DYNAMIC_STRING extended_row;
@ -746,6 +746,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *end= compatible_mode_normal_str; char *end= compatible_mode_normal_str;
int i; int i;
ulong mode; ulong mode;
uint err_len;
opt_quoted= 1; opt_quoted= 1;
opt_set_charset= 0; opt_set_charset= 0;
@ -883,11 +884,11 @@ static int get_options(int *argc, char ***argv)
/* /*
** DB_error -- prints mysql error message and exits the program. ** DB_error -- prints mysql error message and exits the program.
*/ */
static void DB_error(MYSQL *mysql, const char *when) static void DB_error(MYSQL *mysql_arg, const char *when)
{ {
DBUG_ENTER("DB_error"); DBUG_ENTER("DB_error");
fprintf(stderr, "%s: Got error: %d: %s %s\n", my_progname, fprintf(stderr, "%s: Got error: %d: %s %s\n", my_progname,
mysql_errno(mysql), mysql_error(mysql), when); mysql_errno(mysql_arg), mysql_error(mysql_arg), when);
fflush(stderr); fflush(stderr);
safe_exit(EX_MYSQLERR); safe_exit(EX_MYSQLERR);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
@ -1215,7 +1216,7 @@ static void print_quoted_xml(FILE *xml_file, const char *str, ulong len)
..., attribute_name_n, attribute_value_n, NullS) ..., attribute_name_n, attribute_value_n, NullS)
xml_file - output file xml_file - output file
sbeg - line beginning sbeg - line beginning
send - line ending line_end - line ending
tag_name - XML tag name. tag_name - XML tag name.
first_attribute_name - tag and first attribute first_attribute_name - tag and first attribute
first_attribute_value - (Implied) value of first attribute first_attribute_value - (Implied) value of first attribute
@ -1235,7 +1236,8 @@ static void print_quoted_xml(FILE *xml_file, const char *str, ulong len)
All attribute_value arguments will be quoted before output. All attribute_value arguments will be quoted before output.
*/ */
static void print_xml_tag(FILE * xml_file, const char* sbeg, const char* send, static void print_xml_tag(FILE * xml_file, const char* sbeg,
const char* line_end,
const char* tag_name, const char* tag_name,
const char* first_attribute_name, ...) const char* first_attribute_name, ...)
{ {
@ -1265,7 +1267,7 @@ static void print_xml_tag(FILE * xml_file, const char* sbeg, const char* send,
va_end(arg_list); va_end(arg_list);
fputc('>', xml_file); fputc('>', xml_file);
fputs(send, xml_file); fputs(line_end, xml_file);
check_io(xml_file); check_io(xml_file);
} }
@ -1279,7 +1281,7 @@ static void print_xml_tag(FILE * xml_file, const char* sbeg, const char* send,
sbeg - line beginning sbeg - line beginning
stag_atr - tag and attribute stag_atr - tag and attribute
sval - value of attribute sval - value of attribute
send - line ending line_end - line ending
DESCRIPTION DESCRIPTION
Print tag with one attribute to the xml_file. Format is: Print tag with one attribute to the xml_file. Format is:
@ -1291,7 +1293,7 @@ static void print_xml_tag(FILE * xml_file, const char* sbeg, const char* send,
static void print_xml_null_tag(FILE * xml_file, const char* sbeg, static void print_xml_null_tag(FILE * xml_file, const char* sbeg,
const char* stag_atr, const char* sval, const char* stag_atr, const char* sval,
const char* send) const char* line_end)
{ {
fputs(sbeg, xml_file); fputs(sbeg, xml_file);
fputs("<", xml_file); fputs("<", xml_file);
@ -1299,7 +1301,7 @@ static void print_xml_null_tag(FILE * xml_file, const char* sbeg,
fputs("\"", xml_file); fputs("\"", xml_file);
print_quoted_xml(xml_file, sval, strlen(sval)); print_quoted_xml(xml_file, sval, strlen(sval));
fputs("\" xsi:nil=\"true\" />", xml_file); fputs("\" xsi:nil=\"true\" />", xml_file);
fputs(send, xml_file); fputs(line_end, xml_file);
check_io(xml_file); check_io(xml_file);
} }
@ -2876,7 +2878,7 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables)
dynstr_trunc(&where, 1); dynstr_trunc(&where, 1);
dynstr_append(&where,"))"); dynstr_append(&where,"))");
DBUG_PRINT("info",("Dump TS for Tables where: %s",where)); DBUG_PRINT("info",("Dump TS for Tables where: %s",where.str));
r= dump_tablespaces(where.str); r= dump_tablespaces(where.str);
dynstr_free(&where); dynstr_free(&where);
return r; return r;
@ -2906,7 +2908,7 @@ static int dump_tablespaces_for_databases(char** databases)
dynstr_trunc(&where, 1); dynstr_trunc(&where, 1);
dynstr_append(&where,"))"); dynstr_append(&where,"))");
DBUG_PRINT("info",("Dump TS for DBs where: %s",where)); DBUG_PRINT("info",("Dump TS for DBs where: %s",where.str));
r= dump_tablespaces(where.str); r= dump_tablespaces(where.str);
dynstr_free(&where); dynstr_free(&where);
return r; return r;
@ -2918,7 +2920,7 @@ static int dump_tablespaces(char* ts_where)
MYSQL_RES *tableres; MYSQL_RES *tableres;
char buf[FN_REFLEN]; char buf[FN_REFLEN];
DYNAMIC_STRING sqlbuf; DYNAMIC_STRING sqlbuf;
int first; int first= 0;
/* /*
The following are used for parsing the EXTRA field The following are used for parsing the EXTRA field
*/ */

View File

@ -34,7 +34,7 @@
/* Global Thread counter */ /* Global Thread counter */
int counter; uint counter;
#ifdef HAVE_LIBPTHREAD #ifdef HAVE_LIBPTHREAD
pthread_mutex_t counter_mutex; pthread_mutex_t counter_mutex;
pthread_cond_t count_threshhold; pthread_cond_t count_threshhold;

View File

@ -401,7 +401,7 @@ static struct my_option my_long_options[] =
"Load types are mixed, write, or read. Default is mixed\n", "Load types are mixed, write, or read. Default is mixed\n",
(gptr*) &auto_generate_sql_type, (gptr*) &auto_generate_sql_type, (gptr*) &auto_generate_sql_type, (gptr*) &auto_generate_sql_type,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-write_number", OPT_SLAP_AUTO_GENERATE_WRITE_NUM, {"auto-generate-sql-write-number", OPT_SLAP_AUTO_GENERATE_WRITE_NUM,
"Number of rows to insert to used in read and write loads (default is 100).\n", "Number of rows to insert to used in read and write loads (default is 100).\n",
(gptr*) &auto_generate_sql_number, (gptr*) &auto_generate_sql_number, (gptr*) &auto_generate_sql_number, (gptr*) &auto_generate_sql_number,
0, GET_ULL, REQUIRED_ARG, 100, 0, 0, 0, 0, 0}, 0, GET_ULL, REQUIRED_ARG, 100, 0, 0, 0, 0, 0},
@ -439,13 +439,13 @@ static struct my_option my_long_options[] =
(gptr*) &lock_directory, (gptr*) &lock_directory, 0, GET_STR, (gptr*) &lock_directory, (gptr*) &lock_directory, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"number-char-cols", 'x', {"number-char-cols", 'x',
"Number of INT columns to create table with if specifying --auto-generate-sql.", "Number of VARCHAR columns to create table with if specifying --auto-generate-sql ",
(gptr*) &num_char_cols, (gptr*) &num_char_cols, 0, GET_UINT, REQUIRED_ARG, (gptr*) &num_char_cols, (gptr*) &num_char_cols, 0, GET_UINT, REQUIRED_ARG,
1, 0, 0, 0, 0, 0}, 1, 0, 0, 0, 0, 0},
{"number-int-cols", 'y', {"number-int-cols", 'y',
"Number of VARCHAR columns to create table with if specifying " "Number of INT columns to create table with if specifying --auto-generate-sql.",
"--auto-generate-sql.", (gptr*) &num_int_cols, (gptr*) &num_int_cols, 0, (gptr*) &num_int_cols, (gptr*) &num_int_cols, 0, GET_UINT, REQUIRED_ARG,
GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0}, 1, 0, 0, 0, 0, 0},
{"number-of-queries", OPT_MYSQL_NUMBER_OF_QUERY, {"number-of-queries", OPT_MYSQL_NUMBER_OF_QUERY,
"Limit each client to this number of queries (this is not exact).", "Limit each client to this number of queries (this is not exact).",
(gptr*) &num_of_query, (gptr*) &num_of_query, 0, (gptr*) &num_of_query, (gptr*) &num_of_query, 0,

View File

@ -84,11 +84,11 @@ enum {
}; };
static int record= 0, opt_sleep= -1; static int record= 0, opt_sleep= -1;
static char *db= 0, *pass= 0; static char *opt_db= 0, *opt_pass= 0;
const char *user= 0, *host= 0, *unix_sock= 0, *opt_basedir= "./"; const char *opt_user= 0, *opt_host= 0, *unix_sock= 0, *opt_basedir= "./";
const char *opt_logdir= ""; const char *opt_logdir= "";
const char *opt_include= 0, *opt_charsets_dir; const char *opt_include= 0, *opt_charsets_dir;
static int port= 0; static int opt_port= 0;
static int opt_max_connect_retries; static int opt_max_connect_retries;
static my_bool opt_compress= 0, silent= 0, verbose= 0; static my_bool opt_compress= 0, silent= 0, verbose= 0;
static my_bool tty_password= 0; static my_bool tty_password= 0;
@ -610,15 +610,14 @@ void check_command_args(struct st_command *command,
int i; int i;
const char *ptr= arguments; const char *ptr= arguments;
const char *start; const char *start;
DBUG_ENTER("check_command_args"); DBUG_ENTER("check_command_args");
DBUG_PRINT("enter", ("num_args: %d", num_args)); DBUG_PRINT("enter", ("num_args: %d", num_args));
for (i= 0; i < num_args; i++) for (i= 0; i < num_args; i++)
{ {
const struct command_arg *arg= &args[i]; const struct command_arg *arg= &args[i];
switch (arg->type) switch (arg->type) {
{
/* A string */ /* A string */
case ARG_STRING: case ARG_STRING:
/* Skip leading spaces */ /* Skip leading spaces */
@ -783,7 +782,7 @@ void free_used_memory()
dynstr_free(&ds_progress); dynstr_free(&ds_progress);
dynstr_free(&ds_warning_messages); dynstr_free(&ds_warning_messages);
free_all_replace(); free_all_replace();
my_free(pass,MYF(MY_ALLOW_ZERO_PTR)); my_free(opt_pass,MYF(MY_ALLOW_ZERO_PTR));
free_defaults(default_argv); free_defaults(default_argv);
free_re(); free_re();
#ifdef __WIN__ #ifdef __WIN__
@ -1313,7 +1312,7 @@ void var_set_errno(int sql_errno)
void var_query_set(VAR *var, const char *query, const char** query_end) void var_query_set(VAR *var, const char *query, const char** query_end)
{ {
char* end = (char*)((query_end && *query_end) ? char *end = (char*)((query_end && *query_end) ?
*query_end : query + strlen(query)); *query_end : query + strlen(query));
MYSQL_RES *res; MYSQL_RES *res;
MYSQL_ROW row; MYSQL_ROW row;
@ -1344,7 +1343,6 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
DYNAMIC_STRING result; DYNAMIC_STRING result;
uint i; uint i;
ulong *lengths; ulong *lengths;
char *end;
#ifdef NOT_YET #ifdef NOT_YET
MYSQL_FIELD *fields= mysql_fetch_fields(res); MYSQL_FIELD *fields= mysql_fetch_fields(res);
#endif #endif
@ -1847,7 +1845,7 @@ void do_copy_file(struct st_command *command)
void do_chmod_file(struct st_command *command) void do_chmod_file(struct st_command *command)
{ {
ulong mode= 0; long mode= 0;
static DYNAMIC_STRING ds_mode; static DYNAMIC_STRING ds_mode;
static DYNAMIC_STRING ds_file; static DYNAMIC_STRING ds_file;
const struct command_arg chmod_file_args[] = { const struct command_arg chmod_file_args[] = {
@ -2129,6 +2127,7 @@ void do_perl(struct st_command *command)
int do_echo(struct st_command *command) int do_echo(struct st_command *command)
{ {
DYNAMIC_STRING ds_echo; DYNAMIC_STRING ds_echo;
DBUG_ENTER("do_echo");
init_dynamic_string(&ds_echo, "", command->query_len, 256); init_dynamic_string(&ds_echo, "", command->query_len, 256);
do_eval(&ds_echo, command->first_argument, command->end, FALSE); do_eval(&ds_echo, command->first_argument, command->end, FALSE);
@ -2136,7 +2135,7 @@ int do_echo(struct st_command *command)
dynstr_append_mem(&ds_res, "\n", 1); dynstr_append_mem(&ds_res, "\n", 1);
dynstr_free(&ds_echo); dynstr_free(&ds_echo);
command->last_argument= command->end; command->last_argument= command->end;
return(0); DBUG_RETURN(0);
} }
@ -2432,7 +2431,6 @@ void do_let(struct st_command *command)
char *p= command->first_argument; char *p= command->first_argument;
char *var_name, *var_name_end; char *var_name, *var_name_end;
DYNAMIC_STRING let_rhs_expr; DYNAMIC_STRING let_rhs_expr;
DBUG_ENTER("do_let"); DBUG_ENTER("do_let");
init_dynamic_string(&let_rhs_expr, "", 512, 2048); init_dynamic_string(&let_rhs_expr, "", 512, 2048);
@ -3112,7 +3110,7 @@ int connect_n_handle_errors(struct st_command *command,
void do_connect(struct st_command *command) void do_connect(struct st_command *command)
{ {
int con_port= port; int con_port= opt_port;
char *con_options; char *con_options;
bool con_ssl= 0, con_compress= 0; bool con_ssl= 0, con_compress= 0;
char *ptr; char *ptr;
@ -3248,13 +3246,12 @@ void do_connect(struct st_command *command)
/* Use default db name */ /* Use default db name */
if (ds_database.length == 0) if (ds_database.length == 0)
dynstr_set(&ds_database, db); dynstr_set(&ds_database, opt_db);
/* Special database to allow one to connect without a database name */ /* Special database to allow one to connect without a database name */
if (ds_database.length && !strcmp(ds_database.str,"*NO-ONE*")) if (ds_database.length && !strcmp(ds_database.str,"*NO-ONE*"))
dynstr_set(&ds_database, ""); dynstr_set(&ds_database, "");
if (connect_n_handle_errors(command, &next_con->mysql, if (connect_n_handle_errors(command, &next_con->mysql,
ds_host.str,ds_user.str, ds_host.str,ds_user.str,
ds_password.str, ds_database.str, ds_password.str, ds_database.str,
@ -3678,7 +3675,7 @@ int read_line(char *buf, int size)
void convert_to_format_v1(char* query) void convert_to_format_v1(char* query)
{ {
int last_c_was_quote= 0; int last_c_was_quote= 0;
char *p= query, *write= query; char *p= query, *to= query;
char *end= strend(query); char *end= strend(query);
char last_c; char last_c;
@ -3686,7 +3683,7 @@ void convert_to_format_v1(char* query)
{ {
if (*p == '\n' && !last_c_was_quote) if (*p == '\n' && !last_c_was_quote)
{ {
*write++ = *p++; /* Save the newline */ *to++ = *p++; /* Save the newline */
/* Skip any spaces on next line */ /* Skip any spaces on next line */
while (*p && my_isspace(charset_info, *p)) while (*p && my_isspace(charset_info, *p))
@ -3697,19 +3694,19 @@ void convert_to_format_v1(char* query)
else if (*p == '\'' || *p == '"' || *p == '`') else if (*p == '\'' || *p == '"' || *p == '`')
{ {
last_c= *p; last_c= *p;
*write++ = *p++; *to++ = *p++;
/* Copy anything until the next quote of same type */ /* Copy anything until the next quote of same type */
while (*p && *p != last_c) while (*p && *p != last_c)
*write++ = *p++; *to++ = *p++;
*write++ = *p++; *to++ = *p++;
last_c_was_quote= 1; last_c_was_quote= 1;
} }
else else
{ {
*write++ = *p++; *to++ = *p++;
last_c_was_quote= 0; last_c_was_quote= 0;
} }
} }
@ -3834,12 +3831,10 @@ void check_eol_junk(const char *eol)
Converts lines returned by read_line into a command, this involves Converts lines returned by read_line into a command, this involves
parsing the first word in the read line to find the command type. parsing the first word in the read line to find the command type.
A -- comment may contain a valid query as the first word after the A -- comment may contain a valid query as the first word after the
comment start. Thus it's always checked to see if that is the case. comment start. Thus it's always checked to see if that is the case.
The advantage with this approach is to be able to execute commands The advantage with this approach is to be able to execute commands
terminated by new line '\n' regardless how many "delimiter" it contain. terminated by new line '\n' regardless how many "delimiter" it contain.
*/ */
#define MAX_QUERY (256*1024) /* 256K -- a test in sp-big is >128K */ #define MAX_QUERY (256*1024) /* 256K -- a test in sp-big is >128K */
@ -3925,7 +3920,7 @@ static struct my_option my_long_options[] =
{"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statements.", {"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statements.",
(gptr*) &cursor_protocol, (gptr*) &cursor_protocol, 0, (gptr*) &cursor_protocol, (gptr*) &cursor_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"database", 'D', "Database to use.", (gptr*) &db, (gptr*) &db, 0, {"database", 'D', "Database to use.", (gptr*) &opt_db, (gptr*) &opt_db, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF #ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit", {"debug", '#', "This is a non-debug version. Catch this and exit",
@ -3936,7 +3931,7 @@ static struct my_option my_long_options[] =
#endif #endif
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag, {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
(gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0, {"host", 'h', "Connect to host.", (gptr*) &opt_host, (gptr*) &opt_host, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"include", 'i', "Include SQL before each test case.", (gptr*) &opt_include, {"include", 'i', "Include SQL before each test case.", (gptr*) &opt_include,
(gptr*) &opt_include, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &opt_include, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -3952,8 +3947,8 @@ static struct my_option my_long_options[] =
GET_INT, REQUIRED_ARG, 500, 1, 10000, 0, 0, 0}, GET_INT, REQUIRED_ARG, 500, 1, 10000, 0, 0, 0},
{"password", 'p', "Password to use when connecting to server.", {"password", 'p', "Password to use when connecting to server.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection.", (gptr*) &port, {"port", 'P', "Port number to use for connection.", (gptr*) &opt_port,
(gptr*) &port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &opt_port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ps-protocol", OPT_PS_PROTOCOL, "Use prepared statements protocol for communication", {"ps-protocol", OPT_PS_PROTOCOL, "Use prepared statements protocol for communication",
(gptr*) &ps_protocol, (gptr*) &ps_protocol, 0, (gptr*) &ps_protocol, (gptr*) &ps_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -3989,8 +3984,8 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tmpdir", 't', "Temporary directory where sockets are put.", {"tmpdir", 't', "Temporary directory where sockets are put.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "User for login.", (gptr*) &user, (gptr*) &user, 0, GET_STR, {"user", 'u', "User for login.", (gptr*) &opt_user, (gptr*) &opt_user, 0,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Write more.", (gptr*) &verbose, (gptr*) &verbose, 0, {"verbose", 'v', "Write more.", (gptr*) &verbose, (gptr*) &verbose, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", {"version", 'V', "Output version information and exit.",
@ -4117,8 +4112,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'p': case 'p':
if (argument) if (argument)
{ {
my_free(pass, MYF(MY_ALLOW_ZERO_PTR)); my_free(opt_pass, MYF(MY_ALLOW_ZERO_PTR));
pass= my_strdup(argument, MYF(MY_FAE)); opt_pass= my_strdup(argument, MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */ while (*argument) *argument++= 'x'; /* Destroy argument */
tty_password= 0; tty_password= 0;
} }
@ -4155,7 +4150,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
exit(0); exit(0);
case '?': case '?':
usage(); usage();
exit(1); exit(0);
} }
return 0; return 0;
} }
@ -4175,9 +4170,9 @@ int parse_args(int argc, char **argv)
exit(1); exit(1);
} }
if (argc == 1) if (argc == 1)
db= *argv; opt_db= *argv;
if (tty_password) if (tty_password)
pass=get_tty_password(NullS); opt_pass= get_tty_password(NullS); /* purify tested */
return 0; return 0;
} }
@ -4462,13 +4457,13 @@ void append_result(DYNAMIC_STRING *ds, MYSQL_RES *res)
void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt, void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
MYSQL_FIELD *fields, uint num_fields) MYSQL_FIELD *fields, uint num_fields)
{ {
MYSQL_BIND *bind; MYSQL_BIND *my_bind;
my_bool *is_null; my_bool *is_null;
ulong *length; ulong *length;
uint i; uint i;
/* Allocate array with bind structs, lengths and NULL flags */ /* Allocate array with bind structs, lengths and NULL flags */
bind= (MYSQL_BIND*) my_malloc(num_fields * sizeof(MYSQL_BIND), my_bind= (MYSQL_BIND*) my_malloc(num_fields * sizeof(MYSQL_BIND),
MYF(MY_WME | MY_FAE | MY_ZEROFILL)); MYF(MY_WME | MY_FAE | MY_ZEROFILL));
length= (ulong*) my_malloc(num_fields * sizeof(ulong), length= (ulong*) my_malloc(num_fields * sizeof(ulong),
MYF(MY_WME | MY_FAE)); MYF(MY_WME | MY_FAE));
@ -4479,25 +4474,25 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
for (i= 0; i < num_fields; i++) for (i= 0; i < num_fields; i++)
{ {
uint max_length= fields[i].max_length + 1; uint max_length= fields[i].max_length + 1;
bind[i].buffer_type= MYSQL_TYPE_STRING; my_bind[i].buffer_type= MYSQL_TYPE_STRING;
bind[i].buffer= (char *)my_malloc(max_length, MYF(MY_WME | MY_FAE)); my_bind[i].buffer= (char *)my_malloc(max_length, MYF(MY_WME | MY_FAE));
bind[i].buffer_length= max_length; my_bind[i].buffer_length= max_length;
bind[i].is_null= &is_null[i]; my_bind[i].is_null= &is_null[i];
bind[i].length= &length[i]; my_bind[i].length= &length[i];
DBUG_PRINT("bind", ("col[%d]: buffer_type: %d, buffer_length: %lu", DBUG_PRINT("bind", ("col[%d]: buffer_type: %d, buffer_length: %lu",
i, bind[i].buffer_type, bind[i].buffer_length)); i, my_bind[i].buffer_type, my_bind[i].buffer_length));
} }
if (mysql_stmt_bind_result(stmt, bind)) if (mysql_stmt_bind_result(stmt, my_bind))
die("mysql_stmt_bind_result failed: %d: %s", die("mysql_stmt_bind_result failed: %d: %s",
mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
while (mysql_stmt_fetch(stmt) == 0) while (mysql_stmt_fetch(stmt) == 0)
{ {
for (i= 0; i < num_fields; i++) for (i= 0; i < num_fields; i++)
append_field(ds, i, &fields[i], (const char *) bind[i].buffer, append_field(ds, i, &fields[i], (const char *) my_bind[i].buffer,
*bind[i].length, *bind[i].is_null); *my_bind[i].length, *my_bind[i].is_null);
if (!display_result_vertically) if (!display_result_vertically)
dynstr_append_mem(ds, "\n", 1); dynstr_append_mem(ds, "\n", 1);
} }
@ -4509,10 +4504,10 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
for (i= 0; i < num_fields; i++) for (i= 0; i < num_fields; i++)
{ {
/* Free data for output */ /* Free data for output */
my_free((gptr)bind[i].buffer, MYF(MY_WME | MY_FAE)); my_free((gptr)my_bind[i].buffer, MYF(MY_WME | MY_FAE));
} }
/* Free array with bind structs, lengths and NULL flags */ /* Free array with bind structs, lengths and NULL flags */
my_free((gptr)bind , MYF(MY_WME | MY_FAE)); my_free((gptr)my_bind , MYF(MY_WME | MY_FAE));
my_free((gptr)length , MYF(MY_WME | MY_FAE)); my_free((gptr)length , MYF(MY_WME | MY_FAE));
my_free((gptr)is_null , MYF(MY_WME | MY_FAE)); my_free((gptr)is_null , MYF(MY_WME | MY_FAE));
} }
@ -4649,17 +4644,14 @@ int append_warnings(DYNAMIC_STRING *ds, MYSQL* mysql)
/* /*
Run query using MySQL C API Run query using MySQL C API
SYNPOSIS SYNOPSIS
run_query_normal run_query_normal()
mysql - mysql handle mysql mysql handle
command - currrent command pointer command current command pointer
flags -flags indicating wheter to SEND and/or REAP flags flags indicating if we should SEND and/or REAP
query - query string to execute query query string to execute
query_len - length query string to execute query_len length query string to execute
ds - output buffer wherte to store result form query ds output buffer where to store result form query
RETURN VALUE
error - function will not return
*/ */
void run_query_normal(struct st_connection *cn, struct st_command *command, void run_query_normal(struct st_connection *cn, struct st_command *command,
@ -5184,15 +5176,14 @@ int util_query(MYSQL* org_mysql, const char* query){
/* /*
Run query Run query
SYNPOSIS
run_query()
mysql mysql handle
command currrent command pointer
flags control the phased/stages of query execution to be performed flags control the phased/stages of query execution to be performed
if QUERY_SEND_FLAG bit is on, the query will be sent. If QUERY_REAP_FLAG if QUERY_SEND_FLAG bit is on, the query will be sent. If QUERY_REAP_FLAG
is on the result will be read - for regular query, both bits must be on is on the result will be read - for regular query, both bits must be on
SYNPOSIS
run_query
mysql - mysql handle
command - currrent command pointer
*/ */
void run_query(struct st_connection *cn, struct st_command *command, int flags) void run_query(struct st_connection *cn, struct st_command *command, int flags)
@ -5207,6 +5198,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
my_bool view_created= 0, sp_created= 0; my_bool view_created= 0, sp_created= 0;
my_bool complete_query= ((flags & QUERY_SEND_FLAG) && my_bool complete_query= ((flags & QUERY_SEND_FLAG) &&
(flags & QUERY_REAP_FLAG)); (flags & QUERY_REAP_FLAG));
DBUG_ENTER("run_query");
init_dynamic_string(&ds_warnings, NULL, 0, 256); init_dynamic_string(&ds_warnings, NULL, 0, 256);
@ -5372,7 +5364,6 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
if (command->require_file[0]) if (command->require_file[0])
{ {
/* A result file was specified for _this_ query /* A result file was specified for _this_ query
and the output should be checked against an already and the output should be checked against an already
existing file which has been specified using --require or --result existing file which has been specified using --require or --result
@ -5385,6 +5376,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
dynstr_free(&ds_result); dynstr_free(&ds_result);
if (command->type == Q_EVAL) if (command->type == Q_EVAL)
dynstr_free(&eval_query); dynstr_free(&eval_query);
DBUG_VOID_RETURN;
} }
/****************************************************************************/ /****************************************************************************/
@ -5712,8 +5704,8 @@ int main(int argc, char **argv)
if (!(cur_con->name = my_strdup("default", MYF(MY_WME)))) if (!(cur_con->name = my_strdup("default", MYF(MY_WME))))
die("Out of memory"); die("Out of memory");
safe_connect(&cur_con->mysql, cur_con->name, host, user, pass, safe_connect(&cur_con->mysql, cur_con->name, opt_host, opt_user, opt_pass,
db, port, unix_sock); opt_db, opt_port, unix_sock);
/* Use all time until exit if no explicit 'start_timer' */ /* Use all time until exit if no explicit 'start_timer' */
timer_start= timer_now(); timer_start= timer_now();
@ -6080,8 +6072,6 @@ int main(int argc, char **argv)
if (result_file_name && ds_warning_messages.length) if (result_file_name && ds_warning_messages.length)
dump_warning_messages(); dump_warning_messages();
dynstr_free(&ds_res);
timer_output(); timer_output();
free_used_memory(); free_used_memory();
my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR); my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);

View File

@ -247,6 +247,10 @@ bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *cs)
0 No conversion needed 0 No conversion needed
1 Either character set conversion or adding leading zeros 1 Either character set conversion or adding leading zeros
(e.g. for UCS-2) must be done (e.g. for UCS-2) must be done
NOTE
to_cs may be NULL for "no conversion" if the system variable
character_set_results is NULL.
*/ */
bool String::needs_conversion(uint32 arg_length, bool String::needs_conversion(uint32 arg_length,
@ -255,7 +259,8 @@ bool String::needs_conversion(uint32 arg_length,
uint32 *offset) uint32 *offset)
{ {
*offset= 0; *offset= 0;
if ((to_cs == &my_charset_bin) || if (!to_cs ||
(to_cs == &my_charset_bin) ||
(to_cs == from_cs) || (to_cs == from_cs) ||
my_charset_same(from_cs, to_cs) || my_charset_same(from_cs, to_cs) ||
((from_cs == &my_charset_bin) && ((from_cs == &my_charset_bin) &&
@ -612,27 +617,26 @@ skip:
} }
/* /*
** replace substring with string Replace substring with string
** If wrong parameter or not enough memory, do nothing If wrong parameter or not enough memory, do nothing
*/ */
bool String::replace(uint32 offset,uint32 arg_length,const String &to) bool String::replace(uint32 offset,uint32 arg_length,const String &to)
{ {
return replace(offset,arg_length,to.ptr(),to.length()); return replace(offset,arg_length,to.ptr(),to.length());
} }
bool String::replace(uint32 offset,uint32 arg_length, bool String::replace(uint32 offset,uint32 arg_length,
const char *to,uint32 length) const char *to, uint32 to_length)
{ {
long diff = (long) length-(long) arg_length; long diff = (long) to_length-(long) arg_length;
if (offset+arg_length <= str_length) if (offset+arg_length <= str_length)
{ {
if (diff < 0) if (diff < 0)
{ {
if (length) if (to_length)
memcpy(Ptr+offset,to,length); memcpy(Ptr+offset,to,to_length);
bmove(Ptr+offset+length,Ptr+offset+arg_length, bmove(Ptr+offset+to_length,Ptr+offset+arg_length,
str_length-offset-arg_length); str_length-offset-arg_length);
} }
else else
@ -644,8 +648,8 @@ bool String::replace(uint32 offset,uint32 arg_length,
bmove_upp(Ptr+str_length+diff,Ptr+str_length, bmove_upp(Ptr+str_length+diff,Ptr+str_length,
str_length-offset-arg_length); str_length-offset-arg_length);
} }
if (length) if (to_length)
memcpy(Ptr+offset,to,length); memcpy(Ptr+offset,to,to_length);
} }
str_length+=(uint32) diff; str_length+=(uint32) diff;
} }
@ -818,8 +822,18 @@ copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
from++; from++;
wc= '?'; wc= '?';
} }
else if (cnvres > MY_CS_TOOSMALL)
{
/*
A correct multibyte sequence detected
But it doesn't have Unicode mapping.
*/
error_count++;
from+= (-cnvres);
wc= '?';
}
else else
break; // Impossible char. break; // Not enough characters
outp: outp:
if ((cnvres= (*wc_mb)(to_cs, wc, (uchar*) to, to_end)) > 0) if ((cnvres= (*wc_mb)(to_cs, wc, (uchar*) to, to_end)) > 0)
@ -847,22 +861,22 @@ void String::print(String *str)
switch (c) switch (c)
{ {
case '\\': case '\\':
str->append("\\\\", 2); str->append(STRING_WITH_LEN("\\\\"));
break; break;
case '\0': case '\0':
str->append("\\0", 2); str->append(STRING_WITH_LEN("\\0"));
break; break;
case '\'': case '\'':
str->append("\\'", 2); str->append(STRING_WITH_LEN("\\'"));
break; break;
case '\n': case '\n':
str->append("\\n", 2); str->append(STRING_WITH_LEN("\\n"));
break; break;
case '\r': case '\r':
str->append("\\r", 2); str->append(STRING_WITH_LEN("\\r"));
break; break;
case 26: //Ctrl-Z case 26: //Ctrl-Z
str->append("\\z", 2); str->append(STRING_WITH_LEN("\\z"));
break; break;
default: default:
str->append(c); str->append(c);

View File

@ -23,6 +23,8 @@
#define NOT_FIXED_DEC 31 #define NOT_FIXED_DEC 31
#endif #endif
#define STRING_WITH_LEN(X) ((const char*) X), ((uint) (sizeof(X) - 1))
class String; class String;
int sortcmp(const String *a,const String *b, CHARSET_INFO *cs); int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
String *copy_if_not_alloced(String *a,String *b,uint32 arg_length); String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
@ -76,13 +78,15 @@ public:
{ /* never called */ } { /* never called */ }
~String() { free(); } ~String() { free(); }
inline void set_charset(CHARSET_INFO *charset) { str_charset= charset; } inline void set_charset(CHARSET_INFO *charset_arg)
{ str_charset= charset_arg; }
inline CHARSET_INFO *charset() const { return str_charset; } inline CHARSET_INFO *charset() const { return str_charset; }
inline uint32 length() const { return str_length;} inline uint32 length() const { return str_length;}
inline uint32 alloced_length() const { return Alloced_length;} inline uint32 alloced_length() const { return Alloced_length;}
inline char& operator [] (uint32 i) const { return Ptr[i]; } inline char& operator [] (uint32 i) const { return Ptr[i]; }
inline void length(uint32 len) { str_length=len ; } inline void length(uint32 len) { str_length=len ; }
inline bool is_empty() { return (str_length == 0); } inline bool is_empty() { return (str_length == 0); }
inline void mark_as_const() { Alloced_length= 0;}
inline const char *ptr() const { return Ptr; } inline const char *ptr() const { return Ptr; }
inline char *c_ptr() inline char *c_ptr()
{ {

View File

@ -112,7 +112,7 @@ int rl_attempted_completion_over = 0;
char *rl_basic_word_break_characters = break_chars; char *rl_basic_word_break_characters = break_chars;
char *rl_completer_word_break_characters = NULL; char *rl_completer_word_break_characters = NULL;
char *rl_completer_quote_characters = NULL; char *rl_completer_quote_characters = NULL;
Function *rl_completion_entry_function = NULL; CPFunction *rl_completion_entry_function = NULL;
CPPFunction *rl_attempted_completion_function = NULL; CPPFunction *rl_attempted_completion_function = NULL;
Function *rl_pre_input_hook = NULL; Function *rl_pre_input_hook = NULL;
Function *rl_startup1_hook = NULL; Function *rl_startup1_hook = NULL;
@ -1724,7 +1724,7 @@ rl_display_match_list (matches, len, max)
static int static int
_rl_complete_internal(int what_to_do) _rl_complete_internal(int what_to_do)
{ {
Function *complet_func; CPFunction *complet_func;
const LineInfo *li; const LineInfo *li;
char *temp, **matches; char *temp, **matches;
const char *ctemp; const char *ctemp;
@ -1737,7 +1737,7 @@ _rl_complete_internal(int what_to_do)
complet_func = rl_completion_entry_function; complet_func = rl_completion_entry_function;
if (!complet_func) if (!complet_func)
complet_func = (Function *)(void *)filename_completion_function; complet_func = filename_completion_function;
/* We now look backwards for the start of a filename/variable word */ /* We now look backwards for the start of a filename/variable word */
li = el_line(e); li = el_line(e);
@ -1764,7 +1764,7 @@ _rl_complete_internal(int what_to_do)
} else } else
matches = 0; matches = 0;
if (!rl_attempted_completion_function || !matches) if (!rl_attempted_completion_function || !matches)
matches = completion_matches(temp, (CPFunction *)complet_func); matches = completion_matches(temp, complet_func);
if (matches) { if (matches) {
int i, retval = CC_REFRESH; int i, retval = CC_REFRESH;
@ -1789,8 +1789,7 @@ _rl_complete_internal(int what_to_do)
* object is a directory. * object is a directory.
*/ */
size_t alen = strlen(matches[0]); size_t alen = strlen(matches[0]);
if ((complet_func != if ((complet_func != filename_completion_function
(Function *)filename_completion_function
|| (alen > 0 && (matches[0])[alen - 1] != '/')) || (alen > 0 && (matches[0])[alen - 1] != '/'))
&& rl_completion_append_character) { && rl_completion_append_character) {
char buf[2]; char buf[2];

View File

@ -102,7 +102,7 @@ extern int max_input_history;
extern char *rl_basic_word_break_characters; extern char *rl_basic_word_break_characters;
extern char *rl_completer_word_break_characters; extern char *rl_completer_word_break_characters;
extern char *rl_completer_quote_characters; extern char *rl_completer_quote_characters;
extern Function *rl_completion_entry_function; extern CPFunction *rl_completion_entry_function;
extern CPPFunction *rl_attempted_completion_function; extern CPPFunction *rl_attempted_completion_function;
extern int rl_completion_type; extern int rl_completion_type;
extern int rl_completion_query_items; extern int rl_completion_query_items;

View File

@ -426,7 +426,7 @@ rl_redisplay ()
#if defined (HANDLE_MULTIBYTE) #if defined (HANDLE_MULTIBYTE)
wchar_t wc; wchar_t wc;
size_t wc_bytes; size_t wc_bytes;
int wc_width; int wc_width= 0;
mbstate_t ps; mbstate_t ps;
int _rl_wrapped_multicolumn = 0; int _rl_wrapped_multicolumn = 0;
#endif #endif

View File

@ -560,12 +560,12 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
#if defined (HANDLE_MULTIBYTE) #if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{ {
int c, l; int chr, l;
l = _rl_find_prev_mbchar (string, i, MB_FIND_ANY); l = _rl_find_prev_mbchar (string, i, MB_FIND_ANY);
c = string[l]; chr = string[l];
/* XXX - original patch had i - 1 ??? If i == 0 it would fail. */ /* XXX - original patch had i - 1 ??? If i == 0 it would fail. */
if (i && (c == '\'' || c == '"')) if (i && (chr == '\'' || chr == '"'))
quoted_search_delimiter = c; quoted_search_delimiter = chr;
} }
else else
#endif /* HANDLE_MULTIBYTE */ #endif /* HANDLE_MULTIBYTE */

View File

@ -529,17 +529,17 @@ _rl_read_mbchar (mbchar, size)
may be FIRST. Used by the search functions, among others. Very similar may be FIRST. Used by the search functions, among others. Very similar
to _rl_read_mbchar. */ to _rl_read_mbchar. */
int int
_rl_read_mbstring (first, mb, mblen) _rl_read_mbstring (first, mb, mb_len)
int first; int first;
char *mb; char *mb;
int mblen; int mb_len;
{ {
int i, c; int i, c;
mbstate_t ps; mbstate_t ps;
c = first; c = first;
memset (mb, 0, mblen); memset (mb, 0, mb_len);
for (i = 0; i < mblen; i++) for (i = 0; i < mb_len; i++)
{ {
mb[i] = (char)c; mb[i] = (char)c;
memset (&ps, 0, sizeof (mbstate_t)); memset (&ps, 0, sizeof (mbstate_t));

View File

@ -1002,12 +1002,12 @@ _rl_rubout_char (count, key)
} }
else else
{ {
int orig_point; int orig_point2;
orig_point = rl_point; orig_point2 = rl_point;
rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO); rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
c = rl_line_buffer[rl_point]; c = rl_line_buffer[rl_point];
rl_delete_text (rl_point, orig_point); rl_delete_text (rl_point, orig_point2);
} }
#endif /* HANDLE_MULTIBYTE */ #endif /* HANDLE_MULTIBYTE */

View File

@ -672,7 +672,7 @@ _rl_vi_change_mbchar_case (count)
{ {
wchar_t wc; wchar_t wc;
char mb[MB_LEN_MAX+1]; char mb[MB_LEN_MAX+1];
int mblen; int local_mblen;
mbstate_t ps; mbstate_t ps;
memset (&ps, 0, sizeof (mbstate_t)); memset (&ps, 0, sizeof (mbstate_t));
@ -695,9 +695,9 @@ _rl_vi_change_mbchar_case (count)
/* Vi is kind of strange here. */ /* Vi is kind of strange here. */
if (wc) if (wc)
{ {
mblen = wcrtomb (mb, wc, &ps); local_mblen = wcrtomb (mb, wc, &ps);
if (mblen >= 0) if (local_mblen >= 0)
mb[mblen] = '\0'; mb[local_mblen] = '\0';
rl_begin_undo_group (); rl_begin_undo_group ();
rl_delete (1, 0); rl_delete (1, 0);
rl_insert_text (mb); rl_insert_text (mb);

View File

@ -973,7 +973,7 @@ case $SYSTEM_TYPE in
*darwin6*) *darwin6*)
if test "$ac_cv_prog_gcc" = "yes" if test "$ac_cv_prog_gcc" = "yes"
then then
FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH" FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH -DDONT_DECLARE_CXA_PURE_VIRTUAL "
CFLAGS="$CFLAGS $FLAGS" CFLAGS="$CFLAGS $FLAGS"
CXXFLAGS="$CXXFLAGS $FLAGS" CXXFLAGS="$CXXFLAGS $FLAGS"
MAX_C_OPTIMIZE="-O" MAX_C_OPTIMIZE="-O"
@ -2357,6 +2357,7 @@ readline_basedir=""
readline_dir="" readline_dir=""
readline_h_ln_cmd="" readline_h_ln_cmd=""
readline_link="" readline_link=""
want_to_use_readline="no"
if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null
then then
@ -2382,6 +2383,7 @@ then
readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a" readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a"
readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/readline readline" readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/readline readline"
compile_readline=yes compile_readline=yes
want_to_use_readline="yes"
AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1) AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1)
else else
# Use system readline library # Use system readline library
@ -2391,10 +2393,12 @@ else
MYSQL_CHECK_NEW_RL_INTERFACE MYSQL_CHECK_NEW_RL_INTERFACE
MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY
AC_LANG_RESTORE AC_LANG_RESTORE
if [test "$mysql_cv_new_rl_interface" = "yes"] if [test "$mysql_cv_new_rl_interface" = "yes"] && [test -d "./cmd-line-utils/readline"]
then then
# Use the new readline interface # Use the new readline interface, but only if the package includes a bundled libreadline
# this way we avoid linking commercial source with GPL readline
readline_link="-lreadline" readline_link="-lreadline"
want_to_use_readline="yes"
elif [test "$mysql_cv_libedit_interface" = "yes"] elif [test "$mysql_cv_libedit_interface" = "yes"]
then then
# Use libedit # Use libedit
@ -2405,6 +2409,15 @@ else
versions of libedit or readline]) versions of libedit or readline])
fi fi
fi fi
# if there is no readline, but we want to build with readline, we fail
if [test "$want_to_use_readline" = "yes"] && [test ! -d "./cmd-line-utils/readline"]
then
AC_MSG_ERROR([This commercially licensed MySQL source package can't
be built with libreadline. Please use --with-libedit to use
the bundled version of libedit instead.])
fi
# #
# if either readline or libedit is enabled - generate Makefile's for both # if either readline or libedit is enabled - generate Makefile's for both
# (to make sure both are included in 'make dist') # (to make sure both are included in 'make dist')
@ -2534,7 +2547,8 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
sql/sql_builtin.cc sql-common/Makefile dnl sql/sql_builtin.cc sql-common/Makefile dnl
dbug/Makefile scripts/Makefile include/Makefile dnl dbug/Makefile scripts/Makefile include/Makefile dnl
tests/Makefile Docs/Makefile support-files/Makefile dnl tests/Makefile Docs/Makefile support-files/Makefile dnl
support-files/MacOSX/Makefile mysql-test/Makefile dnl support-files/MacOSX/Makefile support-files/RHEL4-SElinux/Makefile dnl
mysql-test/Makefile dnl
mysql-test/ndb/Makefile netware/Makefile sql-bench/Makefile dnl mysql-test/ndb/Makefile netware/Makefile sql-bench/Makefile dnl
include/mysql_version.h plugin/Makefile win/Makefile) include/mysql_version.h plugin/Makefile win/Makefile)

299
configure.in.rej Normal file
View File

@ -0,0 +1,299 @@
***************
*** 388,402 ****
if expr "$target_os" : "[[Ll]]inux.*" > /dev/null
then
MYSQLD_DEFAULT_SWITCHES="--skip-locking"
! IS_LINUX="true"
AC_MSG_RESULT("yes");
else
MYSQLD_DEFAULT_SWITCHES=""
! IS_LINUX="false"
AC_MSG_RESULT("no");
fi
AC_SUBST(MYSQLD_DEFAULT_SWITCHES)
! AC_SUBST(IS_LINUX)
dnl Find paths to some shell programs
AC_PATH_PROG(LN, ln, ln)
--- 388,403 ----
if expr "$target_os" : "[[Ll]]inux.*" > /dev/null
then
MYSQLD_DEFAULT_SWITCHES="--skip-locking"
! TARGET_LINUX="true"
AC_MSG_RESULT("yes");
+ AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
else
MYSQLD_DEFAULT_SWITCHES=""
! TARGET_LINUX="false"
AC_MSG_RESULT("no");
fi
AC_SUBST(MYSQLD_DEFAULT_SWITCHES)
! AC_SUBST(TARGET_LINUX)
dnl Find paths to some shell programs
AC_PATH_PROG(LN, ln, ln)
***************
*** 576,582 ****
# (this is true on the MySQL build machines to avoid NSS problems)
#
! if test "$IS_LINUX" = "true" -a "$static_nss" = ""
then
tmp=`nm /usr/lib/libc.a | grep _nss_files_getaliasent_r`
if test -n "$tmp"
--- 577,583 ----
# (this is true on the MySQL build machines to avoid NSS problems)
#
! if test "$TARGET_LINUX" = "true" -a "$static_nss" = ""
then
tmp=`nm /usr/lib/libc.a | grep _nss_files_getaliasent_r`
if test -n "$tmp"
***************
*** 827,833 ****
])
AC_SUBST(WRAPLIBS)
! if test "$IS_LINUX" = "true"; then
AC_MSG_CHECKING([for atomic operations])
AC_LANG_SAVE
--- 828,834 ----
])
AC_SUBST(WRAPLIBS)
! if test "$TARGET_LINUX" = "true"; then
AC_MSG_CHECKING([for atomic operations])
AC_LANG_SAVE
***************
*** 870,876 ****
[ USE_PSTACK=no ])
pstack_libs=
pstack_dirs=
! if test "$USE_PSTACK" = yes -a "$IS_LINUX" = "true" -a "$BASE_MACHINE_TYPE" = "i386" -a "$with_mit_threads" = "no"
then
have_libiberty= have_libbfd=
my_save_LIBS="$LIBS"
--- 871,877 ----
[ USE_PSTACK=no ])
pstack_libs=
pstack_dirs=
! if test "$USE_PSTACK" = yes -a "$TARGET_LINUX" = "true" -a "$BASE_MACHINE_TYPE" = "i386" -a "$with_mit_threads" = "no"
then
have_libiberty= have_libbfd=
my_save_LIBS="$LIBS"
***************
*** 1239,1301 ****
# Hack for DEC-UNIX (OSF1)
if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
then
! # Look for LinuxThreads.
! AC_MSG_CHECKING("LinuxThreads")
! grepres=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l`
! getconfres=`which getconf >/dev/null && getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |grep LINUXTHREADS | wc -l || echo 0`
! if test "$grepres" -gt 0 -o "$getconfres" -gt 0
then
! AC_MSG_RESULT("Found")
! AC_DEFINE(HAVE_LINUXTHREADS)
! # Linux 2.0 sanity check
! AC_TRY_COMPILE([#include <sched.h>], [int a = sched_get_priority_min(1);], ,
! AC_MSG_ERROR([Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file. See the Installation chapter in the Reference Manual]))
! # RedHat 5.0 does not work with dynamic linking of this. -static also
! # gives a speed increase in linux so it does not hurt on other systems.
! with_named_thread="-lpthread"
! else
! AC_MSG_RESULT("Not found")
! # If this is a linux machine we should barf
! AC_MSG_CHECKING("NPTL")
! if test "$IS_LINUX" = "true"
! then
! getconfres=`which getconf >/dev/null && getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |grep NPTL | wc -l || echo 0`
! if test "$getconfres" -gt 0
then
! AC_DEFINE(HAVE_LINUXTHREADS) dnl All this code predates NPTL, so "have linuxthreads" is a poor name.
! with_named_thread="-lpthread"
else
! AC_MSG_ERROR([This is a Linux system and neither Linuxthreads nor NPTL were
! found. Please install Linuxthreads or a new glibc and try
! again. See the Installation chapter in the Reference Manual for
! more information.])
fi
! else
! AC_MSG_CHECKING("DEC threads")
! if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
! then
! with_named_thread="-lpthread -lmach -lexc"
! CFLAGS="$CFLAGS -D_REENTRANT"
! CXXFLAGS="$CXXFLAGS -D_REENTRANT"
! AC_DEFINE(HAVE_DEC_THREADS)
! AC_MSG_RESULT("yes")
! else
! AC_MSG_RESULT("no")
! AC_MSG_CHECKING("DEC 3.2 threads")
! if test -f /usr/shlib/libpthreads.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
! then
! with_named_thread="-lpthreads -lmach -lc_r"
! AC_DEFINE(HAVE_DEC_THREADS)
! AC_DEFINE(HAVE_DEC_3_2_THREADS)
! with_osf32_threads="yes"
! MYSQLD_DEFAULT_SWITCHES="--skip-thread-priority"
! AC_MSG_RESULT("yes")
! else
! AC_MSG_RESULT("no")
! fi
! fi
! fi
! fi
fi
--- 1240,1337 ----
# Hack for DEC-UNIX (OSF1)
if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
then
! AC_MSG_CHECKING("Linux threads")
! if test "$TARGET_LINUX" = "true"
then
! AC_MSG_RESULT("starting")
! # use getconf to check glibc contents
! AC_MSG_CHECKING("getconf GNU_LIBPTHREAD_VERSION")
! case `getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` in
! NPTL* )
! AC_MSG_RESULT("NPTL")
! AC_DEFINE([HAVE_NPTL], [1], [NPTL threads implementation])
! with_named_thread="-lpthread"
! ;;
! LINUXTHREADS* )
! AC_MSG_RESULT("Linuxthreads")
! AC_DEFINE([HAVE_LINUXTHREADS], [1],
! [Whether we are using Xavier Leroy's LinuxThreads])
! with_named_thread="-lpthread"
! ;;
! * )
! AC_MSG_RESULT("unknown")
! ;;
! esac
! if test "$with_named_thread" = "no"
then
! # old method, check headers
! # Look for LinuxThreads.
! AC_MSG_CHECKING("LinuxThreads in header file comment")
! res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l`
! if test "$res" -gt 0
! then
! AC_MSG_RESULT("Found")
! AC_DEFINE([HAVE_LINUXTHREADS], [1],
! [Whether we are using Xavier Leroy's LinuxThreads])
! # Linux 2.0 sanity check
! AC_TRY_COMPILE([#include <sched.h>], [int a = sched_get_priority_min(1);], ,
! AC_MSG_ERROR([Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file. See the Installation chapter in the Reference Manual]))
! # RedHat 5.0 does not work with dynamic linking of this. -static also
! # gives a speed increase in linux so it does not hurt on other systems.
! with_named_thread="-lpthread"
! else
! AC_MSG_RESULT("Not found")
! # If this is a linux machine we should barf
! AC_MSG_ERROR([This is a Linux system without a working getconf,
! and Linuxthreads was not found. Please install it (or a new glibc) and try again.
! See the Installation chapter in the Reference Manual for more information.])
! fi
else
! AC_MSG_RESULT("no need to check headers")
fi
! AC_MSG_CHECKING("for pthread_create in -lpthread");
! ac_save_LIBS="$LIBS"
! LIBS="$LIBS -lpthread"
! AC_TRY_LINK( [#include <pthread.h>],
! [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
! AC_MSG_RESULT("yes"),
! [ AC_MSG_RESULT("no")
! AC_MSG_ERROR([
! This is a Linux system claiming to support threads, either Linuxthreads or NPTL, but linking a test program failed.
! Please install one of these (or a new glibc) and try again.
! See the Installation chapter in the Reference Manual for more information.]) ]
! )
! LIBS="$ac_save_LIBS"
! else
! AC_MSG_RESULT("no")
! fi # "$TARGET_LINUX"
! fi # "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
!
! if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
! then
! AC_MSG_CHECKING("DEC threads")
! if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
! then
! with_named_thread="-lpthread -lmach -lexc"
! CFLAGS="$CFLAGS -D_REENTRANT"
! CXXFLAGS="$CXXFLAGS -D_REENTRANT"
! AC_DEFINE(HAVE_DEC_THREADS)
! AC_MSG_RESULT("yes")
! else
! AC_MSG_RESULT("no")
! AC_MSG_CHECKING("DEC 3.2 threads")
! if test -f /usr/shlib/libpthreads.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
! then
! with_named_thread="-lpthreads -lmach -lc_r"
! AC_DEFINE(HAVE_DEC_THREADS)
! AC_DEFINE(HAVE_DEC_3_2_THREADS)
! with_osf32_threads="yes"
! MYSQLD_DEFAULT_SWITCHES="--skip-thread-priority"
! AC_MSG_RESULT("yes")
! else
! AC_MSG_RESULT("no")
! fi
! fi
fi
***************
*** 1720,1726 ****
AC_SUBST(COMPILATION_COMMENT)
AC_MSG_CHECKING("need of special linking flags")
! if test "$IS_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes"
then
LDFLAGS="$LDFLAGS -rdynamic"
AC_MSG_RESULT("-rdynamic")
--- 1756,1762 ----
AC_SUBST(COMPILATION_COMMENT)
AC_MSG_CHECKING("need of special linking flags")
! if test "$TARGET_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes"
then
LDFLAGS="$LDFLAGS -rdynamic"
AC_MSG_RESULT("-rdynamic")
***************
*** 1873,1878 ****
tell atod memcpy memmove \
setupterm strcasecmp sighold vidattr lrand48 localtime_r \
sigset sigthreadmask pthread_sigmask pthread_setprio pthread_setprio_np \
pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \
pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \
pthread_attr_getstacksize pthread_key_delete \
--- 1909,1915 ----
tell atod memcpy memmove \
setupterm strcasecmp sighold vidattr lrand48 localtime_r \
sigset sigthreadmask pthread_sigmask pthread_setprio pthread_setprio_np \
+ sigaction sigemptyset sigaddset \
pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \
pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \
pthread_attr_getstacksize pthread_key_delete \
***************
*** 1884,1890 ****
# Sanity check: We chould not have any fseeko symbol unless
# large_file_support=yes
AC_CHECK_FUNCS(fseeko,
! [if test "$large_file_support" = no -a "$IS_LINUX" = "true";
then
AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!");
fi]
--- 1921,1927 ----
# Sanity check: We chould not have any fseeko symbol unless
# large_file_support=yes
AC_CHECK_FUNCS(fseeko,
! [if test "$large_file_support" = no -a "$TARGET_LINUX" = "true";
then
AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!");
fi]

View File

@ -2375,4 +2375,18 @@ va_list ap;
#endif /* NO_VARARGS */ #endif /* NO_VARARGS */
#else
/*
* Dummy function, workaround for MySQL bug#14420 related
* build failure on a platform where linking with an empty
* archive fails.
*
* This block can be removed as soon as a fix for bug#14420
* is implemented.
*/
int i_am_a_dummy_function() {
return 0;
}
#endif #endif

View File

@ -309,7 +309,7 @@ FILE *inf;
unsigned long fn_ssz; unsigned long fn_ssz;
unsigned long lastuse; unsigned long lastuse;
unsigned int pos; unsigned int pos;
unsigned long time; unsigned long local_time;
unsigned int oldpos; unsigned int oldpos;
unsigned long oldtime; unsigned long oldtime;
unsigned long oldchild; unsigned long oldchild;
@ -335,15 +335,15 @@ FILE *inf;
*/ */
while (pop (&oldpos, &oldtime, &oldchild)) { while (pop (&oldpos, &oldtime, &oldchild)) {
DBUG_PRINT ("popped", ("%lu %lu", oldtime, oldchild)); DBUG_PRINT ("popped", ("%lu %lu", oldtime, oldchild));
time = fn_time - oldtime; local_time = fn_time - oldtime;
t = top (); t = top ();
t -> children += time; t -> children += local_time;
DBUG_PRINT ("update", ("%s", modules[t -> pos].name)); DBUG_PRINT ("update", ("%s", modules[t -> pos].name));
DBUG_PRINT ("update", ("%lu", t -> children)); DBUG_PRINT ("update", ("%lu", t -> children));
time -= oldchild; local_time -= oldchild;
modules[oldpos].m_time += time; modules[oldpos].m_time += local_time;
modules[oldpos].m_calls++; modules[oldpos].m_calls++;
tot_time += time; tot_time += local_time;
tot_calls++; tot_calls++;
if (pos == oldpos) { if (pos == oldpos) {
goto next_line; /* Should be a break2 */ goto next_line; /* Should be a break2 */
@ -355,11 +355,11 @@ FILE *inf;
* it so that it works the next time too. * it so that it works the next time too.
*/ */
t = top (); t = top ();
time = fn_time - t -> time - t -> children; local_time = fn_time - t -> time - t -> children;
t -> time = fn_time; t -> children = 0; t -> time = fn_time; t -> children = 0;
modules[pos].m_time += time; modules[pos].m_time += local_time;
modules[pos].m_calls++; modules[pos].m_calls++;
tot_time += time; tot_time += local_time;
tot_calls++; tot_calls++;
break; break;
case 'S': case 'S':
@ -405,13 +405,13 @@ FILE *inf;
* time of fn_time. * time of fn_time.
*/ */
while (pop (&oldpos,&oldtime,&oldchild)) { while (pop (&oldpos,&oldtime,&oldchild)) {
time = fn_time - oldtime; local_time = fn_time - oldtime;
t = top (); t = top ();
t -> children += time; t -> children += local_time;
time -= oldchild; local_time -= oldchild;
modules[oldpos].m_time += time; modules[oldpos].m_time += local_time;
modules[oldpos].m_calls++; modules[oldpos].m_calls++;
tot_time += time; tot_time += local_time;
tot_calls++; tot_calls++;
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
@ -472,17 +472,17 @@ unsigned long int *called, *timed;
{ {
char *name = m -> name; char *name = m -> name;
register unsigned int calls = m -> m_calls; register unsigned int calls = m -> m_calls;
register unsigned long time = m -> m_time; register unsigned long local_time = m -> m_time;
register unsigned long stkuse = m -> m_stkuse; register unsigned long stkuse = m -> m_stkuse;
unsigned int import; unsigned int import;
double per_time = 0.0; double per_time = 0.0;
double per_calls = 0.0; double per_calls = 0.0;
double ms_per_call, ftime; double ms_per_call, local_ftime;
DBUG_ENTER ("out_item"); DBUG_ENTER ("out_item");
if (tot_time > 0) { if (tot_time > 0) {
per_time = (double) (time * 100) / (double) tot_time; per_time = (double) (local_time * 100) / (double) tot_time;
} }
if (tot_calls > 0) { if (tot_calls > 0) {
per_calls = (double) (calls * 100) / (double) tot_calls; per_calls = (double) (calls * 100) / (double) tot_calls;
@ -491,18 +491,18 @@ unsigned long int *called, *timed;
if (verbose) { if (verbose) {
fprintf (outf, "%6d\t%10.2f\t%11ld\t%10.2f %10d\t%-15s\n", fprintf (outf, "%6d\t%10.2f\t%11ld\t%10.2f %10d\t%-15s\n",
calls, per_calls, time, per_time, import, name); calls, per_calls, local_time, per_time, import, name);
} else { } else {
ms_per_call = time; ms_per_call = local_time;
ms_per_call /= calls; ms_per_call /= calls;
ftime = time; local_ftime = local_time;
ftime /= 1000; local_ftime /= 1000;
fprintf(outf, "%8.2f%8.3f%8u%8.3f%8.2f%8u%8lu %-s\n", fprintf(outf, "%8.2f%8.3f%8u%8.3f%8.2f%8u%8lu %-s\n",
per_time, ftime, calls, ms_per_call, per_calls, import, per_time, local_ftime, calls, ms_per_call, per_calls, import,
stkuse, name); stkuse, name);
} }
*called = calls; *called = calls;
*timed = time; *timed = local_time;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@ -517,7 +517,7 @@ FILE *outf;
register unsigned int root; register unsigned int root;
register unsigned long int *s_calls, *s_time; register unsigned long int *s_calls, *s_time;
{ {
unsigned long int calls, time; unsigned long int calls, local_time;
DBUG_ENTER ("out_body"); DBUG_ENTER ("out_body");
DBUG_PRINT ("out_body", ("%lu,%lu",*s_calls,*s_time)); DBUG_PRINT ("out_body", ("%lu,%lu",*s_calls,*s_time));
@ -526,10 +526,10 @@ register unsigned long int *s_calls, *s_time;
} else { } else {
while (root != MAXPROCS) { while (root != MAXPROCS) {
out_body (outf, s_table[root].lchild,s_calls,s_time); out_body (outf, s_table[root].lchild,s_calls,s_time);
out_item (outf, &modules[s_table[root].pos],&calls,&time); out_item (outf, &modules[s_table[root].pos],&calls,&local_time);
DBUG_PRINT ("out_body", ("-- %lu -- %lu --", calls, time)); DBUG_PRINT ("out_body", ("-- %lu -- %lu --", calls, local_time));
*s_calls += calls; *s_calls += calls;
*s_time += time; *s_time += local_time;
root = s_table[root].rchild; root = s_table[root].rchild;
} }
DBUG_PRINT ("out_body", ("%lu,%lu", *s_calls, *s_time)); DBUG_PRINT ("out_body", ("%lu,%lu", *s_calls, *s_time));

View File

@ -1,6 +1,13 @@
#ifdef DBUG_OFF /* We are testing dbug */ #ifdef DBUG_OFF /* We are testing dbug */
#undef DBUG_OFF
#endif int factorial(register int value) {
if(value > 1) {
value *= factorial(value-1);
}
return value;
}
#else
#include <my_global.h> #include <my_global.h>
@ -15,3 +22,6 @@ register int value)
DBUG_PRINT ("result", ("result is %d", value)); DBUG_PRINT ("result", ("result is %d", value));
DBUG_RETURN (value); DBUG_RETURN (value);
} }
#endif

View File

@ -48,15 +48,16 @@ static struct my_option my_long_options[] =
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
{"defaults-extra-file", 'e', {"defaults-extra-file", 'e',
"Read this file after the global /etc config file and before the config file in the users home directory.", "Read this file after the global /etc config file and before the config file in the users home directory.",
(gptr*) &defaults_extra_file, (gptr*) &defaults_extra_file, 0, GET_STR, (gptr*) &my_defaults_extra_file, (gptr*) &my_defaults_extra_file, 0,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"defaults-group-suffix", 'g', {"defaults-group-suffix", 'g',
"In addition to the given groups, read also groups with this suffix", "In addition to the given groups, read also groups with this suffix",
(gptr*) &defaults_group_suffix, (gptr*) &defaults_group_suffix, (gptr*) &my_defaults_group_suffix, (gptr*) &my_defaults_group_suffix,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"extra-file", 'e', {"extra-file", 'e',
"Synonym for --defaults-extra-file.", "Synonym for --defaults-extra-file.",
(gptr*) &defaults_extra_file, (gptr*) &defaults_extra_file, 0, GET_STR, (gptr*) &my_defaults_extra_file,
(gptr*) &my_defaults_extra_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"no-defaults", 'n', "Return an empty string (useful for scripts).", {"no-defaults", 'n', "Return an empty string (useful for scripts).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},

View File

@ -49,11 +49,13 @@ const uint AUTO = 0xFEEDBEEF;
// Checking Policy should implement a check function that tests whether the // Checking Policy should implement a check function that tests whether the
// index is within the size limit of the array // index is within the size limit of the array
struct Check { struct Check {
Check() {}
void check(uint i, uint limit); void check(uint i, uint limit);
}; };
struct NoCheck { struct NoCheck {
NoCheck() {}
void check(uint, uint); void check(uint, uint);
}; };
@ -191,6 +193,7 @@ inline void checked_delete(T* p)
// sets pointer to zero so safe for std conatiners // sets pointer to zero so safe for std conatiners
struct del_ptr_zero struct del_ptr_zero
{ {
del_ptr_zero() {}
template <typename T> template <typename T>
void operator()(T*& p) const void operator()(T*& p) const
{ {

View File

@ -42,6 +42,7 @@ namespace yaSSL {
// Digest policy should implement a get_digest, update, and get sizes for pad // Digest policy should implement a get_digest, update, and get sizes for pad
// and digest // and digest
struct Digest : public virtual_base { struct Digest : public virtual_base {
Digest() {}
virtual void get_digest(byte*) = 0; virtual void get_digest(byte*) = 0;
virtual void get_digest(byte*, const byte*, unsigned int) = 0; virtual void get_digest(byte*, const byte*, unsigned int) = 0;
virtual void update(const byte*, unsigned int) = 0; virtual void update(const byte*, unsigned int) = 0;
@ -53,6 +54,7 @@ struct Digest : public virtual_base {
// For use with NULL Digests // For use with NULL Digests
struct NO_MAC : public Digest { struct NO_MAC : public Digest {
NO_MAC() {}
void get_digest(byte*); void get_digest(byte*);
void get_digest(byte*, const byte*, unsigned int); void get_digest(byte*, const byte*, unsigned int);
void update(const byte*, unsigned int); void update(const byte*, unsigned int);
@ -177,6 +179,7 @@ private:
// BulkCipher policy should implement encrypt, decrypt, get block size, // BulkCipher policy should implement encrypt, decrypt, get block size,
// and set keys for encrypt and decrypt // and set keys for encrypt and decrypt
struct BulkCipher : public virtual_base { struct BulkCipher : public virtual_base {
BulkCipher() {}
virtual void encrypt(byte*, const byte*, unsigned int) = 0; virtual void encrypt(byte*, const byte*, unsigned int) = 0;
virtual void decrypt(byte*, const byte*, unsigned int) = 0; virtual void decrypt(byte*, const byte*, unsigned int) = 0;
virtual void set_encryptKey(const byte*, const byte* = 0) = 0; virtual void set_encryptKey(const byte*, const byte* = 0) = 0;
@ -190,6 +193,7 @@ struct BulkCipher : public virtual_base {
// For use with NULL Ciphers // For use with NULL Ciphers
struct NO_Cipher : public BulkCipher { struct NO_Cipher : public BulkCipher {
NO_Cipher() {}
void encrypt(byte*, const byte*, unsigned int) {} void encrypt(byte*, const byte*, unsigned int) {}
void decrypt(byte*, const byte*, unsigned int) {} void decrypt(byte*, const byte*, unsigned int) {}
void set_encryptKey(const byte*, const byte*) {} void set_encryptKey(const byte*, const byte*) {}
@ -311,12 +315,14 @@ struct Auth : public virtual_base {
virtual bool verify(const byte*, unsigned int, const byte*, virtual bool verify(const byte*, unsigned int, const byte*,
unsigned int) = 0; unsigned int) = 0;
virtual uint get_signatureLength() const = 0; virtual uint get_signatureLength() const = 0;
Auth() {}
virtual ~Auth() {} virtual ~Auth() {}
}; };
// For use with NULL Authentication schemes // For use with NULL Authentication schemes
struct NO_Auth : public Auth { struct NO_Auth : public Auth {
NO_Auth() {}
void sign(byte*, const byte*, unsigned int, const RandomPool&) {} void sign(byte*, const byte*, unsigned int, const RandomPool&) {}
bool verify(const byte*, unsigned int, const byte*, unsigned int) bool verify(const byte*, unsigned int, const byte*, unsigned int)
{ return true; } { return true; }

View File

@ -64,6 +64,7 @@ struct RecordLayerHeader {
// base for all messages // base for all messages
struct Message : public virtual_base { struct Message : public virtual_base {
Message() {}
virtual input_buffer& set(input_buffer&) =0; virtual input_buffer& set(input_buffer&) =0;
virtual output_buffer& get(output_buffer&) const =0; virtual output_buffer& get(output_buffer&) const =0;
@ -177,6 +178,7 @@ private:
class HandShakeBase : public virtual_base { class HandShakeBase : public virtual_base {
int length_; int length_;
public: public:
HandShakeBase() {}
int get_length() const; int get_length() const;
void set_length(int); void set_length(int);
@ -194,6 +196,7 @@ public:
struct HelloRequest : public HandShakeBase { struct HelloRequest : public HandShakeBase {
HelloRequest() {}
input_buffer& set(input_buffer& in); input_buffer& set(input_buffer& in);
output_buffer& get(output_buffer& out) const; output_buffer& get(output_buffer& out) const;
@ -327,6 +330,7 @@ private:
struct ServerKeyBase : public virtual_base { struct ServerKeyBase : public virtual_base {
ServerKeyBase() {}
virtual ~ServerKeyBase() {} virtual ~ServerKeyBase() {}
virtual void build(SSL&) {} virtual void build(SSL&) {}
virtual void read(SSL&, input_buffer&) {} virtual void read(SSL&, input_buffer&) {}
@ -337,15 +341,21 @@ struct ServerKeyBase : public virtual_base {
// Server random number for FORTEZZA KEA // Server random number for FORTEZZA KEA
struct Fortezza_Server : public ServerKeyBase { struct Fortezza_Server : public ServerKeyBase {
Fortezza_Server() {}
opaque r_s_[FORTEZZA_MAX]; opaque r_s_[FORTEZZA_MAX];
}; };
struct SignatureBase : public virtual_base { struct SignatureBase : public virtual_base {
SignatureBase() {}
virtual ~SignatureBase() {} virtual ~SignatureBase() {}
}; };
struct anonymous_sa : public SignatureBase {}; struct anonymous_sa : public SignatureBase
{
public:
anonymous_sa() {}
};
struct Hashes { struct Hashes {
@ -355,11 +365,13 @@ struct Hashes {
struct rsa_sa : public SignatureBase { struct rsa_sa : public SignatureBase {
rsa_sa() {}
Hashes hashes_; Hashes hashes_;
}; };
struct dsa_sa : public SignatureBase { struct dsa_sa : public SignatureBase {
dsa_sa() {}
uint8 sha_[SHA_LEN]; uint8 sha_[SHA_LEN];
}; };
@ -387,6 +399,7 @@ private:
// Server's RSA exchange // Server's RSA exchange
struct RSA_Server : public ServerKeyBase { struct RSA_Server : public ServerKeyBase {
RSA_Server() {}
ServerRSAParams params_; ServerRSAParams params_;
opaque* signature_; // signed rsa_sa hashes opaque* signature_; // signed rsa_sa hashes
}; };
@ -461,6 +474,7 @@ struct PreMasterSecret {
struct ClientKeyBase : public virtual_base { struct ClientKeyBase : public virtual_base {
ClientKeyBase() {}
virtual ~ClientKeyBase() {} virtual ~ClientKeyBase() {}
virtual void build(SSL&) {} virtual void build(SSL&) {}
virtual void read(SSL&, input_buffer&) {} virtual void read(SSL&, input_buffer&) {}
@ -491,6 +505,7 @@ private:
// Fortezza Key Parameters from page 29 // Fortezza Key Parameters from page 29
// hard code lengths cause only used here // hard code lengths cause only used here
struct FortezzaKeys : public ClientKeyBase { struct FortezzaKeys : public ClientKeyBase {
FortezzaKeys() {}
opaque y_c_ [128]; // client's Yc, public value opaque y_c_ [128]; // client's Yc, public value
opaque r_c_ [128]; // client's Rc opaque r_c_ [128]; // client's Rc
opaque y_signature_ [40]; // DSS signed public key opaque y_signature_ [40]; // DSS signed public key

View File

@ -228,6 +228,7 @@ struct BIGNUM {
TaoCrypt::Integer), we need to explicitly state the namespace TaoCrypt::Integer), we need to explicitly state the namespace
here to let gcc 2.96 deduce the correct type. here to let gcc 2.96 deduce the correct type.
*/ */
BIGNUM() {}
yaSSL::Integer int_; yaSSL::Integer int_;
void assign(const byte* b, uint s) { int_.assign(b,s); } void assign(const byte* b, uint s) { int_.assign(b,s); }
}; };

View File

@ -550,6 +550,7 @@ void RandomPool::Fill(opaque* dst, uint sz) const
// Implementation of DSS Authentication // Implementation of DSS Authentication
struct DSS::DSSImpl { struct DSS::DSSImpl {
DSSImpl() {}
void SetPublic (const byte*, unsigned int); void SetPublic (const byte*, unsigned int);
void SetPrivate(const byte*, unsigned int); void SetPrivate(const byte*, unsigned int);
TaoCrypt::DSA_PublicKey publicKey_; TaoCrypt::DSA_PublicKey publicKey_;
@ -622,6 +623,7 @@ bool DSS::verify(const byte* sha_digest, unsigned int /* shaSz */,
// Implementation of RSA key interface // Implementation of RSA key interface
struct RSA::RSAImpl { struct RSA::RSAImpl {
RSAImpl() {}
void SetPublic (const byte*, unsigned int); void SetPublic (const byte*, unsigned int);
void SetPrivate(const byte*, unsigned int); void SetPrivate(const byte*, unsigned int);
TaoCrypt::RSA_PublicKey publicKey_; TaoCrypt::RSA_PublicKey publicKey_;

View File

@ -65,7 +65,7 @@ int main(int argc, char** argv)
const int megs = 5; // how much to test const int megs = 5; // how much to test
const byte key[] = const byte global_key[] =
{ {
0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef, 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10, 0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10,
@ -81,19 +81,19 @@ const byte iv[] =
}; };
byte plain [1024*1024]; byte global_plain [1024*1024];
byte cipher[1024*1024]; byte global_cipher[1024*1024];
void bench_des() void bench_des()
{ {
DES_EDE3_CBC_Encryption enc; DES_EDE3_CBC_Encryption enc;
enc.SetKey(key, 16, iv); enc.SetKey(global_key, 16, iv);
double start = current_time(); double start = current_time();
for(int i = 0; i < megs; i++) for(int i = 0; i < megs; i++)
enc.Process(plain, cipher, sizeof(plain)); enc.Process(global_plain, global_cipher, sizeof(global_plain));
double total = current_time() - start; double total = current_time() - start;
@ -107,12 +107,12 @@ void bench_des()
void bench_aes(bool show) void bench_aes(bool show)
{ {
AES_CBC_Encryption enc; AES_CBC_Encryption enc;
enc.SetKey(key, 16, iv); enc.SetKey(global_key, 16, iv);
double start = current_time(); double start = current_time();
for(int i = 0; i < megs; i++) for(int i = 0; i < megs; i++)
enc.Process(plain, cipher, sizeof(plain)); enc.Process(global_plain, global_cipher, sizeof(global_plain));
double total = current_time() - start; double total = current_time() - start;
@ -127,12 +127,12 @@ void bench_aes(bool show)
void bench_twofish() void bench_twofish()
{ {
Twofish_CBC_Encryption enc; Twofish_CBC_Encryption enc;
enc.SetKey(key, 16, iv); enc.SetKey(global_key, 16, iv);
double start = current_time(); double start = current_time();
for(int i = 0; i < megs; i++) for(int i = 0; i < megs; i++)
enc.Process(plain, cipher, sizeof(plain)); enc.Process(global_plain, global_cipher, sizeof(global_plain));
double total = current_time() - start; double total = current_time() - start;
@ -147,12 +147,12 @@ void bench_twofish()
void bench_blowfish() void bench_blowfish()
{ {
Blowfish_CBC_Encryption enc; Blowfish_CBC_Encryption enc;
enc.SetKey(key, 16, iv); enc.SetKey(global_key, 16, iv);
double start = current_time(); double start = current_time();
for(int i = 0; i < megs; i++) for(int i = 0; i < megs; i++)
enc.Process(plain, cipher, sizeof(plain)); enc.Process(global_plain, global_cipher, sizeof(global_plain));
double total = current_time() - start; double total = current_time() - start;
@ -166,12 +166,12 @@ void bench_blowfish()
void bench_arc4() void bench_arc4()
{ {
ARC4 enc; ARC4 enc;
enc.SetKey(key, 16); enc.SetKey(global_key, 16);
double start = current_time(); double start = current_time();
for(int i = 0; i < megs; i++) for(int i = 0; i < megs; i++)
enc.Process(cipher, plain, sizeof(plain)); enc.Process(global_cipher, global_plain, sizeof(global_plain));
double total = current_time() - start; double total = current_time() - start;
@ -191,7 +191,7 @@ void bench_md5()
for(int i = 0; i < megs; i++) for(int i = 0; i < megs; i++)
hash.Update(plain, sizeof(plain)); hash.Update(global_plain, sizeof(global_plain));
hash.Final(digest); hash.Final(digest);
@ -213,7 +213,7 @@ void bench_sha()
for(int i = 0; i < megs; i++) for(int i = 0; i < megs; i++)
hash.Update(plain, sizeof(plain)); hash.Update(global_plain, sizeof(global_plain));
hash.Final(digest); hash.Final(digest);
@ -241,7 +241,7 @@ void bench_ripemd()
for(int i = 0; i < megs; i++) for(int i = 0; i < megs; i++)
hash.Update(plain, sizeof(plain)); hash.Update(global_plain, sizeof(global_plain));
hash.Final(digest); hash.Final(digest);

View File

@ -40,6 +40,7 @@ class TAOCRYPT_NO_VTABLE AbstractGroup : public virtual_base
public: public:
typedef Integer Element; typedef Integer Element;
AbstractGroup() {}
virtual ~AbstractGroup() {} virtual ~AbstractGroup() {}
virtual bool Equal(const Element &a, const Element &b) const =0; virtual bool Equal(const Element &a, const Element &b) const =0;
@ -94,6 +95,7 @@ private:
class MultiplicativeGroupT : public AbstractGroup class MultiplicativeGroupT : public AbstractGroup
{ {
public: public:
MultiplicativeGroupT() {}
const AbstractRing& GetRing() const const AbstractRing& GetRing() const
{return *m_pRing;} {return *m_pRing;}
@ -145,6 +147,7 @@ class TAOCRYPT_NO_VTABLE AbstractEuclideanDomain
: public AbstractRing : public AbstractRing
{ {
public: public:
AbstractEuclideanDomain() {}
typedef Integer Element; typedef Integer Element;
virtual void DivisionAlgorithm(Element &r, Element &q, const Element &a, virtual void DivisionAlgorithm(Element &r, Element &q, const Element &a,

View File

@ -41,6 +41,7 @@ enum { DES_BLOCK_SIZE = 8, DES_KEY_SIZE = 32 };
class BasicDES { class BasicDES {
public: public:
BasicDES() {}
void SetKey(const byte*, word32, CipherDir dir); void SetKey(const byte*, word32, CipherDir dir);
void RawProcessBlock(word32&, word32&) const; void RawProcessBlock(word32&, word32&) const;
protected: protected:

View File

@ -31,6 +31,7 @@ namespace TaoCrypt {
// HASH // HASH
class HASH : public virtual_base { class HASH : public virtual_base {
public: public:
HASH() {}
virtual ~HASH() {} virtual ~HASH() {}
virtual void Update(const byte*, word32) = 0; virtual void Update(const byte*, word32) = 0;

View File

@ -109,11 +109,11 @@ void HMAC<T>::KeyInnerHash()
// Update // Update
template <class T> template <class T>
void HMAC<T>::Update(const byte* msg, word32 length) void HMAC<T>::Update(const byte* msg_arg, word32 length)
{ {
if (!innerHashKeyed_) if (!innerHashKeyed_)
KeyInnerHash(); KeyInnerHash();
mac_.Update(msg, length); mac_.Update(msg_arg, length);
} }

View File

@ -37,8 +37,8 @@ public:
typedef int RandomizationParameter; typedef int RandomizationParameter;
typedef Integer Element; typedef Integer Element;
ModularArithmetic(const Integer &modulus = Integer::One()) ModularArithmetic(const Integer &modulus_arg = Integer::One())
: modulus(modulus), result((word)0, modulus.reg_.size()) {} : modulus(modulus_arg), result((word)0, modulus_arg.reg_.size()) {}
ModularArithmetic(const ModularArithmetic &ma) ModularArithmetic(const ModularArithmetic &ma)
: AbstractRing(), : AbstractRing(),

View File

@ -42,8 +42,8 @@ public:
{ cipher_.Process(c, p, sz); } { cipher_.Process(c, p, sz); }
void SetKey(const byte* k, word32 sz) void SetKey(const byte* k, word32 sz)
{ cipher_.SetKey(k, sz, DIR); } { cipher_.SetKey(k, sz, DIR); }
void SetKey(const byte* k, word32 sz, const byte* iv) void SetKey(const byte* k, word32 sz, const byte* iv_arg)
{ cipher_.SetKey(k, sz, DIR); cipher_.SetIV(iv); } { cipher_.SetKey(k, sz, DIR); cipher_.SetIV(iv_arg); }
private: private:
T cipher_; T cipher_;

View File

@ -131,6 +131,7 @@ private:
// block type 2 padding // block type 2 padding
class RSA_BlockType2 { class RSA_BlockType2 {
public: public:
RSA_BlockType2() {}
void Pad(const byte*, word32, byte*, word32, void Pad(const byte*, word32, byte*, word32,
RandomNumberGenerator&) const; RandomNumberGenerator&) const;
word32 UnPad(const byte*, word32, byte*) const; word32 UnPad(const byte*, word32, byte*) const;
@ -140,6 +141,7 @@ public:
// block type 1 padding // block type 1 padding
class RSA_BlockType1 { class RSA_BlockType1 {
public: public:
RSA_BlockType1() {}
void Pad(const byte*, word32, byte*, word32, void Pad(const byte*, word32, byte*, word32,
RandomNumberGenerator&) const; RandomNumberGenerator&) const;
word32 UnPad(const byte*, word32, byte*) const; word32 UnPad(const byte*, word32, byte*) const;
@ -174,25 +176,27 @@ public:
// Public Encrypt // Public Encrypt
template<class Pad> template<class Pad>
void RSA_Encryptor<Pad>::Encrypt(const byte* plain, word32 sz, byte* cipher, void RSA_Encryptor<Pad>::Encrypt(const byte* plain_arg, word32 sz,
RandomNumberGenerator& rng) byte* cipher_arg,
RandomNumberGenerator& rng_arg)
{ {
PK_Lengths lengths(key_.GetModulus()); PK_Lengths lengths(key_.GetModulus());
assert(sz <= lengths.FixedMaxPlaintextLength()); assert(sz <= lengths.FixedMaxPlaintextLength());
ByteBlock paddedBlock(lengths.PaddedBlockByteLength()); ByteBlock paddedBlock(lengths.PaddedBlockByteLength());
padding_.Pad(plain, sz, paddedBlock.get_buffer(), padding_.Pad(plain_arg, sz, paddedBlock.get_buffer(),
lengths.PaddedBlockBitLength(), rng); lengths.PaddedBlockBitLength(), rng_arg);
key_.ApplyFunction(Integer(paddedBlock.get_buffer(), paddedBlock.size())). key_.ApplyFunction(Integer(paddedBlock.get_buffer(), paddedBlock.size())).
Encode(cipher, lengths.FixedCiphertextLength()); Encode(cipher_arg, lengths.FixedCiphertextLength());
} }
// Private Decrypt // Private Decrypt
template<class Pad> template<class Pad>
word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher, word32 sz, byte* plain, word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher_arg, word32 sz,
RandomNumberGenerator& rng) byte* plain_arg,
RandomNumberGenerator& rng_arg)
{ {
PK_Lengths lengths(key_.GetModulus()); PK_Lengths lengths(key_.GetModulus());
assert(sz == lengths.FixedCiphertextLength()); assert(sz == lengths.FixedCiphertextLength());
@ -201,29 +205,29 @@ word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher, word32 sz, byte* plain,
return 0; return 0;
ByteBlock paddedBlock(lengths.PaddedBlockByteLength()); ByteBlock paddedBlock(lengths.PaddedBlockByteLength());
Integer x = key_.CalculateInverse(rng, Integer(cipher, Integer x = key_.CalculateInverse(rng_arg, Integer(cipher_arg,
lengths.FixedCiphertextLength()).Ref()); lengths.FixedCiphertextLength()).Ref());
if (x.ByteCount() > paddedBlock.size()) if (x.ByteCount() > paddedBlock.size())
x = Integer::Zero(); // don't return false, prevents timing attack x = Integer::Zero(); // don't return false, prevents timing attack
x.Encode(paddedBlock.get_buffer(), paddedBlock.size()); x.Encode(paddedBlock.get_buffer(), paddedBlock.size());
return padding_.UnPad(paddedBlock.get_buffer(), return padding_.UnPad(paddedBlock.get_buffer(),
lengths.PaddedBlockBitLength(), plain); lengths.PaddedBlockBitLength(), plain_arg);
} }
// Private SSL type (block 1) Encrypt // Private SSL type (block 1) Encrypt
template<class Pad> template<class Pad>
void RSA_Decryptor<Pad>::SSL_Sign(const byte* message, word32 sz, byte* sig, void RSA_Decryptor<Pad>::SSL_Sign(const byte* message, word32 sz, byte* sig,
RandomNumberGenerator& rng) RandomNumberGenerator& rng_arg)
{ {
RSA_PublicKey inverse; RSA_PublicKey inverse;
inverse.Initialize(key_.GetModulus(), key_.GetPrivateExponent()); inverse.Initialize(key_.GetModulus(), key_.GetPrivateExponent());
RSA_Encryptor<RSA_BlockType1> enc(inverse); // SSL Type RSA_Encryptor<RSA_BlockType1> enc(inverse); // SSL Type
enc.Encrypt(message, sz, sig, rng); enc.Encrypt(message, sz, sig, rng_arg);
} }
word32 SSL_Decrypt(const RSA_PublicKey& key, const byte* sig, byte* plain); word32 SSL_Decrypt(const RSA_PublicKey& key, const byte* sig, byte* plain_arg);
// Public SSL type (block 1) Decrypt // Public SSL type (block 1) Decrypt
@ -231,11 +235,11 @@ template<class Pad>
bool RSA_Encryptor<Pad>::SSL_Verify(const byte* message, word32 sz, bool RSA_Encryptor<Pad>::SSL_Verify(const byte* message, word32 sz,
const byte* sig) const byte* sig)
{ {
ByteBlock plain(PK_Lengths(key_.GetModulus()).FixedMaxPlaintextLength()); ByteBlock local_plain(PK_Lengths(key_.GetModulus()).FixedMaxPlaintextLength());
if (SSL_Decrypt(key_, sig, plain.get_buffer()) != sz) if (SSL_Decrypt(key_, sig, local_plain.get_buffer()) != sz)
return false; // not right justified or bad padding return false; // not right justified or bad padding
if ( (memcmp(plain.get_buffer(), message, sz)) == 0) if ( (memcmp(local_plain.get_buffer(), message, sz)) == 0)
return true; return true;
return false; return false;
} }

View File

@ -62,7 +62,11 @@ MK_FUNDAMENTAL_TYPE(unsigned long)
MK_FUNDAMENTAL_TYPE(float) MK_FUNDAMENTAL_TYPE(float)
MK_FUNDAMENTAL_TYPE( double) MK_FUNDAMENTAL_TYPE( double)
MK_FUNDAMENTAL_TYPE(long double)
#ifdef LONG_DOUBLE_IS_DISTINCT_TYPE
// Don't define by default as this gives warnings on power mac
MK_FUNDAMENTAL_TYPE(long double)
#endif
#if defined(WORD64_AVAILABLE) && defined(WORD64_IS_DISTINCT_TYPE) #if defined(WORD64_AVAILABLE) && defined(WORD64_IS_DISTINCT_TYPE)
MK_FUNDAMENTAL_TYPE(word64) MK_FUNDAMENTAL_TYPE(word64)

View File

@ -231,7 +231,7 @@ void list<T>::push_front(T t)
template<typename T> template<typename T>
void list<T>::pop_front() void list<T>::pop_front()
{ {
node* front = head_; node* local_front = head_;
if (head_ == 0) if (head_ == 0)
return; return;
@ -241,8 +241,8 @@ void list<T>::pop_front()
head_ = head_->next_; head_ = head_->next_;
head_->prev_ = 0; head_->prev_ = 0;
} }
destroy(front); destroy(local_front);
FreeMemory(front); FreeMemory(local_front);
--sz_; --sz_;
} }
@ -303,13 +303,13 @@ T list<T>::back() const
template<typename T> template<typename T>
typename list<T>::node* list<T>::look_up(T t) typename list<T>::node* list<T>::look_up(T t)
{ {
node* list = head_; node* local_list = head_;
if (list == 0) return 0; if (local_list == 0) return 0;
for (; list; list = list->next_) for (; local_list; local_list = local_list->next_)
if (list->value_ == t) if (local_list->value_ == t)
return list; return local_list;
return 0; return 0;
} }

View File

@ -90,13 +90,14 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
rounds_ = keylen/4 + 6; rounds_ = keylen/4 + 6;
word32 temp, *rk = key_; word32 temp, *rk = key_;
unsigned int i=0;
GetUserKey(BigEndianOrder, rk, keylen/4, userKey, keylen); GetUserKey(BigEndianOrder, rk, keylen/4, userKey, keylen);
switch(keylen) switch(keylen)
{ {
case 16: case 16:
{
unsigned int i=0;
while (true) while (true)
{ {
temp = rk[3]; temp = rk[3];
@ -114,8 +115,10 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
rk += 4; rk += 4;
} }
break; break;
}
case 24: case 24:
{
unsigned int i=0;
while (true) // for (;;) here triggers a bug in VC60 SP4 w/ Pro Pack while (true) // for (;;) here triggers a bug in VC60 SP4 w/ Pro Pack
{ {
temp = rk[ 5]; temp = rk[ 5];
@ -136,7 +139,10 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
} }
break; break;
}
case 32: case 32:
{
unsigned int i=0;
while (true) while (true)
{ {
temp = rk[ 7]; temp = rk[ 7];
@ -165,6 +171,7 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
} }
break; break;
} }
}
if (dir_ == DECRYPTION) if (dir_ == DECRYPTION)
{ {

View File

@ -186,10 +186,10 @@ Integer AbstractGroup::CascadeScalarMultiply(const Element &x,
struct WindowSlider struct WindowSlider
{ {
WindowSlider(const Integer &exp, bool fastNegate, WindowSlider(const Integer &exp_arg, bool fastNegate_arg,
unsigned int windowSizeIn=0) unsigned int windowSizeIn=0)
: exp(exp), windowModulus(Integer::One()), windowSize(windowSizeIn), : exp(exp_arg), windowModulus(Integer::One()), windowSize(windowSizeIn),
windowBegin(0), fastNegate(fastNegate), firstTime(true), windowBegin(0), fastNegate(fastNegate_arg), firstTime(true),
finished(false) finished(false)
{ {
if (windowSize == 0) if (windowSize == 0)

View File

@ -734,8 +734,8 @@ void CertDecoder::GetName(NameType nt)
else { else {
// skip // skip
source_.advance(oidSz + 1); source_.advance(oidSz + 1);
word32 length = GetLength(source_); word32 length2 = GetLength(source_);
source_.advance(length); source_.advance(length2);
} }
} }
ptr[idx++] = 0; ptr[idx++] = 0;

View File

@ -139,20 +139,20 @@ const byte msgTmp[] = { // "now is the time for all " w/o trailing 0
0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20 0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
}; };
byte* msg = 0; // for block cipher input byte* global_msg = 0; // for block cipher input
byte* plain = 0; // for cipher decrypt comparison byte* global_plain = 0; // for cipher decrypt comparison
byte* cipher = 0; // block output byte* global_cipher = 0; // block output
void taocrypt_test(void* args) void taocrypt_test(void* args)
{ {
((func_args*)args)->return_code = -1; // error state ((func_args*)args)->return_code = -1; // error state
msg = NEW_TC byte[24]; global_msg = NEW_TC byte[24];
plain = NEW_TC byte[24]; global_plain = NEW_TC byte[24];
cipher = NEW_TC byte[24]; global_cipher = NEW_TC byte[24];
memcpy(msg, msgTmp, 24); memcpy(global_msg, msgTmp, 24);
int ret = 0; int ret = 0;
if ( (ret = sha_test()) ) if ( (ret = sha_test()) )
@ -237,9 +237,9 @@ void taocrypt_test(void* args)
printf( "PKCS12 test passed!\n"); printf( "PKCS12 test passed!\n");
*/ */
tcArrayDelete(cipher); tcArrayDelete(global_cipher);
tcArrayDelete(plain); tcArrayDelete(global_plain);
tcArrayDelete(msg); tcArrayDelete(global_msg);
((func_args*)args)->return_code = ret; ((func_args*)args)->return_code = ret;
} }
@ -606,11 +606,11 @@ int des_test()
const byte iv[] = { 0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef }; const byte iv[] = { 0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef };
enc.SetKey(key, sizeof(key)); enc.SetKey(key, sizeof(key));
enc.Process(cipher, msg, sz); enc.Process(global_cipher, global_msg, sz);
dec.SetKey(key, sizeof(key)); dec.SetKey(key, sizeof(key));
dec.Process(plain, cipher, sz); dec.Process(global_plain, global_cipher, sz);
if (memcmp(plain, msg, sz)) if (memcmp(global_plain, global_msg, sz))
return -50; return -50;
const byte verify1[] = const byte verify1[] =
@ -620,7 +620,7 @@ int des_test()
0x89,0x3d,0x51,0xec,0x4b,0x56,0x3b,0x53 0x89,0x3d,0x51,0xec,0x4b,0x56,0x3b,0x53
}; };
if (memcmp(cipher, verify1, sz)) if (memcmp(global_cipher, verify1, sz))
return -51; return -51;
// CBC mode // CBC mode
@ -628,11 +628,11 @@ int des_test()
DES_CBC_Decryption dec2; DES_CBC_Decryption dec2;
enc2.SetKey(key, sizeof(key), iv); enc2.SetKey(key, sizeof(key), iv);
enc2.Process(cipher, msg, sz); enc2.Process(global_cipher, global_msg, sz);
dec2.SetKey(key, sizeof(key), iv); dec2.SetKey(key, sizeof(key), iv);
dec2.Process(plain, cipher, sz); dec2.Process(global_plain, global_cipher, sz);
if (memcmp(plain, msg, sz)) if (memcmp(global_plain, global_msg, sz))
return -52; return -52;
const byte verify2[] = const byte verify2[] =
@ -642,7 +642,7 @@ int des_test()
0x15,0x85,0xb3,0x22,0x4b,0x86,0x2b,0x4b 0x15,0x85,0xb3,0x22,0x4b,0x86,0x2b,0x4b
}; };
if (memcmp(cipher, verify2, sz)) if (memcmp(global_cipher, verify2, sz))
return -53; return -53;
// EDE3 CBC mode // EDE3 CBC mode
@ -664,11 +664,11 @@ int des_test()
}; };
enc3.SetKey(key3, sizeof(key3), iv3); enc3.SetKey(key3, sizeof(key3), iv3);
enc3.Process(cipher, msg, sz); enc3.Process(global_cipher, global_msg, sz);
dec3.SetKey(key3, sizeof(key3), iv3); dec3.SetKey(key3, sizeof(key3), iv3);
dec3.Process(plain, cipher, sz); dec3.Process(global_plain, global_cipher, sz);
if (memcmp(plain, msg, sz)) if (memcmp(global_plain, global_msg, sz))
return -54; return -54;
const byte verify3[] = const byte verify3[] =
@ -678,7 +678,7 @@ int des_test()
0x18,0xbc,0xbb,0x6d,0xd2,0xb1,0x16,0xda 0x18,0xbc,0xbb,0x6d,0xd2,0xb1,0x16,0xda
}; };
if (memcmp(cipher, verify3, sz)) if (memcmp(global_cipher, verify3, sz))
return -55; return -55;
return 0; return 0;
@ -697,10 +697,10 @@ int aes_test()
enc.SetKey(key, bs, iv); enc.SetKey(key, bs, iv);
dec.SetKey(key, bs, iv); dec.SetKey(key, bs, iv);
enc.Process(cipher, msg, bs); enc.Process(global_cipher, global_msg, bs);
dec.Process(plain, cipher, bs); dec.Process(global_plain, global_cipher, bs);
if (memcmp(plain, msg, bs)) if (memcmp(global_plain, global_msg, bs))
return -60; return -60;
const byte verify[] = const byte verify[] =
@ -709,7 +709,7 @@ int aes_test()
0x2c,0xcc,0x9d,0x46,0x77,0xa2,0x33,0xcb 0x2c,0xcc,0x9d,0x46,0x77,0xa2,0x33,0xcb
}; };
if (memcmp(cipher, verify, bs)) if (memcmp(global_cipher, verify, bs))
return -61; return -61;
AES_ECB_Encryption enc2; AES_ECB_Encryption enc2;
@ -718,10 +718,10 @@ int aes_test()
enc2.SetKey(key, bs, iv); enc2.SetKey(key, bs, iv);
dec2.SetKey(key, bs, iv); dec2.SetKey(key, bs, iv);
enc2.Process(cipher, msg, bs); enc2.Process(global_cipher, global_msg, bs);
dec2.Process(plain, cipher, bs); dec2.Process(global_plain, global_cipher, bs);
if (memcmp(plain, msg, bs)) if (memcmp(global_plain, global_msg, bs))
return -62; return -62;
const byte verify2[] = const byte verify2[] =
@ -730,7 +730,7 @@ int aes_test()
0xc8,0x8c,0x33,0x3b,0xb5,0x8f,0x85,0xd1 0xc8,0x8c,0x33,0x3b,0xb5,0x8f,0x85,0xd1
}; };
if (memcmp(cipher, verify2, bs)) if (memcmp(global_cipher, verify2, bs))
return -63; return -63;
return 0; return 0;
@ -749,10 +749,10 @@ int twofish_test()
enc.SetKey(key, bs, iv); enc.SetKey(key, bs, iv);
dec.SetKey(key, bs, iv); dec.SetKey(key, bs, iv);
enc.Process(cipher, msg, bs); enc.Process(global_cipher, global_msg, bs);
dec.Process(plain, cipher, bs); dec.Process(global_plain, global_cipher, bs);
if (memcmp(plain, msg, bs)) if (memcmp(global_plain, global_msg, bs))
return -60; return -60;
const byte verify[] = const byte verify[] =
@ -761,7 +761,7 @@ int twofish_test()
0x21,0x03,0x58,0x79,0x5F,0x02,0x27,0x2C 0x21,0x03,0x58,0x79,0x5F,0x02,0x27,0x2C
}; };
if (memcmp(cipher, verify, bs)) if (memcmp(global_cipher, verify, bs))
return -61; return -61;
Twofish_ECB_Encryption enc2; Twofish_ECB_Encryption enc2;
@ -770,10 +770,10 @@ int twofish_test()
enc2.SetKey(key, bs, iv); enc2.SetKey(key, bs, iv);
dec2.SetKey(key, bs, iv); dec2.SetKey(key, bs, iv);
enc2.Process(cipher, msg, bs); enc2.Process(global_cipher, global_msg, bs);
dec2.Process(plain, cipher, bs); dec2.Process(global_plain, global_cipher, bs);
if (memcmp(plain, msg, bs)) if (memcmp(global_plain, global_msg, bs))
return -62; return -62;
const byte verify2[] = const byte verify2[] =
@ -782,7 +782,7 @@ int twofish_test()
0xC4,0xCD,0x6B,0x91,0x14,0xC5,0x3A,0x09 0xC4,0xCD,0x6B,0x91,0x14,0xC5,0x3A,0x09
}; };
if (memcmp(cipher, verify2, bs)) if (memcmp(global_cipher, verify2, bs))
return -63; return -63;
return 0; return 0;
@ -801,10 +801,10 @@ int blowfish_test()
enc.SetKey(key, 16, iv); enc.SetKey(key, 16, iv);
dec.SetKey(key, 16, iv); dec.SetKey(key, 16, iv);
enc.Process(cipher, msg, bs * 2); enc.Process(global_cipher, global_msg, bs * 2);
dec.Process(plain, cipher, bs * 2); dec.Process(global_plain, global_cipher, bs * 2);
if (memcmp(plain, msg, bs)) if (memcmp(global_plain, global_msg, bs))
return -60; return -60;
const byte verify[] = const byte verify[] =
@ -813,7 +813,7 @@ int blowfish_test()
0xBC,0xD9,0x08,0xC4,0x94,0x6C,0x89,0xA3 0xBC,0xD9,0x08,0xC4,0x94,0x6C,0x89,0xA3
}; };
if (memcmp(cipher, verify, bs)) if (memcmp(global_cipher, verify, bs))
return -61; return -61;
Blowfish_ECB_Encryption enc2; Blowfish_ECB_Encryption enc2;
@ -822,10 +822,10 @@ int blowfish_test()
enc2.SetKey(key, 16, iv); enc2.SetKey(key, 16, iv);
dec2.SetKey(key, 16, iv); dec2.SetKey(key, 16, iv);
enc2.Process(cipher, msg, bs * 2); enc2.Process(global_cipher, global_msg, bs * 2);
dec2.Process(plain, cipher, bs * 2); dec2.Process(global_plain, global_cipher, bs * 2);
if (memcmp(plain, msg, bs)) if (memcmp(global_plain, global_msg, bs))
return -62; return -62;
const byte verify2[] = const byte verify2[] =
@ -834,7 +834,7 @@ int blowfish_test()
0x8F,0xCE,0x39,0x32,0xDE,0xD7,0xBC,0x5B 0x8F,0xCE,0x39,0x32,0xDE,0xD7,0xBC,0x5B
}; };
if (memcmp(cipher, verify2, bs)) if (memcmp(global_cipher, verify2, bs))
return -63; return -63;
return 0; return 0;

View File

@ -141,16 +141,17 @@ int test_openSSL_des()
/* test des encrypt/decrypt */ /* test des encrypt/decrypt */
char data[] = "this is my data "; char data[] = "this is my data ";
int dataSz = strlen(data); int dataSz = strlen(data);
DES_key_schedule key[3]; DES_key_schedule local_key[3];
byte iv[8]; byte iv[8];
EVP_BytesToKey(EVP_des_ede3_cbc(), EVP_md5(), NULL, (byte*)data, dataSz, 1, EVP_BytesToKey(EVP_des_ede3_cbc(), EVP_md5(), NULL, (byte*)data, dataSz, 1,
(byte*)key, iv); (byte*)local_key, iv);
byte cipher[16]; byte cipher[16];
DES_ede3_cbc_encrypt((byte*)data, cipher, dataSz, &key[0], &key[1], DES_ede3_cbc_encrypt((byte*)data, cipher, dataSz,
&key[2], &iv, true); &local_key[0], &local_key[1],
&local_key[2], &iv, true);
byte plain[16]; byte plain[16];
DES_ede3_cbc_encrypt(cipher, plain, 16, &key[0], &key[1], &key[2], DES_ede3_cbc_encrypt(cipher, plain, 16, &local_key[0], &local_key[1],
&iv, false); &local_key[2], &iv, false);
return 0; return 0;
} }

View File

@ -98,7 +98,7 @@ typedef struct
{ {
uint beg; uint beg;
uint end; uint end;
uint mblen; uint mb_len;
} my_match_t; } my_match_t;
enum my_lex_states enum my_lex_states

View File

@ -629,7 +629,7 @@ typedef unsigned short ushort;
duplicate declaration of __cxa_pure_virtual, solved by declaring it a duplicate declaration of __cxa_pure_virtual, solved by declaring it a
weak symbol. weak symbol.
*/ */
#ifdef USE_MYSYS_NEW #if defined(USE_MYSYS_NEW) && ! defined(DONT_DECLARE_CXA_PURE_VIRTUAL)
C_MODE_START C_MODE_START
int __cxa_pure_virtual () __attribute__ ((weak)); int __cxa_pure_virtual () __attribute__ ((weak));
C_MODE_END C_MODE_END

17
include/my_global.h.rej Normal file
View File

@ -0,0 +1,17 @@
***************
*** 97,103 ****
/* Fix problem with S_ISLNK() on Linux */
! #if defined(HAVE_LINUXTHREADS)
#undef _GNU_SOURCE
#define _GNU_SOURCE 1
#endif
--- 97,103 ----
/* Fix problem with S_ISLNK() on Linux */
! #if defined(TARGET_OS_LINUX) || defined(__GLIBC__)
#undef _GNU_SOURCE
#define _GNU_SOURCE 1
#endif

View File

@ -269,14 +269,14 @@ int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
we want to make sure that no such flags are set. we want to make sure that no such flags are set.
*/ */
#if defined(HAVE_SIGACTION) && !defined(my_sigset) #if defined(HAVE_SIGACTION) && !defined(my_sigset)
#define my_sigset(A,B) do { struct sigaction s; sigset_t set; int rc; \ #define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; int l_rc; \
DBUG_ASSERT((A) != 0); \ DBUG_ASSERT((A) != 0); \
sigemptyset(&set); \ sigemptyset(&l_set); \
s.sa_handler = (B); \ l_s.sa_handler = (B); \
s.sa_mask = set; \ l_s.sa_mask = l_set; \
s.sa_flags = 0; \ l_s.sa_flags = 0; \
rc= sigaction((A), &s, (struct sigaction *) NULL);\ l_rc= sigaction((A), &l_s, (struct sigaction *) NULL);\
DBUG_ASSERT(rc == 0); \ DBUG_ASSERT(l_rc == 0); \
} while (0) } while (0)
#elif defined(HAVE_SIGSET) && !defined(my_sigset) #elif defined(HAVE_SIGSET) && !defined(my_sigset)
#define my_sigset(A,B) sigset((A),(B)) #define my_sigset(A,B) sigset((A),(B))
@ -690,6 +690,15 @@ extern uint my_thread_end_wait_time;
Keep track of shutdown,signal, and main threads so that my_end() will not Keep track of shutdown,signal, and main threads so that my_end() will not
report errors with them report errors with them
*/ */
/* Which kind of thread library is in use */
#define THD_LIB_OTHER 1
#define THD_LIB_NPTL 2
#define THD_LIB_LT 4
extern uint thd_lib_detected;
/* statistics_xxx functions are for not essential statistic */ /* statistics_xxx functions are for not essential statistic */
#ifndef thread_safe_increment #ifndef thread_safe_increment

80
include/my_pthread.h.rej Normal file
View File

@ -0,0 +1,80 @@
***************
*** 286,293 ****
#undef HAVE_PTHREAD_RWLOCK_RDLOCK
#undef HAVE_SNPRINTF
! #define sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
! #define signal(A,B) pthread_signal((A),(void (*)(int)) (B))
#define my_pthread_attr_setprio(A,B)
#endif /* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */
--- 294,301 ----
#undef HAVE_PTHREAD_RWLOCK_RDLOCK
#undef HAVE_SNPRINTF
! #define my_sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
! #define my_signal(A,B) pthread_signal((A),(void (*)(int)) (B))
#define my_pthread_attr_setprio(A,B)
#endif /* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */
***************
*** 324,337 ****
#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX)
int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
#endif
! #if !defined(HAVE_SIGSET) && !defined(HAVE_mit_thread) && !defined(sigset)
! #define sigset(A,B) do { struct sigaction s; sigset_t set; \
! sigemptyset(&set); \
! s.sa_handler = (B); \
! s.sa_mask = set; \
! s.sa_flags = 0; \
! sigaction((A), &s, (struct sigaction *) NULL); \
} while (0)
#endif
#ifndef my_pthread_setprio
--- 332,358 ----
#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX)
int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
#endif
!
! /*
! We define my_sigset() and use that instead of the system sigset() so that
! we can favor an implementation based on sigaction(). On some systems, such
! as Mac OS X, sigset() results in flags such as SA_RESTART being set, and
! we want to make sure that no such flags are set.
! */
! #if defined(HAVE_SIGACTION) && !defined(my_sigset)
! #define my_sigset(A,B) do { struct sigaction s; sigset_t set; int rc; \
! DBUG_ASSERT((A) != 0); \
! sigemptyset(&set); \
! s.sa_handler = (B); \
! s.sa_mask = set; \
! s.sa_flags = 0; \
! rc= sigaction((A), &s, (struct sigaction *) NULL); \
! DBUG_ASSERT(rc == 0); \
} while (0)
+ #elif defined(HAVE_SIGSET) && !defined(my_sigset)
+ #define my_sigset(A,B) sigset((A),(B))
+ #elif !defined(my_sigset)
+ #define my_sigset(A,B) signal((A),(B))
#endif
#ifndef my_pthread_setprio
***************
*** 416,422 ****
#undef pthread_detach_this_thread
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); }
#undef sigset
! #define sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
#endif
#if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER)
--- 437,443 ----
#undef pthread_detach_this_thread
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); }
#undef sigset
! #define my_sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
#endif
#if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER)

View File

@ -250,9 +250,10 @@ extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io,
NEAR my_disable_flush_key_blocks, NEAR my_disable_symlinks; NEAR my_disable_flush_key_blocks, NEAR my_disable_symlinks;
extern char wild_many,wild_one,wild_prefix; extern char wild_many,wild_one,wild_prefix;
extern const char *charsets_dir; extern const char *charsets_dir;
extern char *defaults_extra_file; /* from default.c */
extern const char *defaults_group_suffix; extern char *my_defaults_extra_file;
extern const char *defaults_file; extern const char *my_defaults_group_suffix;
extern const char *my_defaults_file;
extern my_bool timed_mutexes; extern my_bool timed_mutexes;

View File

@ -80,16 +80,16 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
uint flags, int *was_cut); uint flags, int *was_cut);
longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res, longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
uint flags, int *was_cut); uint flags, int *was_cut);
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *time); ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *);
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *time); ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *);
ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *time); ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *);
ulonglong TIME_to_ulonglong(const MYSQL_TIME *time); ulonglong TIME_to_ulonglong(const MYSQL_TIME *);
my_bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time, my_bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time,
int *warning); int *warning);
int check_time_range(struct st_mysql_time *time, int *warning); int check_time_range(struct st_mysql_time *, int *warning);
long calc_daynr(uint year,uint month,uint day); long calc_daynr(uint year,uint month,uint day);
uint calc_days_in_year(uint year); uint calc_days_in_year(uint year);

View File

@ -87,6 +87,7 @@ extern char *mysql_unix_port;
#define IS_NUM(t) ((t) <= MYSQL_TYPE_INT24 || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL) #define IS_NUM(t) ((t) <= MYSQL_TYPE_INT24 || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL)
#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG) #define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
#define INTERNAL_NUM_FIELD(f) (((f)->type <= MYSQL_TYPE_INT24 && ((f)->type != MYSQL_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == MYSQL_TYPE_YEAR) #define INTERNAL_NUM_FIELD(f) (((f)->type <= MYSQL_TYPE_INT24 && ((f)->type != MYSQL_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == MYSQL_TYPE_YEAR)
#define IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_STRING)
typedef struct st_mysql_field { typedef struct st_mysql_field {
@ -783,7 +784,7 @@ int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query,
unsigned long length); unsigned long length);
int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt); int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt);
int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt); int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt);
int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind, int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg,
unsigned int column, unsigned int column,
unsigned long offset); unsigned long offset);
int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt); int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt);

View File

@ -24,11 +24,6 @@ extern "C" {
#ifndef USE_ALARM_THREAD #ifndef USE_ALARM_THREAD
#define USE_ONE_SIGNAL_HAND /* One must call process_alarm */ #define USE_ONE_SIGNAL_HAND /* One must call process_alarm */
#endif #endif
#ifdef HAVE_LINUXTHREADS
#define THR_CLIENT_ALARM SIGALRM
#else
#define THR_CLIENT_ALARM SIGUSR1
#endif
#ifdef HAVE_rts_threads #ifdef HAVE_rts_threads
#undef USE_ONE_SIGNAL_HAND #undef USE_ONE_SIGNAL_HAND
#define USE_ALARM_THREAD #define USE_ALARM_THREAD
@ -89,6 +84,9 @@ typedef struct st_alarm {
my_bool malloced; my_bool malloced;
} ALARM; } ALARM;
extern uint thr_client_alarm;
extern pthread_t alarm_thread;
#define thr_alarm_init(A) (*(A))=0 #define thr_alarm_init(A) (*(A))=0
#define thr_alarm_in_use(A) (*(A)!= 0) #define thr_alarm_in_use(A) (*(A)!= 0)
void init_thr_alarm(uint max_alarm); void init_thr_alarm(uint max_alarm);

View File

@ -1724,7 +1724,7 @@ static int stmt_read_row_no_result_set(MYSQL_STMT *stmt, unsigned char **row);
STMT_ATTR_UPDATE_MAX_LENGTH attribute is set. STMT_ATTR_UPDATE_MAX_LENGTH attribute is set.
*/ */
static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data); static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data);
static my_bool setup_one_fetch_function(MYSQL_BIND *bind, MYSQL_FIELD *field); static my_bool setup_one_fetch_function(MYSQL_BIND *, MYSQL_FIELD *field);
/* Auxilary function used to reset statement handle. */ /* Auxilary function used to reset statement handle. */
@ -2168,7 +2168,7 @@ static void update_stmt_fields(MYSQL_STMT *stmt)
MYSQL_FIELD *field= stmt->mysql->fields; MYSQL_FIELD *field= stmt->mysql->fields;
MYSQL_FIELD *field_end= field + stmt->field_count; MYSQL_FIELD *field_end= field + stmt->field_count;
MYSQL_FIELD *stmt_field= stmt->fields; MYSQL_FIELD *stmt_field= stmt->fields;
MYSQL_BIND *bind= stmt->bind_result_done ? stmt->bind : 0; MYSQL_BIND *my_bind= stmt->bind_result_done ? stmt->bind : 0;
DBUG_ASSERT(stmt->field_count == stmt->mysql->field_count); DBUG_ASSERT(stmt->field_count == stmt->mysql->field_count);
@ -2179,10 +2179,10 @@ static void update_stmt_fields(MYSQL_STMT *stmt)
stmt_field->type = field->type; stmt_field->type = field->type;
stmt_field->flags = field->flags; stmt_field->flags = field->flags;
stmt_field->decimals = field->decimals; stmt_field->decimals = field->decimals;
if (bind) if (my_bind)
{ {
/* Ignore return value: it should be 0 if bind_result succeeded. */ /* Ignore return value: it should be 0 if bind_result succeeded. */
(void) setup_one_fetch_function(bind++, stmt_field); (void) setup_one_fetch_function(my_bind++, stmt_field);
} }
} }
} }
@ -3008,7 +3008,7 @@ static my_bool int_is_null_false= 0;
mysql_stmt_bind_param() mysql_stmt_bind_param()
stmt statement handle stmt statement handle
The statement must be prepared with mysql_stmt_prepare(). The statement must be prepared with mysql_stmt_prepare().
bind Array of mysql_stmt_param_count() bind parameters. my_bind Array of mysql_stmt_param_count() bind parameters.
This function doesn't check that size of this argument This function doesn't check that size of this argument
is >= mysql_stmt_field_count(): it's user's responsibility. is >= mysql_stmt_field_count(): it's user's responsibility.
@ -3094,54 +3094,55 @@ static my_bool int_is_null_false= 0;
members should be zero-initialized. members should be zero-initialized.
Binding NULLs. Binding NULLs.
You might have a column always NULL, never NULL, or sometimes NULL. You might have a column always NULL, never NULL, or sometimes
For an always NULL column set MYSQL_BIND::buffer_type to NULL. For an always NULL column set MYSQL_BIND::buffer_type to
MYSQL_TYPE_NULL. The rest of the members just need to be MYSQL_TYPE_NULL. The rest of the members just need to be
zero-initialized. For never NULL columns set MYSQL_BIND::is_null to zero-initialized. For never NULL columns set
0, or this has already been done if you zero-initialized the entire MYSQL_BIND::is_null to 0, or this has already been done if you
structure. If you set MYSQL_TYPE::is_null to point to an zero-initialized the entire structure. If you set
application buffer of type 'my_bool', then this buffer will be MYSQL_TYPE::is_null to point to an application buffer of type
checked on each execution: this way you can set the buffer to TRUE, 'my_bool', then this buffer will be checked on each execution:
or any non-0 value for NULLs, and to FALSE or 0 for not NULL data. this way you can set the buffer to TRUE, or any non-0 value for
NULLs, and to FALSE or 0 for not NULL data.
Binding text strings and sequences of bytes. Binding text strings and sequences of bytes.
For strings, in addition to MYSQL_BIND::buffer_type and For strings, in addition to MYSQL_BIND::buffer_type and
MYSQL_BIND::buffer you need to set MYSQL_BIND::length or MYSQL_BIND::buffer you need to set MYSQL_BIND::length or
MYSQL_BIND::buffer_length. MYSQL_BIND::buffer_length. If 'length' is set, 'buffer_length'
If 'length' is set, 'buffer_length' is ignored. 'buffer_length' is ignored. 'buffer_length' member should be used when size of
member should be used when size of string doesn't change between string doesn't change between executions. If you want to vary
executions. If you want to vary buffer length for each value, set buffer length for each value, set 'length' to point to an
'length' to point to an application buffer of type 'unsigned long' application buffer of type 'unsigned long' and set this long to
and set this long to length of the string before each length of the string before each mysql_stmt_execute().
mysql_stmt_execute().
Binding dates and times. Binding dates and times.
For binding dates and times prepared statements API provides clients For binding dates and times prepared statements API provides
with MYSQL_TIME structure. A pointer to instance of this structure clients with MYSQL_TIME structure. A pointer to instance of this
should be assigned to MYSQL_BIND::buffer whenever MYSQL_TYPE_TIME, structure should be assigned to MYSQL_BIND::buffer whenever
MYSQL_TYPE_DATE, MYSQL_TYPE_DATETIME typecodes are used. When MYSQL_TYPE_TIME, MYSQL_TYPE_DATE, MYSQL_TYPE_DATETIME typecodes
typecode is MYSQL_TYPE_TIME, only members 'hour', 'minute', 'second' are used. When typecode is MYSQL_TYPE_TIME, only members
and 'neg' (is time offset negative) are used. These members only 'hour', 'minute', 'second' and 'neg' (is time offset negative)
will be sent to the server. are used. These members only will be sent to the server.
MYSQL_TYPE_DATE implies use of 'year', 'month', 'day', 'neg'. MYSQL_TYPE_DATE implies use of 'year', 'month', 'day', 'neg'.
MYSQL_TYPE_DATETIME utilizes both parts of MYSQL_TIME structure. MYSQL_TYPE_DATETIME utilizes both parts of MYSQL_TIME structure.
You don't have to set MYSQL_TIME::time_type member: it's not used You don't have to set MYSQL_TIME::time_type member: it's not
when sending data to the server, typecode information is enough. used when sending data to the server, typecode information is
'second_part' member can hold microsecond precision of time value, enough. 'second_part' member can hold microsecond precision of
but now it's only supported on protocol level: you can't store time value, but now it's only supported on protocol level: you
microsecond in a column, or use in temporal calculations. However, can't store microsecond in a column, or use in temporal
if you send a time value with microsecond part for 'SELECT ?', calculations. However, if you send a time value with microsecond
statement, you'll get it back unchanged from the server. part for 'SELECT ?', statement, you'll get it back unchanged
from the server.
Data conversion. Data conversion.
If conversion from host language type to data representation, If conversion from host language type to data representation,
corresponding to SQL type, is required it's done on the server. corresponding to SQL type, is required it's done on the server.
Data truncation is possible when conversion is lossy. For example, Data truncation is possible when conversion is lossy. For
if you supply MYSQL_TYPE_DATETIME value out of valid SQL type example, if you supply MYSQL_TYPE_DATETIME value out of valid
TIMESTAMP range, the same conversion will be applied as if this SQL type TIMESTAMP range, the same conversion will be applied as
value would have been sent as string in the old protocol. if this value would have been sent as string in the old
TODO: document how the server will behave in case of truncation/data protocol. TODO: document how the server will behave in case of
loss. truncation/data loss.
After variables were bound, you can repeatedly set/change their After variables were bound, you can repeatedly set/change their
values and mysql_stmt_execute() the statement. values and mysql_stmt_execute() the statement.
@ -3169,7 +3170,7 @@ static my_bool int_is_null_false= 0;
1 error, can be retrieved with mysql_stmt_error. 1 error, can be retrieved with mysql_stmt_error.
*/ */
my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *bind) my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *my_bind)
{ {
uint count=0; uint count=0;
MYSQL_BIND *param, *end; MYSQL_BIND *param, *end;
@ -3186,7 +3187,7 @@ my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *bind)
} }
/* Allocated on prepare */ /* Allocated on prepare */
memcpy((char*) stmt->params, (char*) bind, memcpy((char*) stmt->params, (char*) my_bind,
sizeof(MYSQL_BIND) * stmt->param_count); sizeof(MYSQL_BIND) * stmt->param_count);
for (param= stmt->params, end= param+stmt->param_count; for (param= stmt->params, end= param+stmt->param_count;
@ -3349,8 +3350,7 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number,
} }
param= stmt->params+param_number; param= stmt->params+param_number;
if (param->buffer_type < MYSQL_TYPE_TINY_BLOB || if (!IS_LONGDATA(param->buffer_type))
param->buffer_type > MYSQL_TYPE_STRING)
{ {
/* Long data handling should be used only for string/binary types */ /* Long data handling should be used only for string/binary types */
strmov(stmt->sqlstate, unknown_sqlstate); strmov(stmt->sqlstate, unknown_sqlstate);
@ -3514,7 +3514,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
This function should support all target buffer types: the rest This function should support all target buffer types: the rest
of conversion functions can delegate conversion to it. of conversion functions can delegate conversion to it.
*/ */
switch(param->buffer_type) { switch (param->buffer_type) {
case MYSQL_TYPE_NULL: /* do nothing */ case MYSQL_TYPE_NULL: /* do nothing */
break; break;
case MYSQL_TYPE_TINY: case MYSQL_TYPE_TINY:
@ -3856,32 +3856,32 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
static void fetch_datetime_with_conversion(MYSQL_BIND *param, static void fetch_datetime_with_conversion(MYSQL_BIND *param,
MYSQL_FIELD *field, MYSQL_FIELD *field,
MYSQL_TIME *time) MYSQL_TIME *my_time)
{ {
switch (param->buffer_type) { switch (param->buffer_type) {
case MYSQL_TYPE_NULL: /* do nothing */ case MYSQL_TYPE_NULL: /* do nothing */
break; break;
case MYSQL_TYPE_DATE: case MYSQL_TYPE_DATE:
*(MYSQL_TIME *)(param->buffer)= *time; *(MYSQL_TIME *)(param->buffer)= *my_time;
*param->error= time->time_type != MYSQL_TIMESTAMP_DATE; *param->error= my_time->time_type != MYSQL_TIMESTAMP_DATE;
break; break;
case MYSQL_TYPE_TIME: case MYSQL_TYPE_TIME:
*(MYSQL_TIME *)(param->buffer)= *time; *(MYSQL_TIME *)(param->buffer)= *my_time;
*param->error= time->time_type != MYSQL_TIMESTAMP_TIME; *param->error= my_time->time_type != MYSQL_TIMESTAMP_TIME;
break; break;
case MYSQL_TYPE_DATETIME: case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP: case MYSQL_TYPE_TIMESTAMP:
*(MYSQL_TIME *)(param->buffer)= *time; *(MYSQL_TIME *)(param->buffer)= *my_time;
/* No error: time and date are compatible with datetime */ /* No error: time and date are compatible with datetime */
break; break;
case MYSQL_TYPE_YEAR: case MYSQL_TYPE_YEAR:
shortstore(param->buffer, time->year); shortstore(param->buffer, my_time->year);
*param->error= 1; *param->error= 1;
break; break;
case MYSQL_TYPE_FLOAT: case MYSQL_TYPE_FLOAT:
case MYSQL_TYPE_DOUBLE: case MYSQL_TYPE_DOUBLE:
{ {
ulonglong value= TIME_to_ulonglong(time); ulonglong value= TIME_to_ulonglong(my_time);
fetch_float_with_conversion(param, field, fetch_float_with_conversion(param, field,
ulonglong2double(value), DBL_DIG); ulonglong2double(value), DBL_DIG);
break; break;
@ -3892,7 +3892,7 @@ static void fetch_datetime_with_conversion(MYSQL_BIND *param,
case MYSQL_TYPE_LONG: case MYSQL_TYPE_LONG:
case MYSQL_TYPE_LONGLONG: case MYSQL_TYPE_LONGLONG:
{ {
longlong value= (longlong) TIME_to_ulonglong(time); longlong value= (longlong) TIME_to_ulonglong(my_time);
fetch_long_with_conversion(param, field, value, TRUE); fetch_long_with_conversion(param, field, value, TRUE);
break; break;
} }
@ -3903,7 +3903,7 @@ static void fetch_datetime_with_conversion(MYSQL_BIND *param,
fetch_string_with_conversion: fetch_string_with_conversion:
*/ */
char buff[MAX_DATE_STRING_REP_LENGTH]; char buff[MAX_DATE_STRING_REP_LENGTH];
uint length= my_TIME_to_str(time, buff); uint length= my_TIME_to_str(my_time, buff);
/* Resort to string conversion */ /* Resort to string conversion */
fetch_string_with_conversion(param, (char *)buff, length); fetch_string_with_conversion(param, (char *)buff, length);
break; break;
@ -4269,6 +4269,8 @@ static my_bool is_binary_compatible(enum enum_field_types type1,
static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field) static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
{ {
DBUG_ENTER("setup_one_fetch_function");
/* Setup data copy functions for the different supported types */ /* Setup data copy functions for the different supported types */
switch (param->buffer_type) { switch (param->buffer_type) {
case MYSQL_TYPE_NULL: /* for dummy binds */ case MYSQL_TYPE_NULL: /* for dummy binds */
@ -4333,7 +4335,9 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
param->fetch_result= fetch_result_str; param->fetch_result= fetch_result_str;
break; break;
default: default:
return TRUE; DBUG_PRINT("error", ("Unknown param->buffer_type: %u",
(uint) param->buffer_type));
DBUG_RETURN(TRUE);
} }
if (! is_binary_compatible(param->buffer_type, field->type)) if (! is_binary_compatible(param->buffer_type, field->type))
param->fetch_result= fetch_result_with_conversion; param->fetch_result= fetch_result_with_conversion;
@ -4402,9 +4406,10 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
param->skip_result= skip_result_string; param->skip_result= skip_result_string;
break; break;
default: default:
return TRUE; DBUG_PRINT("error", ("Unknown field->type: %u", (uint) field->type));
DBUG_RETURN(TRUE);
} }
return FALSE; DBUG_RETURN(FALSE);
} }
@ -4412,7 +4417,7 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
Setup the bind buffers for resultset processing Setup the bind buffers for resultset processing
*/ */
my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind) my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *my_bind)
{ {
MYSQL_BIND *param, *end; MYSQL_BIND *param, *end;
MYSQL_FIELD *field; MYSQL_FIELD *field;
@ -4436,8 +4441,9 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
is called from mysql_stmt_store_result. is called from mysql_stmt_store_result.
*/ */
if (stmt->bind != bind) if (stmt->bind != my_bind)
memcpy((char*) stmt->bind, (char*) bind, sizeof(MYSQL_BIND) * bind_count); memcpy((char*) stmt->bind, (char*) my_bind,
sizeof(MYSQL_BIND) * bind_count);
for (param= stmt->bind, end= param + bind_count, field= stmt->fields ; for (param= stmt->bind, end= param + bind_count, field= stmt->fields ;
param < end ; param < end ;
@ -4484,7 +4490,7 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row) static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
{ {
MYSQL_BIND *bind, *end; MYSQL_BIND *my_bind, *end;
MYSQL_FIELD *field; MYSQL_FIELD *field;
uchar *null_ptr, bit; uchar *null_ptr, bit;
int truncation_count= 0; int truncation_count= 0;
@ -4506,11 +4512,12 @@ static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
bit= 4; /* first 2 bits are reserved */ bit= 4; /* first 2 bits are reserved */
/* Copy complete row to application buffers */ /* Copy complete row to application buffers */
for (bind= stmt->bind, end= bind + stmt->field_count, field= stmt->fields ; for (my_bind= stmt->bind, end= my_bind + stmt->field_count,
bind < end ; field= stmt->fields ;
bind++, field++) my_bind < end ;
my_bind++, field++)
{ {
*bind->error= 0; *my_bind->error= 0;
if (*null_ptr & bit) if (*null_ptr & bit)
{ {
/* /*
@ -4520,15 +4527,15 @@ static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
mysql_stmt_fetch_column, and in this case nullness of column will be mysql_stmt_fetch_column, and in this case nullness of column will be
lost. See mysql_stmt_fetch_column for details. lost. See mysql_stmt_fetch_column for details.
*/ */
bind->row_ptr= NULL; my_bind->row_ptr= NULL;
*bind->is_null= 1; *my_bind->is_null= 1;
} }
else else
{ {
*bind->is_null= 0; *my_bind->is_null= 0;
bind->row_ptr= row; my_bind->row_ptr= row;
(*bind->fetch_result)(bind, field, &row); (*my_bind->fetch_result)(my_bind, field, &row);
truncation_count+= *bind->error; truncation_count+= *my_bind->error;
} }
if (!((bit<<=1) & 255)) if (!((bit<<=1) & 255))
{ {
@ -4585,7 +4592,7 @@ int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt)
SYNOPSIS SYNOPSIS
mysql_stmt_fetch_column() mysql_stmt_fetch_column()
stmt Prepared statement handler stmt Prepared statement handler
bind Where data should be placed. Should be filled in as my_bind Where data should be placed. Should be filled in as
when calling mysql_stmt_bind_result() when calling mysql_stmt_bind_result()
column Column to fetch (first column is 0) column Column to fetch (first column is 0)
ulong offset Offset in result data (to fetch blob in pieces) ulong offset Offset in result data (to fetch blob in pieces)
@ -4595,7 +4602,7 @@ int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt)
1 error 1 error
*/ */
int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind, int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *my_bind,
uint column, ulong offset) uint column, ulong offset)
{ {
MYSQL_BIND *param= stmt->bind+column; MYSQL_BIND *param= stmt->bind+column;
@ -4612,26 +4619,26 @@ int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (!bind->error) if (!my_bind->error)
bind->error= &bind->error_value; my_bind->error= &my_bind->error_value;
*bind->error= 0; *my_bind->error= 0;
if (param->row_ptr) if (param->row_ptr)
{ {
MYSQL_FIELD *field= stmt->fields+column; MYSQL_FIELD *field= stmt->fields+column;
uchar *row= param->row_ptr; uchar *row= param->row_ptr;
bind->offset= offset; my_bind->offset= offset;
if (bind->is_null) if (my_bind->is_null)
*bind->is_null= 0; *my_bind->is_null= 0;
if (bind->length) /* Set the length if non char/binary types */ if (my_bind->length) /* Set the length if non char/binary types */
*bind->length= *param->length; *my_bind->length= *param->length;
else else
bind->length= &param->length_value; /* Needed for fetch_result() */ my_bind->length= &param->length_value; /* Needed for fetch_result() */
fetch_result_with_conversion(bind, field, &row); fetch_result_with_conversion(my_bind, field, &row);
} }
else else
{ {
if (bind->is_null) if (my_bind->is_null)
*bind->is_null= 1; *my_bind->is_null= 1;
} }
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -4703,7 +4710,7 @@ err:
static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data) static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data)
{ {
MYSQL_BIND *bind, *end; MYSQL_BIND *my_bind, *end;
MYSQL_FIELD *field; MYSQL_FIELD *field;
uchar *null_ptr, bit; uchar *null_ptr, bit;
uchar *row= (uchar*) data->data; uchar *row= (uchar*) data->data;
@ -4716,12 +4723,12 @@ static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data)
bit= 4; /* first 2 bits are reserved */ bit= 4; /* first 2 bits are reserved */
/* Go through all fields and calculate metadata */ /* Go through all fields and calculate metadata */
for (bind= stmt->bind, end= bind + stmt->field_count, field= stmt->fields ; for (my_bind= stmt->bind, end= my_bind + stmt->field_count, field= stmt->fields ;
bind < end ; my_bind < end ;
bind++, field++) my_bind++, field++)
{ {
if (!(*null_ptr & bit)) if (!(*null_ptr & bit))
(*bind->skip_result)(bind, field, &row); (*my_bind->skip_result)(my_bind, field, &row);
DBUG_ASSERT(row <= row_end); DBUG_ASSERT(row <= row_end);
if (!((bit<<=1) & 255)) if (!((bit<<=1) & 255))
{ {
@ -4785,16 +4792,17 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
We must initalize the bind structure to be able to calculate We must initalize the bind structure to be able to calculate
max_length max_length
*/ */
MYSQL_BIND *bind, *end; MYSQL_BIND *my_bind, *end;
MYSQL_FIELD *field; MYSQL_FIELD *field;
bzero((char*) stmt->bind, sizeof(*stmt->bind)* stmt->field_count); bzero((char*) stmt->bind, sizeof(*stmt->bind)* stmt->field_count);
for (bind= stmt->bind, end= bind + stmt->field_count, field= stmt->fields; for (my_bind= stmt->bind, end= my_bind + stmt->field_count,
bind < end ; field= stmt->fields;
bind++, field++) my_bind < end ;
my_bind++, field++)
{ {
bind->buffer_type= MYSQL_TYPE_NULL; my_bind->buffer_type= MYSQL_TYPE_NULL;
bind->buffer_length=1; my_bind->buffer_length=1;
} }
if (mysql_stmt_bind_result(stmt, stmt->bind)) if (mysql_stmt_bind_result(stmt, stmt->bind))

View File

@ -538,6 +538,11 @@ int init_embedded_server(int argc, char **argv, char **groups)
sql_print_error("Warning: Can't create thread to manage maintenance"); sql_print_error("Warning: Can't create thread to manage maintenance");
} }
// FIXME initialize binlog_filter and rpl_filter if not already done
// corresponding delete is in clean_up()
if(!binlog_filter) binlog_filter = new Rpl_filter;
if(!rpl_filter) rpl_filter = new Rpl_filter;
if (opt_init_file) if (opt_init_file)
{ {
if (read_init_file(opt_init_file)) if (read_init_file(opt_init_file))
@ -593,7 +598,7 @@ void *create_embedded_thd(int client_flag)
thd->set_time(); thd->set_time();
thd->init_for_queries(); thd->init_for_queries();
thd->client_capabilities= client_flag; thd->client_capabilities= client_flag;
thd->real_id= (pthread_t) thd; thd->real_id= pthread_self();
thd->db= NULL; thd->db= NULL;
thd->db_length= 0; thd->db_length= 0;
@ -1055,6 +1060,7 @@ void Protocol_simple::prepare_for_resend()
data->embedded_info->prev_ptr= &cur->next; data->embedded_info->prev_ptr= &cur->next;
next_field=cur->data; next_field=cur->data;
next_mysql_field= data->embedded_info->fields_list; next_mysql_field= data->embedded_info->fields_list;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }

View File

@ -530,7 +530,8 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT DISTINCT a,b FROM t1 GROUP BY a,b; EXPLAIN SELECT DISTINCT a,b FROM t1 GROUP BY a,b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 1 SIMPLE t1 ALL NULL NULL NULL NULL 3
CREATE TABLE t2(a INT, b INT, c INT, d INT, PRIMARY KEY (a,b)); CREATE TABLE t2(a INT, b INT NOT NULL, c INT NOT NULL, d INT,
PRIMARY KEY (a,b));
INSERT INTO t2 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4); INSERT INTO t2 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4);
EXPLAIN SELECT DISTINCT a FROM t2; EXPLAIN SELECT DISTINCT a FROM t2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
@ -644,3 +645,26 @@ SELECT COUNT(*) FROM
COUNT(*) COUNT(*)
2 2
DROP TABLE t1, t2; DROP TABLE t1, t2;
CREATE TABLE t1 (a INT, UNIQUE (a));
INSERT INTO t1 VALUES (4),(null),(2),(1),(null),(3);
EXPLAIN SELECT DISTINCT a FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 5 NULL 6 Using index
SELECT DISTINCT a FROM t1;
a
NULL
1
2
3
4
EXPLAIN SELECT a FROM t1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 5 NULL 6 Using index
SELECT a FROM t1 GROUP BY a;
a
NULL
1
2
3
4
DROP TABLE t1;

View File

@ -1183,6 +1183,20 @@ set time_zone= @@global.time_zone;
select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE; select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE;
str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE
NULL NULL
CREATE TABLE t1 (a int, t1 time, t2 time, d date, PRIMARY KEY (a));
INSERT INTO t1 VALUES (1, '10:00:00', NULL, NULL),
(2, '11:00:00', '11:15:00', '1972-02-06');
SELECT t1, t2, SEC_TO_TIME( TIME_TO_SEC( t2 ) - TIME_TO_SEC( t1 ) ), QUARTER(d)
FROM t1;
t1 t2 SEC_TO_TIME( TIME_TO_SEC( t2 ) - TIME_TO_SEC( t1 ) ) QUARTER(d)
10:00:00 NULL NULL NULL
11:00:00 11:15:00 00:15:00 1
SELECT t1, t2, SEC_TO_TIME( TIME_TO_SEC( t2 ) - TIME_TO_SEC( t1 ) ), QUARTER(d)
FROM t1 ORDER BY a DESC;
t1 t2 SEC_TO_TIME( TIME_TO_SEC( t2 ) - TIME_TO_SEC( t1 ) ) QUARTER(d)
11:00:00 11:15:00 00:15:00 1
10:00:00 NULL NULL NULL
DROP TABLE t1;
End of 5.0 tests End of 5.0 tests
select date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND); select date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND);
date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND) date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND)

View File

@ -1039,4 +1039,24 @@ REVOKE EXECUTE ON PROCEDURE t1 FROM some_user_name@1234567890abcdefghij123456789
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60) ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
GRANT PROCESS ON * TO user@localhost; GRANT PROCESS ON * TO user@localhost;
ERROR 3D000: No database selected ERROR 3D000: No database selected
CREATE USER bug23556@localhost;
CREATE DATABASE bug23556;
GRANT SELECT ON bug23556.* TO bug23556@localhost;
USE bug23556;
CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
GRANT DELETE ON t1 TO bug23556@localhost;
USE bug23556;
TRUNCATE t1;
ERROR 42000: DROP command denied to user 'bug23556'@'localhost' for table 't1'
USE bug23556;
REVOKE DELETE ON t1 FROM bug23556@localhost;
GRANT DROP ON t1 TO bug23556@localhost;
USE bug23556;
TRUNCATE t1;
USE bug23556;
DROP TABLE t1;
USE test;
DROP DATABASE bug23556;
DROP USER bug23556@localhost;
End of 5.0 tests End of 5.0 tests

View File

@ -1342,6 +1342,16 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found 1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
2 DERIVED tables ALL NULL NULL NULL NULL 2 2 DERIVED tables ALL NULL NULL NULL NULL 2
drop view v1; drop view v1;
create table t1 (f1 int(11));
create table t2 (f1 int(11), f2 int(11));
select table_name from information_schema.tables
where table_schema = 'test' and table_name not in
(select table_name from information_schema.columns
where table_schema = 'test' and column_name = 'f3');
table_name
t1
t2
drop table t1,t2;
End of 5.0 tests. End of 5.0 tests.
select * from information_schema.engines WHERE ENGINE="MyISAM"; select * from information_schema.engines WHERE ENGINE="MyISAM";
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS

View File

@ -1605,3 +1605,31 @@ WHERE t1.id='5';
id ct pc nm id ct pc nm
5 NULL NULL NULL 5 NULL NULL NULL
DROP TABLE t1,t2,t3,t4; DROP TABLE t1,t2,t3,t4;
CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (a INT);
CREATE TABLE t3 (a INT, c INT);
CREATE TABLE t4 (a INT, c INT);
CREATE TABLE t5 (a INT, c INT);
SELECT b FROM t1 JOIN (t2 LEFT JOIN t3 USING (a) LEFT JOIN t4 USING (a)
LEFT JOIN t5 USING (a)) USING (a);
b
SELECT c FROM t1 JOIN (t2 LEFT JOIN t3 USING (a) LEFT JOIN t4 USING (a)
LEFT JOIN t5 USING (a)) USING (a);
ERROR 23000: Column 'c' in field list is ambiguous
SELECT b FROM t1 JOIN (t2 JOIN t3 USING (a) JOIN t4 USING (a)
JOIN t5 USING (a)) USING (a);
b
SELECT c FROM t1 JOIN (t2 JOIN t3 USING (a) JOIN t4 USING (a)
JOIN t5 USING (a)) USING (a);
ERROR 23000: Column 'c' in field list is ambiguous
DROP TABLE t1,t2,t3,t4,t5;
CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (a INT, b INT);
CREATE TABLE t3 (a INT, b INT);
INSERT INTO t1 VALUES (1,1);
INSERT INTO t2 VALUES (1,1);
INSERT INTO t3 VALUES (1,1);
SELECT * FROM t1 JOIN (t2 JOIN t3 USING (b)) USING (a);
ERROR 23000: Column 'a' in from clause is ambiguous
DROP TABLE t1,t2,t3;
End of 5.0 tests

View File

@ -482,3 +482,10 @@ alter table t1 drop index i3, drop index i2, drop index i1;
alter table t1 add index i3 (c3), add index i2 (c2), add unique index i1 (c1); alter table t1 add index i3 (c3), add index i2 (c2), add unique index i1 (c1);
ERROR 23000: Duplicate entry '1' for key 'i1' ERROR 23000: Duplicate entry '1' for key 'i1'
drop table t1; drop table t1;
CREATE TABLE t1( a TINYINT, KEY(a) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES( 1 );
ALTER TABLE t1 DISABLE KEYS;
EXPLAIN SELECT MAX(a) FROM t1 FORCE INDEX(a);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
drop table t1;

View File

@ -775,7 +775,7 @@ CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(2),(1); INSERT INTO t1 VALUES(2),(1);
CREATE TABLE t2(a INT, KEY(a)) ENGINE=MERGE UNION=(t1); CREATE TABLE t2(a INT, KEY(a)) ENGINE=MERGE UNION=(t1);
SELECT * FROM t2 WHERE a=2; SELECT * FROM t2 WHERE a=2;
ERROR HY000: Got error 124 from storage engine ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t1, t2; DROP TABLE t1, t2;
CREATE TABLE t1(a INT) ENGINE=MEMORY; CREATE TABLE t1(a INT) ENGINE=MEMORY;
CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t1); CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t1);
@ -786,6 +786,26 @@ CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t3);
SELECT * FROM t2; SELECT * FROM t2;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t2; DROP TABLE t2;
CREATE TABLE t1(a INT, b TEXT);
CREATE TABLE tm1(a TEXT, b INT) ENGINE=MERGE UNION=(t1);
SELECT * FROM tm1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t1, tm1;
CREATE TABLE t1(a SMALLINT, b SMALLINT);
CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1);
SELECT * FROM tm1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t1, tm1;
CREATE TABLE t1(a SMALLINT, b SMALLINT, KEY(a, b));
CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1);
SELECT * FROM tm1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t1, tm1;
CREATE TABLE t1(a SMALLINT, b SMALLINT, KEY(b));
CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1);
SELECT * FROM tm1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t1, tm1;
create table t1 (b bit(1)); create table t1 (b bit(1));
create table t2 (b bit(1)); create table t2 (b bit(1));
create table tm (b bit(1)) engine = merge union = (t1,t2); create table tm (b bit(1)) engine = merge union = (t1,t2);

View File

@ -1,5 +1,5 @@
set timestamp=1000000000; set timestamp=1000000000;
drop table if exists t1,t2; drop table if exists t1,t2,t3,t4,t5,t03,t04;
create table t1 (word varchar(20)); create table t1 (word varchar(20));
create table t2 (id int auto_increment not null primary key); create table t2 (id int auto_increment not null primary key);
insert into t1 values ("abirvalg"); insert into t1 values ("abirvalg");
@ -23,7 +23,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/; SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/; /*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
drop table if exists t1,t2/*!*/; drop table if exists t1,t2,t3,t4,t5,t03,t04/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
create table t1 (word varchar(20))/*!*/; create table t1 (word varchar(20))/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
@ -100,7 +100,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/; SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/; /*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
drop table if exists t1,t2/*!*/; drop table if exists t1,t2,t3,t4,t5,t03,t04/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
create table t1 (word varchar(20))/*!*/; create table t1 (word varchar(20))/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
@ -192,6 +192,7 @@ DELIMITER ;
# End of log file # End of log file
ROLLBACK /* added by mysqlbinlog */; ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
drop table t1,t2;
flush logs; flush logs;
create table t3 (f text character set utf8); create table t3 (f text character set utf8);
create table t4 (f text character set cp932); create table t4 (f text character set cp932);
@ -209,14 +210,15 @@ HEX(f)
select HEX(f) from t4; select HEX(f) from t4;
HEX(f) HEX(f)
835C 835C
drop table t3,t4,t03,t04;
flush logs; flush logs;
flush logs; flush logs;
select * from t5 /* must be (1),(1) */; select * from t5 /* must be (1),(1) */;
a a
1 1
1 1
drop table t5;
flush logs; flush logs;
drop table if exists t5;
create table t5 (c1 int, c2 varchar(128) character set latin1 not null); create table t5 (c1 int, c2 varchar(128) character set latin1 not null);
insert into t5 values (1, date_format('2001-01-01','%W')); insert into t5 values (1, date_format('2001-01-01','%W'));
set lc_time_names=de_DE; set lc_time_names=de_DE;
@ -235,6 +237,7 @@ c1 c2
1 Monday 1 Monday
2 Montag 2 Montag
3 Monday 3 Monday
drop table t5;
drop procedure if exists p1; drop procedure if exists p1;
flush logs; flush logs;
create procedure p1() create procedure p1()
@ -270,5 +273,4 @@ call p1();
1 1
1 1
drop procedure p1; drop procedure p1;
drop table t1, t2, t03, t04, t3, t4, t5;
flush logs; flush logs;

View File

@ -1,7 +1,6 @@
DROP TABLE IF EXISTS t1;
drop view if exists v1;
drop database if exists client_test_db; drop database if exists client_test_db;
DROP SCHEMA test;
CREATE SCHEMA test;
use test;
mysql.columns_priv OK mysql.columns_priv OK
mysql.db OK mysql.db OK
mysql.event OK mysql.event OK

View File

@ -422,6 +422,8 @@ mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 7: Con
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 3: connection 'test_con1' not found in connection pool mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 3: connection 'test_con1' not found in connection pool
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 2: Connection test_con1 already exists mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 2: Connection test_con1 already exists
connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET); connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
show tables;
ERROR 3D000: No database selected
Output from mysqltest-x.inc Output from mysqltest-x.inc
Output from mysqltest-x.inc Output from mysqltest-x.inc
Output from mysqltest-x.inc Output from mysqltest-x.inc

View File

@ -417,12 +417,12 @@ a b c
9199 9200 NULL 9199 9200 NULL
223456 223457 NULL 223456 223457 NULL
245651 245652 2005-12-08 15:58:27 245651 245652 2005-12-08 15:58:27
select c, count(*) select t21.c, count(*)
from t21 from t21
inner join t22 using (a) inner join t22 using (a)
where t22.b in (2,256,257,1121,1134,4102,9200,223457,245652) where t22.b in (2,256,257,1121,1134,4102,9200,223457,245652)
group by c group by t21.c
order by c; order by t21.c;
c count(*) c count(*)
NULL 7 NULL 7
2005-12-08 15:58:27 1 2005-12-08 15:58:27 1

View File

@ -30,7 +30,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a,b a 5 const 3 Using where; Using index 1 SIMPLE t1 ref a,b a 5 const 3 Using where; Using index
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3; explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a,b a 5 const 2 Using where; Using index 1 SIMPLE t1 range a,b a 9 NULL 3 Using where; Using index
explain select * from t1 where a > 1 and a < 3 limit 1; explain select * from t1 where a > 1 and a < 3 limit 1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index 1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index
@ -258,7 +258,7 @@ INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4
INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL); INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
explain select id from t1 where uniq_id is null; explain select id from t1 where uniq_id is null;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref idx1 idx1 5 const 1 Using where 1 SIMPLE t1 ref idx1 idx1 5 const 5 Using where
explain select id from t1 where uniq_id =1; explain select id from t1 where uniq_id =1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const idx1 idx1 5 const 1 1 SIMPLE t1 const idx1 idx1 5 const 1

View File

@ -3642,6 +3642,92 @@ INSERT into t1 values (1), (2), (3);
SELECT * FROM t1 LIMIT 2, -1; SELECT * FROM t1 LIMIT 2, -1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 1
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (
ID_with_null int NULL,
ID_better int NOT NULL,
INDEX idx1 (ID_with_null),
INDEX idx2 (ID_better)
);
INSERT INTO t1 VALUES (1,1), (2,1), (null,3), (null,3), (null,3), (null,3);
INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;
SELECT COUNT(*) FROM t1 WHERE ID_with_null IS NULL;
COUNT(*)
128
SELECT COUNT(*) FROM t1 WHERE ID_better=1;
COUNT(*)
2
EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID_with_null IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where
DROP INDEX idx1 ON t1;
CREATE UNIQUE INDEX idx1 ON t1(ID_with_null);
EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID_with_null IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where
DROP TABLE t1;
CREATE TABLE t1 (
ID1_with_null int NULL,
ID2_with_null int NULL,
ID_better int NOT NULL,
INDEX idx1 (ID1_with_null, ID2_with_null),
INDEX idx2 (ID_better)
);
INSERT INTO t1 VALUES (1,1,1), (2,2,1), (3,null,3), (null,3,3), (null,null,3),
(3,null,3), (null,3,3), (null,null,3), (3,null,3), (null,3,3), (null,null,3);
INSERT INTO t1 SELECT * FROM t1 WHERE ID1_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID2_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID1_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID2_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID1_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID2_with_null IS NULL;
SELECT COUNT(*) FROM t1 WHERE ID1_with_null IS NULL AND ID2_with_null=3;
COUNT(*)
24
SELECT COUNT(*) FROM t1 WHERE ID1_with_null=3 AND ID2_with_null IS NULL;
COUNT(*)
24
SELECT COUNT(*) FROM t1 WHERE ID1_with_null IS NULL AND ID2_with_null IS NULL;
COUNT(*)
192
SELECT COUNT(*) FROM t1 WHERE ID_better=1;
COUNT(*)
2
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null=3 IS NULL ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where
DROP INDEX idx1 ON t1;
CREATE UNIQUE INDEX idx1 ON t1(ID1_with_null,ID2_with_null);
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null IS NULL ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null IS NULL AND
(ID2_with_null=1 OR ID2_with_null=2);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where
DROP TABLE t1;
create table t1 (a bigint unsigned); create table t1 (a bigint unsigned);
insert into t1 values insert into t1 values
(if(1, 9223372036854775808, 1)), (if(1, 9223372036854775808, 1)),

View File

@ -3046,6 +3046,80 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 1 PRIMARY t1 ALL NULL NULL NULL NULL 2
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (2), (4), (1), (3);
CREATE TABLE t2 (b int, c int);
INSERT INTO t2 VALUES
(2,1), (1,3), (2,1), (4,4), (2,2), (1,4);
SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 2 );
a
2
4
1
3
SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 1);
ERROR 21000: Subquery returns more than 1 row
SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 2), a;
a
1
2
3
4
SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 1), a;
ERROR 21000: Subquery returns more than 1 row
SELECT b, MAX(c) FROM t2 GROUP BY b, (SELECT c FROM t2 WHERE b > 2);
b MAX(c)
1 4
2 2
4 4
SELECT b, MAX(c) FROM t2 GROUP BY b, (SELECT c FROM t2 WHERE b > 1);
ERROR 21000: Subquery returns more than 1 row
SELECT a FROM t1 GROUP BY a
HAVING IFNULL((SELECT b FROM t2 WHERE b > 2),
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3;
a
1
2
3
4
SELECT a FROM t1 GROUP BY a
HAVING IFNULL((SELECT b FROM t2 WHERE b > 1),
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3;
ERROR 21000: Subquery returns more than 1 row
SELECT a FROM t1 GROUP BY a
HAVING IFNULL((SELECT b FROM t2 WHERE b > 4),
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3;
a
4
SELECT a FROM t1 GROUP BY a
HAVING IFNULL((SELECT b FROM t2 WHERE b > 4),
(SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b)) > 3;
ERROR 21000: Subquery returns more than 1 row
SELECT a FROM t1
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 2),
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b));
a
2
4
1
3
SELECT a FROM t1
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 1),
(SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b));
ERROR 21000: Subquery returns more than 1 row
SELECT a FROM t1
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 4),
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b));
a
2
1
3
4
SELECT a FROM t1
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 4),
(SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b));
ERROR 21000: Subquery returns more than 1 row
DROP TABLE t1,t2;
create table t1 (df decimal(5,1)); create table t1 (df decimal(5,1));
insert into t1 values(1.1); insert into t1 values(1.1);
insert into t1 values(2.2); insert into t1 values(2.2);

View File

@ -629,3 +629,19 @@ cc NULL NULL
aa 1 1 aa 1 1
bb NULL NULL bb NULL NULL
drop table t1,t2; drop table t1,t2;
create table t1 (a int, b int);
insert into t1 values (0,0), (2,2), (3,3);
create table t2 (a int, b int);
insert into t2 values (1,1), (3,3);
select a, b, (a,b) in (select a, min(b) from t2 group by a) Z from t1;
a b Z
0 0 0
2 2 0
3 3 1
insert into t2 values (NULL,4);
select a, b, (a,b) in (select a, min(b) from t2 group by a) Z from t1;
a b Z
0 0 0
2 2 0
3 3 1
drop table t1,t2;

View File

@ -14,8 +14,8 @@ CREATE TABLE t1(num_value INT);
CREATE TABLE t2(user_str TEXT); CREATE TABLE t2(user_str TEXT);
---> connection: default ---> connection: default
GRANT INSERT, DELETE ON mysqltest_db1.t1 TO mysqltest_dfn@localhost; GRANT INSERT, DROP ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
GRANT INSERT, DELETE ON mysqltest_db1.t2 TO mysqltest_dfn@localhost; GRANT INSERT, DROP ON mysqltest_db1.t2 TO mysqltest_dfn@localhost;
---> connection: default ---> connection: default
GRANT SUPER ON *.* TO mysqltest_dfn@localhost; GRANT SUPER ON *.* TO mysqltest_dfn@localhost;

View File

@ -1241,6 +1241,31 @@ i j
2 2 2 2
13 13 13 13
drop table t1; drop table t1;
CREATE TABLE t1 (a INT PRIMARY KEY);
CREATE TABLE t2 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
CREATE TRIGGER trg_t1 BEFORE DELETE on t1 FOR EACH ROW
INSERT INTO t2 VALUES (OLD.a);
FLUSH STATUS;
TRUNCATE t1;
SHOW STATUS LIKE 'handler_delete';
Variable_name Value
Handler_delete 0
SELECT COUNT(*) FROM t2;
COUNT(*)
0
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
DELETE FROM t2;
FLUSH STATUS;
DELETE FROM t1;
SHOW STATUS LIKE 'handler_delete';
Variable_name Value
Handler_delete 8
SELECT COUNT(*) FROM t2;
COUNT(*)
8
DROP TRIGGER trg_t1;
DROP TABLE t1,t2;
drop table if exists t1; drop table if exists t1;
drop function if exists f1; drop function if exists f1;
create table t1 (i int); create table t1 (i int);

View File

@ -6,7 +6,7 @@ select 1;
1 1
1 1
select 2; select 2;
ERROR HY000: MySQL server has gone away Got one of the listed errors
select 3; select 3;
3 3
3 3
@ -14,7 +14,7 @@ select 1;
1 1
1 1
select 2; select 2;
ERROR HY000: MySQL server has gone away Got one of the listed errors
select 3; select 3;
3 3
3 3

View File

@ -39,4 +39,4 @@ synchronization : Bug#24529 Test 'synchronization' fails on Mac pushb
flush2 : Bug#24805 Pushbuild can't handle test with --disable-log-bin flush2 : Bug#24805 Pushbuild can't handle test with --disable-log-bin
mysql_upgrade : Bug#25074 mysql_upgrade gives inconsisten results mysql_upgrade : Bug#25074 mysql_upgrade gives inconsisten results
plugin : Bug#25659 memory leak via "plugins" test plugin : Bug#25659 memory leak via "plugins" test
rpl_ndb_dd_advance : Bug#25913 rpl_ndb_dd_advance fails randomly

View File

@ -364,7 +364,8 @@ EXPLAIN SELECT a FROM t1 GROUP BY a;
EXPLAIN SELECT a,b FROM t1 GROUP BY a,b; EXPLAIN SELECT a,b FROM t1 GROUP BY a,b;
EXPLAIN SELECT DISTINCT a,b FROM t1 GROUP BY a,b; EXPLAIN SELECT DISTINCT a,b FROM t1 GROUP BY a,b;
CREATE TABLE t2(a INT, b INT, c INT, d INT, PRIMARY KEY (a,b)); CREATE TABLE t2(a INT, b INT NOT NULL, c INT NOT NULL, d INT,
PRIMARY KEY (a,b));
INSERT INTO t2 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4); INSERT INTO t2 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4);
EXPLAIN SELECT DISTINCT a FROM t2; EXPLAIN SELECT DISTINCT a FROM t2;
EXPLAIN SELECT DISTINCT a,a FROM t2; EXPLAIN SELECT DISTINCT a,a FROM t2;
@ -525,3 +526,17 @@ SELECT COUNT(*) FROM
(SELECT DISTINCT a FROM t2 WHERE a='oe' COLLATE latin1_german2_ci) dt; (SELECT DISTINCT a FROM t2 WHERE a='oe' COLLATE latin1_german2_ci) dt;
DROP TABLE t1, t2; DROP TABLE t1, t2;
#
# Bug #25551: inconsistent behaviour in grouping NULL, depending on index type
#
CREATE TABLE t1 (a INT, UNIQUE (a));
INSERT INTO t1 VALUES (4),(null),(2),(1),(null),(3);
EXPLAIN SELECT DISTINCT a FROM t1;
#result must have one row with NULL
SELECT DISTINCT a FROM t1;
EXPLAIN SELECT a FROM t1 GROUP BY a;
#result must have one row with NULL
SELECT a FROM t1 GROUP BY a;
DROP TABLE t1;

View File

@ -692,6 +692,18 @@ set time_zone= @@global.time_zone;
# #
select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE; select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE;
#
# Bug #25643: SEC_TO_TIME function problem
#
CREATE TABLE t1 (a int, t1 time, t2 time, d date, PRIMARY KEY (a));
INSERT INTO t1 VALUES (1, '10:00:00', NULL, NULL),
(2, '11:00:00', '11:15:00', '1972-02-06');
SELECT t1, t2, SEC_TO_TIME( TIME_TO_SEC( t2 ) - TIME_TO_SEC( t1 ) ), QUARTER(d)
FROM t1;
SELECT t1, t2, SEC_TO_TIME( TIME_TO_SEC( t2 ) - TIME_TO_SEC( t1 ) ), QUARTER(d)
FROM t1 ORDER BY a DESC;
DROP TABLE t1;
--echo End of 5.0 tests --echo End of 5.0 tests
# #

View File

@ -940,6 +940,40 @@ REVOKE EXECUTE ON PROCEDURE p1 FROM 1234567890abcdefGHIKL@localhost;
--error ER_WRONG_STRING_LENGTH --error ER_WRONG_STRING_LENGTH
REVOKE EXECUTE ON PROCEDURE t1 FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY; REVOKE EXECUTE ON PROCEDURE t1 FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
#
# BUG#23556: TRUNCATE TABLE still maps to DELETE
#
CREATE USER bug23556@localhost;
CREATE DATABASE bug23556;
GRANT SELECT ON bug23556.* TO bug23556@localhost;
connect (bug23556,localhost,bug23556,,bug23556);
connection default;
USE bug23556;
CREATE TABLE t1 (a INT PRIMARY KEY); INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
GRANT DELETE ON t1 TO bug23556@localhost;
connection bug23556;
USE bug23556;
--error ER_TABLEACCESS_DENIED_ERROR
TRUNCATE t1;
connection default;
USE bug23556;
REVOKE DELETE ON t1 FROM bug23556@localhost;
GRANT DROP ON t1 TO bug23556@localhost;
connection bug23556;
USE bug23556;
TRUNCATE t1;
connection default;
USE bug23556;
DROP TABLE t1;
USE test;
DROP DATABASE bug23556;
DROP USER bug23556@localhost;
# #
# Bug #6774: Replication fails with Wrong usage of DB GRANT and GLOBAL PRIVILEGES # Bug #6774: Replication fails with Wrong usage of DB GRANT and GLOBAL PRIVILEGES
# #

View File

@ -988,6 +988,18 @@ explain select * from v1;
explain select * from (select table_name from information_schema.tables) as a; explain select * from (select table_name from information_schema.tables) as a;
drop view v1; drop view v1;
#
# Bug#23299 Some queries against INFORMATION_SCHEMA with subqueries fail
#
create table t1 (f1 int(11));
create table t2 (f1 int(11), f2 int(11));
select table_name from information_schema.tables
where table_schema = 'test' and table_name not in
(select table_name from information_schema.columns
where table_schema = 'test' and column_name = 'f3');
drop table t1,t2;
--echo End of 5.0 tests. --echo End of 5.0 tests.
# #
# Show engines # Show engines

View File

@ -1045,3 +1045,42 @@ SELECT t1.*, t4.nm
WHERE t1.id='5'; WHERE t1.id='5';
DROP TABLE t1,t2,t3,t4; DROP TABLE t1,t2,t3,t4;
#
# BUG#25575: ERROR 1052 (Column in from clause is ambiguous) with sub-join
#
CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (a INT);
CREATE TABLE t3 (a INT, c INT);
CREATE TABLE t4 (a INT, c INT);
CREATE TABLE t5 (a INT, c INT);
SELECT b FROM t1 JOIN (t2 LEFT JOIN t3 USING (a) LEFT JOIN t4 USING (a)
LEFT JOIN t5 USING (a)) USING (a);
--error ER_NON_UNIQ_ERROR
SELECT c FROM t1 JOIN (t2 LEFT JOIN t3 USING (a) LEFT JOIN t4 USING (a)
LEFT JOIN t5 USING (a)) USING (a);
SELECT b FROM t1 JOIN (t2 JOIN t3 USING (a) JOIN t4 USING (a)
JOIN t5 USING (a)) USING (a);
--error ER_NON_UNIQ_ERROR
SELECT c FROM t1 JOIN (t2 JOIN t3 USING (a) JOIN t4 USING (a)
JOIN t5 USING (a)) USING (a);
DROP TABLE t1,t2,t3,t4,t5;
CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (a INT, b INT);
CREATE TABLE t3 (a INT, b INT);
INSERT INTO t1 VALUES (1,1);
INSERT INTO t2 VALUES (1,1);
INSERT INTO t3 VALUES (1,1);
--error ER_NON_UNIQ_ERROR
SELECT * FROM t1 JOIN (t2 JOIN t3 USING (b)) USING (a);
DROP TABLE t1,t2,t3;
--echo End of 5.0 tests

View File

@ -442,3 +442,14 @@ alter table t1 drop index i3, drop index i2, drop index i1;
alter table t1 add index i3 (c3), add index i2 (c2), add unique index i1 (c1); alter table t1 add index i3 (c3), add index i2 (c2), add unique index i1 (c1);
drop table t1; drop table t1;
#
# Bug #20604: Test for disabled keys with aggregate functions and FORCE INDEX.
#
CREATE TABLE t1( a TINYINT, KEY(a) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES( 1 );
ALTER TABLE t1 DISABLE KEYS;
EXPLAIN SELECT MAX(a) FROM t1 FORCE INDEX(a);
drop table t1;

View File

@ -37,7 +37,6 @@ set session long_query_time=1;
select sleep(2); select sleep(2);
--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME --replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
select * from mysql.slow_log; select * from mysql.slow_log;
disconnect con1;
connection default; connection default;
show global variables show global variables
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
@ -121,3 +120,8 @@ drop table t1;
select * from mysql.general_log; select * from mysql.general_log;
--enable_ps_protocol --enable_ps_protocol
#
# Cleanup (must be done last to avoid delayed 'Quit' message in general log)
#
disconnect con1;

View File

@ -389,7 +389,7 @@ drop table t1, t2, t3;
CREATE TABLE t1(a INT); CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(2),(1); INSERT INTO t1 VALUES(2),(1);
CREATE TABLE t2(a INT, KEY(a)) ENGINE=MERGE UNION=(t1); CREATE TABLE t2(a INT, KEY(a)) ENGINE=MERGE UNION=(t1);
--error 1030 --error 1168
SELECT * FROM t2 WHERE a=2; SELECT * FROM t2 WHERE a=2;
DROP TABLE t1, t2; DROP TABLE t1, t2;
@ -407,6 +407,33 @@ CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t3);
SELECT * FROM t2; SELECT * FROM t2;
DROP TABLE t2; DROP TABLE t2;
#
# Underlying table definition conformance tests.
#
CREATE TABLE t1(a INT, b TEXT);
CREATE TABLE tm1(a TEXT, b INT) ENGINE=MERGE UNION=(t1);
--error 1168
SELECT * FROM tm1;
DROP TABLE t1, tm1;
CREATE TABLE t1(a SMALLINT, b SMALLINT);
CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1);
--error 1168
SELECT * FROM tm1;
DROP TABLE t1, tm1;
CREATE TABLE t1(a SMALLINT, b SMALLINT, KEY(a, b));
CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1);
--error 1168
SELECT * FROM tm1;
DROP TABLE t1, tm1;
CREATE TABLE t1(a SMALLINT, b SMALLINT, KEY(b));
CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1);
--error 1168
SELECT * FROM tm1;
DROP TABLE t1, tm1;
# End of 4.1 tests # End of 4.1 tests
# #

View File

@ -44,7 +44,7 @@ unlock tables;
drop table t1; drop table t1;
# #
# BUG#16217 - MySQL client misinterpretes multi-byte char as escape `\' # BUG#16217 - MySQL client misinterprets multi-byte char as escape `\'
# #
# new command \C or charset # new command \C or charset
@ -263,4 +263,14 @@ drop table t17583;
--exec echo "DELIMITER \\\\" > $MYSQLTEST_VARDIR/tmp/bug21412.sql --exec echo "DELIMITER \\\\" > $MYSQLTEST_VARDIR/tmp/bug21412.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1 --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
#
# Some coverage of not normally used parts
#
--disable_query_log
--exec $MYSQL test -e "show status" 2>&1 > /dev/null
--exec $MYSQL --help 2>&1 > /dev/null
--exec $MYSQL --version 2>&1 > /dev/null
--enable_quary_log
--echo End of 5.0 tests --echo End of 5.0 tests

View File

@ -9,7 +9,7 @@
set timestamp=1000000000; set timestamp=1000000000;
--disable_warnings --disable_warnings
drop table if exists t1,t2; drop table if exists t1,t2,t3,t4,t5,t03,t04;
--enable_warnings --enable_warnings
create table t1 (word varchar(20)); create table t1 (word varchar(20));
@ -108,8 +108,11 @@ select "--- reading stdin --" as "";
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form --position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001 --exec $MYSQL_BINLOG --short-form --position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
drop table t1,t2;
#
# Bug#16217 (mysql client did not know how not switch its internal charset) # Bug#16217 (mysql client did not know how not switch its internal charset)
#
flush logs; flush logs;
create table t3 (f text character set utf8); create table t3 (f text character set utf8);
create table t4 (f text character set cp932); create table t4 (f text character set cp932);
@ -123,6 +126,7 @@ select HEX(f) from t03;
select HEX(f) from t3; select HEX(f) from t3;
select HEX(f) from t04; select HEX(f) from t04;
select HEX(f) from t4; select HEX(f) from t4;
drop table t3,t4,t03,t04;
# #
#BUG#14157: utf8 encoding in binlog without set character_set_client #BUG#14157: utf8 encoding in binlog without set character_set_client
@ -136,6 +140,7 @@ flush logs;
flush logs; flush logs;
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL --exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL
select * from t5 /* must be (1),(1) */; select * from t5 /* must be (1),(1) */;
drop table t5;
# #
# Bug#22645 LC_TIME_NAMES: Statement not replicated # Bug#22645 LC_TIME_NAMES: Statement not replicated
@ -143,7 +148,6 @@ select * from t5 /* must be (1),(1) */;
# lc_time_names dependent values correctly # lc_time_names dependent values correctly
# #
flush logs; flush logs;
drop table if exists t5;
create table t5 (c1 int, c2 varchar(128) character set latin1 not null); create table t5 (c1 int, c2 varchar(128) character set latin1 not null);
insert into t5 values (1, date_format('2001-01-01','%W')); insert into t5 values (1, date_format('2001-01-01','%W'));
set lc_time_names=de_DE; set lc_time_names=de_DE;
@ -155,6 +159,8 @@ flush logs;
drop table t5; drop table t5;
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000008 | $MYSQL --exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000008 | $MYSQL
select * from t5 order by c1; select * from t5 order by c1;
drop table t5;
# #
# Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails # Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails
# #
@ -179,8 +185,13 @@ call p1();
call p1(); call p1();
drop procedure p1; drop procedure p1;
# clean up #
drop table t1, t2, t03, t04, t3, t4, t5; # Some coverage of not normally used parts
#
--disable_query_log
--exec $MYSQL_BINLOG --version 2>&1 > /dev/null
--exec $MYSQL_BINLOG --help 2>&1 > /dev/null
--enable_query_log
# End of 5.0 tests # End of 5.0 tests

View File

@ -1,3 +1,4 @@
# Embedded server doesn't support external clients # Embedded server doesn't support external clients
--source include/not_embedded.inc --source include/not_embedded.inc
@ -5,13 +6,16 @@
# depends on the presence of the log tables (which are CSV-based). # depends on the presence of the log tables (which are CSV-based).
--source include/have_csv.inc --source include/have_csv.inc
#
# Clean up after previous tests
#
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1;
drop view if exists v1;
drop database if exists client_test_db; drop database if exists client_test_db;
--enable_warnings --enable_warnings
DROP SCHEMA test;
CREATE SCHEMA test;
use test;
# #
# Bug #13783 mysqlcheck tries to optimize and analyze information_schema # Bug #13783 mysqlcheck tries to optimize and analyze information_schema
# #

View File

@ -1276,8 +1276,16 @@ EOF
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
connection default; connection default;
connection con1; connection con1;
disconnect con1;
--enable_abort_on_error --enable_abort_on_error
# Test connect without a database
connect (con2,localhost,root,,*NO-ONE*);
--error ER_NO_DB_ERROR
show tables;
disconnect con2;
connection default;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Test mysqltest arguments # Test mysqltest arguments
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@ -1635,5 +1643,17 @@ EOF
--exec echo "echo Some output; exit; echo Not this;" | $MYSQL_TEST 2>&1 --exec echo "echo Some output; exit; echo Not this;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
# Some coverage tests
# ----------------------------------------------------------------------------
--disable_query_log
--exec $MYSQL_TEST --help 2>&1 > /dev/null
--exec $MYSQL_TEST --version 2>&1 > /dev/null
--enable_quary_log
--disable_abort_on_error
--error 1
--exec $MYSQL_TEST a b c 2>&1 > /dev/null
--enable_abort_on_error
--echo End of tests --echo End of tests

View File

@ -249,12 +249,12 @@ t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a a
delete from t22 where a > 245651; delete from t22 where a > 245651;
update t22 set b = a + 1; update t22 set b = a + 1;
select * from t22 order by 1,2,3; select * from t22 order by 1,2,3;
select c, count(*) select t21.c, count(*)
from t21 from t21
inner join t22 using (a) inner join t22 using (a)
where t22.b in (2,256,257,1121,1134,4102,9200,223457,245652) where t22.b in (2,256,257,1121,1134,4102,9200,223457,245652)
group by c group by t21.c
order by c; order by t21.c;
DROP TABLE t1, t11, t12, t21, t22; DROP TABLE t1, t11, t12, t21, t22;

View File

@ -579,7 +579,7 @@ prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
create table t5 (a int) ; create table t5 (a int) ;
# rename must fail, t7 does not exist # rename must fail, t7 does not exist
# Clean up the filename here because embedded server reports whole path # Clean up the filename here because embedded server reports whole path
--replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ "" t7.frm t7 --replace_result \\ / $MYSQLTEST_VARDIR . /master-data/ "" t7.frm t7
--error 1017 --error 1017
execute stmt1 ; execute stmt1 ;
create table t7 (a int) ; create table t7 (a int) ;

View File

@ -9,6 +9,7 @@
--source include/have_binlog_format_row.inc --source include/have_binlog_format_row.inc
--source include/ndb_default_cluster.inc --source include/ndb_default_cluster.inc
--source include/not_embedded.inc --source include/not_embedded.inc
--source include/big_test.inc
#--source include/have_ndb_extra.inc #--source include/have_ndb_extra.inc
--source include/master-slave.inc --source include/master-slave.inc

View File

@ -3135,6 +3135,79 @@ SELECT * FROM t1 LIMIT 2, -1;
DROP TABLE t1; DROP TABLE t1;
# #
# 25407: wrong estimate of NULL keys for unique indexes
#
CREATE TABLE t1 (
ID_with_null int NULL,
ID_better int NOT NULL,
INDEX idx1 (ID_with_null),
INDEX idx2 (ID_better)
);
INSERT INTO t1 VALUES (1,1), (2,1), (null,3), (null,3), (null,3), (null,3);
INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;
SELECT COUNT(*) FROM t1 WHERE ID_with_null IS NULL;
SELECT COUNT(*) FROM t1 WHERE ID_better=1;
EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID_with_null IS NULL;
DROP INDEX idx1 ON t1;
CREATE UNIQUE INDEX idx1 ON t1(ID_with_null);
EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID_with_null IS NULL;
DROP TABLE t1;
CREATE TABLE t1 (
ID1_with_null int NULL,
ID2_with_null int NULL,
ID_better int NOT NULL,
INDEX idx1 (ID1_with_null, ID2_with_null),
INDEX idx2 (ID_better)
);
INSERT INTO t1 VALUES (1,1,1), (2,2,1), (3,null,3), (null,3,3), (null,null,3),
(3,null,3), (null,3,3), (null,null,3), (3,null,3), (null,3,3), (null,null,3);
INSERT INTO t1 SELECT * FROM t1 WHERE ID1_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID2_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID1_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID2_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID1_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID2_with_null IS NULL;
SELECT COUNT(*) FROM t1 WHERE ID1_with_null IS NULL AND ID2_with_null=3;
SELECT COUNT(*) FROM t1 WHERE ID1_with_null=3 AND ID2_with_null IS NULL;
SELECT COUNT(*) FROM t1 WHERE ID1_with_null IS NULL AND ID2_with_null IS NULL;
SELECT COUNT(*) FROM t1 WHERE ID_better=1;
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ;
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null=3 IS NULL ;
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null IS NULL;
DROP INDEX idx1 ON t1;
CREATE UNIQUE INDEX idx1 ON t1(ID1_with_null,ID2_with_null);
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ;
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null IS NULL ;
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null IS NULL;
EXPLAIN SELECT * FROM t1
WHERE ID_better=1 AND ID1_with_null IS NULL AND
(ID2_with_null=1 OR ID2_with_null=2);
DROP TABLE t1;
# Bug #22026: Warning when using IF statement and large unsigned bigint # Bug #22026: Warning when using IF statement and large unsigned bigint
# #

View File

@ -2000,6 +2000,65 @@ SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL;
EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL; EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL;
DROP TABLE t1; DROP TABLE t1;
#
# Bug 24653: sorting by expressions containing subselects
# that return more than one row
#
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (2), (4), (1), (3);
CREATE TABLE t2 (b int, c int);
INSERT INTO t2 VALUES
(2,1), (1,3), (2,1), (4,4), (2,2), (1,4);
SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 2 );
--error 1242
SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 1);
SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 2), a;
--error 1242
SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 1), a;
SELECT b, MAX(c) FROM t2 GROUP BY b, (SELECT c FROM t2 WHERE b > 2);
--error 1242
SELECT b, MAX(c) FROM t2 GROUP BY b, (SELECT c FROM t2 WHERE b > 1);
SELECT a FROM t1 GROUP BY a
HAVING IFNULL((SELECT b FROM t2 WHERE b > 2),
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3;
--error 1242
SELECT a FROM t1 GROUP BY a
HAVING IFNULL((SELECT b FROM t2 WHERE b > 1),
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3;
SELECT a FROM t1 GROUP BY a
HAVING IFNULL((SELECT b FROM t2 WHERE b > 4),
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3;
--error 1242
SELECT a FROM t1 GROUP BY a
HAVING IFNULL((SELECT b FROM t2 WHERE b > 4),
(SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b)) > 3;
SELECT a FROM t1
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 2),
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b));
--error 1242
SELECT a FROM t1
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 1),
(SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b));
SELECT a FROM t1
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 4),
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b));
--error 1242
SELECT a FROM t1
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 4),
(SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b));
DROP TABLE t1,t2;
# End of 4.1 tests # End of 4.1 tests
# #

View File

@ -472,3 +472,20 @@ select oref, a, a in (select min(ie) from t1 where oref=t2.oref group by grp) Z
drop table t1,t2; drop table t1,t2;
#
# BUG#24420: row-based IN suqueries with aggregation when the left operand
# of the subquery predicate may contain NULL values
#
create table t1 (a int, b int);
insert into t1 values (0,0), (2,2), (3,3);
create table t2 (a int, b int);
insert into t2 values (1,1), (3,3);
select a, b, (a,b) in (select a, min(b) from t2 group by a) Z from t1;
insert into t2 values (NULL,4);
select a, b, (a,b) in (select a, min(b) from t2 group by a) Z from t1;
drop table t1,t2;

View File

@ -60,8 +60,8 @@ CREATE TABLE t2(user_str TEXT);
--echo --echo
--echo ---> connection: default --echo ---> connection: default
GRANT INSERT, DELETE ON mysqltest_db1.t1 TO mysqltest_dfn@localhost; GRANT INSERT, DROP ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
GRANT INSERT, DELETE ON mysqltest_db1.t2 TO mysqltest_dfn@localhost; GRANT INSERT, DROP ON mysqltest_db1.t2 TO mysqltest_dfn@localhost;
# #
# Check that the user must have TRIGGER privilege to create a trigger. # Check that the user must have TRIGGER privilege to create a trigger.

View File

@ -1505,6 +1505,31 @@ update t1 set i= i+ 10 where j > 2;
select * from t1; select * from t1;
drop table t1; drop table t1;
#
# Bug#23556 TRUNCATE TABLE still maps to DELETE
#
CREATE TABLE t1 (a INT PRIMARY KEY);
CREATE TABLE t2 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
CREATE TRIGGER trg_t1 BEFORE DELETE on t1 FOR EACH ROW
INSERT INTO t2 VALUES (OLD.a);
FLUSH STATUS;
TRUNCATE t1;
SHOW STATUS LIKE 'handler_delete';
SELECT COUNT(*) FROM t2;
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
DELETE FROM t2;
FLUSH STATUS;
DELETE FROM t1;
SHOW STATUS LIKE 'handler_delete';
SELECT COUNT(*) FROM t2;
DROP TRIGGER trg_t1;
DROP TABLE t1,t2;
# #
# Bug #23651 "Server crashes when trigger which uses stored function # Bug #23651 "Server crashes when trigger which uses stored function

View File

@ -49,7 +49,8 @@ sleep 1;
connection default; connection default;
# When the connection is closed in this way, the error code should # When the connection is closed in this way, the error code should
# be consistent see bug#2845 for an explanation # be consistent see bug#2845 for an explanation
--error 2006 # depending on platform/client, either errno 2006 or 2013 can occur below
--error 2006,2013
select 2; select 2;
--enable_reconnect --enable_reconnect
select 3; select 3;
@ -96,7 +97,8 @@ sleep 1;
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
# be consistent see bug#2845 for an explanation # be consistent see bug#2845 for an explanation
--error 2006 # depending on platform/client, either errno 2006 or 2013 can occur below
--error 2006,2013
select 2; select 2;
--enable_reconnect --enable_reconnect
select 3; select 3;

View File

@ -41,9 +41,9 @@
#include <winbase.h> #include <winbase.h>
#endif #endif
const char *defaults_file=0; const char *my_defaults_file=0;
const char *defaults_group_suffix=0; const char *my_defaults_group_suffix=0;
char *defaults_extra_file=0; char *my_defaults_extra_file=0;
/* Which directories are searched for options (and in which order) */ /* Which directories are searched for options (and in which order) */
@ -116,7 +116,7 @@ static char *remove_end_comment(char *ptr);
0 ok 0 ok
1 given cinf_file doesn't exist 1 given cinf_file doesn't exist
The global variable 'defaults_group_suffix' is updated with value for The global variable 'my_defaults_group_suffix' is updated with value for
--defaults_group_suffix --defaults_group_suffix
*/ */
@ -132,28 +132,28 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
*args_used+= get_defaults_options(*argc - *args_used, *argv + *args_used, *args_used+= get_defaults_options(*argc - *args_used, *argv + *args_used,
(char **) &forced_default_file, (char **) &forced_default_file,
(char **) &forced_extra_defaults, (char **) &forced_extra_defaults,
(char **) &defaults_group_suffix); (char **) &my_defaults_group_suffix);
if (! defaults_group_suffix) if (! my_defaults_group_suffix)
defaults_group_suffix= getenv(STRINGIFY_ARG(DEFAULT_GROUP_SUFFIX_ENV)); my_defaults_group_suffix= getenv(STRINGIFY_ARG(DEFAULT_GROUP_SUFFIX_ENV));
if (forced_extra_defaults) if (forced_extra_defaults)
defaults_extra_file= (char *) forced_extra_defaults; my_defaults_extra_file= (char *) forced_extra_defaults;
if (forced_default_file) if (forced_default_file)
defaults_file= forced_default_file; my_defaults_file= forced_default_file;
/* /*
We can only handle 'defaults-group-suffix' if we are called from We can only handle 'defaults-group-suffix' if we are called from
load_defaults() as otherwise we can't know the type of 'func_ctx' load_defaults() as otherwise we can't know the type of 'func_ctx'
*/ */
if (defaults_group_suffix && func == handle_default_option) if (my_defaults_group_suffix && func == handle_default_option)
{ {
/* 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(defaults_group_suffix); const uint 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;
@ -176,7 +176,7 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
/** Construct new group */ /** Construct new group */
memcpy(ptr, extra_groups[i], len); memcpy(ptr, extra_groups[i], len);
memcpy(ptr+len, defaults_group_suffix, instance_len+1); memcpy(ptr+len, my_defaults_group_suffix, instance_len+1);
} }
group->count*= 2; group->count*= 2;
@ -210,15 +210,15 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
if (search_default_file(func, func_ctx, *dirs, conf_file) < 0) if (search_default_file(func, func_ctx, *dirs, conf_file) < 0)
goto err; goto err;
} }
else if (defaults_extra_file) else if (my_defaults_extra_file)
{ {
if ((error= search_default_file_with_ext(func, func_ctx, "", "", if ((error= search_default_file_with_ext(func, func_ctx, "", "",
defaults_extra_file, 0)) < 0) my_defaults_extra_file, 0)) < 0)
goto err; /* Fatal error */ goto err; /* Fatal error */
if (error > 0) if (error > 0)
{ {
fprintf(stderr, "Could not open required defaults file: %s\n", fprintf(stderr, "Could not open required defaults file: %s\n",
defaults_extra_file); my_defaults_extra_file);
goto err; goto err;
} }
} }
@ -874,8 +874,8 @@ void my_print_default_files(const char *conf_file)
char *end; char *end;
if (**dirs) if (**dirs)
pos= *dirs; pos= *dirs;
else if (defaults_extra_file) else if (my_defaults_extra_file)
pos= defaults_extra_file; pos= my_defaults_extra_file;
else else
continue; continue;
end= convert_dirname(name, pos, NullS); end= convert_dirname(name, pos, NullS);
@ -901,14 +901,14 @@ void print_defaults(const char *conf_file, const char **groups)
fputs(*groups,stdout); fputs(*groups,stdout);
} }
if (defaults_group_suffix) if (my_defaults_group_suffix)
{ {
groups= groups_save; groups= groups_save;
for ( ; *groups ; groups++) for ( ; *groups ; groups++)
{ {
fputc(' ',stdout); fputc(' ',stdout);
fputs(*groups,stdout); fputs(*groups,stdout);
fputs(defaults_group_suffix,stdout); fputs(my_defaults_group_suffix,stdout);
} }
} }
puts("\nThe following options may be given as the first argument:\n\ puts("\nThe following options may be given as the first argument:\n\

View File

@ -369,10 +369,10 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
if (*fmt == 's') /* String parameter */ if (*fmt == 's') /* String parameter */
{ {
reg2 char *par = va_arg(args, char *); reg2 char *par = va_arg(args, char *);
uint length = (uint) strlen(par); uint length2 = (uint) strlen(par);
/* TODO: implement minimum width and precision */ /* TODO: implement minimum width and precision */
out_length+=length; out_length+= length2;
if (my_b_write(info, par, length)) if (my_b_write(info, par, length2))
goto err; goto err;
} }
else if (*fmt == 'b') /* Sized buffer parameter, only precision makes sense */ else if (*fmt == 'b') /* Sized buffer parameter, only precision makes sense */
@ -385,32 +385,32 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
else if (*fmt == 'd' || *fmt == 'u') /* Integer parameter */ else if (*fmt == 'd' || *fmt == 'u') /* Integer parameter */
{ {
register int iarg; register int iarg;
uint length; uint length2;
char buff[17]; char buff[17];
iarg = va_arg(args, int); iarg = va_arg(args, int);
if (*fmt == 'd') if (*fmt == 'd')
length= (uint) (int10_to_str((long) iarg,buff, -10) - buff); length2= (uint) (int10_to_str((long) iarg,buff, -10) - buff);
else else
length= (uint) (int10_to_str((long) (uint) iarg,buff,10)- buff); length2= (uint) (int10_to_str((long) (uint) iarg,buff,10)- buff);
out_length+=length; out_length+= length2;
if (my_b_write(info, buff, length)) if (my_b_write(info, buff, length2))
goto err; goto err;
} }
else if ((*fmt == 'l' && fmt[1] == 'd') || fmt[1] == 'u') else if ((*fmt == 'l' && fmt[1] == 'd') || fmt[1] == 'u')
/* long parameter */ /* long parameter */
{ {
register long iarg; register long iarg;
uint length; uint length2;
char buff[17]; char buff[17];
iarg = va_arg(args, long); iarg = va_arg(args, long);
if (*++fmt == 'd') if (*++fmt == 'd')
length= (uint) (int10_to_str(iarg,buff, -10) - buff); length2= (uint) (int10_to_str(iarg,buff, -10) - buff);
else else
length= (uint) (int10_to_str(iarg,buff,10)- buff); length2= (uint) (int10_to_str(iarg,buff,10)- buff);
out_length+=length; out_length+= length2;
if (my_b_write(info, buff, length)) if (my_b_write(info, buff, length2))
goto err; goto err;
} }
else else

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