Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
into a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1
This commit is contained in:
commit
cd75806b61
@ -2080,6 +2080,7 @@ storage/archive/.deps/ha_archive_la-azio.Plo
|
||||
storage/archive/.deps/ha_archive_la-ha_archive.Plo
|
||||
storage/archive/.deps/libarchive_a-azio.Po
|
||||
storage/archive/.deps/libarchive_a-ha_archive.Po
|
||||
storage/archive/archive_reader
|
||||
storage/archive/archive_test
|
||||
storage/bdb/*.ds?
|
||||
storage/bdb/*.vcproj
|
||||
|
@ -93,6 +93,10 @@ if [ "x$warning_mode" != "xpedantic" ]; then
|
||||
warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W"
|
||||
warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare"
|
||||
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="$warnings -Wunused-parameter"
|
||||
# C++ warnings
|
||||
@ -191,6 +195,12 @@ fi
|
||||
# (http://samba.org/ccache) is installed, use it.
|
||||
# We use 'grep' and hope 'grep' will work as expected
|
||||
# (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"
|
||||
then
|
||||
echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC"
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
# Need to disable ccache, or we loose the gcov-needed compiler output files.
|
||||
|
||||
USING_GCOV=1
|
||||
CCACHE_GCOV_VERSION_ENABLED=0
|
||||
if ccache -V > /dev/null 2>&1
|
||||
then
|
||||
@ -26,8 +27,10 @@ export LDFLAGS="-fprofile-arcs -ftest-coverage"
|
||||
# The -fprofile-arcs and -ftest-coverage options cause GCC to instrument the
|
||||
# code with profiling information used by gcov.
|
||||
# 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="$extra_configs $max_configs"
|
||||
c_warnings="$c_warnings $debug_extra_warnings"
|
||||
cxx_warnings="$cxx_warnings $debug_extra_warnings"
|
||||
|
||||
. "$path/FINISH.sh"
|
||||
|
@ -131,7 +131,7 @@ typedef enum enum_info_type INFO_TYPE;
|
||||
static MYSQL mysql; /* The connection */
|
||||
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,
|
||||
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,
|
||||
vertical=0, line_numbers=1, column_names=1,opt_html=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
|
||||
{"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.",
|
||||
(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 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},
|
||||
@ -898,7 +899,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
}
|
||||
break;
|
||||
case 'A':
|
||||
rehash= 0;
|
||||
opt_rehash= 0;
|
||||
break;
|
||||
case 'N':
|
||||
column_names= 0;
|
||||
@ -1756,15 +1757,17 @@ char *rindex(const char *s,int c)
|
||||
|
||||
static int reconnect(void)
|
||||
{
|
||||
/* purecov: begin tested */
|
||||
if (opt_reconnect)
|
||||
{
|
||||
put_info("No connection. Trying to reconnect...",INFO_INFO);
|
||||
(void) com_connect((String *) 0, 0);
|
||||
if (rehash)
|
||||
if (opt_rehash)
|
||||
com_rehash(NULL, NULL);
|
||||
}
|
||||
if (!connected)
|
||||
return put_info("Can't connect to the server\n",INFO_ERROR);
|
||||
/* purecov: end */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2933,7 +2936,7 @@ static int
|
||||
com_connect(String *buffer, char *line)
|
||||
{
|
||||
char *tmp, buff[256];
|
||||
bool save_rehash= rehash;
|
||||
bool save_rehash= opt_rehash;
|
||||
int error;
|
||||
|
||||
bzero(buff, sizeof(buff));
|
||||
@ -2957,13 +2960,16 @@ com_connect(String *buffer, char *line)
|
||||
}
|
||||
}
|
||||
else
|
||||
rehash= 0; // Quick re-connect
|
||||
{
|
||||
/* Quick re-connect */
|
||||
opt_rehash= 0; /* purecov: tested */
|
||||
}
|
||||
buffer->length(0); // command used
|
||||
}
|
||||
else
|
||||
rehash= 0;
|
||||
opt_rehash= 0;
|
||||
error=sql_connect(current_host,current_db,current_user,opt_password,0);
|
||||
rehash= save_rehash;
|
||||
opt_rehash= save_rehash;
|
||||
|
||||
if (connected)
|
||||
{
|
||||
@ -3125,7 +3131,7 @@ com_use(String *buffer __attribute__((unused)), char *line)
|
||||
current_db=my_strdup(tmp,MYF(MY_WME));
|
||||
#ifdef HAVE_READLINE
|
||||
if (select_db > 1)
|
||||
build_completion_hash(rehash, 1);
|
||||
build_completion_hash(opt_rehash, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -3279,7 +3285,7 @@ sql_real_connect(char *host,char *database,char *user,char *password,
|
||||
mysql.reconnect= 1;
|
||||
#endif
|
||||
#ifdef HAVE_READLINE
|
||||
build_completion_hash(rehash, 1);
|
||||
build_completion_hash(opt_rehash, 1);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@ -3324,8 +3330,8 @@ static int
|
||||
com_status(String *buffer __attribute__((unused)),
|
||||
char *line __attribute__((unused)))
|
||||
{
|
||||
const char *status;
|
||||
char buff[22];
|
||||
const char *status_str;
|
||||
char buff[40];
|
||||
ulonglong id;
|
||||
MYSQL_RES *result;
|
||||
LINT_INIT(result);
|
||||
@ -3351,9 +3357,9 @@ com_status(String *buffer __attribute__((unused)),
|
||||
mysql_free_result(result);
|
||||
}
|
||||
#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",
|
||||
status);
|
||||
status_str);
|
||||
else
|
||||
#endif /* HAVE_OPENSSL */
|
||||
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");
|
||||
#endif
|
||||
|
||||
if ((status=mysql_stat(&mysql)) && !mysql_error(&mysql)[0])
|
||||
if ((status_str= mysql_stat(&mysql)) && !mysql_error(&mysql)[0])
|
||||
{
|
||||
ulong sec;
|
||||
char buff[40];
|
||||
const char *pos= strchr(status,' ');
|
||||
const char *pos= strchr(status_str,' ');
|
||||
/* print label */
|
||||
tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status), status);
|
||||
if ((status=str2int(pos,10,0,LONG_MAX,(long*) &sec)))
|
||||
tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status_str), status_str);
|
||||
if ((status_str= str2int(pos,10,0,LONG_MAX,(long*) &sec)))
|
||||
{
|
||||
nice_time((double) sec,buff,0);
|
||||
tee_puts(buff, stdout); /* print nice time */
|
||||
while (*status == ' ') status++; /* to next info */
|
||||
}
|
||||
if (status)
|
||||
{
|
||||
while (*status_str == ' ')
|
||||
status_str++; /* to next info */
|
||||
tee_putc('\n', stdout);
|
||||
tee_puts(status, stdout);
|
||||
tee_puts(status_str, stdout);
|
||||
}
|
||||
}
|
||||
if (safe_updates)
|
||||
@ -3448,7 +3451,7 @@ select_limit, max_join_size);
|
||||
}
|
||||
|
||||
static const char *
|
||||
server_version_string(MYSQL *mysql)
|
||||
server_version_string(MYSQL *con)
|
||||
{
|
||||
static char buf[MAX_SERVER_VERSION_LENGTH] = "";
|
||||
|
||||
@ -3458,11 +3461,11 @@ server_version_string(MYSQL *mysql)
|
||||
char *bufp = buf;
|
||||
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 */
|
||||
if (!mysql_query(mysql, "select @@version_comment limit 1") &&
|
||||
(result = mysql_use_result(mysql)))
|
||||
if (!mysql_query(con, "select @@version_comment limit 1") &&
|
||||
(result = mysql_use_result(con)))
|
||||
{
|
||||
MYSQL_ROW cur = mysql_fetch_row(result);
|
||||
if (cur && cur[0])
|
||||
@ -3552,10 +3555,10 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate)
|
||||
|
||||
|
||||
static int
|
||||
put_error(MYSQL *mysql)
|
||||
put_error(MYSQL *con)
|
||||
{
|
||||
return put_info(mysql_error(mysql), INFO_ERROR, mysql_errno(mysql),
|
||||
mysql_sqlstate(mysql));
|
||||
return put_info(mysql_error(con), INFO_ERROR, mysql_errno(con),
|
||||
mysql_sqlstate(con));
|
||||
}
|
||||
|
||||
|
||||
@ -3802,8 +3805,6 @@ static const char* construct_prompt()
|
||||
break;
|
||||
case 'D':
|
||||
char* dateTime;
|
||||
time_t lclock;
|
||||
lclock = time(NULL);
|
||||
dateTime = ctime(&lclock);
|
||||
processed_prompt.append(strtok(dateTime,"\n"));
|
||||
break;
|
||||
|
@ -449,9 +449,9 @@ int main(int argc, char **argv)
|
||||
|
||||
char *forced_defaults_file;
|
||||
char *forced_extra_defaults;
|
||||
char *defaults_group_suffix;
|
||||
char *local_defaults_group_suffix;
|
||||
const char *script_line;
|
||||
char *upgrade_defaults_path;
|
||||
char *upgrade_defaults_path= 0;
|
||||
char *defaults_to_use= NULL;
|
||||
int upgrade_defaults_created= 0;
|
||||
|
||||
@ -466,7 +466,7 @@ int main(int argc, char **argv)
|
||||
/* Check if we are forced to use specific defaults */
|
||||
get_defaults_options(argc, argv,
|
||||
&forced_defaults_file, &forced_extra_defaults,
|
||||
&defaults_group_suffix);
|
||||
&local_defaults_group_suffix);
|
||||
|
||||
load_defaults("my", load_default_groups, &argc, &argv);
|
||||
|
||||
|
@ -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()
|
||||
(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,
|
||||
const char* logname);
|
||||
static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
|
||||
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, ...);
|
||||
static void die(const char* fmt, ...) __attribute__ ((__noreturn__));
|
||||
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);
|
||||
|
||||
// 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))
|
||||
break; // Error
|
||||
@ -638,9 +637,10 @@ Create_file event for file_id: %u\n",exv->file_id);
|
||||
break;
|
||||
}
|
||||
case FORMAT_DESCRIPTION_EVENT:
|
||||
delete description_event;
|
||||
description_event= (Format_description_log_event*) ev;
|
||||
print_event_info->common_header_len= description_event->common_header_len;
|
||||
delete glob_description_event;
|
||||
glob_description_event= (Format_description_log_event*) ev;
|
||||
print_event_info->common_header_len=
|
||||
glob_description_event->common_header_len;
|
||||
ev->print(result_file, print_event_info);
|
||||
/*
|
||||
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;
|
||||
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;
|
||||
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
|
||||
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
|
||||
**description_event)
|
||||
{
|
||||
@ -1045,26 +1045,31 @@ static int check_master_version(MYSQL* mysql,
|
||||
MYSQL_ROW row;
|
||||
const char* version;
|
||||
|
||||
if (mysql_query(mysql, "SELECT VERSION()") ||
|
||||
!(res = mysql_store_result(mysql)))
|
||||
if (mysql_query(mysql_arg, "SELECT VERSION()") ||
|
||||
!(res = mysql_store_result(mysql_arg)))
|
||||
{
|
||||
/* purecov: begin inspected */
|
||||
char errmsg[256];
|
||||
strmake(errmsg, mysql_error(mysql), sizeof(errmsg)-1);
|
||||
mysql_close(mysql);
|
||||
strmake(errmsg, mysql_error(mysql_arg), sizeof(errmsg)-1);
|
||||
mysql_close(mysql_arg);
|
||||
die("Error checking master version: %s", errmsg);
|
||||
/* purecov: end */
|
||||
}
|
||||
if (!(row = mysql_fetch_row(res)))
|
||||
{
|
||||
/* purecov: begin inspected */
|
||||
mysql_free_result(res);
|
||||
mysql_close(mysql);
|
||||
die("Master returned no rows for SELECT VERSION()");
|
||||
return 1;
|
||||
/* purecov: end */
|
||||
}
|
||||
if (!(version = row[0]))
|
||||
{
|
||||
/* purecov: begin inspected */
|
||||
mysql_free_result(res);
|
||||
mysql_close(mysql);
|
||||
mysql_close(mysql_arg);
|
||||
die("Master reported NULL for the version");
|
||||
/* purecov: end */
|
||||
}
|
||||
|
||||
switch (*version) {
|
||||
@ -1083,11 +1088,11 @@ static int check_master_version(MYSQL* mysql,
|
||||
*description_event= new Format_description_log_event(3);
|
||||
break;
|
||||
default:
|
||||
sql_print_error("Master reported unrecognized MySQL version '%s'",
|
||||
version);
|
||||
/* purecov: begin inspected */
|
||||
mysql_free_result(res);
|
||||
mysql_close(mysql);
|
||||
return 1;
|
||||
mysql_close(mysql_arg);
|
||||
die("Master reported unrecognized MySQL version '%s'", version);
|
||||
/* purecov: end */
|
||||
}
|
||||
mysql_free_result(res);
|
||||
return 0;
|
||||
@ -1115,12 +1120,12 @@ static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
|
||||
mysql= safe_connect();
|
||||
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");
|
||||
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; \
|
||||
could be out of memory");
|
||||
@ -1170,7 +1175,7 @@ could be out of memory");
|
||||
len, net->read_pos[5]));
|
||||
if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 ,
|
||||
len - 1, &error_msg,
|
||||
description_event)))
|
||||
glob_description_event)))
|
||||
{
|
||||
fprintf(stderr, "Could not construct log event object\n");
|
||||
error= 1;
|
||||
@ -1178,7 +1183,7 @@ could be out of memory");
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
/*
|
||||
@ -1384,7 +1389,7 @@ static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
|
||||
my_close(fd, MYF(MY_WME));
|
||||
return 1;
|
||||
}
|
||||
check_header(file, &description_event);
|
||||
check_header(file, &glob_description_event);
|
||||
}
|
||||
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,
|
||||
0, MYF(MY_WME | MY_NABP | MY_DONT_CHECK_FILESIZE)))
|
||||
return 1;
|
||||
check_header(file, &description_event);
|
||||
check_header(file, &glob_description_event);
|
||||
if (start_position)
|
||||
{
|
||||
/* 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");
|
||||
|
||||
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];
|
||||
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 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.
|
||||
*/
|
||||
if (description_event->flags & LOG_EVENT_BINLOG_IN_USE_F)
|
||||
if (glob_description_event->flags & LOG_EVENT_BINLOG_IN_USE_F)
|
||||
file->error= 0;
|
||||
else if (file->error)
|
||||
{
|
||||
@ -1469,7 +1474,7 @@ end:
|
||||
if (fd >= 0)
|
||||
my_close(fd, MYF(MY_WME));
|
||||
end_io_cache(file);
|
||||
delete description_event;
|
||||
delete glob_description_event;
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ static char compatible_mode_normal_str[255];
|
||||
static ulong opt_compatible_mode= 0;
|
||||
#define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1
|
||||
#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 int first_error=0;
|
||||
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;
|
||||
int i;
|
||||
ulong mode;
|
||||
uint err_len;
|
||||
|
||||
opt_quoted= 1;
|
||||
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.
|
||||
*/
|
||||
static void DB_error(MYSQL *mysql, const char *when)
|
||||
static void DB_error(MYSQL *mysql_arg, const char *when)
|
||||
{
|
||||
DBUG_ENTER("DB_error");
|
||||
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);
|
||||
safe_exit(EX_MYSQLERR);
|
||||
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)
|
||||
xml_file - output file
|
||||
sbeg - line beginning
|
||||
send - line ending
|
||||
line_end - line ending
|
||||
tag_name - XML tag name.
|
||||
first_attribute_name - tag and 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.
|
||||
*/
|
||||
|
||||
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* 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);
|
||||
|
||||
fputc('>', xml_file);
|
||||
fputs(send, xml_file);
|
||||
fputs(line_end, 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
|
||||
stag_atr - tag and attribute
|
||||
sval - value of attribute
|
||||
send - line ending
|
||||
line_end - line ending
|
||||
|
||||
DESCRIPTION
|
||||
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,
|
||||
const char* stag_atr, const char* sval,
|
||||
const char* send)
|
||||
const char* line_end)
|
||||
{
|
||||
fputs(sbeg, xml_file);
|
||||
fputs("<", xml_file);
|
||||
@ -1299,7 +1301,7 @@ static void print_xml_null_tag(FILE * xml_file, const char* sbeg,
|
||||
fputs("\"", xml_file);
|
||||
print_quoted_xml(xml_file, sval, strlen(sval));
|
||||
fputs("\" xsi:nil=\"true\" />", xml_file);
|
||||
fputs(send, xml_file);
|
||||
fputs(line_end, 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_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);
|
||||
dynstr_free(&where);
|
||||
return r;
|
||||
@ -2906,7 +2908,7 @@ static int dump_tablespaces_for_databases(char** databases)
|
||||
dynstr_trunc(&where, 1);
|
||||
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);
|
||||
dynstr_free(&where);
|
||||
return r;
|
||||
@ -2918,7 +2920,7 @@ static int dump_tablespaces(char* ts_where)
|
||||
MYSQL_RES *tableres;
|
||||
char buf[FN_REFLEN];
|
||||
DYNAMIC_STRING sqlbuf;
|
||||
int first;
|
||||
int first= 0;
|
||||
/*
|
||||
The following are used for parsing the EXTRA field
|
||||
*/
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
|
||||
/* Global Thread counter */
|
||||
int counter;
|
||||
uint counter;
|
||||
#ifdef HAVE_LIBPTHREAD
|
||||
pthread_mutex_t counter_mutex;
|
||||
pthread_cond_t count_threshhold;
|
||||
|
@ -84,11 +84,11 @@ enum {
|
||||
};
|
||||
|
||||
static int record= 0, opt_sleep= -1;
|
||||
static char *db= 0, *pass= 0;
|
||||
const char *user= 0, *host= 0, *unix_sock= 0, *opt_basedir= "./";
|
||||
static char *opt_db= 0, *opt_pass= 0;
|
||||
const char *opt_user= 0, *opt_host= 0, *unix_sock= 0, *opt_basedir= "./";
|
||||
const char *opt_logdir= "";
|
||||
const char *opt_include= 0, *opt_charsets_dir;
|
||||
static int port= 0;
|
||||
static int opt_port= 0;
|
||||
static int opt_max_connect_retries;
|
||||
static my_bool opt_compress= 0, silent= 0, verbose= 0;
|
||||
static my_bool tty_password= 0;
|
||||
@ -610,15 +610,14 @@ void check_command_args(struct st_command *command,
|
||||
int i;
|
||||
const char *ptr= arguments;
|
||||
const char *start;
|
||||
|
||||
DBUG_ENTER("check_command_args");
|
||||
DBUG_PRINT("enter", ("num_args: %d", num_args));
|
||||
|
||||
for (i= 0; i < num_args; i++)
|
||||
{
|
||||
const struct command_arg *arg= &args[i];
|
||||
|
||||
switch (arg->type)
|
||||
{
|
||||
switch (arg->type) {
|
||||
/* A string */
|
||||
case ARG_STRING:
|
||||
/* Skip leading spaces */
|
||||
@ -783,7 +782,7 @@ void free_used_memory()
|
||||
dynstr_free(&ds_progress);
|
||||
dynstr_free(&ds_warning_messages);
|
||||
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_re();
|
||||
#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)
|
||||
{
|
||||
char* end = (char*)((query_end && *query_end) ?
|
||||
char *end = (char*)((query_end && *query_end) ?
|
||||
*query_end : query + strlen(query));
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
@ -1344,7 +1343,6 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
|
||||
DYNAMIC_STRING result;
|
||||
uint i;
|
||||
ulong *lengths;
|
||||
char *end;
|
||||
#ifdef NOT_YET
|
||||
MYSQL_FIELD *fields= mysql_fetch_fields(res);
|
||||
#endif
|
||||
@ -1847,7 +1845,7 @@ void do_copy_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_file;
|
||||
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)
|
||||
{
|
||||
DYNAMIC_STRING ds_echo;
|
||||
DBUG_ENTER("do_echo");
|
||||
|
||||
init_dynamic_string(&ds_echo, "", command->query_len, 256);
|
||||
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_free(&ds_echo);
|
||||
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 *var_name, *var_name_end;
|
||||
DYNAMIC_STRING let_rhs_expr;
|
||||
|
||||
DBUG_ENTER("do_let");
|
||||
|
||||
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)
|
||||
{
|
||||
int con_port= port;
|
||||
int con_port= opt_port;
|
||||
char *con_options;
|
||||
bool con_ssl= 0, con_compress= 0;
|
||||
char *ptr;
|
||||
@ -3248,13 +3246,12 @@ void do_connect(struct st_command *command)
|
||||
|
||||
/* Use default db name */
|
||||
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 */
|
||||
if (ds_database.length && !strcmp(ds_database.str,"*NO-ONE*"))
|
||||
dynstr_set(&ds_database, "");
|
||||
|
||||
|
||||
if (connect_n_handle_errors(command, &next_con->mysql,
|
||||
ds_host.str,ds_user.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)
|
||||
{
|
||||
int last_c_was_quote= 0;
|
||||
char *p= query, *write= query;
|
||||
char *p= query, *to= query;
|
||||
char *end= strend(query);
|
||||
char last_c;
|
||||
|
||||
@ -3686,7 +3683,7 @@ void convert_to_format_v1(char* query)
|
||||
{
|
||||
if (*p == '\n' && !last_c_was_quote)
|
||||
{
|
||||
*write++ = *p++; /* Save the newline */
|
||||
*to++ = *p++; /* Save the newline */
|
||||
|
||||
/* Skip any spaces on next line */
|
||||
while (*p && my_isspace(charset_info, *p))
|
||||
@ -3697,19 +3694,19 @@ void convert_to_format_v1(char* query)
|
||||
else if (*p == '\'' || *p == '"' || *p == '`')
|
||||
{
|
||||
last_c= *p;
|
||||
*write++ = *p++;
|
||||
*to++ = *p++;
|
||||
|
||||
/* Copy anything until the next quote of same type */
|
||||
while (*p && *p != last_c)
|
||||
*write++ = *p++;
|
||||
*to++ = *p++;
|
||||
|
||||
*write++ = *p++;
|
||||
*to++ = *p++;
|
||||
|
||||
last_c_was_quote= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*write++ = *p++;
|
||||
*to++ = *p++;
|
||||
last_c_was_quote= 0;
|
||||
}
|
||||
}
|
||||
@ -3827,19 +3824,17 @@ void check_eol_junk(const char *eol)
|
||||
Create a command from a set of lines
|
||||
|
||||
SYNOPSIS
|
||||
read_command()
|
||||
command_ptr pointer where to return the new query
|
||||
read_command()
|
||||
command_ptr pointer where to return the new query
|
||||
|
||||
DESCRIPTION
|
||||
Converts lines returned by read_line into a command, this involves
|
||||
parsing the first word in the read line to find the command type.
|
||||
|
||||
Converts lines returned by read_line into a command, this involves
|
||||
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
|
||||
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
|
||||
terminated by new line '\n' regardless how many "delimiter" it contain.
|
||||
|
||||
*/
|
||||
|
||||
#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.",
|
||||
(gptr*) &cursor_protocol, (gptr*) &cursor_protocol, 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},
|
||||
#ifdef DBUG_OFF
|
||||
{"debug", '#', "This is a non-debug version. Catch this and exit",
|
||||
@ -3936,7 +3931,7 @@ static struct my_option my_long_options[] =
|
||||
#endif
|
||||
{"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},
|
||||
{"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},
|
||||
{"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},
|
||||
@ -3952,8 +3947,8 @@ static struct my_option my_long_options[] =
|
||||
GET_INT, REQUIRED_ARG, 500, 1, 10000, 0, 0, 0},
|
||||
{"password", 'p', "Password to use when connecting to server.",
|
||||
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"port", 'P', "Port number to use for connection.", (gptr*) &port,
|
||||
(gptr*) &port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_port,
|
||||
(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",
|
||||
(gptr*) &ps_protocol, (gptr*) &ps_protocol, 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},
|
||||
{"tmpdir", 't', "Temporary directory where sockets are put.",
|
||||
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,
|
||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"user", 'u', "User for login.", (gptr*) &opt_user, (gptr*) &opt_user, 0,
|
||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"verbose", 'v', "Write more.", (gptr*) &verbose, (gptr*) &verbose, 0,
|
||||
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"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':
|
||||
if (argument)
|
||||
{
|
||||
my_free(pass, MYF(MY_ALLOW_ZERO_PTR));
|
||||
pass= my_strdup(argument, MYF(MY_FAE));
|
||||
my_free(opt_pass, MYF(MY_ALLOW_ZERO_PTR));
|
||||
opt_pass= my_strdup(argument, MYF(MY_FAE));
|
||||
while (*argument) *argument++= 'x'; /* Destroy argument */
|
||||
tty_password= 0;
|
||||
}
|
||||
@ -4155,7 +4150,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
exit(0);
|
||||
case '?':
|
||||
usage();
|
||||
exit(1);
|
||||
exit(0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -4175,9 +4170,9 @@ int parse_args(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
if (argc == 1)
|
||||
db= *argv;
|
||||
opt_db= *argv;
|
||||
if (tty_password)
|
||||
pass=get_tty_password(NullS);
|
||||
opt_pass= get_tty_password(NullS); /* purify tested */
|
||||
|
||||
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,
|
||||
MYSQL_FIELD *fields, uint num_fields)
|
||||
{
|
||||
MYSQL_BIND *bind;
|
||||
MYSQL_BIND *my_bind;
|
||||
my_bool *is_null;
|
||||
ulong *length;
|
||||
uint i;
|
||||
|
||||
/* 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));
|
||||
length= (ulong*) my_malloc(num_fields * sizeof(ulong),
|
||||
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++)
|
||||
{
|
||||
uint max_length= fields[i].max_length + 1;
|
||||
bind[i].buffer_type= MYSQL_TYPE_STRING;
|
||||
bind[i].buffer= (char *)my_malloc(max_length, MYF(MY_WME | MY_FAE));
|
||||
bind[i].buffer_length= max_length;
|
||||
bind[i].is_null= &is_null[i];
|
||||
bind[i].length= &length[i];
|
||||
my_bind[i].buffer_type= MYSQL_TYPE_STRING;
|
||||
my_bind[i].buffer= (char *)my_malloc(max_length, MYF(MY_WME | MY_FAE));
|
||||
my_bind[i].buffer_length= max_length;
|
||||
my_bind[i].is_null= &is_null[i];
|
||||
my_bind[i].length= &length[i];
|
||||
|
||||
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",
|
||||
mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
|
||||
|
||||
while (mysql_stmt_fetch(stmt) == 0)
|
||||
{
|
||||
for (i= 0; i < num_fields; i++)
|
||||
append_field(ds, i, &fields[i], (const char *) bind[i].buffer,
|
||||
*bind[i].length, *bind[i].is_null);
|
||||
append_field(ds, i, &fields[i], (const char *) my_bind[i].buffer,
|
||||
*my_bind[i].length, *my_bind[i].is_null);
|
||||
if (!display_result_vertically)
|
||||
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++)
|
||||
{
|
||||
/* 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 */
|
||||
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)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
|
||||
|
||||
SYNPOSIS
|
||||
run_query_normal
|
||||
mysql - mysql handle
|
||||
command - currrent command pointer
|
||||
flags -flags indicating wheter to SEND and/or REAP
|
||||
query - query string to execute
|
||||
query_len - length query string to execute
|
||||
ds - output buffer wherte to store result form query
|
||||
|
||||
RETURN VALUE
|
||||
error - function will not return
|
||||
SYNOPSIS
|
||||
run_query_normal()
|
||||
mysql mysql handle
|
||||
command current command pointer
|
||||
flags flags indicating if we should SEND and/or REAP
|
||||
query query string to execute
|
||||
query_len length query string to execute
|
||||
ds output buffer where to store result form query
|
||||
*/
|
||||
|
||||
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
|
||||
|
||||
SYNPOSIS
|
||||
run_query()
|
||||
mysql mysql handle
|
||||
command currrent command pointer
|
||||
|
||||
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
|
||||
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)
|
||||
@ -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 complete_query= ((flags & QUERY_SEND_FLAG) &&
|
||||
(flags & QUERY_REAP_FLAG));
|
||||
DBUG_ENTER("run_query");
|
||||
|
||||
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])
|
||||
{
|
||||
|
||||
/* A result file was specified for _this_ query
|
||||
and the output should be checked against an already
|
||||
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);
|
||||
if (command->type == Q_EVAL)
|
||||
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))))
|
||||
die("Out of memory");
|
||||
|
||||
safe_connect(&cur_con->mysql, cur_con->name, host, user, pass,
|
||||
db, port, unix_sock);
|
||||
safe_connect(&cur_con->mysql, cur_con->name, opt_host, opt_user, opt_pass,
|
||||
opt_db, opt_port, unix_sock);
|
||||
|
||||
/* Use all time until exit if no explicit 'start_timer' */
|
||||
timer_start= timer_now();
|
||||
@ -6080,8 +6072,6 @@ int main(int argc, char **argv)
|
||||
if (result_file_name && ds_warning_messages.length)
|
||||
dump_warning_messages();
|
||||
|
||||
dynstr_free(&ds_res);
|
||||
|
||||
timer_output();
|
||||
free_used_memory();
|
||||
my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);
|
||||
|
@ -247,6 +247,10 @@ bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *cs)
|
||||
0 No conversion needed
|
||||
1 Either character set conversion or adding leading zeros
|
||||
(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,
|
||||
@ -255,7 +259,8 @@ bool String::needs_conversion(uint32 arg_length,
|
||||
uint32 *offset)
|
||||
{
|
||||
*offset= 0;
|
||||
if ((to_cs == &my_charset_bin) ||
|
||||
if (!to_cs ||
|
||||
(to_cs == &my_charset_bin) ||
|
||||
(to_cs == from_cs) ||
|
||||
my_charset_same(from_cs, to_cs) ||
|
||||
((from_cs == &my_charset_bin) &&
|
||||
@ -612,27 +617,26 @@ skip:
|
||||
}
|
||||
|
||||
/*
|
||||
** replace substring with string
|
||||
** If wrong parameter or not enough memory, do nothing
|
||||
Replace substring with string
|
||||
If wrong parameter or not enough memory, do nothing
|
||||
*/
|
||||
|
||||
|
||||
bool String::replace(uint32 offset,uint32 arg_length,const String &to)
|
||||
{
|
||||
return replace(offset,arg_length,to.ptr(),to.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 (diff < 0)
|
||||
{
|
||||
if (length)
|
||||
memcpy(Ptr+offset,to,length);
|
||||
bmove(Ptr+offset+length,Ptr+offset+arg_length,
|
||||
if (to_length)
|
||||
memcpy(Ptr+offset,to,to_length);
|
||||
bmove(Ptr+offset+to_length,Ptr+offset+arg_length,
|
||||
str_length-offset-arg_length);
|
||||
}
|
||||
else
|
||||
@ -644,8 +648,8 @@ bool String::replace(uint32 offset,uint32 arg_length,
|
||||
bmove_upp(Ptr+str_length+diff,Ptr+str_length,
|
||||
str_length-offset-arg_length);
|
||||
}
|
||||
if (length)
|
||||
memcpy(Ptr+offset,to,length);
|
||||
if (to_length)
|
||||
memcpy(Ptr+offset,to,to_length);
|
||||
}
|
||||
str_length+=(uint32) diff;
|
||||
}
|
||||
@ -818,8 +822,18 @@ copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
|
||||
from++;
|
||||
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
|
||||
break; // Impossible char.
|
||||
break; // Not enough characters
|
||||
|
||||
outp:
|
||||
if ((cnvres= (*wc_mb)(to_cs, wc, (uchar*) to, to_end)) > 0)
|
||||
@ -847,22 +861,22 @@ void String::print(String *str)
|
||||
switch (c)
|
||||
{
|
||||
case '\\':
|
||||
str->append("\\\\", 2);
|
||||
str->append(STRING_WITH_LEN("\\\\"));
|
||||
break;
|
||||
case '\0':
|
||||
str->append("\\0", 2);
|
||||
str->append(STRING_WITH_LEN("\\0"));
|
||||
break;
|
||||
case '\'':
|
||||
str->append("\\'", 2);
|
||||
str->append(STRING_WITH_LEN("\\'"));
|
||||
break;
|
||||
case '\n':
|
||||
str->append("\\n", 2);
|
||||
str->append(STRING_WITH_LEN("\\n"));
|
||||
break;
|
||||
case '\r':
|
||||
str->append("\\r", 2);
|
||||
str->append(STRING_WITH_LEN("\\r"));
|
||||
break;
|
||||
case 26: //Ctrl-Z
|
||||
str->append("\\z", 2);
|
||||
str->append(STRING_WITH_LEN("\\z"));
|
||||
break;
|
||||
default:
|
||||
str->append(c);
|
||||
|
@ -23,6 +23,8 @@
|
||||
#define NOT_FIXED_DEC 31
|
||||
#endif
|
||||
|
||||
#define STRING_WITH_LEN(X) ((const char*) X), ((uint) (sizeof(X) - 1))
|
||||
|
||||
class String;
|
||||
int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
|
||||
String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
|
||||
@ -76,13 +78,15 @@ public:
|
||||
{ /* never called */ }
|
||||
~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 uint32 length() const { return str_length;}
|
||||
inline uint32 alloced_length() const { return Alloced_length;}
|
||||
inline char& operator [] (uint32 i) const { return Ptr[i]; }
|
||||
inline void length(uint32 len) { str_length=len ; }
|
||||
inline bool is_empty() { return (str_length == 0); }
|
||||
inline void mark_as_const() { Alloced_length= 0;}
|
||||
inline const char *ptr() const { return Ptr; }
|
||||
inline char *c_ptr()
|
||||
{
|
||||
|
@ -426,7 +426,7 @@ rl_redisplay ()
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
wchar_t wc;
|
||||
size_t wc_bytes;
|
||||
int wc_width;
|
||||
int wc_width= 0;
|
||||
mbstate_t ps;
|
||||
int _rl_wrapped_multicolumn = 0;
|
||||
#endif
|
||||
|
@ -560,12 +560,12 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
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);
|
||||
c = string[l];
|
||||
chr = string[l];
|
||||
/* XXX - original patch had i - 1 ??? If i == 0 it would fail. */
|
||||
if (i && (c == '\'' || c == '"'))
|
||||
quoted_search_delimiter = c;
|
||||
if (i && (chr == '\'' || chr == '"'))
|
||||
quoted_search_delimiter = chr;
|
||||
}
|
||||
else
|
||||
#endif /* HANDLE_MULTIBYTE */
|
||||
|
@ -529,17 +529,17 @@ _rl_read_mbchar (mbchar, size)
|
||||
may be FIRST. Used by the search functions, among others. Very similar
|
||||
to _rl_read_mbchar. */
|
||||
int
|
||||
_rl_read_mbstring (first, mb, mblen)
|
||||
_rl_read_mbstring (first, mb, mb_len)
|
||||
int first;
|
||||
char *mb;
|
||||
int mblen;
|
||||
int mb_len;
|
||||
{
|
||||
int i, c;
|
||||
mbstate_t ps;
|
||||
|
||||
c = first;
|
||||
memset (mb, 0, mblen);
|
||||
for (i = 0; i < mblen; i++)
|
||||
memset (mb, 0, mb_len);
|
||||
for (i = 0; i < mb_len; i++)
|
||||
{
|
||||
mb[i] = (char)c;
|
||||
memset (&ps, 0, sizeof (mbstate_t));
|
||||
|
@ -1002,12 +1002,12 @@ _rl_rubout_char (count, key)
|
||||
}
|
||||
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);
|
||||
c = rl_line_buffer[rl_point];
|
||||
rl_delete_text (rl_point, orig_point);
|
||||
rl_delete_text (rl_point, orig_point2);
|
||||
}
|
||||
#endif /* HANDLE_MULTIBYTE */
|
||||
|
||||
|
@ -672,7 +672,7 @@ _rl_vi_change_mbchar_case (count)
|
||||
{
|
||||
wchar_t wc;
|
||||
char mb[MB_LEN_MAX+1];
|
||||
int mblen;
|
||||
int local_mblen;
|
||||
mbstate_t ps;
|
||||
|
||||
memset (&ps, 0, sizeof (mbstate_t));
|
||||
@ -695,9 +695,9 @@ _rl_vi_change_mbchar_case (count)
|
||||
/* Vi is kind of strange here. */
|
||||
if (wc)
|
||||
{
|
||||
mblen = wcrtomb (mb, wc, &ps);
|
||||
if (mblen >= 0)
|
||||
mb[mblen] = '\0';
|
||||
local_mblen = wcrtomb (mb, wc, &ps);
|
||||
if (local_mblen >= 0)
|
||||
mb[local_mblen] = '\0';
|
||||
rl_begin_undo_group ();
|
||||
rl_delete (1, 0);
|
||||
rl_insert_text (mb);
|
||||
|
@ -970,7 +970,7 @@ case $SYSTEM_TYPE in
|
||||
*darwin6*)
|
||||
if test "$ac_cv_prog_gcc" = "yes"
|
||||
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"
|
||||
CXXFLAGS="$CXXFLAGS $FLAGS"
|
||||
MAX_C_OPTIMIZE="-O"
|
||||
|
@ -309,7 +309,7 @@ FILE *inf;
|
||||
unsigned long fn_ssz;
|
||||
unsigned long lastuse;
|
||||
unsigned int pos;
|
||||
unsigned long time;
|
||||
unsigned long local_time;
|
||||
unsigned int oldpos;
|
||||
unsigned long oldtime;
|
||||
unsigned long oldchild;
|
||||
@ -335,15 +335,15 @@ FILE *inf;
|
||||
*/
|
||||
while (pop (&oldpos, &oldtime, &oldchild)) {
|
||||
DBUG_PRINT ("popped", ("%lu %lu", oldtime, oldchild));
|
||||
time = fn_time - oldtime;
|
||||
local_time = fn_time - oldtime;
|
||||
t = top ();
|
||||
t -> children += time;
|
||||
t -> children += local_time;
|
||||
DBUG_PRINT ("update", ("%s", modules[t -> pos].name));
|
||||
DBUG_PRINT ("update", ("%lu", t -> children));
|
||||
time -= oldchild;
|
||||
modules[oldpos].m_time += time;
|
||||
local_time -= oldchild;
|
||||
modules[oldpos].m_time += local_time;
|
||||
modules[oldpos].m_calls++;
|
||||
tot_time += time;
|
||||
tot_time += local_time;
|
||||
tot_calls++;
|
||||
if (pos == oldpos) {
|
||||
goto next_line; /* Should be a break2 */
|
||||
@ -355,11 +355,11 @@ FILE *inf;
|
||||
* it so that it works the next time too.
|
||||
*/
|
||||
t = top ();
|
||||
time = fn_time - t -> time - t -> children;
|
||||
local_time = fn_time - t -> time - t -> children;
|
||||
t -> time = fn_time; t -> children = 0;
|
||||
modules[pos].m_time += time;
|
||||
modules[pos].m_time += local_time;
|
||||
modules[pos].m_calls++;
|
||||
tot_time += time;
|
||||
tot_time += local_time;
|
||||
tot_calls++;
|
||||
break;
|
||||
case 'S':
|
||||
@ -405,13 +405,13 @@ FILE *inf;
|
||||
* time of fn_time.
|
||||
*/
|
||||
while (pop (&oldpos,&oldtime,&oldchild)) {
|
||||
time = fn_time - oldtime;
|
||||
local_time = fn_time - oldtime;
|
||||
t = top ();
|
||||
t -> children += time;
|
||||
time -= oldchild;
|
||||
modules[oldpos].m_time += time;
|
||||
t -> children += local_time;
|
||||
local_time -= oldchild;
|
||||
modules[oldpos].m_time += local_time;
|
||||
modules[oldpos].m_calls++;
|
||||
tot_time += time;
|
||||
tot_time += local_time;
|
||||
tot_calls++;
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
@ -472,17 +472,17 @@ unsigned long int *called, *timed;
|
||||
{
|
||||
char *name = m -> name;
|
||||
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;
|
||||
unsigned int import;
|
||||
double per_time = 0.0;
|
||||
double per_calls = 0.0;
|
||||
double ms_per_call, ftime;
|
||||
double ms_per_call, local_ftime;
|
||||
|
||||
DBUG_ENTER ("out_item");
|
||||
|
||||
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) {
|
||||
per_calls = (double) (calls * 100) / (double) tot_calls;
|
||||
@ -491,18 +491,18 @@ unsigned long int *called, *timed;
|
||||
|
||||
if (verbose) {
|
||||
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 {
|
||||
ms_per_call = time;
|
||||
ms_per_call = local_time;
|
||||
ms_per_call /= calls;
|
||||
ftime = time;
|
||||
ftime /= 1000;
|
||||
local_ftime = local_time;
|
||||
local_ftime /= 1000;
|
||||
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);
|
||||
}
|
||||
*called = calls;
|
||||
*timed = time;
|
||||
*timed = local_time;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@ -517,7 +517,7 @@ FILE *outf;
|
||||
register unsigned int root;
|
||||
register unsigned long int *s_calls, *s_time;
|
||||
{
|
||||
unsigned long int calls, time;
|
||||
unsigned long int calls, local_time;
|
||||
|
||||
DBUG_ENTER ("out_body");
|
||||
DBUG_PRINT ("out_body", ("%lu,%lu",*s_calls,*s_time));
|
||||
@ -526,10 +526,10 @@ register unsigned long int *s_calls, *s_time;
|
||||
} else {
|
||||
while (root != MAXPROCS) {
|
||||
out_body (outf, s_table[root].lchild,s_calls,s_time);
|
||||
out_item (outf, &modules[s_table[root].pos],&calls,&time);
|
||||
DBUG_PRINT ("out_body", ("-- %lu -- %lu --", calls, time));
|
||||
out_item (outf, &modules[s_table[root].pos],&calls,&local_time);
|
||||
DBUG_PRINT ("out_body", ("-- %lu -- %lu --", calls, local_time));
|
||||
*s_calls += calls;
|
||||
*s_time += time;
|
||||
*s_time += local_time;
|
||||
root = s_table[root].rchild;
|
||||
}
|
||||
DBUG_PRINT ("out_body", ("%lu,%lu", *s_calls, *s_time));
|
||||
|
@ -48,15 +48,16 @@ static struct my_option my_long_options[] =
|
||||
0, 0, 0, 0, 0, 0},
|
||||
{"defaults-extra-file", 'e',
|
||||
"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,
|
||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
(gptr*) &my_defaults_extra_file, (gptr*) &my_defaults_extra_file, 0,
|
||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"defaults-group-suffix", 'g',
|
||||
"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},
|
||||
{"extra-file", 'e',
|
||||
"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},
|
||||
{"no-defaults", 'n', "Return an empty string (useful for scripts).",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
@ -56,11 +56,13 @@ const uint AUTO = 0xFEEDBEEF;
|
||||
// Checking Policy should implement a check function that tests whether the
|
||||
// index is within the size limit of the array
|
||||
struct Check {
|
||||
Check() {}
|
||||
void check(uint i, uint limit);
|
||||
};
|
||||
|
||||
|
||||
struct NoCheck {
|
||||
NoCheck() {}
|
||||
void check(uint, uint);
|
||||
};
|
||||
|
||||
@ -198,6 +200,7 @@ inline void checked_delete(T* p)
|
||||
// sets pointer to zero so safe for std conatiners
|
||||
struct del_ptr_zero
|
||||
{
|
||||
del_ptr_zero() {}
|
||||
template <typename T>
|
||||
void operator()(T*& p) const
|
||||
{
|
||||
|
@ -49,6 +49,7 @@ namespace yaSSL {
|
||||
// Digest policy should implement a get_digest, update, and get sizes for pad
|
||||
// and digest
|
||||
struct Digest : public virtual_base {
|
||||
Digest() {}
|
||||
virtual void get_digest(byte*) = 0;
|
||||
virtual void get_digest(byte*, const byte*, unsigned int) = 0;
|
||||
virtual void update(const byte*, unsigned int) = 0;
|
||||
@ -60,6 +61,7 @@ struct Digest : public virtual_base {
|
||||
|
||||
// For use with NULL Digests
|
||||
struct NO_MAC : public Digest {
|
||||
NO_MAC() {}
|
||||
void get_digest(byte*);
|
||||
void get_digest(byte*, const byte*, unsigned int);
|
||||
void update(const byte*, unsigned int);
|
||||
@ -184,6 +186,7 @@ private:
|
||||
// BulkCipher policy should implement encrypt, decrypt, get block size,
|
||||
// and set keys for encrypt and decrypt
|
||||
struct BulkCipher : public virtual_base {
|
||||
BulkCipher() {}
|
||||
virtual void encrypt(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;
|
||||
@ -197,6 +200,7 @@ struct BulkCipher : public virtual_base {
|
||||
|
||||
// For use with NULL Ciphers
|
||||
struct NO_Cipher : public BulkCipher {
|
||||
NO_Cipher() {}
|
||||
void encrypt(byte*, const byte*, unsigned int) {}
|
||||
void decrypt(byte*, const byte*, unsigned int) {}
|
||||
void set_encryptKey(const byte*, const byte*) {}
|
||||
@ -318,12 +322,14 @@ struct Auth : public virtual_base {
|
||||
virtual bool verify(const byte*, unsigned int, const byte*,
|
||||
unsigned int) = 0;
|
||||
virtual uint get_signatureLength() const = 0;
|
||||
Auth() {}
|
||||
virtual ~Auth() {}
|
||||
};
|
||||
|
||||
|
||||
// For use with NULL Authentication schemes
|
||||
struct NO_Auth : public Auth {
|
||||
NO_Auth() {}
|
||||
void sign(byte*, const byte*, unsigned int, const RandomPool&) {}
|
||||
bool verify(const byte*, unsigned int, const byte*, unsigned int)
|
||||
{ return true; }
|
||||
|
@ -71,6 +71,7 @@ struct RecordLayerHeader {
|
||||
|
||||
// base for all messages
|
||||
struct Message : public virtual_base {
|
||||
Message() {}
|
||||
virtual input_buffer& set(input_buffer&) =0;
|
||||
virtual output_buffer& get(output_buffer&) const =0;
|
||||
|
||||
@ -184,6 +185,7 @@ private:
|
||||
class HandShakeBase : public virtual_base {
|
||||
int length_;
|
||||
public:
|
||||
HandShakeBase() {}
|
||||
int get_length() const;
|
||||
void set_length(int);
|
||||
|
||||
@ -201,6 +203,7 @@ public:
|
||||
|
||||
|
||||
struct HelloRequest : public HandShakeBase {
|
||||
HelloRequest() {}
|
||||
input_buffer& set(input_buffer& in);
|
||||
output_buffer& get(output_buffer& out) const;
|
||||
|
||||
@ -334,6 +337,7 @@ private:
|
||||
|
||||
|
||||
struct ServerKeyBase : public virtual_base {
|
||||
ServerKeyBase() {}
|
||||
virtual ~ServerKeyBase() {}
|
||||
virtual void build(SSL&) {}
|
||||
virtual void read(SSL&, input_buffer&) {}
|
||||
@ -344,15 +348,21 @@ struct ServerKeyBase : public virtual_base {
|
||||
|
||||
// Server random number for FORTEZZA KEA
|
||||
struct Fortezza_Server : public ServerKeyBase {
|
||||
Fortezza_Server() {}
|
||||
opaque r_s_[FORTEZZA_MAX];
|
||||
};
|
||||
|
||||
|
||||
struct SignatureBase : public virtual_base {
|
||||
SignatureBase() {}
|
||||
virtual ~SignatureBase() {}
|
||||
};
|
||||
|
||||
struct anonymous_sa : public SignatureBase {};
|
||||
struct anonymous_sa : public SignatureBase
|
||||
{
|
||||
public:
|
||||
anonymous_sa() {}
|
||||
};
|
||||
|
||||
|
||||
struct Hashes {
|
||||
@ -362,11 +372,13 @@ struct Hashes {
|
||||
|
||||
|
||||
struct rsa_sa : public SignatureBase {
|
||||
rsa_sa() {}
|
||||
Hashes hashes_;
|
||||
};
|
||||
|
||||
|
||||
struct dsa_sa : public SignatureBase {
|
||||
dsa_sa() {}
|
||||
uint8 sha_[SHA_LEN];
|
||||
};
|
||||
|
||||
@ -394,6 +406,7 @@ private:
|
||||
|
||||
// Server's RSA exchange
|
||||
struct RSA_Server : public ServerKeyBase {
|
||||
RSA_Server() {}
|
||||
ServerRSAParams params_;
|
||||
opaque* signature_; // signed rsa_sa hashes
|
||||
};
|
||||
@ -468,6 +481,7 @@ struct PreMasterSecret {
|
||||
|
||||
|
||||
struct ClientKeyBase : public virtual_base {
|
||||
ClientKeyBase() {}
|
||||
virtual ~ClientKeyBase() {}
|
||||
virtual void build(SSL&) {}
|
||||
virtual void read(SSL&, input_buffer&) {}
|
||||
@ -498,6 +512,7 @@ private:
|
||||
// Fortezza Key Parameters from page 29
|
||||
// hard code lengths cause only used here
|
||||
struct FortezzaKeys : public ClientKeyBase {
|
||||
FortezzaKeys() {}
|
||||
opaque y_c_ [128]; // client's Yc, public value
|
||||
opaque r_c_ [128]; // client's Rc
|
||||
opaque y_signature_ [40]; // DSS signed public key
|
||||
|
@ -235,6 +235,7 @@ struct BIGNUM {
|
||||
TaoCrypt::Integer), we need to explicitly state the namespace
|
||||
here to let gcc 2.96 deduce the correct type.
|
||||
*/
|
||||
BIGNUM() {}
|
||||
yaSSL::Integer int_;
|
||||
void assign(const byte* b, uint s) { int_.assign(b,s); }
|
||||
};
|
||||
|
@ -557,6 +557,7 @@ void RandomPool::Fill(opaque* dst, uint sz) const
|
||||
|
||||
// Implementation of DSS Authentication
|
||||
struct DSS::DSSImpl {
|
||||
DSSImpl() {}
|
||||
void SetPublic (const byte*, unsigned int);
|
||||
void SetPrivate(const byte*, unsigned int);
|
||||
TaoCrypt::DSA_PublicKey publicKey_;
|
||||
@ -629,6 +630,7 @@ bool DSS::verify(const byte* sha_digest, unsigned int /* shaSz */,
|
||||
|
||||
// Implementation of RSA key interface
|
||||
struct RSA::RSAImpl {
|
||||
RSAImpl() {}
|
||||
void SetPublic (const byte*, unsigned int);
|
||||
void SetPrivate(const byte*, unsigned int);
|
||||
TaoCrypt::RSA_PublicKey publicKey_;
|
||||
|
@ -65,7 +65,7 @@ int main(int argc, char** argv)
|
||||
|
||||
const int megs = 5; // how much to test
|
||||
|
||||
const byte key[] =
|
||||
const byte global_key[] =
|
||||
{
|
||||
0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
|
||||
0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10,
|
||||
@ -81,19 +81,19 @@ const byte iv[] =
|
||||
};
|
||||
|
||||
|
||||
byte plain [1024*1024];
|
||||
byte cipher[1024*1024];
|
||||
byte global_plain [1024*1024];
|
||||
byte global_cipher[1024*1024];
|
||||
|
||||
|
||||
void bench_des()
|
||||
{
|
||||
DES_EDE3_CBC_Encryption enc;
|
||||
enc.SetKey(key, 16, iv);
|
||||
enc.SetKey(global_key, 16, iv);
|
||||
|
||||
double start = current_time();
|
||||
|
||||
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;
|
||||
|
||||
@ -107,12 +107,12 @@ void bench_des()
|
||||
void bench_aes(bool show)
|
||||
{
|
||||
AES_CBC_Encryption enc;
|
||||
enc.SetKey(key, 16, iv);
|
||||
enc.SetKey(global_key, 16, iv);
|
||||
|
||||
double start = current_time();
|
||||
|
||||
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;
|
||||
|
||||
@ -127,12 +127,12 @@ void bench_aes(bool show)
|
||||
void bench_twofish()
|
||||
{
|
||||
Twofish_CBC_Encryption enc;
|
||||
enc.SetKey(key, 16, iv);
|
||||
enc.SetKey(global_key, 16, iv);
|
||||
|
||||
double start = current_time();
|
||||
|
||||
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;
|
||||
|
||||
@ -147,12 +147,12 @@ void bench_twofish()
|
||||
void bench_blowfish()
|
||||
{
|
||||
Blowfish_CBC_Encryption enc;
|
||||
enc.SetKey(key, 16, iv);
|
||||
enc.SetKey(global_key, 16, iv);
|
||||
|
||||
double start = current_time();
|
||||
|
||||
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;
|
||||
|
||||
@ -166,12 +166,12 @@ void bench_blowfish()
|
||||
void bench_arc4()
|
||||
{
|
||||
ARC4 enc;
|
||||
enc.SetKey(key, 16);
|
||||
enc.SetKey(global_key, 16);
|
||||
|
||||
double start = current_time();
|
||||
|
||||
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;
|
||||
|
||||
@ -191,7 +191,7 @@ void bench_md5()
|
||||
|
||||
|
||||
for(int i = 0; i < megs; i++)
|
||||
hash.Update(plain, sizeof(plain));
|
||||
hash.Update(global_plain, sizeof(global_plain));
|
||||
|
||||
hash.Final(digest);
|
||||
|
||||
@ -213,7 +213,7 @@ void bench_sha()
|
||||
|
||||
|
||||
for(int i = 0; i < megs; i++)
|
||||
hash.Update(plain, sizeof(plain));
|
||||
hash.Update(global_plain, sizeof(global_plain));
|
||||
|
||||
hash.Final(digest);
|
||||
|
||||
@ -241,7 +241,7 @@ void bench_ripemd()
|
||||
|
||||
|
||||
for(int i = 0; i < megs; i++)
|
||||
hash.Update(plain, sizeof(plain));
|
||||
hash.Update(global_plain, sizeof(global_plain));
|
||||
|
||||
hash.Final(digest);
|
||||
|
||||
|
@ -47,6 +47,7 @@ class TAOCRYPT_NO_VTABLE AbstractGroup : public virtual_base
|
||||
public:
|
||||
typedef Integer Element;
|
||||
|
||||
AbstractGroup() {}
|
||||
virtual ~AbstractGroup() {}
|
||||
|
||||
virtual bool Equal(const Element &a, const Element &b) const =0;
|
||||
@ -101,6 +102,7 @@ private:
|
||||
class MultiplicativeGroupT : public AbstractGroup
|
||||
{
|
||||
public:
|
||||
MultiplicativeGroupT() {}
|
||||
const AbstractRing& GetRing() const
|
||||
{return *m_pRing;}
|
||||
|
||||
@ -152,6 +154,7 @@ class TAOCRYPT_NO_VTABLE AbstractEuclideanDomain
|
||||
: public AbstractRing
|
||||
{
|
||||
public:
|
||||
AbstractEuclideanDomain() {}
|
||||
typedef Integer Element;
|
||||
|
||||
virtual void DivisionAlgorithm(Element &r, Element &q, const Element &a,
|
||||
|
@ -48,6 +48,7 @@ enum { DES_BLOCK_SIZE = 8, DES_KEY_SIZE = 32 };
|
||||
|
||||
class BasicDES {
|
||||
public:
|
||||
BasicDES() {}
|
||||
void SetKey(const byte*, word32, CipherDir dir);
|
||||
void RawProcessBlock(word32&, word32&) const;
|
||||
protected:
|
||||
|
@ -38,6 +38,7 @@ namespace TaoCrypt {
|
||||
// HASH
|
||||
class HASH : public virtual_base {
|
||||
public:
|
||||
HASH() {}
|
||||
virtual ~HASH() {}
|
||||
|
||||
virtual void Update(const byte*, word32) = 0;
|
||||
|
@ -116,11 +116,11 @@ void HMAC<T>::KeyInnerHash()
|
||||
|
||||
// Update
|
||||
template <class T>
|
||||
void HMAC<T>::Update(const byte* msg, word32 length)
|
||||
void HMAC<T>::Update(const byte* msg_arg, word32 length)
|
||||
{
|
||||
if (!innerHashKeyed_)
|
||||
KeyInnerHash();
|
||||
mac_.Update(msg, length);
|
||||
mac_.Update(msg_arg, length);
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,8 +44,8 @@ public:
|
||||
typedef int RandomizationParameter;
|
||||
typedef Integer Element;
|
||||
|
||||
ModularArithmetic(const Integer &modulus = Integer::One())
|
||||
: modulus(modulus), result((word)0, modulus.reg_.size()) {}
|
||||
ModularArithmetic(const Integer &modulus_arg = Integer::One())
|
||||
: modulus(modulus_arg), result((word)0, modulus_arg.reg_.size()) {}
|
||||
|
||||
ModularArithmetic(const ModularArithmetic &ma)
|
||||
: AbstractRing(),
|
||||
|
@ -49,8 +49,8 @@ public:
|
||||
{ cipher_.Process(c, p, sz); }
|
||||
void SetKey(const byte* k, word32 sz)
|
||||
{ cipher_.SetKey(k, sz, DIR); }
|
||||
void SetKey(const byte* k, word32 sz, const byte* iv)
|
||||
{ cipher_.SetKey(k, sz, DIR); cipher_.SetIV(iv); }
|
||||
void SetKey(const byte* k, word32 sz, const byte* iv_arg)
|
||||
{ cipher_.SetKey(k, sz, DIR); cipher_.SetIV(iv_arg); }
|
||||
private:
|
||||
T cipher_;
|
||||
|
||||
|
@ -138,6 +138,7 @@ private:
|
||||
// block type 2 padding
|
||||
class RSA_BlockType2 {
|
||||
public:
|
||||
RSA_BlockType2() {}
|
||||
void Pad(const byte*, word32, byte*, word32,
|
||||
RandomNumberGenerator&) const;
|
||||
word32 UnPad(const byte*, word32, byte*) const;
|
||||
@ -147,6 +148,7 @@ public:
|
||||
// block type 1 padding
|
||||
class RSA_BlockType1 {
|
||||
public:
|
||||
RSA_BlockType1() {}
|
||||
void Pad(const byte*, word32, byte*, word32,
|
||||
RandomNumberGenerator&) const;
|
||||
word32 UnPad(const byte*, word32, byte*) const;
|
||||
@ -181,25 +183,27 @@ public:
|
||||
|
||||
// Public Encrypt
|
||||
template<class Pad>
|
||||
void RSA_Encryptor<Pad>::Encrypt(const byte* plain, word32 sz, byte* cipher,
|
||||
RandomNumberGenerator& rng)
|
||||
void RSA_Encryptor<Pad>::Encrypt(const byte* plain_arg, word32 sz,
|
||||
byte* cipher_arg,
|
||||
RandomNumberGenerator& rng_arg)
|
||||
{
|
||||
PK_Lengths lengths(key_.GetModulus());
|
||||
assert(sz <= lengths.FixedMaxPlaintextLength());
|
||||
|
||||
ByteBlock paddedBlock(lengths.PaddedBlockByteLength());
|
||||
padding_.Pad(plain, sz, paddedBlock.get_buffer(),
|
||||
lengths.PaddedBlockBitLength(), rng);
|
||||
padding_.Pad(plain_arg, sz, paddedBlock.get_buffer(),
|
||||
lengths.PaddedBlockBitLength(), rng_arg);
|
||||
|
||||
key_.ApplyFunction(Integer(paddedBlock.get_buffer(), paddedBlock.size())).
|
||||
Encode(cipher, lengths.FixedCiphertextLength());
|
||||
Encode(cipher_arg, lengths.FixedCiphertextLength());
|
||||
}
|
||||
|
||||
|
||||
// Private Decrypt
|
||||
template<class Pad>
|
||||
word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher, word32 sz, byte* plain,
|
||||
RandomNumberGenerator& rng)
|
||||
word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher_arg, word32 sz,
|
||||
byte* plain_arg,
|
||||
RandomNumberGenerator& rng_arg)
|
||||
{
|
||||
PK_Lengths lengths(key_.GetModulus());
|
||||
assert(sz == lengths.FixedCiphertextLength());
|
||||
@ -208,29 +212,29 @@ word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher, word32 sz, byte* plain,
|
||||
return 0;
|
||||
|
||||
ByteBlock paddedBlock(lengths.PaddedBlockByteLength());
|
||||
Integer x = key_.CalculateInverse(rng, Integer(cipher,
|
||||
Integer x = key_.CalculateInverse(rng_arg, Integer(cipher_arg,
|
||||
lengths.FixedCiphertextLength()).Ref());
|
||||
if (x.ByteCount() > paddedBlock.size())
|
||||
x = Integer::Zero(); // don't return false, prevents timing attack
|
||||
x.Encode(paddedBlock.get_buffer(), paddedBlock.size());
|
||||
return padding_.UnPad(paddedBlock.get_buffer(),
|
||||
lengths.PaddedBlockBitLength(), plain);
|
||||
lengths.PaddedBlockBitLength(), plain_arg);
|
||||
}
|
||||
|
||||
|
||||
// Private SSL type (block 1) Encrypt
|
||||
template<class Pad>
|
||||
void RSA_Decryptor<Pad>::SSL_Sign(const byte* message, word32 sz, byte* sig,
|
||||
RandomNumberGenerator& rng)
|
||||
RandomNumberGenerator& rng_arg)
|
||||
{
|
||||
RSA_PublicKey inverse;
|
||||
inverse.Initialize(key_.GetModulus(), key_.GetPrivateExponent());
|
||||
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
|
||||
@ -238,11 +242,11 @@ template<class Pad>
|
||||
bool RSA_Encryptor<Pad>::SSL_Verify(const byte* message, word32 sz,
|
||||
const byte* sig)
|
||||
{
|
||||
ByteBlock plain(PK_Lengths(key_.GetModulus()).FixedMaxPlaintextLength());
|
||||
if (SSL_Decrypt(key_, sig, plain.get_buffer()) != sz)
|
||||
ByteBlock local_plain(PK_Lengths(key_.GetModulus()).FixedMaxPlaintextLength());
|
||||
if (SSL_Decrypt(key_, sig, local_plain.get_buffer()) != sz)
|
||||
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 false;
|
||||
}
|
||||
|
@ -69,7 +69,11 @@ MK_FUNDAMENTAL_TYPE(unsigned long)
|
||||
|
||||
MK_FUNDAMENTAL_TYPE(float)
|
||||
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)
|
||||
MK_FUNDAMENTAL_TYPE(word64)
|
||||
|
@ -238,7 +238,7 @@ void list<T>::push_front(T t)
|
||||
template<typename T>
|
||||
void list<T>::pop_front()
|
||||
{
|
||||
node* front = head_;
|
||||
node* local_front = head_;
|
||||
|
||||
if (head_ == 0)
|
||||
return;
|
||||
@ -248,8 +248,8 @@ void list<T>::pop_front()
|
||||
head_ = head_->next_;
|
||||
head_->prev_ = 0;
|
||||
}
|
||||
destroy(front);
|
||||
FreeMemory(front);
|
||||
destroy(local_front);
|
||||
FreeMemory(local_front);
|
||||
--sz_;
|
||||
}
|
||||
|
||||
@ -310,13 +310,13 @@ T list<T>::back() const
|
||||
template<typename 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_)
|
||||
if (list->value_ == t)
|
||||
return list;
|
||||
for (; local_list; local_list = local_list->next_)
|
||||
if (local_list->value_ == t)
|
||||
return local_list;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -97,13 +97,14 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
|
||||
rounds_ = keylen/4 + 6;
|
||||
|
||||
word32 temp, *rk = key_;
|
||||
unsigned int i=0;
|
||||
|
||||
GetUserKey(BigEndianOrder, rk, keylen/4, userKey, keylen);
|
||||
|
||||
switch(keylen)
|
||||
{
|
||||
case 16:
|
||||
{
|
||||
unsigned int i=0;
|
||||
while (true)
|
||||
{
|
||||
temp = rk[3];
|
||||
@ -121,8 +122,10 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
|
||||
rk += 4;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
case 24:
|
||||
{
|
||||
unsigned int i=0;
|
||||
while (true) // for (;;) here triggers a bug in VC60 SP4 w/ Pro Pack
|
||||
{
|
||||
temp = rk[ 5];
|
||||
@ -143,7 +146,10 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
case 32:
|
||||
{
|
||||
unsigned int i=0;
|
||||
while (true)
|
||||
{
|
||||
temp = rk[ 7];
|
||||
@ -172,6 +178,7 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (dir_ == DECRYPTION)
|
||||
{
|
||||
|
@ -193,10 +193,10 @@ Integer AbstractGroup::CascadeScalarMultiply(const Element &x,
|
||||
|
||||
struct WindowSlider
|
||||
{
|
||||
WindowSlider(const Integer &exp, bool fastNegate,
|
||||
WindowSlider(const Integer &exp_arg, bool fastNegate_arg,
|
||||
unsigned int windowSizeIn=0)
|
||||
: exp(exp), windowModulus(Integer::One()), windowSize(windowSizeIn),
|
||||
windowBegin(0), fastNegate(fastNegate), firstTime(true),
|
||||
: exp(exp_arg), windowModulus(Integer::One()), windowSize(windowSizeIn),
|
||||
windowBegin(0), fastNegate(fastNegate_arg), firstTime(true),
|
||||
finished(false)
|
||||
{
|
||||
if (windowSize == 0)
|
||||
|
@ -741,8 +741,8 @@ void CertDecoder::GetName(NameType nt)
|
||||
else {
|
||||
// skip
|
||||
source_.advance(oidSz + 1);
|
||||
word32 length = GetLength(source_);
|
||||
source_.advance(length);
|
||||
word32 length2 = GetLength(source_);
|
||||
source_.advance(length2);
|
||||
}
|
||||
}
|
||||
ptr[idx++] = 0;
|
||||
|
@ -137,20 +137,20 @@ const byte msgTmp[] = { // "now is the time for all " w/o trailing 0
|
||||
0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
|
||||
};
|
||||
|
||||
byte* msg = 0; // for block cipher input
|
||||
byte* plain = 0; // for cipher decrypt comparison
|
||||
byte* cipher = 0; // block output
|
||||
byte* global_msg = 0; // for block cipher input
|
||||
byte* global_plain = 0; // for cipher decrypt comparison
|
||||
byte* global_cipher = 0; // block output
|
||||
|
||||
|
||||
void taocrypt_test(void* args)
|
||||
{
|
||||
((func_args*)args)->return_code = -1; // error state
|
||||
|
||||
msg = NEW_TC byte[24];
|
||||
plain = NEW_TC byte[24];
|
||||
cipher = NEW_TC byte[24];
|
||||
global_msg = NEW_TC byte[24];
|
||||
global_plain = NEW_TC byte[24];
|
||||
global_cipher = NEW_TC byte[24];
|
||||
|
||||
memcpy(msg, msgTmp, 24);
|
||||
memcpy(global_msg, msgTmp, 24);
|
||||
|
||||
int ret = 0;
|
||||
if ( (ret = sha_test()) )
|
||||
@ -228,9 +228,9 @@ void taocrypt_test(void* args)
|
||||
else
|
||||
printf( "PBKDF2 test passed!\n");
|
||||
|
||||
tcArrayDelete(cipher);
|
||||
tcArrayDelete(plain);
|
||||
tcArrayDelete(msg);
|
||||
tcArrayDelete(global_cipher);
|
||||
tcArrayDelete(global_plain);
|
||||
tcArrayDelete(global_msg);
|
||||
|
||||
((func_args*)args)->return_code = ret;
|
||||
}
|
||||
@ -597,11 +597,11 @@ int des_test()
|
||||
const byte iv[] = { 0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef };
|
||||
|
||||
enc.SetKey(key, sizeof(key));
|
||||
enc.Process(cipher, msg, sz);
|
||||
enc.Process(global_cipher, global_msg, sz);
|
||||
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;
|
||||
|
||||
const byte verify1[] =
|
||||
@ -611,7 +611,7 @@ int des_test()
|
||||
0x89,0x3d,0x51,0xec,0x4b,0x56,0x3b,0x53
|
||||
};
|
||||
|
||||
if (memcmp(cipher, verify1, sz))
|
||||
if (memcmp(global_cipher, verify1, sz))
|
||||
return -51;
|
||||
|
||||
// CBC mode
|
||||
@ -619,11 +619,11 @@ int des_test()
|
||||
DES_CBC_Decryption dec2;
|
||||
|
||||
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.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;
|
||||
|
||||
const byte verify2[] =
|
||||
@ -633,7 +633,7 @@ int des_test()
|
||||
0x15,0x85,0xb3,0x22,0x4b,0x86,0x2b,0x4b
|
||||
};
|
||||
|
||||
if (memcmp(cipher, verify2, sz))
|
||||
if (memcmp(global_cipher, verify2, sz))
|
||||
return -53;
|
||||
|
||||
// EDE3 CBC mode
|
||||
@ -655,11 +655,11 @@ int des_test()
|
||||
};
|
||||
|
||||
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.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;
|
||||
|
||||
const byte verify3[] =
|
||||
@ -669,7 +669,7 @@ int des_test()
|
||||
0x18,0xbc,0xbb,0x6d,0xd2,0xb1,0x16,0xda
|
||||
};
|
||||
|
||||
if (memcmp(cipher, verify3, sz))
|
||||
if (memcmp(global_cipher, verify3, sz))
|
||||
return -55;
|
||||
|
||||
return 0;
|
||||
@ -688,10 +688,10 @@ int aes_test()
|
||||
enc.SetKey(key, bs, iv);
|
||||
dec.SetKey(key, bs, iv);
|
||||
|
||||
enc.Process(cipher, msg, bs);
|
||||
dec.Process(plain, cipher, bs);
|
||||
enc.Process(global_cipher, global_msg, bs);
|
||||
dec.Process(global_plain, global_cipher, bs);
|
||||
|
||||
if (memcmp(plain, msg, bs))
|
||||
if (memcmp(global_plain, global_msg, bs))
|
||||
return -60;
|
||||
|
||||
const byte verify[] =
|
||||
@ -700,7 +700,7 @@ int aes_test()
|
||||
0x2c,0xcc,0x9d,0x46,0x77,0xa2,0x33,0xcb
|
||||
};
|
||||
|
||||
if (memcmp(cipher, verify, bs))
|
||||
if (memcmp(global_cipher, verify, bs))
|
||||
return -61;
|
||||
|
||||
AES_ECB_Encryption enc2;
|
||||
@ -709,10 +709,10 @@ int aes_test()
|
||||
enc2.SetKey(key, bs, iv);
|
||||
dec2.SetKey(key, bs, iv);
|
||||
|
||||
enc2.Process(cipher, msg, bs);
|
||||
dec2.Process(plain, cipher, bs);
|
||||
enc2.Process(global_cipher, global_msg, bs);
|
||||
dec2.Process(global_plain, global_cipher, bs);
|
||||
|
||||
if (memcmp(plain, msg, bs))
|
||||
if (memcmp(global_plain, global_msg, bs))
|
||||
return -62;
|
||||
|
||||
const byte verify2[] =
|
||||
@ -721,7 +721,7 @@ int aes_test()
|
||||
0xc8,0x8c,0x33,0x3b,0xb5,0x8f,0x85,0xd1
|
||||
};
|
||||
|
||||
if (memcmp(cipher, verify2, bs))
|
||||
if (memcmp(global_cipher, verify2, bs))
|
||||
return -63;
|
||||
|
||||
return 0;
|
||||
@ -740,10 +740,10 @@ int twofish_test()
|
||||
enc.SetKey(key, bs, iv);
|
||||
dec.SetKey(key, bs, iv);
|
||||
|
||||
enc.Process(cipher, msg, bs);
|
||||
dec.Process(plain, cipher, bs);
|
||||
enc.Process(global_cipher, global_msg, bs);
|
||||
dec.Process(global_plain, global_cipher, bs);
|
||||
|
||||
if (memcmp(plain, msg, bs))
|
||||
if (memcmp(global_plain, global_msg, bs))
|
||||
return -60;
|
||||
|
||||
const byte verify[] =
|
||||
@ -752,7 +752,7 @@ int twofish_test()
|
||||
0x21,0x03,0x58,0x79,0x5F,0x02,0x27,0x2C
|
||||
};
|
||||
|
||||
if (memcmp(cipher, verify, bs))
|
||||
if (memcmp(global_cipher, verify, bs))
|
||||
return -61;
|
||||
|
||||
Twofish_ECB_Encryption enc2;
|
||||
@ -761,10 +761,10 @@ int twofish_test()
|
||||
enc2.SetKey(key, bs, iv);
|
||||
dec2.SetKey(key, bs, iv);
|
||||
|
||||
enc2.Process(cipher, msg, bs);
|
||||
dec2.Process(plain, cipher, bs);
|
||||
enc2.Process(global_cipher, global_msg, bs);
|
||||
dec2.Process(global_plain, global_cipher, bs);
|
||||
|
||||
if (memcmp(plain, msg, bs))
|
||||
if (memcmp(global_plain, global_msg, bs))
|
||||
return -62;
|
||||
|
||||
const byte verify2[] =
|
||||
@ -773,7 +773,7 @@ int twofish_test()
|
||||
0xC4,0xCD,0x6B,0x91,0x14,0xC5,0x3A,0x09
|
||||
};
|
||||
|
||||
if (memcmp(cipher, verify2, bs))
|
||||
if (memcmp(global_cipher, verify2, bs))
|
||||
return -63;
|
||||
|
||||
return 0;
|
||||
@ -792,10 +792,10 @@ int blowfish_test()
|
||||
enc.SetKey(key, 16, iv);
|
||||
dec.SetKey(key, 16, iv);
|
||||
|
||||
enc.Process(cipher, msg, bs * 2);
|
||||
dec.Process(plain, cipher, bs * 2);
|
||||
enc.Process(global_cipher, global_msg, bs * 2);
|
||||
dec.Process(global_plain, global_cipher, bs * 2);
|
||||
|
||||
if (memcmp(plain, msg, bs))
|
||||
if (memcmp(global_plain, global_msg, bs))
|
||||
return -60;
|
||||
|
||||
const byte verify[] =
|
||||
@ -804,7 +804,7 @@ int blowfish_test()
|
||||
0xBC,0xD9,0x08,0xC4,0x94,0x6C,0x89,0xA3
|
||||
};
|
||||
|
||||
if (memcmp(cipher, verify, bs))
|
||||
if (memcmp(global_cipher, verify, bs))
|
||||
return -61;
|
||||
|
||||
Blowfish_ECB_Encryption enc2;
|
||||
@ -813,10 +813,10 @@ int blowfish_test()
|
||||
enc2.SetKey(key, 16, iv);
|
||||
dec2.SetKey(key, 16, iv);
|
||||
|
||||
enc2.Process(cipher, msg, bs * 2);
|
||||
dec2.Process(plain, cipher, bs * 2);
|
||||
enc2.Process(global_cipher, global_msg, bs * 2);
|
||||
dec2.Process(global_plain, global_cipher, bs * 2);
|
||||
|
||||
if (memcmp(plain, msg, bs))
|
||||
if (memcmp(global_plain, global_msg, bs))
|
||||
return -62;
|
||||
|
||||
const byte verify2[] =
|
||||
@ -825,7 +825,7 @@ int blowfish_test()
|
||||
0x8F,0xCE,0x39,0x32,0xDE,0xD7,0xBC,0x5B
|
||||
};
|
||||
|
||||
if (memcmp(cipher, verify2, bs))
|
||||
if (memcmp(global_cipher, verify2, bs))
|
||||
return -63;
|
||||
|
||||
return 0;
|
||||
|
@ -141,16 +141,17 @@ int test_openSSL_des()
|
||||
/* test des encrypt/decrypt */
|
||||
char data[] = "this is my data ";
|
||||
int dataSz = strlen(data);
|
||||
DES_key_schedule key[3];
|
||||
DES_key_schedule local_key[3];
|
||||
byte iv[8];
|
||||
EVP_BytesToKey(EVP_des_ede3_cbc(), EVP_md5(), NULL, (byte*)data, dataSz, 1,
|
||||
(byte*)key, iv);
|
||||
(byte*)local_key, iv);
|
||||
|
||||
byte cipher[16];
|
||||
DES_ede3_cbc_encrypt((byte*)data, cipher, dataSz, &key[0], &key[1],
|
||||
&key[2], &iv, true);
|
||||
DES_ede3_cbc_encrypt((byte*)data, cipher, dataSz,
|
||||
&local_key[0], &local_key[1],
|
||||
&local_key[2], &iv, true);
|
||||
byte plain[16];
|
||||
DES_ede3_cbc_encrypt(cipher, plain, 16, &key[0], &key[1], &key[2],
|
||||
&iv, false);
|
||||
DES_ede3_cbc_encrypt(cipher, plain, 16, &local_key[0], &local_key[1],
|
||||
&local_key[2], &iv, false);
|
||||
return 0;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ typedef struct
|
||||
{
|
||||
uint beg;
|
||||
uint end;
|
||||
uint mblen;
|
||||
uint mb_len;
|
||||
} my_match_t;
|
||||
|
||||
enum my_lex_states
|
||||
|
@ -629,7 +629,7 @@ typedef unsigned short ushort;
|
||||
duplicate declaration of __cxa_pure_virtual, solved by declaring it a
|
||||
weak symbol.
|
||||
*/
|
||||
#ifdef USE_MYSYS_NEW
|
||||
#if defined(USE_MYSYS_NEW) && ! defined(DONT_DECLARE_CXA_PURE_VIRTUAL)
|
||||
C_MODE_START
|
||||
int __cxa_pure_virtual () __attribute__ ((weak));
|
||||
C_MODE_END
|
||||
|
@ -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.
|
||||
*/
|
||||
#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); \
|
||||
#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; int l_rc; \
|
||||
DBUG_ASSERT((A) != 0); \
|
||||
sigemptyset(&l_set); \
|
||||
l_s.sa_handler = (B); \
|
||||
l_s.sa_mask = l_set; \
|
||||
l_s.sa_flags = 0; \
|
||||
l_rc= sigaction((A), &l_s, (struct sigaction *) NULL);\
|
||||
DBUG_ASSERT(l_rc == 0); \
|
||||
} while (0)
|
||||
#elif defined(HAVE_SIGSET) && !defined(my_sigset)
|
||||
#define my_sigset(A,B) sigset((A),(B))
|
||||
|
@ -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;
|
||||
extern char wild_many,wild_one,wild_prefix;
|
||||
extern const char *charsets_dir;
|
||||
extern char *defaults_extra_file;
|
||||
extern const char *defaults_group_suffix;
|
||||
extern const char *defaults_file;
|
||||
/* from default.c */
|
||||
extern char *my_defaults_extra_file;
|
||||
extern const char *my_defaults_group_suffix;
|
||||
extern const char *my_defaults_file;
|
||||
|
||||
extern my_bool timed_mutexes;
|
||||
|
||||
|
@ -80,16 +80,16 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
|
||||
uint flags, int *was_cut);
|
||||
longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
|
||||
uint flags, int *was_cut);
|
||||
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *time);
|
||||
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *time);
|
||||
ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *time);
|
||||
ulonglong TIME_to_ulonglong(const MYSQL_TIME *time);
|
||||
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *);
|
||||
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *);
|
||||
ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *);
|
||||
ulonglong TIME_to_ulonglong(const MYSQL_TIME *);
|
||||
|
||||
|
||||
my_bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time,
|
||||
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);
|
||||
uint calc_days_in_year(uint year);
|
||||
|
@ -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_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 IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_STRING)
|
||||
|
||||
|
||||
typedef struct st_mysql_field {
|
||||
@ -783,7 +784,7 @@ int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query,
|
||||
unsigned long length);
|
||||
int STDCALL mysql_stmt_execute(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 long offset);
|
||||
int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt);
|
||||
|
@ -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.
|
||||
*/
|
||||
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. */
|
||||
|
||||
@ -2168,7 +2168,7 @@ static void update_stmt_fields(MYSQL_STMT *stmt)
|
||||
MYSQL_FIELD *field= stmt->mysql->fields;
|
||||
MYSQL_FIELD *field_end= field + stmt->field_count;
|
||||
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);
|
||||
|
||||
@ -2179,10 +2179,10 @@ static void update_stmt_fields(MYSQL_STMT *stmt)
|
||||
stmt_field->type = field->type;
|
||||
stmt_field->flags = field->flags;
|
||||
stmt_field->decimals = field->decimals;
|
||||
if (bind)
|
||||
if (my_bind)
|
||||
{
|
||||
/* 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()
|
||||
stmt statement handle
|
||||
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
|
||||
is >= mysql_stmt_field_count(): it's user's responsibility.
|
||||
|
||||
@ -3083,65 +3083,66 @@ static my_bool int_is_null_false= 0;
|
||||
to point to the buffer of given type. Finally, additional actions
|
||||
may be taken for some types or use cases:
|
||||
|
||||
Binding integer types.
|
||||
For integer types you might also need to set MYSQL_BIND::is_unsigned
|
||||
member. Set it to TRUE when binding unsigned char, unsigned short,
|
||||
unsigned int, unsigned long, unsigned long long.
|
||||
Binding integer types.
|
||||
For integer types you might also need to set MYSQL_BIND::is_unsigned
|
||||
member. Set it to TRUE when binding unsigned char, unsigned short,
|
||||
unsigned int, unsigned long, unsigned long long.
|
||||
|
||||
Binding floating point types.
|
||||
For floating point types you just need to set
|
||||
MYSQL_BIND::buffer_type and MYSQL_BIND::buffer. The rest of the
|
||||
members should be zero-initialized.
|
||||
Binding floating point types.
|
||||
For floating point types you just need to set
|
||||
MYSQL_BIND::buffer_type and MYSQL_BIND::buffer. The rest of the
|
||||
members should be zero-initialized.
|
||||
|
||||
Binding NULLs.
|
||||
You might have a column always NULL, never NULL, or sometimes NULL.
|
||||
For an always NULL column set MYSQL_BIND::buffer_type to
|
||||
MYSQL_TYPE_NULL. The rest of the members just need to be
|
||||
zero-initialized. For never NULL columns set MYSQL_BIND::is_null to
|
||||
0, or this has already been done if you zero-initialized the entire
|
||||
structure. If you set MYSQL_TYPE::is_null to point to an
|
||||
application buffer of type 'my_bool', then this buffer will be
|
||||
checked on each execution: 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 NULLs.
|
||||
You might have a column always NULL, never NULL, or sometimes
|
||||
NULL. For an always NULL column set MYSQL_BIND::buffer_type to
|
||||
MYSQL_TYPE_NULL. The rest of the members just need to be
|
||||
zero-initialized. For never NULL columns set
|
||||
MYSQL_BIND::is_null to 0, or this has already been done if you
|
||||
zero-initialized the entire structure. If you set
|
||||
MYSQL_TYPE::is_null to point to an application buffer of type
|
||||
'my_bool', then this buffer will be checked on each execution:
|
||||
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.
|
||||
For strings, in addition to MYSQL_BIND::buffer_type and
|
||||
MYSQL_BIND::buffer you need to set MYSQL_BIND::length or
|
||||
MYSQL_BIND::buffer_length.
|
||||
If 'length' is set, 'buffer_length' is ignored. 'buffer_length'
|
||||
member should be used when size of string doesn't change between
|
||||
executions. If you want to vary buffer length for each value, set
|
||||
'length' to point to an application buffer of type 'unsigned long'
|
||||
and set this long to length of the string before each
|
||||
mysql_stmt_execute().
|
||||
Binding text strings and sequences of bytes.
|
||||
For strings, in addition to MYSQL_BIND::buffer_type and
|
||||
MYSQL_BIND::buffer you need to set MYSQL_BIND::length or
|
||||
MYSQL_BIND::buffer_length. If 'length' is set, 'buffer_length'
|
||||
is ignored. 'buffer_length' member should be used when size of
|
||||
string doesn't change between executions. If you want to vary
|
||||
buffer length for each value, set 'length' to point to an
|
||||
application buffer of type 'unsigned long' and set this long to
|
||||
length of the string before each mysql_stmt_execute().
|
||||
|
||||
Binding dates and times.
|
||||
For binding dates and times prepared statements API provides clients
|
||||
with MYSQL_TIME structure. A pointer to instance of this structure
|
||||
should be assigned to MYSQL_BIND::buffer whenever MYSQL_TYPE_TIME,
|
||||
MYSQL_TYPE_DATE, MYSQL_TYPE_DATETIME typecodes are used. When
|
||||
typecode is MYSQL_TYPE_TIME, only members 'hour', 'minute', 'second'
|
||||
and 'neg' (is time offset negative) are used. These members only
|
||||
will be sent to the server.
|
||||
MYSQL_TYPE_DATE implies use of 'year', 'month', 'day', 'neg'.
|
||||
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
|
||||
when sending data to the server, typecode information is enough.
|
||||
'second_part' member can hold microsecond precision of time value,
|
||||
but now it's only supported on protocol level: you can't store
|
||||
microsecond in a column, or use in temporal calculations. However,
|
||||
if you send a time value with microsecond part for 'SELECT ?',
|
||||
statement, you'll get it back unchanged from the server.
|
||||
Binding dates and times.
|
||||
For binding dates and times prepared statements API provides
|
||||
clients with MYSQL_TIME structure. A pointer to instance of this
|
||||
structure should be assigned to MYSQL_BIND::buffer whenever
|
||||
MYSQL_TYPE_TIME, MYSQL_TYPE_DATE, MYSQL_TYPE_DATETIME typecodes
|
||||
are used. When typecode is MYSQL_TYPE_TIME, only members
|
||||
'hour', 'minute', 'second' and 'neg' (is time offset negative)
|
||||
are used. These members only will be sent to the server.
|
||||
MYSQL_TYPE_DATE implies use of 'year', 'month', 'day', 'neg'.
|
||||
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 when sending data to the server, typecode information is
|
||||
enough. 'second_part' member can hold microsecond precision of
|
||||
time value, but now it's only supported on protocol level: you
|
||||
can't store microsecond in a column, or use in temporal
|
||||
calculations. However, if you send a time value with microsecond
|
||||
part for 'SELECT ?', statement, you'll get it back unchanged
|
||||
from the server.
|
||||
|
||||
Data conversion.
|
||||
If conversion from host language type to data representation,
|
||||
corresponding to SQL type, is required it's done on the server.
|
||||
Data truncation is possible when conversion is lossy. For example,
|
||||
if you supply MYSQL_TYPE_DATETIME value out of valid SQL type
|
||||
TIMESTAMP range, the same conversion will be applied as if this
|
||||
value would have been sent as string in the old protocol.
|
||||
TODO: document how the server will behave in case of truncation/data
|
||||
loss.
|
||||
Data conversion.
|
||||
If conversion from host language type to data representation,
|
||||
corresponding to SQL type, is required it's done on the server.
|
||||
Data truncation is possible when conversion is lossy. For
|
||||
example, if you supply MYSQL_TYPE_DATETIME value out of valid
|
||||
SQL type TIMESTAMP range, the same conversion will be applied as
|
||||
if this value would have been sent as string in the old
|
||||
protocol. TODO: document how the server will behave in case of
|
||||
truncation/data loss.
|
||||
|
||||
After variables were bound, you can repeatedly set/change their
|
||||
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.
|
||||
*/
|
||||
|
||||
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;
|
||||
MYSQL_BIND *param, *end;
|
||||
@ -3186,7 +3187,7 @@ my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *bind)
|
||||
}
|
||||
|
||||
/* Allocated on prepare */
|
||||
memcpy((char*) stmt->params, (char*) bind,
|
||||
memcpy((char*) stmt->params, (char*) my_bind,
|
||||
sizeof(MYSQL_BIND) * 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;
|
||||
if (param->buffer_type < MYSQL_TYPE_TINY_BLOB ||
|
||||
param->buffer_type > MYSQL_TYPE_STRING)
|
||||
if (!IS_LONGDATA(param->buffer_type))
|
||||
{
|
||||
/* Long data handling should be used only for string/binary types */
|
||||
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
|
||||
of conversion functions can delegate conversion to it.
|
||||
*/
|
||||
switch(param->buffer_type) {
|
||||
switch (param->buffer_type) {
|
||||
case MYSQL_TYPE_NULL: /* do nothing */
|
||||
break;
|
||||
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,
|
||||
MYSQL_FIELD *field,
|
||||
MYSQL_TIME *time)
|
||||
MYSQL_TIME *my_time)
|
||||
{
|
||||
switch (param->buffer_type) {
|
||||
case MYSQL_TYPE_NULL: /* do nothing */
|
||||
break;
|
||||
case MYSQL_TYPE_DATE:
|
||||
*(MYSQL_TIME *)(param->buffer)= *time;
|
||||
*param->error= time->time_type != MYSQL_TIMESTAMP_DATE;
|
||||
*(MYSQL_TIME *)(param->buffer)= *my_time;
|
||||
*param->error= my_time->time_type != MYSQL_TIMESTAMP_DATE;
|
||||
break;
|
||||
case MYSQL_TYPE_TIME:
|
||||
*(MYSQL_TIME *)(param->buffer)= *time;
|
||||
*param->error= time->time_type != MYSQL_TIMESTAMP_TIME;
|
||||
*(MYSQL_TIME *)(param->buffer)= *my_time;
|
||||
*param->error= my_time->time_type != MYSQL_TIMESTAMP_TIME;
|
||||
break;
|
||||
case MYSQL_TYPE_DATETIME:
|
||||
case MYSQL_TYPE_TIMESTAMP:
|
||||
*(MYSQL_TIME *)(param->buffer)= *time;
|
||||
*(MYSQL_TIME *)(param->buffer)= *my_time;
|
||||
/* No error: time and date are compatible with datetime */
|
||||
break;
|
||||
case MYSQL_TYPE_YEAR:
|
||||
shortstore(param->buffer, time->year);
|
||||
shortstore(param->buffer, my_time->year);
|
||||
*param->error= 1;
|
||||
break;
|
||||
case MYSQL_TYPE_FLOAT:
|
||||
case MYSQL_TYPE_DOUBLE:
|
||||
{
|
||||
ulonglong value= TIME_to_ulonglong(time);
|
||||
ulonglong value= TIME_to_ulonglong(my_time);
|
||||
fetch_float_with_conversion(param, field,
|
||||
ulonglong2double(value), DBL_DIG);
|
||||
break;
|
||||
@ -3892,7 +3892,7 @@ static void fetch_datetime_with_conversion(MYSQL_BIND *param,
|
||||
case MYSQL_TYPE_LONG:
|
||||
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);
|
||||
break;
|
||||
}
|
||||
@ -3903,7 +3903,7 @@ static void fetch_datetime_with_conversion(MYSQL_BIND *param,
|
||||
fetch_string_with_conversion:
|
||||
*/
|
||||
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 */
|
||||
fetch_string_with_conversion(param, (char *)buff, length);
|
||||
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)
|
||||
{
|
||||
DBUG_ENTER("setup_one_fetch_function");
|
||||
|
||||
/* Setup data copy functions for the different supported types */
|
||||
switch (param->buffer_type) {
|
||||
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;
|
||||
break;
|
||||
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))
|
||||
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;
|
||||
break;
|
||||
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
|
||||
*/
|
||||
|
||||
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_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.
|
||||
*/
|
||||
|
||||
if (stmt->bind != bind)
|
||||
memcpy((char*) stmt->bind, (char*) bind, sizeof(MYSQL_BIND) * bind_count);
|
||||
if (stmt->bind != my_bind)
|
||||
memcpy((char*) stmt->bind, (char*) my_bind,
|
||||
sizeof(MYSQL_BIND) * bind_count);
|
||||
|
||||
for (param= stmt->bind, end= param + bind_count, field= stmt->fields ;
|
||||
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)
|
||||
{
|
||||
MYSQL_BIND *bind, *end;
|
||||
MYSQL_BIND *my_bind, *end;
|
||||
MYSQL_FIELD *field;
|
||||
uchar *null_ptr, bit;
|
||||
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 */
|
||||
|
||||
/* Copy complete row to application buffers */
|
||||
for (bind= stmt->bind, end= bind + stmt->field_count, field= stmt->fields ;
|
||||
bind < end ;
|
||||
bind++, field++)
|
||||
for (my_bind= stmt->bind, end= my_bind + stmt->field_count,
|
||||
field= stmt->fields ;
|
||||
my_bind < end ;
|
||||
my_bind++, field++)
|
||||
{
|
||||
*bind->error= 0;
|
||||
*my_bind->error= 0;
|
||||
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
|
||||
lost. See mysql_stmt_fetch_column for details.
|
||||
*/
|
||||
bind->row_ptr= NULL;
|
||||
*bind->is_null= 1;
|
||||
my_bind->row_ptr= NULL;
|
||||
*my_bind->is_null= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*bind->is_null= 0;
|
||||
bind->row_ptr= row;
|
||||
(*bind->fetch_result)(bind, field, &row);
|
||||
truncation_count+= *bind->error;
|
||||
*my_bind->is_null= 0;
|
||||
my_bind->row_ptr= row;
|
||||
(*my_bind->fetch_result)(my_bind, field, &row);
|
||||
truncation_count+= *my_bind->error;
|
||||
}
|
||||
if (!((bit<<=1) & 255))
|
||||
{
|
||||
@ -4585,7 +4592,7 @@ int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt)
|
||||
SYNOPSIS
|
||||
mysql_stmt_fetch_column()
|
||||
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()
|
||||
column Column to fetch (first column is 0)
|
||||
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
|
||||
*/
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
if (!bind->error)
|
||||
bind->error= &bind->error_value;
|
||||
*bind->error= 0;
|
||||
if (!my_bind->error)
|
||||
my_bind->error= &my_bind->error_value;
|
||||
*my_bind->error= 0;
|
||||
if (param->row_ptr)
|
||||
{
|
||||
MYSQL_FIELD *field= stmt->fields+column;
|
||||
uchar *row= param->row_ptr;
|
||||
bind->offset= offset;
|
||||
if (bind->is_null)
|
||||
*bind->is_null= 0;
|
||||
if (bind->length) /* Set the length if non char/binary types */
|
||||
*bind->length= *param->length;
|
||||
my_bind->offset= offset;
|
||||
if (my_bind->is_null)
|
||||
*my_bind->is_null= 0;
|
||||
if (my_bind->length) /* Set the length if non char/binary types */
|
||||
*my_bind->length= *param->length;
|
||||
else
|
||||
bind->length= ¶m->length_value; /* Needed for fetch_result() */
|
||||
fetch_result_with_conversion(bind, field, &row);
|
||||
my_bind->length= ¶m->length_value; /* Needed for fetch_result() */
|
||||
fetch_result_with_conversion(my_bind, field, &row);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bind->is_null)
|
||||
*bind->is_null= 1;
|
||||
if (my_bind->is_null)
|
||||
*my_bind->is_null= 1;
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
@ -4703,7 +4710,7 @@ err:
|
||||
|
||||
static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data)
|
||||
{
|
||||
MYSQL_BIND *bind, *end;
|
||||
MYSQL_BIND *my_bind, *end;
|
||||
MYSQL_FIELD *field;
|
||||
uchar *null_ptr, bit;
|
||||
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 */
|
||||
|
||||
/* Go through all fields and calculate metadata */
|
||||
for (bind= stmt->bind, end= bind + stmt->field_count, field= stmt->fields ;
|
||||
bind < end ;
|
||||
bind++, field++)
|
||||
for (my_bind= stmt->bind, end= my_bind + stmt->field_count, field= stmt->fields ;
|
||||
my_bind < end ;
|
||||
my_bind++, field++)
|
||||
{
|
||||
if (!(*null_ptr & bit))
|
||||
(*bind->skip_result)(bind, field, &row);
|
||||
(*my_bind->skip_result)(my_bind, field, &row);
|
||||
DBUG_ASSERT(row <= row_end);
|
||||
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
|
||||
max_length
|
||||
*/
|
||||
MYSQL_BIND *bind, *end;
|
||||
MYSQL_BIND *my_bind, *end;
|
||||
MYSQL_FIELD *field;
|
||||
bzero((char*) stmt->bind, sizeof(*stmt->bind)* stmt->field_count);
|
||||
|
||||
for (bind= stmt->bind, end= bind + stmt->field_count, field= stmt->fields;
|
||||
bind < end ;
|
||||
bind++, field++)
|
||||
for (my_bind= stmt->bind, end= my_bind + stmt->field_count,
|
||||
field= stmt->fields;
|
||||
my_bind < end ;
|
||||
my_bind++, field++)
|
||||
{
|
||||
bind->buffer_type= MYSQL_TYPE_NULL;
|
||||
bind->buffer_length=1;
|
||||
my_bind->buffer_type= MYSQL_TYPE_NULL;
|
||||
my_bind->buffer_length=1;
|
||||
}
|
||||
|
||||
if (mysql_stmt_bind_result(stmt, stmt->bind))
|
||||
|
@ -1060,6 +1060,7 @@ void Protocol_simple::prepare_for_resend()
|
||||
data->embedded_info->prev_ptr= &cur->next;
|
||||
next_field=cur->data;
|
||||
next_mysql_field= data->embedded_info->fields_list;
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
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 t2 (id int auto_increment not null primary key);
|
||||
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/*!*/;
|
||||
/*!\C latin1 *//*!*/;
|
||||
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/*!*/;
|
||||
create table t1 (word varchar(20))/*!*/;
|
||||
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/*!*/;
|
||||
/*!\C latin1 *//*!*/;
|
||||
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/*!*/;
|
||||
create table t1 (word varchar(20))/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
@ -192,6 +192,7 @@ DELIMITER ;
|
||||
# End of log file
|
||||
ROLLBACK /* added by mysqlbinlog */;
|
||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||
drop table t1,t2;
|
||||
flush logs;
|
||||
create table t3 (f text character set utf8);
|
||||
create table t4 (f text character set cp932);
|
||||
@ -209,14 +210,15 @@ HEX(f)
|
||||
select HEX(f) from t4;
|
||||
HEX(f)
|
||||
835C
|
||||
drop table t3,t4,t03,t04;
|
||||
flush logs;
|
||||
flush logs;
|
||||
select * from t5 /* must be (1),(1) */;
|
||||
a
|
||||
1
|
||||
1
|
||||
drop table t5;
|
||||
flush logs;
|
||||
drop table if exists t5;
|
||||
create table t5 (c1 int, c2 varchar(128) character set latin1 not null);
|
||||
insert into t5 values (1, date_format('2001-01-01','%W'));
|
||||
set lc_time_names=de_DE;
|
||||
@ -235,6 +237,7 @@ c1 c2
|
||||
1 Monday
|
||||
2 Montag
|
||||
3 Monday
|
||||
drop table t5;
|
||||
drop procedure if exists p1;
|
||||
flush logs;
|
||||
create procedure p1()
|
||||
@ -270,5 +273,4 @@ call p1();
|
||||
1
|
||||
1
|
||||
drop procedure p1;
|
||||
drop table t1, t2, t03, t04, t3, t4, t5;
|
||||
flush logs;
|
||||
|
@ -1,7 +1,6 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
drop view if exists v1;
|
||||
drop database if exists client_test_db;
|
||||
DROP SCHEMA test;
|
||||
CREATE SCHEMA test;
|
||||
use test;
|
||||
mysql.columns_priv OK
|
||||
mysql.db OK
|
||||
mysql.event OK
|
||||
|
@ -413,6 +413,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 2: Connection test_con1 already exists
|
||||
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
|
||||
|
@ -6,7 +6,7 @@ select 1;
|
||||
1
|
||||
1
|
||||
select 2;
|
||||
ERROR HY000: MySQL server has gone away
|
||||
Got one of the listed errors
|
||||
select 3;
|
||||
3
|
||||
3
|
||||
@ -14,7 +14,7 @@ select 1;
|
||||
1
|
||||
1
|
||||
select 2;
|
||||
ERROR HY000: MySQL server has gone away
|
||||
Got one of the listed errors
|
||||
select 3;
|
||||
3
|
||||
3
|
||||
|
@ -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
|
||||
mysql_upgrade : Bug#25074 mysql_upgrade gives inconsisten results
|
||||
plugin : Bug#25659 memory leak via "plugins" test
|
||||
|
||||
rpl_ndb_dd_advance : Bug#25913 rpl_ndb_dd_advance fails randomly
|
||||
|
@ -37,7 +37,6 @@ set session long_query_time=1;
|
||||
select sleep(2);
|
||||
--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
|
||||
select * from mysql.slow_log;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
show global variables
|
||||
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
|
||||
@ -121,3 +120,8 @@ drop table t1;
|
||||
select * from mysql.general_log;
|
||||
|
||||
--enable_ps_protocol
|
||||
|
||||
#
|
||||
# Cleanup (must be done last to avoid delayed 'Quit' message in general log)
|
||||
#
|
||||
disconnect con1;
|
||||
|
@ -44,7 +44,7 @@ unlock tables;
|
||||
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
|
||||
@ -263,4 +263,14 @@ drop table t17583;
|
||||
--exec echo "DELIMITER \\\\" > $MYSQLTEST_VARDIR/tmp/bug21412.sql
|
||||
--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
|
||||
|
@ -9,7 +9,7 @@
|
||||
set timestamp=1000000000;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
drop table if exists t1,t2,t3,t4,t5,t03,t04;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (word varchar(20));
|
||||
@ -108,8 +108,11 @@ select "--- reading stdin --" as "";
|
||||
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--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)
|
||||
#
|
||||
flush logs;
|
||||
create table t3 (f text character set utf8);
|
||||
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 t04;
|
||||
select HEX(f) from t4;
|
||||
drop table t3,t4,t03,t04;
|
||||
|
||||
#
|
||||
#BUG#14157: utf8 encoding in binlog without set character_set_client
|
||||
@ -136,6 +140,7 @@ flush logs;
|
||||
flush logs;
|
||||
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL
|
||||
select * from t5 /* must be (1),(1) */;
|
||||
drop table t5;
|
||||
|
||||
#
|
||||
# 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
|
||||
#
|
||||
flush logs;
|
||||
drop table if exists t5;
|
||||
create table t5 (c1 int, c2 varchar(128) character set latin1 not null);
|
||||
insert into t5 values (1, date_format('2001-01-01','%W'));
|
||||
set lc_time_names=de_DE;
|
||||
@ -155,6 +159,8 @@ flush logs;
|
||||
drop table t5;
|
||||
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000008 | $MYSQL
|
||||
select * from t5 order by c1;
|
||||
drop table t5;
|
||||
|
||||
#
|
||||
# Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails
|
||||
#
|
||||
@ -179,8 +185,13 @@ call p1();
|
||||
call 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
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
# Embedded server doesn't support external clients
|
||||
--source include/not_embedded.inc
|
||||
|
||||
@ -5,13 +6,16 @@
|
||||
# depends on the presence of the log tables (which are CSV-based).
|
||||
--source include/have_csv.inc
|
||||
|
||||
#
|
||||
# Clean up after previous tests
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
drop view if exists v1;
|
||||
drop database if exists client_test_db;
|
||||
--enable_warnings
|
||||
|
||||
DROP SCHEMA test;
|
||||
CREATE SCHEMA test;
|
||||
use test;
|
||||
#
|
||||
# Bug #13783 mysqlcheck tries to optimize and analyze information_schema
|
||||
#
|
||||
|
@ -1246,8 +1246,16 @@ EOF
|
||||
connect (con1,localhost,root,,);
|
||||
connection default;
|
||||
connection con1;
|
||||
disconnect con1;
|
||||
--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
|
||||
# ----------------------------------------------------------------------------
|
||||
@ -1605,5 +1613,17 @@ EOF
|
||||
|
||||
--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
|
||||
|
@ -9,6 +9,7 @@
|
||||
--source include/have_binlog_format_row.inc
|
||||
--source include/ndb_default_cluster.inc
|
||||
--source include/not_embedded.inc
|
||||
--source include/big_test.inc
|
||||
#--source include/have_ndb_extra.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
|
@ -49,7 +49,8 @@ sleep 1;
|
||||
connection default;
|
||||
# When the connection is closed in this way, the error code should
|
||||
# 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;
|
||||
--enable_reconnect
|
||||
select 3;
|
||||
@ -96,7 +97,8 @@ sleep 1;
|
||||
connection con1;
|
||||
# When the connection is closed in this way, the error code should
|
||||
# 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;
|
||||
--enable_reconnect
|
||||
select 3;
|
||||
|
@ -41,9 +41,9 @@
|
||||
#include <winbase.h>
|
||||
#endif
|
||||
|
||||
const char *defaults_file=0;
|
||||
const char *defaults_group_suffix=0;
|
||||
char *defaults_extra_file=0;
|
||||
const char *my_defaults_file=0;
|
||||
const char *my_defaults_group_suffix=0;
|
||||
char *my_defaults_extra_file=0;
|
||||
|
||||
/* Which directories are searched for options (and in which order) */
|
||||
|
||||
@ -116,7 +116,7 @@ static char *remove_end_comment(char *ptr);
|
||||
0 ok
|
||||
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
|
||||
*/
|
||||
|
||||
@ -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,
|
||||
(char **) &forced_default_file,
|
||||
(char **) &forced_extra_defaults,
|
||||
(char **) &defaults_group_suffix);
|
||||
(char **) &my_defaults_group_suffix);
|
||||
|
||||
if (! defaults_group_suffix)
|
||||
defaults_group_suffix= getenv(STRINGIFY_ARG(DEFAULT_GROUP_SUFFIX_ENV));
|
||||
if (! my_defaults_group_suffix)
|
||||
my_defaults_group_suffix= getenv(STRINGIFY_ARG(DEFAULT_GROUP_SUFFIX_ENV));
|
||||
|
||||
if (forced_extra_defaults)
|
||||
defaults_extra_file= (char *) forced_extra_defaults;
|
||||
my_defaults_extra_file= (char *) forced_extra_defaults;
|
||||
|
||||
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
|
||||
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= */
|
||||
uint i;
|
||||
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;
|
||||
char *ptr;
|
||||
TYPELIB *group= ctx->group;
|
||||
@ -176,7 +176,7 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
|
||||
|
||||
/** Construct new group */
|
||||
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;
|
||||
@ -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)
|
||||
goto err;
|
||||
}
|
||||
else if (defaults_extra_file)
|
||||
else if (my_defaults_extra_file)
|
||||
{
|
||||
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 */
|
||||
if (error > 0)
|
||||
{
|
||||
fprintf(stderr, "Could not open required defaults file: %s\n",
|
||||
defaults_extra_file);
|
||||
my_defaults_extra_file);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@ -874,8 +874,8 @@ void my_print_default_files(const char *conf_file)
|
||||
char *end;
|
||||
if (**dirs)
|
||||
pos= *dirs;
|
||||
else if (defaults_extra_file)
|
||||
pos= defaults_extra_file;
|
||||
else if (my_defaults_extra_file)
|
||||
pos= my_defaults_extra_file;
|
||||
else
|
||||
continue;
|
||||
end= convert_dirname(name, pos, NullS);
|
||||
@ -901,14 +901,14 @@ void print_defaults(const char *conf_file, const char **groups)
|
||||
fputs(*groups,stdout);
|
||||
}
|
||||
|
||||
if (defaults_group_suffix)
|
||||
if (my_defaults_group_suffix)
|
||||
{
|
||||
groups= groups_save;
|
||||
for ( ; *groups ; groups++)
|
||||
{
|
||||
fputc(' ',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\
|
||||
|
@ -369,10 +369,10 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
|
||||
if (*fmt == 's') /* String parameter */
|
||||
{
|
||||
reg2 char *par = va_arg(args, char *);
|
||||
uint length = (uint) strlen(par);
|
||||
uint length2 = (uint) strlen(par);
|
||||
/* TODO: implement minimum width and precision */
|
||||
out_length+=length;
|
||||
if (my_b_write(info, par, length))
|
||||
out_length+= length2;
|
||||
if (my_b_write(info, par, length2))
|
||||
goto err;
|
||||
}
|
||||
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 */
|
||||
{
|
||||
register int iarg;
|
||||
uint length;
|
||||
uint length2;
|
||||
char buff[17];
|
||||
|
||||
iarg = va_arg(args, int);
|
||||
if (*fmt == 'd')
|
||||
length= (uint) (int10_to_str((long) iarg,buff, -10) - buff);
|
||||
length2= (uint) (int10_to_str((long) iarg,buff, -10) - buff);
|
||||
else
|
||||
length= (uint) (int10_to_str((long) (uint) iarg,buff,10)- buff);
|
||||
out_length+=length;
|
||||
if (my_b_write(info, buff, length))
|
||||
length2= (uint) (int10_to_str((long) (uint) iarg,buff,10)- buff);
|
||||
out_length+= length2;
|
||||
if (my_b_write(info, buff, length2))
|
||||
goto err;
|
||||
}
|
||||
else if ((*fmt == 'l' && fmt[1] == 'd') || fmt[1] == 'u')
|
||||
/* long parameter */
|
||||
{
|
||||
register long iarg;
|
||||
uint length;
|
||||
uint length2;
|
||||
char buff[17];
|
||||
|
||||
iarg = va_arg(args, long);
|
||||
if (*++fmt == 'd')
|
||||
length= (uint) (int10_to_str(iarg,buff, -10) - buff);
|
||||
length2= (uint) (int10_to_str(iarg,buff, -10) - buff);
|
||||
else
|
||||
length= (uint) (int10_to_str(iarg,buff,10)- buff);
|
||||
out_length+=length;
|
||||
if (my_b_write(info, buff, length))
|
||||
length2= (uint) (int10_to_str(iarg,buff,10)- buff);
|
||||
out_length+= length2;
|
||||
if (my_b_write(info, buff, length2))
|
||||
goto err;
|
||||
}
|
||||
else
|
||||
|
@ -828,9 +828,10 @@ static inline void link_changed(BLOCK_LINK *block, BLOCK_LINK **phead)
|
||||
*/
|
||||
|
||||
static void link_to_file_list(KEY_CACHE *keycache,
|
||||
BLOCK_LINK *block, int file, my_bool unlink)
|
||||
BLOCK_LINK *block, int file,
|
||||
my_bool unlink_block)
|
||||
{
|
||||
if (unlink)
|
||||
if (unlink_block)
|
||||
unlink_changed(block);
|
||||
link_changed(block, &keycache->file_blocks[FILE_HASH(file)]);
|
||||
if (block->status & BLOCK_CHANGED)
|
||||
|
@ -171,10 +171,10 @@ void bitmap_free(MY_BITMAP *map)
|
||||
|
||||
my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit)
|
||||
{
|
||||
uchar *byte= (uchar*)map->bitmap + (bitmap_bit / 8);
|
||||
uchar *value= ((uchar*) map->bitmap) + (bitmap_bit / 8);
|
||||
uchar bit= 1 << ((bitmap_bit) & 7);
|
||||
uchar res= (*byte) & bit;
|
||||
*byte|= bit;
|
||||
uchar res= (*value) & bit;
|
||||
*value|= bit;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
12
mysys/sha1.c
12
mysys/sha1.c
@ -244,7 +244,7 @@ static void SHA1ProcessMessageBlock(SHA1_CONTEXT *context)
|
||||
uint32 temp; /* Temporary word value */
|
||||
uint32 W[80]; /* Word sequence */
|
||||
uint32 A, B, C, D, E; /* Word buffers */
|
||||
int index;
|
||||
int idx;
|
||||
|
||||
/*
|
||||
Initialize the first 16 words in the array W
|
||||
@ -252,11 +252,11 @@ static void SHA1ProcessMessageBlock(SHA1_CONTEXT *context)
|
||||
|
||||
for (t = 0; t < 16; t++)
|
||||
{
|
||||
index=t*4;
|
||||
W[t] = context->Message_Block[index] << 24;
|
||||
W[t] |= context->Message_Block[index + 1] << 16;
|
||||
W[t] |= context->Message_Block[index + 2] << 8;
|
||||
W[t] |= context->Message_Block[index + 3];
|
||||
idx=t*4;
|
||||
W[t] = context->Message_Block[idx] << 24;
|
||||
W[t] |= context->Message_Block[idx + 1] << 16;
|
||||
W[t] |= context->Message_Block[idx + 2] << 8;
|
||||
W[t] |= context->Message_Block[idx + 3];
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,13 +22,15 @@
|
||||
#include <my_dir.h>
|
||||
|
||||
/*
|
||||
#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8)
|
||||
Disable __attribute__() on non-gcc compilers.
|
||||
*/
|
||||
#if !defined(__attribute__) && !defined(__GNUC__)
|
||||
#define __attribute__(A)
|
||||
#endif
|
||||
*/
|
||||
|
||||
|
||||
#define HEART_STRING_BUFFER 100
|
||||
|
||||
|
||||
struct mysql_heartbeat_context
|
||||
{
|
||||
pthread_t heartbeat_thread;
|
||||
@ -62,7 +64,6 @@ pthread_handler_t mysql_heartbeat(void *p)
|
||||
x++;
|
||||
}
|
||||
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
@ -82,6 +83,7 @@ pthread_handler_t mysql_heartbeat(void *p)
|
||||
|
||||
static int daemon_example_plugin_init(void *p)
|
||||
{
|
||||
|
||||
DBUG_ENTER("daemon_example_plugin_init");
|
||||
struct mysql_heartbeat_context *con;
|
||||
pthread_attr_t attr; /* Thread attributes */
|
||||
@ -92,9 +94,11 @@ static int daemon_example_plugin_init(void *p)
|
||||
|
||||
struct st_plugin_int *plugin= (struct st_plugin_int *)p;
|
||||
|
||||
con= (struct mysql_heartbeat_context *)my_malloc(sizeof(struct mysql_heartbeat_context), MYF(0));
|
||||
con= (struct mysql_heartbeat_context *)
|
||||
my_malloc(sizeof(struct mysql_heartbeat_context), MYF(0));
|
||||
|
||||
fn_format(heartbeat_filename, "mysql-heartbeat", "", ".log", MY_REPLACE_EXT | MY_UNPACK_FILENAME);
|
||||
fn_format(heartbeat_filename, "mysql-heartbeat", "", ".log",
|
||||
MY_REPLACE_EXT | MY_UNPACK_FILENAME);
|
||||
unlink(heartbeat_filename);
|
||||
con->heartbeat_file= my_open(heartbeat_filename, O_CREAT|O_RDWR, MYF(0));
|
||||
|
||||
@ -118,12 +122,12 @@ static int daemon_example_plugin_init(void *p)
|
||||
|
||||
|
||||
/* now create the thread */
|
||||
if (pthread_create(&con->heartbeat_thread, &attr, mysql_heartbeat, (void *)con) != 0)
|
||||
if (pthread_create(&con->heartbeat_thread, &attr, mysql_heartbeat,
|
||||
(void *)con) != 0)
|
||||
{
|
||||
fprintf(stderr,"Could not create heartbeat thread!\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
plugin->data= (void *)con;
|
||||
|
||||
DBUG_RETURN(0);
|
||||
@ -142,12 +146,14 @@ static int daemon_example_plugin_init(void *p)
|
||||
1 failure (cannot happen)
|
||||
|
||||
*/
|
||||
|
||||
static int daemon_example_plugin_deinit(void *p)
|
||||
{
|
||||
DBUG_ENTER("daemon_example_plugin_deinit");
|
||||
char buffer[HEART_STRING_BUFFER];
|
||||
struct st_plugin_int *plugin= (struct st_plugin_int *)p;
|
||||
struct mysql_heartbeat_context *con= (struct mysql_heartbeat_context *)plugin->data;
|
||||
struct mysql_heartbeat_context *con=
|
||||
(struct mysql_heartbeat_context *)plugin->data;
|
||||
time_t result= time(NULL);
|
||||
struct tm tm_tmp;
|
||||
|
||||
@ -165,12 +171,12 @@ static int daemon_example_plugin_deinit(void *p)
|
||||
my_write(con->heartbeat_file, buffer, strlen(buffer), MYF(0));
|
||||
my_close(con->heartbeat_file, MYF(0));
|
||||
|
||||
|
||||
my_free((char *)con, MYF(0));
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
struct st_mysql_daemon daemon_example_plugin=
|
||||
{ MYSQL_DAEMON_INTERFACE_VERSION };
|
||||
|
||||
|
@ -297,16 +297,15 @@ int Mysql_connection::dispatch_command(enum enum_server_command command,
|
||||
(unsigned long) connection_id,
|
||||
(const char *) packet);
|
||||
|
||||
if (Command *command= parse_command(packet))
|
||||
if (Command *com= parse_command(packet))
|
||||
{
|
||||
int res= 0;
|
||||
|
||||
log_info("Connection %lu: query parsed successfully.",
|
||||
(unsigned long) connection_id);
|
||||
|
||||
res= command->execute(&net, connection_id);
|
||||
delete command;
|
||||
|
||||
res= com->execute(&net, connection_id);
|
||||
delete com;
|
||||
if (!res)
|
||||
{
|
||||
log_info("Connection %lu: query executed successfully",
|
||||
|
@ -464,28 +464,28 @@ int Options::load(int argc, char **argv)
|
||||
'.angel.pid'.
|
||||
*/
|
||||
|
||||
char *angel_pid_file_name;
|
||||
char *local_angel_pid_file_name;
|
||||
char *base_name_ptr;
|
||||
char *ext_ptr;
|
||||
|
||||
angel_pid_file_name=
|
||||
local_angel_pid_file_name=
|
||||
(char *) malloc(strlen(Options::Main::pid_file_name) +
|
||||
ANGEL_PID_FILE_SUFFIX_LEN);
|
||||
|
||||
strcpy(angel_pid_file_name, Options::Main::pid_file_name);
|
||||
strcpy(local_angel_pid_file_name, Options::Main::pid_file_name);
|
||||
|
||||
base_name_ptr= strrchr(angel_pid_file_name, '/');
|
||||
base_name_ptr= strrchr(local_angel_pid_file_name, '/');
|
||||
|
||||
if (!base_name_ptr)
|
||||
base_name_ptr= angel_pid_file_name + 1;
|
||||
base_name_ptr= local_angel_pid_file_name + 1;
|
||||
|
||||
ext_ptr= strrchr(base_name_ptr, '.');
|
||||
if (ext_ptr)
|
||||
*ext_ptr= 0;
|
||||
|
||||
strcat(angel_pid_file_name, ANGEL_PID_FILE_SUFFIX);
|
||||
strcat(local_angel_pid_file_name, ANGEL_PID_FILE_SUFFIX);
|
||||
|
||||
Options::Daemon::angel_pid_file_name= angel_pid_file_name;
|
||||
Options::Daemon::angel_pid_file_name= local_angel_pid_file_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -682,7 +682,7 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
|
||||
mysql->info=0;
|
||||
mysql->affected_rows= ~(my_ulonglong) 0;
|
||||
/*
|
||||
We don't want to clear the protocol buffer on COM_QUIT, beacsue if
|
||||
We don't want to clear the protocol buffer on COM_QUIT, because if
|
||||
the previous command was a shutdown command, we may have the
|
||||
response for the COM_QUIT already in the communication buffer
|
||||
*/
|
||||
@ -2364,12 +2364,12 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
|
||||
{
|
||||
DYNAMIC_ARRAY *init_commands= mysql->options.init_commands;
|
||||
char **ptr= (char**)init_commands->buffer;
|
||||
char **end= ptr + init_commands->elements;
|
||||
char **end_command= ptr + init_commands->elements;
|
||||
|
||||
my_bool reconnect=mysql->reconnect;
|
||||
mysql->reconnect=0;
|
||||
|
||||
for (; ptr<end; ptr++)
|
||||
for (; ptr < end_command; ptr++)
|
||||
{
|
||||
MYSQL_RES *res;
|
||||
if (mysql_real_query(mysql,*ptr, (ulong) strlen(*ptr)))
|
||||
|
@ -680,24 +680,24 @@ fractional:
|
||||
1 time value is invalid
|
||||
*/
|
||||
|
||||
int check_time_range(struct st_mysql_time *time, int *warning)
|
||||
int check_time_range(struct st_mysql_time *my_time, int *warning)
|
||||
{
|
||||
longlong hour;
|
||||
|
||||
if (time->minute >= 60 || time->second >= 60)
|
||||
if (my_time->minute >= 60 || my_time->second >= 60)
|
||||
return 1;
|
||||
|
||||
hour= time->hour + (24*time->day);
|
||||
hour= my_time->hour + (24*my_time->day);
|
||||
if (hour <= TIME_MAX_HOUR &&
|
||||
(hour != TIME_MAX_HOUR || time->minute != TIME_MAX_MINUTE ||
|
||||
time->second != TIME_MAX_SECOND || !time->second_part))
|
||||
(hour != TIME_MAX_HOUR || my_time->minute != TIME_MAX_MINUTE ||
|
||||
my_time->second != TIME_MAX_SECOND || !my_time->second_part))
|
||||
return 0;
|
||||
|
||||
time->day= 0;
|
||||
time->hour= TIME_MAX_HOUR;
|
||||
time->minute= TIME_MAX_MINUTE;
|
||||
time->second= TIME_MAX_SECOND;
|
||||
time->second_part= 0;
|
||||
my_time->day= 0;
|
||||
my_time->hour= TIME_MAX_HOUR;
|
||||
my_time->minute= TIME_MAX_MINUTE;
|
||||
my_time->second= TIME_MAX_SECOND;
|
||||
my_time->second_part= 0;
|
||||
*warning|= MYSQL_TIME_WARN_OUT_OF_RANGE;
|
||||
return 0;
|
||||
}
|
||||
@ -1148,22 +1148,23 @@ longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
|
||||
|
||||
/* Convert time value to integer in YYYYMMDDHHMMSS format */
|
||||
|
||||
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *time)
|
||||
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *my_time)
|
||||
{
|
||||
return ((ulonglong) (time->year * 10000UL +
|
||||
time->month * 100UL +
|
||||
time->day) * ULL(1000000) +
|
||||
(ulonglong) (time->hour * 10000UL +
|
||||
time->minute * 100UL +
|
||||
time->second));
|
||||
return ((ulonglong) (my_time->year * 10000UL +
|
||||
my_time->month * 100UL +
|
||||
my_time->day) * ULL(1000000) +
|
||||
(ulonglong) (my_time->hour * 10000UL +
|
||||
my_time->minute * 100UL +
|
||||
my_time->second));
|
||||
}
|
||||
|
||||
|
||||
/* Convert TIME value to integer in YYYYMMDD format */
|
||||
|
||||
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *time)
|
||||
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *my_time)
|
||||
{
|
||||
return (ulonglong) (time->year * 10000UL + time->month * 100UL + time->day);
|
||||
return (ulonglong) (my_time->year * 10000UL + my_time->month * 100UL +
|
||||
my_time->day);
|
||||
}
|
||||
|
||||
|
||||
@ -1173,11 +1174,11 @@ ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *time)
|
||||
it's assumed that days have been converted to hours already.
|
||||
*/
|
||||
|
||||
ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *time)
|
||||
ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *my_time)
|
||||
{
|
||||
return (ulonglong) (time->hour * 10000UL +
|
||||
time->minute * 100UL +
|
||||
time->second);
|
||||
return (ulonglong) (my_time->hour * 10000UL +
|
||||
my_time->minute * 100UL +
|
||||
my_time->second);
|
||||
}
|
||||
|
||||
|
||||
@ -1201,15 +1202,15 @@ ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *time)
|
||||
valid date either.
|
||||
*/
|
||||
|
||||
ulonglong TIME_to_ulonglong(const MYSQL_TIME *time)
|
||||
ulonglong TIME_to_ulonglong(const MYSQL_TIME *my_time)
|
||||
{
|
||||
switch (time->time_type) {
|
||||
switch (my_time->time_type) {
|
||||
case MYSQL_TIMESTAMP_DATETIME:
|
||||
return TIME_to_ulonglong_datetime(time);
|
||||
return TIME_to_ulonglong_datetime(my_time);
|
||||
case MYSQL_TIMESTAMP_DATE:
|
||||
return TIME_to_ulonglong_date(time);
|
||||
return TIME_to_ulonglong_date(my_time);
|
||||
case MYSQL_TIMESTAMP_TIME:
|
||||
return TIME_to_ulonglong_time(time);
|
||||
return TIME_to_ulonglong_time(my_time);
|
||||
case MYSQL_TIMESTAMP_NONE:
|
||||
case MYSQL_TIMESTAMP_ERROR:
|
||||
return ULL(0);
|
||||
|
@ -1560,7 +1560,6 @@ done:
|
||||
int
|
||||
Event_timed::get_create_event(THD *thd, String *buf)
|
||||
{
|
||||
int multipl= 0;
|
||||
char tmp_buf[2 * STRING_BUFFER_USUAL_SIZE];
|
||||
String expr_buf(tmp_buf, sizeof(tmp_buf), system_charset_info);
|
||||
expr_buf.length(0);
|
||||
|
@ -518,7 +518,6 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
|
||||
my_bool create_if_not)
|
||||
{
|
||||
int ret= 0;
|
||||
CHARSET_INFO *scs= system_charset_info;
|
||||
TABLE *table= NULL;
|
||||
char old_db_buf[NAME_LEN+1];
|
||||
LEX_STRING old_db= { old_db_buf, sizeof(old_db_buf) };
|
||||
|
@ -139,8 +139,6 @@ bool
|
||||
Event_queue::init_queue(THD *thd, Event_db_repository *db_repo)
|
||||
{
|
||||
bool res;
|
||||
struct event_queue_param *event_queue_param_value= NULL;
|
||||
|
||||
DBUG_ENTER("Event_queue::init_queue");
|
||||
DBUG_PRINT("enter", ("this: 0x%lx", (long) this));
|
||||
|
||||
|
201
sql/field.cc
201
sql/field.cc
@ -1415,12 +1415,12 @@ my_decimal* Field_num::val_decimal(my_decimal *decimal_value)
|
||||
|
||||
Field_str::Field_str(char *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
|
||||
uchar null_bit_arg, utype unireg_check_arg,
|
||||
const char *field_name_arg, CHARSET_INFO *charset)
|
||||
const char *field_name_arg, CHARSET_INFO *charset_arg)
|
||||
:Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
|
||||
unireg_check_arg, field_name_arg)
|
||||
{
|
||||
field_charset=charset;
|
||||
if (charset->state & MY_CS_BINSORT)
|
||||
field_charset= charset_arg;
|
||||
if (charset_arg->state & MY_CS_BINSORT)
|
||||
flags|=BINARY_FLAG;
|
||||
field_derivation= DERIVATION_IMPLICIT;
|
||||
}
|
||||
@ -1527,7 +1527,7 @@ bool Field::get_time(TIME *ltime)
|
||||
Needs to be changed if/when we want to support different time formats
|
||||
*/
|
||||
|
||||
int Field::store_time(TIME *ltime, timestamp_type type)
|
||||
int Field::store_time(TIME *ltime, timestamp_type type_arg)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
char buff[MAX_DATE_STRING_REP_LENGTH];
|
||||
@ -2242,12 +2242,12 @@ Field_new_decimal::Field_new_decimal(char *ptr_arg,
|
||||
|
||||
|
||||
Field_new_decimal::Field_new_decimal(uint32 len_arg,
|
||||
bool maybe_null,
|
||||
bool maybe_null_arg,
|
||||
const char *name,
|
||||
uint8 dec_arg,
|
||||
bool unsigned_arg)
|
||||
:Field_num((char*) 0, len_arg,
|
||||
maybe_null ? (uchar*) "": 0, 0,
|
||||
maybe_null_arg ? (uchar*) "": 0, 0,
|
||||
NONE, name, dec_arg, 0, unsigned_arg)
|
||||
{
|
||||
precision= my_decimal_length_to_precision(len_arg, dec_arg, unsigned_arg);
|
||||
@ -2351,7 +2351,7 @@ bool Field_new_decimal::store_value(const my_decimal *decimal_value)
|
||||
|
||||
|
||||
int Field_new_decimal::store(const char *from, uint length,
|
||||
CHARSET_INFO *charset)
|
||||
CHARSET_INFO *charset_arg)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
int err;
|
||||
@ -2360,7 +2360,7 @@ int Field_new_decimal::store(const char *from, uint length,
|
||||
|
||||
if ((err= str2my_decimal(E_DEC_FATAL_ERROR &
|
||||
~(E_DEC_OVERFLOW | E_DEC_BAD_NUM),
|
||||
from, length, charset, &decimal_value)) &&
|
||||
from, length, charset_arg, &decimal_value)) &&
|
||||
table->in_use->abort_on_warning)
|
||||
{
|
||||
/* Because "from" is not NUL-terminated and we use %s in the ER() */
|
||||
@ -2556,7 +2556,7 @@ uint Field_new_decimal::is_equal(create_field *new_field)
|
||||
(uint) (flags & UNSIGNED_FLAG)) &&
|
||||
((new_field->flags & AUTO_INCREMENT_FLAG) ==
|
||||
(uint) (flags & AUTO_INCREMENT_FLAG)) &&
|
||||
(new_field->length == max_length()) &&
|
||||
(new_field->length == max_display_length()) &&
|
||||
(new_field->decimals == dec));
|
||||
}
|
||||
|
||||
@ -3282,25 +3282,6 @@ void Field_medium::sql_type(String &res) const
|
||||
** long int
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
A helper function to check whether the next character
|
||||
in the string "s" is MINUS SIGN.
|
||||
*/
|
||||
#ifdef HAVE_CHARSET_ucs2
|
||||
static bool test_if_minus(CHARSET_INFO *cs,
|
||||
const char *s, const char *e)
|
||||
{
|
||||
my_wc_t wc;
|
||||
return cs->cset->mb_wc(cs, &wc, (uchar*) s, (uchar*) e) > 0 && wc == '-';
|
||||
}
|
||||
#else
|
||||
/*
|
||||
If not UCS2 support is compiled then it is easier
|
||||
*/
|
||||
#define test_if_minus(cs, s, e) (*s == '-')
|
||||
#endif
|
||||
|
||||
|
||||
int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
@ -4912,7 +4893,7 @@ int Field_time::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
}
|
||||
|
||||
|
||||
int Field_time::store_time(TIME *ltime, timestamp_type type)
|
||||
int Field_time::store_time(TIME *ltime, timestamp_type time_type)
|
||||
{
|
||||
long tmp= ((ltime->month ? 0 : ltime->day * 24L) + ltime->hour) * 10000L +
|
||||
(ltime->minute * 100 + ltime->second);
|
||||
@ -5523,12 +5504,13 @@ int Field_newdate::store(longlong nr, bool unsigned_val)
|
||||
}
|
||||
|
||||
|
||||
int Field_newdate::store_time(TIME *ltime,timestamp_type type)
|
||||
int Field_newdate::store_time(TIME *ltime,timestamp_type time_type)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
long tmp;
|
||||
int error= 0;
|
||||
if (type == MYSQL_TIMESTAMP_DATE || type == MYSQL_TIMESTAMP_DATETIME)
|
||||
if (time_type == MYSQL_TIMESTAMP_DATE ||
|
||||
time_type == MYSQL_TIMESTAMP_DATETIME)
|
||||
{
|
||||
tmp=ltime->year*16*32+ltime->month*32+ltime->day;
|
||||
if (check_date(ltime, tmp != 0,
|
||||
@ -5748,7 +5730,7 @@ int Field_datetime::store(longlong nr, bool unsigned_val)
|
||||
}
|
||||
|
||||
|
||||
int Field_datetime::store_time(TIME *ltime,timestamp_type type)
|
||||
int Field_datetime::store_time(TIME *ltime,timestamp_type time_type)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
longlong tmp;
|
||||
@ -5757,7 +5739,8 @@ int Field_datetime::store_time(TIME *ltime,timestamp_type type)
|
||||
We don't perform range checking here since values stored in TIME
|
||||
structure always fit into DATETIME range.
|
||||
*/
|
||||
if (type == MYSQL_TIMESTAMP_DATE || type == MYSQL_TIMESTAMP_DATETIME)
|
||||
if (time_type == MYSQL_TIMESTAMP_DATE ||
|
||||
time_type == MYSQL_TIMESTAMP_DATETIME)
|
||||
{
|
||||
tmp=((ltime->year*10000L+ltime->month*100+ltime->day)*LL(1000000)+
|
||||
(ltime->hour*10000L+ltime->minute*100+ltime->second));
|
||||
@ -6136,32 +6119,32 @@ int Field_str::store(double nr)
|
||||
char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
|
||||
uint length;
|
||||
bool use_scientific_notation= TRUE;
|
||||
uint char_length= field_length / charset()->mbmaxlen;
|
||||
uint local_char_length= field_length / charset()->mbmaxlen;
|
||||
/*
|
||||
Check fabs(nr) against longest value that can be stored in field,
|
||||
which depends on whether the value is < 1 or not, and negative or not
|
||||
*/
|
||||
double anr= fabs(nr);
|
||||
int neg= (nr < 0.0) ? 1 : 0;
|
||||
if (char_length > 4 && char_length < 32 &&
|
||||
(anr < 1.0 ? anr > 1/(log_10[max(0,(int) char_length-neg-2)]) /* -2 for "0." */
|
||||
: anr < log_10[char_length-neg]-1))
|
||||
if (local_char_length > 4 && local_char_length < 32 &&
|
||||
(anr < 1.0 ? anr > 1/(log_10[max(0,(int) local_char_length-neg-2)]) /* -2 for "0." */
|
||||
: anr < log_10[local_char_length-neg]-1))
|
||||
use_scientific_notation= FALSE;
|
||||
|
||||
length= (uint) my_sprintf(buff, (buff, "%-.*g",
|
||||
(use_scientific_notation ?
|
||||
max(0, (int)char_length-neg-5) :
|
||||
char_length),
|
||||
max(0, (int)local_char_length-neg-5) :
|
||||
local_char_length),
|
||||
nr));
|
||||
/*
|
||||
+1 below is because "precision" in %g above means the
|
||||
max. number of significant digits, not the output width.
|
||||
Thus the width can be larger than number of significant digits by 1
|
||||
(for decimal point)
|
||||
the test for char_length < 5 is for extreme cases,
|
||||
the test for local_char_length < 5 is for extreme cases,
|
||||
like inserting 500.0 in char(1)
|
||||
*/
|
||||
DBUG_ASSERT(char_length < 5 || length <= char_length+1);
|
||||
DBUG_ASSERT(local_char_length < 5 || length <= local_char_length+1);
|
||||
return store((const char *) buff, length, charset());
|
||||
}
|
||||
|
||||
@ -6182,7 +6165,7 @@ uint Field_str::is_equal(create_field *new_field)
|
||||
|
||||
return ((new_field->sql_type == real_type()) &&
|
||||
new_field->charset == field_charset &&
|
||||
new_field->length == max_length());
|
||||
new_field->length == max_display_length());
|
||||
}
|
||||
|
||||
|
||||
@ -6344,10 +6327,11 @@ void Field_string::sql_type(String &res) const
|
||||
char *Field_string::pack(char *to, const char *from, uint max_length)
|
||||
{
|
||||
uint length= min(field_length,max_length);
|
||||
uint char_length= max_length/field_charset->mbmaxlen;
|
||||
if (length > char_length)
|
||||
char_length= my_charpos(field_charset, from, from+length, char_length);
|
||||
set_if_smaller(length, char_length);
|
||||
uint local_char_length= max_length/field_charset->mbmaxlen;
|
||||
if (length > local_char_length)
|
||||
local_char_length= my_charpos(field_charset, from, from+length,
|
||||
local_char_length);
|
||||
set_if_smaller(length, local_char_length);
|
||||
while (length && from[length-1] == ' ')
|
||||
length--;
|
||||
*to++= (char) (uchar) length;
|
||||
@ -6431,15 +6415,15 @@ int Field_string::pack_cmp(const char *a, const char *b, uint length,
|
||||
int Field_string::pack_cmp(const char *key, uint length,
|
||||
my_bool insert_or_update)
|
||||
{
|
||||
uint row_length, key_length;
|
||||
uint row_length, local_key_length;
|
||||
char *end;
|
||||
if (length > 255)
|
||||
{
|
||||
key_length= uint2korr(key);
|
||||
local_key_length= uint2korr(key);
|
||||
key+= 2;
|
||||
}
|
||||
else
|
||||
key_length= (uint) (uchar) *key++;
|
||||
local_key_length= (uint) (uchar) *key++;
|
||||
|
||||
/* Only use 'length' of key, not field_length */
|
||||
end= ptr + length;
|
||||
@ -6449,7 +6433,7 @@ int Field_string::pack_cmp(const char *key, uint length,
|
||||
|
||||
return field_charset->coll->strnncollsp(field_charset,
|
||||
(const uchar*) ptr, row_length,
|
||||
(const uchar*) key, key_length,
|
||||
(const uchar*) key, local_key_length,
|
||||
insert_or_update);
|
||||
}
|
||||
|
||||
@ -6641,11 +6625,11 @@ int Field_varstring::cmp_max(const char *a_ptr, const char *b_ptr,
|
||||
int Field_varstring::key_cmp(const byte *key_ptr, uint max_key_length)
|
||||
{
|
||||
uint length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
|
||||
uint char_length= max_key_length / field_charset->mbmaxlen;
|
||||
uint local_char_length= max_key_length / field_charset->mbmaxlen;
|
||||
|
||||
char_length= my_charpos(field_charset, ptr + length_bytes,
|
||||
ptr + length_bytes + length, char_length);
|
||||
set_if_smaller(length, char_length);
|
||||
local_char_length= my_charpos(field_charset, ptr + length_bytes,
|
||||
ptr + length_bytes + length, local_char_length);
|
||||
set_if_smaller(length, local_char_length);
|
||||
return field_charset->coll->strnncollsp(field_charset,
|
||||
(const uchar*) ptr + length_bytes,
|
||||
length,
|
||||
@ -6755,13 +6739,14 @@ char *Field_varstring::pack(char *to, const char *from, uint max_length)
|
||||
char *Field_varstring::pack_key(char *to, const char *key, uint max_length)
|
||||
{
|
||||
uint length= length_bytes == 1 ? (uint) (uchar) *key : uint2korr(key);
|
||||
uint char_length= ((field_charset->mbmaxlen > 1) ?
|
||||
uint local_char_length= ((field_charset->mbmaxlen > 1) ?
|
||||
max_length/field_charset->mbmaxlen : max_length);
|
||||
key+= length_bytes;
|
||||
if (length > char_length)
|
||||
if (length > local_char_length)
|
||||
{
|
||||
char_length= my_charpos(field_charset, key, key+length, char_length);
|
||||
set_if_smaller(length, char_length);
|
||||
local_char_length= my_charpos(field_charset, key, key+length,
|
||||
local_char_length);
|
||||
set_if_smaller(length, local_char_length);
|
||||
}
|
||||
*to++= (char) (length & 255);
|
||||
if (max_length > 255)
|
||||
@ -6857,11 +6842,12 @@ const char *Field_varstring::unpack(char *to, const char *from)
|
||||
}
|
||||
|
||||
|
||||
int Field_varstring::pack_cmp(const char *a, const char *b, uint key_length,
|
||||
int Field_varstring::pack_cmp(const char *a, const char *b,
|
||||
uint key_length_arg,
|
||||
my_bool insert_or_update)
|
||||
{
|
||||
uint a_length, b_length;
|
||||
if (key_length > 255)
|
||||
if (key_length_arg > 255)
|
||||
{
|
||||
a_length=uint2korr(a); a+= 2;
|
||||
b_length=uint2korr(b); b+= 2;
|
||||
@ -6878,26 +6864,28 @@ int Field_varstring::pack_cmp(const char *a, const char *b, uint key_length,
|
||||
}
|
||||
|
||||
|
||||
int Field_varstring::pack_cmp(const char *b, uint key_length,
|
||||
int Field_varstring::pack_cmp(const char *b, uint key_length_arg,
|
||||
my_bool insert_or_update)
|
||||
{
|
||||
char *a= ptr+ length_bytes;
|
||||
uint a_length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
|
||||
uint b_length;
|
||||
uint char_length= ((field_charset->mbmaxlen > 1) ?
|
||||
key_length / field_charset->mbmaxlen : key_length);
|
||||
uint local_char_length= ((field_charset->mbmaxlen > 1) ?
|
||||
key_length_arg / field_charset->mbmaxlen :
|
||||
key_length_arg);
|
||||
|
||||
if (key_length > 255)
|
||||
if (key_length_arg > 255)
|
||||
{
|
||||
b_length=uint2korr(b); b+= HA_KEY_BLOB_LENGTH;
|
||||
}
|
||||
else
|
||||
b_length= (uint) (uchar) *b++;
|
||||
|
||||
if (a_length > char_length)
|
||||
if (a_length > local_char_length)
|
||||
{
|
||||
char_length= my_charpos(field_charset, a, a+a_length, char_length);
|
||||
set_if_smaller(a_length, char_length);
|
||||
local_char_length= my_charpos(field_charset, a, a+a_length,
|
||||
local_char_length);
|
||||
set_if_smaller(a_length, local_char_length);
|
||||
}
|
||||
|
||||
return field_charset->coll->strnncollsp(field_charset,
|
||||
@ -6922,13 +6910,15 @@ uint Field_varstring::max_packed_col_length(uint max_length)
|
||||
}
|
||||
|
||||
|
||||
void Field_varstring::get_key_image(char *buff, uint length, imagetype type)
|
||||
void Field_varstring::get_key_image(char *buff, uint length,
|
||||
imagetype type_arg)
|
||||
{
|
||||
uint f_length= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
|
||||
uint char_length= length / field_charset->mbmaxlen;
|
||||
uint local_char_length= length / field_charset->mbmaxlen;
|
||||
char *pos= ptr+length_bytes;
|
||||
char_length= my_charpos(field_charset, pos, pos + f_length, char_length);
|
||||
set_if_smaller(f_length, char_length);
|
||||
local_char_length= my_charpos(field_charset, pos, pos + f_length,
|
||||
local_char_length);
|
||||
set_if_smaller(f_length, local_char_length);
|
||||
/* Key is always stored with 2 bytes */
|
||||
int2store(buff,f_length);
|
||||
memcpy(buff+HA_KEY_BLOB_LENGTH, pos, f_length);
|
||||
@ -7009,11 +6999,11 @@ uint Field_varstring::is_equal(create_field *new_field)
|
||||
if (new_field->sql_type == real_type() &&
|
||||
new_field->charset == field_charset)
|
||||
{
|
||||
if (new_field->length == max_length())
|
||||
if (new_field->length == max_display_length())
|
||||
return IS_EQUAL_YES;
|
||||
if (new_field->length > max_length() &&
|
||||
((new_field->length <= 255 && max_length() <= 255) ||
|
||||
(new_field->length > 255 && max_length() > 255)))
|
||||
if (new_field->length > max_display_length() &&
|
||||
((new_field->length <= 255 && max_display_length() <= 255) ||
|
||||
(new_field->length > 255 && max_display_length() > 255)))
|
||||
return IS_EQUAL_PACK_LENGTH; // VARCHAR, longer variable length
|
||||
}
|
||||
return IS_EQUAL_NO;
|
||||
@ -7344,13 +7334,13 @@ int Field_blob::cmp_binary(const char *a_ptr, const char *b_ptr,
|
||||
|
||||
/* The following is used only when comparing a key */
|
||||
|
||||
void Field_blob::get_key_image(char *buff, uint length, imagetype type)
|
||||
void Field_blob::get_key_image(char *buff, uint length, imagetype type_arg)
|
||||
{
|
||||
uint32 blob_length= get_length(ptr);
|
||||
char *blob;
|
||||
|
||||
#ifdef HAVE_SPATIAL
|
||||
if (type == itMBR)
|
||||
if (type_arg == itMBR)
|
||||
{
|
||||
const char *dummy;
|
||||
MBR mbr;
|
||||
@ -7378,10 +7368,10 @@ void Field_blob::get_key_image(char *buff, uint length, imagetype type)
|
||||
#endif /*HAVE_SPATIAL*/
|
||||
|
||||
get_ptr(&blob);
|
||||
uint char_length= length / field_charset->mbmaxlen;
|
||||
char_length= my_charpos(field_charset, blob, blob + blob_length,
|
||||
char_length);
|
||||
set_if_smaller(blob_length, char_length);
|
||||
uint local_char_length= length / field_charset->mbmaxlen;
|
||||
local_char_length= my_charpos(field_charset, blob, blob + blob_length,
|
||||
local_char_length);
|
||||
set_if_smaller(blob_length, local_char_length);
|
||||
|
||||
if ((uint32) length > blob_length)
|
||||
{
|
||||
@ -7410,9 +7400,10 @@ int Field_blob::key_cmp(const byte *key_ptr, uint max_key_length)
|
||||
uint blob_length=get_length(ptr);
|
||||
memcpy_fixed(&blob1,ptr+packlength,sizeof(char*));
|
||||
CHARSET_INFO *cs= charset();
|
||||
uint char_length= max_key_length / cs->mbmaxlen;
|
||||
char_length= my_charpos(cs, blob1, blob1+blob_length, char_length);
|
||||
set_if_smaller(blob_length, char_length);
|
||||
uint local_char_length= max_key_length / cs->mbmaxlen;
|
||||
local_char_length= my_charpos(cs, blob1, blob1+blob_length,
|
||||
local_char_length);
|
||||
set_if_smaller(blob_length, local_char_length);
|
||||
return Field_blob::cmp(blob1, blob_length,
|
||||
(char*) key_ptr+HA_KEY_BLOB_LENGTH,
|
||||
uint2korr(key_ptr));
|
||||
@ -7534,11 +7525,11 @@ const char *Field_blob::unpack(char *to, const char *from)
|
||||
|
||||
/* Keys for blobs are like keys on varchars */
|
||||
|
||||
int Field_blob::pack_cmp(const char *a, const char *b, uint key_length,
|
||||
int Field_blob::pack_cmp(const char *a, const char *b, uint key_length_arg,
|
||||
my_bool insert_or_update)
|
||||
{
|
||||
uint a_length, b_length;
|
||||
if (key_length > 255)
|
||||
if (key_length_arg > 255)
|
||||
{
|
||||
a_length=uint2korr(a); a+=2;
|
||||
b_length=uint2korr(b); b+=2;
|
||||
@ -7555,19 +7546,19 @@ int Field_blob::pack_cmp(const char *a, const char *b, uint key_length,
|
||||
}
|
||||
|
||||
|
||||
int Field_blob::pack_cmp(const char *b, uint key_length,
|
||||
int Field_blob::pack_cmp(const char *b, uint key_length_arg,
|
||||
my_bool insert_or_update)
|
||||
{
|
||||
char *a;
|
||||
uint a_length, b_length;
|
||||
memcpy_fixed(&a,ptr+packlength,sizeof(char*));
|
||||
if (!a)
|
||||
return key_length > 0 ? -1 : 0;
|
||||
uint a_length=get_length(ptr);
|
||||
uint b_length;
|
||||
return key_length_arg > 0 ? -1 : 0;
|
||||
|
||||
if (key_length > 255)
|
||||
a_length= get_length(ptr);
|
||||
if (key_length_arg > 255)
|
||||
{
|
||||
b_length=uint2korr(b); b+=2;
|
||||
b_length= uint2korr(b); b+=2;
|
||||
}
|
||||
else
|
||||
b_length= (uint) (uchar) *b++;
|
||||
@ -7584,13 +7575,14 @@ char *Field_blob::pack_key(char *to, const char *from, uint max_length)
|
||||
char *save=ptr;
|
||||
ptr=(char*) from;
|
||||
uint32 length=get_length(); // Length of from string
|
||||
uint char_length= ((field_charset->mbmaxlen > 1) ?
|
||||
uint local_char_length= ((field_charset->mbmaxlen > 1) ?
|
||||
max_length/field_charset->mbmaxlen : max_length);
|
||||
if (length)
|
||||
get_ptr((char**) &from);
|
||||
if (length > char_length)
|
||||
char_length= my_charpos(field_charset, from, from+length, char_length);
|
||||
set_if_smaller(length, char_length);
|
||||
if (length > local_char_length)
|
||||
local_char_length= my_charpos(field_charset, from, from+length,
|
||||
local_char_length);
|
||||
set_if_smaller(length, local_char_length);
|
||||
*to++= (uchar) length;
|
||||
if (max_length > 255) // 2 byte length
|
||||
*to++= (uchar) (length >> 8);
|
||||
@ -7677,7 +7669,7 @@ uint Field_blob::max_packed_col_length(uint max_length)
|
||||
|
||||
#ifdef HAVE_SPATIAL
|
||||
|
||||
void Field_geom::get_key_image(char *buff, uint length, imagetype type)
|
||||
void Field_geom::get_key_image(char *buff, uint length, imagetype type_arg)
|
||||
{
|
||||
char *blob;
|
||||
const char *dummy;
|
||||
@ -7775,7 +7767,7 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
|
||||
goto err;
|
||||
wkb_type= uint4korr(from + SRID_SIZE + 1);
|
||||
if (wkb_type < (uint32) Geometry::wkb_point ||
|
||||
wkb_type > (uint32) Geometry::wkb_end)
|
||||
wkb_type > (uint32) Geometry::wkb_last)
|
||||
goto err;
|
||||
Field_blob::store_length(length);
|
||||
if (table->copy_blobs || length <= MAX_FIELD_WIDTH)
|
||||
@ -8204,7 +8196,7 @@ uint Field_num::is_equal(create_field *new_field)
|
||||
UNSIGNED_FLAG)) &&
|
||||
((new_field->flags & AUTO_INCREMENT_FLAG) ==
|
||||
(uint) (flags & AUTO_INCREMENT_FLAG)) &&
|
||||
(new_field->length <= max_length()));
|
||||
(new_field->length <= max_display_length()));
|
||||
}
|
||||
|
||||
|
||||
@ -8485,7 +8477,7 @@ int Field_bit::cmp_offset(uint row_offset)
|
||||
}
|
||||
|
||||
|
||||
void Field_bit::get_key_image(char *buff, uint length, imagetype type)
|
||||
void Field_bit::get_key_image(char *buff, uint length, imagetype type_arg)
|
||||
{
|
||||
if (bit_len)
|
||||
{
|
||||
@ -8659,7 +8651,7 @@ void create_field::create_length_to_internal_length(void)
|
||||
|
||||
|
||||
void create_field::init_for_tmp_table(enum_field_types sql_type_arg,
|
||||
uint32 length_arg, uint32 decimals,
|
||||
uint32 length_arg, uint32 decimals_arg,
|
||||
bool maybe_null, bool is_unsigned)
|
||||
{
|
||||
field_name= "";
|
||||
@ -8670,7 +8662,7 @@ void create_field::init_for_tmp_table(enum_field_types sql_type_arg,
|
||||
charset= &my_charset_bin;
|
||||
geom_type= Field::GEOM_GEOMETRY;
|
||||
pack_flag= (FIELDFLAG_NUMBER |
|
||||
((decimals & FIELDFLAG_MAX_DEC) << FIELDFLAG_DEC_SHIFT) |
|
||||
((decimals_arg & FIELDFLAG_MAX_DEC) << FIELDFLAG_DEC_SHIFT) |
|
||||
(maybe_null ? FIELDFLAG_MAYBE_NULL : 0) |
|
||||
(is_unsigned ? 0 : FIELDFLAG_DECIMAL));
|
||||
}
|
||||
@ -9378,12 +9370,13 @@ create_field::create_field(Field *old_field,Field *orig_field)
|
||||
maximum possible display length for blob
|
||||
|
||||
SYNOPSIS
|
||||
Field_blob::max_length()
|
||||
Field_blob::max_display_length()
|
||||
|
||||
RETURN
|
||||
length
|
||||
*/
|
||||
uint32 Field_blob::max_length()
|
||||
|
||||
uint32 Field_blob::max_display_length()
|
||||
{
|
||||
switch (packlength)
|
||||
{
|
||||
|
54
sql/field.h
54
sql/field.h
@ -158,12 +158,12 @@ public:
|
||||
virtual void reset_fields() {}
|
||||
virtual void set_default()
|
||||
{
|
||||
my_ptrdiff_t offset = (my_ptrdiff_t) (table->s->default_values -
|
||||
my_ptrdiff_t l_offset= (my_ptrdiff_t) (table->s->default_values -
|
||||
table->record[0]);
|
||||
memcpy(ptr, ptr + offset, pack_length());
|
||||
memcpy(ptr, ptr + l_offset, pack_length());
|
||||
if (null_ptr)
|
||||
*null_ptr= ((*null_ptr & (uchar) ~null_bit) |
|
||||
null_ptr[offset] & null_bit);
|
||||
null_ptr[l_offset] & null_bit);
|
||||
}
|
||||
virtual bool binary() const { return 1; }
|
||||
virtual bool zero_pack() const { return 1; }
|
||||
@ -276,7 +276,7 @@ public:
|
||||
{ memcpy(buff,ptr,length); }
|
||||
inline void set_image(char *buff,uint length, CHARSET_INFO *cs)
|
||||
{ memcpy(ptr,buff,length); }
|
||||
virtual void get_key_image(char *buff, uint length, imagetype type)
|
||||
virtual void get_key_image(char *buff, uint length, imagetype type_arg)
|
||||
{ get_image(buff,length, &my_charset_bin); }
|
||||
virtual void set_key_image(char *buff,uint length)
|
||||
{ set_image(buff,length, &my_charset_bin); }
|
||||
@ -352,10 +352,10 @@ public:
|
||||
virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; }
|
||||
virtual CHARSET_INFO *sort_charset(void) const { return charset(); }
|
||||
virtual bool has_charset(void) const { return FALSE; }
|
||||
virtual void set_charset(CHARSET_INFO *charset) { }
|
||||
virtual void set_charset(CHARSET_INFO *charset_arg) { }
|
||||
virtual enum Derivation derivation(void) const
|
||||
{ return DERIVATION_IMPLICIT; }
|
||||
virtual void set_derivation(enum Derivation derivation) { }
|
||||
virtual void set_derivation(enum Derivation derivation_arg) { }
|
||||
bool set_warning(MYSQL_ERROR::enum_warning_level, unsigned int code,
|
||||
int cuted_increment);
|
||||
bool check_int(const char *str, int length, const char *int_end,
|
||||
@ -380,7 +380,7 @@ public:
|
||||
}
|
||||
|
||||
/* maximum possible display length */
|
||||
virtual uint32 max_length()= 0;
|
||||
virtual uint32 max_display_length()= 0;
|
||||
|
||||
virtual uint is_equal(create_field *new_field);
|
||||
/* convert decimal to longlong with overflow check */
|
||||
@ -464,12 +464,12 @@ public:
|
||||
int store(const char *to,uint length,CHARSET_INFO *cs)=0;
|
||||
uint size_of() const { return sizeof(*this); }
|
||||
CHARSET_INFO *charset(void) const { return field_charset; }
|
||||
void set_charset(CHARSET_INFO *charset) { field_charset=charset; }
|
||||
void set_charset(CHARSET_INFO *charset_arg) { field_charset= charset_arg; }
|
||||
enum Derivation derivation(void) const { return field_derivation; }
|
||||
virtual void set_derivation(enum Derivation derivation_arg)
|
||||
{ field_derivation= derivation_arg; }
|
||||
bool binary() const { return field_charset == &my_charset_bin; }
|
||||
uint32 max_length() { return field_length; }
|
||||
uint32 max_display_length() { return field_length; }
|
||||
friend class create_field;
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
virtual bool str_needs_quotes() { return TRUE; }
|
||||
@ -484,9 +484,9 @@ class Field_longstr :public Field_str
|
||||
public:
|
||||
Field_longstr(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
|
||||
uchar null_bit_arg, utype unireg_check_arg,
|
||||
const char *field_name_arg, CHARSET_INFO *charset)
|
||||
const char *field_name_arg, CHARSET_INFO *charset_arg)
|
||||
:Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg,
|
||||
field_name_arg, charset)
|
||||
field_name_arg, charset_arg)
|
||||
{}
|
||||
|
||||
int store_decimal(const my_decimal *d);
|
||||
@ -532,7 +532,7 @@ public:
|
||||
void overflow(bool negative);
|
||||
bool zero_pack() const { return 0; }
|
||||
void sql_type(String &str) const;
|
||||
uint32 max_length() { return field_length; }
|
||||
uint32 max_display_length() { return field_length; }
|
||||
};
|
||||
|
||||
|
||||
@ -574,7 +574,7 @@ public:
|
||||
void sort_string(char *buff, uint length);
|
||||
bool zero_pack() const { return 0; }
|
||||
void sql_type(String &str) const;
|
||||
uint32 max_length() { return field_length; }
|
||||
uint32 max_display_length() { return field_length; }
|
||||
uint size_of() const { return sizeof(*this); }
|
||||
uint32 pack_length() const { return (uint32) bin_size; }
|
||||
uint is_equal(create_field *new_field);
|
||||
@ -607,7 +607,7 @@ public:
|
||||
void sort_string(char *buff,uint length);
|
||||
uint32 pack_length() const { return 1; }
|
||||
void sql_type(String &str) const;
|
||||
uint32 max_length() { return 4; }
|
||||
uint32 max_display_length() { return 4; }
|
||||
};
|
||||
|
||||
|
||||
@ -642,7 +642,7 @@ public:
|
||||
void sort_string(char *buff,uint length);
|
||||
uint32 pack_length() const { return 2; }
|
||||
void sql_type(String &str) const;
|
||||
uint32 max_length() { return 6; }
|
||||
uint32 max_display_length() { return 6; }
|
||||
};
|
||||
|
||||
|
||||
@ -672,7 +672,7 @@ public:
|
||||
void sort_string(char *buff,uint length);
|
||||
uint32 pack_length() const { return 3; }
|
||||
void sql_type(String &str) const;
|
||||
uint32 max_length() { return 8; }
|
||||
uint32 max_display_length() { return 8; }
|
||||
};
|
||||
|
||||
|
||||
@ -707,7 +707,7 @@ public:
|
||||
void sort_string(char *buff,uint length);
|
||||
uint32 pack_length() const { return 4; }
|
||||
void sql_type(String &str) const;
|
||||
uint32 max_length() { return 11; }
|
||||
uint32 max_display_length() { return 11; }
|
||||
};
|
||||
|
||||
|
||||
@ -749,7 +749,7 @@ public:
|
||||
uint32 pack_length() const { return 8; }
|
||||
void sql_type(String &str) const;
|
||||
bool can_be_compared_as_longlong() const { return TRUE; }
|
||||
uint32 max_length() { return 20; }
|
||||
uint32 max_display_length() { return 20; }
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -783,7 +783,7 @@ public:
|
||||
void sort_string(char *buff,uint length);
|
||||
uint32 pack_length() const { return sizeof(float); }
|
||||
void sql_type(String &str) const;
|
||||
uint32 max_length() { return 24; }
|
||||
uint32 max_display_length() { return 24; }
|
||||
};
|
||||
|
||||
|
||||
@ -816,7 +816,7 @@ public:
|
||||
void sort_string(char *buff,uint length);
|
||||
uint32 pack_length() const { return sizeof(double); }
|
||||
void sql_type(String &str) const;
|
||||
uint32 max_length() { return 53; }
|
||||
uint32 max_display_length() { return 53; }
|
||||
};
|
||||
|
||||
|
||||
@ -848,7 +848,7 @@ public:
|
||||
uint32 pack_length() const { return 0; }
|
||||
void sql_type(String &str) const;
|
||||
uint size_of() const { return sizeof(*this); }
|
||||
uint32 max_length() { return 4; }
|
||||
uint32 max_display_length() { return 4; }
|
||||
};
|
||||
|
||||
|
||||
@ -1229,10 +1229,10 @@ public:
|
||||
packlength= 4;
|
||||
if (set_packlength)
|
||||
{
|
||||
uint32 char_length= len_arg/cs->mbmaxlen;
|
||||
packlength= char_length <= 255 ? 1 :
|
||||
char_length <= 65535 ? 2 :
|
||||
char_length <= 16777215 ? 3 : 4;
|
||||
uint32 l_char_length= len_arg/cs->mbmaxlen;
|
||||
packlength= l_char_length <= 255 ? 1 :
|
||||
l_char_length <= 65535 ? 2 :
|
||||
l_char_length <= 16777215 ? 3 : 4;
|
||||
}
|
||||
}
|
||||
enum_field_types type() const { return MYSQL_TYPE_BLOB;}
|
||||
@ -1316,7 +1316,7 @@ public:
|
||||
uint size_of() const { return sizeof(*this); }
|
||||
bool has_charset(void) const
|
||||
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
|
||||
uint32 max_length();
|
||||
uint32 max_display_length();
|
||||
};
|
||||
|
||||
|
||||
@ -1445,7 +1445,7 @@ public:
|
||||
enum_field_types type() const { return MYSQL_TYPE_BIT; }
|
||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BIT; }
|
||||
uint32 key_length() const { return (uint32) (field_length + 7) / 8; }
|
||||
uint32 max_length() { return field_length; }
|
||||
uint32 max_display_length() { return field_length; }
|
||||
uint size_of() const { return sizeof(*this); }
|
||||
Item_result result_type () const { return INT_RESULT; }
|
||||
int reset(void) { bzero(ptr, bytes_in_rec); return 0; }
|
||||
|
@ -104,7 +104,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
|
||||
uint maxbuffer;
|
||||
BUFFPEK *buffpek;
|
||||
ha_rows records= HA_POS_ERROR;
|
||||
uchar **sort_keys;
|
||||
uchar **sort_keys= 0;
|
||||
IO_CACHE tempfile, buffpek_pointers, *selected_records_file, *outfile;
|
||||
SORTPARAM param;
|
||||
bool multi_byte_charset;
|
||||
@ -890,12 +890,14 @@ static void make_sortkey(register SORTPARAM *param,
|
||||
}
|
||||
else
|
||||
{
|
||||
uchar *end= (uchar*) field->pack((char *) to, field->ptr);
|
||||
#ifdef HAVE_purify
|
||||
uchar *end= (uchar*) field->pack((char *) to, field->ptr);
|
||||
uint length= (uint) ((to + addonf->length) - end);
|
||||
DBUG_ASSERT((int) length >= 0);
|
||||
if (length)
|
||||
bzero(end, length);
|
||||
#else
|
||||
(void) field->pack((char *) to, field->ptr);
|
||||
#endif
|
||||
}
|
||||
to+= addonf->length;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1131,7 +1131,7 @@ ndbcluster_update_slock(THD *thd,
|
||||
ndb_error= this_error;
|
||||
break;
|
||||
}
|
||||
end:
|
||||
|
||||
if (ndb_error)
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
|
||||
ER_GET_ERRMSG, ER(ER_GET_ERRMSG),
|
||||
|
@ -584,7 +584,6 @@ int ha_partition::drop_partitions(const char *path)
|
||||
List_iterator<partition_element> part_it(m_part_info->partitions);
|
||||
char part_name_buff[FN_REFLEN];
|
||||
uint no_parts= m_part_info->partitions.elements;
|
||||
uint part_count= 0;
|
||||
uint no_subparts= m_part_info->no_subparts;
|
||||
uint i= 0;
|
||||
uint name_variant;
|
||||
@ -1075,7 +1074,6 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
|
||||
uint no_parts= m_part_info->no_parts;
|
||||
uint no_subparts= m_part_info->no_subparts;
|
||||
uint i= 0;
|
||||
LEX *lex= thd->lex;
|
||||
int error;
|
||||
DBUG_ENTER("ha_partition::handle_opt_partitions");
|
||||
DBUG_PRINT("enter", ("all_parts %u, flag= %u", all_parts, flag));
|
||||
@ -1087,11 +1085,9 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
|
||||
{
|
||||
if (m_is_sub_partitioned)
|
||||
{
|
||||
List_iterator<partition_element> sub_it(part_elem->subpartitions);
|
||||
uint j= 0, part;
|
||||
do
|
||||
{
|
||||
partition_element *sub_elem= sub_it++;
|
||||
part= i * no_subparts + j;
|
||||
DBUG_PRINT("info", ("Optimize subpartition %u",
|
||||
part));
|
||||
@ -1136,7 +1132,6 @@ int ha_partition::prepare_new_partition(TABLE *table,
|
||||
{
|
||||
int error;
|
||||
bool create_flag= FALSE;
|
||||
bool open_flag= FALSE;
|
||||
DBUG_ENTER("prepare_new_partition");
|
||||
|
||||
if ((error= set_up_table_before_create(table, part_name, create_info,
|
||||
@ -1245,7 +1240,6 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
|
||||
handler **new_file_array;
|
||||
int error= 1;
|
||||
bool first;
|
||||
bool copy_parts= FALSE;
|
||||
uint temp_partitions= m_part_info->temp_partitions.elements;
|
||||
THD *thd= current_thd;
|
||||
DBUG_ENTER("ha_partition::change_partitions");
|
||||
@ -2061,7 +2055,6 @@ bool ha_partition::new_handlers_from_part_info(MEM_ROOT *mem_root)
|
||||
partition_element *part_elem;
|
||||
uint alloc_len= (m_tot_parts + 1) * sizeof(handler*);
|
||||
List_iterator_fast <partition_element> part_it(m_part_info->partitions);
|
||||
THD *thd= current_thd;
|
||||
DBUG_ENTER("ha_partition::new_handlers_from_part_info");
|
||||
|
||||
if (!(m_file= (handler **) alloc_root(mem_root, alloc_len)))
|
||||
|
@ -47,12 +47,6 @@ static handlerton *installed_htons[128];
|
||||
|
||||
KEY_CREATE_INFO default_key_create_info= { HA_KEY_ALG_UNDEF, 0, {NullS,0} };
|
||||
|
||||
/* static functions defined in this file */
|
||||
|
||||
static handler *create_default(TABLE_SHARE *table, MEM_ROOT *mem_root);
|
||||
|
||||
static SHOW_COMP_OPTION have_yes= SHOW_OPTION_YES;
|
||||
|
||||
/* number of entries in handlertons[] */
|
||||
ulong total_ha= 0;
|
||||
/* number of storage engines (from handlertons[]) that support 2pc */
|
||||
@ -167,11 +161,13 @@ const char *ha_get_storage_engine(enum legacy_db_type db_type)
|
||||
}
|
||||
|
||||
|
||||
#ifdef NOT_USED
|
||||
static handler *create_default(TABLE_SHARE *table, MEM_ROOT *mem_root)
|
||||
{
|
||||
handlerton *hton= ha_default_handlerton(current_thd);
|
||||
return (hton && hton->create) ? hton->create(hton, table, mem_root) : NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type)
|
||||
@ -726,7 +722,7 @@ int ha_commit_trans(THD *thd, bool all)
|
||||
}
|
||||
DBUG_EXECUTE_IF("crash_commit_after_prepare", abort(););
|
||||
if (error || (is_real_trans && xid &&
|
||||
(error= !(cookie= tc_log->log(thd, xid)))))
|
||||
(error= !(cookie= tc_log->log_xid(thd, xid)))))
|
||||
{
|
||||
ha_rollback_trans(thd, all);
|
||||
error= 1;
|
||||
@ -734,7 +730,7 @@ int ha_commit_trans(THD *thd, bool all)
|
||||
}
|
||||
DBUG_EXECUTE_IF("crash_commit_after_log", abort(););
|
||||
}
|
||||
error=ha_commit_one_phase(thd, all) ? cookie ? 2 : 1 : 0;
|
||||
error=ha_commit_one_phase(thd, all) ? (cookie ? 2 : 1) : 0;
|
||||
DBUG_EXECUTE_IF("crash_commit_before_unlog", abort(););
|
||||
if (cookie)
|
||||
tc_log->unlog(cookie, xid);
|
||||
@ -3345,7 +3341,6 @@ static my_bool exts_handlerton(THD *unused, st_plugin_int *plugin,
|
||||
|
||||
TYPELIB *ha_known_exts(void)
|
||||
{
|
||||
MEM_ROOT *mem_root= current_thd->mem_root;
|
||||
if (!known_extensions.type_names || mysys_usage_id != known_extensions_id)
|
||||
{
|
||||
List<char> found_exts;
|
||||
|
62
sql/item.cc
62
sql/item.cc
@ -25,10 +25,6 @@
|
||||
#include "sql_trigger.h"
|
||||
#include "sql_select.h"
|
||||
|
||||
static void mark_as_dependent(THD *thd,
|
||||
SELECT_LEX *last, SELECT_LEX *current,
|
||||
Item_ident *item);
|
||||
|
||||
const String my_null_string("NULL", 4, default_charset_info);
|
||||
|
||||
/****************************************************************************/
|
||||
@ -1718,7 +1714,7 @@ void Item_field::set_field(Field *field_par)
|
||||
field=result_field=field_par; // for easy coding with fields
|
||||
maybe_null=field->maybe_null();
|
||||
decimals= field->decimals();
|
||||
max_length= field_par->max_length();
|
||||
max_length= field_par->max_display_length();
|
||||
table_name= *field_par->table_name;
|
||||
field_name= field_par->field_name;
|
||||
db_name= field_par->table->s->db.str;
|
||||
@ -2427,21 +2423,22 @@ void Item_param::set_decimal(const char *str, ulong length)
|
||||
the fact that even wrong value sent over binary protocol fits into
|
||||
MAX_DATE_STRING_REP_LENGTH buffer.
|
||||
*/
|
||||
void Item_param::set_time(TIME *tm, timestamp_type type, uint32 max_length_arg)
|
||||
void Item_param::set_time(TIME *tm, timestamp_type time_type,
|
||||
uint32 max_length_arg)
|
||||
{
|
||||
DBUG_ENTER("Item_param::set_time");
|
||||
|
||||
value.time= *tm;
|
||||
value.time.time_type= type;
|
||||
value.time.time_type= time_type;
|
||||
|
||||
if (value.time.year > 9999 || value.time.month > 12 ||
|
||||
value.time.day > 31 ||
|
||||
type != MYSQL_TIMESTAMP_TIME && value.time.hour > 23 ||
|
||||
time_type != MYSQL_TIMESTAMP_TIME && value.time.hour > 23 ||
|
||||
value.time.minute > 59 || value.time.second > 59)
|
||||
{
|
||||
char buff[MAX_DATE_STRING_REP_LENGTH];
|
||||
uint length= my_TIME_to_str(&value.time, buff);
|
||||
make_truncated_value_warning(current_thd, buff, length, type, 0);
|
||||
make_truncated_value_warning(current_thd, buff, length, time_type, 0);
|
||||
set_zero_time(&value.time, MYSQL_TIMESTAMP_ERROR);
|
||||
}
|
||||
|
||||
@ -2907,7 +2904,7 @@ bool Item_param::basic_const_item() const
|
||||
|
||||
|
||||
Item *
|
||||
Item_param::new_item()
|
||||
Item_param::clone_item()
|
||||
{
|
||||
/* see comments in the header file */
|
||||
switch (state) {
|
||||
@ -3524,28 +3521,29 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
|
||||
thd->lex->in_sum_func->nest_level ==
|
||||
thd->lex->current_select->nest_level)
|
||||
{
|
||||
Item::Type type= (*reference)->type();
|
||||
Item::Type ref_type= (*reference)->type();
|
||||
set_if_bigger(thd->lex->in_sum_func->max_arg_level,
|
||||
select->nest_level);
|
||||
set_field(*from_field);
|
||||
fixed= 1;
|
||||
mark_as_dependent(thd, last_checked_context->select_lex,
|
||||
context->select_lex, this,
|
||||
((type == REF_ITEM || type == FIELD_ITEM) ?
|
||||
((ref_type == REF_ITEM ||
|
||||
ref_type == FIELD_ITEM) ?
|
||||
(Item_ident*) (*reference) : 0));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Item::Type type= (*reference)->type();
|
||||
Item::Type ref_type= (*reference)->type();
|
||||
prev_subselect_item->used_tables_cache|=
|
||||
(*reference)->used_tables();
|
||||
prev_subselect_item->const_item_cache&=
|
||||
(*reference)->const_item();
|
||||
mark_as_dependent(thd, last_checked_context->select_lex,
|
||||
context->select_lex, this,
|
||||
((type == REF_ITEM || type == FIELD_ITEM) ?
|
||||
((ref_type == REF_ITEM || ref_type == FIELD_ITEM) ?
|
||||
(Item_ident*) (*reference) :
|
||||
0));
|
||||
/*
|
||||
@ -4088,7 +4086,7 @@ Item *Item_field::replace_equal_field(byte *arg)
|
||||
|
||||
|
||||
void Item::init_make_field(Send_field *tmp_field,
|
||||
enum enum_field_types field_type)
|
||||
enum enum_field_types field_type_arg)
|
||||
{
|
||||
char *empty_name= (char*) "";
|
||||
tmp_field->db_name= empty_name;
|
||||
@ -4100,7 +4098,7 @@ void Item::init_make_field(Send_field *tmp_field,
|
||||
tmp_field->flags= (maybe_null ? 0 : NOT_NULL_FLAG) |
|
||||
(my_binary_compare(collation.collation) ?
|
||||
BINARY_FLAG : 0);
|
||||
tmp_field->type=field_type;
|
||||
tmp_field->type= field_type_arg;
|
||||
tmp_field->length=max_length;
|
||||
tmp_field->decimals=decimals;
|
||||
if (unsigned_flag)
|
||||
@ -4115,12 +4113,12 @@ void Item::make_field(Send_field *tmp_field)
|
||||
|
||||
enum_field_types Item::string_field_type() const
|
||||
{
|
||||
enum_field_types type= MYSQL_TYPE_VAR_STRING;
|
||||
enum_field_types f_type= MYSQL_TYPE_VAR_STRING;
|
||||
if (max_length >= 16777216)
|
||||
type= MYSQL_TYPE_LONG_BLOB;
|
||||
f_type= MYSQL_TYPE_LONG_BLOB;
|
||||
else if (max_length >= 65536)
|
||||
type= MYSQL_TYPE_MEDIUM_BLOB;
|
||||
return type;
|
||||
f_type= MYSQL_TYPE_MEDIUM_BLOB;
|
||||
return f_type;
|
||||
}
|
||||
|
||||
|
||||
@ -4490,7 +4488,7 @@ bool Item_int::eq(const Item *arg, bool binary_cmp) const
|
||||
}
|
||||
|
||||
|
||||
Item *Item_int_with_ref::new_item()
|
||||
Item *Item_int_with_ref::clone_item()
|
||||
{
|
||||
DBUG_ASSERT(ref->const_item());
|
||||
/*
|
||||
@ -4768,10 +4766,10 @@ bool Item_null::send(Protocol *protocol, String *packet)
|
||||
bool Item::send(Protocol *protocol, String *buffer)
|
||||
{
|
||||
bool result;
|
||||
enum_field_types type;
|
||||
enum_field_types f_type;
|
||||
LINT_INIT(result); // Will be set if null_value == 0
|
||||
|
||||
switch ((type=field_type())) {
|
||||
switch ((f_type=field_type())) {
|
||||
default:
|
||||
case MYSQL_TYPE_NULL:
|
||||
case MYSQL_TYPE_DECIMAL:
|
||||
@ -4850,7 +4848,7 @@ bool Item::send(Protocol *protocol, String *buffer)
|
||||
get_date(&tm, TIME_FUZZY_DATE);
|
||||
if (!null_value)
|
||||
{
|
||||
if (type == MYSQL_TYPE_DATE)
|
||||
if (f_type == MYSQL_TYPE_DATE)
|
||||
return protocol->store_date(&tm);
|
||||
else
|
||||
result= protocol->store(&tm);
|
||||
@ -5063,7 +5061,7 @@ bool Item_ref::fix_fields(THD *thd, Item **reference)
|
||||
goto error;
|
||||
if (from_field == view_ref_found)
|
||||
{
|
||||
Item::Type type= (*reference)->type();
|
||||
Item::Type refer_type= (*reference)->type();
|
||||
prev_subselect_item->used_tables_cache|=
|
||||
(*reference)->used_tables();
|
||||
prev_subselect_item->const_item_cache&=
|
||||
@ -5071,7 +5069,8 @@ bool Item_ref::fix_fields(THD *thd, Item **reference)
|
||||
DBUG_ASSERT((*reference)->type() == REF_ITEM);
|
||||
mark_as_dependent(thd, last_checked_context->select_lex,
|
||||
context->select_lex, this,
|
||||
((type == REF_ITEM || type == FIELD_ITEM) ?
|
||||
((refer_type == REF_ITEM ||
|
||||
refer_type == FIELD_ITEM) ?
|
||||
(Item_ident*) (*reference) :
|
||||
0));
|
||||
/*
|
||||
@ -5817,8 +5816,8 @@ bool Item_trigger_field::fix_fields(THD *thd, Item **items)
|
||||
{
|
||||
table_grants->want_privilege= want_privilege;
|
||||
|
||||
if (check_grant_column(thd, table_grants, triggers->table->s->db.str,
|
||||
triggers->table->s->table_name.str, field_name,
|
||||
if (check_grant_column(thd, table_grants, triggers->trigger_table->s->db.str,
|
||||
triggers->trigger_table->s->table_name.str, field_name,
|
||||
strlen(field_name), thd->security_ctx))
|
||||
return TRUE;
|
||||
}
|
||||
@ -5931,7 +5930,8 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
|
||||
DBUG_ASSERT(item_row->cols() == comp_item_row->cols());
|
||||
col= item_row->cols();
|
||||
while (col-- > 0)
|
||||
resolve_const_item(thd, item_row->addr(col), comp_item_row->el(col));
|
||||
resolve_const_item(thd, item_row->addr(col),
|
||||
comp_item_row->element_index(col));
|
||||
break;
|
||||
}
|
||||
/* Fallthrough */
|
||||
@ -6199,7 +6199,7 @@ bool Item_cache_row::setup(Item * item)
|
||||
return 1;
|
||||
for (uint i= 0; i < item_count; i++)
|
||||
{
|
||||
Item *el= item->el(i);
|
||||
Item *el= item->element_index(i);
|
||||
Item_cache *tmp;
|
||||
if (!(tmp= values[i]= Item_cache::get_cache(el->result_type())))
|
||||
return 1;
|
||||
@ -6215,7 +6215,7 @@ void Item_cache_row::store(Item * item)
|
||||
item->bring_value();
|
||||
for (uint i= 0; i < item_count; i++)
|
||||
{
|
||||
values[i]->store(item->el(i));
|
||||
values[i]->store(item->element_index(i));
|
||||
null_value|= values[i]->null_value;
|
||||
}
|
||||
}
|
||||
|
36
sql/item.h
36
sql/item.h
@ -687,7 +687,7 @@ public:
|
||||
*/
|
||||
virtual bool basic_const_item() const { return 0; }
|
||||
/* cloning of constant items (0 if it is not const) */
|
||||
virtual Item *new_item() { return 0; }
|
||||
virtual Item *clone_item() { return 0; }
|
||||
virtual cond_result eq_cmp_result() const { return COND_OK; }
|
||||
inline uint float_length(uint decimals_par) const
|
||||
{ return decimals != NOT_FIXED_DEC ? (DBL_DIG+2+decimals_par) : DBL_DIG+8;}
|
||||
@ -818,6 +818,7 @@ public:
|
||||
virtual bool collect_item_field_processor(byte * arg) { return 0; }
|
||||
virtual bool find_item_in_field_list_processor(byte *arg) { return 0; }
|
||||
virtual bool change_context_processor(byte *context) { return 0; }
|
||||
virtual bool reset_query_id_processor(byte *query_id_arg) { return 0; }
|
||||
virtual bool is_expensive_processor(byte *arg) { return 0; }
|
||||
virtual bool register_field_in_read_map(byte *arg) { return 0; }
|
||||
/*
|
||||
@ -895,11 +896,11 @@ public:
|
||||
For SP local variable returns address of pointer to Item representing its
|
||||
current value and pointer passed via parameter otherwise.
|
||||
*/
|
||||
virtual Item **this_item_addr(THD *thd, Item **addr) { return addr; }
|
||||
virtual Item **this_item_addr(THD *thd, Item **addr_arg) { return addr_arg; }
|
||||
|
||||
// Row emulation
|
||||
virtual uint cols() { return 1; }
|
||||
virtual Item* el(uint i) { return this; }
|
||||
virtual Item* element_index(uint i) { return this; }
|
||||
virtual Item** addr(uint i) { return 0; }
|
||||
virtual bool check_cols(uint c);
|
||||
// It is not row => null inside is impossible
|
||||
@ -1165,7 +1166,8 @@ class Item_name_const : public Item
|
||||
Item *value_item;
|
||||
Item *name_item;
|
||||
public:
|
||||
Item_name_const(Item *name, Item *val): value_item(val), name_item(name)
|
||||
Item_name_const(Item *name_arg, Item *val):
|
||||
value_item(val), name_item(name_arg)
|
||||
{
|
||||
Item::maybe_null= TRUE;
|
||||
}
|
||||
@ -1385,7 +1387,7 @@ public:
|
||||
Item *equal_fields_propagator(byte *arg);
|
||||
bool set_no_const_sub(byte *arg);
|
||||
Item *replace_equal_field(byte *arg);
|
||||
inline uint32 max_disp_length() { return field->max_length(); }
|
||||
inline uint32 max_disp_length() { return field->max_display_length(); }
|
||||
Item_field *filed_for_view_update() { return this; }
|
||||
Item *safe_charset_converter(CHARSET_INFO *tocs);
|
||||
int fix_outer_field(THD *thd, Field **field, Item **reference);
|
||||
@ -1419,7 +1421,7 @@ public:
|
||||
/* to prevent drop fixed flag (no need parent cleanup call) */
|
||||
void cleanup() {}
|
||||
bool basic_const_item() const { return 1; }
|
||||
Item *new_item() { return new Item_null(name); }
|
||||
Item *clone_item() { return new Item_null(name); }
|
||||
bool is_null() { return 1; }
|
||||
void print(String *str) { str->append(STRING_WITH_LEN("NULL")); }
|
||||
Item *safe_charset_converter(CHARSET_INFO *tocs);
|
||||
@ -1568,7 +1570,7 @@ public:
|
||||
basic_const_item returned TRUE.
|
||||
*/
|
||||
Item *safe_charset_converter(CHARSET_INFO *tocs);
|
||||
Item *new_item();
|
||||
Item *clone_item();
|
||||
/*
|
||||
Implement by-value equality evaluation if parameter value
|
||||
is set and is a basic constant (integer, real or string).
|
||||
@ -1600,7 +1602,7 @@ public:
|
||||
String *val_str(String*);
|
||||
int save_in_field(Field *field, bool no_conversions);
|
||||
bool basic_const_item() const { return 1; }
|
||||
Item *new_item() { return new Item_int(name,value,max_length); }
|
||||
Item *clone_item() { return new Item_int(name,value,max_length); }
|
||||
// to prevent drop fixed flag (no need parent cleanup call)
|
||||
void cleanup() {}
|
||||
void print(String *str);
|
||||
@ -1620,7 +1622,7 @@ public:
|
||||
double val_real()
|
||||
{ DBUG_ASSERT(fixed == 1); return ulonglong2double((ulonglong)value); }
|
||||
String *val_str(String*);
|
||||
Item *new_item() { return new Item_uint(name,max_length); }
|
||||
Item *clone_item() { return new Item_uint(name,max_length); }
|
||||
int save_in_field(Field *field, bool no_conversions);
|
||||
void print(String *str);
|
||||
Item_num *neg ();
|
||||
@ -1651,7 +1653,7 @@ public:
|
||||
my_decimal *val_decimal(my_decimal *val) { return &decimal_value; }
|
||||
int save_in_field(Field *field, bool no_conversions);
|
||||
bool basic_const_item() const { return 1; }
|
||||
Item *new_item()
|
||||
Item *clone_item()
|
||||
{
|
||||
return new Item_decimal(name, &decimal_value, decimals, max_length);
|
||||
}
|
||||
@ -1709,7 +1711,7 @@ public:
|
||||
bool basic_const_item() const { return 1; }
|
||||
// to prevent drop fixed flag (no need parent cleanup call)
|
||||
void cleanup() {}
|
||||
Item *new_item()
|
||||
Item *clone_item()
|
||||
{ return new Item_float(name, value, decimals, max_length); }
|
||||
Item_num *neg() { value= -value; return this; }
|
||||
void print(String *str);
|
||||
@ -1795,7 +1797,7 @@ public:
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; }
|
||||
bool basic_const_item() const { return 1; }
|
||||
bool eq(const Item *item, bool binary_cmp) const;
|
||||
Item *new_item()
|
||||
Item *clone_item()
|
||||
{
|
||||
return new Item_string(name, str_value.ptr(),
|
||||
str_value.length(), collation.collation);
|
||||
@ -1849,9 +1851,9 @@ class Item_return_int :public Item_int
|
||||
{
|
||||
enum_field_types int_field_type;
|
||||
public:
|
||||
Item_return_int(const char *name, uint length,
|
||||
Item_return_int(const char *name_arg, uint length,
|
||||
enum_field_types field_type_arg)
|
||||
:Item_int(name, 0, length), int_field_type(field_type_arg)
|
||||
:Item_int(name_arg, 0, length), int_field_type(field_type_arg)
|
||||
{
|
||||
unsigned_flag=1;
|
||||
}
|
||||
@ -2115,7 +2117,7 @@ public:
|
||||
{
|
||||
return ref->save_in_field(field, no_conversions);
|
||||
}
|
||||
Item *new_item();
|
||||
Item *clone_item();
|
||||
virtual Item *real_item() { return ref; }
|
||||
bool check_partition_func_processor(byte *int_arg) {return TRUE;}
|
||||
};
|
||||
@ -2553,8 +2555,8 @@ public:
|
||||
enum Item_result result_type() const { return ROW_RESULT; }
|
||||
|
||||
uint cols() { return item_count; }
|
||||
Item* el(uint i) { return values[i]; }
|
||||
Item** addr(uint i) { return (Item **) (values + i); }
|
||||
Item *element_index(uint i) { return values[i]; }
|
||||
Item **addr(uint i) { return (Item **) (values + i); }
|
||||
bool check_cols(uint c);
|
||||
bool null_inside();
|
||||
void bring_value();
|
||||
|
@ -322,7 +322,7 @@ static bool convert_constant_item(THD *thd, Field *field, Item **item)
|
||||
void Item_bool_func2::fix_length_and_dec()
|
||||
{
|
||||
max_length= 1; // Function returns 0 or 1
|
||||
THD *thd= current_thd;
|
||||
THD *thd;
|
||||
|
||||
/*
|
||||
As some compare functions are generated after sql_yacc,
|
||||
@ -360,12 +360,13 @@ void Item_bool_func2::fix_length_and_dec()
|
||||
return;
|
||||
}
|
||||
|
||||
thd= current_thd;
|
||||
if (!thd->is_context_analysis_only())
|
||||
{
|
||||
Item *real_item= args[0]->real_item();
|
||||
if (real_item->type() == FIELD_ITEM)
|
||||
Item *arg_real_item= args[0]->real_item();
|
||||
if (arg_real_item->type() == FIELD_ITEM)
|
||||
{
|
||||
Field *field=((Item_field*) real_item)->field;
|
||||
Field *field=((Item_field*) arg_real_item)->field;
|
||||
if (field->can_be_compared_as_longlong())
|
||||
{
|
||||
if (convert_constant_item(thd, field,&args[1]))
|
||||
@ -377,10 +378,10 @@ void Item_bool_func2::fix_length_and_dec()
|
||||
}
|
||||
}
|
||||
}
|
||||
real_item= args[1]->real_item();
|
||||
if (real_item->type() == FIELD_ITEM /* && !real_item->const_item() */)
|
||||
arg_real_item= args[1]->real_item();
|
||||
if (arg_real_item->type() == FIELD_ITEM)
|
||||
{
|
||||
Field *field=((Item_field*) real_item)->field;
|
||||
Field *field=((Item_field*) arg_real_item)->field;
|
||||
if (field->can_be_compared_as_longlong())
|
||||
{
|
||||
if (convert_constant_item(thd, field,&args[0]))
|
||||
@ -416,9 +417,9 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type)
|
||||
return 1;
|
||||
for (uint i=0; i < n; i++)
|
||||
{
|
||||
if ((*a)->el(i)->cols() != (*b)->el(i)->cols())
|
||||
if ((*a)->element_index(i)->cols() != (*b)->element_index(i)->cols())
|
||||
{
|
||||
my_error(ER_OPERAND_COLUMNS, MYF(0), (*a)->el(i)->cols());
|
||||
my_error(ER_OPERAND_COLUMNS, MYF(0), (*a)->element_index(i)->cols());
|
||||
return 1;
|
||||
}
|
||||
comparators[i].set_cmp_func(owner, (*a)->addr(i), (*b)->addr(i));
|
||||
@ -803,10 +804,10 @@ bool Item_in_optimizer::fix_left(THD *thd, Item **ref)
|
||||
uint n= cache->cols();
|
||||
for (uint i= 0; i < n; i++)
|
||||
{
|
||||
if (args[0]->el(i)->used_tables())
|
||||
((Item_cache *)cache->el(i))->set_used_tables(OUTER_REF_TABLE_BIT);
|
||||
if (args[0]->element_index(i)->used_tables())
|
||||
((Item_cache *)cache->element_index(i))->set_used_tables(OUTER_REF_TABLE_BIT);
|
||||
else
|
||||
((Item_cache *)cache->el(i))->set_used_tables(0);
|
||||
((Item_cache *)cache->element_index(i))->set_used_tables(0);
|
||||
}
|
||||
used_tables_cache= args[0]->used_tables();
|
||||
}
|
||||
@ -881,7 +882,7 @@ longlong Item_in_optimizer::val_int()
|
||||
if (cache->cols() == 1)
|
||||
{
|
||||
item_subs->set_cond_guard_var(0, FALSE);
|
||||
longlong tmp= args[1]->val_bool_result();
|
||||
(void) args[1]->val_bool_result();
|
||||
result_for_null_param= null_value= !item_subs->engine->no_rows();
|
||||
item_subs->set_cond_guard_var(0, TRUE);
|
||||
}
|
||||
@ -895,11 +896,11 @@ longlong Item_in_optimizer::val_int()
|
||||
*/
|
||||
for (i= 0; i < ncols; i++)
|
||||
{
|
||||
if (cache->el(i)->null_value)
|
||||
if (cache->element_index(i)->null_value)
|
||||
item_subs->set_cond_guard_var(i, FALSE);
|
||||
}
|
||||
|
||||
longlong tmp= args[1]->val_bool_result();
|
||||
(void) args[1]->val_bool_result();
|
||||
result_for_null_param= null_value= !item_subs->engine->no_rows();
|
||||
|
||||
/* Turn all predicates back on */
|
||||
@ -1019,15 +1020,17 @@ longlong Item_func_strcmp::val_int()
|
||||
|
||||
void Item_func_interval::fix_length_and_dec()
|
||||
{
|
||||
use_decimal_comparison= (row->el(0)->result_type() == DECIMAL_RESULT) ||
|
||||
(row->el(0)->result_type() == INT_RESULT);
|
||||
use_decimal_comparison= ((row->element_index(0)->result_type() ==
|
||||
DECIMAL_RESULT) ||
|
||||
(row->element_index(0)->result_type() ==
|
||||
INT_RESULT));
|
||||
if (row->cols() > 8)
|
||||
{
|
||||
bool consts=1;
|
||||
|
||||
for (uint i=1 ; consts && i < row->cols() ; i++)
|
||||
{
|
||||
consts&= row->el(i)->const_item();
|
||||
consts&= row->element_index(i)->const_item();
|
||||
}
|
||||
|
||||
if (consts &&
|
||||
@ -1038,7 +1041,7 @@ void Item_func_interval::fix_length_and_dec()
|
||||
{
|
||||
for (uint i=1 ; i < row->cols(); i++)
|
||||
{
|
||||
Item *el= row->el(i);
|
||||
Item *el= row->element_index(i);
|
||||
interval_range *range= intervals + (i-1);
|
||||
if ((el->result_type() == DECIMAL_RESULT) ||
|
||||
(el->result_type() == INT_RESULT))
|
||||
@ -1063,7 +1066,7 @@ void Item_func_interval::fix_length_and_dec()
|
||||
{
|
||||
for (uint i=1 ; i < row->cols(); i++)
|
||||
{
|
||||
intervals[i-1].dbl= row->el(i)->val_real();
|
||||
intervals[i-1].dbl= row->element_index(i)->val_real();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1103,15 +1106,15 @@ longlong Item_func_interval::val_int()
|
||||
|
||||
if (use_decimal_comparison)
|
||||
{
|
||||
dec= row->el(0)->val_decimal(&dec_buf);
|
||||
if (row->el(0)->null_value)
|
||||
dec= row->element_index(0)->val_decimal(&dec_buf);
|
||||
if (row->element_index(0)->null_value)
|
||||
return -1;
|
||||
my_decimal2double(E_DEC_FATAL_ERROR, dec, &value);
|
||||
}
|
||||
else
|
||||
{
|
||||
value= row->el(0)->val_real();
|
||||
if (row->el(0)->null_value)
|
||||
value= row->element_index(0)->val_real();
|
||||
if (row->element_index(0)->null_value)
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1147,16 +1150,16 @@ longlong Item_func_interval::val_int()
|
||||
|
||||
for (i=1 ; i < row->cols() ; i++)
|
||||
{
|
||||
Item *el= row->el(i);
|
||||
Item *el= row->element_index(i);
|
||||
if (use_decimal_comparison &&
|
||||
((el->result_type() == DECIMAL_RESULT) ||
|
||||
(el->result_type() == INT_RESULT)))
|
||||
{
|
||||
my_decimal e_dec_buf, *e_dec= row->el(i)->val_decimal(&e_dec_buf);
|
||||
my_decimal e_dec_buf, *e_dec= row->element_index(i)->val_decimal(&e_dec_buf);
|
||||
if (my_decimal_cmp(e_dec, dec) > 0)
|
||||
return i-1;
|
||||
}
|
||||
else if (row->el(i)->val_real() > value)
|
||||
else if (row->element_index(i)->val_real() > value)
|
||||
return i-1;
|
||||
}
|
||||
return i-1;
|
||||
@ -1850,7 +1853,9 @@ bool Item_func_case::fix_fields(THD *thd, Item **ref)
|
||||
buff should match stack usage from
|
||||
Item_func_case::val_int() -> Item_func_case::find_item()
|
||||
*/
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
char buff[MAX_FIELD_WIDTH*2+sizeof(String)*2+sizeof(String*)*2+sizeof(double)*2+sizeof(longlong)*2];
|
||||
#endif
|
||||
bool res= Item_func::fix_fields(thd, ref);
|
||||
/*
|
||||
Call check_stack_overrun after fix_fields to be sure that stack variable
|
||||
@ -1867,7 +1872,6 @@ void Item_func_case::fix_length_and_dec()
|
||||
{
|
||||
Item **agg;
|
||||
uint nagg;
|
||||
THD *thd= current_thd;
|
||||
uint found_types= 0;
|
||||
if (!(agg= (Item**) sql_alloc(sizeof(Item*)*(ncases+1))))
|
||||
return;
|
||||
@ -2328,11 +2332,11 @@ void cmp_item_row::store_value(Item *item)
|
||||
{
|
||||
if (!comparators[i])
|
||||
if (!(comparators[i]=
|
||||
cmp_item::get_comparator(item->el(i)->result_type(),
|
||||
item->el(i)->collation.collation)))
|
||||
cmp_item::get_comparator(item->element_index(i)->result_type(),
|
||||
item->element_index(i)->collation.collation)))
|
||||
break; // new failed
|
||||
comparators[i]->store_value(item->el(i));
|
||||
item->null_value|= item->el(i)->null_value;
|
||||
comparators[i]->store_value(item->element_index(i));
|
||||
item->null_value|= item->element_index(i)->null_value;
|
||||
}
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
@ -2357,8 +2361,8 @@ void cmp_item_row::store_value_by_template(cmp_item *t, Item *item)
|
||||
if (!(comparators[i]= tmpl->comparators[i]->make_same()))
|
||||
break; // new failed
|
||||
comparators[i]->store_value_by_template(tmpl->comparators[i],
|
||||
item->el(i));
|
||||
item->null_value|= item->el(i)->null_value;
|
||||
item->element_index(i));
|
||||
item->null_value|= item->element_index(i)->null_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2376,9 +2380,9 @@ int cmp_item_row::cmp(Item *arg)
|
||||
arg->bring_value();
|
||||
for (uint i=0; i < n; i++)
|
||||
{
|
||||
if (comparators[i]->cmp(arg->el(i)))
|
||||
if (comparators[i]->cmp(arg->element_index(i)))
|
||||
{
|
||||
if (!arg->el(i)->null_value)
|
||||
if (!arg->element_index(i)->null_value)
|
||||
return 1;
|
||||
was_null= 1;
|
||||
}
|
||||
@ -2389,11 +2393,11 @@ int cmp_item_row::cmp(Item *arg)
|
||||
|
||||
int cmp_item_row::compare(cmp_item *c)
|
||||
{
|
||||
cmp_item_row *cmp= (cmp_item_row *) c;
|
||||
cmp_item_row *l_cmp= (cmp_item_row *) c;
|
||||
for (uint i=0; i < n; i++)
|
||||
{
|
||||
int res;
|
||||
if ((res= comparators[i]->compare(cmp->comparators[i])))
|
||||
if ((res= comparators[i]->compare(l_cmp->comparators[i])))
|
||||
return res;
|
||||
}
|
||||
return 0;
|
||||
@ -2420,8 +2424,8 @@ int cmp_item_decimal::cmp(Item *arg)
|
||||
|
||||
int cmp_item_decimal::compare(cmp_item *arg)
|
||||
{
|
||||
cmp_item_decimal *cmp= (cmp_item_decimal*) arg;
|
||||
return my_decimal_cmp(&value, &cmp->value);
|
||||
cmp_item_decimal *l_cmp= (cmp_item_decimal*) arg;
|
||||
return my_decimal_cmp(&value, &l_cmp->value);
|
||||
}
|
||||
|
||||
|
||||
|
@ -815,10 +815,10 @@ public:
|
||||
return (value_res ? (res ? sortcmp(value_res, res, cmp_charset) : 1) :
|
||||
(res ? -1 : 0));
|
||||
}
|
||||
int compare(cmp_item *c)
|
||||
int compare(cmp_item *ci)
|
||||
{
|
||||
cmp_item_string *cmp= (cmp_item_string *)c;
|
||||
return sortcmp(value_res, cmp->value_res, cmp_charset);
|
||||
cmp_item_string *l_cmp= (cmp_item_string *) ci;
|
||||
return sortcmp(value_res, l_cmp->value_res, cmp_charset);
|
||||
}
|
||||
cmp_item *make_same();
|
||||
void set_charset(CHARSET_INFO *cs)
|
||||
@ -841,10 +841,10 @@ public:
|
||||
{
|
||||
return value != arg->val_int();
|
||||
}
|
||||
int compare(cmp_item *c)
|
||||
int compare(cmp_item *ci)
|
||||
{
|
||||
cmp_item_int *cmp= (cmp_item_int *)c;
|
||||
return (value < cmp->value) ? -1 : ((value == cmp->value) ? 0 : 1);
|
||||
cmp_item_int *l_cmp= (cmp_item_int *)ci;
|
||||
return (value < l_cmp->value) ? -1 : ((value == l_cmp->value) ? 0 : 1);
|
||||
}
|
||||
cmp_item *make_same();
|
||||
};
|
||||
@ -862,10 +862,10 @@ public:
|
||||
{
|
||||
return value != arg->val_real();
|
||||
}
|
||||
int compare(cmp_item *c)
|
||||
int compare(cmp_item *ci)
|
||||
{
|
||||
cmp_item_real *cmp= (cmp_item_real *)c;
|
||||
return (value < cmp->value)? -1 : ((value == cmp->value) ? 0 : 1);
|
||||
cmp_item_real *l_cmp= (cmp_item_real *) ci;
|
||||
return (value < l_cmp->value)? -1 : ((value == l_cmp->value) ? 0 : 1);
|
||||
}
|
||||
cmp_item *make_same();
|
||||
};
|
||||
@ -931,10 +931,10 @@ public:
|
||||
DBUG_ASSERT(0);
|
||||
return 1;
|
||||
}
|
||||
int compare(cmp_item *c)
|
||||
int compare(cmp_item *ci)
|
||||
{
|
||||
cmp_item_string *cmp= (cmp_item_string *)c;
|
||||
return sortcmp(value_res, cmp->value_res, cmp_charset);
|
||||
cmp_item_string *l_cmp= (cmp_item_string *) ci;
|
||||
return sortcmp(value_res, l_cmp->value_res, cmp_charset);
|
||||
}
|
||||
cmp_item *make_same()
|
||||
{
|
||||
@ -1452,7 +1452,7 @@ public:
|
||||
Item_cond_and() :Item_cond() {}
|
||||
Item_cond_and(Item *i1,Item *i2) :Item_cond(i1,i2) {}
|
||||
Item_cond_and(THD *thd, Item_cond_and *item) :Item_cond(thd, item) {}
|
||||
Item_cond_and(List<Item> &list): Item_cond(list) {}
|
||||
Item_cond_and(List<Item> &list_arg): Item_cond(list_arg) {}
|
||||
enum Functype functype() const { return COND_AND_FUNC; }
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "and"; }
|
||||
@ -1474,7 +1474,7 @@ public:
|
||||
Item_cond_or() :Item_cond() {}
|
||||
Item_cond_or(Item *i1,Item *i2) :Item_cond(i1,i2) {}
|
||||
Item_cond_or(THD *thd, Item_cond_or *item) :Item_cond(thd, item) {}
|
||||
Item_cond_or(List<Item> &list): Item_cond(list) {}
|
||||
Item_cond_or(List<Item> &list_arg): Item_cond(list_arg) {}
|
||||
enum Functype functype() const { return COND_OR_FUNC; }
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "or"; }
|
||||
|
@ -997,7 +997,7 @@ String *Item_decimal_typecast::val_str(String *str)
|
||||
my_decimal tmp_buf, *tmp= val_decimal(&tmp_buf);
|
||||
if (null_value)
|
||||
return NULL;
|
||||
my_decimal2string(E_DEC_FATAL_ERROR, &tmp_buf, 0, 0, 0, str);
|
||||
my_decimal2string(E_DEC_FATAL_ERROR, tmp, 0, 0, 0, str);
|
||||
return str;
|
||||
}
|
||||
|
||||
@ -2375,7 +2375,7 @@ longlong Item_func_locate::val_int()
|
||||
b->ptr(), b->length(),
|
||||
&match, 1))
|
||||
return 0;
|
||||
return (longlong) match.mblen + start0 + 1;
|
||||
return (longlong) match.mb_len + start0 + 1;
|
||||
}
|
||||
|
||||
|
||||
@ -3179,9 +3179,9 @@ longlong Item_master_pos_wait::val_int()
|
||||
null_value = 1;
|
||||
return 0;
|
||||
}
|
||||
#ifdef HAVE_REPLICATION
|
||||
longlong pos = (ulong)args[1]->val_int();
|
||||
longlong timeout = (arg_count==3) ? args[2]->val_int() : 0 ;
|
||||
#ifdef HAVE_REPLICATION
|
||||
if ((event_count = active_mi->rli.wait_for_pos(thd, log_name, pos, timeout)) == -2)
|
||||
{
|
||||
null_value = 1;
|
||||
@ -3717,7 +3717,8 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length,
|
||||
|
||||
|
||||
bool
|
||||
Item_func_set_user_var::update_hash(void *ptr, uint length, Item_result type,
|
||||
Item_func_set_user_var::update_hash(void *ptr, uint length,
|
||||
Item_result res_type,
|
||||
CHARSET_INFO *cs, Derivation dv,
|
||||
bool unsigned_arg)
|
||||
{
|
||||
@ -3726,9 +3727,9 @@ Item_func_set_user_var::update_hash(void *ptr, uint length, Item_result type,
|
||||
result type of the variable
|
||||
*/
|
||||
if ((null_value= args[0]->null_value) && null_item)
|
||||
type= entry->type; // Don't change type of item
|
||||
res_type= entry->type; // Don't change type of item
|
||||
if (::update_hash(entry, (null_value= args[0]->null_value),
|
||||
ptr, length, type, cs, dv, unsigned_arg))
|
||||
ptr, length, res_type, cs, dv, unsigned_arg))
|
||||
{
|
||||
current_thd->fatal_error(); // Probably end of memory
|
||||
null_value= 1;
|
||||
@ -4866,7 +4867,7 @@ longlong Item_func_bit_xor::val_int()
|
||||
thd Thread handler
|
||||
var_type global / session
|
||||
name Name of base or system variable
|
||||
component Component.
|
||||
component Component
|
||||
|
||||
NOTES
|
||||
If component.str = 0 then the variable name is in 'name'
|
||||
@ -4978,8 +4979,9 @@ longlong Item_func_row_count::val_int()
|
||||
}
|
||||
|
||||
|
||||
Item_func_sp::Item_func_sp(Name_resolution_context *context_arg, sp_name *name)
|
||||
:Item_func(), context(context_arg), m_name(name), m_sp(NULL),
|
||||
Item_func_sp::Item_func_sp(Name_resolution_context *context_arg,
|
||||
sp_name *name_arg)
|
||||
:Item_func(), context(context_arg), m_name(name_arg), m_sp(NULL),
|
||||
result_field(NULL)
|
||||
{
|
||||
maybe_null= 1;
|
||||
@ -4990,8 +4992,8 @@ Item_func_sp::Item_func_sp(Name_resolution_context *context_arg, sp_name *name)
|
||||
|
||||
|
||||
Item_func_sp::Item_func_sp(Name_resolution_context *context_arg,
|
||||
sp_name *name, List<Item> &list)
|
||||
:Item_func(list), context(context_arg), m_name(name), m_sp(NULL),
|
||||
sp_name *name_arg, List<Item> &list)
|
||||
:Item_func(list), context(context_arg), m_name(name_arg), m_sp(NULL),
|
||||
result_field(NULL)
|
||||
{
|
||||
maybe_null= 1;
|
||||
|
@ -701,8 +701,9 @@ double Item_func_glength::val_real()
|
||||
|
||||
null_value= (!swkb ||
|
||||
!(geom= Geometry::construct(&buffer,
|
||||
swkb->ptr(), swkb->length())) ||
|
||||
geom->length(&res));
|
||||
swkb->ptr(),
|
||||
swkb->length())) ||
|
||||
geom->geom_length(&res));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
Item *transform(Item_transformer transformer, byte *arg);
|
||||
|
||||
uint cols() { return arg_count; }
|
||||
Item* el(uint i) { return items[i]; }
|
||||
Item* element_index(uint i) { return items[i]; }
|
||||
Item** addr(uint i) { return items + i; }
|
||||
bool check_cols(uint c);
|
||||
bool null_inside() { return with_null; };
|
||||
|
@ -37,15 +37,6 @@ C_MODE_END
|
||||
|
||||
String my_empty_string("",default_charset_info);
|
||||
|
||||
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2,
|
||||
const char *fname)
|
||||
{
|
||||
my_error(ER_CANT_AGGREGATE_2COLLATIONS, MYF(0),
|
||||
c1.collation->name, c1.derivation_name(),
|
||||
c2.collation->name, c2.derivation_name(),
|
||||
fname);
|
||||
}
|
||||
|
||||
|
||||
String *Item_str_func::check_well_formed_result(String *str)
|
||||
{
|
||||
@ -3273,15 +3264,17 @@ String *Item_func_uuid::val_str(String *str)
|
||||
int i;
|
||||
if (my_gethwaddr(mac))
|
||||
{
|
||||
/* purecov: begin inspected */
|
||||
/*
|
||||
generating random "hardware addr"
|
||||
and because specs explicitly specify that it should NOT correlate
|
||||
with a clock_seq value (initialized random below), we use a separate
|
||||
randominit() here
|
||||
*/
|
||||
randominit(&uuid_rand, tmp + (ulong) thd, tmp + (ulong)query_id);
|
||||
randominit(&uuid_rand, tmp + (ulong) thd, tmp + (ulong)global_query_id);
|
||||
for (i=0; i < (int)sizeof(mac); i++)
|
||||
mac[i]=(uchar)(my_rnd(&uuid_rand)*255);
|
||||
/* purecov: end */
|
||||
}
|
||||
s=clock_seq_and_node_str+sizeof(clock_seq_and_node_str)-1;
|
||||
for (i=sizeof(mac)-1 ; i>=0 ; i--)
|
||||
@ -3289,7 +3282,7 @@ String *Item_func_uuid::val_str(String *str)
|
||||
*--s=_dig_vec_lower[mac[i] & 15];
|
||||
*--s=_dig_vec_lower[mac[i] >> 4];
|
||||
}
|
||||
randominit(&uuid_rand, tmp + (ulong)start_time,
|
||||
randominit(&uuid_rand, tmp + (ulong) server_start_time,
|
||||
tmp + thd->status_var.bytes_sent);
|
||||
set_clock_seq_str();
|
||||
}
|
||||
|
@ -275,11 +275,11 @@ bool Item_subselect::const_item() const
|
||||
return const_item_cache;
|
||||
}
|
||||
|
||||
Item *Item_subselect::get_tmp_table_item(THD *thd)
|
||||
Item *Item_subselect::get_tmp_table_item(THD *thd_arg)
|
||||
{
|
||||
if (!with_sum_func && !const_item())
|
||||
return new Item_field(result_field);
|
||||
return copy_or_same(thd);
|
||||
return copy_or_same(thd_arg);
|
||||
}
|
||||
|
||||
void Item_subselect::update_used_tables()
|
||||
@ -594,13 +594,13 @@ void Item_exists_subselect::print(String *str)
|
||||
}
|
||||
|
||||
|
||||
bool Item_in_subselect::test_limit(SELECT_LEX_UNIT *unit)
|
||||
bool Item_in_subselect::test_limit(SELECT_LEX_UNIT *unit_arg)
|
||||
{
|
||||
if (unit->fake_select_lex &&
|
||||
unit->fake_select_lex->test_limit())
|
||||
if (unit_arg->fake_select_lex &&
|
||||
unit_arg->fake_select_lex->test_limit())
|
||||
return(1);
|
||||
|
||||
SELECT_LEX *sl= unit->first_select();
|
||||
SELECT_LEX *sl= unit_arg->first_select();
|
||||
for (; sl; sl= sl->next_select())
|
||||
{
|
||||
if (sl->test_limit())
|
||||
@ -872,7 +872,6 @@ Item_subselect::trans_res
|
||||
Item_in_subselect::single_value_transformer(JOIN *join,
|
||||
Comp_creator *func)
|
||||
{
|
||||
Item_subselect::trans_res result= RES_ERROR;
|
||||
SELECT_LEX *select_lex= join->select_lex;
|
||||
DBUG_ENTER("Item_in_subselect::single_value_transformer");
|
||||
|
||||
@ -970,7 +969,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
|
||||
if (!substitution)
|
||||
{
|
||||
/* We're invoked for the 1st (or the only) SELECT in the subquery UNION */
|
||||
SELECT_LEX_UNIT *unit= select_lex->master_unit();
|
||||
SELECT_LEX_UNIT *master_unit= select_lex->master_unit();
|
||||
substitution= optimizer;
|
||||
|
||||
SELECT_LEX *current= thd->lex->current_select, *up;
|
||||
@ -993,7 +992,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
|
||||
(char *)"<no matter>",
|
||||
(char *)in_left_expr_name);
|
||||
|
||||
unit->uncacheable|= UNCACHEABLE_DEPENDENT;
|
||||
master_unit->uncacheable|= UNCACHEABLE_DEPENDENT;
|
||||
}
|
||||
if (!abort_on_null && left_expr->maybe_null && !pushed_cond_guards)
|
||||
{
|
||||
@ -1192,7 +1191,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
|
||||
if (!substitution)
|
||||
{
|
||||
//first call for this unit
|
||||
SELECT_LEX_UNIT *unit= select_lex->master_unit();
|
||||
SELECT_LEX_UNIT *master_unit= select_lex->master_unit();
|
||||
substitution= optimizer;
|
||||
|
||||
SELECT_LEX *current= thd->lex->current_select, *up;
|
||||
@ -1208,7 +1207,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
|
||||
optimizer->keep_top_level_cache();
|
||||
|
||||
thd->lex->current_select= current;
|
||||
unit->uncacheable|= UNCACHEABLE_DEPENDENT;
|
||||
master_unit->uncacheable|= UNCACHEABLE_DEPENDENT;
|
||||
|
||||
if (!abort_on_null && left_expr->maybe_null && !pushed_cond_guards)
|
||||
{
|
||||
@ -1241,7 +1240,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
|
||||
{
|
||||
DBUG_ASSERT(left_expr->fixed && select_lex->ref_pointer_array[i]->fixed);
|
||||
if (select_lex->ref_pointer_array[i]->
|
||||
check_cols(left_expr->el(i)->cols()))
|
||||
check_cols(left_expr->element_index(i)->cols()))
|
||||
DBUG_RETURN(RES_ERROR);
|
||||
Item *item_eq=
|
||||
new Item_func_eq(new
|
||||
@ -1264,7 +1263,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
|
||||
(char *)"<list ref>")
|
||||
);
|
||||
Item *col_item= new Item_cond_or(item_eq, item_isnull);
|
||||
if (!abort_on_null && left_expr->el(i)->maybe_null)
|
||||
if (!abort_on_null && left_expr->element_index(i)->maybe_null)
|
||||
{
|
||||
if (!(col_item= new Item_func_trig_cond(col_item, get_cond_guard(i))))
|
||||
DBUG_RETURN(RES_ERROR);
|
||||
@ -1278,7 +1277,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
|
||||
ref_pointer_array + i,
|
||||
(char *)"<no matter>",
|
||||
(char *)"<list ref>"));
|
||||
if (!abort_on_null && left_expr->el(i)->maybe_null)
|
||||
if (!abort_on_null && left_expr->element_index(i)->maybe_null)
|
||||
{
|
||||
if (!(item_nnull_test=
|
||||
new Item_func_trig_cond(item_nnull_test, get_cond_guard(i))))
|
||||
@ -1315,7 +1314,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
|
||||
Item *item, *item_isnull;
|
||||
DBUG_ASSERT(left_expr->fixed && select_lex->ref_pointer_array[i]->fixed);
|
||||
if (select_lex->ref_pointer_array[i]->
|
||||
check_cols(left_expr->el(i)->cols()))
|
||||
check_cols(left_expr->element_index(i)->cols()))
|
||||
DBUG_RETURN(RES_ERROR);
|
||||
item=
|
||||
new Item_func_eq(new
|
||||
@ -1355,7 +1354,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
|
||||
TODO: why we create the above for cases where the right part
|
||||
cant be NULL?
|
||||
*/
|
||||
if (left_expr->el(i)->maybe_null)
|
||||
if (left_expr->element_index(i)->maybe_null)
|
||||
{
|
||||
if (!(item= new Item_func_trig_cond(item, get_cond_guard(i))))
|
||||
DBUG_RETURN(RES_ERROR);
|
||||
@ -1517,14 +1516,14 @@ void Item_in_subselect::print(String *str)
|
||||
}
|
||||
|
||||
|
||||
bool Item_in_subselect::fix_fields(THD *thd, Item **ref)
|
||||
bool Item_in_subselect::fix_fields(THD *thd_arg, Item **ref)
|
||||
{
|
||||
bool result = 0;
|
||||
|
||||
if(thd->lex->view_prepare_mode && left_expr && !left_expr->fixed)
|
||||
result = left_expr->fix_fields(thd, &left_expr);
|
||||
if (thd_arg->lex->view_prepare_mode && left_expr && !left_expr->fixed)
|
||||
result = left_expr->fix_fields(thd_arg, &left_expr);
|
||||
|
||||
return result || Item_subselect::fix_fields(thd, ref);
|
||||
return result || Item_subselect::fix_fields(thd_arg, ref);
|
||||
}
|
||||
|
||||
|
||||
@ -1563,13 +1562,13 @@ void subselect_engine::set_thd(THD *thd_arg)
|
||||
|
||||
subselect_single_select_engine::
|
||||
subselect_single_select_engine(st_select_lex *select,
|
||||
select_subselect *result,
|
||||
Item_subselect *item)
|
||||
:subselect_engine(item, result),
|
||||
select_subselect *result_arg,
|
||||
Item_subselect *item_arg)
|
||||
:subselect_engine(item_arg, result_arg),
|
||||
prepared(0), optimized(0), executed(0),
|
||||
select_lex(select), join(0)
|
||||
{
|
||||
select_lex->master_unit()->item= item;
|
||||
select_lex->master_unit()->item= item_arg;
|
||||
}
|
||||
|
||||
|
||||
@ -1806,7 +1805,6 @@ int subselect_single_select_engine::exec()
|
||||
if (!executed)
|
||||
{
|
||||
item->reset_value_registration();
|
||||
bool have_changed_access= FALSE;
|
||||
JOIN_TAB *changed_tabs[MAX_TABLES];
|
||||
JOIN_TAB **last_changed_tab= changed_tabs;
|
||||
if (item->have_guarded_conds())
|
||||
|
@ -164,7 +164,7 @@ public:
|
||||
void fix_length_and_dec();
|
||||
|
||||
uint cols();
|
||||
Item* el(uint i) { return my_reinterpret_cast(Item*)(row[i]); }
|
||||
Item* element_index(uint i) { return my_reinterpret_cast(Item*)(row[i]); }
|
||||
Item** addr(uint i) { return (Item**)row + i; }
|
||||
bool check_cols(uint c);
|
||||
bool null_inside();
|
||||
@ -532,10 +532,10 @@ class subselect_indexsubquery_engine: public subselect_uniquesubquery_engine
|
||||
public:
|
||||
|
||||
// constructor can assign THD because it will be called after JOIN::prepare
|
||||
subselect_indexsubquery_engine(THD *thd, st_join_table *tab_arg,
|
||||
subselect_indexsubquery_engine(THD *thd_arg, st_join_table *tab_arg,
|
||||
Item_subselect *subs, Item *where,
|
||||
Item *having_arg, bool chk_null)
|
||||
:subselect_uniquesubquery_engine(thd, tab_arg, subs, where),
|
||||
:subselect_uniquesubquery_engine(thd_arg, tab_arg, subs, where),
|
||||
check_null(chk_null),
|
||||
having(having_arg)
|
||||
{}
|
||||
|
@ -1172,7 +1172,7 @@ double Item_sum_avg::val_real()
|
||||
|
||||
my_decimal *Item_sum_avg::val_decimal(my_decimal *val)
|
||||
{
|
||||
my_decimal sum, cnt;
|
||||
my_decimal sum_buff, cnt;
|
||||
const my_decimal *sum_dec;
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
if (!count)
|
||||
@ -1180,7 +1180,7 @@ my_decimal *Item_sum_avg::val_decimal(my_decimal *val)
|
||||
null_value=1;
|
||||
return NULL;
|
||||
}
|
||||
sum_dec= Item_sum_sum::val_decimal(&sum);
|
||||
sum_dec= Item_sum_sum::val_decimal(&sum_buff);
|
||||
int2my_decimal(E_DEC_FATAL_ERROR, count, 0, &cnt);
|
||||
my_decimal_div(E_DEC_FATAL_ERROR, val, sum_dec, &cnt, prec_increment);
|
||||
return val;
|
||||
@ -1627,7 +1627,7 @@ bool Item_sum_min::add()
|
||||
break;
|
||||
case DECIMAL_RESULT:
|
||||
{
|
||||
my_decimal value, *val= args[0]->val_decimal(&value);
|
||||
my_decimal value_buff, *val= args[0]->val_decimal(&value_buff);
|
||||
if (!args[0]->null_value &&
|
||||
(null_value || (my_decimal_cmp(&sum_dec, val) > 0)))
|
||||
{
|
||||
@ -1691,7 +1691,7 @@ bool Item_sum_max::add()
|
||||
break;
|
||||
case DECIMAL_RESULT:
|
||||
{
|
||||
my_decimal value, *val= args[0]->val_decimal(&value);
|
||||
my_decimal value_buff, *val= args[0]->val_decimal(&value_buff);
|
||||
if (!args[0]->null_value &&
|
||||
(null_value || (my_decimal_cmp(val, &sum_dec) > 0)))
|
||||
{
|
||||
@ -1856,7 +1856,7 @@ void Item_sum_hybrid::reset_field()
|
||||
}
|
||||
case DECIMAL_RESULT:
|
||||
{
|
||||
my_decimal value, *arg_dec= args[0]->val_decimal(&value);
|
||||
my_decimal value_buff, *arg_dec= args[0]->val_decimal(&value_buff);
|
||||
|
||||
if (maybe_null)
|
||||
{
|
||||
@ -2484,11 +2484,11 @@ bool Item_sum_count_distinct::setup(THD *thd)
|
||||
for (tree_key_length= 0; field < field_end; ++field)
|
||||
{
|
||||
Field *f= *field;
|
||||
enum enum_field_types type= f->type();
|
||||
enum enum_field_types f_type= f->type();
|
||||
tree_key_length+= f->pack_length();
|
||||
if ((type == MYSQL_TYPE_VARCHAR) ||
|
||||
!f->binary() && (type == MYSQL_TYPE_STRING ||
|
||||
type == MYSQL_TYPE_VAR_STRING))
|
||||
if ((f_type == MYSQL_TYPE_VARCHAR) ||
|
||||
!f->binary() && (f_type == MYSQL_TYPE_STRING ||
|
||||
f_type == MYSQL_TYPE_VAR_STRING))
|
||||
{
|
||||
all_binary= FALSE;
|
||||
break;
|
||||
@ -3073,8 +3073,6 @@ Item_func_group_concat::Item_func_group_concat(THD *thd,
|
||||
|
||||
void Item_func_group_concat::cleanup()
|
||||
{
|
||||
THD *thd= current_thd;
|
||||
|
||||
DBUG_ENTER("Item_func_group_concat::cleanup");
|
||||
Item_sum::cleanup();
|
||||
|
||||
@ -3083,7 +3081,7 @@ void Item_func_group_concat::cleanup()
|
||||
{
|
||||
char warn_buff[MYSQL_ERRMSG_SIZE];
|
||||
sprintf(warn_buff, ER(ER_CUT_VALUE_GROUP_CONCAT), count_cut_values);
|
||||
warning->set_msg(thd, warn_buff);
|
||||
warning->set_msg(current_thd, warn_buff);
|
||||
warning= 0;
|
||||
}
|
||||
|
||||
@ -3113,8 +3111,7 @@ void Item_func_group_concat::cleanup()
|
||||
warning= 0;
|
||||
}
|
||||
}
|
||||
DBUG_ASSERT(tree == 0);
|
||||
DBUG_ASSERT(warning == 0);
|
||||
DBUG_ASSERT(tree == 0 && warning == 0);
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
@ -1120,14 +1120,14 @@ String* Item_func_dayname::val_str(String* str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
uint weekday=(uint) val_int(); // Always Item_func_daynr()
|
||||
const char *name;
|
||||
const char *day_name;
|
||||
THD *thd= current_thd;
|
||||
|
||||
if (null_value)
|
||||
return (String*) 0;
|
||||
|
||||
name= thd->variables.lc_time_names->day_names->type_names[weekday];
|
||||
str->set(name, strlen(name), system_charset_info);
|
||||
day_name= thd->variables.lc_time_names->day_names->type_names[weekday];
|
||||
str->set(day_name, strlen(day_name), system_charset_info);
|
||||
return str;
|
||||
}
|
||||
|
||||
@ -3171,10 +3171,10 @@ bool Item_func_str_to_date::get_date(TIME *ltime, uint fuzzy_date)
|
||||
{
|
||||
DATE_TIME_FORMAT date_time_format;
|
||||
char val_buff[64], format_buff[64];
|
||||
String val_str(val_buff, sizeof(val_buff), &my_charset_bin), *val;
|
||||
String val_string(val_buff, sizeof(val_buff), &my_charset_bin), *val;
|
||||
String format_str(format_buff, sizeof(format_buff), &my_charset_bin), *format;
|
||||
|
||||
val= args[0]->val_str(&val_str);
|
||||
val= args[0]->val_str(&val_string);
|
||||
format= args[1]->val_str(&format_str);
|
||||
if (args[0]->null_value || args[1]->null_value)
|
||||
goto null_date;
|
||||
|
@ -577,7 +577,6 @@ String * Item_nodeset_func_union::val_nodeset(String *nodeset)
|
||||
both_str.alloc(numnodes);
|
||||
char *both= (char*) both_str.ptr();
|
||||
bzero((void*)both, numnodes);
|
||||
uint pos= 0;
|
||||
MY_XPATH_FLT *flt;
|
||||
|
||||
fltbeg= (MY_XPATH_FLT*) s0->ptr();
|
||||
@ -1484,7 +1483,6 @@ static int my_xpath_parse_AxisName(MY_XPATH *xpath)
|
||||
static int my_xpath_parse_LocationPath(MY_XPATH *xpath);
|
||||
static int my_xpath_parse_AbsoluteLocationPath(MY_XPATH *xpath);
|
||||
static int my_xpath_parse_RelativeLocationPath(MY_XPATH *xpath);
|
||||
static int my_xpath_parse_AbbreviatedAbsoluteLocationPath(MY_XPATH *xpath);
|
||||
static int my_xpath_parse_AbbreviatedStep(MY_XPATH *xpath);
|
||||
static int my_xpath_parse_Step(MY_XPATH *xpath);
|
||||
static int my_xpath_parse_AxisSpecifier(MY_XPATH *xpath);
|
||||
@ -1503,7 +1501,6 @@ static int my_xpath_parse_RelationalExpr(MY_XPATH *xpath);
|
||||
static int my_xpath_parse_AndExpr(MY_XPATH *xpath);
|
||||
static int my_xpath_parse_EqualityExpr(MY_XPATH *xpath);
|
||||
static int my_xpath_parse_VariableReference(MY_XPATH *xpath);
|
||||
static int my_xpath_parse_slash_opt_slash(MY_XPATH *xpath);
|
||||
|
||||
|
||||
/*
|
||||
@ -2699,7 +2696,6 @@ String *Item_func_xml_update::val_str(String *str)
|
||||
}
|
||||
|
||||
MY_XML_NODE *nodebeg= (MY_XML_NODE*) pxml.ptr();
|
||||
MY_XML_NODE *nodeend= (MY_XML_NODE*) pxml.ptr() + pxml.length();
|
||||
MY_XPATH_FLT *fltbeg= (MY_XPATH_FLT*) nodeset->ptr();
|
||||
MY_XPATH_FLT *fltend= (MY_XPATH_FLT*) (nodeset->ptr() + nodeset->length());
|
||||
|
||||
|
84
sql/log.cc
84
sql/log.cc
@ -147,8 +147,7 @@ public:
|
||||
*/
|
||||
void truncate(my_off_t pos)
|
||||
{
|
||||
DBUG_PRINT("info", ("truncating to position %lu", pos));
|
||||
DBUG_PRINT("info", ("before_stmt_pos=%lu", pos));
|
||||
DBUG_PRINT("info", ("truncating to position %lu", (ulong) pos));
|
||||
delete pending();
|
||||
set_pending(0);
|
||||
reinit_io_cache(&trans_log, WRITE_CACHE, pos, 0, 0);
|
||||
@ -909,7 +908,7 @@ bool LOGGER::slow_log_print(THD *thd, const char *query, uint query_length,
|
||||
|
||||
my_time_t current_time;
|
||||
Security_context *sctx= thd->security_ctx;
|
||||
uint message_buff_len= 0, user_host_len= 0;
|
||||
uint user_host_len= 0;
|
||||
longlong query_time= 0, lock_time= 0;
|
||||
|
||||
/*
|
||||
@ -1544,23 +1543,21 @@ static int binlog_prepare(handlerton *hton, THD *thd, bool all)
|
||||
do nothing.
|
||||
just pretend we can do 2pc, so that MySQL won't
|
||||
switch to 1pc.
|
||||
real work will be done in MYSQL_BIN_LOG::log()
|
||||
real work will be done in MYSQL_BIN_LOG::log_xid()
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int binlog_commit(handlerton *hton, THD *thd, bool all)
|
||||
{
|
||||
int error= 0;
|
||||
DBUG_ENTER("binlog_commit");
|
||||
binlog_trx_data *const trx_data=
|
||||
(binlog_trx_data*) thd->ha_data[binlog_hton->slot];
|
||||
IO_CACHE *trans_log= &trx_data->trans_log;
|
||||
DBUG_ASSERT(mysql_bin_log.is_open());
|
||||
|
||||
if (all && trx_data->empty())
|
||||
{
|
||||
// we're here because trans_log was flushed in MYSQL_BIN_LOG::log()
|
||||
// we're here because trans_log was flushed in MYSQL_BIN_LOG::log_xid()
|
||||
trx_data->reset();
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
@ -1584,7 +1581,6 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
|
||||
int error=0;
|
||||
binlog_trx_data *const trx_data=
|
||||
(binlog_trx_data*) thd->ha_data[binlog_hton->slot];
|
||||
IO_CACHE *trans_log= &trx_data->trans_log;
|
||||
DBUG_ASSERT(mysql_bin_log.is_open());
|
||||
|
||||
if (trx_data->empty()) {
|
||||
@ -1647,9 +1643,6 @@ static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv)
|
||||
static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
|
||||
{
|
||||
DBUG_ENTER("binlog_savepoint_rollback");
|
||||
binlog_trx_data *const trx_data=
|
||||
(binlog_trx_data*) thd->ha_data[binlog_hton->slot];
|
||||
IO_CACHE *trans_log= &trx_data->trans_log;
|
||||
DBUG_ASSERT(mysql_bin_log.is_open());
|
||||
|
||||
/*
|
||||
@ -1660,7 +1653,7 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
|
||||
if (unlikely(thd->options &
|
||||
(OPTION_STATUS_NO_TRANS_UPDATE | OPTION_KEEP_LOG)))
|
||||
{
|
||||
int const error=
|
||||
int error=
|
||||
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
thd->query, thd->query_length, TRUE, FALSE);
|
||||
DBUG_RETURN(error);
|
||||
@ -1669,6 +1662,7 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
int check_binlog_magic(IO_CACHE* log, const char** errmsg)
|
||||
{
|
||||
char magic[4];
|
||||
@ -1689,6 +1683,7 @@ int check_binlog_magic(IO_CACHE* log, const char** errmsg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
File open_binlog(IO_CACHE *log, const char *log_file_name, const char **errmsg)
|
||||
{
|
||||
File file;
|
||||
@ -2195,7 +2190,6 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time,
|
||||
|
||||
if (!(specialflag & SPECIAL_SHORT_LOG_FORMAT))
|
||||
{
|
||||
Security_context *sctx= thd->security_ctx;
|
||||
if (current_time != last_time)
|
||||
{
|
||||
last_time= current_time;
|
||||
@ -2434,7 +2428,6 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
|
||||
bool null_created_arg)
|
||||
{
|
||||
File file= -1;
|
||||
int open_flags = O_CREAT | O_BINARY;
|
||||
DBUG_ENTER("MYSQL_BIN_LOG::open");
|
||||
DBUG_PRINT("enter",("log_type: %d",(int) log_type_arg));
|
||||
|
||||
@ -2596,6 +2589,8 @@ int MYSQL_BIN_LOG::raw_get_current_log(LOG_INFO* linfo)
|
||||
0 ok
|
||||
*/
|
||||
|
||||
#ifdef HAVE_REPLICATION
|
||||
|
||||
static bool copy_up_file_and_fill(IO_CACHE *index_file, my_off_t offset)
|
||||
{
|
||||
int bytes_read;
|
||||
@ -2629,6 +2624,7 @@ err:
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
#endif /* HAVE_REPLICATION */
|
||||
|
||||
/*
|
||||
Find the position in the log-index-file for the given log name
|
||||
@ -3121,8 +3117,6 @@ err:
|
||||
pthread_mutex_unlock(&LOCK_index);
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
|
||||
#endif /* HAVE_REPLICATION */
|
||||
|
||||
|
||||
@ -3244,7 +3238,6 @@ void MYSQL_BIN_LOG::new_file_impl(bool need_lock)
|
||||
We log the whole file name for log file as the user may decide
|
||||
to change base names at some point.
|
||||
*/
|
||||
THD *thd = current_thd; /* may be 0 if we are reacting to SIGHUP */
|
||||
Rotate_log_event r(new_name+dirname_length(new_name),
|
||||
0, LOG_EVENT_OFFSET, 0);
|
||||
r.write(&log_file);
|
||||
@ -3480,10 +3473,10 @@ int THD::binlog_flush_transaction_cache()
|
||||
{
|
||||
DBUG_ENTER("binlog_flush_transaction_cache");
|
||||
binlog_trx_data *trx_data= (binlog_trx_data*) ha_data[binlog_hton->slot];
|
||||
DBUG_PRINT("enter", ("trx_data=0x%lu", trx_data));
|
||||
DBUG_PRINT("enter", ("trx_data: 0x%lx", (ulong) trx_data));
|
||||
if (trx_data)
|
||||
DBUG_PRINT("enter", ("trx_data->before_stmt_pos=%u",
|
||||
trx_data->before_stmt_pos));
|
||||
DBUG_PRINT("enter", ("trx_data->before_stmt_pos: %lu",
|
||||
(ulong) trx_data->before_stmt_pos));
|
||||
|
||||
/*
|
||||
Write the transaction cache to the binary log. We don't flush and
|
||||
@ -3698,14 +3691,14 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info)
|
||||
*/
|
||||
if (likely(is_open()))
|
||||
{
|
||||
const char *local_db= event_info->get_db();
|
||||
IO_CACHE *file= &log_file;
|
||||
#ifdef HAVE_REPLICATION
|
||||
/*
|
||||
In the future we need to add to the following if tests like
|
||||
"do the involved tables match (to be implemented)
|
||||
binlog_[wild_]{do|ignore}_table?" (WL#1049)"
|
||||
In the future we need to add to the following if tests like
|
||||
"do the involved tables match (to be implemented)
|
||||
binlog_[wild_]{do|ignore}_table?" (WL#1049)"
|
||||
*/
|
||||
const char *local_db= event_info->get_db();
|
||||
if ((thd && !(thd->options & OPTION_BIN_LOG)) ||
|
||||
(!binlog_filter->db_ok(local_db)))
|
||||
{
|
||||
@ -3981,8 +3974,6 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event)
|
||||
|
||||
if (likely(is_open())) // Should always be true
|
||||
{
|
||||
uint length;
|
||||
|
||||
/*
|
||||
We only bother to write to the binary log if there is anything
|
||||
to write.
|
||||
@ -4022,9 +4013,6 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event)
|
||||
|
||||
if (commit_event && commit_event->write(&log_file))
|
||||
goto err;
|
||||
#ifndef DBUG_OFF
|
||||
DBUG_skip_commit:
|
||||
#endif
|
||||
if (flush_and_sync())
|
||||
goto err;
|
||||
DBUG_EXECUTE_IF("half_binlogged_transaction", abort(););
|
||||
@ -4684,21 +4672,34 @@ int TC_LOG_MMAP::overflow()
|
||||
}
|
||||
|
||||
/*
|
||||
all access to active page is serialized but it's not a problem, as
|
||||
we're assuming that fsync() will be a main bottleneck.
|
||||
That is, parallelizing writes to log pages we'll decrease number of
|
||||
threads waiting for a page, but then all these threads will be waiting
|
||||
for a fsync() anyway
|
||||
Record that transaction XID is committed on the persistent storage
|
||||
|
||||
NOTES
|
||||
This function is called in the middle of two-phase commit:
|
||||
First all resources prepare the transaction, then tc_log->log() is called,
|
||||
then all resources commit the transaction, then tc_log->unlog() is called.
|
||||
|
||||
All access to active page is serialized but it's not a problem, as
|
||||
we're assuming that fsync() will be a main bottleneck.
|
||||
That is, parallelizing writes to log pages we'll decrease number of
|
||||
threads waiting for a page, but then all these threads will be waiting
|
||||
for a fsync() anyway
|
||||
|
||||
IMPLEMENTATION
|
||||
If tc_log == MYSQL_LOG then tc_log writes transaction to binlog and
|
||||
records XID in a special Xid_log_event.
|
||||
If tc_log = TC_LOG_MMAP then xid is written in a special memory-mapped
|
||||
log.
|
||||
|
||||
RETURN
|
||||
0 - error
|
||||
otherwise - "cookie", a number that will be passed as an argument
|
||||
to unlog() call. tc_log can define it any way it wants,
|
||||
and use for whatever purposes. TC_LOG_MMAP sets it
|
||||
to the position in memory where xid was logged to.
|
||||
0 Error
|
||||
# "cookie", a number that will be passed as an argument
|
||||
to unlog() call. tc_log can define it any way it wants,
|
||||
and use for whatever purposes. TC_LOG_MMAP sets it
|
||||
to the position in memory where xid was logged to.
|
||||
*/
|
||||
|
||||
int TC_LOG_MMAP::log(THD *thd, my_xid xid)
|
||||
int TC_LOG_MMAP::log_xid(THD *thd, my_xid xid)
|
||||
{
|
||||
int err;
|
||||
PAGE *p;
|
||||
@ -4807,6 +4808,7 @@ int TC_LOG_MMAP::sync()
|
||||
erase xid from the page, update page free space counters/pointers.
|
||||
cookie points directly to the memory where xid was logged
|
||||
*/
|
||||
|
||||
void TC_LOG_MMAP::unlog(ulong cookie, my_xid xid)
|
||||
{
|
||||
PAGE *p=pages+(cookie/tc_log_page_size);
|
||||
@ -5049,7 +5051,7 @@ void TC_LOG_BINLOG::close()
|
||||
0 - error
|
||||
1 - success
|
||||
*/
|
||||
int TC_LOG_BINLOG::log(THD *thd, my_xid xid)
|
||||
int TC_LOG_BINLOG::log_xid(THD *thd, my_xid xid)
|
||||
{
|
||||
DBUG_ENTER("TC_LOG_BINLOG::log");
|
||||
Xid_log_event xle(thd, xid);
|
||||
|
@ -33,7 +33,7 @@ class TC_LOG
|
||||
|
||||
virtual int open(const char *opt_name)=0;
|
||||
virtual void close()=0;
|
||||
virtual int log(THD *thd, my_xid xid)=0;
|
||||
virtual int log_xid(THD *thd, my_xid xid)=0;
|
||||
virtual void unlog(ulong cookie, my_xid xid)=0;
|
||||
};
|
||||
|
||||
@ -43,7 +43,7 @@ public:
|
||||
TC_LOG_DUMMY() {}
|
||||
int open(const char *opt_name) { return 0; }
|
||||
void close() { }
|
||||
int log(THD *thd, my_xid xid) { return 1; }
|
||||
int log_xid(THD *thd, my_xid xid) { return 1; }
|
||||
void unlog(ulong cookie, my_xid xid) { }
|
||||
};
|
||||
|
||||
@ -88,7 +88,7 @@ class TC_LOG_MMAP: public TC_LOG
|
||||
TC_LOG_MMAP(): inited(0) {}
|
||||
int open(const char *opt_name);
|
||||
void close();
|
||||
int log(THD *thd, my_xid xid);
|
||||
int log_xid(THD *thd, my_xid xid);
|
||||
void unlog(ulong cookie, my_xid xid);
|
||||
int recover();
|
||||
|
||||
@ -287,7 +287,7 @@ public:
|
||||
|
||||
int open(const char *opt_name);
|
||||
void close();
|
||||
int log(THD *thd, my_xid xid);
|
||||
int log_xid(THD *thd, my_xid xid);
|
||||
void unlog(ulong cookie, my_xid xid);
|
||||
int recover(IO_CACHE *log, Format_description_log_event *fdle);
|
||||
#if !defined(MYSQL_CLIENT)
|
||||
|
@ -139,22 +139,6 @@ static void pretty_print_str(IO_CACHE* cache, char* str, int len)
|
||||
}
|
||||
#endif /* MYSQL_CLIENT */
|
||||
|
||||
#ifdef HAVE_purify
|
||||
static void
|
||||
valgrind_check_mem(void *ptr, size_t len)
|
||||
{
|
||||
static volatile uchar dummy;
|
||||
for (volatile uchar *p= (uchar*) ptr ; p != (uchar*) ptr + len ; ++p)
|
||||
{
|
||||
int const c = *p;
|
||||
if (c < 128)
|
||||
dummy= c + 1;
|
||||
else
|
||||
dummy = c - 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
|
||||
|
||||
static void clear_all_errors(THD *thd, struct st_relay_log_info *rli)
|
||||
@ -381,12 +365,14 @@ append_query_string(CHARSET_INFO *csinfo,
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
Prints a "session_var=value" string. Used by mysqlbinlog to print some SET
|
||||
commands just before it prints a query.
|
||||
*/
|
||||
|
||||
#ifdef MYSQL_CLIENT
|
||||
|
||||
static void print_set_option(IO_CACHE* file, uint32 bits_changed,
|
||||
uint32 option, uint32 flags, const char* name,
|
||||
bool* need_comma)
|
||||
@ -3269,7 +3255,6 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
|
||||
thd->main_lex.select_lex.context.resolve_in_table_list_only(&tables);
|
||||
set_fields(tables.db, field_list, &thd->main_lex.select_lex.context);
|
||||
thd->variables.pseudo_thread_id= thread_id;
|
||||
List<Item> set_fields;
|
||||
if (net)
|
||||
{
|
||||
// mysql_load will use thd->net to read the file
|
||||
@ -3280,10 +3265,11 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
|
||||
thd->net.pkt_nr = net->pkt_nr;
|
||||
}
|
||||
/*
|
||||
It is safe to use set_fields twice because we are not going to
|
||||
It is safe to use tmp_list twice because we are not going to
|
||||
update it inside mysql_load().
|
||||
*/
|
||||
if (mysql_load(thd, &ex, &tables, field_list, set_fields, set_fields,
|
||||
List<Item> tmp_list;
|
||||
if (mysql_load(thd, &ex, &tables, field_list, tmp_list, tmp_list,
|
||||
handle_dup, ignore, net != 0))
|
||||
thd->query_error= 1;
|
||||
if (thd->cuted_fields)
|
||||
@ -5481,7 +5467,6 @@ int Rows_log_event::do_add_row_data(byte *const row_data,
|
||||
if (static_cast<my_size_t>(m_rows_end - m_rows_cur) < length)
|
||||
{
|
||||
my_size_t const block_size= 1024;
|
||||
my_ptrdiff_t const old_alloc= m_rows_end - m_rows_buf;
|
||||
my_ptrdiff_t const cur_size= m_rows_cur - m_rows_buf;
|
||||
my_ptrdiff_t const new_alloc=
|
||||
block_size * ((cur_size + length) / block_size + block_size - 1);
|
||||
|
@ -57,10 +57,10 @@ typedef ulonglong nested_join_map;
|
||||
|
||||
/* query_id */
|
||||
typedef ulonglong query_id_t;
|
||||
extern query_id_t query_id;
|
||||
extern query_id_t global_query_id;
|
||||
|
||||
/* increment query_id and return it. */
|
||||
inline query_id_t next_query_id() { return query_id++; }
|
||||
inline query_id_t next_query_id() { return global_query_id++; }
|
||||
|
||||
/* useful constants */
|
||||
extern const key_map key_map_empty;
|
||||
@ -167,7 +167,7 @@ MY_LOCALE *my_locale_by_number(uint number);
|
||||
Feel free to raise this by the smallest amount you can to get the
|
||||
"execution_constants" test to pass.
|
||||
*/
|
||||
#define STACK_MIN_SIZE 10788 // Abort if less stack during eval.
|
||||
#define STACK_MIN_SIZE 12000 // Abort if less stack during eval.
|
||||
|
||||
#define STACK_MIN_SIZE_FOR_OPEN 1024*80
|
||||
#define STACK_BUFF_ALLOC 256 // For stack overrun checks
|
||||
@ -1523,7 +1523,7 @@ extern int creating_table; // How many mysql_create_table() are running
|
||||
External variables
|
||||
*/
|
||||
|
||||
extern time_t start_time;
|
||||
extern time_t server_start_time;
|
||||
extern char *mysql_data_home,server_version[SERVER_VERSION_LENGTH],
|
||||
mysql_real_data_home[], *opt_mysql_tmpdir, mysql_charsets_dir[],
|
||||
def_ft_boolean_syntax[sizeof(ft_boolean_syntax)];
|
||||
|
114
sql/mysqld.cc
114
sql/mysqld.cc
@ -470,7 +470,7 @@ ulong slave_net_timeout, slave_trans_retries;
|
||||
ulong thread_cache_size=0, binlog_cache_size=0, max_binlog_cache_size=0;
|
||||
ulong query_cache_size=0;
|
||||
ulong refresh_version, flush_version; /* Increments on each reload */
|
||||
query_id_t query_id;
|
||||
query_id_t global_query_id;
|
||||
ulong aborted_threads, aborted_connects;
|
||||
ulong delayed_insert_timeout, delayed_insert_limit, delayed_queue_size;
|
||||
ulong delayed_insert_threads, delayed_insert_writes, delayed_rows_in_use;
|
||||
@ -502,7 +502,7 @@ ulong rpl_recovery_rank=0;
|
||||
const char *log_output_str= "TABLE";
|
||||
|
||||
double log_10[32]; /* 10 potences */
|
||||
time_t start_time;
|
||||
time_t server_start_time;
|
||||
|
||||
char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], system_time_zone[30];
|
||||
char *default_tz_name;
|
||||
@ -518,7 +518,6 @@ key_map key_map_full(0); // Will be initialized later
|
||||
const char *opt_date_time_formats[3];
|
||||
|
||||
char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home;
|
||||
struct passwd *user_info;
|
||||
char server_version[SERVER_VERSION_LENGTH];
|
||||
char *mysqld_unix_port, *opt_mysql_tmpdir;
|
||||
const char **errmesg; /* Error messages */
|
||||
@ -540,7 +539,6 @@ Lt_creator lt_creator;
|
||||
Ge_creator ge_creator;
|
||||
Le_creator le_creator;
|
||||
|
||||
|
||||
FILE *bootstrap_file;
|
||||
int bootstrap_error;
|
||||
FILE *stderror_file=0;
|
||||
@ -623,9 +621,13 @@ static char **defaults_argv;
|
||||
static char *opt_bin_logname;
|
||||
|
||||
static my_socket unix_sock,ip_sock;
|
||||
static pthread_t select_thread;
|
||||
struct rand_struct sql_rand; // used by sql_class.cc:THD::THD()
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
struct passwd *user_info;
|
||||
static pthread_t select_thread;
|
||||
#endif
|
||||
|
||||
/* OS specific variables */
|
||||
|
||||
#ifdef __WIN__
|
||||
@ -702,7 +704,6 @@ struct st_VioSSLFd *ssl_acceptor_fd;
|
||||
|
||||
/* Function declarations */
|
||||
|
||||
static void start_signal_handler(void);
|
||||
pthread_handler_t signal_hand(void *arg);
|
||||
static void mysql_init_variables(void);
|
||||
static void get_options(int argc,char **argv);
|
||||
@ -713,7 +714,6 @@ static void fix_paths(void);
|
||||
pthread_handler_t handle_connections_sockets(void *arg);
|
||||
pthread_handler_t kill_server_thread(void *arg);
|
||||
static void bootstrap(FILE *file);
|
||||
static void close_server_sock();
|
||||
static bool read_init_file(char *file_name);
|
||||
#ifdef __NT__
|
||||
pthread_handler_t handle_connections_namedpipes(void *arg);
|
||||
@ -724,11 +724,17 @@ pthread_handler_t handle_connections_shared_memory(void *arg);
|
||||
pthread_handler_t handle_slave(void *arg);
|
||||
static ulong find_bit_type(const char *x, TYPELIB *bit_lib);
|
||||
static void clean_up(bool print_message);
|
||||
static int test_if_case_insensitive(const char *dir_name);
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
static void start_signal_handler(void);
|
||||
static void close_server_sock();
|
||||
static void clean_up_mutexes(void);
|
||||
static void wait_for_signal_thread_to_end(void);
|
||||
static int test_if_case_insensitive(const char *dir_name);
|
||||
static void create_pid_file();
|
||||
static void end_ssl();
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
/****************************************************************************
|
||||
@ -918,7 +924,6 @@ static void close_connections(void)
|
||||
DBUG_PRINT("quit",("close_connections thread"));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
#endif /*EMBEDDED_LIBRARY*/
|
||||
|
||||
|
||||
static void close_server_sock()
|
||||
@ -961,12 +966,14 @@ static void close_server_sock()
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /*EMBEDDED_LIBRARY*/
|
||||
|
||||
|
||||
void kill_mysql(void)
|
||||
{
|
||||
DBUG_ENTER("kill_mysql");
|
||||
|
||||
#ifdef SIGNALS_DONT_BREAK_READ
|
||||
#if defined(SIGNALS_DONT_BREAK_READ) && !defined(EMBEDDED_LIBRARY)
|
||||
abort_loop=1; // Break connection loops
|
||||
close_server_sock(); // Force accept to wake up
|
||||
#endif
|
||||
@ -1044,7 +1051,7 @@ static void __cdecl kill_server(int sig_ptr)
|
||||
kill_in_progress=TRUE;
|
||||
abort_loop=1; // This should be set
|
||||
if (sig != 0) // 0 is not a valid signal number
|
||||
my_sigset(sig,SIG_IGN);
|
||||
my_sigset(sig, SIG_IGN); /* purify inspected */
|
||||
if (sig == MYSQL_KILL_SIGNAL || sig == 0)
|
||||
sql_print_information(ER(ER_NORMAL_SHUTDOWN),my_progname);
|
||||
else
|
||||
@ -1232,7 +1239,9 @@ void clean_up(bool print_message)
|
||||
#endif
|
||||
delete binlog_filter;
|
||||
delete rpl_filter;
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
end_ssl();
|
||||
#endif
|
||||
vio_end();
|
||||
#ifdef USE_REGEX
|
||||
my_regex_end();
|
||||
@ -1265,6 +1274,8 @@ void clean_up(bool print_message)
|
||||
} /* clean_up */
|
||||
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
|
||||
/*
|
||||
This is mainly needed when running with purify, but it's still nice to
|
||||
know that all child threads have died when mysqld exits
|
||||
@ -1335,6 +1346,9 @@ static void clean_up_mutexes()
|
||||
(void) pthread_cond_destroy(&COND_manager);
|
||||
}
|
||||
|
||||
#endif /*EMBEDDED_LIBRARY*/
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
** Init IP and UNIX socket
|
||||
****************************************************************************/
|
||||
@ -1369,7 +1383,7 @@ static void set_ports()
|
||||
static struct passwd *check_user(const char *user)
|
||||
{
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
struct passwd *user_info;
|
||||
struct passwd *tmp_user_info;
|
||||
uid_t user_id= geteuid();
|
||||
|
||||
// Don't bother if we aren't superuser
|
||||
@ -1377,12 +1391,14 @@ static struct passwd *check_user(const char *user)
|
||||
{
|
||||
if (user)
|
||||
{
|
||||
// Don't give a warning, if real user is same as given with --user
|
||||
user_info= getpwnam(user);
|
||||
if ((!user_info || user_id != user_info->pw_uid) &&
|
||||
/* Don't give a warning, if real user is same as given with --user */
|
||||
/* purecov: begin tested */
|
||||
tmp_user_info= getpwnam(user);
|
||||
if ((!tmp_user_info || user_id != tmp_user_info->pw_uid) &&
|
||||
global_system_variables.log_warnings)
|
||||
sql_print_warning(
|
||||
"One can only use the --user switch if running as root\n");
|
||||
/* purecov: end */
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -1395,23 +1411,22 @@ static struct passwd *check_user(const char *user)
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
/* purecov: begin tested */
|
||||
if (!strcmp(user,"root"))
|
||||
return NULL; // Avoid problem with dynamic libraries
|
||||
|
||||
if (!(user_info= getpwnam(user)))
|
||||
if (!(tmp_user_info= getpwnam(user)))
|
||||
{
|
||||
// Allow a numeric uid to be used
|
||||
const char *pos;
|
||||
for (pos= user; my_isdigit(mysqld_charset,*pos); pos++) ;
|
||||
if (*pos) // Not numeric id
|
||||
goto err;
|
||||
if (!(user_info= getpwuid(atoi(user))))
|
||||
if (!(tmp_user_info= getpwuid(atoi(user))))
|
||||
goto err;
|
||||
else
|
||||
return user_info;
|
||||
}
|
||||
else
|
||||
return user_info;
|
||||
return tmp_user_info;
|
||||
/* purecov: end */
|
||||
|
||||
err:
|
||||
sql_print_error("Fatal error: Can't change to run as user '%s' ; Please check that the user exists!\n",user);
|
||||
@ -1420,10 +1435,11 @@ err:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void set_user(const char *user, struct passwd *user_info)
|
||||
static void set_user(const char *user, struct passwd *user_info_arg)
|
||||
{
|
||||
/* purecov: begin tested */
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
DBUG_ASSERT(user_info != 0);
|
||||
DBUG_ASSERT(user_info_arg != 0);
|
||||
#ifdef HAVE_INITGROUPS
|
||||
/*
|
||||
We can get a SIGSEGV when calling initgroups() on some systems when NSS
|
||||
@ -1432,33 +1448,34 @@ static void set_user(const char *user, struct passwd *user_info)
|
||||
output a specific message to help the user resolve this problem.
|
||||
*/
|
||||
calling_initgroups= TRUE;
|
||||
initgroups((char*) user, user_info->pw_gid);
|
||||
initgroups((char*) user, user_info_arg->pw_gid);
|
||||
calling_initgroups= FALSE;
|
||||
#endif
|
||||
if (setgid(user_info->pw_gid) == -1)
|
||||
if (setgid(user_info_arg->pw_gid) == -1)
|
||||
{
|
||||
sql_perror("setgid");
|
||||
unireg_abort(1);
|
||||
}
|
||||
if (setuid(user_info->pw_uid) == -1)
|
||||
if (setuid(user_info_arg->pw_uid) == -1)
|
||||
{
|
||||
sql_perror("setuid");
|
||||
unireg_abort(1);
|
||||
}
|
||||
#endif
|
||||
/* purecov: end */
|
||||
}
|
||||
|
||||
|
||||
static void set_effective_user(struct passwd *user_info)
|
||||
static void set_effective_user(struct passwd *user_info_arg)
|
||||
{
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
DBUG_ASSERT(user_info != 0);
|
||||
if (setregid((gid_t)-1, user_info->pw_gid) == -1)
|
||||
DBUG_ASSERT(user_info_arg != 0);
|
||||
if (setregid((gid_t)-1, user_info_arg->pw_gid) == -1)
|
||||
{
|
||||
sql_perror("setregid");
|
||||
unireg_abort(1);
|
||||
}
|
||||
if (setreuid((uid_t)-1, user_info->pw_uid) == -1)
|
||||
if (setreuid((uid_t)-1, user_info_arg->pw_uid) == -1)
|
||||
{
|
||||
sql_perror("setreuid");
|
||||
unireg_abort(1);
|
||||
@ -1799,6 +1816,7 @@ extern "C" sig_handler abort_thread(int sig __attribute__((unused)))
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
Setup a signal thread with handles all signals.
|
||||
Because Linux doesn't support schemas use a mutex to check that
|
||||
@ -1818,6 +1836,7 @@ static void init_signals(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void start_signal_handler(void)
|
||||
{
|
||||
// Save vm id of this process
|
||||
@ -1825,6 +1844,7 @@ static void start_signal_handler(void)
|
||||
create_pid_file();
|
||||
}
|
||||
|
||||
|
||||
static void check_data_home(const char *path)
|
||||
{}
|
||||
|
||||
@ -2045,6 +2065,7 @@ static void init_signals(void)
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void start_signal_handler(void)
|
||||
{
|
||||
// Save vm id of this process
|
||||
@ -2181,6 +2202,8 @@ bugs.\n");
|
||||
#define SA_NODEFER 0
|
||||
#endif
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
|
||||
static void init_signals(void)
|
||||
{
|
||||
sigset_t set;
|
||||
@ -2253,7 +2276,6 @@ static void init_signals(void)
|
||||
}
|
||||
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
static void start_signal_handler(void)
|
||||
{
|
||||
int error;
|
||||
@ -2427,11 +2449,11 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
|
||||
}
|
||||
return(0); /* purecov: deadcode */
|
||||
}
|
||||
#endif /*!EMBEDDED_LIBRARY*/
|
||||
|
||||
static void check_data_home(const char *path)
|
||||
{}
|
||||
|
||||
#endif /*!EMBEDDED_LIBRARY*/
|
||||
#endif /* __WIN__*/
|
||||
|
||||
|
||||
@ -2496,6 +2518,7 @@ static int my_message_sql(uint error, const char *str, myf MyFlags)
|
||||
}
|
||||
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
static void *my_str_malloc_mysqld(size_t size)
|
||||
{
|
||||
return my_malloc(size, MYF(MY_FAE));
|
||||
@ -2506,6 +2529,7 @@ static void my_str_free_mysqld(void *ptr)
|
||||
{
|
||||
my_free((gptr)ptr, MYF(MY_FAE));
|
||||
}
|
||||
#endif /* EMBEDDED_LIBRARY */
|
||||
|
||||
|
||||
#ifdef __WIN__
|
||||
@ -2612,7 +2636,7 @@ static int init_common_variables(const char *conf_file_name, int argc,
|
||||
tzset(); // Set tzname
|
||||
|
||||
max_system_variables.pseudo_thread_id= (ulong)~0;
|
||||
start_time=time((time_t*) 0);
|
||||
server_start_time= time((time_t*) 0);
|
||||
rpl_filter= new Rpl_filter;
|
||||
binlog_filter= new Rpl_filter;
|
||||
if (!rpl_filter || !binlog_filter)
|
||||
@ -2628,7 +2652,7 @@ static int init_common_variables(const char *conf_file_name, int argc,
|
||||
#ifdef HAVE_TZNAME
|
||||
{
|
||||
struct tm tm_tmp;
|
||||
localtime_r(&start_time,&tm_tmp);
|
||||
localtime_r(&server_start_time,&tm_tmp);
|
||||
strmake(system_time_zone, tzname[tm_tmp.tm_isdst != 0 ? 1 : 0],
|
||||
sizeof(system_time_zone)-1);
|
||||
|
||||
@ -3018,6 +3042,8 @@ static void openssl_lock(int mode, openssl_lock_t *lock, const char *file,
|
||||
#endif /* HAVE_OPENSSL */
|
||||
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
|
||||
static void init_ssl()
|
||||
{
|
||||
#ifdef HAVE_OPENSSL
|
||||
@ -3055,6 +3081,8 @@ static void end_ssl()
|
||||
#endif /* HAVE_OPENSSL */
|
||||
}
|
||||
|
||||
#endif /* EMBEDDED_LIBRARY */
|
||||
|
||||
|
||||
static int init_server_components()
|
||||
{
|
||||
@ -3070,7 +3098,7 @@ static int init_server_components()
|
||||
query_cache_set_min_res_unit(query_cache_min_res_unit);
|
||||
query_cache_init();
|
||||
query_cache_resize(query_cache_size);
|
||||
randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2);
|
||||
randominit(&sql_rand,(ulong) server_start_time,(ulong) server_start_time/2);
|
||||
reset_floating_point_exceptions();
|
||||
init_thr_lock();
|
||||
#ifdef HAVE_REPLICATION
|
||||
@ -3373,6 +3401,8 @@ server.");
|
||||
}
|
||||
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
|
||||
static void create_maintenance_thread()
|
||||
{
|
||||
if (flush_time && flush_time != ~(ulong) 0L)
|
||||
@ -3386,7 +3416,6 @@ static void create_maintenance_thread()
|
||||
|
||||
static void create_shutdown_thread()
|
||||
{
|
||||
#if !defined(EMBEDDED_LIBRARY)
|
||||
#ifdef __WIN__
|
||||
hEventShutdown=CreateEvent(0, FALSE, FALSE, shutdown_event_name);
|
||||
pthread_t hThread;
|
||||
@ -3395,10 +3424,11 @@ static void create_shutdown_thread()
|
||||
|
||||
// On "Stop Service" we have to do regular shutdown
|
||||
Service.SetShutdownEvent(hEventShutdown);
|
||||
#endif
|
||||
#endif // EMBEDDED_LIBRARY
|
||||
#endif /* __WIN__ */
|
||||
}
|
||||
|
||||
#endif /* EMBEDDED_LIBRARY */
|
||||
|
||||
|
||||
#if (defined(__NT__) || defined(HAVE_SMEM)) && !defined(EMBEDDED_LIBRARY)
|
||||
static void handle_connections_methods()
|
||||
@ -6307,7 +6337,7 @@ static int show_starttime(THD *thd, SHOW_VAR *var, char *buff)
|
||||
{
|
||||
var->type= SHOW_LONG;
|
||||
var->value= buff;
|
||||
*((long *)buff)= (long) (thd->query_start() - start_time);
|
||||
*((long *)buff)= (long) (thd->query_start() - server_start_time);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -6991,7 +7021,7 @@ static void mysql_init_variables(void)
|
||||
protocol_version= PROTOCOL_VERSION;
|
||||
what_to_log= ~ (1L << (uint) COM_TIME);
|
||||
refresh_version= flush_version= 1L; /* Increments on each reload */
|
||||
query_id= thread_id= 1L;
|
||||
global_query_id= thread_id= 1L;
|
||||
strmov(server_version, MYSQL_SERVER_VERSION);
|
||||
myisam_recover_options_str= sql_mode_str= "OFF";
|
||||
myisam_stats_method_str= "nulls_unequal";
|
||||
@ -8065,6 +8095,8 @@ static int test_if_case_insensitive(const char *dir_name)
|
||||
|
||||
/* Create file to store pid number */
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
|
||||
static void create_pid_file()
|
||||
{
|
||||
File file;
|
||||
@ -8084,7 +8116,7 @@ static void create_pid_file()
|
||||
sql_perror("Can't start server: can't create PID file");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#endif /* EMBEDDED_LIBRARY */
|
||||
|
||||
/* Clear most status variables */
|
||||
void refresh_status(THD *thd)
|
||||
|
@ -220,6 +220,8 @@ my_bool net_realloc(NET *net, ulong length)
|
||||
-1 Don't know if data is ready or not
|
||||
*/
|
||||
|
||||
#if !defined(EMBEDDED_LIBRARY)
|
||||
|
||||
static int net_data_is_ready(my_socket sd)
|
||||
{
|
||||
#ifdef HAVE_POLL
|
||||
@ -254,9 +256,10 @@ static int net_data_is_ready(my_socket sd)
|
||||
return 0;
|
||||
else
|
||||
return test(res ? FD_ISSET(sd, &sfds) : 0);
|
||||
#endif
|
||||
#endif /* HAVE_POLL */
|
||||
}
|
||||
|
||||
#endif /* EMBEDDED_LIBRARY */
|
||||
|
||||
/*
|
||||
Remove unwanted characters from connection
|
||||
@ -282,8 +285,11 @@ static int net_data_is_ready(my_socket sd)
|
||||
|
||||
void net_clear(NET *net, my_bool clear_buffer)
|
||||
{
|
||||
#if !defined(EMBEDDED_LIBRARY)
|
||||
int count, ready;
|
||||
#endif
|
||||
DBUG_ENTER("net_clear");
|
||||
|
||||
#if !defined(EMBEDDED_LIBRARY)
|
||||
if (clear_buffer)
|
||||
{
|
||||
@ -295,7 +301,7 @@ void net_clear(NET *net, my_bool clear_buffer)
|
||||
{
|
||||
DBUG_PRINT("info",("skipped %d bytes from file: %s",
|
||||
count, vio_description(net->vio)));
|
||||
#ifdef EXTRA_DEBUG
|
||||
#if defined(EXTRA_DEBUG) && (MYSQL_VERSION_ID < 51000)
|
||||
fprintf(stderr,"Error: net_clear() skipped %d bytes from file: %s\n",
|
||||
count, vio_description(net->vio));
|
||||
#endif
|
||||
|
161
sql/opt_range.cc
161
sql/opt_range.cc
@ -609,9 +609,6 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
|
||||
double read_time);
|
||||
static
|
||||
TRP_GROUP_MIN_MAX *get_best_group_min_max(PARAM *param, SEL_TREE *tree);
|
||||
static int get_index_merge_params(PARAM *param, key_map& needed_reg,
|
||||
SEL_IMERGE *imerge, double *read_time,
|
||||
ha_rows* imerge_rows);
|
||||
static double get_index_only_read_time(const PARAM* param, ha_rows records,
|
||||
int keynr);
|
||||
|
||||
@ -621,7 +618,6 @@ static void print_sel_tree(PARAM *param, SEL_TREE *tree, key_map *tree_map,
|
||||
static void print_ror_scans_arr(TABLE *table, const char *msg,
|
||||
struct st_ror_scan_info **start,
|
||||
struct st_ror_scan_info **end);
|
||||
static void print_rowid(byte* val, int len);
|
||||
static void print_quick(QUICK_SELECT_I *quick, const key_map *needed_reg);
|
||||
#endif
|
||||
|
||||
@ -933,7 +929,7 @@ QUICK_SELECT_I::QUICK_SELECT_I()
|
||||
|
||||
QUICK_RANGE_SELECT::QUICK_RANGE_SELECT(THD *thd, TABLE *table, uint key_nr,
|
||||
bool no_alloc, MEM_ROOT *parent_alloc)
|
||||
:dont_free(0),error(0),free_file(0),in_range(0),cur_range(NULL),range(0)
|
||||
:dont_free(0),error(0),free_file(0),in_range(0),cur_range(NULL),last_range(0)
|
||||
{
|
||||
my_bitmap_map *bitmap;
|
||||
DBUG_ENTER("QUICK_RANGE_SELECT::QUICK_RANGE_SELECT");
|
||||
@ -1393,13 +1389,12 @@ int QUICK_ROR_UNION_SELECT::queue_cmp(void *arg, byte *val1, byte *val2)
|
||||
|
||||
int QUICK_ROR_UNION_SELECT::reset()
|
||||
{
|
||||
QUICK_SELECT_I* quick;
|
||||
QUICK_SELECT_I *quick;
|
||||
int error;
|
||||
DBUG_ENTER("QUICK_ROR_UNION_SELECT::reset");
|
||||
have_prev_rowid= FALSE;
|
||||
if (!scans_inited)
|
||||
{
|
||||
QUICK_SELECT_I *quick;
|
||||
List_iterator_fast<QUICK_SELECT_I> it(quick_selects);
|
||||
while ((quick= it++))
|
||||
{
|
||||
@ -2428,8 +2423,6 @@ static int find_used_partitions_imerge(PART_PRUNE_PARAM *ppar,
|
||||
static int find_used_partitions_imerge_list(PART_PRUNE_PARAM *ppar,
|
||||
List<SEL_IMERGE> &merges);
|
||||
static void mark_all_partitions_as_used(partition_info *part_info);
|
||||
static uint32 part_num_to_part_id_range(PART_PRUNE_PARAM* prune_par,
|
||||
uint32 num);
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
static void print_partitioning_index(KEY_PART *parts, KEY_PART *parts_end);
|
||||
@ -4690,8 +4683,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
|
||||
param->table->key_info[keynr].name, found_read_time,
|
||||
read_time));
|
||||
|
||||
if (read_time > found_read_time && found_records != HA_POS_ERROR
|
||||
/*|| read_time == DBL_MAX*/ )
|
||||
if (read_time > found_read_time && found_records != HA_POS_ERROR)
|
||||
{
|
||||
read_time= found_read_time;
|
||||
best_records= found_records;
|
||||
@ -7998,7 +7990,7 @@ int QUICK_RANGE_SELECT::reset()
|
||||
byte *mrange_buff;
|
||||
DBUG_ENTER("QUICK_RANGE_SELECT::reset");
|
||||
next=0;
|
||||
range= NULL;
|
||||
last_range= NULL;
|
||||
in_range= FALSE;
|
||||
cur_range= (QUICK_RANGE**) ranges.buffer;
|
||||
|
||||
@ -8132,23 +8124,23 @@ int QUICK_RANGE_SELECT::get_next()
|
||||
{
|
||||
start_key= &mrange_slot->start_key;
|
||||
end_key= &mrange_slot->end_key;
|
||||
range= *(cur_range++);
|
||||
last_range= *(cur_range++);
|
||||
|
||||
start_key->key= (const byte*) range->min_key;
|
||||
start_key->length= range->min_length;
|
||||
start_key->flag= ((range->flag & NEAR_MIN) ? HA_READ_AFTER_KEY :
|
||||
(range->flag & EQ_RANGE) ?
|
||||
start_key->key= (const byte*) last_range->min_key;
|
||||
start_key->length= last_range->min_length;
|
||||
start_key->flag= ((last_range->flag & NEAR_MIN) ? HA_READ_AFTER_KEY :
|
||||
(last_range->flag & EQ_RANGE) ?
|
||||
HA_READ_KEY_EXACT : HA_READ_KEY_OR_NEXT);
|
||||
end_key->key= (const byte*) range->max_key;
|
||||
end_key->length= range->max_length;
|
||||
end_key->key= (const byte*) last_range->max_key;
|
||||
end_key->length= last_range->max_length;
|
||||
/*
|
||||
We use HA_READ_AFTER_KEY here because if we are reading on a key
|
||||
prefix. We want to find all keys with this prefix.
|
||||
*/
|
||||
end_key->flag= (range->flag & NEAR_MAX ? HA_READ_BEFORE_KEY :
|
||||
end_key->flag= (last_range->flag & NEAR_MAX ? HA_READ_BEFORE_KEY :
|
||||
HA_READ_AFTER_KEY);
|
||||
|
||||
mrange_slot->range_flag= range->flag;
|
||||
mrange_slot->range_flag= last_range->flag;
|
||||
}
|
||||
|
||||
result= file->read_multi_range_first(&mrange, multi_range, count,
|
||||
@ -8204,7 +8196,7 @@ int QUICK_RANGE_SELECT::get_next_prefix(uint prefix_length, byte *cur_prefix)
|
||||
{
|
||||
int result;
|
||||
key_range start_key, end_key;
|
||||
if (range)
|
||||
if (last_range)
|
||||
{
|
||||
/* Read the next record in the same range with prefix after cur_prefix. */
|
||||
DBUG_ASSERT(cur_prefix != 0);
|
||||
@ -8218,35 +8210,35 @@ int QUICK_RANGE_SELECT::get_next_prefix(uint prefix_length, byte *cur_prefix)
|
||||
if (count == 0)
|
||||
{
|
||||
/* Ranges have already been used up before. None is left for read. */
|
||||
range= 0;
|
||||
last_range= 0;
|
||||
DBUG_RETURN(HA_ERR_END_OF_FILE);
|
||||
}
|
||||
range= *(cur_range++);
|
||||
last_range= *(cur_range++);
|
||||
|
||||
start_key.key= (const byte*) range->min_key;
|
||||
start_key.length= min(range->min_length, prefix_length);
|
||||
start_key.flag= ((range->flag & NEAR_MIN) ? HA_READ_AFTER_KEY :
|
||||
(range->flag & EQ_RANGE) ?
|
||||
start_key.key= (const byte*) last_range->min_key;
|
||||
start_key.length= min(last_range->min_length, prefix_length);
|
||||
start_key.flag= ((last_range->flag & NEAR_MIN) ? HA_READ_AFTER_KEY :
|
||||
(last_range->flag & EQ_RANGE) ?
|
||||
HA_READ_KEY_EXACT : HA_READ_KEY_OR_NEXT);
|
||||
end_key.key= (const byte*) range->max_key;
|
||||
end_key.length= min(range->max_length, prefix_length);
|
||||
end_key.key= (const byte*) last_range->max_key;
|
||||
end_key.length= min(last_range->max_length, prefix_length);
|
||||
/*
|
||||
We use READ_AFTER_KEY here because if we are reading on a key
|
||||
prefix we want to find all keys with this prefix
|
||||
*/
|
||||
end_key.flag= (range->flag & NEAR_MAX ? HA_READ_BEFORE_KEY :
|
||||
end_key.flag= (last_range->flag & NEAR_MAX ? HA_READ_BEFORE_KEY :
|
||||
HA_READ_AFTER_KEY);
|
||||
|
||||
result= file->read_range_first(range->min_length ? &start_key : 0,
|
||||
range->max_length ? &end_key : 0,
|
||||
test(range->flag & EQ_RANGE),
|
||||
result= file->read_range_first(last_range->min_length ? &start_key : 0,
|
||||
last_range->max_length ? &end_key : 0,
|
||||
test(last_range->flag & EQ_RANGE),
|
||||
sorted);
|
||||
if (range->flag == (UNIQUE_RANGE | EQ_RANGE))
|
||||
range=0; // Stop searching
|
||||
if (last_range->flag == (UNIQUE_RANGE | EQ_RANGE))
|
||||
last_range= 0; // Stop searching
|
||||
|
||||
if (result != HA_ERR_END_OF_FILE)
|
||||
DBUG_RETURN(result);
|
||||
range=0; // No matching rows; go to next range
|
||||
last_range= 0; // No matching rows; go to next range
|
||||
}
|
||||
}
|
||||
|
||||
@ -8260,11 +8252,11 @@ int QUICK_RANGE_SELECT_GEOM::get_next()
|
||||
for (;;)
|
||||
{
|
||||
int result;
|
||||
if (range)
|
||||
if (last_range)
|
||||
{
|
||||
// Already read through key
|
||||
result= file->index_next_same(record, (byte*) range->min_key,
|
||||
range->min_length);
|
||||
result= file->index_next_same(record, (byte*) last_range->min_key,
|
||||
last_range->min_length);
|
||||
if (result != HA_ERR_END_OF_FILE)
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
@ -8273,18 +8265,18 @@ int QUICK_RANGE_SELECT_GEOM::get_next()
|
||||
if (count == 0)
|
||||
{
|
||||
/* Ranges have already been used up before. None is left for read. */
|
||||
range= 0;
|
||||
last_range= 0;
|
||||
DBUG_RETURN(HA_ERR_END_OF_FILE);
|
||||
}
|
||||
range= *(cur_range++);
|
||||
last_range= *(cur_range++);
|
||||
|
||||
result= file->index_read(record,
|
||||
(byte*) range->min_key,
|
||||
range->min_length,
|
||||
(ha_rkey_function)(range->flag ^ GEOM_FLAG));
|
||||
(byte*) last_range->min_key,
|
||||
last_range->min_length,
|
||||
(ha_rkey_function)(last_range->flag ^ GEOM_FLAG));
|
||||
if (result != HA_ERR_KEY_NOT_FOUND && result != HA_ERR_END_OF_FILE)
|
||||
DBUG_RETURN(result);
|
||||
range=0; // Not found, to next range
|
||||
last_range= 0; // Not found, to next range
|
||||
}
|
||||
}
|
||||
|
||||
@ -8309,7 +8301,7 @@ int QUICK_RANGE_SELECT_GEOM::get_next()
|
||||
|
||||
bool QUICK_RANGE_SELECT::row_in_ranges()
|
||||
{
|
||||
QUICK_RANGE *range;
|
||||
QUICK_RANGE *res;
|
||||
uint min= 0;
|
||||
uint max= ranges.elements - 1;
|
||||
uint mid= (max + min)/2;
|
||||
@ -8325,8 +8317,8 @@ bool QUICK_RANGE_SELECT::row_in_ranges()
|
||||
max= mid;
|
||||
mid= (min + max) / 2;
|
||||
}
|
||||
range= *(QUICK_RANGE**)dynamic_array_ptr(&ranges, mid);
|
||||
return (!cmp_next(range) && !cmp_prev(range));
|
||||
res= *(QUICK_RANGE**)dynamic_array_ptr(&ranges, mid);
|
||||
return (!cmp_next(res) && !cmp_prev(res));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -8340,14 +8332,14 @@ bool QUICK_RANGE_SELECT::row_in_ranges()
|
||||
*/
|
||||
|
||||
QUICK_SELECT_DESC::QUICK_SELECT_DESC(QUICK_RANGE_SELECT *q,
|
||||
uint used_key_parts)
|
||||
uint used_key_parts_arg)
|
||||
:QUICK_RANGE_SELECT(*q), rev_it(rev_ranges)
|
||||
{
|
||||
QUICK_RANGE *r;
|
||||
|
||||
QUICK_RANGE **pr= (QUICK_RANGE**)ranges.buffer;
|
||||
QUICK_RANGE **last_range= pr + ranges.elements;
|
||||
for (; pr!=last_range; pr++)
|
||||
QUICK_RANGE **end_range= pr + ranges.elements;
|
||||
for (; pr!=end_range; pr++)
|
||||
rev_ranges.push_front(*pr);
|
||||
|
||||
/* Remove EQ_RANGE flag for keys that are not using the full key */
|
||||
@ -8381,11 +8373,11 @@ int QUICK_SELECT_DESC::get_next()
|
||||
for (;;)
|
||||
{
|
||||
int result;
|
||||
if (range)
|
||||
if (last_range)
|
||||
{ // Already read through key
|
||||
result = ((range->flag & EQ_RANGE)
|
||||
? file->index_next_same(record, (byte*) range->min_key,
|
||||
range->min_length) :
|
||||
result = ((last_range->flag & EQ_RANGE)
|
||||
? file->index_next_same(record, (byte*) last_range->min_key,
|
||||
last_range->min_length) :
|
||||
file->index_prev(record));
|
||||
if (!result)
|
||||
{
|
||||
@ -8396,47 +8388,49 @@ int QUICK_SELECT_DESC::get_next()
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
if (!(range=rev_it++))
|
||||
if (!(last_range= rev_it++))
|
||||
DBUG_RETURN(HA_ERR_END_OF_FILE); // All ranges used
|
||||
|
||||
if (range->flag & NO_MAX_RANGE) // Read last record
|
||||
if (last_range->flag & NO_MAX_RANGE) // Read last record
|
||||
{
|
||||
int local_error;
|
||||
if ((local_error=file->index_last(record)))
|
||||
DBUG_RETURN(local_error); // Empty table
|
||||
if (cmp_prev(range) == 0)
|
||||
if (cmp_prev(last_range) == 0)
|
||||
DBUG_RETURN(0);
|
||||
range=0; // No matching records; go to next range
|
||||
last_range= 0; // No match; go to next range
|
||||
continue;
|
||||
}
|
||||
|
||||
if (range->flag & EQ_RANGE)
|
||||
if (last_range->flag & EQ_RANGE)
|
||||
{
|
||||
result = file->index_read(record, (byte*) range->max_key,
|
||||
range->max_length, HA_READ_KEY_EXACT);
|
||||
result= file->index_read(record, (byte*) last_range->max_key,
|
||||
last_range->max_length, HA_READ_KEY_EXACT);
|
||||
}
|
||||
else
|
||||
{
|
||||
DBUG_ASSERT(range->flag & NEAR_MAX || range_reads_after_key(range));
|
||||
result=file->index_read(record, (byte*) range->max_key,
|
||||
range->max_length,
|
||||
((range->flag & NEAR_MAX) ?
|
||||
HA_READ_BEFORE_KEY : HA_READ_PREFIX_LAST_OR_PREV));
|
||||
DBUG_ASSERT(last_range->flag & NEAR_MAX ||
|
||||
range_reads_after_key(last_range));
|
||||
result=file->index_read(record, (byte*) last_range->max_key,
|
||||
last_range->max_length,
|
||||
((last_range->flag & NEAR_MAX) ?
|
||||
HA_READ_BEFORE_KEY :
|
||||
HA_READ_PREFIX_LAST_OR_PREV));
|
||||
}
|
||||
if (result)
|
||||
{
|
||||
if (result != HA_ERR_KEY_NOT_FOUND && result != HA_ERR_END_OF_FILE)
|
||||
DBUG_RETURN(result);
|
||||
range=0; // Not found, to next range
|
||||
last_range= 0; // Not found, to next range
|
||||
continue;
|
||||
}
|
||||
if (cmp_prev(range) == 0)
|
||||
if (cmp_prev(last_range) == 0)
|
||||
{
|
||||
if (range->flag == (UNIQUE_RANGE | EQ_RANGE))
|
||||
range = 0; // Stop searching
|
||||
if (last_range->flag == (UNIQUE_RANGE | EQ_RANGE))
|
||||
last_range= 0; // Stop searching
|
||||
DBUG_RETURN(0); // Found key is in range
|
||||
}
|
||||
range = 0; // To next range
|
||||
last_range= 0; // To next range
|
||||
}
|
||||
}
|
||||
|
||||
@ -10928,23 +10922,9 @@ static void print_quick(QUICK_SELECT_I *quick, const key_map *needed_reg)
|
||||
}
|
||||
|
||||
|
||||
static void print_rowid(byte* val, int len)
|
||||
{
|
||||
byte *pb;
|
||||
DBUG_LOCK_FILE;
|
||||
fputc('\"', DBUG_FILE);
|
||||
for (pb= val; pb!= val + len; ++pb)
|
||||
fprintf(DBUG_FILE, "%c", *pb);
|
||||
fprintf(DBUG_FILE, "\", hex: ");
|
||||
|
||||
for (pb= val; pb!= val + len; ++pb)
|
||||
fprintf(DBUG_FILE, "%x ", *pb);
|
||||
fputc('\n', DBUG_FILE);
|
||||
DBUG_UNLOCK_FILE;
|
||||
}
|
||||
|
||||
void QUICK_RANGE_SELECT::dbug_dump(int indent, bool verbose)
|
||||
{
|
||||
/* purecov: begin inspected */
|
||||
fprintf(DBUG_FILE, "%*squick range select, key %s, length: %d\n",
|
||||
indent, "", head->key_info[index].name, max_used_key_length);
|
||||
|
||||
@ -10952,8 +10932,8 @@ void QUICK_RANGE_SELECT::dbug_dump(int indent, bool verbose)
|
||||
{
|
||||
QUICK_RANGE *range;
|
||||
QUICK_RANGE **pr= (QUICK_RANGE**)ranges.buffer;
|
||||
QUICK_RANGE **last_range= pr + ranges.elements;
|
||||
for (; pr!=last_range; ++pr)
|
||||
QUICK_RANGE **end_range= pr + ranges.elements;
|
||||
for (; pr != end_range; ++pr)
|
||||
{
|
||||
fprintf(DBUG_FILE, "%*s", indent + 2, "");
|
||||
range= *pr;
|
||||
@ -10978,6 +10958,7 @@ void QUICK_RANGE_SELECT::dbug_dump(int indent, bool verbose)
|
||||
fputs("\n",DBUG_FILE);
|
||||
}
|
||||
}
|
||||
/* purecov: end */
|
||||
}
|
||||
|
||||
void QUICK_INDEX_MERGE_SELECT::dbug_dump(int indent, bool verbose)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user