mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/my/mysql-5.0
This commit is contained in:
commit
a04157fbb3
229 changed files with 3267 additions and 3076 deletions
|
@ -1333,3 +1333,4 @@ win/vs71cache.txt
|
|||
win/vs8cache.txt
|
||||
zlib/*.ds?
|
||||
zlib/*.vcproj
|
||||
mysql-test/mysql-test-run-shell
|
||||
|
|
|
@ -49,11 +49,14 @@ SSL_LIBRARY=--with-yassl
|
|||
|
||||
# If you are not using codefusion add "-Wpointer-arith" to WARNINGS
|
||||
# The following warning flag will give too many warnings:
|
||||
# -Wshadow -Wunused -Winline (The later isn't usable in C++ as
|
||||
# -Wunused -Winline (The later isn't usable in C++ as
|
||||
# __attribute()__ doesn't work with gnu C++)
|
||||
|
||||
global_warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings"
|
||||
#debug_extra_warnings="-Wuninitialized"
|
||||
global_warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable"
|
||||
#
|
||||
# For more warnings, uncomment the following line
|
||||
# global_warnings="$global_warnings -Wshadow"
|
||||
|
||||
c_warnings="$global_warnings -Wunused"
|
||||
cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
|
||||
base_max_configs="--with-innodb --with-ndbcluster --with-archive-storage-engine --with-big-tables --with-blackhole-storage-engine --with-federated-storage-engine --with-csv-storage-engine $SSL_LIBRARY"
|
||||
|
|
|
@ -14,7 +14,9 @@ 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"
|
||||
extra_flags="$pentium_cflags -fprofile-arcs -ftest-coverage -DDISABLE_TAO_ASM $debug_cflags $max_cflags -DMYSQL_SERVER_SUFFIX=-gcov"
|
||||
c_warnings="$c_warnings $debug_extra_warnings"
|
||||
cxx_warnings="$cxx_warnings $debug_extra_warnings"
|
||||
extra_configs="$pentium_configs $debug_configs --disable-shared $static_link"
|
||||
extra_configs="$extra_configs $max_configs"
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
@ -585,7 +585,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},
|
||||
|
@ -888,7 +889,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;
|
||||
|
@ -1768,15 +1769,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;
|
||||
}
|
||||
|
||||
|
@ -2941,7 +2944,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));
|
||||
|
@ -2965,13 +2968,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)
|
||||
{
|
||||
|
@ -3133,7 +3139,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
|
||||
}
|
||||
|
||||
|
@ -3287,7 +3293,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;
|
||||
}
|
||||
|
@ -3332,8 +3338,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);
|
||||
|
@ -3359,9 +3365,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);
|
||||
|
@ -3420,23 +3426,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)
|
||||
|
@ -3456,7 +3459,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] = "";
|
||||
|
||||
|
@ -3466,11 +3469,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])
|
||||
|
@ -3560,10 +3563,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));
|
||||
}
|
||||
|
||||
|
||||
|
@ -3822,8 +3825,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,7 +449,7 @@ 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 *defaults_to_use= NULL;
|
||||
|
@ -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);
|
||||
|
||||
|
|
|
@ -91,15 +91,14 @@ static bool stop_passed= 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();
|
||||
|
||||
|
||||
|
@ -560,7 +559,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
|
||||
|
@ -595,9 +594,9 @@ 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
|
||||
|
@ -803,7 +802,7 @@ static void die(const char* fmt, ...)
|
|||
|
||||
static void print_version()
|
||||
{
|
||||
printf("%s Ver 3.1 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
|
||||
printf("%s Ver 3.2 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
|
||||
NETWARE_SET_SCREEN_MODE(1);
|
||||
}
|
||||
|
||||
|
@ -974,7 +973,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)
|
||||
{
|
||||
|
@ -982,26 +981,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) {
|
||||
|
@ -1020,11 +1024,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;
|
||||
|
@ -1052,12 +1056,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");
|
||||
|
@ -1107,7 +1111,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;
|
||||
|
@ -1115,7 +1119,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))
|
||||
{
|
||||
/*
|
||||
|
@ -1321,7 +1325,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;
|
||||
{
|
||||
|
@ -1347,7 +1351,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 */
|
||||
|
@ -1365,7 +1369,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))
|
||||
|
@ -1378,14 +1382,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)
|
||||
{
|
||||
|
@ -1410,7 +1414,7 @@ end:
|
|||
if (fd >= 0)
|
||||
my_close(fd, MYF(MY_WME));
|
||||
end_io_cache(file);
|
||||
delete description_event;
|
||||
delete glob_description_event;
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
|
@ -111,7 +111,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;
|
||||
|
@ -723,6 +723,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;
|
||||
|
@ -860,11 +861,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;
|
||||
|
@ -1192,7 +1193,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
|
||||
|
@ -1212,7 +1213,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, ...)
|
||||
{
|
||||
|
@ -1242,7 +1244,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);
|
||||
}
|
||||
|
||||
|
@ -1256,7 +1258,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:
|
||||
|
@ -1268,7 +1270,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);
|
||||
|
@ -1276,7 +1278,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);
|
||||
}
|
||||
|
||||
|
|
|
@ -84,10 +84,10 @@ 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_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;
|
||||
|
@ -609,15 +609,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 */
|
||||
|
@ -782,7 +781,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__
|
||||
|
@ -1312,7 +1311,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;
|
||||
|
@ -1343,7 +1342,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
|
||||
|
@ -2128,6 +2126,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);
|
||||
|
@ -2135,7 +2134,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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2431,7 +2430,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);
|
||||
|
@ -3111,7 +3109,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;
|
||||
|
@ -3247,13 +3245,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,
|
||||
|
@ -3677,7 +3674,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;
|
||||
|
||||
|
@ -3685,7 +3682,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))
|
||||
|
@ -3696,19 +3693,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;
|
||||
}
|
||||
}
|
||||
|
@ -3826,19 +3823,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 */
|
||||
|
@ -3924,7 +3919,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",
|
||||
|
@ -3933,7 +3928,7 @@ static struct my_option my_long_options[] =
|
|||
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
|
||||
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
{"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},
|
||||
|
@ -3947,8 +3942,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},
|
||||
|
@ -3984,8 +3979,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.",
|
||||
|
@ -4112,8 +4107,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;
|
||||
}
|
||||
|
@ -4150,7 +4145,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
exit(0);
|
||||
case '?':
|
||||
usage();
|
||||
exit(1);
|
||||
exit(0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -4170,9 +4165,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;
|
||||
}
|
||||
|
@ -4455,13 +4450,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));
|
||||
|
@ -4472,25 +4467,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);
|
||||
}
|
||||
|
@ -4502,10 +4497,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));
|
||||
}
|
||||
|
@ -4642,17 +4637,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,
|
||||
|
@ -5177,15 +5169,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)
|
||||
|
@ -5200,6 +5191,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);
|
||||
|
||||
|
@ -5365,7 +5357,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
|
||||
|
@ -5378,6 +5369,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;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
@ -5705,8 +5697,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();
|
||||
|
@ -6073,8 +6065,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(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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ typedef struct
|
|||
{
|
||||
uint beg;
|
||||
uint end;
|
||||
uint mblen;
|
||||
uint mb_len;
|
||||
} my_match_t;
|
||||
|
||||
enum my_lex_states
|
||||
|
|
|
@ -371,14 +371,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))
|
||||
|
|
|
@ -260,9 +260,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;
|
||||
|
||||
|
|
|
@ -73,16 +73,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) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR || (t) == FIELD_TYPE_NEWDECIMAL)
|
||||
#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
|
||||
#define INTERNAL_NUM_FIELD(f) (((f)->type <= FIELD_TYPE_INT24 && ((f)->type != FIELD_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == FIELD_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);
|
||||
|
|
|
@ -1730,7 +1730,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. */
|
||||
|
||||
|
@ -2174,7 +2174,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);
|
||||
|
||||
|
@ -2185,10 +2185,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3014,7 +3014,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.
|
||||
|
||||
|
@ -3089,65 +3089,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.
|
||||
|
@ -3175,7 +3176,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;
|
||||
|
@ -3192,7 +3193,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;
|
||||
|
@ -3355,8 +3356,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);
|
||||
|
@ -3520,7 +3520,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:
|
||||
|
@ -3862,32 +3862,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;
|
||||
|
@ -3898,7 +3898,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;
|
||||
}
|
||||
|
@ -3909,7 +3909,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;
|
||||
|
@ -4275,6 +4275,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 */
|
||||
|
@ -4339,7 +4341,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;
|
||||
|
@ -4408,9 +4412,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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4418,7 +4423,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;
|
||||
|
@ -4442,8 +4447,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 ;
|
||||
|
@ -4490,7 +4496,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;
|
||||
|
@ -4512,11 +4518,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)
|
||||
{
|
||||
/*
|
||||
|
@ -4526,15 +4533,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))
|
||||
{
|
||||
|
@ -4591,7 +4598,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)
|
||||
|
@ -4601,7 +4608,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;
|
||||
|
@ -4618,26 +4625,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);
|
||||
}
|
||||
|
@ -4709,7 +4716,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;
|
||||
|
@ -4722,12 +4729,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))
|
||||
{
|
||||
|
@ -4791,16 +4798,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))
|
||||
|
|
|
@ -1052,7 +1052,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;
|
||||
err:
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
|
|
@ -490,7 +490,7 @@ static void _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_
|
|||
FT_SEG_ITERATOR ftsi;
|
||||
FTB_EXPR *ftbe;
|
||||
float weight=ftbw->weight;
|
||||
int yn=ftbw->flags, ythresh, mode=(ftsi_orig != 0);
|
||||
int yn_flag= ftbw->flags, ythresh, mode=(ftsi_orig != 0);
|
||||
my_off_t curdoc=ftbw->docid[mode];
|
||||
|
||||
for (ftbe=ftbw->up; ftbe; ftbe=ftbe->up)
|
||||
|
@ -504,13 +504,13 @@ static void _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_
|
|||
}
|
||||
if (ftbe->nos)
|
||||
break;
|
||||
if (yn & FTB_FLAG_YES)
|
||||
if (yn_flag & FTB_FLAG_YES)
|
||||
{
|
||||
weight /= ftbe->ythresh;
|
||||
ftbe->cur_weight += weight;
|
||||
if ((int) ++ftbe->yesses == ythresh)
|
||||
{
|
||||
yn=ftbe->flags;
|
||||
yn_flag=ftbe->flags;
|
||||
weight=ftbe->cur_weight*ftbe->weight;
|
||||
if (mode && ftbe->phrase)
|
||||
{
|
||||
|
@ -531,14 +531,14 @@ static void _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_
|
|||
break;
|
||||
}
|
||||
else
|
||||
if (yn & FTB_FLAG_NO)
|
||||
if (yn_flag & FTB_FLAG_NO)
|
||||
{
|
||||
/*
|
||||
NOTE: special sort function of queue assures that all
|
||||
(yn & FTB_FLAG_NO) != 0
|
||||
(yn_flag & FTB_FLAG_NO) != 0
|
||||
events for every particular subexpression will
|
||||
"auto-magically" happen BEFORE all the
|
||||
(yn & FTB_FLAG_YES) != 0 events. So no
|
||||
(yn_flag & FTB_FLAG_YES) != 0 events. So no
|
||||
already matched expression can become not-matched again.
|
||||
*/
|
||||
++ftbe->nos;
|
||||
|
@ -551,8 +551,8 @@ static void _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_
|
|||
ftbe->cur_weight += weight;
|
||||
if ((int) ftbe->yesses < ythresh)
|
||||
break;
|
||||
if (!(yn & FTB_FLAG_WONLY))
|
||||
yn= ((int) ftbe->yesses++ == ythresh) ? ftbe->flags : FTB_FLAG_WONLY ;
|
||||
if (!(yn_flag & FTB_FLAG_WONLY))
|
||||
yn_flag= ((int) ftbe->yesses++ == ythresh) ? ftbe->flags : FTB_FLAG_WONLY ;
|
||||
weight*= ftbe->weight;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -358,11 +358,11 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
|
|||
}
|
||||
else
|
||||
{
|
||||
uint j;
|
||||
uint k;
|
||||
share->keyinfo[i].seg=pos;
|
||||
for (j=0; j < FT_SEGS; j++)
|
||||
for (k=0; k < FT_SEGS; k++)
|
||||
{
|
||||
*pos=ft_keysegs[j];
|
||||
*pos= ft_keysegs[k];
|
||||
pos[0].language= pos[-1].language;
|
||||
if (!(pos[0].charset= pos[-1].charset))
|
||||
{
|
||||
|
|
|
@ -470,9 +470,9 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
|
|||
else
|
||||
{
|
||||
/* We have to compare k and vseg as if they were space extended */
|
||||
uchar *end= k+ (cmplen - len);
|
||||
for ( ; k < end && *k == ' '; k++) ;
|
||||
if (k == end)
|
||||
uchar *k_end= k+ (cmplen - len);
|
||||
for ( ; k < k_end && *k == ' '; k++) ;
|
||||
if (k == k_end)
|
||||
goto cmp_rest; /* should never happen */
|
||||
if (*k < (uchar) ' ')
|
||||
{
|
||||
|
@ -484,15 +484,15 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
|
|||
}
|
||||
else if (len > cmplen)
|
||||
{
|
||||
uchar *end;
|
||||
uchar *vseg_end;
|
||||
if ((nextflag & SEARCH_PREFIX) && key_len_left == 0)
|
||||
goto fix_flag;
|
||||
|
||||
/* We have to compare k and vseg as if they were space extended */
|
||||
for (end=vseg + (len-cmplen) ;
|
||||
vseg < end && *vseg == (uchar) ' ';
|
||||
for (vseg_end= vseg + (len-cmplen) ;
|
||||
vseg < vseg_end && *vseg == (uchar) ' ';
|
||||
vseg++, matched++) ;
|
||||
DBUG_ASSERT(vseg < end);
|
||||
DBUG_ASSERT(vseg < vseg_end);
|
||||
|
||||
if (*vseg > (uchar) ' ')
|
||||
{
|
||||
|
|
|
@ -56,7 +56,7 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record,
|
|||
if (_mi_search_next(info,info->s->keyinfo+def->key, info->lastkey,
|
||||
MI_UNIQUE_HASH_LENGTH, SEARCH_BIGGER,
|
||||
info->s->state.key_root[def->key]) ||
|
||||
bcmp(info->lastkey, key_buff, MI_UNIQUE_HASH_LENGTH))
|
||||
bcmp((char*) info->lastkey, (char*) key_buff, MI_UNIQUE_HASH_LENGTH))
|
||||
{
|
||||
info->page_changed=1; /* Can't optimize read next */
|
||||
info->lastpos=lastpos;
|
||||
|
|
|
@ -2689,8 +2689,9 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
|
|||
}
|
||||
case FIELD_VARCHAR:
|
||||
{
|
||||
uint pack_length= HA_VARCHAR_PACKLENGTH(count->field_length-1);
|
||||
ulong col_length= (pack_length == 1 ? (uint) *(uchar*) start_pos :
|
||||
uint var_pack_length= HA_VARCHAR_PACKLENGTH(count->field_length-1);
|
||||
ulong col_length= (var_pack_length == 1 ?
|
||||
(uint) *(uchar*) start_pos :
|
||||
uint2korr(start_pos));
|
||||
/* Empty varchar are encoded with a single 1 bit. */
|
||||
if (!col_length)
|
||||
|
@ -2700,7 +2701,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
|
|||
}
|
||||
else
|
||||
{
|
||||
byte *end=start_pos+pack_length+col_length;
|
||||
byte *end= start_pos + var_pack_length + col_length;
|
||||
DBUG_PRINT("fields", ("FIELD_VARCHAR not empty, bits: 1"));
|
||||
write_bits(0,1);
|
||||
/* Write the varchar length. */
|
||||
|
@ -2708,7 +2709,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
|
|||
col_length, count->length_bits));
|
||||
write_bits(col_length,count->length_bits);
|
||||
/* Encode the varchar bytes. */
|
||||
for (start_pos+=pack_length ; start_pos < end ; start_pos++)
|
||||
for (start_pos+= var_pack_length ; start_pos < end ; start_pos++)
|
||||
{
|
||||
DBUG_PRINT("fields",
|
||||
("value: 0x%02x code: 0x%s bits: %2u bin: %s",
|
||||
|
|
|
@ -626,8 +626,6 @@ static int rtree_insert_level(MI_INFO *info, uint keynr, uchar *key,
|
|||
|
||||
if ((old_root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR)
|
||||
{
|
||||
int res;
|
||||
|
||||
if ((old_root = _mi_new(info, keyinfo, DFLT_INIT_HITS)) == HA_OFFSET_ERROR)
|
||||
return -1;
|
||||
info->buff_used = 1;
|
||||
|
@ -913,7 +911,6 @@ int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length)
|
|||
for (i = 0; i < ReinsertList.n_pages; ++i)
|
||||
{
|
||||
uchar *page_buf;
|
||||
uint nod_flag;
|
||||
uchar *k;
|
||||
uchar *last;
|
||||
|
||||
|
|
|
@ -220,9 +220,9 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
|
|||
|
||||
if (my_b_inited(&tempfile_for_exceptions))
|
||||
{
|
||||
MI_INFO *index=info->sort_info->info;
|
||||
MI_INFO *idx=info->sort_info->info;
|
||||
uint keyno=info->key;
|
||||
uint key_length, ref_length=index->s->rec_reflength;
|
||||
uint key_length, ref_length=idx->s->rec_reflength;
|
||||
|
||||
if (!no_messages)
|
||||
printf(" - Adding exceptions\n"); /* purecov: tested */
|
||||
|
@ -235,7 +235,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
|
|||
&& !my_b_read(&tempfile_for_exceptions,(byte*)sort_keys,
|
||||
(uint) key_length))
|
||||
{
|
||||
if (_mi_ck_write(index,keyno,(uchar*) sort_keys,key_length-ref_length))
|
||||
if (_mi_ck_write(idx,keyno,(uchar*) sort_keys,key_length-ref_length))
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
DROP TABLE IF EXISTS t1;
|
||||
drop view if exists v1;
|
||||
drop database if exists client_test_db;
|
||||
mysql.columns_priv OK
|
||||
mysql.db OK
|
||||
mysql.func 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
|
||||
|
|
|
@ -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
|
||||
|
@ -262,4 +262,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
|
||||
|
|
|
@ -175,6 +175,12 @@ call p1();
|
|||
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000009 | $MYSQL
|
||||
call p1();
|
||||
drop procedure p1;
|
||||
# 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
|
||||
|
||||
# clean up
|
||||
drop table t1, t2, t03, t04, t3, t4, t5;
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
# 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
|
||||
|
||||
# Embedded server doesn't support external clients
|
||||
--source include/not_embedded.inc
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -866,8 +866,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);
|
||||
|
@ -893,14 +893,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\
|
||||
|
|
|
@ -321,10 +321,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 */
|
||||
|
@ -337,32 +337,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
|
||||
|
|
|
@ -840,9 +840,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)
|
||||
|
|
|
@ -123,10 +123,10 @@ void bitmap_set_bit(MY_BITMAP *map, uint bitmap_bit)
|
|||
|
||||
my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit)
|
||||
{
|
||||
uchar *byte= map->bitmap + (bitmap_bit / 8);
|
||||
uchar *value= 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];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ private:
|
|||
Uint32 data[2];
|
||||
|
||||
public:
|
||||
ArbitTicket() {}
|
||||
STATIC_CONST( DataLength = 2 );
|
||||
STATIC_CONST( TextLength = DataLength * 8 ); // hex digits
|
||||
|
||||
|
@ -142,6 +143,7 @@ public:
|
|||
ArbitTicket ticket; // ticket
|
||||
NodeBitmask mask; // set of nodes
|
||||
|
||||
ArbitSignalData() {}
|
||||
STATIC_CONST( SignalLength = 3 + ArbitTicket::DataLength + NodeBitmask::Size );
|
||||
|
||||
inline bool match(ArbitSignalData& aData) const {
|
||||
|
|
|
@ -274,6 +274,7 @@ public:
|
|||
Uint32 MinRowsLow;
|
||||
Uint32 MinRowsHigh;
|
||||
|
||||
Table() {}
|
||||
void init();
|
||||
};
|
||||
|
||||
|
@ -334,6 +335,7 @@ public:
|
|||
Uint32 AttributeAutoIncrement;
|
||||
char AttributeDefaultValue[MAX_ATTR_DEFAULT_VALUE_SIZE];
|
||||
|
||||
Attribute() {}
|
||||
void init();
|
||||
|
||||
inline
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
|
||||
bool checkMagicNumber() const;
|
||||
|
||||
inline void next(NdbReceiver* next) { m_next = next;}
|
||||
inline void next(NdbReceiver* next_arg) { m_next = next_arg;}
|
||||
inline NdbReceiver* next() { return m_next; }
|
||||
|
||||
void setErrorCode(int);
|
||||
|
|
|
@ -116,6 +116,11 @@ struct SegmentedSectionPtr {
|
|||
Uint32 i;
|
||||
struct SectionSegment * p;
|
||||
|
||||
SegmentedSectionPtr() {}
|
||||
SegmentedSectionPtr(Uint32 sz_arg, Uint32 i_arg,
|
||||
struct SectionSegment *p_arg)
|
||||
:sz(sz_arg), i(i_arg), p(p_arg)
|
||||
{}
|
||||
void setNull() { p = 0;}
|
||||
bool isNull() const { return p == 0;}
|
||||
};
|
||||
|
|
|
@ -26,6 +26,7 @@ class InputStream {
|
|||
public:
|
||||
virtual ~InputStream() {}
|
||||
virtual char* gets(char * buf, int bufLen) = 0;
|
||||
InputStream() {}
|
||||
};
|
||||
|
||||
class FileInputStream : public InputStream {
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
class OutputStream {
|
||||
public:
|
||||
OutputStream() {}
|
||||
virtual ~OutputStream() {}
|
||||
virtual int print(const char * fmt, ...) = 0;
|
||||
virtual int println(const char * fmt, ...) = 0;
|
||||
|
@ -60,6 +61,7 @@ public:
|
|||
|
||||
class NullOutputStream : public OutputStream {
|
||||
public:
|
||||
NullOutputStream() {}
|
||||
int print(const char * /* unused */, ...) { return 1;}
|
||||
int println(const char * /* unused */, ...) { return 1;}
|
||||
};
|
||||
|
|
|
@ -168,6 +168,7 @@ public:
|
|||
bool add(Uint16 key, Uint32 value);
|
||||
bool add(Uint16 key, const char * value);
|
||||
bool add(Uint16 key, const void* value, int len);
|
||||
Writer() {}
|
||||
protected:
|
||||
virtual ~Writer() {}
|
||||
virtual bool reset() = 0;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
class SocketAuthenticator
|
||||
{
|
||||
public:
|
||||
SocketAuthenticator() {}
|
||||
virtual ~SocketAuthenticator() {};
|
||||
virtual bool client_authenticate(int sockfd) = 0;
|
||||
virtual bool server_authenticate(int sockfd) = 0;
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
*/
|
||||
class Service {
|
||||
public:
|
||||
Service() {}
|
||||
virtual ~Service(){}
|
||||
|
||||
/**
|
||||
|
|
|
@ -154,12 +154,13 @@ ConfigRetriever::getConfig() {
|
|||
}
|
||||
|
||||
ndb_mgm_configuration *
|
||||
ConfigRetriever::getConfig(NdbMgmHandle m_handle)
|
||||
ConfigRetriever::getConfig(NdbMgmHandle m_handle_arg)
|
||||
{
|
||||
ndb_mgm_configuration * conf = ndb_mgm_get_configuration(m_handle,m_version);
|
||||
ndb_mgm_configuration * conf = ndb_mgm_get_configuration(m_handle_arg,
|
||||
m_version);
|
||||
if(conf == 0)
|
||||
{
|
||||
setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle));
|
||||
setError(CR_ERROR, ndb_mgm_get_latest_error_desc(m_handle_arg));
|
||||
return 0;
|
||||
}
|
||||
return conf;
|
||||
|
|
|
@ -60,9 +60,9 @@ NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros){
|
|||
int res = gettimeofday(&tick_time, 0);
|
||||
|
||||
if(secs==0) {
|
||||
NDB_TICKS secs = tick_time.tv_sec;
|
||||
NDB_TICKS local_secs = tick_time.tv_sec;
|
||||
*micros = tick_time.tv_usec;
|
||||
*micros = secs*1000000+*micros;
|
||||
*micros = local_secs*1000000+*micros;
|
||||
} else {
|
||||
* secs = tick_time.tv_sec;
|
||||
* micros = tick_time.tv_usec;
|
||||
|
|
|
@ -31,7 +31,7 @@ SHM_Transporter::SHM_Transporter(TransporterRegistry &t_reg,
|
|||
const char *lHostName,
|
||||
const char *rHostName,
|
||||
int r_port,
|
||||
bool isMgmConnection,
|
||||
bool isMgmConnection_arg,
|
||||
NodeId lNodeId,
|
||||
NodeId rNodeId,
|
||||
NodeId serverNodeId,
|
||||
|
@ -40,7 +40,7 @@ SHM_Transporter::SHM_Transporter(TransporterRegistry &t_reg,
|
|||
key_t _shmKey,
|
||||
Uint32 _shmSize) :
|
||||
Transporter(t_reg, tt_SHM_TRANSPORTER,
|
||||
lHostName, rHostName, r_port, isMgmConnection,
|
||||
lHostName, rHostName, r_port, isMgmConnection_arg,
|
||||
lNodeId, rNodeId, serverNodeId,
|
||||
0, false, checksum, signalId),
|
||||
shmKey(_shmKey),
|
||||
|
|
|
@ -67,14 +67,14 @@ TCP_Transporter::TCP_Transporter(TransporterRegistry &t_reg,
|
|||
const char *lHostName,
|
||||
const char *rHostName,
|
||||
int r_port,
|
||||
bool isMgmConnection,
|
||||
bool isMgmConnection_arg,
|
||||
NodeId lNodeId,
|
||||
NodeId rNodeId,
|
||||
NodeId serverNodeId,
|
||||
bool chksm, bool signalId,
|
||||
Uint32 _reportFreq) :
|
||||
Transporter(t_reg, tt_TCP_TRANSPORTER,
|
||||
lHostName, rHostName, r_port, isMgmConnection,
|
||||
lHostName, rHostName, r_port, isMgmConnection_arg,
|
||||
lNodeId, rNodeId, serverNodeId,
|
||||
0, false, chksm, signalId),
|
||||
m_sendBuffer(sendBufSize)
|
||||
|
|
|
@ -33,6 +33,7 @@ struct ReceiveBuffer {
|
|||
Uint32 sizeOfData; // In bytes
|
||||
Uint32 sizeOfBuffer;
|
||||
|
||||
ReceiveBuffer() {}
|
||||
bool init(int bytes);
|
||||
void destroy();
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ Transporter::connect_server(NDB_SOCKET_TYPE sockfd) {
|
|||
{
|
||||
struct sockaddr_in addr;
|
||||
SOCKET_SIZE_TYPE addrlen= sizeof(addr);
|
||||
int r= getpeername(sockfd, (struct sockaddr*)&addr, &addrlen);
|
||||
getpeername(sockfd, (struct sockaddr*)&addr, &addrlen);
|
||||
m_connect_address= (&addr)->sin_addr;
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ Transporter::connect_client(NDB_SOCKET_TYPE sockfd) {
|
|||
{
|
||||
struct sockaddr_in addr;
|
||||
SOCKET_SIZE_TYPE addrlen= sizeof(addr);
|
||||
int r= getpeername(sockfd, (struct sockaddr*)&addr, &addrlen);
|
||||
getpeername(sockfd, (struct sockaddr*)&addr, &addrlen);
|
||||
m_connect_address= (&addr)->sin_addr;
|
||||
}
|
||||
|
||||
|
|
|
@ -1413,8 +1413,6 @@ TransporterRegistry::add_transporter_interface(NodeId remoteNodeId,
|
|||
bool
|
||||
TransporterRegistry::start_service(SocketServer& socket_server)
|
||||
{
|
||||
struct ndb_mgm_reply mgm_reply;
|
||||
|
||||
DBUG_ENTER("TransporterRegistry::start_service");
|
||||
if (m_transporter_interface.size() > 0 && !nodeIdSpecified)
|
||||
{
|
||||
|
|
|
@ -16,21 +16,6 @@
|
|||
#include <Bitmask.hpp>
|
||||
#include <NdbOut.hpp>
|
||||
|
||||
static
|
||||
void print(const Uint32 src[], Uint32 len, Uint32 pos = 0)
|
||||
{
|
||||
printf("b'");
|
||||
for(unsigned i = 0; i<len; i++)
|
||||
{
|
||||
if(BitmaskImpl::get((pos + len + 31) >> 5, src, i+pos))
|
||||
printf("1");
|
||||
else
|
||||
printf("0");
|
||||
if((i & 31) == 31)
|
||||
printf(" ");
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __TEST_BITMASK__
|
||||
|
||||
void
|
||||
|
@ -95,6 +80,21 @@ BitmaskImpl::setFieldImpl(Uint32 dst[],
|
|||
}
|
||||
#else
|
||||
|
||||
static
|
||||
void print(const Uint32 src[], Uint32 len, Uint32 pos = 0)
|
||||
{
|
||||
printf("b'");
|
||||
for(unsigned i = 0; i<len; i++)
|
||||
{
|
||||
if(BitmaskImpl::get((pos + len + 31) >> 5, src, i+pos))
|
||||
printf("1");
|
||||
else
|
||||
printf("0");
|
||||
if((i & 31) == 31)
|
||||
printf(" ");
|
||||
}
|
||||
}
|
||||
|
||||
#define DEBUG 0
|
||||
#include <Vector.hpp>
|
||||
static void do_test(int bitmask_size);
|
||||
|
|
|
@ -447,13 +447,13 @@ ConfigValuesFactory::put(const ConfigValues::Entry & entry){
|
|||
if(count >= sz){
|
||||
pos = hash(tmp, sz);
|
||||
count = 0;
|
||||
Uint32 val = m_cfg->m_values[pos];
|
||||
Uint32 val2 = m_cfg->m_values[pos];
|
||||
|
||||
printf("key: %d, (key %% size): %d\n", entry.m_key, (entry.m_key % sz));
|
||||
printf("pos: %d", pos);
|
||||
while((val & KP_MASK) != tmp && val != CFV_KEY_FREE && count < sz){
|
||||
while((val2 & KP_MASK) != tmp && val2 != CFV_KEY_FREE && count < sz){
|
||||
pos = nextHash(tmp, sz, pos, ++count);
|
||||
val = m_cfg->m_values[pos];
|
||||
val2 = m_cfg->m_values[pos];
|
||||
printf(" %d", pos);
|
||||
}
|
||||
printf("\n");
|
||||
|
|
|
@ -162,9 +162,9 @@ File_class::readChar(char* buf)
|
|||
}
|
||||
|
||||
int
|
||||
File_class::write(const void* buf, size_t size, size_t nitems)
|
||||
File_class::write(const void* buf, size_t size_arg, size_t nitems)
|
||||
{
|
||||
return ::fwrite(buf, size, nitems, m_file);
|
||||
return ::fwrite(buf, size_arg, nitems, m_file);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -627,11 +627,11 @@ PropertiesImpl::getPropsPut(const char * name,
|
|||
if(nvp == 0){
|
||||
Properties * tmpP = new Properties();
|
||||
PropertyImpl * tmpPI = new PropertyImpl(tmp2, tmpP);
|
||||
PropertyImpl * nvp = put(tmpPI);
|
||||
PropertyImpl * nvp2 = put(tmpPI);
|
||||
|
||||
delete tmpP;
|
||||
free(tmp2);
|
||||
return ((Properties*)nvp->value)->impl->getPropsPut(tmp+1, impl);
|
||||
return ((Properties*)nvp2->value)->impl->getPropsPut(tmp+1, impl);
|
||||
}
|
||||
free(tmp2);
|
||||
if(nvp->valueType != PropertiesType_Properties){
|
||||
|
|
|
@ -87,7 +87,7 @@ SocketClient::bind(const char* bindaddress, unsigned short localport)
|
|||
int ret = errno;
|
||||
NDB_CLOSE_SOCKET(m_sockfd);
|
||||
m_sockfd= NDB_INVALID_SOCKET;
|
||||
return errno;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (::bind(m_sockfd, (struct sockaddr*)&local, sizeof(local)) == -1)
|
||||
|
|
|
@ -197,7 +197,7 @@ int initSequence(RandomSequence *seq, SequenceValues *inputValues)
|
|||
unsigned int i;
|
||||
unsigned int j;
|
||||
unsigned int totalLength;
|
||||
unsigned int index;
|
||||
unsigned int idx;
|
||||
|
||||
if( !seq || !inputValues ) return(-1);
|
||||
|
||||
|
@ -219,12 +219,12 @@ int initSequence(RandomSequence *seq, SequenceValues *inputValues)
|
|||
/*----------------------*/
|
||||
/* set the array values */
|
||||
/*----------------------*/
|
||||
index = 0;
|
||||
idx = 0;
|
||||
|
||||
for(i = 0; inputValues[i].length != 0; i++) {
|
||||
for(j = 0; j < inputValues[i].length; j++ ) {
|
||||
seq->values[index] = inputValues[i].value;
|
||||
index++;
|
||||
seq->values[idx] = inputValues[i].value;
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -164,8 +164,8 @@ write_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
|
|||
FD_SET(socket, &writeset);
|
||||
timeout.tv_sec = 1;
|
||||
timeout.tv_usec = 0;
|
||||
const int selectRes = select(socket + 1, 0, &writeset, 0, &timeout);
|
||||
if(selectRes != 1){
|
||||
const int selectRes2 = select(socket + 1, 0, &writeset, 0, &timeout);
|
||||
if(selectRes2 != 1){
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -389,7 +389,6 @@ CPCDAPISession::listProcesses(Parser_t::Context & /* unused */,
|
|||
void
|
||||
CPCDAPISession::showVersion(Parser_t::Context & /* unused */,
|
||||
const class Properties & args){
|
||||
Uint32 id;
|
||||
CPCD::RequestStatus rs;
|
||||
|
||||
m_output->println("show version");
|
||||
|
|
|
@ -74,8 +74,6 @@ extern "C" static void sig_child(int signo, siginfo_t*, void*);
|
|||
const char *progname = "ndb_cpcd";
|
||||
|
||||
int main(int argc, char** argv){
|
||||
int save_argc= argc;
|
||||
char** save_argv= argv;
|
||||
const char *load_default_groups[]= { "ndb_cpcd",0 };
|
||||
MY_INIT(argv[0]);
|
||||
|
||||
|
|
|
@ -1246,7 +1246,7 @@ Cmvmi::execTESTSIG(Signal* signal){
|
|||
fprintf(stdout, "\n");
|
||||
|
||||
for(i = 0; i<signal->header.m_noOfSections; i++){
|
||||
SegmentedSectionPtr ptr = {0,0,0};
|
||||
SegmentedSectionPtr ptr(0,0,0);
|
||||
ndbout_c("-- Section %d --", i);
|
||||
signal->getSection(ptr, i);
|
||||
ndbrequire(ptr.p != 0);
|
||||
|
@ -1304,7 +1304,7 @@ Cmvmi::execTESTSIG(Signal* signal){
|
|||
LinearSectionPtr ptr[3];
|
||||
const Uint32 secs = signal->getNoOfSections();
|
||||
for(i = 0; i<secs; i++){
|
||||
SegmentedSectionPtr sptr = {0,0,0};
|
||||
SegmentedSectionPtr sptr(0,0,0);
|
||||
signal->getSection(sptr, i);
|
||||
ptr[i].sz = sptr.sz;
|
||||
ptr[i].p = new Uint32[sptr.sz];
|
||||
|
@ -1353,7 +1353,7 @@ Cmvmi::execTESTSIG(Signal* signal){
|
|||
LinearSectionPtr ptr[3];
|
||||
const Uint32 secs = signal->getNoOfSections();
|
||||
for(i = 0; i<secs; i++){
|
||||
SegmentedSectionPtr sptr = {0,0,0};
|
||||
SegmentedSectionPtr sptr(0,0,0);
|
||||
signal->getSection(sptr, i);
|
||||
ptr[i].sz = sptr.sz;
|
||||
ptr[i].p = new Uint32[sptr.sz];
|
||||
|
@ -1419,7 +1419,7 @@ Cmvmi::execTESTSIG(Signal* signal){
|
|||
const Uint32 secs = signal->getNoOfSections();
|
||||
memset(g_test, 0, sizeof(g_test));
|
||||
for(i = 0; i<secs; i++){
|
||||
SegmentedSectionPtr sptr = {0,0,0};
|
||||
SegmentedSectionPtr sptr(0,0,0);
|
||||
signal->getSection(sptr, i);
|
||||
g_test[i].sz = sptr.sz;
|
||||
g_test[i].p = new Uint32[sptr.sz];
|
||||
|
|
|
@ -5067,11 +5067,6 @@ void Dbdict::handleTabInfoInit(SimpleProperties::Reader & it,
|
|||
tablePtr.p->minRowsLow = tableDesc.MinRowsLow;
|
||||
tablePtr.p->minRowsHigh = tableDesc.MinRowsHigh;
|
||||
|
||||
Uint64 maxRows =
|
||||
(((Uint64)tablePtr.p->maxRowsHigh) << 32) + tablePtr.p->maxRowsLow;
|
||||
Uint64 minRows =
|
||||
(((Uint64)tablePtr.p->minRowsHigh) << 32) + tablePtr.p->minRowsLow;
|
||||
|
||||
tablePtr.p->frmLen = tableDesc.FrmLen;
|
||||
memcpy(tablePtr.p->frmData, tableDesc.FrmData, tableDesc.FrmLen);
|
||||
|
||||
|
|
|
@ -131,6 +131,7 @@ public:
|
|||
* on disk. Index trigger ids are volatile.
|
||||
*/
|
||||
struct TableRecord : public MetaData::Table {
|
||||
TableRecord() {}
|
||||
Uint32 maxRowsLow;
|
||||
Uint32 maxRowsHigh;
|
||||
Uint32 minRowsLow;
|
||||
|
@ -250,6 +251,7 @@ public:
|
|||
* attributes. This is wrong but convenient.
|
||||
*/
|
||||
struct AttributeRecord : public MetaData::Attribute {
|
||||
AttributeRecord() {}
|
||||
union {
|
||||
/** Pointer to the next attribute used by ArrayPool */
|
||||
Uint32 nextPool;
|
||||
|
@ -285,6 +287,7 @@ public:
|
|||
* trigger online creates the trigger in TC (if index) and LQH-TUP.
|
||||
*/
|
||||
struct TriggerRecord {
|
||||
TriggerRecord() {}
|
||||
|
||||
/** Trigger state */
|
||||
enum TriggerState {
|
||||
|
@ -864,6 +867,7 @@ private:
|
|||
* seize/release invokes ctor/dtor automatically.
|
||||
*/
|
||||
struct OpRecordCommon {
|
||||
OpRecordCommon() {}
|
||||
Uint32 key; // key shared between master and slaves
|
||||
Uint32 nextHash;
|
||||
Uint32 prevHash;
|
||||
|
@ -879,6 +883,7 @@ private:
|
|||
* Create table record
|
||||
*/
|
||||
struct CreateTableRecord : OpRecordCommon {
|
||||
CreateTableRecord() {}
|
||||
Uint32 m_senderRef;
|
||||
Uint32 m_senderData;
|
||||
Uint32 m_coordinatorRef;
|
||||
|
@ -917,6 +922,7 @@ private:
|
|||
* Drop table record
|
||||
*/
|
||||
struct DropTableRecord : OpRecordCommon {
|
||||
DropTableRecord() {}
|
||||
DropTableReq m_request;
|
||||
|
||||
Uint32 m_requestType;
|
||||
|
|
|
@ -1288,6 +1288,7 @@ public:
|
|||
private:
|
||||
|
||||
struct LcpState {
|
||||
LcpState() {}
|
||||
LcpStatus lcpStatus;
|
||||
Uint32 lcpStatusUpdatedPlace;
|
||||
|
||||
|
@ -1394,6 +1395,7 @@ public:
|
|||
private:
|
||||
class MasterTakeOverState {
|
||||
public:
|
||||
MasterTakeOverState() {}
|
||||
void set(LcpMasterTakeOverState s, Uint32 line) {
|
||||
state = s; updatePlace = line;
|
||||
}
|
||||
|
@ -1481,6 +1483,7 @@ private:
|
|||
* SwitchReplicaRecord - Should only be used by master
|
||||
*/
|
||||
struct SwitchReplicaRecord {
|
||||
SwitchReplicaRecord() {}
|
||||
void clear(){}
|
||||
|
||||
Uint32 nodeId;
|
||||
|
|
|
@ -509,6 +509,7 @@ public:
|
|||
typedef Ptr<Databuf> DatabufPtr;
|
||||
|
||||
struct ScanRecord {
|
||||
ScanRecord() {}
|
||||
enum ScanState {
|
||||
SCAN_FREE = 0,
|
||||
WAIT_STORED_PROC_COPY = 1,
|
||||
|
@ -2899,6 +2900,7 @@ public:
|
|||
*
|
||||
*/
|
||||
struct CommitAckMarker {
|
||||
CommitAckMarker() {}
|
||||
Uint32 transid1;
|
||||
Uint32 transid2;
|
||||
|
||||
|
@ -2925,6 +2927,7 @@ public:
|
|||
void scanMarkers(Signal* signal, Uint32 tcNodeFail, Uint32 bucket, Uint32 i);
|
||||
|
||||
struct Counters {
|
||||
Counters() {}
|
||||
Uint32 operations;
|
||||
|
||||
inline void clear(){
|
||||
|
|
|
@ -7548,7 +7548,6 @@ Dblqh::get_acc_ptr_from_scan_record(ScanRecord* scanP,
|
|||
bool crash_flag)
|
||||
{
|
||||
Uint32* acc_ptr;
|
||||
Uint32 attr_buf_rec, attr_buf_index;
|
||||
if (!((index < MAX_PARALLEL_OP_PER_SCAN) &&
|
||||
index < scanP->scan_acc_index)) {
|
||||
ndbrequire(crash_flag);
|
||||
|
@ -7593,7 +7592,6 @@ void Dblqh::execSCAN_FRAGREQ(Signal* signal)
|
|||
const Uint32 scanLockMode = ScanFragReq::getLockMode(reqinfo);
|
||||
const Uint8 keyinfo = ScanFragReq::getKeyinfoFlag(reqinfo);
|
||||
const Uint8 rangeScan = ScanFragReq::getRangeScanFlag(reqinfo);
|
||||
const Uint8 tupScan = ScanFragReq::getTupScanFlag(reqinfo);
|
||||
|
||||
ptrCheckGuard(tabptr, ctabrecFileSize, tablerec);
|
||||
if(tabptr.p->tableStatus != Tablerec::TABLE_DEFINED){
|
||||
|
@ -8979,9 +8977,6 @@ Uint32 Dblqh::sendKeyinfo20(Signal* signal,
|
|||
const Uint32 scanOp = scanP->m_curr_batch_size_rows;
|
||||
const Uint32 nodeId = refToNode(ref);
|
||||
const bool connectedToNode = getNodeInfo(nodeId).m_connected;
|
||||
const Uint32 type = getNodeInfo(nodeId).m_type;
|
||||
const bool is_api = (type >= NodeInfo::API && type <= NodeInfo::REP);
|
||||
const bool old_dest = (getNodeInfo(nodeId).m_version < MAKE_VERSION(3,5,0));
|
||||
const bool longable = true; // TODO is_api && !old_dest;
|
||||
|
||||
Uint32 * dst = keyInfo->keyData;
|
||||
|
@ -9082,7 +9077,6 @@ void Dblqh::sendScanFragConf(Signal* signal, Uint32 scanCompleted)
|
|||
return;
|
||||
}
|
||||
ScanFragConf * conf = (ScanFragConf*)&signal->theData[0];
|
||||
NodeId tc_node_id= refToNode(tcConnectptr.p->clientBlockref);
|
||||
Uint32 trans_id1= tcConnectptr.p->transid[0];
|
||||
Uint32 trans_id2= tcConnectptr.p->transid[1];
|
||||
|
||||
|
@ -11368,7 +11362,6 @@ void Dblqh::sendAccContOp(Signal* signal)
|
|||
{
|
||||
LcpLocRecordPtr sacLcpLocptr;
|
||||
|
||||
int count = 0;
|
||||
sacLcpLocptr.i = lcpPtr.p->firstLcpLocAcc;
|
||||
do {
|
||||
ptrCheckGuard(sacLcpLocptr, clcpLocrecFileSize, lcpLocRecord);
|
||||
|
@ -15070,8 +15063,6 @@ void Dblqh::execDEBUG_SIG(Signal* signal)
|
|||
2.5 TEMPORARY VARIABLES
|
||||
-----------------------
|
||||
*/
|
||||
UintR tdebug;
|
||||
|
||||
jamEntry();
|
||||
//logPagePtr.i = signal->theData[0];
|
||||
//tdebug = logPagePtr.p->logPageWord[0];
|
||||
|
|
|
@ -303,6 +303,7 @@ public:
|
|||
/* WHEN THE TRIGGER IS DEACTIVATED. */
|
||||
/* **************************************** */
|
||||
struct TcDefinedTriggerData {
|
||||
TcDefinedTriggerData() {}
|
||||
/**
|
||||
* Trigger id, used to identify the trigger
|
||||
*/
|
||||
|
@ -957,6 +958,7 @@ public:
|
|||
/* ALL TABLES IN THE SYSTEM. */
|
||||
/********************************************************/
|
||||
struct TableRecord {
|
||||
TableRecord() {}
|
||||
Uint32 currentSchemaVersion;
|
||||
Uint8 enabled;
|
||||
Uint8 dropping;
|
||||
|
@ -1666,6 +1668,7 @@ private:
|
|||
UintR tcheckGcpId;
|
||||
|
||||
struct TransCounters {
|
||||
TransCounters() {}
|
||||
enum { Off, Timer, Started } c_trans_status;
|
||||
UintR cattrinfoCount;
|
||||
UintR ctransCount;
|
||||
|
@ -1804,6 +1807,7 @@ private:
|
|||
*/
|
||||
public:
|
||||
struct CommitAckMarker {
|
||||
CommitAckMarker() {}
|
||||
Uint32 transid1;
|
||||
Uint32 transid2;
|
||||
union { Uint32 nextPool; Uint32 nextHash; };
|
||||
|
|
|
@ -747,6 +747,7 @@ typedef Ptr<RestartInfoRecord> RestartInfoRecordPtr;
|
|||
/* WHEN THE TRIGGER IS DEACTIVATED. */
|
||||
/* **************************************** */
|
||||
struct TupTriggerData {
|
||||
TupTriggerData() {}
|
||||
|
||||
/**
|
||||
* Trigger id, used by DICT/TRIX to identify the trigger
|
||||
|
|
|
@ -89,7 +89,6 @@ Dbtup::execNEXT_SCANREQ(Signal* signal)
|
|||
FragrecordPtr fragPtr;
|
||||
fragPtr.i = scan.m_fragPtrI[0];
|
||||
ptrCheckGuard(fragPtr, cnoOfFragrec, fragrecord);
|
||||
Fragrecord& frag = *fragPtr.p;
|
||||
switch (req->scanFlag) {
|
||||
case NextScanReq::ZSCAN_NEXT:
|
||||
jam();
|
||||
|
|
|
@ -401,8 +401,6 @@ Dbtux::nodePopUpScans(NodeHandle& node, unsigned pos)
|
|||
void
|
||||
Dbtux::nodeSlide(NodeHandle& dstNode, NodeHandle& srcNode, unsigned cnt, unsigned i)
|
||||
{
|
||||
Frag& frag = dstNode.m_frag;
|
||||
TreeHead& tree = frag.m_tree;
|
||||
ndbrequire(i <= 1);
|
||||
while (cnt != 0) {
|
||||
TreeEnt ent;
|
||||
|
|
|
@ -704,7 +704,6 @@ Dbtux::scanFirst(ScanOpPtr scanPtr)
|
|||
debugOut << "Enter first scan " << scanPtr.i << " " << scan << endl;
|
||||
}
|
||||
#endif
|
||||
TreeHead& tree = frag.m_tree;
|
||||
// set up index keys for this operation
|
||||
setKeyAttrs(frag);
|
||||
// scan direction 0, 1
|
||||
|
@ -985,7 +984,6 @@ Dbtux::scanVisible(ScanOpPtr scanPtr, TreeEnt ent)
|
|||
const Frag& frag = *c_fragPool.getPtr(scan.m_fragPtrI);
|
||||
Uint32 fragBit = ent.m_fragBit;
|
||||
Uint32 tableFragPtrI = frag.m_tupTableFragPtrI[fragBit];
|
||||
Uint32 fragId = frag.m_fragId | fragBit;
|
||||
Uint32 tupAddr = getTupAddr(frag, ent);
|
||||
Uint32 tupVersion = ent.m_tupVersion;
|
||||
// check for same tuple twice in row
|
||||
|
|
|
@ -212,7 +212,6 @@ Dbtux::treeRemove(Frag& frag, TreePos treePos)
|
|||
void
|
||||
Dbtux::treeRemoveInner(Frag& frag, NodeHandle lubNode, unsigned pos)
|
||||
{
|
||||
TreeHead& tree = frag.m_tree;
|
||||
TreeEnt ent;
|
||||
// find g.l.b node
|
||||
NodeHandle glbNode(frag);
|
||||
|
|
|
@ -82,6 +82,7 @@ public:
|
|||
*/
|
||||
|
||||
struct StartRecord {
|
||||
StartRecord() {}
|
||||
Uint64 m_startTime;
|
||||
|
||||
void reset();
|
||||
|
|
|
@ -818,7 +818,6 @@ Ndbcntr::trySystemRestart(Signal* signal){
|
|||
*/
|
||||
const bool allNodes = c_start.m_waiting.equal(c_allDefinedNodes);
|
||||
const bool allClusterNodes = c_start.m_waiting.equal(c_clusterNodes);
|
||||
const Uint64 now = NdbTick_CurrentMillisecond();
|
||||
|
||||
if(!allClusterNodes){
|
||||
jam();
|
||||
|
@ -1390,7 +1389,6 @@ void Ndbcntr::execNODE_FAILREP(Signal* signal)
|
|||
const bool tMasterFailed = allFailed.get(cmasterNodeId);
|
||||
const bool tStarted = !failedStarted.isclear();
|
||||
const bool tStarting = !failedStarting.isclear();
|
||||
const bool tWaiting = !failedWaiting.isclear();
|
||||
|
||||
if(tMasterFailed){
|
||||
jam();
|
||||
|
@ -2471,8 +2469,6 @@ void Ndbcntr::execABORT_ALL_CONF(Signal* signal){
|
|||
|
||||
void Ndbcntr::execABORT_ALL_REF(Signal* signal){
|
||||
jamEntry();
|
||||
AbortAllRef *abortAllRef = (AbortAllRef *)&signal->theData[0];
|
||||
AbortAllRef::ErrorCode errorCode = (AbortAllRef::ErrorCode) abortAllRef->errorCode;
|
||||
|
||||
StopRef * const stopRef = (StopRef *)&signal->theData[0];
|
||||
stopRef->senderData = c_stopRec.stopReq.senderData;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue