Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/my/mysql-5.0 BitKeeper/etc/ignore: auto-union BUILD/SETUP.sh: Auto merged Makefile.am: Auto merged client/mysql.cc: Auto merged cmd-line-utils/readline/display.c: Auto merged configure.in: Auto merged extra/yassl/include/buffer.hpp: Auto merged extra/yassl/include/crypto_wrapper.hpp: Auto merged extra/yassl/include/yassl_imp.hpp: Auto merged extra/yassl/include/yassl_int.hpp: Auto merged extra/yassl/src/crypto_wrapper.cpp: Auto merged extra/yassl/taocrypt/include/algebra.hpp: Auto merged extra/yassl/taocrypt/include/des.hpp: Auto merged extra/yassl/taocrypt/include/hash.hpp: Auto merged extra/yassl/taocrypt/include/hmac.hpp: Auto merged extra/yassl/taocrypt/include/modarith.hpp: Auto merged extra/yassl/taocrypt/include/modes.hpp: Auto merged extra/yassl/taocrypt/include/rsa.hpp: Auto merged extra/yassl/taocrypt/include/type_traits.hpp: Auto merged extra/yassl/taocrypt/mySTL/list.hpp: Auto merged extra/yassl/taocrypt/src/aes.cpp: Auto merged extra/yassl/taocrypt/src/algebra.cpp: Auto merged extra/yassl/testsuite/testsuite.cpp: Auto merged include/my_global.h: Auto merged include/my_pthread.h: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/mi_open.c: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/r/mysqltest.result: Auto merged mysql-test/t/mysqltest.test: Auto merged mysys/default.c: Auto merged ndb/src/common/transporter/Transporter.cpp: Auto merged ndb/src/common/util/File.cpp: Auto merged ndb/src/common/util/SocketClient.cpp: Auto merged ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp: Auto merged ndb/src/kernel/blocks/dbtc/Dbtc.hpp: Auto merged ndb/src/kernel/blocks/qmgr/Qmgr.hpp: Auto merged ndb/src/kernel/blocks/qmgr/QmgrMain.cpp: Auto merged ndb/src/mgmapi/mgmapi.cpp: Auto merged ndb/src/mgmclient/CommandInterpreter.cpp: Auto merged ndb/src/mgmsrv/ConfigInfo.cpp: Auto merged ndb/src/mgmsrv/MgmtSrvr.cpp: Auto merged ndb/src/ndbapi/ClusterMgr.hpp: Auto merged ndb/src/ndbapi/Ndb.cpp: Auto merged ndb/src/ndbapi/NdbScanOperation.cpp: Auto merged ndb/src/ndbapi/SignalSender.cpp: Auto merged sql/field.cc: Auto merged sql/filesort.cc: Auto merged sql/ha_myisammrg.cc: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_func.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_subselect.h: Auto merged sql/item_sum.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/mysql_priv.h: Auto merged sql/net_serv.cc: Auto merged sql/opt_range.cc: Auto merged sql/opt_range.h: Auto merged sql/repl_failsafe.cc: Auto merged sql/set_var.cc: Auto merged sql/set_var.h: Auto merged sql/slave.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_union.cc: Auto merged sql/sql_update.cc: Auto merged sql-common/client.c: Auto merged sql/sql_view.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.cc: Auto merged sql/unireg.cc: Auto merged extra/yassl/taocrypt/src/asn.cpp: Manual merge (Fix shadowed variable name) extra/yassl/taocrypt/test/test.cpp: No changes ndb/src/common/util/ConfigValues.cpp: Manual merge (Fix shadowed variable name) sql/field.h: manual merge sql/ha_myisam.cc: manual merge sql/ha_ndbcluster.cc: manual merge sql/item_cmpfunc.cc: manual merge sql/item_subselect.cc: Manual merge (Fix shadowed variable name) sql/mysqld.cc: no changes
This commit is contained in:
commit
1384e64005
@ -49,11 +49,14 @@ SSL_LIBRARY=--with-yassl
|
|||||||
|
|
||||||
# If you are not using codefusion add "-Wpointer-arith" to WARNINGS
|
# If you are not using codefusion add "-Wpointer-arith" to WARNINGS
|
||||||
# The following warning flag will give too many 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++)
|
# __attribute()__ doesn't work with gnu C++)
|
||||||
|
|
||||||
global_warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings"
|
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"
|
||||||
#debug_extra_warnings="-Wuninitialized"
|
#
|
||||||
|
# For more warnings, uncomment the following line
|
||||||
|
# global_warnings="$global_warnings -Wshadow"
|
||||||
|
|
||||||
c_warnings="$global_warnings -Wunused"
|
c_warnings="$global_warnings -Wunused"
|
||||||
cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
|
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"
|
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
|
# The -fprofile-arcs and -ftest-coverage options cause GCC to instrument the
|
||||||
# code with profiling information used by gcov.
|
# code with profiling information used by gcov.
|
||||||
# the -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl.
|
# the -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl.
|
||||||
extra_flags="$pentium_cflags -fprofile-arcs -ftest-coverage -DDISABLE_TAO_ASM"
|
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="$pentium_configs $debug_configs --disable-shared $static_link"
|
||||||
extra_configs="$extra_configs $max_configs"
|
extra_configs="$extra_configs $max_configs"
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ typedef enum enum_info_type INFO_TYPE;
|
|||||||
static MYSQL mysql; /* The connection */
|
static MYSQL mysql; /* The connection */
|
||||||
static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
|
static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
|
||||||
connected=0,opt_raw_data=0,unbuffered=0,output_tables=0,
|
connected=0,opt_raw_data=0,unbuffered=0,output_tables=0,
|
||||||
rehash=1,skip_updates=0,safe_updates=0,one_database=0,
|
opt_rehash=1,skip_updates=0,safe_updates=0,one_database=0,
|
||||||
opt_compress=0, using_opt_local_infile=0,
|
opt_compress=0, using_opt_local_infile=0,
|
||||||
vertical=0, line_numbers=1, column_names=1,opt_html=0,
|
vertical=0, line_numbers=1, column_names=1,opt_html=0,
|
||||||
opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0,
|
opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0,
|
||||||
@ -585,7 +585,8 @@ static struct my_option my_long_options[] =
|
|||||||
#endif
|
#endif
|
||||||
{"auto-rehash", OPT_AUTO_REHASH,
|
{"auto-rehash", OPT_AUTO_REHASH,
|
||||||
"Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. Disable with --disable-auto-rehash.",
|
"Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. Disable with --disable-auto-rehash.",
|
||||||
(gptr*) &rehash, (gptr*) &rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
|
(gptr*) &opt_rehash, (gptr*) &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
|
||||||
|
0, 0},
|
||||||
{"no-auto-rehash", 'A',
|
{"no-auto-rehash", 'A',
|
||||||
"No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead.",
|
"No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead.",
|
||||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
@ -888,7 +889,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
rehash= 0;
|
opt_rehash= 0;
|
||||||
break;
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
column_names= 0;
|
column_names= 0;
|
||||||
@ -1768,15 +1769,17 @@ char *rindex(const char *s,int c)
|
|||||||
|
|
||||||
static int reconnect(void)
|
static int reconnect(void)
|
||||||
{
|
{
|
||||||
|
/* purecov: begin tested */
|
||||||
if (opt_reconnect)
|
if (opt_reconnect)
|
||||||
{
|
{
|
||||||
put_info("No connection. Trying to reconnect...",INFO_INFO);
|
put_info("No connection. Trying to reconnect...",INFO_INFO);
|
||||||
(void) com_connect((String *) 0, 0);
|
(void) com_connect((String *) 0, 0);
|
||||||
if (rehash)
|
if (opt_rehash)
|
||||||
com_rehash(NULL, NULL);
|
com_rehash(NULL, NULL);
|
||||||
}
|
}
|
||||||
if (!connected)
|
if (!connected)
|
||||||
return put_info("Can't connect to the server\n",INFO_ERROR);
|
return put_info("Can't connect to the server\n",INFO_ERROR);
|
||||||
|
/* purecov: end */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2941,7 +2944,7 @@ static int
|
|||||||
com_connect(String *buffer, char *line)
|
com_connect(String *buffer, char *line)
|
||||||
{
|
{
|
||||||
char *tmp, buff[256];
|
char *tmp, buff[256];
|
||||||
bool save_rehash= rehash;
|
bool save_rehash= opt_rehash;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
bzero(buff, sizeof(buff));
|
bzero(buff, sizeof(buff));
|
||||||
@ -2965,13 +2968,16 @@ com_connect(String *buffer, char *line)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rehash= 0; // Quick re-connect
|
{
|
||||||
|
/* Quick re-connect */
|
||||||
|
opt_rehash= 0; /* purecov: tested */
|
||||||
|
}
|
||||||
buffer->length(0); // command used
|
buffer->length(0); // command used
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rehash= 0;
|
opt_rehash= 0;
|
||||||
error=sql_connect(current_host,current_db,current_user,opt_password,0);
|
error=sql_connect(current_host,current_db,current_user,opt_password,0);
|
||||||
rehash= save_rehash;
|
opt_rehash= save_rehash;
|
||||||
|
|
||||||
if (connected)
|
if (connected)
|
||||||
{
|
{
|
||||||
@ -3133,7 +3139,7 @@ com_use(String *buffer __attribute__((unused)), char *line)
|
|||||||
current_db=my_strdup(tmp,MYF(MY_WME));
|
current_db=my_strdup(tmp,MYF(MY_WME));
|
||||||
#ifdef HAVE_READLINE
|
#ifdef HAVE_READLINE
|
||||||
if (select_db > 1)
|
if (select_db > 1)
|
||||||
build_completion_hash(rehash, 1);
|
build_completion_hash(opt_rehash, 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3287,7 +3293,7 @@ sql_real_connect(char *host,char *database,char *user,char *password,
|
|||||||
mysql.reconnect= 1;
|
mysql.reconnect= 1;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_READLINE
|
#ifdef HAVE_READLINE
|
||||||
build_completion_hash(rehash, 1);
|
build_completion_hash(opt_rehash, 1);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -3332,8 +3338,8 @@ static int
|
|||||||
com_status(String *buffer __attribute__((unused)),
|
com_status(String *buffer __attribute__((unused)),
|
||||||
char *line __attribute__((unused)))
|
char *line __attribute__((unused)))
|
||||||
{
|
{
|
||||||
const char *status;
|
const char *status_str;
|
||||||
char buff[22];
|
char buff[40];
|
||||||
ulonglong id;
|
ulonglong id;
|
||||||
MYSQL_RES *result;
|
MYSQL_RES *result;
|
||||||
LINT_INIT(result);
|
LINT_INIT(result);
|
||||||
@ -3359,9 +3365,9 @@ com_status(String *buffer __attribute__((unused)),
|
|||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_OPENSSL
|
#ifdef HAVE_OPENSSL
|
||||||
if ((status= mysql_get_ssl_cipher(&mysql)))
|
if ((status_str= mysql_get_ssl_cipher(&mysql)))
|
||||||
tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n",
|
tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n",
|
||||||
status);
|
status_str);
|
||||||
else
|
else
|
||||||
#endif /* HAVE_OPENSSL */
|
#endif /* HAVE_OPENSSL */
|
||||||
tee_puts("SSL:\t\t\tNot in use", stdout);
|
tee_puts("SSL:\t\t\tNot in use", stdout);
|
||||||
@ -3420,23 +3426,20 @@ com_status(String *buffer __attribute__((unused)),
|
|||||||
tee_fprintf(stdout, "Protocol:\t\tCompressed\n");
|
tee_fprintf(stdout, "Protocol:\t\tCompressed\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((status=mysql_stat(&mysql)) && !mysql_error(&mysql)[0])
|
if ((status_str= mysql_stat(&mysql)) && !mysql_error(&mysql)[0])
|
||||||
{
|
{
|
||||||
ulong sec;
|
ulong sec;
|
||||||
char buff[40];
|
const char *pos= strchr(status_str,' ');
|
||||||
const char *pos= strchr(status,' ');
|
|
||||||
/* print label */
|
/* print label */
|
||||||
tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status), status);
|
tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status_str), status_str);
|
||||||
if ((status=str2int(pos,10,0,LONG_MAX,(long*) &sec)))
|
if ((status_str= str2int(pos,10,0,LONG_MAX,(long*) &sec)))
|
||||||
{
|
{
|
||||||
nice_time((double) sec,buff,0);
|
nice_time((double) sec,buff,0);
|
||||||
tee_puts(buff, stdout); /* print nice time */
|
tee_puts(buff, stdout); /* print nice time */
|
||||||
while (*status == ' ') status++; /* to next info */
|
while (*status_str == ' ')
|
||||||
}
|
status_str++; /* to next info */
|
||||||
if (status)
|
|
||||||
{
|
|
||||||
tee_putc('\n', stdout);
|
tee_putc('\n', stdout);
|
||||||
tee_puts(status, stdout);
|
tee_puts(status_str, stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (safe_updates)
|
if (safe_updates)
|
||||||
@ -3456,7 +3459,7 @@ select_limit, max_join_size);
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
server_version_string(MYSQL *mysql)
|
server_version_string(MYSQL *con)
|
||||||
{
|
{
|
||||||
static char buf[MAX_SERVER_VERSION_LENGTH] = "";
|
static char buf[MAX_SERVER_VERSION_LENGTH] = "";
|
||||||
|
|
||||||
@ -3466,11 +3469,11 @@ server_version_string(MYSQL *mysql)
|
|||||||
char *bufp = buf;
|
char *bufp = buf;
|
||||||
MYSQL_RES *result;
|
MYSQL_RES *result;
|
||||||
|
|
||||||
bufp = strnmov(buf, mysql_get_server_info(mysql), sizeof buf);
|
bufp= strnmov(buf, mysql_get_server_info(con), sizeof buf);
|
||||||
|
|
||||||
/* "limit 1" is protection against SQL_SELECT_LIMIT=0 */
|
/* "limit 1" is protection against SQL_SELECT_LIMIT=0 */
|
||||||
if (!mysql_query(mysql, "select @@version_comment limit 1") &&
|
if (!mysql_query(con, "select @@version_comment limit 1") &&
|
||||||
(result = mysql_use_result(mysql)))
|
(result = mysql_use_result(con)))
|
||||||
{
|
{
|
||||||
MYSQL_ROW cur = mysql_fetch_row(result);
|
MYSQL_ROW cur = mysql_fetch_row(result);
|
||||||
if (cur && cur[0])
|
if (cur && cur[0])
|
||||||
@ -3560,10 +3563,10 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate)
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
put_error(MYSQL *mysql)
|
put_error(MYSQL *con)
|
||||||
{
|
{
|
||||||
return put_info(mysql_error(mysql), INFO_ERROR, mysql_errno(mysql),
|
return put_info(mysql_error(con), INFO_ERROR, mysql_errno(con),
|
||||||
mysql_sqlstate(mysql));
|
mysql_sqlstate(con));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3822,8 +3825,6 @@ static const char* construct_prompt()
|
|||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
char* dateTime;
|
char* dateTime;
|
||||||
time_t lclock;
|
|
||||||
lclock = time(NULL);
|
|
||||||
dateTime = ctime(&lclock);
|
dateTime = ctime(&lclock);
|
||||||
processed_prompt.append(strtok(dateTime,"\n"));
|
processed_prompt.append(strtok(dateTime,"\n"));
|
||||||
break;
|
break;
|
||||||
|
@ -449,7 +449,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
char *forced_defaults_file;
|
char *forced_defaults_file;
|
||||||
char *forced_extra_defaults;
|
char *forced_extra_defaults;
|
||||||
char *defaults_group_suffix;
|
char *local_defaults_group_suffix;
|
||||||
const char *script_line;
|
const char *script_line;
|
||||||
char *upgrade_defaults_path;
|
char *upgrade_defaults_path;
|
||||||
char *defaults_to_use= NULL;
|
char *defaults_to_use= NULL;
|
||||||
@ -466,7 +466,7 @@ int main(int argc, char **argv)
|
|||||||
/* Check if we are forced to use specific defaults */
|
/* Check if we are forced to use specific defaults */
|
||||||
get_defaults_options(argc, argv,
|
get_defaults_options(argc, argv,
|
||||||
&forced_defaults_file, &forced_extra_defaults,
|
&forced_defaults_file, &forced_extra_defaults,
|
||||||
&defaults_group_suffix);
|
&local_defaults_group_suffix);
|
||||||
|
|
||||||
load_defaults("my", load_default_groups, &argc, &argv);
|
load_defaults("my", load_default_groups, &argc, &argv);
|
||||||
|
|
||||||
|
@ -91,15 +91,14 @@ static bool stop_passed= 0;
|
|||||||
This is because the event will be created (alloced) in read_log_event()
|
This is because the event will be created (alloced) in read_log_event()
|
||||||
(which returns a pointer) in check_header().
|
(which returns a pointer) in check_header().
|
||||||
*/
|
*/
|
||||||
Format_description_log_event* description_event;
|
Format_description_log_event* glob_description_event;
|
||||||
|
|
||||||
static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
|
static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
|
||||||
const char* logname);
|
const char* logname);
|
||||||
static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
|
static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
|
||||||
const char* logname);
|
const char* logname);
|
||||||
static int dump_log_entries(const char* logname);
|
static int dump_log_entries(const char* logname);
|
||||||
static int dump_remote_file(NET* net, const char* fname);
|
static void die(const char* fmt, ...) __attribute__ ((__noreturn__));
|
||||||
static void die(const char* fmt, ...);
|
|
||||||
static MYSQL* safe_connect();
|
static MYSQL* safe_connect();
|
||||||
|
|
||||||
|
|
||||||
@ -560,7 +559,7 @@ int process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
|||||||
ce->print(result_file, print_event_info, TRUE);
|
ce->print(result_file, print_event_info, TRUE);
|
||||||
|
|
||||||
// If this binlog is not 3.23 ; why this test??
|
// If this binlog is not 3.23 ; why this test??
|
||||||
if (description_event->binlog_version >= 3)
|
if (glob_description_event->binlog_version >= 3)
|
||||||
{
|
{
|
||||||
if (load_processor.process(ce))
|
if (load_processor.process(ce))
|
||||||
break; // Error
|
break; // Error
|
||||||
@ -595,9 +594,9 @@ Create_file event for file_id: %u\n",exv->file_id);
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FORMAT_DESCRIPTION_EVENT:
|
case FORMAT_DESCRIPTION_EVENT:
|
||||||
delete description_event;
|
delete glob_description_event;
|
||||||
description_event= (Format_description_log_event*) ev;
|
glob_description_event= (Format_description_log_event*) ev;
|
||||||
print_event_info->common_header_len= description_event->common_header_len;
|
print_event_info->common_header_len= glob_description_event->common_header_len;
|
||||||
ev->print(result_file, print_event_info);
|
ev->print(result_file, print_event_info);
|
||||||
/*
|
/*
|
||||||
We don't want this event to be deleted now, so let's hide it (I
|
We don't want this event to be deleted now, so let's hide it (I
|
||||||
@ -803,7 +802,7 @@ static void die(const char* fmt, ...)
|
|||||||
|
|
||||||
static void print_version()
|
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);
|
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
|
This is not as smart as check_header() (used for local log); it will not work
|
||||||
for a binlog which mixes format. TODO: fix this.
|
for a binlog which mixes format. TODO: fix this.
|
||||||
*/
|
*/
|
||||||
static int check_master_version(MYSQL* mysql,
|
static int check_master_version(MYSQL *mysql_arg,
|
||||||
Format_description_log_event
|
Format_description_log_event
|
||||||
**description_event)
|
**description_event)
|
||||||
{
|
{
|
||||||
@ -982,26 +981,31 @@ static int check_master_version(MYSQL* mysql,
|
|||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
const char* version;
|
const char* version;
|
||||||
|
|
||||||
if (mysql_query(mysql, "SELECT VERSION()") ||
|
if (mysql_query(mysql_arg, "SELECT VERSION()") ||
|
||||||
!(res = mysql_store_result(mysql)))
|
!(res = mysql_store_result(mysql_arg)))
|
||||||
{
|
{
|
||||||
|
/* purecov: begin inspected */
|
||||||
char errmsg[256];
|
char errmsg[256];
|
||||||
strmake(errmsg, mysql_error(mysql), sizeof(errmsg)-1);
|
strmake(errmsg, mysql_error(mysql_arg), sizeof(errmsg)-1);
|
||||||
mysql_close(mysql);
|
mysql_close(mysql_arg);
|
||||||
die("Error checking master version: %s", errmsg);
|
die("Error checking master version: %s", errmsg);
|
||||||
|
/* purecov: end */
|
||||||
}
|
}
|
||||||
if (!(row = mysql_fetch_row(res)))
|
if (!(row = mysql_fetch_row(res)))
|
||||||
{
|
{
|
||||||
|
/* purecov: begin inspected */
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
mysql_close(mysql);
|
mysql_close(mysql);
|
||||||
die("Master returned no rows for SELECT VERSION()");
|
die("Master returned no rows for SELECT VERSION()");
|
||||||
return 1;
|
/* purecov: end */
|
||||||
}
|
}
|
||||||
if (!(version = row[0]))
|
if (!(version = row[0]))
|
||||||
{
|
{
|
||||||
|
/* purecov: begin inspected */
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
mysql_close(mysql);
|
mysql_close(mysql_arg);
|
||||||
die("Master reported NULL for the version");
|
die("Master reported NULL for the version");
|
||||||
|
/* purecov: end */
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (*version) {
|
switch (*version) {
|
||||||
@ -1020,11 +1024,11 @@ static int check_master_version(MYSQL* mysql,
|
|||||||
*description_event= new Format_description_log_event(3);
|
*description_event= new Format_description_log_event(3);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sql_print_error("Master reported unrecognized MySQL version '%s'",
|
/* purecov: begin inspected */
|
||||||
version);
|
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
mysql_close(mysql);
|
mysql_close(mysql_arg);
|
||||||
return 1;
|
die("Master reported unrecognized MySQL version '%s'", version);
|
||||||
|
/* purecov: end */
|
||||||
}
|
}
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1052,12 +1056,12 @@ static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
|
|||||||
mysql= safe_connect();
|
mysql= safe_connect();
|
||||||
net= &mysql->net;
|
net= &mysql->net;
|
||||||
|
|
||||||
if (check_master_version(mysql, &description_event))
|
if (check_master_version(mysql, &glob_description_event))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Could not find server version");
|
fprintf(stderr, "Could not find server version");
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
if (!description_event || !description_event->is_valid())
|
if (!glob_description_event || !glob_description_event->is_valid())
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Invalid Format_description log event; \
|
fprintf(stderr, "Invalid Format_description log event; \
|
||||||
could be out of memory");
|
could be out of memory");
|
||||||
@ -1107,7 +1111,7 @@ could be out of memory");
|
|||||||
len, net->read_pos[5]));
|
len, net->read_pos[5]));
|
||||||
if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 ,
|
if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 ,
|
||||||
len - 1, &error_msg,
|
len - 1, &error_msg,
|
||||||
description_event)))
|
glob_description_event)))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Could not construct log event object\n");
|
fprintf(stderr, "Could not construct log event object\n");
|
||||||
error= 1;
|
error= 1;
|
||||||
@ -1115,7 +1119,7 @@ could be out of memory");
|
|||||||
}
|
}
|
||||||
|
|
||||||
Log_event_type type= ev->get_type_code();
|
Log_event_type type= ev->get_type_code();
|
||||||
if (description_event->binlog_version >= 3 ||
|
if (glob_description_event->binlog_version >= 3 ||
|
||||||
(type != LOAD_EVENT && type != CREATE_FILE_EVENT))
|
(type != LOAD_EVENT && type != CREATE_FILE_EVENT))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -1321,7 +1325,7 @@ static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
|
|||||||
my_close(fd, MYF(MY_WME));
|
my_close(fd, MYF(MY_WME));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
check_header(file, &description_event);
|
check_header(file, &glob_description_event);
|
||||||
}
|
}
|
||||||
else // reading from stdin;
|
else // reading from stdin;
|
||||||
{
|
{
|
||||||
@ -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,
|
if (init_io_cache(file, fileno(stdin), 0, READ_CACHE, (my_off_t) 0,
|
||||||
0, MYF(MY_WME | MY_NABP | MY_DONT_CHECK_FILESIZE)))
|
0, MYF(MY_WME | MY_NABP | MY_DONT_CHECK_FILESIZE)))
|
||||||
return 1;
|
return 1;
|
||||||
check_header(file, &description_event);
|
check_header(file, &glob_description_event);
|
||||||
if (start_position)
|
if (start_position)
|
||||||
{
|
{
|
||||||
/* skip 'start_position' characters from stdin */
|
/* skip 'start_position' characters from stdin */
|
||||||
@ -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");
|
die("Invalid Format_description log event; could be out of memory");
|
||||||
|
|
||||||
if (!start_position && my_b_read(file, tmp_buff, BIN_LOG_HEADER_SIZE))
|
if (!start_position && my_b_read(file, tmp_buff, BIN_LOG_HEADER_SIZE))
|
||||||
@ -1378,14 +1382,14 @@ static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
|
|||||||
char llbuff[21];
|
char llbuff[21];
|
||||||
my_off_t old_off = my_b_tell(file);
|
my_off_t old_off = my_b_tell(file);
|
||||||
|
|
||||||
Log_event* ev = Log_event::read_log_event(file, description_event);
|
Log_event* ev = Log_event::read_log_event(file, glob_description_event);
|
||||||
if (!ev)
|
if (!ev)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
if binlog wasn't closed properly ("in use" flag is set) don't complain
|
if binlog wasn't closed properly ("in use" flag is set) don't complain
|
||||||
about a corruption, but treat it as EOF and move to the next binlog.
|
about a corruption, but treat it as EOF and move to the next binlog.
|
||||||
*/
|
*/
|
||||||
if (description_event->flags & LOG_EVENT_BINLOG_IN_USE_F)
|
if (glob_description_event->flags & LOG_EVENT_BINLOG_IN_USE_F)
|
||||||
file->error= 0;
|
file->error= 0;
|
||||||
else if (file->error)
|
else if (file->error)
|
||||||
{
|
{
|
||||||
@ -1410,7 +1414,7 @@ end:
|
|||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
my_close(fd, MYF(MY_WME));
|
my_close(fd, MYF(MY_WME));
|
||||||
end_io_cache(file);
|
end_io_cache(file);
|
||||||
delete description_event;
|
delete glob_description_event;
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ static char compatible_mode_normal_str[255];
|
|||||||
static ulong opt_compatible_mode= 0;
|
static ulong opt_compatible_mode= 0;
|
||||||
#define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1
|
#define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1
|
||||||
#define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2
|
#define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2
|
||||||
static uint opt_mysql_port= 0, err_len= 0, opt_master_data;
|
static uint opt_mysql_port= 0, opt_master_data;
|
||||||
static my_string opt_mysql_unix_port=0;
|
static my_string opt_mysql_unix_port=0;
|
||||||
static int first_error=0;
|
static int first_error=0;
|
||||||
static DYNAMIC_STRING extended_row;
|
static DYNAMIC_STRING extended_row;
|
||||||
@ -723,6 +723,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
char *end= compatible_mode_normal_str;
|
char *end= compatible_mode_normal_str;
|
||||||
int i;
|
int i;
|
||||||
ulong mode;
|
ulong mode;
|
||||||
|
uint err_len;
|
||||||
|
|
||||||
opt_quoted= 1;
|
opt_quoted= 1;
|
||||||
opt_set_charset= 0;
|
opt_set_charset= 0;
|
||||||
@ -860,11 +861,11 @@ static int get_options(int *argc, char ***argv)
|
|||||||
/*
|
/*
|
||||||
** DB_error -- prints mysql error message and exits the program.
|
** DB_error -- prints mysql error message and exits the program.
|
||||||
*/
|
*/
|
||||||
static void DB_error(MYSQL *mysql, const char *when)
|
static void DB_error(MYSQL *mysql_arg, const char *when)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("DB_error");
|
DBUG_ENTER("DB_error");
|
||||||
fprintf(stderr, "%s: Got error: %d: %s %s\n", my_progname,
|
fprintf(stderr, "%s: Got error: %d: %s %s\n", my_progname,
|
||||||
mysql_errno(mysql), mysql_error(mysql), when);
|
mysql_errno(mysql_arg), mysql_error(mysql_arg), when);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
safe_exit(EX_MYSQLERR);
|
safe_exit(EX_MYSQLERR);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
@ -1192,7 +1193,7 @@ static void print_quoted_xml(FILE *xml_file, const char *str, ulong len)
|
|||||||
..., attribute_name_n, attribute_value_n, NullS)
|
..., attribute_name_n, attribute_value_n, NullS)
|
||||||
xml_file - output file
|
xml_file - output file
|
||||||
sbeg - line beginning
|
sbeg - line beginning
|
||||||
send - line ending
|
line_end - line ending
|
||||||
tag_name - XML tag name.
|
tag_name - XML tag name.
|
||||||
first_attribute_name - tag and first attribute
|
first_attribute_name - tag and first attribute
|
||||||
first_attribute_value - (Implied) value of first attribute
|
first_attribute_value - (Implied) value of first attribute
|
||||||
@ -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.
|
All attribute_value arguments will be quoted before output.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void print_xml_tag(FILE * xml_file, const char* sbeg, const char* send,
|
static void print_xml_tag(FILE * xml_file, const char* sbeg,
|
||||||
|
const char* line_end,
|
||||||
const char* tag_name,
|
const char* tag_name,
|
||||||
const char* first_attribute_name, ...)
|
const char* first_attribute_name, ...)
|
||||||
{
|
{
|
||||||
@ -1242,7 +1244,7 @@ static void print_xml_tag(FILE * xml_file, const char* sbeg, const char* send,
|
|||||||
va_end(arg_list);
|
va_end(arg_list);
|
||||||
|
|
||||||
fputc('>', xml_file);
|
fputc('>', xml_file);
|
||||||
fputs(send, xml_file);
|
fputs(line_end, xml_file);
|
||||||
check_io(xml_file);
|
check_io(xml_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1256,7 +1258,7 @@ static void print_xml_tag(FILE * xml_file, const char* sbeg, const char* send,
|
|||||||
sbeg - line beginning
|
sbeg - line beginning
|
||||||
stag_atr - tag and attribute
|
stag_atr - tag and attribute
|
||||||
sval - value of attribute
|
sval - value of attribute
|
||||||
send - line ending
|
line_end - line ending
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Print tag with one attribute to the xml_file. Format is:
|
Print tag with one attribute to the xml_file. Format is:
|
||||||
@ -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,
|
static void print_xml_null_tag(FILE * xml_file, const char* sbeg,
|
||||||
const char* stag_atr, const char* sval,
|
const char* stag_atr, const char* sval,
|
||||||
const char* send)
|
const char* line_end)
|
||||||
{
|
{
|
||||||
fputs(sbeg, xml_file);
|
fputs(sbeg, xml_file);
|
||||||
fputs("<", xml_file);
|
fputs("<", xml_file);
|
||||||
@ -1276,7 +1278,7 @@ static void print_xml_null_tag(FILE * xml_file, const char* sbeg,
|
|||||||
fputs("\"", xml_file);
|
fputs("\"", xml_file);
|
||||||
print_quoted_xml(xml_file, sval, strlen(sval));
|
print_quoted_xml(xml_file, sval, strlen(sval));
|
||||||
fputs("\" xsi:nil=\"true\" />", xml_file);
|
fputs("\" xsi:nil=\"true\" />", xml_file);
|
||||||
fputs(send, xml_file);
|
fputs(line_end, xml_file);
|
||||||
check_io(xml_file);
|
check_io(xml_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,10 +84,10 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int record= 0, opt_sleep= -1;
|
static int record= 0, opt_sleep= -1;
|
||||||
static char *db= 0, *pass= 0;
|
static char *opt_db= 0, *opt_pass= 0;
|
||||||
const char *user= 0, *host= 0, *unix_sock= 0, *opt_basedir= "./";
|
const char *opt_user= 0, *opt_host= 0, *unix_sock= 0, *opt_basedir= "./";
|
||||||
const char *opt_include= 0, *opt_charsets_dir;
|
const char *opt_include= 0, *opt_charsets_dir;
|
||||||
static int port= 0;
|
static int opt_port= 0;
|
||||||
static int opt_max_connect_retries;
|
static int opt_max_connect_retries;
|
||||||
static my_bool opt_compress= 0, silent= 0, verbose= 0;
|
static my_bool opt_compress= 0, silent= 0, verbose= 0;
|
||||||
static my_bool tty_password= 0;
|
static my_bool tty_password= 0;
|
||||||
@ -609,15 +609,14 @@ void check_command_args(struct st_command *command,
|
|||||||
int i;
|
int i;
|
||||||
const char *ptr= arguments;
|
const char *ptr= arguments;
|
||||||
const char *start;
|
const char *start;
|
||||||
|
|
||||||
DBUG_ENTER("check_command_args");
|
DBUG_ENTER("check_command_args");
|
||||||
DBUG_PRINT("enter", ("num_args: %d", num_args));
|
DBUG_PRINT("enter", ("num_args: %d", num_args));
|
||||||
|
|
||||||
for (i= 0; i < num_args; i++)
|
for (i= 0; i < num_args; i++)
|
||||||
{
|
{
|
||||||
const struct command_arg *arg= &args[i];
|
const struct command_arg *arg= &args[i];
|
||||||
|
|
||||||
switch (arg->type)
|
switch (arg->type) {
|
||||||
{
|
|
||||||
/* A string */
|
/* A string */
|
||||||
case ARG_STRING:
|
case ARG_STRING:
|
||||||
/* Skip leading spaces */
|
/* Skip leading spaces */
|
||||||
@ -782,7 +781,7 @@ void free_used_memory()
|
|||||||
dynstr_free(&ds_progress);
|
dynstr_free(&ds_progress);
|
||||||
dynstr_free(&ds_warning_messages);
|
dynstr_free(&ds_warning_messages);
|
||||||
free_all_replace();
|
free_all_replace();
|
||||||
my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
|
my_free(opt_pass,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
free_defaults(default_argv);
|
free_defaults(default_argv);
|
||||||
free_re();
|
free_re();
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
@ -1343,7 +1342,6 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
|
|||||||
DYNAMIC_STRING result;
|
DYNAMIC_STRING result;
|
||||||
uint i;
|
uint i;
|
||||||
ulong *lengths;
|
ulong *lengths;
|
||||||
char *end;
|
|
||||||
#ifdef NOT_YET
|
#ifdef NOT_YET
|
||||||
MYSQL_FIELD *fields= mysql_fetch_fields(res);
|
MYSQL_FIELD *fields= mysql_fetch_fields(res);
|
||||||
#endif
|
#endif
|
||||||
@ -2128,6 +2126,7 @@ void do_perl(struct st_command *command)
|
|||||||
int do_echo(struct st_command *command)
|
int do_echo(struct st_command *command)
|
||||||
{
|
{
|
||||||
DYNAMIC_STRING ds_echo;
|
DYNAMIC_STRING ds_echo;
|
||||||
|
DBUG_ENTER("do_echo");
|
||||||
|
|
||||||
init_dynamic_string(&ds_echo, "", command->query_len, 256);
|
init_dynamic_string(&ds_echo, "", command->query_len, 256);
|
||||||
do_eval(&ds_echo, command->first_argument, command->end, FALSE);
|
do_eval(&ds_echo, command->first_argument, command->end, FALSE);
|
||||||
@ -2135,7 +2134,7 @@ int do_echo(struct st_command *command)
|
|||||||
dynstr_append_mem(&ds_res, "\n", 1);
|
dynstr_append_mem(&ds_res, "\n", 1);
|
||||||
dynstr_free(&ds_echo);
|
dynstr_free(&ds_echo);
|
||||||
command->last_argument= command->end;
|
command->last_argument= command->end;
|
||||||
return(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2431,7 +2430,6 @@ void do_let(struct st_command *command)
|
|||||||
char *p= command->first_argument;
|
char *p= command->first_argument;
|
||||||
char *var_name, *var_name_end;
|
char *var_name, *var_name_end;
|
||||||
DYNAMIC_STRING let_rhs_expr;
|
DYNAMIC_STRING let_rhs_expr;
|
||||||
|
|
||||||
DBUG_ENTER("do_let");
|
DBUG_ENTER("do_let");
|
||||||
|
|
||||||
init_dynamic_string(&let_rhs_expr, "", 512, 2048);
|
init_dynamic_string(&let_rhs_expr, "", 512, 2048);
|
||||||
@ -3111,7 +3109,7 @@ int connect_n_handle_errors(struct st_command *command,
|
|||||||
|
|
||||||
void do_connect(struct st_command *command)
|
void do_connect(struct st_command *command)
|
||||||
{
|
{
|
||||||
int con_port= port;
|
int con_port= opt_port;
|
||||||
char *con_options;
|
char *con_options;
|
||||||
bool con_ssl= 0, con_compress= 0;
|
bool con_ssl= 0, con_compress= 0;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
@ -3247,13 +3245,12 @@ void do_connect(struct st_command *command)
|
|||||||
|
|
||||||
/* Use default db name */
|
/* Use default db name */
|
||||||
if (ds_database.length == 0)
|
if (ds_database.length == 0)
|
||||||
dynstr_set(&ds_database, db);
|
dynstr_set(&ds_database, opt_db);
|
||||||
|
|
||||||
/* Special database to allow one to connect without a database name */
|
/* Special database to allow one to connect without a database name */
|
||||||
if (ds_database.length && !strcmp(ds_database.str,"*NO-ONE*"))
|
if (ds_database.length && !strcmp(ds_database.str,"*NO-ONE*"))
|
||||||
dynstr_set(&ds_database, "");
|
dynstr_set(&ds_database, "");
|
||||||
|
|
||||||
|
|
||||||
if (connect_n_handle_errors(command, &next_con->mysql,
|
if (connect_n_handle_errors(command, &next_con->mysql,
|
||||||
ds_host.str,ds_user.str,
|
ds_host.str,ds_user.str,
|
||||||
ds_password.str, ds_database.str,
|
ds_password.str, ds_database.str,
|
||||||
@ -3677,7 +3674,7 @@ int read_line(char *buf, int size)
|
|||||||
void convert_to_format_v1(char* query)
|
void convert_to_format_v1(char* query)
|
||||||
{
|
{
|
||||||
int last_c_was_quote= 0;
|
int last_c_was_quote= 0;
|
||||||
char *p= query, *write= query;
|
char *p= query, *to= query;
|
||||||
char *end= strend(query);
|
char *end= strend(query);
|
||||||
char last_c;
|
char last_c;
|
||||||
|
|
||||||
@ -3685,7 +3682,7 @@ void convert_to_format_v1(char* query)
|
|||||||
{
|
{
|
||||||
if (*p == '\n' && !last_c_was_quote)
|
if (*p == '\n' && !last_c_was_quote)
|
||||||
{
|
{
|
||||||
*write++ = *p++; /* Save the newline */
|
*to++ = *p++; /* Save the newline */
|
||||||
|
|
||||||
/* Skip any spaces on next line */
|
/* Skip any spaces on next line */
|
||||||
while (*p && my_isspace(charset_info, *p))
|
while (*p && my_isspace(charset_info, *p))
|
||||||
@ -3696,19 +3693,19 @@ void convert_to_format_v1(char* query)
|
|||||||
else if (*p == '\'' || *p == '"' || *p == '`')
|
else if (*p == '\'' || *p == '"' || *p == '`')
|
||||||
{
|
{
|
||||||
last_c= *p;
|
last_c= *p;
|
||||||
*write++ = *p++;
|
*to++ = *p++;
|
||||||
|
|
||||||
/* Copy anything until the next quote of same type */
|
/* Copy anything until the next quote of same type */
|
||||||
while (*p && *p != last_c)
|
while (*p && *p != last_c)
|
||||||
*write++ = *p++;
|
*to++ = *p++;
|
||||||
|
|
||||||
*write++ = *p++;
|
*to++ = *p++;
|
||||||
|
|
||||||
last_c_was_quote= 1;
|
last_c_was_quote= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*write++ = *p++;
|
*to++ = *p++;
|
||||||
last_c_was_quote= 0;
|
last_c_was_quote= 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3833,12 +3830,10 @@ void check_eol_junk(const char *eol)
|
|||||||
Converts lines returned by read_line into a command, this involves
|
Converts lines returned by read_line into a command, this involves
|
||||||
parsing the first word in the read line to find the command type.
|
parsing the first word in the read line to find the command type.
|
||||||
|
|
||||||
|
|
||||||
A -- comment may contain a valid query as the first word after the
|
A -- comment may contain a valid query as the first word after the
|
||||||
comment start. Thus it's always checked to see if that is the case.
|
comment start. Thus it's always checked to see if that is the case.
|
||||||
The advantage with this approach is to be able to execute commands
|
The advantage with this approach is to be able to execute commands
|
||||||
terminated by new line '\n' regardless how many "delimiter" it contain.
|
terminated by new line '\n' regardless how many "delimiter" it contain.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MAX_QUERY (256*1024) /* 256K -- a test in sp-big is >128K */
|
#define MAX_QUERY (256*1024) /* 256K -- a test in sp-big is >128K */
|
||||||
@ -3924,7 +3919,7 @@ static struct my_option my_long_options[] =
|
|||||||
{"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statements.",
|
{"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statements.",
|
||||||
(gptr*) &cursor_protocol, (gptr*) &cursor_protocol, 0,
|
(gptr*) &cursor_protocol, (gptr*) &cursor_protocol, 0,
|
||||||
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"database", 'D', "Database to use.", (gptr*) &db, (gptr*) &db, 0,
|
{"database", 'D', "Database to use.", (gptr*) &opt_db, (gptr*) &opt_db, 0,
|
||||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
#ifdef DBUG_OFF
|
#ifdef DBUG_OFF
|
||||||
{"debug", '#', "This is a non-debug version. Catch this and exit",
|
{"debug", '#', "This is a non-debug version. Catch this and exit",
|
||||||
@ -3933,7 +3928,7 @@ static struct my_option my_long_options[] =
|
|||||||
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
|
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
|
||||||
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
#endif
|
#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},
|
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"include", 'i', "Include SQL before each test case.", (gptr*) &opt_include,
|
{"include", 'i', "Include SQL before each test case.", (gptr*) &opt_include,
|
||||||
(gptr*) &opt_include, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &opt_include, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
@ -3947,8 +3942,8 @@ static struct my_option my_long_options[] =
|
|||||||
GET_INT, REQUIRED_ARG, 500, 1, 10000, 0, 0, 0},
|
GET_INT, REQUIRED_ARG, 500, 1, 10000, 0, 0, 0},
|
||||||
{"password", 'p', "Password to use when connecting to server.",
|
{"password", 'p', "Password to use when connecting to server.",
|
||||||
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"port", 'P', "Port number to use for connection.", (gptr*) &port,
|
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_port,
|
||||||
(gptr*) &port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &opt_port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"ps-protocol", OPT_PS_PROTOCOL, "Use prepared statements protocol for communication",
|
{"ps-protocol", OPT_PS_PROTOCOL, "Use prepared statements protocol for communication",
|
||||||
(gptr*) &ps_protocol, (gptr*) &ps_protocol, 0,
|
(gptr*) &ps_protocol, (gptr*) &ps_protocol, 0,
|
||||||
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
@ -3984,8 +3979,8 @@ static struct my_option my_long_options[] =
|
|||||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"tmpdir", 't', "Temporary directory where sockets are put.",
|
{"tmpdir", 't', "Temporary directory where sockets are put.",
|
||||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"user", 'u', "User for login.", (gptr*) &user, (gptr*) &user, 0, GET_STR,
|
{"user", 'u', "User for login.", (gptr*) &opt_user, (gptr*) &opt_user, 0,
|
||||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"verbose", 'v', "Write more.", (gptr*) &verbose, (gptr*) &verbose, 0,
|
{"verbose", 'v', "Write more.", (gptr*) &verbose, (gptr*) &verbose, 0,
|
||||||
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"version", 'V', "Output version information and exit.",
|
{"version", 'V', "Output version information and exit.",
|
||||||
@ -4112,8 +4107,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
case 'p':
|
case 'p':
|
||||||
if (argument)
|
if (argument)
|
||||||
{
|
{
|
||||||
my_free(pass, MYF(MY_ALLOW_ZERO_PTR));
|
my_free(opt_pass, MYF(MY_ALLOW_ZERO_PTR));
|
||||||
pass= my_strdup(argument, MYF(MY_FAE));
|
opt_pass= my_strdup(argument, MYF(MY_FAE));
|
||||||
while (*argument) *argument++= 'x'; /* Destroy argument */
|
while (*argument) *argument++= 'x'; /* Destroy argument */
|
||||||
tty_password= 0;
|
tty_password= 0;
|
||||||
}
|
}
|
||||||
@ -4150,7 +4145,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
exit(0);
|
exit(0);
|
||||||
case '?':
|
case '?':
|
||||||
usage();
|
usage();
|
||||||
exit(1);
|
exit(0);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -4170,9 +4165,9 @@ int parse_args(int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
db= *argv;
|
opt_db= *argv;
|
||||||
if (tty_password)
|
if (tty_password)
|
||||||
pass=get_tty_password(NullS);
|
opt_pass= get_tty_password(NullS); /* purify tested */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -4455,13 +4450,13 @@ void append_result(DYNAMIC_STRING *ds, MYSQL_RES *res)
|
|||||||
void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
|
void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
|
||||||
MYSQL_FIELD *fields, uint num_fields)
|
MYSQL_FIELD *fields, uint num_fields)
|
||||||
{
|
{
|
||||||
MYSQL_BIND *bind;
|
MYSQL_BIND *my_bind;
|
||||||
my_bool *is_null;
|
my_bool *is_null;
|
||||||
ulong *length;
|
ulong *length;
|
||||||
uint i;
|
uint i;
|
||||||
|
|
||||||
/* Allocate array with bind structs, lengths and NULL flags */
|
/* Allocate array with bind structs, lengths and NULL flags */
|
||||||
bind= (MYSQL_BIND*) my_malloc(num_fields * sizeof(MYSQL_BIND),
|
my_bind= (MYSQL_BIND*) my_malloc(num_fields * sizeof(MYSQL_BIND),
|
||||||
MYF(MY_WME | MY_FAE | MY_ZEROFILL));
|
MYF(MY_WME | MY_FAE | MY_ZEROFILL));
|
||||||
length= (ulong*) my_malloc(num_fields * sizeof(ulong),
|
length= (ulong*) my_malloc(num_fields * sizeof(ulong),
|
||||||
MYF(MY_WME | MY_FAE));
|
MYF(MY_WME | MY_FAE));
|
||||||
@ -4472,25 +4467,25 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
|
|||||||
for (i= 0; i < num_fields; i++)
|
for (i= 0; i < num_fields; i++)
|
||||||
{
|
{
|
||||||
uint max_length= fields[i].max_length + 1;
|
uint max_length= fields[i].max_length + 1;
|
||||||
bind[i].buffer_type= MYSQL_TYPE_STRING;
|
my_bind[i].buffer_type= MYSQL_TYPE_STRING;
|
||||||
bind[i].buffer= (char *)my_malloc(max_length, MYF(MY_WME | MY_FAE));
|
my_bind[i].buffer= (char *)my_malloc(max_length, MYF(MY_WME | MY_FAE));
|
||||||
bind[i].buffer_length= max_length;
|
my_bind[i].buffer_length= max_length;
|
||||||
bind[i].is_null= &is_null[i];
|
my_bind[i].is_null= &is_null[i];
|
||||||
bind[i].length= &length[i];
|
my_bind[i].length= &length[i];
|
||||||
|
|
||||||
DBUG_PRINT("bind", ("col[%d]: buffer_type: %d, buffer_length: %lu",
|
DBUG_PRINT("bind", ("col[%d]: buffer_type: %d, buffer_length: %lu",
|
||||||
i, bind[i].buffer_type, bind[i].buffer_length));
|
i, my_bind[i].buffer_type, my_bind[i].buffer_length));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mysql_stmt_bind_result(stmt, bind))
|
if (mysql_stmt_bind_result(stmt, my_bind))
|
||||||
die("mysql_stmt_bind_result failed: %d: %s",
|
die("mysql_stmt_bind_result failed: %d: %s",
|
||||||
mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
|
mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
|
||||||
|
|
||||||
while (mysql_stmt_fetch(stmt) == 0)
|
while (mysql_stmt_fetch(stmt) == 0)
|
||||||
{
|
{
|
||||||
for (i= 0; i < num_fields; i++)
|
for (i= 0; i < num_fields; i++)
|
||||||
append_field(ds, i, &fields[i], (const char *) bind[i].buffer,
|
append_field(ds, i, &fields[i], (const char *) my_bind[i].buffer,
|
||||||
*bind[i].length, *bind[i].is_null);
|
*my_bind[i].length, *my_bind[i].is_null);
|
||||||
if (!display_result_vertically)
|
if (!display_result_vertically)
|
||||||
dynstr_append_mem(ds, "\n", 1);
|
dynstr_append_mem(ds, "\n", 1);
|
||||||
}
|
}
|
||||||
@ -4502,10 +4497,10 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
|
|||||||
for (i= 0; i < num_fields; i++)
|
for (i= 0; i < num_fields; i++)
|
||||||
{
|
{
|
||||||
/* Free data for output */
|
/* Free data for output */
|
||||||
my_free((gptr)bind[i].buffer, MYF(MY_WME | MY_FAE));
|
my_free((gptr)my_bind[i].buffer, MYF(MY_WME | MY_FAE));
|
||||||
}
|
}
|
||||||
/* Free array with bind structs, lengths and NULL flags */
|
/* Free array with bind structs, lengths and NULL flags */
|
||||||
my_free((gptr)bind , MYF(MY_WME | MY_FAE));
|
my_free((gptr)my_bind , MYF(MY_WME | MY_FAE));
|
||||||
my_free((gptr)length , MYF(MY_WME | MY_FAE));
|
my_free((gptr)length , MYF(MY_WME | MY_FAE));
|
||||||
my_free((gptr)is_null , MYF(MY_WME | MY_FAE));
|
my_free((gptr)is_null , MYF(MY_WME | MY_FAE));
|
||||||
}
|
}
|
||||||
@ -4642,17 +4637,14 @@ int append_warnings(DYNAMIC_STRING *ds, MYSQL* mysql)
|
|||||||
/*
|
/*
|
||||||
Run query using MySQL C API
|
Run query using MySQL C API
|
||||||
|
|
||||||
SYNPOSIS
|
SYNOPSIS
|
||||||
run_query_normal
|
run_query_normal()
|
||||||
mysql - mysql handle
|
mysql mysql handle
|
||||||
command - currrent command pointer
|
command current command pointer
|
||||||
flags -flags indicating wheter to SEND and/or REAP
|
flags flags indicating if we should SEND and/or REAP
|
||||||
query - query string to execute
|
query query string to execute
|
||||||
query_len - length query string to execute
|
query_len length query string to execute
|
||||||
ds - output buffer wherte to store result form query
|
ds output buffer where to store result form query
|
||||||
|
|
||||||
RETURN VALUE
|
|
||||||
error - function will not return
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void run_query_normal(struct st_connection *cn, struct st_command *command,
|
void run_query_normal(struct st_connection *cn, struct st_command *command,
|
||||||
@ -5177,15 +5169,14 @@ int util_query(MYSQL* org_mysql, const char* query){
|
|||||||
/*
|
/*
|
||||||
Run query
|
Run query
|
||||||
|
|
||||||
|
SYNPOSIS
|
||||||
|
run_query()
|
||||||
|
mysql mysql handle
|
||||||
|
command currrent command pointer
|
||||||
|
|
||||||
flags control the phased/stages of query execution to be performed
|
flags control the phased/stages of query execution to be performed
|
||||||
if QUERY_SEND_FLAG bit is on, the query will be sent. If QUERY_REAP_FLAG
|
if QUERY_SEND_FLAG bit is on, the query will be sent. If QUERY_REAP_FLAG
|
||||||
is on the result will be read - for regular query, both bits must be on
|
is on the result will be read - for regular query, both bits must be on
|
||||||
|
|
||||||
SYNPOSIS
|
|
||||||
run_query
|
|
||||||
mysql - mysql handle
|
|
||||||
command - currrent command pointer
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void run_query(struct st_connection *cn, struct st_command *command, int flags)
|
void run_query(struct st_connection *cn, struct st_command *command, int flags)
|
||||||
@ -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 view_created= 0, sp_created= 0;
|
||||||
my_bool complete_query= ((flags & QUERY_SEND_FLAG) &&
|
my_bool complete_query= ((flags & QUERY_SEND_FLAG) &&
|
||||||
(flags & QUERY_REAP_FLAG));
|
(flags & QUERY_REAP_FLAG));
|
||||||
|
DBUG_ENTER("run_query");
|
||||||
|
|
||||||
init_dynamic_string(&ds_warnings, NULL, 0, 256);
|
init_dynamic_string(&ds_warnings, NULL, 0, 256);
|
||||||
|
|
||||||
@ -5365,7 +5357,6 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
|
|||||||
|
|
||||||
if (command->require_file[0])
|
if (command->require_file[0])
|
||||||
{
|
{
|
||||||
|
|
||||||
/* A result file was specified for _this_ query
|
/* A result file was specified for _this_ query
|
||||||
and the output should be checked against an already
|
and the output should be checked against an already
|
||||||
existing file which has been specified using --require or --result
|
existing file which has been specified using --require or --result
|
||||||
@ -5378,6 +5369,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
|
|||||||
dynstr_free(&ds_result);
|
dynstr_free(&ds_result);
|
||||||
if (command->type == Q_EVAL)
|
if (command->type == Q_EVAL)
|
||||||
dynstr_free(&eval_query);
|
dynstr_free(&eval_query);
|
||||||
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
@ -5705,8 +5697,8 @@ int main(int argc, char **argv)
|
|||||||
if (!(cur_con->name = my_strdup("default", MYF(MY_WME))))
|
if (!(cur_con->name = my_strdup("default", MYF(MY_WME))))
|
||||||
die("Out of memory");
|
die("Out of memory");
|
||||||
|
|
||||||
safe_connect(&cur_con->mysql, cur_con->name, host, user, pass,
|
safe_connect(&cur_con->mysql, cur_con->name, opt_host, opt_user, opt_pass,
|
||||||
db, port, unix_sock);
|
opt_db, opt_port, unix_sock);
|
||||||
|
|
||||||
/* Use all time until exit if no explicit 'start_timer' */
|
/* Use all time until exit if no explicit 'start_timer' */
|
||||||
timer_start= timer_now();
|
timer_start= timer_now();
|
||||||
@ -6073,8 +6065,6 @@ int main(int argc, char **argv)
|
|||||||
if (result_file_name && ds_warning_messages.length)
|
if (result_file_name && ds_warning_messages.length)
|
||||||
dump_warning_messages();
|
dump_warning_messages();
|
||||||
|
|
||||||
dynstr_free(&ds_res);
|
|
||||||
|
|
||||||
timer_output();
|
timer_output();
|
||||||
free_used_memory();
|
free_used_memory();
|
||||||
my_end(MY_CHECK_ERROR);
|
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
|
0 No conversion needed
|
||||||
1 Either character set conversion or adding leading zeros
|
1 Either character set conversion or adding leading zeros
|
||||||
(e.g. for UCS-2) must be done
|
(e.g. for UCS-2) must be done
|
||||||
|
|
||||||
|
NOTE
|
||||||
|
to_cs may be NULL for "no conversion" if the system variable
|
||||||
|
character_set_results is NULL.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool String::needs_conversion(uint32 arg_length,
|
bool String::needs_conversion(uint32 arg_length,
|
||||||
@ -255,7 +259,8 @@ bool String::needs_conversion(uint32 arg_length,
|
|||||||
uint32 *offset)
|
uint32 *offset)
|
||||||
{
|
{
|
||||||
*offset= 0;
|
*offset= 0;
|
||||||
if ((to_cs == &my_charset_bin) ||
|
if (!to_cs ||
|
||||||
|
(to_cs == &my_charset_bin) ||
|
||||||
(to_cs == from_cs) ||
|
(to_cs == from_cs) ||
|
||||||
my_charset_same(from_cs, to_cs) ||
|
my_charset_same(from_cs, to_cs) ||
|
||||||
((from_cs == &my_charset_bin) &&
|
((from_cs == &my_charset_bin) &&
|
||||||
@ -612,27 +617,26 @@ skip:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** replace substring with string
|
Replace substring with string
|
||||||
** If wrong parameter or not enough memory, do nothing
|
If wrong parameter or not enough memory, do nothing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
bool String::replace(uint32 offset,uint32 arg_length,const String &to)
|
bool String::replace(uint32 offset,uint32 arg_length,const String &to)
|
||||||
{
|
{
|
||||||
return replace(offset,arg_length,to.ptr(),to.length());
|
return replace(offset,arg_length,to.ptr(),to.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool String::replace(uint32 offset,uint32 arg_length,
|
bool String::replace(uint32 offset,uint32 arg_length,
|
||||||
const char *to,uint32 length)
|
const char *to, uint32 to_length)
|
||||||
{
|
{
|
||||||
long diff = (long) length-(long) arg_length;
|
long diff = (long) to_length-(long) arg_length;
|
||||||
if (offset+arg_length <= str_length)
|
if (offset+arg_length <= str_length)
|
||||||
{
|
{
|
||||||
if (diff < 0)
|
if (diff < 0)
|
||||||
{
|
{
|
||||||
if (length)
|
if (to_length)
|
||||||
memcpy(Ptr+offset,to,length);
|
memcpy(Ptr+offset,to,to_length);
|
||||||
bmove(Ptr+offset+length,Ptr+offset+arg_length,
|
bmove(Ptr+offset+to_length,Ptr+offset+arg_length,
|
||||||
str_length-offset-arg_length);
|
str_length-offset-arg_length);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -644,8 +648,8 @@ bool String::replace(uint32 offset,uint32 arg_length,
|
|||||||
bmove_upp(Ptr+str_length+diff,Ptr+str_length,
|
bmove_upp(Ptr+str_length+diff,Ptr+str_length,
|
||||||
str_length-offset-arg_length);
|
str_length-offset-arg_length);
|
||||||
}
|
}
|
||||||
if (length)
|
if (to_length)
|
||||||
memcpy(Ptr+offset,to,length);
|
memcpy(Ptr+offset,to,to_length);
|
||||||
}
|
}
|
||||||
str_length+=(uint32) diff;
|
str_length+=(uint32) diff;
|
||||||
}
|
}
|
||||||
@ -818,8 +822,18 @@ copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
|
|||||||
from++;
|
from++;
|
||||||
wc= '?';
|
wc= '?';
|
||||||
}
|
}
|
||||||
|
else if (cnvres > MY_CS_TOOSMALL)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
A correct multibyte sequence detected
|
||||||
|
But it doesn't have Unicode mapping.
|
||||||
|
*/
|
||||||
|
error_count++;
|
||||||
|
from+= (-cnvres);
|
||||||
|
wc= '?';
|
||||||
|
}
|
||||||
else
|
else
|
||||||
break; // Impossible char.
|
break; // Not enough characters
|
||||||
|
|
||||||
outp:
|
outp:
|
||||||
if ((cnvres= (*wc_mb)(to_cs, wc, (uchar*) to, to_end)) > 0)
|
if ((cnvres= (*wc_mb)(to_cs, wc, (uchar*) to, to_end)) > 0)
|
||||||
@ -847,22 +861,22 @@ void String::print(String *str)
|
|||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case '\\':
|
case '\\':
|
||||||
str->append("\\\\", 2);
|
str->append(STRING_WITH_LEN("\\\\"));
|
||||||
break;
|
break;
|
||||||
case '\0':
|
case '\0':
|
||||||
str->append("\\0", 2);
|
str->append(STRING_WITH_LEN("\\0"));
|
||||||
break;
|
break;
|
||||||
case '\'':
|
case '\'':
|
||||||
str->append("\\'", 2);
|
str->append(STRING_WITH_LEN("\\'"));
|
||||||
break;
|
break;
|
||||||
case '\n':
|
case '\n':
|
||||||
str->append("\\n", 2);
|
str->append(STRING_WITH_LEN("\\n"));
|
||||||
break;
|
break;
|
||||||
case '\r':
|
case '\r':
|
||||||
str->append("\\r", 2);
|
str->append(STRING_WITH_LEN("\\r"));
|
||||||
break;
|
break;
|
||||||
case 26: //Ctrl-Z
|
case 26: //Ctrl-Z
|
||||||
str->append("\\z", 2);
|
str->append(STRING_WITH_LEN("\\z"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
str->append(c);
|
str->append(c);
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
#define NOT_FIXED_DEC 31
|
#define NOT_FIXED_DEC 31
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define STRING_WITH_LEN(X) ((const char*) X), ((uint) (sizeof(X) - 1))
|
||||||
|
|
||||||
class String;
|
class String;
|
||||||
int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
|
int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
|
||||||
String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
|
String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
|
||||||
@ -76,13 +78,15 @@ public:
|
|||||||
{ /* never called */ }
|
{ /* never called */ }
|
||||||
~String() { free(); }
|
~String() { free(); }
|
||||||
|
|
||||||
inline void set_charset(CHARSET_INFO *charset) { str_charset= charset; }
|
inline void set_charset(CHARSET_INFO *charset_arg)
|
||||||
|
{ str_charset= charset_arg; }
|
||||||
inline CHARSET_INFO *charset() const { return str_charset; }
|
inline CHARSET_INFO *charset() const { return str_charset; }
|
||||||
inline uint32 length() const { return str_length;}
|
inline uint32 length() const { return str_length;}
|
||||||
inline uint32 alloced_length() const { return Alloced_length;}
|
inline uint32 alloced_length() const { return Alloced_length;}
|
||||||
inline char& operator [] (uint32 i) const { return Ptr[i]; }
|
inline char& operator [] (uint32 i) const { return Ptr[i]; }
|
||||||
inline void length(uint32 len) { str_length=len ; }
|
inline void length(uint32 len) { str_length=len ; }
|
||||||
inline bool is_empty() { return (str_length == 0); }
|
inline bool is_empty() { return (str_length == 0); }
|
||||||
|
inline void mark_as_const() { Alloced_length= 0;}
|
||||||
inline const char *ptr() const { return Ptr; }
|
inline const char *ptr() const { return Ptr; }
|
||||||
inline char *c_ptr()
|
inline char *c_ptr()
|
||||||
{
|
{
|
||||||
|
@ -426,7 +426,7 @@ rl_redisplay ()
|
|||||||
#if defined (HANDLE_MULTIBYTE)
|
#if defined (HANDLE_MULTIBYTE)
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
size_t wc_bytes;
|
size_t wc_bytes;
|
||||||
int wc_width;
|
int wc_width= 0;
|
||||||
mbstate_t ps;
|
mbstate_t ps;
|
||||||
int _rl_wrapped_multicolumn = 0;
|
int _rl_wrapped_multicolumn = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -560,12 +560,12 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
|
|||||||
#if defined (HANDLE_MULTIBYTE)
|
#if defined (HANDLE_MULTIBYTE)
|
||||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||||
{
|
{
|
||||||
int c, l;
|
int chr, l;
|
||||||
l = _rl_find_prev_mbchar (string, i, MB_FIND_ANY);
|
l = _rl_find_prev_mbchar (string, i, MB_FIND_ANY);
|
||||||
c = string[l];
|
chr = string[l];
|
||||||
/* XXX - original patch had i - 1 ??? If i == 0 it would fail. */
|
/* XXX - original patch had i - 1 ??? If i == 0 it would fail. */
|
||||||
if (i && (c == '\'' || c == '"'))
|
if (i && (chr == '\'' || chr == '"'))
|
||||||
quoted_search_delimiter = c;
|
quoted_search_delimiter = chr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* HANDLE_MULTIBYTE */
|
#endif /* HANDLE_MULTIBYTE */
|
||||||
|
@ -529,17 +529,17 @@ _rl_read_mbchar (mbchar, size)
|
|||||||
may be FIRST. Used by the search functions, among others. Very similar
|
may be FIRST. Used by the search functions, among others. Very similar
|
||||||
to _rl_read_mbchar. */
|
to _rl_read_mbchar. */
|
||||||
int
|
int
|
||||||
_rl_read_mbstring (first, mb, mblen)
|
_rl_read_mbstring (first, mb, mb_len)
|
||||||
int first;
|
int first;
|
||||||
char *mb;
|
char *mb;
|
||||||
int mblen;
|
int mb_len;
|
||||||
{
|
{
|
||||||
int i, c;
|
int i, c;
|
||||||
mbstate_t ps;
|
mbstate_t ps;
|
||||||
|
|
||||||
c = first;
|
c = first;
|
||||||
memset (mb, 0, mblen);
|
memset (mb, 0, mb_len);
|
||||||
for (i = 0; i < mblen; i++)
|
for (i = 0; i < mb_len; i++)
|
||||||
{
|
{
|
||||||
mb[i] = (char)c;
|
mb[i] = (char)c;
|
||||||
memset (&ps, 0, sizeof (mbstate_t));
|
memset (&ps, 0, sizeof (mbstate_t));
|
||||||
|
@ -1002,12 +1002,12 @@ _rl_rubout_char (count, key)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int orig_point;
|
int orig_point2;
|
||||||
|
|
||||||
orig_point = rl_point;
|
orig_point2 = rl_point;
|
||||||
rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
|
rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
|
||||||
c = rl_line_buffer[rl_point];
|
c = rl_line_buffer[rl_point];
|
||||||
rl_delete_text (rl_point, orig_point);
|
rl_delete_text (rl_point, orig_point2);
|
||||||
}
|
}
|
||||||
#endif /* HANDLE_MULTIBYTE */
|
#endif /* HANDLE_MULTIBYTE */
|
||||||
|
|
||||||
|
@ -672,7 +672,7 @@ _rl_vi_change_mbchar_case (count)
|
|||||||
{
|
{
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
char mb[MB_LEN_MAX+1];
|
char mb[MB_LEN_MAX+1];
|
||||||
int mblen;
|
int local_mblen;
|
||||||
mbstate_t ps;
|
mbstate_t ps;
|
||||||
|
|
||||||
memset (&ps, 0, sizeof (mbstate_t));
|
memset (&ps, 0, sizeof (mbstate_t));
|
||||||
@ -695,9 +695,9 @@ _rl_vi_change_mbchar_case (count)
|
|||||||
/* Vi is kind of strange here. */
|
/* Vi is kind of strange here. */
|
||||||
if (wc)
|
if (wc)
|
||||||
{
|
{
|
||||||
mblen = wcrtomb (mb, wc, &ps);
|
local_mblen = wcrtomb (mb, wc, &ps);
|
||||||
if (mblen >= 0)
|
if (local_mblen >= 0)
|
||||||
mb[mblen] = '\0';
|
mb[local_mblen] = '\0';
|
||||||
rl_begin_undo_group ();
|
rl_begin_undo_group ();
|
||||||
rl_delete (1, 0);
|
rl_delete (1, 0);
|
||||||
rl_insert_text (mb);
|
rl_insert_text (mb);
|
||||||
|
@ -1090,7 +1090,7 @@ case $SYSTEM_TYPE in
|
|||||||
*darwin6*)
|
*darwin6*)
|
||||||
if test "$ac_cv_prog_gcc" = "yes"
|
if test "$ac_cv_prog_gcc" = "yes"
|
||||||
then
|
then
|
||||||
FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
|
FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH -DDONT_DECLARE_CXA_PURE_VIRTUAL "
|
||||||
CFLAGS="$CFLAGS $FLAGS"
|
CFLAGS="$CFLAGS $FLAGS"
|
||||||
CXXFLAGS="$CXXFLAGS $FLAGS"
|
CXXFLAGS="$CXXFLAGS $FLAGS"
|
||||||
MAX_C_OPTIMIZE="-O"
|
MAX_C_OPTIMIZE="-O"
|
||||||
|
@ -309,7 +309,7 @@ FILE *inf;
|
|||||||
unsigned long fn_ssz;
|
unsigned long fn_ssz;
|
||||||
unsigned long lastuse;
|
unsigned long lastuse;
|
||||||
unsigned int pos;
|
unsigned int pos;
|
||||||
unsigned long time;
|
unsigned long local_time;
|
||||||
unsigned int oldpos;
|
unsigned int oldpos;
|
||||||
unsigned long oldtime;
|
unsigned long oldtime;
|
||||||
unsigned long oldchild;
|
unsigned long oldchild;
|
||||||
@ -335,15 +335,15 @@ FILE *inf;
|
|||||||
*/
|
*/
|
||||||
while (pop (&oldpos, &oldtime, &oldchild)) {
|
while (pop (&oldpos, &oldtime, &oldchild)) {
|
||||||
DBUG_PRINT ("popped", ("%lu %lu", oldtime, oldchild));
|
DBUG_PRINT ("popped", ("%lu %lu", oldtime, oldchild));
|
||||||
time = fn_time - oldtime;
|
local_time = fn_time - oldtime;
|
||||||
t = top ();
|
t = top ();
|
||||||
t -> children += time;
|
t -> children += local_time;
|
||||||
DBUG_PRINT ("update", ("%s", modules[t -> pos].name));
|
DBUG_PRINT ("update", ("%s", modules[t -> pos].name));
|
||||||
DBUG_PRINT ("update", ("%lu", t -> children));
|
DBUG_PRINT ("update", ("%lu", t -> children));
|
||||||
time -= oldchild;
|
local_time -= oldchild;
|
||||||
modules[oldpos].m_time += time;
|
modules[oldpos].m_time += local_time;
|
||||||
modules[oldpos].m_calls++;
|
modules[oldpos].m_calls++;
|
||||||
tot_time += time;
|
tot_time += local_time;
|
||||||
tot_calls++;
|
tot_calls++;
|
||||||
if (pos == oldpos) {
|
if (pos == oldpos) {
|
||||||
goto next_line; /* Should be a break2 */
|
goto next_line; /* Should be a break2 */
|
||||||
@ -355,11 +355,11 @@ FILE *inf;
|
|||||||
* it so that it works the next time too.
|
* it so that it works the next time too.
|
||||||
*/
|
*/
|
||||||
t = top ();
|
t = top ();
|
||||||
time = fn_time - t -> time - t -> children;
|
local_time = fn_time - t -> time - t -> children;
|
||||||
t -> time = fn_time; t -> children = 0;
|
t -> time = fn_time; t -> children = 0;
|
||||||
modules[pos].m_time += time;
|
modules[pos].m_time += local_time;
|
||||||
modules[pos].m_calls++;
|
modules[pos].m_calls++;
|
||||||
tot_time += time;
|
tot_time += local_time;
|
||||||
tot_calls++;
|
tot_calls++;
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
@ -405,13 +405,13 @@ FILE *inf;
|
|||||||
* time of fn_time.
|
* time of fn_time.
|
||||||
*/
|
*/
|
||||||
while (pop (&oldpos,&oldtime,&oldchild)) {
|
while (pop (&oldpos,&oldtime,&oldchild)) {
|
||||||
time = fn_time - oldtime;
|
local_time = fn_time - oldtime;
|
||||||
t = top ();
|
t = top ();
|
||||||
t -> children += time;
|
t -> children += local_time;
|
||||||
time -= oldchild;
|
local_time -= oldchild;
|
||||||
modules[oldpos].m_time += time;
|
modules[oldpos].m_time += local_time;
|
||||||
modules[oldpos].m_calls++;
|
modules[oldpos].m_calls++;
|
||||||
tot_time += time;
|
tot_time += local_time;
|
||||||
tot_calls++;
|
tot_calls++;
|
||||||
}
|
}
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
@ -472,17 +472,17 @@ unsigned long int *called, *timed;
|
|||||||
{
|
{
|
||||||
char *name = m -> name;
|
char *name = m -> name;
|
||||||
register unsigned int calls = m -> m_calls;
|
register unsigned int calls = m -> m_calls;
|
||||||
register unsigned long time = m -> m_time;
|
register unsigned long local_time = m -> m_time;
|
||||||
register unsigned long stkuse = m -> m_stkuse;
|
register unsigned long stkuse = m -> m_stkuse;
|
||||||
unsigned int import;
|
unsigned int import;
|
||||||
double per_time = 0.0;
|
double per_time = 0.0;
|
||||||
double per_calls = 0.0;
|
double per_calls = 0.0;
|
||||||
double ms_per_call, ftime;
|
double ms_per_call, local_ftime;
|
||||||
|
|
||||||
DBUG_ENTER ("out_item");
|
DBUG_ENTER ("out_item");
|
||||||
|
|
||||||
if (tot_time > 0) {
|
if (tot_time > 0) {
|
||||||
per_time = (double) (time * 100) / (double) tot_time;
|
per_time = (double) (local_time * 100) / (double) tot_time;
|
||||||
}
|
}
|
||||||
if (tot_calls > 0) {
|
if (tot_calls > 0) {
|
||||||
per_calls = (double) (calls * 100) / (double) tot_calls;
|
per_calls = (double) (calls * 100) / (double) tot_calls;
|
||||||
@ -491,18 +491,18 @@ unsigned long int *called, *timed;
|
|||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf (outf, "%6d\t%10.2f\t%11ld\t%10.2f %10d\t%-15s\n",
|
fprintf (outf, "%6d\t%10.2f\t%11ld\t%10.2f %10d\t%-15s\n",
|
||||||
calls, per_calls, time, per_time, import, name);
|
calls, per_calls, local_time, per_time, import, name);
|
||||||
} else {
|
} else {
|
||||||
ms_per_call = time;
|
ms_per_call = local_time;
|
||||||
ms_per_call /= calls;
|
ms_per_call /= calls;
|
||||||
ftime = time;
|
local_ftime = local_time;
|
||||||
ftime /= 1000;
|
local_ftime /= 1000;
|
||||||
fprintf(outf, "%8.2f%8.3f%8u%8.3f%8.2f%8u%8lu %-s\n",
|
fprintf(outf, "%8.2f%8.3f%8u%8.3f%8.2f%8u%8lu %-s\n",
|
||||||
per_time, ftime, calls, ms_per_call, per_calls, import,
|
per_time, local_ftime, calls, ms_per_call, per_calls, import,
|
||||||
stkuse, name);
|
stkuse, name);
|
||||||
}
|
}
|
||||||
*called = calls;
|
*called = calls;
|
||||||
*timed = time;
|
*timed = local_time;
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,7 +517,7 @@ FILE *outf;
|
|||||||
register unsigned int root;
|
register unsigned int root;
|
||||||
register unsigned long int *s_calls, *s_time;
|
register unsigned long int *s_calls, *s_time;
|
||||||
{
|
{
|
||||||
unsigned long int calls, time;
|
unsigned long int calls, local_time;
|
||||||
|
|
||||||
DBUG_ENTER ("out_body");
|
DBUG_ENTER ("out_body");
|
||||||
DBUG_PRINT ("out_body", ("%lu,%lu",*s_calls,*s_time));
|
DBUG_PRINT ("out_body", ("%lu,%lu",*s_calls,*s_time));
|
||||||
@ -526,10 +526,10 @@ register unsigned long int *s_calls, *s_time;
|
|||||||
} else {
|
} else {
|
||||||
while (root != MAXPROCS) {
|
while (root != MAXPROCS) {
|
||||||
out_body (outf, s_table[root].lchild,s_calls,s_time);
|
out_body (outf, s_table[root].lchild,s_calls,s_time);
|
||||||
out_item (outf, &modules[s_table[root].pos],&calls,&time);
|
out_item (outf, &modules[s_table[root].pos],&calls,&local_time);
|
||||||
DBUG_PRINT ("out_body", ("-- %lu -- %lu --", calls, time));
|
DBUG_PRINT ("out_body", ("-- %lu -- %lu --", calls, local_time));
|
||||||
*s_calls += calls;
|
*s_calls += calls;
|
||||||
*s_time += time;
|
*s_time += local_time;
|
||||||
root = s_table[root].rchild;
|
root = s_table[root].rchild;
|
||||||
}
|
}
|
||||||
DBUG_PRINT ("out_body", ("%lu,%lu", *s_calls, *s_time));
|
DBUG_PRINT ("out_body", ("%lu,%lu", *s_calls, *s_time));
|
||||||
|
@ -48,15 +48,16 @@ static struct my_option my_long_options[] =
|
|||||||
0, 0, 0, 0, 0, 0},
|
0, 0, 0, 0, 0, 0},
|
||||||
{"defaults-extra-file", 'e',
|
{"defaults-extra-file", 'e',
|
||||||
"Read this file after the global /etc config file and before the config file in the users home directory.",
|
"Read this file after the global /etc config file and before the config file in the users home directory.",
|
||||||
(gptr*) &defaults_extra_file, (gptr*) &defaults_extra_file, 0, GET_STR,
|
(gptr*) &my_defaults_extra_file, (gptr*) &my_defaults_extra_file, 0,
|
||||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"defaults-group-suffix", 'g',
|
{"defaults-group-suffix", 'g',
|
||||||
"In addition to the given groups, read also groups with this suffix",
|
"In addition to the given groups, read also groups with this suffix",
|
||||||
(gptr*) &defaults_group_suffix, (gptr*) &defaults_group_suffix,
|
(gptr*) &my_defaults_group_suffix, (gptr*) &my_defaults_group_suffix,
|
||||||
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"extra-file", 'e',
|
{"extra-file", 'e',
|
||||||
"Synonym for --defaults-extra-file.",
|
"Synonym for --defaults-extra-file.",
|
||||||
(gptr*) &defaults_extra_file, (gptr*) &defaults_extra_file, 0, GET_STR,
|
(gptr*) &my_defaults_extra_file,
|
||||||
|
(gptr*) &my_defaults_extra_file, 0, GET_STR,
|
||||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"no-defaults", 'n', "Return an empty string (useful for scripts).",
|
{"no-defaults", 'n', "Return an empty string (useful for scripts).",
|
||||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
|
@ -49,11 +49,13 @@ const uint AUTO = 0xFEEDBEEF;
|
|||||||
// Checking Policy should implement a check function that tests whether the
|
// Checking Policy should implement a check function that tests whether the
|
||||||
// index is within the size limit of the array
|
// index is within the size limit of the array
|
||||||
struct Check {
|
struct Check {
|
||||||
|
Check() {}
|
||||||
void check(uint i, uint limit);
|
void check(uint i, uint limit);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct NoCheck {
|
struct NoCheck {
|
||||||
|
NoCheck() {}
|
||||||
void check(uint, uint);
|
void check(uint, uint);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -191,6 +193,7 @@ inline void checked_delete(T* p)
|
|||||||
// sets pointer to zero so safe for std conatiners
|
// sets pointer to zero so safe for std conatiners
|
||||||
struct del_ptr_zero
|
struct del_ptr_zero
|
||||||
{
|
{
|
||||||
|
del_ptr_zero() {}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void operator()(T*& p) const
|
void operator()(T*& p) const
|
||||||
{
|
{
|
||||||
|
@ -42,6 +42,7 @@ namespace yaSSL {
|
|||||||
// Digest policy should implement a get_digest, update, and get sizes for pad
|
// Digest policy should implement a get_digest, update, and get sizes for pad
|
||||||
// and digest
|
// and digest
|
||||||
struct Digest : public virtual_base {
|
struct Digest : public virtual_base {
|
||||||
|
Digest() {}
|
||||||
virtual void get_digest(byte*) = 0;
|
virtual void get_digest(byte*) = 0;
|
||||||
virtual void get_digest(byte*, const byte*, unsigned int) = 0;
|
virtual void get_digest(byte*, const byte*, unsigned int) = 0;
|
||||||
virtual void update(const byte*, unsigned int) = 0;
|
virtual void update(const byte*, unsigned int) = 0;
|
||||||
@ -53,6 +54,7 @@ struct Digest : public virtual_base {
|
|||||||
|
|
||||||
// For use with NULL Digests
|
// For use with NULL Digests
|
||||||
struct NO_MAC : public Digest {
|
struct NO_MAC : public Digest {
|
||||||
|
NO_MAC() {}
|
||||||
void get_digest(byte*);
|
void get_digest(byte*);
|
||||||
void get_digest(byte*, const byte*, unsigned int);
|
void get_digest(byte*, const byte*, unsigned int);
|
||||||
void update(const byte*, unsigned int);
|
void update(const byte*, unsigned int);
|
||||||
@ -177,6 +179,7 @@ private:
|
|||||||
// BulkCipher policy should implement encrypt, decrypt, get block size,
|
// BulkCipher policy should implement encrypt, decrypt, get block size,
|
||||||
// and set keys for encrypt and decrypt
|
// and set keys for encrypt and decrypt
|
||||||
struct BulkCipher : public virtual_base {
|
struct BulkCipher : public virtual_base {
|
||||||
|
BulkCipher() {}
|
||||||
virtual void encrypt(byte*, const byte*, unsigned int) = 0;
|
virtual void encrypt(byte*, const byte*, unsigned int) = 0;
|
||||||
virtual void decrypt(byte*, const byte*, unsigned int) = 0;
|
virtual void decrypt(byte*, const byte*, unsigned int) = 0;
|
||||||
virtual void set_encryptKey(const byte*, const byte* = 0) = 0;
|
virtual void set_encryptKey(const byte*, const byte* = 0) = 0;
|
||||||
@ -190,6 +193,7 @@ struct BulkCipher : public virtual_base {
|
|||||||
|
|
||||||
// For use with NULL Ciphers
|
// For use with NULL Ciphers
|
||||||
struct NO_Cipher : public BulkCipher {
|
struct NO_Cipher : public BulkCipher {
|
||||||
|
NO_Cipher() {}
|
||||||
void encrypt(byte*, const byte*, unsigned int) {}
|
void encrypt(byte*, const byte*, unsigned int) {}
|
||||||
void decrypt(byte*, const byte*, unsigned int) {}
|
void decrypt(byte*, const byte*, unsigned int) {}
|
||||||
void set_encryptKey(const byte*, const byte*) {}
|
void set_encryptKey(const byte*, const byte*) {}
|
||||||
@ -311,12 +315,14 @@ struct Auth : public virtual_base {
|
|||||||
virtual bool verify(const byte*, unsigned int, const byte*,
|
virtual bool verify(const byte*, unsigned int, const byte*,
|
||||||
unsigned int) = 0;
|
unsigned int) = 0;
|
||||||
virtual uint get_signatureLength() const = 0;
|
virtual uint get_signatureLength() const = 0;
|
||||||
|
Auth() {}
|
||||||
virtual ~Auth() {}
|
virtual ~Auth() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// For use with NULL Authentication schemes
|
// For use with NULL Authentication schemes
|
||||||
struct NO_Auth : public Auth {
|
struct NO_Auth : public Auth {
|
||||||
|
NO_Auth() {}
|
||||||
void sign(byte*, const byte*, unsigned int, const RandomPool&) {}
|
void sign(byte*, const byte*, unsigned int, const RandomPool&) {}
|
||||||
bool verify(const byte*, unsigned int, const byte*, unsigned int)
|
bool verify(const byte*, unsigned int, const byte*, unsigned int)
|
||||||
{ return true; }
|
{ return true; }
|
||||||
|
@ -64,6 +64,7 @@ struct RecordLayerHeader {
|
|||||||
|
|
||||||
// base for all messages
|
// base for all messages
|
||||||
struct Message : public virtual_base {
|
struct Message : public virtual_base {
|
||||||
|
Message() {}
|
||||||
virtual input_buffer& set(input_buffer&) =0;
|
virtual input_buffer& set(input_buffer&) =0;
|
||||||
virtual output_buffer& get(output_buffer&) const =0;
|
virtual output_buffer& get(output_buffer&) const =0;
|
||||||
|
|
||||||
@ -177,6 +178,7 @@ private:
|
|||||||
class HandShakeBase : public virtual_base {
|
class HandShakeBase : public virtual_base {
|
||||||
int length_;
|
int length_;
|
||||||
public:
|
public:
|
||||||
|
HandShakeBase() {}
|
||||||
int get_length() const;
|
int get_length() const;
|
||||||
void set_length(int);
|
void set_length(int);
|
||||||
|
|
||||||
@ -194,6 +196,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
struct HelloRequest : public HandShakeBase {
|
struct HelloRequest : public HandShakeBase {
|
||||||
|
HelloRequest() {}
|
||||||
input_buffer& set(input_buffer& in);
|
input_buffer& set(input_buffer& in);
|
||||||
output_buffer& get(output_buffer& out) const;
|
output_buffer& get(output_buffer& out) const;
|
||||||
|
|
||||||
@ -327,6 +330,7 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
struct ServerKeyBase : public virtual_base {
|
struct ServerKeyBase : public virtual_base {
|
||||||
|
ServerKeyBase() {}
|
||||||
virtual ~ServerKeyBase() {}
|
virtual ~ServerKeyBase() {}
|
||||||
virtual void build(SSL&) {}
|
virtual void build(SSL&) {}
|
||||||
virtual void read(SSL&, input_buffer&) {}
|
virtual void read(SSL&, input_buffer&) {}
|
||||||
@ -337,15 +341,21 @@ struct ServerKeyBase : public virtual_base {
|
|||||||
|
|
||||||
// Server random number for FORTEZZA KEA
|
// Server random number for FORTEZZA KEA
|
||||||
struct Fortezza_Server : public ServerKeyBase {
|
struct Fortezza_Server : public ServerKeyBase {
|
||||||
|
Fortezza_Server() {}
|
||||||
opaque r_s_[FORTEZZA_MAX];
|
opaque r_s_[FORTEZZA_MAX];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct SignatureBase : public virtual_base {
|
struct SignatureBase : public virtual_base {
|
||||||
|
SignatureBase() {}
|
||||||
virtual ~SignatureBase() {}
|
virtual ~SignatureBase() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct anonymous_sa : public SignatureBase {};
|
struct anonymous_sa : public SignatureBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
anonymous_sa() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct Hashes {
|
struct Hashes {
|
||||||
@ -355,11 +365,13 @@ struct Hashes {
|
|||||||
|
|
||||||
|
|
||||||
struct rsa_sa : public SignatureBase {
|
struct rsa_sa : public SignatureBase {
|
||||||
|
rsa_sa() {}
|
||||||
Hashes hashes_;
|
Hashes hashes_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct dsa_sa : public SignatureBase {
|
struct dsa_sa : public SignatureBase {
|
||||||
|
dsa_sa() {}
|
||||||
uint8 sha_[SHA_LEN];
|
uint8 sha_[SHA_LEN];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -387,6 +399,7 @@ private:
|
|||||||
|
|
||||||
// Server's RSA exchange
|
// Server's RSA exchange
|
||||||
struct RSA_Server : public ServerKeyBase {
|
struct RSA_Server : public ServerKeyBase {
|
||||||
|
RSA_Server() {}
|
||||||
ServerRSAParams params_;
|
ServerRSAParams params_;
|
||||||
opaque* signature_; // signed rsa_sa hashes
|
opaque* signature_; // signed rsa_sa hashes
|
||||||
};
|
};
|
||||||
@ -461,6 +474,7 @@ struct PreMasterSecret {
|
|||||||
|
|
||||||
|
|
||||||
struct ClientKeyBase : public virtual_base {
|
struct ClientKeyBase : public virtual_base {
|
||||||
|
ClientKeyBase() {}
|
||||||
virtual ~ClientKeyBase() {}
|
virtual ~ClientKeyBase() {}
|
||||||
virtual void build(SSL&) {}
|
virtual void build(SSL&) {}
|
||||||
virtual void read(SSL&, input_buffer&) {}
|
virtual void read(SSL&, input_buffer&) {}
|
||||||
@ -491,6 +505,7 @@ private:
|
|||||||
// Fortezza Key Parameters from page 29
|
// Fortezza Key Parameters from page 29
|
||||||
// hard code lengths cause only used here
|
// hard code lengths cause only used here
|
||||||
struct FortezzaKeys : public ClientKeyBase {
|
struct FortezzaKeys : public ClientKeyBase {
|
||||||
|
FortezzaKeys() {}
|
||||||
opaque y_c_ [128]; // client's Yc, public value
|
opaque y_c_ [128]; // client's Yc, public value
|
||||||
opaque r_c_ [128]; // client's Rc
|
opaque r_c_ [128]; // client's Rc
|
||||||
opaque y_signature_ [40]; // DSS signed public key
|
opaque y_signature_ [40]; // DSS signed public key
|
||||||
|
@ -228,6 +228,7 @@ struct BIGNUM {
|
|||||||
TaoCrypt::Integer), we need to explicitly state the namespace
|
TaoCrypt::Integer), we need to explicitly state the namespace
|
||||||
here to let gcc 2.96 deduce the correct type.
|
here to let gcc 2.96 deduce the correct type.
|
||||||
*/
|
*/
|
||||||
|
BIGNUM() {}
|
||||||
yaSSL::Integer int_;
|
yaSSL::Integer int_;
|
||||||
void assign(const byte* b, uint s) { int_.assign(b,s); }
|
void assign(const byte* b, uint s) { int_.assign(b,s); }
|
||||||
};
|
};
|
||||||
|
@ -550,6 +550,7 @@ void RandomPool::Fill(opaque* dst, uint sz) const
|
|||||||
|
|
||||||
// Implementation of DSS Authentication
|
// Implementation of DSS Authentication
|
||||||
struct DSS::DSSImpl {
|
struct DSS::DSSImpl {
|
||||||
|
DSSImpl() {}
|
||||||
void SetPublic (const byte*, unsigned int);
|
void SetPublic (const byte*, unsigned int);
|
||||||
void SetPrivate(const byte*, unsigned int);
|
void SetPrivate(const byte*, unsigned int);
|
||||||
TaoCrypt::DSA_PublicKey publicKey_;
|
TaoCrypt::DSA_PublicKey publicKey_;
|
||||||
@ -622,6 +623,7 @@ bool DSS::verify(const byte* sha_digest, unsigned int /* shaSz */,
|
|||||||
|
|
||||||
// Implementation of RSA key interface
|
// Implementation of RSA key interface
|
||||||
struct RSA::RSAImpl {
|
struct RSA::RSAImpl {
|
||||||
|
RSAImpl() {}
|
||||||
void SetPublic (const byte*, unsigned int);
|
void SetPublic (const byte*, unsigned int);
|
||||||
void SetPrivate(const byte*, unsigned int);
|
void SetPrivate(const byte*, unsigned int);
|
||||||
TaoCrypt::RSA_PublicKey publicKey_;
|
TaoCrypt::RSA_PublicKey publicKey_;
|
||||||
|
@ -65,7 +65,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
const int megs = 5; // how much to test
|
const int megs = 5; // how much to test
|
||||||
|
|
||||||
const byte key[] =
|
const byte global_key[] =
|
||||||
{
|
{
|
||||||
0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
|
0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
|
||||||
0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10,
|
0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10,
|
||||||
@ -81,19 +81,19 @@ const byte iv[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
byte plain [1024*1024];
|
byte global_plain [1024*1024];
|
||||||
byte cipher[1024*1024];
|
byte global_cipher[1024*1024];
|
||||||
|
|
||||||
|
|
||||||
void bench_des()
|
void bench_des()
|
||||||
{
|
{
|
||||||
DES_EDE3_CBC_Encryption enc;
|
DES_EDE3_CBC_Encryption enc;
|
||||||
enc.SetKey(key, 16, iv);
|
enc.SetKey(global_key, 16, iv);
|
||||||
|
|
||||||
double start = current_time();
|
double start = current_time();
|
||||||
|
|
||||||
for(int i = 0; i < megs; i++)
|
for(int i = 0; i < megs; i++)
|
||||||
enc.Process(plain, cipher, sizeof(plain));
|
enc.Process(global_plain, global_cipher, sizeof(global_plain));
|
||||||
|
|
||||||
double total = current_time() - start;
|
double total = current_time() - start;
|
||||||
|
|
||||||
@ -107,12 +107,12 @@ void bench_des()
|
|||||||
void bench_aes(bool show)
|
void bench_aes(bool show)
|
||||||
{
|
{
|
||||||
AES_CBC_Encryption enc;
|
AES_CBC_Encryption enc;
|
||||||
enc.SetKey(key, 16, iv);
|
enc.SetKey(global_key, 16, iv);
|
||||||
|
|
||||||
double start = current_time();
|
double start = current_time();
|
||||||
|
|
||||||
for(int i = 0; i < megs; i++)
|
for(int i = 0; i < megs; i++)
|
||||||
enc.Process(plain, cipher, sizeof(plain));
|
enc.Process(global_plain, global_cipher, sizeof(global_plain));
|
||||||
|
|
||||||
double total = current_time() - start;
|
double total = current_time() - start;
|
||||||
|
|
||||||
@ -127,12 +127,12 @@ void bench_aes(bool show)
|
|||||||
void bench_twofish()
|
void bench_twofish()
|
||||||
{
|
{
|
||||||
Twofish_CBC_Encryption enc;
|
Twofish_CBC_Encryption enc;
|
||||||
enc.SetKey(key, 16, iv);
|
enc.SetKey(global_key, 16, iv);
|
||||||
|
|
||||||
double start = current_time();
|
double start = current_time();
|
||||||
|
|
||||||
for(int i = 0; i < megs; i++)
|
for(int i = 0; i < megs; i++)
|
||||||
enc.Process(plain, cipher, sizeof(plain));
|
enc.Process(global_plain, global_cipher, sizeof(global_plain));
|
||||||
|
|
||||||
double total = current_time() - start;
|
double total = current_time() - start;
|
||||||
|
|
||||||
@ -147,12 +147,12 @@ void bench_twofish()
|
|||||||
void bench_blowfish()
|
void bench_blowfish()
|
||||||
{
|
{
|
||||||
Blowfish_CBC_Encryption enc;
|
Blowfish_CBC_Encryption enc;
|
||||||
enc.SetKey(key, 16, iv);
|
enc.SetKey(global_key, 16, iv);
|
||||||
|
|
||||||
double start = current_time();
|
double start = current_time();
|
||||||
|
|
||||||
for(int i = 0; i < megs; i++)
|
for(int i = 0; i < megs; i++)
|
||||||
enc.Process(plain, cipher, sizeof(plain));
|
enc.Process(global_plain, global_cipher, sizeof(global_plain));
|
||||||
|
|
||||||
double total = current_time() - start;
|
double total = current_time() - start;
|
||||||
|
|
||||||
@ -166,12 +166,12 @@ void bench_blowfish()
|
|||||||
void bench_arc4()
|
void bench_arc4()
|
||||||
{
|
{
|
||||||
ARC4 enc;
|
ARC4 enc;
|
||||||
enc.SetKey(key, 16);
|
enc.SetKey(global_key, 16);
|
||||||
|
|
||||||
double start = current_time();
|
double start = current_time();
|
||||||
|
|
||||||
for(int i = 0; i < megs; i++)
|
for(int i = 0; i < megs; i++)
|
||||||
enc.Process(cipher, plain, sizeof(plain));
|
enc.Process(global_cipher, global_plain, sizeof(global_plain));
|
||||||
|
|
||||||
double total = current_time() - start;
|
double total = current_time() - start;
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ void bench_md5()
|
|||||||
|
|
||||||
|
|
||||||
for(int i = 0; i < megs; i++)
|
for(int i = 0; i < megs; i++)
|
||||||
hash.Update(plain, sizeof(plain));
|
hash.Update(global_plain, sizeof(global_plain));
|
||||||
|
|
||||||
hash.Final(digest);
|
hash.Final(digest);
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ void bench_sha()
|
|||||||
|
|
||||||
|
|
||||||
for(int i = 0; i < megs; i++)
|
for(int i = 0; i < megs; i++)
|
||||||
hash.Update(plain, sizeof(plain));
|
hash.Update(global_plain, sizeof(global_plain));
|
||||||
|
|
||||||
hash.Final(digest);
|
hash.Final(digest);
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ void bench_ripemd()
|
|||||||
|
|
||||||
|
|
||||||
for(int i = 0; i < megs; i++)
|
for(int i = 0; i < megs; i++)
|
||||||
hash.Update(plain, sizeof(plain));
|
hash.Update(global_plain, sizeof(global_plain));
|
||||||
|
|
||||||
hash.Final(digest);
|
hash.Final(digest);
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ class TAOCRYPT_NO_VTABLE AbstractGroup : public virtual_base
|
|||||||
public:
|
public:
|
||||||
typedef Integer Element;
|
typedef Integer Element;
|
||||||
|
|
||||||
|
AbstractGroup() {}
|
||||||
virtual ~AbstractGroup() {}
|
virtual ~AbstractGroup() {}
|
||||||
|
|
||||||
virtual bool Equal(const Element &a, const Element &b) const =0;
|
virtual bool Equal(const Element &a, const Element &b) const =0;
|
||||||
@ -94,6 +95,7 @@ private:
|
|||||||
class MultiplicativeGroupT : public AbstractGroup
|
class MultiplicativeGroupT : public AbstractGroup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
MultiplicativeGroupT() {}
|
||||||
const AbstractRing& GetRing() const
|
const AbstractRing& GetRing() const
|
||||||
{return *m_pRing;}
|
{return *m_pRing;}
|
||||||
|
|
||||||
@ -145,6 +147,7 @@ class TAOCRYPT_NO_VTABLE AbstractEuclideanDomain
|
|||||||
: public AbstractRing
|
: public AbstractRing
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
AbstractEuclideanDomain() {}
|
||||||
typedef Integer Element;
|
typedef Integer Element;
|
||||||
|
|
||||||
virtual void DivisionAlgorithm(Element &r, Element &q, const Element &a,
|
virtual void DivisionAlgorithm(Element &r, Element &q, const Element &a,
|
||||||
|
@ -41,6 +41,7 @@ enum { DES_BLOCK_SIZE = 8, DES_KEY_SIZE = 32 };
|
|||||||
|
|
||||||
class BasicDES {
|
class BasicDES {
|
||||||
public:
|
public:
|
||||||
|
BasicDES() {}
|
||||||
void SetKey(const byte*, word32, CipherDir dir);
|
void SetKey(const byte*, word32, CipherDir dir);
|
||||||
void RawProcessBlock(word32&, word32&) const;
|
void RawProcessBlock(word32&, word32&) const;
|
||||||
protected:
|
protected:
|
||||||
|
@ -31,6 +31,7 @@ namespace TaoCrypt {
|
|||||||
// HASH
|
// HASH
|
||||||
class HASH : public virtual_base {
|
class HASH : public virtual_base {
|
||||||
public:
|
public:
|
||||||
|
HASH() {}
|
||||||
virtual ~HASH() {}
|
virtual ~HASH() {}
|
||||||
|
|
||||||
virtual void Update(const byte*, word32) = 0;
|
virtual void Update(const byte*, word32) = 0;
|
||||||
|
@ -109,11 +109,11 @@ void HMAC<T>::KeyInnerHash()
|
|||||||
|
|
||||||
// Update
|
// Update
|
||||||
template <class T>
|
template <class T>
|
||||||
void HMAC<T>::Update(const byte* msg, word32 length)
|
void HMAC<T>::Update(const byte* msg_arg, word32 length)
|
||||||
{
|
{
|
||||||
if (!innerHashKeyed_)
|
if (!innerHashKeyed_)
|
||||||
KeyInnerHash();
|
KeyInnerHash();
|
||||||
mac_.Update(msg, length);
|
mac_.Update(msg_arg, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ public:
|
|||||||
typedef int RandomizationParameter;
|
typedef int RandomizationParameter;
|
||||||
typedef Integer Element;
|
typedef Integer Element;
|
||||||
|
|
||||||
ModularArithmetic(const Integer &modulus = Integer::One())
|
ModularArithmetic(const Integer &modulus_arg = Integer::One())
|
||||||
: modulus(modulus), result((word)0, modulus.reg_.size()) {}
|
: modulus(modulus_arg), result((word)0, modulus_arg.reg_.size()) {}
|
||||||
|
|
||||||
ModularArithmetic(const ModularArithmetic &ma)
|
ModularArithmetic(const ModularArithmetic &ma)
|
||||||
: AbstractRing(),
|
: AbstractRing(),
|
||||||
|
@ -42,8 +42,8 @@ public:
|
|||||||
{ cipher_.Process(c, p, sz); }
|
{ cipher_.Process(c, p, sz); }
|
||||||
void SetKey(const byte* k, word32 sz)
|
void SetKey(const byte* k, word32 sz)
|
||||||
{ cipher_.SetKey(k, sz, DIR); }
|
{ cipher_.SetKey(k, sz, DIR); }
|
||||||
void SetKey(const byte* k, word32 sz, const byte* iv)
|
void SetKey(const byte* k, word32 sz, const byte* iv_arg)
|
||||||
{ cipher_.SetKey(k, sz, DIR); cipher_.SetIV(iv); }
|
{ cipher_.SetKey(k, sz, DIR); cipher_.SetIV(iv_arg); }
|
||||||
private:
|
private:
|
||||||
T cipher_;
|
T cipher_;
|
||||||
|
|
||||||
|
@ -131,6 +131,7 @@ private:
|
|||||||
// block type 2 padding
|
// block type 2 padding
|
||||||
class RSA_BlockType2 {
|
class RSA_BlockType2 {
|
||||||
public:
|
public:
|
||||||
|
RSA_BlockType2() {}
|
||||||
void Pad(const byte*, word32, byte*, word32,
|
void Pad(const byte*, word32, byte*, word32,
|
||||||
RandomNumberGenerator&) const;
|
RandomNumberGenerator&) const;
|
||||||
word32 UnPad(const byte*, word32, byte*) const;
|
word32 UnPad(const byte*, word32, byte*) const;
|
||||||
@ -140,6 +141,7 @@ public:
|
|||||||
// block type 1 padding
|
// block type 1 padding
|
||||||
class RSA_BlockType1 {
|
class RSA_BlockType1 {
|
||||||
public:
|
public:
|
||||||
|
RSA_BlockType1() {}
|
||||||
void Pad(const byte*, word32, byte*, word32,
|
void Pad(const byte*, word32, byte*, word32,
|
||||||
RandomNumberGenerator&) const;
|
RandomNumberGenerator&) const;
|
||||||
word32 UnPad(const byte*, word32, byte*) const;
|
word32 UnPad(const byte*, word32, byte*) const;
|
||||||
@ -174,25 +176,27 @@ public:
|
|||||||
|
|
||||||
// Public Encrypt
|
// Public Encrypt
|
||||||
template<class Pad>
|
template<class Pad>
|
||||||
void RSA_Encryptor<Pad>::Encrypt(const byte* plain, word32 sz, byte* cipher,
|
void RSA_Encryptor<Pad>::Encrypt(const byte* plain_arg, word32 sz,
|
||||||
RandomNumberGenerator& rng)
|
byte* cipher_arg,
|
||||||
|
RandomNumberGenerator& rng_arg)
|
||||||
{
|
{
|
||||||
PK_Lengths lengths(key_.GetModulus());
|
PK_Lengths lengths(key_.GetModulus());
|
||||||
assert(sz <= lengths.FixedMaxPlaintextLength());
|
assert(sz <= lengths.FixedMaxPlaintextLength());
|
||||||
|
|
||||||
ByteBlock paddedBlock(lengths.PaddedBlockByteLength());
|
ByteBlock paddedBlock(lengths.PaddedBlockByteLength());
|
||||||
padding_.Pad(plain, sz, paddedBlock.get_buffer(),
|
padding_.Pad(plain_arg, sz, paddedBlock.get_buffer(),
|
||||||
lengths.PaddedBlockBitLength(), rng);
|
lengths.PaddedBlockBitLength(), rng_arg);
|
||||||
|
|
||||||
key_.ApplyFunction(Integer(paddedBlock.get_buffer(), paddedBlock.size())).
|
key_.ApplyFunction(Integer(paddedBlock.get_buffer(), paddedBlock.size())).
|
||||||
Encode(cipher, lengths.FixedCiphertextLength());
|
Encode(cipher_arg, lengths.FixedCiphertextLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Private Decrypt
|
// Private Decrypt
|
||||||
template<class Pad>
|
template<class Pad>
|
||||||
word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher, word32 sz, byte* plain,
|
word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher_arg, word32 sz,
|
||||||
RandomNumberGenerator& rng)
|
byte* plain_arg,
|
||||||
|
RandomNumberGenerator& rng_arg)
|
||||||
{
|
{
|
||||||
PK_Lengths lengths(key_.GetModulus());
|
PK_Lengths lengths(key_.GetModulus());
|
||||||
assert(sz == lengths.FixedCiphertextLength());
|
assert(sz == lengths.FixedCiphertextLength());
|
||||||
@ -201,29 +205,29 @@ word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher, word32 sz, byte* plain,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ByteBlock paddedBlock(lengths.PaddedBlockByteLength());
|
ByteBlock paddedBlock(lengths.PaddedBlockByteLength());
|
||||||
Integer x = key_.CalculateInverse(rng, Integer(cipher,
|
Integer x = key_.CalculateInverse(rng_arg, Integer(cipher_arg,
|
||||||
lengths.FixedCiphertextLength()).Ref());
|
lengths.FixedCiphertextLength()).Ref());
|
||||||
if (x.ByteCount() > paddedBlock.size())
|
if (x.ByteCount() > paddedBlock.size())
|
||||||
x = Integer::Zero(); // don't return false, prevents timing attack
|
x = Integer::Zero(); // don't return false, prevents timing attack
|
||||||
x.Encode(paddedBlock.get_buffer(), paddedBlock.size());
|
x.Encode(paddedBlock.get_buffer(), paddedBlock.size());
|
||||||
return padding_.UnPad(paddedBlock.get_buffer(),
|
return padding_.UnPad(paddedBlock.get_buffer(),
|
||||||
lengths.PaddedBlockBitLength(), plain);
|
lengths.PaddedBlockBitLength(), plain_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Private SSL type (block 1) Encrypt
|
// Private SSL type (block 1) Encrypt
|
||||||
template<class Pad>
|
template<class Pad>
|
||||||
void RSA_Decryptor<Pad>::SSL_Sign(const byte* message, word32 sz, byte* sig,
|
void RSA_Decryptor<Pad>::SSL_Sign(const byte* message, word32 sz, byte* sig,
|
||||||
RandomNumberGenerator& rng)
|
RandomNumberGenerator& rng_arg)
|
||||||
{
|
{
|
||||||
RSA_PublicKey inverse;
|
RSA_PublicKey inverse;
|
||||||
inverse.Initialize(key_.GetModulus(), key_.GetPrivateExponent());
|
inverse.Initialize(key_.GetModulus(), key_.GetPrivateExponent());
|
||||||
RSA_Encryptor<RSA_BlockType1> enc(inverse); // SSL Type
|
RSA_Encryptor<RSA_BlockType1> enc(inverse); // SSL Type
|
||||||
enc.Encrypt(message, sz, sig, rng);
|
enc.Encrypt(message, sz, sig, rng_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
word32 SSL_Decrypt(const RSA_PublicKey& key, const byte* sig, byte* plain);
|
word32 SSL_Decrypt(const RSA_PublicKey& key, const byte* sig, byte* plain_arg);
|
||||||
|
|
||||||
|
|
||||||
// Public SSL type (block 1) Decrypt
|
// Public SSL type (block 1) Decrypt
|
||||||
@ -231,11 +235,11 @@ template<class Pad>
|
|||||||
bool RSA_Encryptor<Pad>::SSL_Verify(const byte* message, word32 sz,
|
bool RSA_Encryptor<Pad>::SSL_Verify(const byte* message, word32 sz,
|
||||||
const byte* sig)
|
const byte* sig)
|
||||||
{
|
{
|
||||||
ByteBlock plain(PK_Lengths(key_.GetModulus()).FixedMaxPlaintextLength());
|
ByteBlock local_plain(PK_Lengths(key_.GetModulus()).FixedMaxPlaintextLength());
|
||||||
if (SSL_Decrypt(key_, sig, plain.get_buffer()) != sz)
|
if (SSL_Decrypt(key_, sig, local_plain.get_buffer()) != sz)
|
||||||
return false; // not right justified or bad padding
|
return false; // not right justified or bad padding
|
||||||
|
|
||||||
if ( (memcmp(plain.get_buffer(), message, sz)) == 0)
|
if ( (memcmp(local_plain.get_buffer(), message, sz)) == 0)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,11 @@ MK_FUNDAMENTAL_TYPE(unsigned long)
|
|||||||
|
|
||||||
MK_FUNDAMENTAL_TYPE(float)
|
MK_FUNDAMENTAL_TYPE(float)
|
||||||
MK_FUNDAMENTAL_TYPE( double)
|
MK_FUNDAMENTAL_TYPE( double)
|
||||||
|
|
||||||
|
#ifdef LONG_DOUBLE_IS_DISTINCT_TYPE
|
||||||
|
// Don't define by default as this gives warnings on power mac
|
||||||
MK_FUNDAMENTAL_TYPE(long double)
|
MK_FUNDAMENTAL_TYPE(long double)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(WORD64_AVAILABLE) && defined(WORD64_IS_DISTINCT_TYPE)
|
#if defined(WORD64_AVAILABLE) && defined(WORD64_IS_DISTINCT_TYPE)
|
||||||
MK_FUNDAMENTAL_TYPE(word64)
|
MK_FUNDAMENTAL_TYPE(word64)
|
||||||
|
@ -231,7 +231,7 @@ void list<T>::push_front(T t)
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
void list<T>::pop_front()
|
void list<T>::pop_front()
|
||||||
{
|
{
|
||||||
node* front = head_;
|
node* local_front = head_;
|
||||||
|
|
||||||
if (head_ == 0)
|
if (head_ == 0)
|
||||||
return;
|
return;
|
||||||
@ -241,8 +241,8 @@ void list<T>::pop_front()
|
|||||||
head_ = head_->next_;
|
head_ = head_->next_;
|
||||||
head_->prev_ = 0;
|
head_->prev_ = 0;
|
||||||
}
|
}
|
||||||
destroy(front);
|
destroy(local_front);
|
||||||
FreeMemory(front);
|
FreeMemory(local_front);
|
||||||
--sz_;
|
--sz_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,13 +303,13 @@ T list<T>::back() const
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
typename list<T>::node* list<T>::look_up(T t)
|
typename list<T>::node* list<T>::look_up(T t)
|
||||||
{
|
{
|
||||||
node* list = head_;
|
node* local_list = head_;
|
||||||
|
|
||||||
if (list == 0) return 0;
|
if (local_list == 0) return 0;
|
||||||
|
|
||||||
for (; list; list = list->next_)
|
for (; local_list; local_list = local_list->next_)
|
||||||
if (list->value_ == t)
|
if (local_list->value_ == t)
|
||||||
return list;
|
return local_list;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -90,13 +90,14 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
|
|||||||
rounds_ = keylen/4 + 6;
|
rounds_ = keylen/4 + 6;
|
||||||
|
|
||||||
word32 temp, *rk = key_;
|
word32 temp, *rk = key_;
|
||||||
unsigned int i=0;
|
|
||||||
|
|
||||||
GetUserKey(BigEndianOrder, rk, keylen/4, userKey, keylen);
|
GetUserKey(BigEndianOrder, rk, keylen/4, userKey, keylen);
|
||||||
|
|
||||||
switch(keylen)
|
switch(keylen)
|
||||||
{
|
{
|
||||||
case 16:
|
case 16:
|
||||||
|
{
|
||||||
|
unsigned int i=0;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
temp = rk[3];
|
temp = rk[3];
|
||||||
@ -114,8 +115,10 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
|
|||||||
rk += 4;
|
rk += 4;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 24:
|
case 24:
|
||||||
|
{
|
||||||
|
unsigned int i=0;
|
||||||
while (true) // for (;;) here triggers a bug in VC60 SP4 w/ Pro Pack
|
while (true) // for (;;) here triggers a bug in VC60 SP4 w/ Pro Pack
|
||||||
{
|
{
|
||||||
temp = rk[ 5];
|
temp = rk[ 5];
|
||||||
@ -136,7 +139,10 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
case 32:
|
case 32:
|
||||||
|
{
|
||||||
|
unsigned int i=0;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
temp = rk[ 7];
|
temp = rk[ 7];
|
||||||
@ -165,6 +171,7 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (dir_ == DECRYPTION)
|
if (dir_ == DECRYPTION)
|
||||||
{
|
{
|
||||||
|
@ -186,10 +186,10 @@ Integer AbstractGroup::CascadeScalarMultiply(const Element &x,
|
|||||||
|
|
||||||
struct WindowSlider
|
struct WindowSlider
|
||||||
{
|
{
|
||||||
WindowSlider(const Integer &exp, bool fastNegate,
|
WindowSlider(const Integer &exp_arg, bool fastNegate_arg,
|
||||||
unsigned int windowSizeIn=0)
|
unsigned int windowSizeIn=0)
|
||||||
: exp(exp), windowModulus(Integer::One()), windowSize(windowSizeIn),
|
: exp(exp_arg), windowModulus(Integer::One()), windowSize(windowSizeIn),
|
||||||
windowBegin(0), fastNegate(fastNegate), firstTime(true),
|
windowBegin(0), fastNegate(fastNegate_arg), firstTime(true),
|
||||||
finished(false)
|
finished(false)
|
||||||
{
|
{
|
||||||
if (windowSize == 0)
|
if (windowSize == 0)
|
||||||
|
@ -737,17 +737,19 @@ void CertDecoder::GetName(NameType nt)
|
|||||||
email = true;
|
email = true;
|
||||||
|
|
||||||
source_.advance(oidSz + 1);
|
source_.advance(oidSz + 1);
|
||||||
word32 length = GetLength(source_);
|
word32 length2 = GetLength(source_);
|
||||||
|
|
||||||
if (email) {
|
if (email) {
|
||||||
memcpy(&ptr[idx], "/emailAddress=", 14);
|
memcpy(&ptr[idx], "/emailAddress=", 14);
|
||||||
idx += 14;
|
idx += 14;
|
||||||
|
|
||||||
memcpy(&ptr[idx], source_.get_current(), length);
|
memcpy(&ptr[idx], source_.get_current(), length2);
|
||||||
idx += length;
|
idx += length2;
|
||||||
}
|
}
|
||||||
|
|
||||||
source_.advance(length);
|
source_.advance(oidSz + 1);
|
||||||
|
word32 length2 = GetLength(source_);
|
||||||
|
source_.advance(length2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ptr[idx++] = 0;
|
ptr[idx++] = 0;
|
||||||
|
@ -139,20 +139,20 @@ const byte msgTmp[] = { // "now is the time for all " w/o trailing 0
|
|||||||
0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
|
0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
|
||||||
};
|
};
|
||||||
|
|
||||||
byte* msg = 0; // for block cipher input
|
byte* global_msg = 0; // for block cipher input
|
||||||
byte* plain = 0; // for cipher decrypt comparison
|
byte* global_plain = 0; // for cipher decrypt comparison
|
||||||
byte* cipher = 0; // block output
|
byte* global_cipher = 0; // block output
|
||||||
|
|
||||||
|
|
||||||
void taocrypt_test(void* args)
|
void taocrypt_test(void* args)
|
||||||
{
|
{
|
||||||
((func_args*)args)->return_code = -1; // error state
|
((func_args*)args)->return_code = -1; // error state
|
||||||
|
|
||||||
msg = NEW_TC byte[24];
|
global_msg = NEW_TC byte[24];
|
||||||
plain = NEW_TC byte[24];
|
global_plain = NEW_TC byte[24];
|
||||||
cipher = NEW_TC byte[24];
|
global_cipher = NEW_TC byte[24];
|
||||||
|
|
||||||
memcpy(msg, msgTmp, 24);
|
memcpy(global_msg, msgTmp, 24);
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if ( (ret = sha_test()) )
|
if ( (ret = sha_test()) )
|
||||||
@ -237,9 +237,9 @@ void taocrypt_test(void* args)
|
|||||||
printf( "PKCS12 test passed!\n");
|
printf( "PKCS12 test passed!\n");
|
||||||
*/
|
*/
|
||||||
|
|
||||||
tcArrayDelete(cipher);
|
tcArrayDelete(global_cipher);
|
||||||
tcArrayDelete(plain);
|
tcArrayDelete(global_plain);
|
||||||
tcArrayDelete(msg);
|
tcArrayDelete(global_msg);
|
||||||
|
|
||||||
((func_args*)args)->return_code = ret;
|
((func_args*)args)->return_code = ret;
|
||||||
}
|
}
|
||||||
@ -606,11 +606,11 @@ int des_test()
|
|||||||
const byte iv[] = { 0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef };
|
const byte iv[] = { 0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef };
|
||||||
|
|
||||||
enc.SetKey(key, sizeof(key));
|
enc.SetKey(key, sizeof(key));
|
||||||
enc.Process(cipher, msg, sz);
|
enc.Process(global_cipher, global_msg, sz);
|
||||||
dec.SetKey(key, sizeof(key));
|
dec.SetKey(key, sizeof(key));
|
||||||
dec.Process(plain, cipher, sz);
|
dec.Process(global_plain, global_cipher, sz);
|
||||||
|
|
||||||
if (memcmp(plain, msg, sz))
|
if (memcmp(global_plain, global_msg, sz))
|
||||||
return -50;
|
return -50;
|
||||||
|
|
||||||
const byte verify1[] =
|
const byte verify1[] =
|
||||||
@ -620,7 +620,7 @@ int des_test()
|
|||||||
0x89,0x3d,0x51,0xec,0x4b,0x56,0x3b,0x53
|
0x89,0x3d,0x51,0xec,0x4b,0x56,0x3b,0x53
|
||||||
};
|
};
|
||||||
|
|
||||||
if (memcmp(cipher, verify1, sz))
|
if (memcmp(global_cipher, verify1, sz))
|
||||||
return -51;
|
return -51;
|
||||||
|
|
||||||
// CBC mode
|
// CBC mode
|
||||||
@ -628,11 +628,11 @@ int des_test()
|
|||||||
DES_CBC_Decryption dec2;
|
DES_CBC_Decryption dec2;
|
||||||
|
|
||||||
enc2.SetKey(key, sizeof(key), iv);
|
enc2.SetKey(key, sizeof(key), iv);
|
||||||
enc2.Process(cipher, msg, sz);
|
enc2.Process(global_cipher, global_msg, sz);
|
||||||
dec2.SetKey(key, sizeof(key), iv);
|
dec2.SetKey(key, sizeof(key), iv);
|
||||||
dec2.Process(plain, cipher, sz);
|
dec2.Process(global_plain, global_cipher, sz);
|
||||||
|
|
||||||
if (memcmp(plain, msg, sz))
|
if (memcmp(global_plain, global_msg, sz))
|
||||||
return -52;
|
return -52;
|
||||||
|
|
||||||
const byte verify2[] =
|
const byte verify2[] =
|
||||||
@ -642,7 +642,7 @@ int des_test()
|
|||||||
0x15,0x85,0xb3,0x22,0x4b,0x86,0x2b,0x4b
|
0x15,0x85,0xb3,0x22,0x4b,0x86,0x2b,0x4b
|
||||||
};
|
};
|
||||||
|
|
||||||
if (memcmp(cipher, verify2, sz))
|
if (memcmp(global_cipher, verify2, sz))
|
||||||
return -53;
|
return -53;
|
||||||
|
|
||||||
// EDE3 CBC mode
|
// EDE3 CBC mode
|
||||||
@ -664,11 +664,11 @@ int des_test()
|
|||||||
};
|
};
|
||||||
|
|
||||||
enc3.SetKey(key3, sizeof(key3), iv3);
|
enc3.SetKey(key3, sizeof(key3), iv3);
|
||||||
enc3.Process(cipher, msg, sz);
|
enc3.Process(global_cipher, global_msg, sz);
|
||||||
dec3.SetKey(key3, sizeof(key3), iv3);
|
dec3.SetKey(key3, sizeof(key3), iv3);
|
||||||
dec3.Process(plain, cipher, sz);
|
dec3.Process(global_plain, global_cipher, sz);
|
||||||
|
|
||||||
if (memcmp(plain, msg, sz))
|
if (memcmp(global_plain, global_msg, sz))
|
||||||
return -54;
|
return -54;
|
||||||
|
|
||||||
const byte verify3[] =
|
const byte verify3[] =
|
||||||
@ -678,7 +678,7 @@ int des_test()
|
|||||||
0x18,0xbc,0xbb,0x6d,0xd2,0xb1,0x16,0xda
|
0x18,0xbc,0xbb,0x6d,0xd2,0xb1,0x16,0xda
|
||||||
};
|
};
|
||||||
|
|
||||||
if (memcmp(cipher, verify3, sz))
|
if (memcmp(global_cipher, verify3, sz))
|
||||||
return -55;
|
return -55;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -697,10 +697,10 @@ int aes_test()
|
|||||||
enc.SetKey(key, bs, iv);
|
enc.SetKey(key, bs, iv);
|
||||||
dec.SetKey(key, bs, iv);
|
dec.SetKey(key, bs, iv);
|
||||||
|
|
||||||
enc.Process(cipher, msg, bs);
|
enc.Process(global_cipher, global_msg, bs);
|
||||||
dec.Process(plain, cipher, bs);
|
dec.Process(global_plain, global_cipher, bs);
|
||||||
|
|
||||||
if (memcmp(plain, msg, bs))
|
if (memcmp(global_plain, global_msg, bs))
|
||||||
return -60;
|
return -60;
|
||||||
|
|
||||||
const byte verify[] =
|
const byte verify[] =
|
||||||
@ -709,7 +709,7 @@ int aes_test()
|
|||||||
0x2c,0xcc,0x9d,0x46,0x77,0xa2,0x33,0xcb
|
0x2c,0xcc,0x9d,0x46,0x77,0xa2,0x33,0xcb
|
||||||
};
|
};
|
||||||
|
|
||||||
if (memcmp(cipher, verify, bs))
|
if (memcmp(global_cipher, verify, bs))
|
||||||
return -61;
|
return -61;
|
||||||
|
|
||||||
AES_ECB_Encryption enc2;
|
AES_ECB_Encryption enc2;
|
||||||
@ -718,10 +718,10 @@ int aes_test()
|
|||||||
enc2.SetKey(key, bs, iv);
|
enc2.SetKey(key, bs, iv);
|
||||||
dec2.SetKey(key, bs, iv);
|
dec2.SetKey(key, bs, iv);
|
||||||
|
|
||||||
enc2.Process(cipher, msg, bs);
|
enc2.Process(global_cipher, global_msg, bs);
|
||||||
dec2.Process(plain, cipher, bs);
|
dec2.Process(global_plain, global_cipher, bs);
|
||||||
|
|
||||||
if (memcmp(plain, msg, bs))
|
if (memcmp(global_plain, global_msg, bs))
|
||||||
return -62;
|
return -62;
|
||||||
|
|
||||||
const byte verify2[] =
|
const byte verify2[] =
|
||||||
@ -730,7 +730,7 @@ int aes_test()
|
|||||||
0xc8,0x8c,0x33,0x3b,0xb5,0x8f,0x85,0xd1
|
0xc8,0x8c,0x33,0x3b,0xb5,0x8f,0x85,0xd1
|
||||||
};
|
};
|
||||||
|
|
||||||
if (memcmp(cipher, verify2, bs))
|
if (memcmp(global_cipher, verify2, bs))
|
||||||
return -63;
|
return -63;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -749,10 +749,10 @@ int twofish_test()
|
|||||||
enc.SetKey(key, bs, iv);
|
enc.SetKey(key, bs, iv);
|
||||||
dec.SetKey(key, bs, iv);
|
dec.SetKey(key, bs, iv);
|
||||||
|
|
||||||
enc.Process(cipher, msg, bs);
|
enc.Process(global_cipher, global_msg, bs);
|
||||||
dec.Process(plain, cipher, bs);
|
dec.Process(global_plain, global_cipher, bs);
|
||||||
|
|
||||||
if (memcmp(plain, msg, bs))
|
if (memcmp(global_plain, global_msg, bs))
|
||||||
return -60;
|
return -60;
|
||||||
|
|
||||||
const byte verify[] =
|
const byte verify[] =
|
||||||
@ -761,7 +761,7 @@ int twofish_test()
|
|||||||
0x21,0x03,0x58,0x79,0x5F,0x02,0x27,0x2C
|
0x21,0x03,0x58,0x79,0x5F,0x02,0x27,0x2C
|
||||||
};
|
};
|
||||||
|
|
||||||
if (memcmp(cipher, verify, bs))
|
if (memcmp(global_cipher, verify, bs))
|
||||||
return -61;
|
return -61;
|
||||||
|
|
||||||
Twofish_ECB_Encryption enc2;
|
Twofish_ECB_Encryption enc2;
|
||||||
@ -770,10 +770,10 @@ int twofish_test()
|
|||||||
enc2.SetKey(key, bs, iv);
|
enc2.SetKey(key, bs, iv);
|
||||||
dec2.SetKey(key, bs, iv);
|
dec2.SetKey(key, bs, iv);
|
||||||
|
|
||||||
enc2.Process(cipher, msg, bs);
|
enc2.Process(global_cipher, global_msg, bs);
|
||||||
dec2.Process(plain, cipher, bs);
|
dec2.Process(global_plain, global_cipher, bs);
|
||||||
|
|
||||||
if (memcmp(plain, msg, bs))
|
if (memcmp(global_plain, global_msg, bs))
|
||||||
return -62;
|
return -62;
|
||||||
|
|
||||||
const byte verify2[] =
|
const byte verify2[] =
|
||||||
@ -782,7 +782,7 @@ int twofish_test()
|
|||||||
0xC4,0xCD,0x6B,0x91,0x14,0xC5,0x3A,0x09
|
0xC4,0xCD,0x6B,0x91,0x14,0xC5,0x3A,0x09
|
||||||
};
|
};
|
||||||
|
|
||||||
if (memcmp(cipher, verify2, bs))
|
if (memcmp(global_cipher, verify2, bs))
|
||||||
return -63;
|
return -63;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -801,10 +801,10 @@ int blowfish_test()
|
|||||||
enc.SetKey(key, 16, iv);
|
enc.SetKey(key, 16, iv);
|
||||||
dec.SetKey(key, 16, iv);
|
dec.SetKey(key, 16, iv);
|
||||||
|
|
||||||
enc.Process(cipher, msg, bs * 2);
|
enc.Process(global_cipher, global_msg, bs * 2);
|
||||||
dec.Process(plain, cipher, bs * 2);
|
dec.Process(global_plain, global_cipher, bs * 2);
|
||||||
|
|
||||||
if (memcmp(plain, msg, bs))
|
if (memcmp(global_plain, global_msg, bs))
|
||||||
return -60;
|
return -60;
|
||||||
|
|
||||||
const byte verify[] =
|
const byte verify[] =
|
||||||
@ -813,7 +813,7 @@ int blowfish_test()
|
|||||||
0xBC,0xD9,0x08,0xC4,0x94,0x6C,0x89,0xA3
|
0xBC,0xD9,0x08,0xC4,0x94,0x6C,0x89,0xA3
|
||||||
};
|
};
|
||||||
|
|
||||||
if (memcmp(cipher, verify, bs))
|
if (memcmp(global_cipher, verify, bs))
|
||||||
return -61;
|
return -61;
|
||||||
|
|
||||||
Blowfish_ECB_Encryption enc2;
|
Blowfish_ECB_Encryption enc2;
|
||||||
@ -822,10 +822,10 @@ int blowfish_test()
|
|||||||
enc2.SetKey(key, 16, iv);
|
enc2.SetKey(key, 16, iv);
|
||||||
dec2.SetKey(key, 16, iv);
|
dec2.SetKey(key, 16, iv);
|
||||||
|
|
||||||
enc2.Process(cipher, msg, bs * 2);
|
enc2.Process(global_cipher, global_msg, bs * 2);
|
||||||
dec2.Process(plain, cipher, bs * 2);
|
dec2.Process(global_plain, global_cipher, bs * 2);
|
||||||
|
|
||||||
if (memcmp(plain, msg, bs))
|
if (memcmp(global_plain, global_msg, bs))
|
||||||
return -62;
|
return -62;
|
||||||
|
|
||||||
const byte verify2[] =
|
const byte verify2[] =
|
||||||
@ -834,7 +834,7 @@ int blowfish_test()
|
|||||||
0x8F,0xCE,0x39,0x32,0xDE,0xD7,0xBC,0x5B
|
0x8F,0xCE,0x39,0x32,0xDE,0xD7,0xBC,0x5B
|
||||||
};
|
};
|
||||||
|
|
||||||
if (memcmp(cipher, verify2, bs))
|
if (memcmp(global_cipher, verify2, bs))
|
||||||
return -63;
|
return -63;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -141,16 +141,17 @@ int test_openSSL_des()
|
|||||||
/* test des encrypt/decrypt */
|
/* test des encrypt/decrypt */
|
||||||
char data[] = "this is my data ";
|
char data[] = "this is my data ";
|
||||||
int dataSz = strlen(data);
|
int dataSz = strlen(data);
|
||||||
DES_key_schedule key[3];
|
DES_key_schedule local_key[3];
|
||||||
byte iv[8];
|
byte iv[8];
|
||||||
EVP_BytesToKey(EVP_des_ede3_cbc(), EVP_md5(), NULL, (byte*)data, dataSz, 1,
|
EVP_BytesToKey(EVP_des_ede3_cbc(), EVP_md5(), NULL, (byte*)data, dataSz, 1,
|
||||||
(byte*)key, iv);
|
(byte*)local_key, iv);
|
||||||
|
|
||||||
byte cipher[16];
|
byte cipher[16];
|
||||||
DES_ede3_cbc_encrypt((byte*)data, cipher, dataSz, &key[0], &key[1],
|
DES_ede3_cbc_encrypt((byte*)data, cipher, dataSz,
|
||||||
&key[2], &iv, true);
|
&local_key[0], &local_key[1],
|
||||||
|
&local_key[2], &iv, true);
|
||||||
byte plain[16];
|
byte plain[16];
|
||||||
DES_ede3_cbc_encrypt(cipher, plain, 16, &key[0], &key[1], &key[2],
|
DES_ede3_cbc_encrypt(cipher, plain, 16, &local_key[0], &local_key[1],
|
||||||
&iv, false);
|
&local_key[2], &iv, false);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ int heap_write(HP_INFO *info, const byte *record)
|
|||||||
|
|
||||||
err:
|
err:
|
||||||
if (my_errno == HA_ERR_FOUND_DUPP_KEY)
|
if (my_errno == HA_ERR_FOUND_DUPP_KEY)
|
||||||
DBUG_PRINT("info",("Duplicate key: %d", keydef - share->keydef));
|
DBUG_PRINT("info",("Duplicate key: %d", (int) (keydef - share->keydef)));
|
||||||
info->errkey= keydef - share->keydef;
|
info->errkey= keydef - share->keydef;
|
||||||
/*
|
/*
|
||||||
We don't need to delete non-inserted key from rb-tree. Also, if
|
We don't need to delete non-inserted key from rb-tree. Also, if
|
||||||
|
@ -90,7 +90,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
uint beg;
|
uint beg;
|
||||||
uint end;
|
uint end;
|
||||||
uint mblen;
|
uint mb_len;
|
||||||
} my_match_t;
|
} my_match_t;
|
||||||
|
|
||||||
enum my_lex_states
|
enum my_lex_states
|
||||||
|
@ -540,7 +540,7 @@ typedef unsigned short ushort;
|
|||||||
duplicate declaration of __cxa_pure_virtual, solved by declaring it a
|
duplicate declaration of __cxa_pure_virtual, solved by declaring it a
|
||||||
weak symbol.
|
weak symbol.
|
||||||
*/
|
*/
|
||||||
#ifdef USE_MYSYS_NEW
|
#if defined(USE_MYSYS_NEW) && ! defined(DONT_DECLARE_CXA_PURE_VIRTUAL)
|
||||||
C_MODE_START
|
C_MODE_START
|
||||||
int __cxa_pure_virtual () __attribute__ ((weak));
|
int __cxa_pure_virtual () __attribute__ ((weak));
|
||||||
C_MODE_END
|
C_MODE_END
|
||||||
@ -1078,7 +1078,7 @@ typedef char bool; /* Ordinary boolean values 0 1 */
|
|||||||
*/
|
*/
|
||||||
#define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF)
|
#define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF)
|
||||||
#endif
|
#endif
|
||||||
#define uint4korr(A) (*((unsigned long *) (A)))
|
#define uint4korr(A) (*((uint32 *) (A)))
|
||||||
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
|
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
|
||||||
(((uint32) ((uchar) (A)[1])) << 8) +\
|
(((uint32) ((uchar) (A)[1])) << 8) +\
|
||||||
(((uint32) ((uchar) (A)[2])) << 16) +\
|
(((uint32) ((uchar) (A)[2])) << 16) +\
|
||||||
|
@ -370,14 +370,14 @@ int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
|
|||||||
we want to make sure that no such flags are set.
|
we want to make sure that no such flags are set.
|
||||||
*/
|
*/
|
||||||
#if defined(HAVE_SIGACTION) && !defined(my_sigset)
|
#if defined(HAVE_SIGACTION) && !defined(my_sigset)
|
||||||
#define my_sigset(A,B) do { struct sigaction s; sigset_t set; int rc; \
|
#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; int l_rc; \
|
||||||
DBUG_ASSERT((A) != 0); \
|
DBUG_ASSERT((A) != 0); \
|
||||||
sigemptyset(&set); \
|
sigemptyset(&l_set); \
|
||||||
s.sa_handler = (B); \
|
l_s.sa_handler = (B); \
|
||||||
s.sa_mask = set; \
|
l_s.sa_mask = l_set; \
|
||||||
s.sa_flags = 0; \
|
l_s.sa_flags = 0; \
|
||||||
rc= sigaction((A), &s, (struct sigaction *) NULL);\
|
l_rc= sigaction((A), &l_s, (struct sigaction *) NULL);\
|
||||||
DBUG_ASSERT(rc == 0); \
|
DBUG_ASSERT(l_rc == 0); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#elif defined(HAVE_SIGSET) && !defined(my_sigset)
|
#elif defined(HAVE_SIGSET) && !defined(my_sigset)
|
||||||
#define my_sigset(A,B) sigset((A),(B))
|
#define my_sigset(A,B) sigset((A),(B))
|
||||||
|
@ -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;
|
NEAR my_disable_flush_key_blocks, NEAR my_disable_symlinks;
|
||||||
extern char wild_many,wild_one,wild_prefix;
|
extern char wild_many,wild_one,wild_prefix;
|
||||||
extern const char *charsets_dir;
|
extern const char *charsets_dir;
|
||||||
extern char *defaults_extra_file;
|
/* from default.c */
|
||||||
extern const char *defaults_group_suffix;
|
extern char *my_defaults_extra_file;
|
||||||
extern const char *defaults_file;
|
extern const char *my_defaults_group_suffix;
|
||||||
|
extern const char *my_defaults_file;
|
||||||
|
|
||||||
extern my_bool timed_mutexes;
|
extern my_bool timed_mutexes;
|
||||||
|
|
||||||
|
@ -73,16 +73,16 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
|
|||||||
uint flags, int *was_cut);
|
uint flags, int *was_cut);
|
||||||
longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
|
longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
|
||||||
uint flags, int *was_cut);
|
uint flags, int *was_cut);
|
||||||
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *time);
|
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *);
|
||||||
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *time);
|
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *);
|
||||||
ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *time);
|
ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *);
|
||||||
ulonglong TIME_to_ulonglong(const MYSQL_TIME *time);
|
ulonglong TIME_to_ulonglong(const MYSQL_TIME *);
|
||||||
|
|
||||||
|
|
||||||
my_bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time,
|
my_bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time,
|
||||||
int *warning);
|
int *warning);
|
||||||
|
|
||||||
int check_time_range(struct st_mysql_time *time, int *warning);
|
int check_time_range(struct st_mysql_time *, int *warning);
|
||||||
|
|
||||||
long calc_daynr(uint year,uint month,uint day);
|
long calc_daynr(uint year,uint month,uint day);
|
||||||
uint calc_days_in_year(uint year);
|
uint calc_days_in_year(uint year);
|
||||||
|
@ -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(t) ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR || (t) == FIELD_TYPE_NEWDECIMAL)
|
||||||
#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
|
#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
|
||||||
#define INTERNAL_NUM_FIELD(f) (((f)->type <= FIELD_TYPE_INT24 && ((f)->type != FIELD_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == FIELD_TYPE_YEAR)
|
#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 {
|
typedef struct st_mysql_field {
|
||||||
@ -783,7 +784,7 @@ int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query,
|
|||||||
unsigned long length);
|
unsigned long length);
|
||||||
int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt);
|
int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt);
|
||||||
int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt);
|
int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt);
|
||||||
int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
|
int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg,
|
||||||
unsigned int column,
|
unsigned int column,
|
||||||
unsigned long offset);
|
unsigned long offset);
|
||||||
int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt);
|
int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt);
|
||||||
|
@ -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.
|
STMT_ATTR_UPDATE_MAX_LENGTH attribute is set.
|
||||||
*/
|
*/
|
||||||
static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data);
|
static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data);
|
||||||
static my_bool setup_one_fetch_function(MYSQL_BIND *bind, MYSQL_FIELD *field);
|
static my_bool setup_one_fetch_function(MYSQL_BIND *, MYSQL_FIELD *field);
|
||||||
|
|
||||||
/* Auxilary function used to reset statement handle. */
|
/* Auxilary function used to reset statement handle. */
|
||||||
|
|
||||||
@ -2174,7 +2174,7 @@ static void update_stmt_fields(MYSQL_STMT *stmt)
|
|||||||
MYSQL_FIELD *field= stmt->mysql->fields;
|
MYSQL_FIELD *field= stmt->mysql->fields;
|
||||||
MYSQL_FIELD *field_end= field + stmt->field_count;
|
MYSQL_FIELD *field_end= field + stmt->field_count;
|
||||||
MYSQL_FIELD *stmt_field= stmt->fields;
|
MYSQL_FIELD *stmt_field= stmt->fields;
|
||||||
MYSQL_BIND *bind= stmt->bind_result_done ? stmt->bind : 0;
|
MYSQL_BIND *my_bind= stmt->bind_result_done ? stmt->bind : 0;
|
||||||
|
|
||||||
DBUG_ASSERT(stmt->field_count == stmt->mysql->field_count);
|
DBUG_ASSERT(stmt->field_count == stmt->mysql->field_count);
|
||||||
|
|
||||||
@ -2185,10 +2185,10 @@ static void update_stmt_fields(MYSQL_STMT *stmt)
|
|||||||
stmt_field->type = field->type;
|
stmt_field->type = field->type;
|
||||||
stmt_field->flags = field->flags;
|
stmt_field->flags = field->flags;
|
||||||
stmt_field->decimals = field->decimals;
|
stmt_field->decimals = field->decimals;
|
||||||
if (bind)
|
if (my_bind)
|
||||||
{
|
{
|
||||||
/* Ignore return value: it should be 0 if bind_result succeeded. */
|
/* Ignore return value: it should be 0 if bind_result succeeded. */
|
||||||
(void) setup_one_fetch_function(bind++, stmt_field);
|
(void) setup_one_fetch_function(my_bind++, stmt_field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3014,7 +3014,7 @@ static my_bool int_is_null_false= 0;
|
|||||||
mysql_stmt_bind_param()
|
mysql_stmt_bind_param()
|
||||||
stmt statement handle
|
stmt statement handle
|
||||||
The statement must be prepared with mysql_stmt_prepare().
|
The statement must be prepared with mysql_stmt_prepare().
|
||||||
bind Array of mysql_stmt_param_count() bind parameters.
|
my_bind Array of mysql_stmt_param_count() bind parameters.
|
||||||
This function doesn't check that size of this argument
|
This function doesn't check that size of this argument
|
||||||
is >= mysql_stmt_field_count(): it's user's responsibility.
|
is >= mysql_stmt_field_count(): it's user's responsibility.
|
||||||
|
|
||||||
@ -3100,54 +3100,55 @@ static my_bool int_is_null_false= 0;
|
|||||||
members should be zero-initialized.
|
members should be zero-initialized.
|
||||||
|
|
||||||
Binding NULLs.
|
Binding NULLs.
|
||||||
You might have a column always NULL, never NULL, or sometimes NULL.
|
You might have a column always NULL, never NULL, or sometimes
|
||||||
For an always NULL column set MYSQL_BIND::buffer_type to
|
NULL. For an always NULL column set MYSQL_BIND::buffer_type to
|
||||||
MYSQL_TYPE_NULL. The rest of the members just need to be
|
MYSQL_TYPE_NULL. The rest of the members just need to be
|
||||||
zero-initialized. For never NULL columns set MYSQL_BIND::is_null to
|
zero-initialized. For never NULL columns set
|
||||||
0, or this has already been done if you zero-initialized the entire
|
MYSQL_BIND::is_null to 0, or this has already been done if you
|
||||||
structure. If you set MYSQL_TYPE::is_null to point to an
|
zero-initialized the entire structure. If you set
|
||||||
application buffer of type 'my_bool', then this buffer will be
|
MYSQL_TYPE::is_null to point to an application buffer of type
|
||||||
checked on each execution: this way you can set the buffer to TRUE,
|
'my_bool', then this buffer will be checked on each execution:
|
||||||
or any non-0 value for NULLs, and to FALSE or 0 for not NULL data.
|
this way you can set the buffer to TRUE, or any non-0 value for
|
||||||
|
NULLs, and to FALSE or 0 for not NULL data.
|
||||||
|
|
||||||
Binding text strings and sequences of bytes.
|
Binding text strings and sequences of bytes.
|
||||||
For strings, in addition to MYSQL_BIND::buffer_type and
|
For strings, in addition to MYSQL_BIND::buffer_type and
|
||||||
MYSQL_BIND::buffer you need to set MYSQL_BIND::length or
|
MYSQL_BIND::buffer you need to set MYSQL_BIND::length or
|
||||||
MYSQL_BIND::buffer_length.
|
MYSQL_BIND::buffer_length. If 'length' is set, 'buffer_length'
|
||||||
If 'length' is set, 'buffer_length' is ignored. 'buffer_length'
|
is ignored. 'buffer_length' member should be used when size of
|
||||||
member should be used when size of string doesn't change between
|
string doesn't change between executions. If you want to vary
|
||||||
executions. If you want to vary buffer length for each value, set
|
buffer length for each value, set 'length' to point to an
|
||||||
'length' to point to an application buffer of type 'unsigned long'
|
application buffer of type 'unsigned long' and set this long to
|
||||||
and set this long to length of the string before each
|
length of the string before each mysql_stmt_execute().
|
||||||
mysql_stmt_execute().
|
|
||||||
|
|
||||||
Binding dates and times.
|
Binding dates and times.
|
||||||
For binding dates and times prepared statements API provides clients
|
For binding dates and times prepared statements API provides
|
||||||
with MYSQL_TIME structure. A pointer to instance of this structure
|
clients with MYSQL_TIME structure. A pointer to instance of this
|
||||||
should be assigned to MYSQL_BIND::buffer whenever MYSQL_TYPE_TIME,
|
structure should be assigned to MYSQL_BIND::buffer whenever
|
||||||
MYSQL_TYPE_DATE, MYSQL_TYPE_DATETIME typecodes are used. When
|
MYSQL_TYPE_TIME, MYSQL_TYPE_DATE, MYSQL_TYPE_DATETIME typecodes
|
||||||
typecode is MYSQL_TYPE_TIME, only members 'hour', 'minute', 'second'
|
are used. When typecode is MYSQL_TYPE_TIME, only members
|
||||||
and 'neg' (is time offset negative) are used. These members only
|
'hour', 'minute', 'second' and 'neg' (is time offset negative)
|
||||||
will be sent to the server.
|
are used. These members only will be sent to the server.
|
||||||
MYSQL_TYPE_DATE implies use of 'year', 'month', 'day', 'neg'.
|
MYSQL_TYPE_DATE implies use of 'year', 'month', 'day', 'neg'.
|
||||||
MYSQL_TYPE_DATETIME utilizes both parts of MYSQL_TIME structure.
|
MYSQL_TYPE_DATETIME utilizes both parts of MYSQL_TIME structure.
|
||||||
You don't have to set MYSQL_TIME::time_type member: it's not used
|
You don't have to set MYSQL_TIME::time_type member: it's not
|
||||||
when sending data to the server, typecode information is enough.
|
used when sending data to the server, typecode information is
|
||||||
'second_part' member can hold microsecond precision of time value,
|
enough. 'second_part' member can hold microsecond precision of
|
||||||
but now it's only supported on protocol level: you can't store
|
time value, but now it's only supported on protocol level: you
|
||||||
microsecond in a column, or use in temporal calculations. However,
|
can't store microsecond in a column, or use in temporal
|
||||||
if you send a time value with microsecond part for 'SELECT ?',
|
calculations. However, if you send a time value with microsecond
|
||||||
statement, you'll get it back unchanged from the server.
|
part for 'SELECT ?', statement, you'll get it back unchanged
|
||||||
|
from the server.
|
||||||
|
|
||||||
Data conversion.
|
Data conversion.
|
||||||
If conversion from host language type to data representation,
|
If conversion from host language type to data representation,
|
||||||
corresponding to SQL type, is required it's done on the server.
|
corresponding to SQL type, is required it's done on the server.
|
||||||
Data truncation is possible when conversion is lossy. For example,
|
Data truncation is possible when conversion is lossy. For
|
||||||
if you supply MYSQL_TYPE_DATETIME value out of valid SQL type
|
example, if you supply MYSQL_TYPE_DATETIME value out of valid
|
||||||
TIMESTAMP range, the same conversion will be applied as if this
|
SQL type TIMESTAMP range, the same conversion will be applied as
|
||||||
value would have been sent as string in the old protocol.
|
if this value would have been sent as string in the old
|
||||||
TODO: document how the server will behave in case of truncation/data
|
protocol. TODO: document how the server will behave in case of
|
||||||
loss.
|
truncation/data loss.
|
||||||
|
|
||||||
After variables were bound, you can repeatedly set/change their
|
After variables were bound, you can repeatedly set/change their
|
||||||
values and mysql_stmt_execute() the statement.
|
values and mysql_stmt_execute() the statement.
|
||||||
@ -3175,7 +3176,7 @@ static my_bool int_is_null_false= 0;
|
|||||||
1 error, can be retrieved with mysql_stmt_error.
|
1 error, can be retrieved with mysql_stmt_error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *bind)
|
my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *my_bind)
|
||||||
{
|
{
|
||||||
uint count=0;
|
uint count=0;
|
||||||
MYSQL_BIND *param, *end;
|
MYSQL_BIND *param, *end;
|
||||||
@ -3192,7 +3193,7 @@ my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *bind)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Allocated on prepare */
|
/* Allocated on prepare */
|
||||||
memcpy((char*) stmt->params, (char*) bind,
|
memcpy((char*) stmt->params, (char*) my_bind,
|
||||||
sizeof(MYSQL_BIND) * stmt->param_count);
|
sizeof(MYSQL_BIND) * stmt->param_count);
|
||||||
|
|
||||||
for (param= stmt->params, end= param+stmt->param_count;
|
for (param= stmt->params, end= param+stmt->param_count;
|
||||||
@ -3355,8 +3356,7 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number,
|
|||||||
}
|
}
|
||||||
|
|
||||||
param= stmt->params+param_number;
|
param= stmt->params+param_number;
|
||||||
if (param->buffer_type < MYSQL_TYPE_TINY_BLOB ||
|
if (!IS_LONGDATA(param->buffer_type))
|
||||||
param->buffer_type > MYSQL_TYPE_STRING)
|
|
||||||
{
|
{
|
||||||
/* Long data handling should be used only for string/binary types */
|
/* Long data handling should be used only for string/binary types */
|
||||||
strmov(stmt->sqlstate, unknown_sqlstate);
|
strmov(stmt->sqlstate, unknown_sqlstate);
|
||||||
@ -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,
|
static void fetch_datetime_with_conversion(MYSQL_BIND *param,
|
||||||
MYSQL_FIELD *field,
|
MYSQL_FIELD *field,
|
||||||
MYSQL_TIME *time)
|
MYSQL_TIME *my_time)
|
||||||
{
|
{
|
||||||
switch (param->buffer_type) {
|
switch (param->buffer_type) {
|
||||||
case MYSQL_TYPE_NULL: /* do nothing */
|
case MYSQL_TYPE_NULL: /* do nothing */
|
||||||
break;
|
break;
|
||||||
case MYSQL_TYPE_DATE:
|
case MYSQL_TYPE_DATE:
|
||||||
*(MYSQL_TIME *)(param->buffer)= *time;
|
*(MYSQL_TIME *)(param->buffer)= *my_time;
|
||||||
*param->error= time->time_type != MYSQL_TIMESTAMP_DATE;
|
*param->error= my_time->time_type != MYSQL_TIMESTAMP_DATE;
|
||||||
break;
|
break;
|
||||||
case MYSQL_TYPE_TIME:
|
case MYSQL_TYPE_TIME:
|
||||||
*(MYSQL_TIME *)(param->buffer)= *time;
|
*(MYSQL_TIME *)(param->buffer)= *my_time;
|
||||||
*param->error= time->time_type != MYSQL_TIMESTAMP_TIME;
|
*param->error= my_time->time_type != MYSQL_TIMESTAMP_TIME;
|
||||||
break;
|
break;
|
||||||
case MYSQL_TYPE_DATETIME:
|
case MYSQL_TYPE_DATETIME:
|
||||||
case MYSQL_TYPE_TIMESTAMP:
|
case MYSQL_TYPE_TIMESTAMP:
|
||||||
*(MYSQL_TIME *)(param->buffer)= *time;
|
*(MYSQL_TIME *)(param->buffer)= *my_time;
|
||||||
/* No error: time and date are compatible with datetime */
|
/* No error: time and date are compatible with datetime */
|
||||||
break;
|
break;
|
||||||
case MYSQL_TYPE_YEAR:
|
case MYSQL_TYPE_YEAR:
|
||||||
shortstore(param->buffer, time->year);
|
shortstore(param->buffer, my_time->year);
|
||||||
*param->error= 1;
|
*param->error= 1;
|
||||||
break;
|
break;
|
||||||
case MYSQL_TYPE_FLOAT:
|
case MYSQL_TYPE_FLOAT:
|
||||||
case MYSQL_TYPE_DOUBLE:
|
case MYSQL_TYPE_DOUBLE:
|
||||||
{
|
{
|
||||||
ulonglong value= TIME_to_ulonglong(time);
|
ulonglong value= TIME_to_ulonglong(my_time);
|
||||||
fetch_float_with_conversion(param, field,
|
fetch_float_with_conversion(param, field,
|
||||||
ulonglong2double(value), DBL_DIG);
|
ulonglong2double(value), DBL_DIG);
|
||||||
break;
|
break;
|
||||||
@ -3898,7 +3898,7 @@ static void fetch_datetime_with_conversion(MYSQL_BIND *param,
|
|||||||
case MYSQL_TYPE_LONG:
|
case MYSQL_TYPE_LONG:
|
||||||
case MYSQL_TYPE_LONGLONG:
|
case MYSQL_TYPE_LONGLONG:
|
||||||
{
|
{
|
||||||
longlong value= (longlong) TIME_to_ulonglong(time);
|
longlong value= (longlong) TIME_to_ulonglong(my_time);
|
||||||
fetch_long_with_conversion(param, field, value, TRUE);
|
fetch_long_with_conversion(param, field, value, TRUE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3909,7 +3909,7 @@ static void fetch_datetime_with_conversion(MYSQL_BIND *param,
|
|||||||
fetch_string_with_conversion:
|
fetch_string_with_conversion:
|
||||||
*/
|
*/
|
||||||
char buff[MAX_DATE_STRING_REP_LENGTH];
|
char buff[MAX_DATE_STRING_REP_LENGTH];
|
||||||
uint length= my_TIME_to_str(time, buff);
|
uint length= my_TIME_to_str(my_time, buff);
|
||||||
/* Resort to string conversion */
|
/* Resort to string conversion */
|
||||||
fetch_string_with_conversion(param, (char *)buff, length);
|
fetch_string_with_conversion(param, (char *)buff, length);
|
||||||
break;
|
break;
|
||||||
@ -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)
|
static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
|
||||||
{
|
{
|
||||||
|
DBUG_ENTER("setup_one_fetch_function");
|
||||||
|
|
||||||
/* Setup data copy functions for the different supported types */
|
/* Setup data copy functions for the different supported types */
|
||||||
switch (param->buffer_type) {
|
switch (param->buffer_type) {
|
||||||
case MYSQL_TYPE_NULL: /* for dummy binds */
|
case MYSQL_TYPE_NULL: /* for dummy binds */
|
||||||
@ -4339,7 +4341,9 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
|
|||||||
param->fetch_result= fetch_result_str;
|
param->fetch_result= fetch_result_str;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return TRUE;
|
DBUG_PRINT("error", ("Unknown param->buffer_type: %u",
|
||||||
|
(uint) param->buffer_type));
|
||||||
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
if (! is_binary_compatible(param->buffer_type, field->type))
|
if (! is_binary_compatible(param->buffer_type, field->type))
|
||||||
param->fetch_result= fetch_result_with_conversion;
|
param->fetch_result= fetch_result_with_conversion;
|
||||||
@ -4408,9 +4412,10 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
|
|||||||
param->skip_result= skip_result_string;
|
param->skip_result= skip_result_string;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return TRUE;
|
DBUG_PRINT("error", ("Unknown field->type: %u", (uint) field->type));
|
||||||
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
return FALSE;
|
DBUG_RETURN(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4418,7 +4423,7 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
|
|||||||
Setup the bind buffers for resultset processing
|
Setup the bind buffers for resultset processing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
|
my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *my_bind)
|
||||||
{
|
{
|
||||||
MYSQL_BIND *param, *end;
|
MYSQL_BIND *param, *end;
|
||||||
MYSQL_FIELD *field;
|
MYSQL_FIELD *field;
|
||||||
@ -4442,8 +4447,9 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
|
|||||||
is called from mysql_stmt_store_result.
|
is called from mysql_stmt_store_result.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (stmt->bind != bind)
|
if (stmt->bind != my_bind)
|
||||||
memcpy((char*) stmt->bind, (char*) bind, sizeof(MYSQL_BIND) * bind_count);
|
memcpy((char*) stmt->bind, (char*) my_bind,
|
||||||
|
sizeof(MYSQL_BIND) * bind_count);
|
||||||
|
|
||||||
for (param= stmt->bind, end= param + bind_count, field= stmt->fields ;
|
for (param= stmt->bind, end= param + bind_count, field= stmt->fields ;
|
||||||
param < end ;
|
param < end ;
|
||||||
@ -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)
|
static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
|
||||||
{
|
{
|
||||||
MYSQL_BIND *bind, *end;
|
MYSQL_BIND *my_bind, *end;
|
||||||
MYSQL_FIELD *field;
|
MYSQL_FIELD *field;
|
||||||
uchar *null_ptr, bit;
|
uchar *null_ptr, bit;
|
||||||
int truncation_count= 0;
|
int truncation_count= 0;
|
||||||
@ -4512,11 +4518,12 @@ static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
|
|||||||
bit= 4; /* first 2 bits are reserved */
|
bit= 4; /* first 2 bits are reserved */
|
||||||
|
|
||||||
/* Copy complete row to application buffers */
|
/* Copy complete row to application buffers */
|
||||||
for (bind= stmt->bind, end= bind + stmt->field_count, field= stmt->fields ;
|
for (my_bind= stmt->bind, end= my_bind + stmt->field_count,
|
||||||
bind < end ;
|
field= stmt->fields ;
|
||||||
bind++, field++)
|
my_bind < end ;
|
||||||
|
my_bind++, field++)
|
||||||
{
|
{
|
||||||
*bind->error= 0;
|
*my_bind->error= 0;
|
||||||
if (*null_ptr & bit)
|
if (*null_ptr & bit)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -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
|
mysql_stmt_fetch_column, and in this case nullness of column will be
|
||||||
lost. See mysql_stmt_fetch_column for details.
|
lost. See mysql_stmt_fetch_column for details.
|
||||||
*/
|
*/
|
||||||
bind->row_ptr= NULL;
|
my_bind->row_ptr= NULL;
|
||||||
*bind->is_null= 1;
|
*my_bind->is_null= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*bind->is_null= 0;
|
*my_bind->is_null= 0;
|
||||||
bind->row_ptr= row;
|
my_bind->row_ptr= row;
|
||||||
(*bind->fetch_result)(bind, field, &row);
|
(*my_bind->fetch_result)(my_bind, field, &row);
|
||||||
truncation_count+= *bind->error;
|
truncation_count+= *my_bind->error;
|
||||||
}
|
}
|
||||||
if (!((bit<<=1) & 255))
|
if (!((bit<<=1) & 255))
|
||||||
{
|
{
|
||||||
@ -4591,7 +4598,7 @@ int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt)
|
|||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
mysql_stmt_fetch_column()
|
mysql_stmt_fetch_column()
|
||||||
stmt Prepared statement handler
|
stmt Prepared statement handler
|
||||||
bind Where data should be placed. Should be filled in as
|
my_bind Where data should be placed. Should be filled in as
|
||||||
when calling mysql_stmt_bind_result()
|
when calling mysql_stmt_bind_result()
|
||||||
column Column to fetch (first column is 0)
|
column Column to fetch (first column is 0)
|
||||||
ulong offset Offset in result data (to fetch blob in pieces)
|
ulong offset Offset in result data (to fetch blob in pieces)
|
||||||
@ -4601,7 +4608,7 @@ int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt)
|
|||||||
1 error
|
1 error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
|
int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *my_bind,
|
||||||
uint column, ulong offset)
|
uint column, ulong offset)
|
||||||
{
|
{
|
||||||
MYSQL_BIND *param= stmt->bind+column;
|
MYSQL_BIND *param= stmt->bind+column;
|
||||||
@ -4618,26 +4625,26 @@ int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
|
|||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bind->error)
|
if (!my_bind->error)
|
||||||
bind->error= &bind->error_value;
|
my_bind->error= &my_bind->error_value;
|
||||||
*bind->error= 0;
|
*my_bind->error= 0;
|
||||||
if (param->row_ptr)
|
if (param->row_ptr)
|
||||||
{
|
{
|
||||||
MYSQL_FIELD *field= stmt->fields+column;
|
MYSQL_FIELD *field= stmt->fields+column;
|
||||||
uchar *row= param->row_ptr;
|
uchar *row= param->row_ptr;
|
||||||
bind->offset= offset;
|
my_bind->offset= offset;
|
||||||
if (bind->is_null)
|
if (my_bind->is_null)
|
||||||
*bind->is_null= 0;
|
*my_bind->is_null= 0;
|
||||||
if (bind->length) /* Set the length if non char/binary types */
|
if (my_bind->length) /* Set the length if non char/binary types */
|
||||||
*bind->length= *param->length;
|
*my_bind->length= *param->length;
|
||||||
else
|
else
|
||||||
bind->length= ¶m->length_value; /* Needed for fetch_result() */
|
my_bind->length= ¶m->length_value; /* Needed for fetch_result() */
|
||||||
fetch_result_with_conversion(bind, field, &row);
|
fetch_result_with_conversion(my_bind, field, &row);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (bind->is_null)
|
if (my_bind->is_null)
|
||||||
*bind->is_null= 1;
|
*my_bind->is_null= 1;
|
||||||
}
|
}
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
@ -4709,7 +4716,7 @@ err:
|
|||||||
|
|
||||||
static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data)
|
static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data)
|
||||||
{
|
{
|
||||||
MYSQL_BIND *bind, *end;
|
MYSQL_BIND *my_bind, *end;
|
||||||
MYSQL_FIELD *field;
|
MYSQL_FIELD *field;
|
||||||
uchar *null_ptr, bit;
|
uchar *null_ptr, bit;
|
||||||
uchar *row= (uchar*) data->data;
|
uchar *row= (uchar*) data->data;
|
||||||
@ -4722,12 +4729,12 @@ static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data)
|
|||||||
bit= 4; /* first 2 bits are reserved */
|
bit= 4; /* first 2 bits are reserved */
|
||||||
|
|
||||||
/* Go through all fields and calculate metadata */
|
/* Go through all fields and calculate metadata */
|
||||||
for (bind= stmt->bind, end= bind + stmt->field_count, field= stmt->fields ;
|
for (my_bind= stmt->bind, end= my_bind + stmt->field_count, field= stmt->fields ;
|
||||||
bind < end ;
|
my_bind < end ;
|
||||||
bind++, field++)
|
my_bind++, field++)
|
||||||
{
|
{
|
||||||
if (!(*null_ptr & bit))
|
if (!(*null_ptr & bit))
|
||||||
(*bind->skip_result)(bind, field, &row);
|
(*my_bind->skip_result)(my_bind, field, &row);
|
||||||
DBUG_ASSERT(row <= row_end);
|
DBUG_ASSERT(row <= row_end);
|
||||||
if (!((bit<<=1) & 255))
|
if (!((bit<<=1) & 255))
|
||||||
{
|
{
|
||||||
@ -4791,16 +4798,17 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
|
|||||||
We must initalize the bind structure to be able to calculate
|
We must initalize the bind structure to be able to calculate
|
||||||
max_length
|
max_length
|
||||||
*/
|
*/
|
||||||
MYSQL_BIND *bind, *end;
|
MYSQL_BIND *my_bind, *end;
|
||||||
MYSQL_FIELD *field;
|
MYSQL_FIELD *field;
|
||||||
bzero((char*) stmt->bind, sizeof(*stmt->bind)* stmt->field_count);
|
bzero((char*) stmt->bind, sizeof(*stmt->bind)* stmt->field_count);
|
||||||
|
|
||||||
for (bind= stmt->bind, end= bind + stmt->field_count, field= stmt->fields;
|
for (my_bind= stmt->bind, end= my_bind + stmt->field_count,
|
||||||
bind < end ;
|
field= stmt->fields;
|
||||||
bind++, field++)
|
my_bind < end ;
|
||||||
|
my_bind++, field++)
|
||||||
{
|
{
|
||||||
bind->buffer_type= MYSQL_TYPE_NULL;
|
my_bind->buffer_type= MYSQL_TYPE_NULL;
|
||||||
bind->buffer_length=1;
|
my_bind->buffer_length=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mysql_stmt_bind_result(stmt, stmt->bind))
|
if (mysql_stmt_bind_result(stmt, stmt->bind))
|
||||||
|
@ -1052,7 +1052,7 @@ void Protocol_simple::prepare_for_resend()
|
|||||||
data->embedded_info->prev_ptr= &cur->next;
|
data->embedded_info->prev_ptr= &cur->next;
|
||||||
next_field=cur->data;
|
next_field=cur->data;
|
||||||
next_mysql_field= data->embedded_info->fields_list;
|
next_mysql_field= data->embedded_info->fields_list;
|
||||||
err:
|
|
||||||
DBUG_VOID_RETURN;
|
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;
|
FT_SEG_ITERATOR ftsi;
|
||||||
FTB_EXPR *ftbe;
|
FTB_EXPR *ftbe;
|
||||||
float weight=ftbw->weight;
|
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];
|
my_off_t curdoc=ftbw->docid[mode];
|
||||||
|
|
||||||
for (ftbe=ftbw->up; ftbe; ftbe=ftbe->up)
|
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)
|
if (ftbe->nos)
|
||||||
break;
|
break;
|
||||||
if (yn & FTB_FLAG_YES)
|
if (yn_flag & FTB_FLAG_YES)
|
||||||
{
|
{
|
||||||
weight /= ftbe->ythresh;
|
weight /= ftbe->ythresh;
|
||||||
ftbe->cur_weight += weight;
|
ftbe->cur_weight += weight;
|
||||||
if ((int) ++ftbe->yesses == ythresh)
|
if ((int) ++ftbe->yesses == ythresh)
|
||||||
{
|
{
|
||||||
yn=ftbe->flags;
|
yn_flag=ftbe->flags;
|
||||||
weight=ftbe->cur_weight*ftbe->weight;
|
weight=ftbe->cur_weight*ftbe->weight;
|
||||||
if (mode && ftbe->phrase)
|
if (mode && ftbe->phrase)
|
||||||
{
|
{
|
||||||
@ -531,14 +531,14 @@ static void _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (yn & FTB_FLAG_NO)
|
if (yn_flag & FTB_FLAG_NO)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
NOTE: special sort function of queue assures that all
|
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
|
events for every particular subexpression will
|
||||||
"auto-magically" happen BEFORE all the
|
"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.
|
already matched expression can become not-matched again.
|
||||||
*/
|
*/
|
||||||
++ftbe->nos;
|
++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;
|
ftbe->cur_weight += weight;
|
||||||
if ((int) ftbe->yesses < ythresh)
|
if ((int) ftbe->yesses < ythresh)
|
||||||
break;
|
break;
|
||||||
if (!(yn & FTB_FLAG_WONLY))
|
if (!(yn_flag & FTB_FLAG_WONLY))
|
||||||
yn= ((int) ftbe->yesses++ == ythresh) ? ftbe->flags : FTB_FLAG_WONLY ;
|
yn_flag= ((int) ftbe->yesses++ == ythresh) ? ftbe->flags : FTB_FLAG_WONLY ;
|
||||||
weight*= ftbe->weight;
|
weight*= ftbe->weight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -364,11 +364,11 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint j;
|
uint k;
|
||||||
share->keyinfo[i].seg=pos;
|
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;
|
pos[0].language= pos[-1].language;
|
||||||
if (!(pos[0].charset= pos[-1].charset))
|
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
|
else
|
||||||
{
|
{
|
||||||
/* We have to compare k and vseg as if they were space extended */
|
/* We have to compare k and vseg as if they were space extended */
|
||||||
uchar *end= k+ (cmplen - len);
|
uchar *k_end= k+ (cmplen - len);
|
||||||
for ( ; k < end && *k == ' '; k++) ;
|
for ( ; k < k_end && *k == ' '; k++) ;
|
||||||
if (k == end)
|
if (k == k_end)
|
||||||
goto cmp_rest; /* should never happen */
|
goto cmp_rest; /* should never happen */
|
||||||
if (*k < (uchar) ' ')
|
if (*k < (uchar) ' ')
|
||||||
{
|
{
|
||||||
@ -484,15 +484,15 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
|
|||||||
}
|
}
|
||||||
else if (len > cmplen)
|
else if (len > cmplen)
|
||||||
{
|
{
|
||||||
uchar *end;
|
uchar *vseg_end;
|
||||||
if ((nextflag & SEARCH_PREFIX) && key_len_left == 0)
|
if ((nextflag & SEARCH_PREFIX) && key_len_left == 0)
|
||||||
goto fix_flag;
|
goto fix_flag;
|
||||||
|
|
||||||
/* We have to compare k and vseg as if they were space extended */
|
/* We have to compare k and vseg as if they were space extended */
|
||||||
for (end=vseg + (len-cmplen) ;
|
for (vseg_end= vseg + (len-cmplen) ;
|
||||||
vseg < end && *vseg == (uchar) ' ';
|
vseg < vseg_end && *vseg == (uchar) ' ';
|
||||||
vseg++, matched++) ;
|
vseg++, matched++) ;
|
||||||
DBUG_ASSERT(vseg < end);
|
DBUG_ASSERT(vseg < vseg_end);
|
||||||
|
|
||||||
if (*vseg > (uchar) ' ')
|
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,
|
if (_mi_search_next(info,info->s->keyinfo+def->key, info->lastkey,
|
||||||
MI_UNIQUE_HASH_LENGTH, SEARCH_BIGGER,
|
MI_UNIQUE_HASH_LENGTH, SEARCH_BIGGER,
|
||||||
info->s->state.key_root[def->key]) ||
|
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->page_changed=1; /* Can't optimize read next */
|
||||||
info->lastpos=lastpos;
|
info->lastpos=lastpos;
|
||||||
|
@ -2689,8 +2689,9 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
|
|||||||
}
|
}
|
||||||
case FIELD_VARCHAR:
|
case FIELD_VARCHAR:
|
||||||
{
|
{
|
||||||
uint pack_length= HA_VARCHAR_PACKLENGTH(count->field_length-1);
|
uint var_pack_length= HA_VARCHAR_PACKLENGTH(count->field_length-1);
|
||||||
ulong col_length= (pack_length == 1 ? (uint) *(uchar*) start_pos :
|
ulong col_length= (var_pack_length == 1 ?
|
||||||
|
(uint) *(uchar*) start_pos :
|
||||||
uint2korr(start_pos));
|
uint2korr(start_pos));
|
||||||
/* Empty varchar are encoded with a single 1 bit. */
|
/* Empty varchar are encoded with a single 1 bit. */
|
||||||
if (!col_length)
|
if (!col_length)
|
||||||
@ -2700,7 +2701,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
|
|||||||
}
|
}
|
||||||
else
|
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"));
|
DBUG_PRINT("fields", ("FIELD_VARCHAR not empty, bits: 1"));
|
||||||
write_bits(0,1);
|
write_bits(0,1);
|
||||||
/* Write the varchar length. */
|
/* 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));
|
col_length, count->length_bits));
|
||||||
write_bits(col_length,count->length_bits);
|
write_bits(col_length,count->length_bits);
|
||||||
/* Encode the varchar bytes. */
|
/* 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",
|
DBUG_PRINT("fields",
|
||||||
("value: 0x%02x code: 0x%s bits: %2u bin: %s",
|
("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)
|
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)
|
if ((old_root = _mi_new(info, keyinfo, DFLT_INIT_HITS)) == HA_OFFSET_ERROR)
|
||||||
return -1;
|
return -1;
|
||||||
info->buff_used = 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)
|
for (i = 0; i < ReinsertList.n_pages; ++i)
|
||||||
{
|
{
|
||||||
uchar *page_buf;
|
uchar *page_buf;
|
||||||
uint nod_flag;
|
|
||||||
uchar *k;
|
uchar *k;
|
||||||
uchar *last;
|
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))
|
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 keyno=info->key;
|
||||||
uint key_length, ref_length=index->s->rec_reflength;
|
uint key_length, ref_length=idx->s->rec_reflength;
|
||||||
|
|
||||||
if (!no_messages)
|
if (!no_messages)
|
||||||
printf(" - Adding exceptions\n"); /* purecov: tested */
|
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,
|
&& !my_b_read(&tempfile_for_exceptions,(byte*)sort_keys,
|
||||||
(uint) key_length))
|
(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;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,8 +236,10 @@ sub mtr_report_stats ($) {
|
|||||||
"the documentation at\n",
|
"the documentation at\n",
|
||||||
"http://www.mysql.com/doc/en/MySQL_test_suite.html\n";
|
"http://www.mysql.com/doc/en/MySQL_test_suite.html\n";
|
||||||
}
|
}
|
||||||
print
|
if (!$::opt_extern)
|
||||||
"The servers were restarted $tot_restarts times\n";
|
{
|
||||||
|
print "The servers where restarted $tot_restarts times\n";
|
||||||
|
}
|
||||||
|
|
||||||
if ( $::opt_timer )
|
if ( $::opt_timer )
|
||||||
{
|
{
|
||||||
|
@ -699,6 +699,8 @@ sub command_line_setup () {
|
|||||||
"$glob_basedir/client",
|
"$glob_basedir/client",
|
||||||
"$glob_basedir/bin");
|
"$glob_basedir/bin");
|
||||||
|
|
||||||
|
if (!$opt_extern)
|
||||||
|
{
|
||||||
$exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
|
$exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
|
||||||
"$glob_basedir/sql/mysqld",
|
"$glob_basedir/sql/mysqld",
|
||||||
"$path_client_bindir/mysqld-max-nt",
|
"$path_client_bindir/mysqld-max-nt",
|
||||||
@ -713,6 +715,14 @@ sub command_line_setup () {
|
|||||||
|
|
||||||
# Use the mysqld found above to find out what features are available
|
# Use the mysqld found above to find out what features are available
|
||||||
collect_mysqld_features();
|
collect_mysqld_features();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mysqld_variables{'port'}= 3306;
|
||||||
|
$mysqld_variables{'master-port'}= 3306;
|
||||||
|
$opt_skip_ndbcluster= 1;
|
||||||
|
$opt_skip_im= 1;
|
||||||
|
}
|
||||||
|
|
||||||
if ( $opt_comment )
|
if ( $opt_comment )
|
||||||
{
|
{
|
||||||
@ -749,7 +759,7 @@ sub command_line_setup () {
|
|||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# NOTE if the default binlog format is changed, this has to be changed
|
# NOTE if the default binlog format is changed, this has to be changed
|
||||||
$used_binlog_format= "stmt";
|
$used_binlog_format= "stmt";
|
||||||
if ( $mysql_version_id >= 50100 )
|
if (!$opt_extern && $mysql_version_id >= 50100 )
|
||||||
{
|
{
|
||||||
$used_binlog_format= "mixed"; # Default value for binlog format
|
$used_binlog_format= "mixed"; # Default value for binlog format
|
||||||
|
|
||||||
@ -835,19 +845,20 @@ sub command_line_setup () {
|
|||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# Check im suport
|
# Check im suport
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
if ( $mysql_version_id < 50000 )
|
if (!$opt_extern)
|
||||||
{
|
{
|
||||||
|
if ( $mysql_version_id < 50000 ) {
|
||||||
# Instance manager is not supported until 5.0
|
# Instance manager is not supported until 5.0
|
||||||
$opt_skip_im= 1;
|
$opt_skip_im= 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $glob_win32 )
|
if ( $glob_win32 ) {
|
||||||
{
|
|
||||||
mtr_report("Disable Instance manager - not supported on Windows");
|
mtr_report("Disable Instance manager - not supported on Windows");
|
||||||
$opt_skip_im= 1;
|
$opt_skip_im= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# Record flag
|
# Record flag
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
@ -1211,7 +1222,7 @@ sub command_line_setup () {
|
|||||||
$opt_skip_rpl= 1;
|
$opt_skip_rpl= 1;
|
||||||
|
|
||||||
# Setup master->[0] with the settings for the extern server
|
# Setup master->[0] with the settings for the extern server
|
||||||
$master->[0]->{'path_sock'}= $opt_socket if $opt_socket;
|
$master->[0]->{'path_sock'}= $opt_socket ? $opt_socket : "/tmp/mysql.sock";
|
||||||
mtr_report("Using extern server at '$master->[0]->{path_sock}'");
|
mtr_report("Using extern server at '$master->[0]->{path_sock}'");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1477,21 +1488,19 @@ sub executable_setup () {
|
|||||||
$exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
|
$exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
|
||||||
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
|
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
|
||||||
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
|
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
|
||||||
if ( $mysql_version_id >= 50100 )
|
|
||||||
|
if (!$opt_extern)
|
||||||
{
|
{
|
||||||
|
if ( $mysql_version_id >= 50100 ) {
|
||||||
$exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
|
$exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
|
||||||
}
|
}
|
||||||
if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server )
|
if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server ) {
|
||||||
{
|
|
||||||
$exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade")
|
$exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade")
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$exe_mysql_upgrade= "";
|
$exe_mysql_upgrade= "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $glob_win32 )
|
if ( ! $glob_win32 ) {
|
||||||
{
|
|
||||||
# Look for mysql_fix_system_table script
|
# Look for mysql_fix_system_table script
|
||||||
$exe_mysql_fix_system_tables=
|
$exe_mysql_fix_system_tables=
|
||||||
mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
|
mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
|
||||||
@ -1503,20 +1512,17 @@ sub executable_setup () {
|
|||||||
mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql",
|
mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql",
|
||||||
"$glob_basedir/share/mysql_fix_privilege_tables.sql");
|
"$glob_basedir/share/mysql_fix_privilege_tables.sql");
|
||||||
|
|
||||||
if ( ! $opt_skip_ndbcluster and executable_setup_ndb())
|
if ( ! $opt_skip_ndbcluster and executable_setup_ndb()) {
|
||||||
{
|
|
||||||
mtr_warning("Could not find all required ndb binaries, " .
|
mtr_warning("Could not find all required ndb binaries, " .
|
||||||
"all ndb tests will fail, use --skip-ndbcluster to " .
|
"all ndb tests will fail, use --skip-ndbcluster to " .
|
||||||
"skip testing it.");
|
"skip testing it.");
|
||||||
|
|
||||||
foreach my $cluster (@{$clusters})
|
foreach my $cluster (@{$clusters}) {
|
||||||
{
|
|
||||||
$cluster->{"executable_setup_failed"}= 1;
|
$cluster->{"executable_setup_failed"}= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $opt_skip_im and executable_setup_im())
|
if ( ! $opt_skip_im and executable_setup_im()) {
|
||||||
{
|
|
||||||
mtr_warning("Could not find all required instance manager binaries, " .
|
mtr_warning("Could not find all required instance manager binaries, " .
|
||||||
"all im tests will fail, use --skip-im to " .
|
"all im tests will fail, use --skip-im to " .
|
||||||
"continue without instance manager");
|
"continue without instance manager");
|
||||||
@ -1528,6 +1534,7 @@ sub executable_setup () {
|
|||||||
mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
|
mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
|
||||||
"$glob_basedir/sql/.libs/udf_example.so",);
|
"$glob_basedir/sql/.libs/udf_example.so",);
|
||||||
|
|
||||||
|
}
|
||||||
# Look for mysqltest executable
|
# Look for mysqltest executable
|
||||||
if ( $glob_use_embedded_server )
|
if ( $glob_use_embedded_server )
|
||||||
{
|
{
|
||||||
@ -1593,7 +1600,7 @@ sub mysql_client_test_arguments()
|
|||||||
mtr_add_arg($args, "--port=$master->[0]->{'port'}");
|
mtr_add_arg($args, "--port=$master->[0]->{'port'}");
|
||||||
mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}");
|
mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}");
|
||||||
|
|
||||||
if ( $mysql_version_id >= 50000 )
|
if ( $opt_extern || $mysql_version_id >= 50000 )
|
||||||
{
|
{
|
||||||
mtr_add_arg($args, "--vardir=$opt_vardir")
|
mtr_add_arg($args, "--vardir=$opt_vardir")
|
||||||
}
|
}
|
||||||
@ -1704,7 +1711,7 @@ sub environment_setup () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ENV{'LD_LIBRARY_PATH'}= join(":", @ld_library_paths,
|
$ENV{'LD_LIBRARY_PATH'}= join(":", @ld_library_paths,
|
||||||
$ENV{'LD_LIBRARY_PATHS'} ?
|
$ENV{'LD_LIBRARY_PATH'} ?
|
||||||
split(':', $ENV{'LD_LIBRARY_PATH'}) : ());
|
split(':', $ENV{'LD_LIBRARY_PATH'}) : ());
|
||||||
mtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}");
|
mtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}");
|
||||||
|
|
||||||
@ -1885,7 +1892,7 @@ sub environment_setup () {
|
|||||||
my $cmdline_mysqlbinlog=
|
my $cmdline_mysqlbinlog=
|
||||||
"$exe_mysqlbinlog" .
|
"$exe_mysqlbinlog" .
|
||||||
" --no-defaults --local-load=$opt_tmpdir";
|
" --no-defaults --local-load=$opt_tmpdir";
|
||||||
if ( $mysql_version_id >= 50000 )
|
if (!$opt_extern && $mysql_version_id >= 50000 )
|
||||||
{
|
{
|
||||||
$cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
|
$cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
|
||||||
}
|
}
|
||||||
@ -1916,7 +1923,7 @@ sub environment_setup () {
|
|||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
# Setup env so childs can execute mysql_upgrade
|
# Setup env so childs can execute mysql_upgrade
|
||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
if ( $mysql_version_id >= 50000 )
|
if ( !$opt_extern && $mysql_version_id >= 50000 )
|
||||||
{
|
{
|
||||||
$ENV{'MYSQL_UPGRADE'}= mysql_upgrade_arguments();
|
$ENV{'MYSQL_UPGRADE'}= mysql_upgrade_arguments();
|
||||||
}
|
}
|
||||||
@ -1924,7 +1931,7 @@ sub environment_setup () {
|
|||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
# Setup env so childs can execute mysql_fix_system_tables
|
# Setup env so childs can execute mysql_fix_system_tables
|
||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
if ( ! $glob_win32 )
|
if ( !$opt_extern && ! $glob_win32 )
|
||||||
{
|
{
|
||||||
my $cmdline_mysql_fix_system_tables=
|
my $cmdline_mysql_fix_system_tables=
|
||||||
"$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
|
"$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
|
||||||
@ -1934,7 +1941,10 @@ sub environment_setup () {
|
|||||||
"--socket=$master->[0]->{'path_sock'}";
|
"--socket=$master->[0]->{'path_sock'}";
|
||||||
$ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
|
$ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
|
||||||
}
|
}
|
||||||
|
if (!$opt_extern)
|
||||||
|
{
|
||||||
$ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables;
|
$ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables;
|
||||||
|
}
|
||||||
|
|
||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
# Setup env so childs can execute my_print_defaults
|
# Setup env so childs can execute my_print_defaults
|
||||||
@ -2237,8 +2247,11 @@ sub check_ssl_support ($) {
|
|||||||
my $mysqld_variables= shift;
|
my $mysqld_variables= shift;
|
||||||
|
|
||||||
if ($opt_skip_ssl || $opt_extern)
|
if ($opt_skip_ssl || $opt_extern)
|
||||||
|
{
|
||||||
|
if (!$opt_extern)
|
||||||
{
|
{
|
||||||
mtr_report("Skipping SSL");
|
mtr_report("Skipping SSL");
|
||||||
|
}
|
||||||
$opt_ssl_supported= 0;
|
$opt_ssl_supported= 0;
|
||||||
$opt_ssl= 0;
|
$opt_ssl= 0;
|
||||||
return;
|
return;
|
||||||
@ -2313,9 +2326,12 @@ sub vs_config_dirs ($$) {
|
|||||||
sub check_ndbcluster_support ($) {
|
sub check_ndbcluster_support ($) {
|
||||||
my $mysqld_variables= shift;
|
my $mysqld_variables= shift;
|
||||||
|
|
||||||
if ($opt_skip_ndbcluster)
|
if ($opt_skip_ndbcluster || $opt_extern)
|
||||||
|
{
|
||||||
|
if (!$opt_extern)
|
||||||
{
|
{
|
||||||
mtr_report("Skipping ndbcluster");
|
mtr_report("Skipping ndbcluster");
|
||||||
|
}
|
||||||
$opt_skip_ndbcluster_slave= 1;
|
$opt_skip_ndbcluster_slave= 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2730,10 +2746,13 @@ sub initialize_servers () {
|
|||||||
setup_vardir();
|
setup_vardir();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if ($opt_verbose)
|
||||||
{
|
{
|
||||||
mtr_report("No need to create '$opt_vardir' it already exists");
|
mtr_report("No need to create '$opt_vardir' it already exists");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
kill_running_servers();
|
kill_running_servers();
|
||||||
@ -3128,19 +3147,19 @@ sub do_before_run_mysqltest($)
|
|||||||
unlink("$result_dir/$tname.log");
|
unlink("$result_dir/$tname.log");
|
||||||
unlink("$result_dir/$tname.warnings");
|
unlink("$result_dir/$tname.warnings");
|
||||||
|
|
||||||
if ( $mysql_version_id < 50000 )
|
if (!$opt_extern)
|
||||||
{
|
{
|
||||||
|
if ( $mysql_version_id < 50000 ) {
|
||||||
# Set environment variable NDB_STATUS_OK to 1
|
# Set environment variable NDB_STATUS_OK to 1
|
||||||
# if script decided to run mysqltest cluster _is_ installed ok
|
# if script decided to run mysqltest cluster _is_ installed ok
|
||||||
$ENV{'NDB_STATUS_OK'} = "1";
|
$ENV{'NDB_STATUS_OK'} = "1";
|
||||||
}
|
} elsif ( $mysql_version_id < 50100 ) {
|
||||||
elsif ( $mysql_version_id < 50100 )
|
|
||||||
{
|
|
||||||
# Set environment variable NDB_STATUS_OK to YES
|
# Set environment variable NDB_STATUS_OK to YES
|
||||||
# if script decided to run mysqltest cluster _is_ installed ok
|
# if script decided to run mysqltest cluster _is_ installed ok
|
||||||
$ENV{'NDB_STATUS_OK'} = "YES";
|
$ENV{'NDB_STATUS_OK'} = "YES";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sub do_after_run_mysqltest($)
|
sub do_after_run_mysqltest($)
|
||||||
{
|
{
|
||||||
@ -4916,7 +4935,7 @@ sub usage ($) {
|
|||||||
print STDERR "$message\n";
|
print STDERR "$message\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print STDERR <<HERE;
|
print <<HERE;
|
||||||
|
|
||||||
$0 [ OPTIONS ] [ TESTCASE ]
|
$0 [ OPTIONS ] [ TESTCASE ]
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
set timestamp=1000000000;
|
set timestamp=1000000000;
|
||||||
drop table if exists t1,t2;
|
drop table if exists t1,t2,t3,t4,t5,t03,t04;
|
||||||
create table t1 (word varchar(20));
|
create table t1 (word varchar(20));
|
||||||
create table t2 (id int auto_increment not null primary key);
|
create table t2 (id int auto_increment not null primary key);
|
||||||
insert into t1 values ("abirvalg");
|
insert into t1 values ("abirvalg");
|
||||||
@ -23,7 +23,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
|
|||||||
SET @@session.sql_mode=0/*!*/;
|
SET @@session.sql_mode=0/*!*/;
|
||||||
/*!\C latin1 *//*!*/;
|
/*!\C latin1 *//*!*/;
|
||||||
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||||
drop table if exists t1,t2/*!*/;
|
drop table if exists t1,t2,t3,t4,t5,t03,t04/*!*/;
|
||||||
SET TIMESTAMP=1000000000/*!*/;
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
create table t1 (word varchar(20))/*!*/;
|
create table t1 (word varchar(20))/*!*/;
|
||||||
SET TIMESTAMP=1000000000/*!*/;
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
@ -100,7 +100,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
|
|||||||
SET @@session.sql_mode=0/*!*/;
|
SET @@session.sql_mode=0/*!*/;
|
||||||
/*!\C latin1 *//*!*/;
|
/*!\C latin1 *//*!*/;
|
||||||
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||||
drop table if exists t1,t2/*!*/;
|
drop table if exists t1,t2,t3,t4,t5,t03,t04/*!*/;
|
||||||
SET TIMESTAMP=1000000000/*!*/;
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
create table t1 (word varchar(20))/*!*/;
|
create table t1 (word varchar(20))/*!*/;
|
||||||
SET TIMESTAMP=1000000000/*!*/;
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
@ -192,6 +192,7 @@ DELIMITER ;
|
|||||||
# End of log file
|
# End of log file
|
||||||
ROLLBACK /* added by mysqlbinlog */;
|
ROLLBACK /* added by mysqlbinlog */;
|
||||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||||
|
drop table t1,t2;
|
||||||
flush logs;
|
flush logs;
|
||||||
create table t3 (f text character set utf8);
|
create table t3 (f text character set utf8);
|
||||||
create table t4 (f text character set cp932);
|
create table t4 (f text character set cp932);
|
||||||
@ -209,13 +210,14 @@ HEX(f)
|
|||||||
select HEX(f) from t4;
|
select HEX(f) from t4;
|
||||||
HEX(f)
|
HEX(f)
|
||||||
835C
|
835C
|
||||||
|
drop table t3,t4,t03,t04;
|
||||||
flush logs;
|
flush logs;
|
||||||
select * from t5 /* must be (1),(1) */;
|
select * from t5 /* must be (1),(1) */;
|
||||||
a
|
a
|
||||||
1
|
1
|
||||||
1
|
1
|
||||||
|
drop table t5;
|
||||||
flush logs;
|
flush logs;
|
||||||
drop table if exists t5;
|
|
||||||
create table t5 (c1 int, c2 varchar(128) character set latin1 not null);
|
create table t5 (c1 int, c2 varchar(128) character set latin1 not null);
|
||||||
insert into t5 values (1, date_format('2001-01-01','%W'));
|
insert into t5 values (1, date_format('2001-01-01','%W'));
|
||||||
set lc_time_names=de_DE;
|
set lc_time_names=de_DE;
|
||||||
@ -234,6 +236,7 @@ c1 c2
|
|||||||
1 Monday
|
1 Monday
|
||||||
2 Montag
|
2 Montag
|
||||||
3 Monday
|
3 Monday
|
||||||
|
drop table t5;
|
||||||
drop procedure if exists p1;
|
drop procedure if exists p1;
|
||||||
flush logs;
|
flush logs;
|
||||||
create procedure p1()
|
create procedure p1()
|
||||||
@ -269,4 +272,3 @@ call p1();
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
drop procedure p1;
|
drop procedure p1;
|
||||||
drop table t1, t2, t03, t04, t3, t4, t5;
|
|
||||||
|
@ -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.columns_priv OK
|
||||||
mysql.db OK
|
mysql.db OK
|
||||||
mysql.func OK
|
mysql.func OK
|
||||||
|
@ -422,6 +422,8 @@ mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 7: Con
|
|||||||
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 3: connection 'test_con1' not found in connection pool
|
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 3: connection 'test_con1' not found in connection pool
|
||||||
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 2: Connection test_con1 already exists
|
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 2: Connection test_con1 already exists
|
||||||
connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
|
connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
|
||||||
|
show tables;
|
||||||
|
ERROR 3D000: No database selected
|
||||||
Output from mysqltest-x.inc
|
Output from mysqltest-x.inc
|
||||||
Output from mysqltest-x.inc
|
Output from mysqltest-x.inc
|
||||||
Output from mysqltest-x.inc
|
Output from mysqltest-x.inc
|
||||||
|
@ -6,7 +6,7 @@ select 1;
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
select 2;
|
select 2;
|
||||||
ERROR HY000: MySQL server has gone away
|
Got one of the listed errors
|
||||||
select 3;
|
select 3;
|
||||||
3
|
3
|
||||||
3
|
3
|
||||||
@ -14,7 +14,7 @@ select 1;
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
select 2;
|
select 2;
|
||||||
ERROR HY000: MySQL server has gone away
|
Got one of the listed errors
|
||||||
select 3;
|
select 3;
|
||||||
3
|
3
|
||||||
3
|
3
|
||||||
|
@ -44,7 +44,7 @@ unlock tables;
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG#16217 - MySQL client misinterpretes multi-byte char as escape `\'
|
# BUG#16217 - MySQL client misinterprets multi-byte char as escape `\'
|
||||||
#
|
#
|
||||||
|
|
||||||
# new command \C or charset
|
# new command \C or charset
|
||||||
@ -262,4 +262,14 @@ drop table t17583;
|
|||||||
--exec echo "DELIMITER \\\\" > $MYSQLTEST_VARDIR/tmp/bug21412.sql
|
--exec echo "DELIMITER \\\\" > $MYSQLTEST_VARDIR/tmp/bug21412.sql
|
||||||
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
|
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
|
||||||
|
|
||||||
|
#
|
||||||
|
# Some coverage of not normally used parts
|
||||||
|
#
|
||||||
|
|
||||||
|
--disable_query_log
|
||||||
|
--exec $MYSQL test -e "show status" 2>&1 > /dev/null
|
||||||
|
--exec $MYSQL --help 2>&1 > /dev/null
|
||||||
|
--exec $MYSQL --version 2>&1 > /dev/null
|
||||||
|
--enable_quary_log
|
||||||
|
|
||||||
--echo End of 5.0 tests
|
--echo End of 5.0 tests
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
set timestamp=1000000000;
|
set timestamp=1000000000;
|
||||||
|
|
||||||
--disable_warnings
|
--disable_warnings
|
||||||
drop table if exists t1,t2;
|
drop table if exists t1,t2,t3,t4,t5,t03,t04;
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
|
|
||||||
create table t1 (word varchar(20));
|
create table t1 (word varchar(20));
|
||||||
@ -106,8 +106,11 @@ select "--- reading stdin --" as "";
|
|||||||
|
|
||||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||||
--exec $MYSQL_BINLOG --short-form --position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
|
--exec $MYSQL_BINLOG --short-form --position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
|
||||||
|
drop table t1,t2;
|
||||||
|
|
||||||
|
#
|
||||||
# Bug#16217 (mysql client did not know how not switch its internal charset)
|
# Bug#16217 (mysql client did not know how not switch its internal charset)
|
||||||
|
#
|
||||||
flush logs;
|
flush logs;
|
||||||
create table t3 (f text character set utf8);
|
create table t3 (f text character set utf8);
|
||||||
create table t4 (f text character set cp932);
|
create table t4 (f text character set cp932);
|
||||||
@ -121,6 +124,7 @@ select HEX(f) from t03;
|
|||||||
select HEX(f) from t3;
|
select HEX(f) from t3;
|
||||||
select HEX(f) from t04;
|
select HEX(f) from t04;
|
||||||
select HEX(f) from t4;
|
select HEX(f) from t4;
|
||||||
|
drop table t3,t4,t03,t04;
|
||||||
|
|
||||||
#
|
#
|
||||||
#BUG#14157: utf8 encoding in binlog without set character_set_client
|
#BUG#14157: utf8 encoding in binlog without set character_set_client
|
||||||
@ -133,6 +137,7 @@ flush logs;
|
|||||||
# should use default-character-set same as the server.
|
# should use default-character-set same as the server.
|
||||||
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL
|
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL
|
||||||
select * from t5 /* must be (1),(1) */;
|
select * from t5 /* must be (1),(1) */;
|
||||||
|
drop table t5;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug#22645 LC_TIME_NAMES: Statement not replicated
|
# Bug#22645 LC_TIME_NAMES: Statement not replicated
|
||||||
@ -140,7 +145,6 @@ select * from t5 /* must be (1),(1) */;
|
|||||||
# lc_time_names dependent values correctly
|
# lc_time_names dependent values correctly
|
||||||
#
|
#
|
||||||
flush logs;
|
flush logs;
|
||||||
drop table if exists t5;
|
|
||||||
create table t5 (c1 int, c2 varchar(128) character set latin1 not null);
|
create table t5 (c1 int, c2 varchar(128) character set latin1 not null);
|
||||||
insert into t5 values (1, date_format('2001-01-01','%W'));
|
insert into t5 values (1, date_format('2001-01-01','%W'));
|
||||||
set lc_time_names=de_DE;
|
set lc_time_names=de_DE;
|
||||||
@ -152,6 +156,8 @@ flush logs;
|
|||||||
drop table t5;
|
drop table t5;
|
||||||
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007 | $MYSQL
|
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007 | $MYSQL
|
||||||
select * from t5 order by c1;
|
select * from t5 order by c1;
|
||||||
|
drop table t5;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails
|
# Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails
|
||||||
#
|
#
|
||||||
@ -176,7 +182,12 @@ call p1();
|
|||||||
call p1();
|
call p1();
|
||||||
drop procedure p1;
|
drop procedure p1;
|
||||||
|
|
||||||
# clean up
|
#
|
||||||
drop table t1, t2, t03, t04, t3, t4, t5;
|
# Some coverage of not normally used parts
|
||||||
|
#
|
||||||
|
--disable_query_log
|
||||||
|
--exec $MYSQL_BINLOG --version 2>&1 > /dev/null
|
||||||
|
--exec $MYSQL_BINLOG --help 2>&1 > /dev/null
|
||||||
|
--enable_query_log
|
||||||
|
|
||||||
# End of 5.0 tests
|
# End of 5.0 tests
|
||||||
|
@ -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
|
# Embedded server doesn't support external clients
|
||||||
--source include/not_embedded.inc
|
--source include/not_embedded.inc
|
||||||
|
|
||||||
|
@ -1276,8 +1276,16 @@ EOF
|
|||||||
connect (con1,localhost,root,,);
|
connect (con1,localhost,root,,);
|
||||||
connection default;
|
connection default;
|
||||||
connection con1;
|
connection con1;
|
||||||
|
disconnect con1;
|
||||||
--enable_abort_on_error
|
--enable_abort_on_error
|
||||||
|
|
||||||
|
# Test connect without a database
|
||||||
|
connect (con2,localhost,root,,*NO-ONE*);
|
||||||
|
--error ER_NO_DB_ERROR
|
||||||
|
show tables;
|
||||||
|
disconnect con2;
|
||||||
|
connection default;
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
# Test mysqltest arguments
|
# Test mysqltest arguments
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
@ -1635,5 +1643,17 @@ EOF
|
|||||||
|
|
||||||
--exec echo "echo Some output; exit; echo Not this;" | $MYSQL_TEST 2>&1
|
--exec echo "echo Some output; exit; echo Not this;" | $MYSQL_TEST 2>&1
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Some coverage tests
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
--disable_query_log
|
||||||
|
--exec $MYSQL_TEST --help 2>&1 > /dev/null
|
||||||
|
--exec $MYSQL_TEST --version 2>&1 > /dev/null
|
||||||
|
--enable_quary_log
|
||||||
|
--disable_abort_on_error
|
||||||
|
--error 1
|
||||||
|
--exec $MYSQL_TEST a b c 2>&1 > /dev/null
|
||||||
|
--enable_abort_on_error
|
||||||
|
|
||||||
--echo End of tests
|
--echo End of tests
|
||||||
|
@ -149,7 +149,7 @@ begin;
|
|||||||
# Have to check with pk access here since scans take locks on
|
# Have to check with pk access here since scans take locks on
|
||||||
# all rows and then release them in chunks
|
# all rows and then release them in chunks
|
||||||
select * from t1 where x = 1 for update;
|
select * from t1 where x = 1 for update;
|
||||||
--error 1205
|
--error 1105,1205
|
||||||
select * from t1 where x = 2 for update;
|
select * from t1 where x = 2 for update;
|
||||||
rollback;
|
rollback;
|
||||||
|
|
||||||
|
@ -46,7 +46,8 @@ while (!`select @aborted_clients`)
|
|||||||
connection default;
|
connection default;
|
||||||
# When the connection is closed in this way, the error code should
|
# When the connection is closed in this way, the error code should
|
||||||
# be consistent see bug#2845 for an explanation
|
# be consistent see bug#2845 for an explanation
|
||||||
--error 2006
|
# depending on platform/client, either errno 2006 or 2013 can occur below
|
||||||
|
--error 2006,2013
|
||||||
select 2;
|
select 2;
|
||||||
--enable_reconnect
|
--enable_reconnect
|
||||||
select 3;
|
select 3;
|
||||||
@ -90,7 +91,8 @@ while (!`select @aborted_clients`)
|
|||||||
connection con1;
|
connection con1;
|
||||||
# When the connection is closed in this way, the error code should
|
# When the connection is closed in this way, the error code should
|
||||||
# be consistent see bug#2845 for an explanation
|
# be consistent see bug#2845 for an explanation
|
||||||
--error 2006
|
# depending on platform/client, either errno 2006 or 2013 can occur below
|
||||||
|
--error 2006,2013
|
||||||
select 2;
|
select 2;
|
||||||
--enable_reconnect
|
--enable_reconnect
|
||||||
select 3;
|
select 3;
|
||||||
|
@ -41,9 +41,9 @@
|
|||||||
#include <winbase.h>
|
#include <winbase.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *defaults_file=0;
|
const char *my_defaults_file=0;
|
||||||
const char *defaults_group_suffix=0;
|
const char *my_defaults_group_suffix=0;
|
||||||
char *defaults_extra_file=0;
|
char *my_defaults_extra_file=0;
|
||||||
|
|
||||||
/* Which directories are searched for options (and in which order) */
|
/* Which directories are searched for options (and in which order) */
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ static char *remove_end_comment(char *ptr);
|
|||||||
0 ok
|
0 ok
|
||||||
1 given cinf_file doesn't exist
|
1 given cinf_file doesn't exist
|
||||||
|
|
||||||
The global variable 'defaults_group_suffix' is updated with value for
|
The global variable 'my_defaults_group_suffix' is updated with value for
|
||||||
--defaults_group_suffix
|
--defaults_group_suffix
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -132,28 +132,28 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
|
|||||||
*args_used+= get_defaults_options(*argc - *args_used, *argv + *args_used,
|
*args_used+= get_defaults_options(*argc - *args_used, *argv + *args_used,
|
||||||
(char **) &forced_default_file,
|
(char **) &forced_default_file,
|
||||||
(char **) &forced_extra_defaults,
|
(char **) &forced_extra_defaults,
|
||||||
(char **) &defaults_group_suffix);
|
(char **) &my_defaults_group_suffix);
|
||||||
|
|
||||||
if (! defaults_group_suffix)
|
if (! my_defaults_group_suffix)
|
||||||
defaults_group_suffix= getenv(STRINGIFY_ARG(DEFAULT_GROUP_SUFFIX_ENV));
|
my_defaults_group_suffix= getenv(STRINGIFY_ARG(DEFAULT_GROUP_SUFFIX_ENV));
|
||||||
|
|
||||||
if (forced_extra_defaults)
|
if (forced_extra_defaults)
|
||||||
defaults_extra_file= (char *) forced_extra_defaults;
|
my_defaults_extra_file= (char *) forced_extra_defaults;
|
||||||
|
|
||||||
if (forced_default_file)
|
if (forced_default_file)
|
||||||
defaults_file= forced_default_file;
|
my_defaults_file= forced_default_file;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
We can only handle 'defaults-group-suffix' if we are called from
|
We can only handle 'defaults-group-suffix' if we are called from
|
||||||
load_defaults() as otherwise we can't know the type of 'func_ctx'
|
load_defaults() as otherwise we can't know the type of 'func_ctx'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (defaults_group_suffix && func == handle_default_option)
|
if (my_defaults_group_suffix && func == handle_default_option)
|
||||||
{
|
{
|
||||||
/* Handle --defaults-group-suffix= */
|
/* Handle --defaults-group-suffix= */
|
||||||
uint i;
|
uint i;
|
||||||
const char **extra_groups;
|
const char **extra_groups;
|
||||||
const uint instance_len= strlen(defaults_group_suffix);
|
const uint instance_len= strlen(my_defaults_group_suffix);
|
||||||
struct handle_option_ctx *ctx= (struct handle_option_ctx*) func_ctx;
|
struct handle_option_ctx *ctx= (struct handle_option_ctx*) func_ctx;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
TYPELIB *group= ctx->group;
|
TYPELIB *group= ctx->group;
|
||||||
@ -176,7 +176,7 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
|
|||||||
|
|
||||||
/** Construct new group */
|
/** Construct new group */
|
||||||
memcpy(ptr, extra_groups[i], len);
|
memcpy(ptr, extra_groups[i], len);
|
||||||
memcpy(ptr+len, defaults_group_suffix, instance_len+1);
|
memcpy(ptr+len, my_defaults_group_suffix, instance_len+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
group->count*= 2;
|
group->count*= 2;
|
||||||
@ -210,15 +210,15 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
|
|||||||
if (search_default_file(func, func_ctx, *dirs, conf_file) < 0)
|
if (search_default_file(func, func_ctx, *dirs, conf_file) < 0)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
else if (defaults_extra_file)
|
else if (my_defaults_extra_file)
|
||||||
{
|
{
|
||||||
if ((error= search_default_file_with_ext(func, func_ctx, "", "",
|
if ((error= search_default_file_with_ext(func, func_ctx, "", "",
|
||||||
defaults_extra_file, 0)) < 0)
|
my_defaults_extra_file, 0)) < 0)
|
||||||
goto err; /* Fatal error */
|
goto err; /* Fatal error */
|
||||||
if (error > 0)
|
if (error > 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Could not open required defaults file: %s\n",
|
fprintf(stderr, "Could not open required defaults file: %s\n",
|
||||||
defaults_extra_file);
|
my_defaults_extra_file);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -866,8 +866,8 @@ void my_print_default_files(const char *conf_file)
|
|||||||
char *end;
|
char *end;
|
||||||
if (**dirs)
|
if (**dirs)
|
||||||
pos= *dirs;
|
pos= *dirs;
|
||||||
else if (defaults_extra_file)
|
else if (my_defaults_extra_file)
|
||||||
pos= defaults_extra_file;
|
pos= my_defaults_extra_file;
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
end= convert_dirname(name, pos, NullS);
|
end= convert_dirname(name, pos, NullS);
|
||||||
@ -893,14 +893,14 @@ void print_defaults(const char *conf_file, const char **groups)
|
|||||||
fputs(*groups,stdout);
|
fputs(*groups,stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defaults_group_suffix)
|
if (my_defaults_group_suffix)
|
||||||
{
|
{
|
||||||
groups= groups_save;
|
groups= groups_save;
|
||||||
for ( ; *groups ; groups++)
|
for ( ; *groups ; groups++)
|
||||||
{
|
{
|
||||||
fputc(' ',stdout);
|
fputc(' ',stdout);
|
||||||
fputs(*groups,stdout);
|
fputs(*groups,stdout);
|
||||||
fputs(defaults_group_suffix,stdout);
|
fputs(my_defaults_group_suffix,stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
puts("\nThe following options may be given as the first argument:\n\
|
puts("\nThe following options may be given as the first argument:\n\
|
||||||
|
@ -321,10 +321,10 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
|
|||||||
if (*fmt == 's') /* String parameter */
|
if (*fmt == 's') /* String parameter */
|
||||||
{
|
{
|
||||||
reg2 char *par = va_arg(args, char *);
|
reg2 char *par = va_arg(args, char *);
|
||||||
uint length = (uint) strlen(par);
|
uint length2 = (uint) strlen(par);
|
||||||
/* TODO: implement minimum width and precision */
|
/* TODO: implement minimum width and precision */
|
||||||
out_length+=length;
|
out_length+= length2;
|
||||||
if (my_b_write(info, par, length))
|
if (my_b_write(info, par, length2))
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
else if (*fmt == 'b') /* Sized buffer parameter, only precision makes sense */
|
else if (*fmt == 'b') /* Sized buffer parameter, only precision makes sense */
|
||||||
@ -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 */
|
else if (*fmt == 'd' || *fmt == 'u') /* Integer parameter */
|
||||||
{
|
{
|
||||||
register int iarg;
|
register int iarg;
|
||||||
uint length;
|
uint length2;
|
||||||
char buff[17];
|
char buff[17];
|
||||||
|
|
||||||
iarg = va_arg(args, int);
|
iarg = va_arg(args, int);
|
||||||
if (*fmt == 'd')
|
if (*fmt == 'd')
|
||||||
length= (uint) (int10_to_str((long) iarg,buff, -10) - buff);
|
length2= (uint) (int10_to_str((long) iarg,buff, -10) - buff);
|
||||||
else
|
else
|
||||||
length= (uint) (int10_to_str((long) (uint) iarg,buff,10)- buff);
|
length2= (uint) (int10_to_str((long) (uint) iarg,buff,10)- buff);
|
||||||
out_length+=length;
|
out_length+= length2;
|
||||||
if (my_b_write(info, buff, length))
|
if (my_b_write(info, buff, length2))
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
else if ((*fmt == 'l' && fmt[1] == 'd') || fmt[1] == 'u')
|
else if ((*fmt == 'l' && fmt[1] == 'd') || fmt[1] == 'u')
|
||||||
/* long parameter */
|
/* long parameter */
|
||||||
{
|
{
|
||||||
register long iarg;
|
register long iarg;
|
||||||
uint length;
|
uint length2;
|
||||||
char buff[17];
|
char buff[17];
|
||||||
|
|
||||||
iarg = va_arg(args, long);
|
iarg = va_arg(args, long);
|
||||||
if (*++fmt == 'd')
|
if (*++fmt == 'd')
|
||||||
length= (uint) (int10_to_str(iarg,buff, -10) - buff);
|
length2= (uint) (int10_to_str(iarg,buff, -10) - buff);
|
||||||
else
|
else
|
||||||
length= (uint) (int10_to_str(iarg,buff,10)- buff);
|
length2= (uint) (int10_to_str(iarg,buff,10)- buff);
|
||||||
out_length+=length;
|
out_length+= length2;
|
||||||
if (my_b_write(info, buff, length))
|
if (my_b_write(info, buff, length2))
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -840,9 +840,10 @@ static inline void link_changed(BLOCK_LINK *block, BLOCK_LINK **phead)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void link_to_file_list(KEY_CACHE *keycache,
|
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);
|
unlink_changed(block);
|
||||||
link_changed(block, &keycache->file_blocks[FILE_HASH(file)]);
|
link_changed(block, &keycache->file_blocks[FILE_HASH(file)]);
|
||||||
if (block->status & BLOCK_CHANGED)
|
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)
|
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 bit= 1 << ((bitmap_bit) & 7);
|
||||||
uchar res= (*byte) & bit;
|
uchar res= (*value) & bit;
|
||||||
*byte|= bit;
|
*value|= bit;
|
||||||
return res;
|
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 temp; /* Temporary word value */
|
||||||
uint32 W[80]; /* Word sequence */
|
uint32 W[80]; /* Word sequence */
|
||||||
uint32 A, B, C, D, E; /* Word buffers */
|
uint32 A, B, C, D, E; /* Word buffers */
|
||||||
int index;
|
int idx;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Initialize the first 16 words in the array W
|
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++)
|
for (t = 0; t < 16; t++)
|
||||||
{
|
{
|
||||||
index=t*4;
|
idx=t*4;
|
||||||
W[t] = context->Message_Block[index] << 24;
|
W[t] = context->Message_Block[idx] << 24;
|
||||||
W[t] |= context->Message_Block[index + 1] << 16;
|
W[t] |= context->Message_Block[idx + 1] << 16;
|
||||||
W[t] |= context->Message_Block[index + 2] << 8;
|
W[t] |= context->Message_Block[idx + 2] << 8;
|
||||||
W[t] |= context->Message_Block[index + 3];
|
W[t] |= context->Message_Block[idx + 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ private:
|
|||||||
Uint32 data[2];
|
Uint32 data[2];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
ArbitTicket() {}
|
||||||
STATIC_CONST( DataLength = 2 );
|
STATIC_CONST( DataLength = 2 );
|
||||||
STATIC_CONST( TextLength = DataLength * 8 ); // hex digits
|
STATIC_CONST( TextLength = DataLength * 8 ); // hex digits
|
||||||
|
|
||||||
@ -142,6 +143,7 @@ public:
|
|||||||
ArbitTicket ticket; // ticket
|
ArbitTicket ticket; // ticket
|
||||||
NodeBitmask mask; // set of nodes
|
NodeBitmask mask; // set of nodes
|
||||||
|
|
||||||
|
ArbitSignalData() {}
|
||||||
STATIC_CONST( SignalLength = 3 + ArbitTicket::DataLength + NodeBitmask::Size );
|
STATIC_CONST( SignalLength = 3 + ArbitTicket::DataLength + NodeBitmask::Size );
|
||||||
|
|
||||||
inline bool match(ArbitSignalData& aData) const {
|
inline bool match(ArbitSignalData& aData) const {
|
||||||
|
@ -274,6 +274,7 @@ public:
|
|||||||
Uint32 MinRowsLow;
|
Uint32 MinRowsLow;
|
||||||
Uint32 MinRowsHigh;
|
Uint32 MinRowsHigh;
|
||||||
|
|
||||||
|
Table() {}
|
||||||
void init();
|
void init();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -334,6 +335,7 @@ public:
|
|||||||
Uint32 AttributeAutoIncrement;
|
Uint32 AttributeAutoIncrement;
|
||||||
char AttributeDefaultValue[MAX_ATTR_DEFAULT_VALUE_SIZE];
|
char AttributeDefaultValue[MAX_ATTR_DEFAULT_VALUE_SIZE];
|
||||||
|
|
||||||
|
Attribute() {}
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
@ -57,7 +57,7 @@ public:
|
|||||||
|
|
||||||
bool checkMagicNumber() const;
|
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; }
|
inline NdbReceiver* next() { return m_next; }
|
||||||
|
|
||||||
void setErrorCode(int);
|
void setErrorCode(int);
|
||||||
|
@ -116,6 +116,11 @@ struct SegmentedSectionPtr {
|
|||||||
Uint32 i;
|
Uint32 i;
|
||||||
struct SectionSegment * p;
|
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;}
|
void setNull() { p = 0;}
|
||||||
bool isNull() const { return p == 0;}
|
bool isNull() const { return p == 0;}
|
||||||
};
|
};
|
||||||
|
@ -26,6 +26,7 @@ class InputStream {
|
|||||||
public:
|
public:
|
||||||
virtual ~InputStream() {}
|
virtual ~InputStream() {}
|
||||||
virtual char* gets(char * buf, int bufLen) = 0;
|
virtual char* gets(char * buf, int bufLen) = 0;
|
||||||
|
InputStream() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class FileInputStream : public InputStream {
|
class FileInputStream : public InputStream {
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
class OutputStream {
|
class OutputStream {
|
||||||
public:
|
public:
|
||||||
|
OutputStream() {}
|
||||||
virtual ~OutputStream() {}
|
virtual ~OutputStream() {}
|
||||||
virtual int print(const char * fmt, ...) = 0;
|
virtual int print(const char * fmt, ...) = 0;
|
||||||
virtual int println(const char * fmt, ...) = 0;
|
virtual int println(const char * fmt, ...) = 0;
|
||||||
@ -60,6 +61,7 @@ public:
|
|||||||
|
|
||||||
class NullOutputStream : public OutputStream {
|
class NullOutputStream : public OutputStream {
|
||||||
public:
|
public:
|
||||||
|
NullOutputStream() {}
|
||||||
int print(const char * /* unused */, ...) { return 1;}
|
int print(const char * /* unused */, ...) { return 1;}
|
||||||
int println(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, Uint32 value);
|
||||||
bool add(Uint16 key, const char * value);
|
bool add(Uint16 key, const char * value);
|
||||||
bool add(Uint16 key, const void* value, int len);
|
bool add(Uint16 key, const void* value, int len);
|
||||||
|
Writer() {}
|
||||||
protected:
|
protected:
|
||||||
virtual ~Writer() {}
|
virtual ~Writer() {}
|
||||||
virtual bool reset() = 0;
|
virtual bool reset() = 0;
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
class SocketAuthenticator
|
class SocketAuthenticator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
SocketAuthenticator() {}
|
||||||
virtual ~SocketAuthenticator() {};
|
virtual ~SocketAuthenticator() {};
|
||||||
virtual bool client_authenticate(int sockfd) = 0;
|
virtual bool client_authenticate(int sockfd) = 0;
|
||||||
virtual bool server_authenticate(int sockfd) = 0;
|
virtual bool server_authenticate(int sockfd) = 0;
|
||||||
|
@ -59,6 +59,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
class Service {
|
class Service {
|
||||||
public:
|
public:
|
||||||
|
Service() {}
|
||||||
virtual ~Service(){}
|
virtual ~Service(){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -154,12 +154,13 @@ ConfigRetriever::getConfig() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ndb_mgm_configuration *
|
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)
|
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 0;
|
||||||
}
|
}
|
||||||
return conf;
|
return conf;
|
||||||
|
@ -60,9 +60,9 @@ NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros){
|
|||||||
int res = gettimeofday(&tick_time, 0);
|
int res = gettimeofday(&tick_time, 0);
|
||||||
|
|
||||||
if(secs==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 = tick_time.tv_usec;
|
||||||
*micros = secs*1000000+*micros;
|
*micros = local_secs*1000000+*micros;
|
||||||
} else {
|
} else {
|
||||||
* secs = tick_time.tv_sec;
|
* secs = tick_time.tv_sec;
|
||||||
* micros = tick_time.tv_usec;
|
* micros = tick_time.tv_usec;
|
||||||
|
@ -31,7 +31,7 @@ SHM_Transporter::SHM_Transporter(TransporterRegistry &t_reg,
|
|||||||
const char *lHostName,
|
const char *lHostName,
|
||||||
const char *rHostName,
|
const char *rHostName,
|
||||||
int r_port,
|
int r_port,
|
||||||
bool isMgmConnection,
|
bool isMgmConnection_arg,
|
||||||
NodeId lNodeId,
|
NodeId lNodeId,
|
||||||
NodeId rNodeId,
|
NodeId rNodeId,
|
||||||
NodeId serverNodeId,
|
NodeId serverNodeId,
|
||||||
@ -40,7 +40,7 @@ SHM_Transporter::SHM_Transporter(TransporterRegistry &t_reg,
|
|||||||
key_t _shmKey,
|
key_t _shmKey,
|
||||||
Uint32 _shmSize) :
|
Uint32 _shmSize) :
|
||||||
Transporter(t_reg, tt_SHM_TRANSPORTER,
|
Transporter(t_reg, tt_SHM_TRANSPORTER,
|
||||||
lHostName, rHostName, r_port, isMgmConnection,
|
lHostName, rHostName, r_port, isMgmConnection_arg,
|
||||||
lNodeId, rNodeId, serverNodeId,
|
lNodeId, rNodeId, serverNodeId,
|
||||||
0, false, checksum, signalId),
|
0, false, checksum, signalId),
|
||||||
shmKey(_shmKey),
|
shmKey(_shmKey),
|
||||||
|
@ -67,14 +67,14 @@ TCP_Transporter::TCP_Transporter(TransporterRegistry &t_reg,
|
|||||||
const char *lHostName,
|
const char *lHostName,
|
||||||
const char *rHostName,
|
const char *rHostName,
|
||||||
int r_port,
|
int r_port,
|
||||||
bool isMgmConnection,
|
bool isMgmConnection_arg,
|
||||||
NodeId lNodeId,
|
NodeId lNodeId,
|
||||||
NodeId rNodeId,
|
NodeId rNodeId,
|
||||||
NodeId serverNodeId,
|
NodeId serverNodeId,
|
||||||
bool chksm, bool signalId,
|
bool chksm, bool signalId,
|
||||||
Uint32 _reportFreq) :
|
Uint32 _reportFreq) :
|
||||||
Transporter(t_reg, tt_TCP_TRANSPORTER,
|
Transporter(t_reg, tt_TCP_TRANSPORTER,
|
||||||
lHostName, rHostName, r_port, isMgmConnection,
|
lHostName, rHostName, r_port, isMgmConnection_arg,
|
||||||
lNodeId, rNodeId, serverNodeId,
|
lNodeId, rNodeId, serverNodeId,
|
||||||
0, false, chksm, signalId),
|
0, false, chksm, signalId),
|
||||||
m_sendBuffer(sendBufSize)
|
m_sendBuffer(sendBufSize)
|
||||||
|
@ -33,6 +33,7 @@ struct ReceiveBuffer {
|
|||||||
Uint32 sizeOfData; // In bytes
|
Uint32 sizeOfData; // In bytes
|
||||||
Uint32 sizeOfBuffer;
|
Uint32 sizeOfBuffer;
|
||||||
|
|
||||||
|
ReceiveBuffer() {}
|
||||||
bool init(int bytes);
|
bool init(int bytes);
|
||||||
void destroy();
|
void destroy();
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ Transporter::connect_server(NDB_SOCKET_TYPE sockfd) {
|
|||||||
{
|
{
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
SOCKET_SIZE_TYPE addrlen= sizeof(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;
|
m_connect_address= (&addr)->sin_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ Transporter::connect_client(NDB_SOCKET_TYPE sockfd) {
|
|||||||
{
|
{
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
SOCKET_SIZE_TYPE addrlen= sizeof(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;
|
m_connect_address= (&addr)->sin_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1413,8 +1413,6 @@ TransporterRegistry::add_transporter_interface(NodeId remoteNodeId,
|
|||||||
bool
|
bool
|
||||||
TransporterRegistry::start_service(SocketServer& socket_server)
|
TransporterRegistry::start_service(SocketServer& socket_server)
|
||||||
{
|
{
|
||||||
struct ndb_mgm_reply mgm_reply;
|
|
||||||
|
|
||||||
DBUG_ENTER("TransporterRegistry::start_service");
|
DBUG_ENTER("TransporterRegistry::start_service");
|
||||||
if (m_transporter_interface.size() > 0 && !nodeIdSpecified)
|
if (m_transporter_interface.size() > 0 && !nodeIdSpecified)
|
||||||
{
|
{
|
||||||
|
@ -16,21 +16,6 @@
|
|||||||
#include <Bitmask.hpp>
|
#include <Bitmask.hpp>
|
||||||
#include <NdbOut.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__
|
#ifndef __TEST_BITMASK__
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -95,6 +80,21 @@ BitmaskImpl::setFieldImpl(Uint32 dst[],
|
|||||||
}
|
}
|
||||||
#else
|
#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
|
#define DEBUG 0
|
||||||
#include <Vector.hpp>
|
#include <Vector.hpp>
|
||||||
static void do_test(int bitmask_size);
|
static void do_test(int bitmask_size);
|
||||||
|
@ -90,18 +90,18 @@ bool
|
|||||||
ConfigValues::getByPos(Uint32 pos, Entry * result) const {
|
ConfigValues::getByPos(Uint32 pos, Entry * result) const {
|
||||||
assert(pos < (2 * m_size));
|
assert(pos < (2 * m_size));
|
||||||
Uint32 keypart = m_values[pos];
|
Uint32 keypart = m_values[pos];
|
||||||
Uint32 val = m_values[pos+1];
|
Uint32 val2 = m_values[pos+1];
|
||||||
|
|
||||||
switch(::getTypeOf(keypart)){
|
switch(::getTypeOf(keypart)){
|
||||||
case IntType:
|
case IntType:
|
||||||
case SectionType:
|
case SectionType:
|
||||||
result->m_int = val;
|
result->m_int = val2;
|
||||||
break;
|
break;
|
||||||
case StringType:
|
case StringType:
|
||||||
result->m_string = * getString(val);
|
result->m_string = * getString(val2);
|
||||||
break;
|
break;
|
||||||
case Int64Type:
|
case Int64Type:
|
||||||
result->m_int64 = * get64(val);
|
result->m_int64 = * get64(val2);
|
||||||
break;
|
break;
|
||||||
case InvalidType:
|
case InvalidType:
|
||||||
default:
|
default:
|
||||||
|
@ -162,9 +162,9 @@ File_class::readChar(char* buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
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
|
int
|
||||||
|
@ -627,11 +627,11 @@ PropertiesImpl::getPropsPut(const char * name,
|
|||||||
if(nvp == 0){
|
if(nvp == 0){
|
||||||
Properties * tmpP = new Properties();
|
Properties * tmpP = new Properties();
|
||||||
PropertyImpl * tmpPI = new PropertyImpl(tmp2, tmpP);
|
PropertyImpl * tmpPI = new PropertyImpl(tmp2, tmpP);
|
||||||
PropertyImpl * nvp = put(tmpPI);
|
PropertyImpl * nvp2 = put(tmpPI);
|
||||||
|
|
||||||
delete tmpP;
|
delete tmpP;
|
||||||
free(tmp2);
|
free(tmp2);
|
||||||
return ((Properties*)nvp->value)->impl->getPropsPut(tmp+1, impl);
|
return ((Properties*)nvp2->value)->impl->getPropsPut(tmp+1, impl);
|
||||||
}
|
}
|
||||||
free(tmp2);
|
free(tmp2);
|
||||||
if(nvp->valueType != PropertiesType_Properties){
|
if(nvp->valueType != PropertiesType_Properties){
|
||||||
|
@ -88,7 +88,7 @@ SocketClient::bind(const char* bindaddress, unsigned short localport)
|
|||||||
int ret = errno;
|
int ret = errno;
|
||||||
NDB_CLOSE_SOCKET(m_sockfd);
|
NDB_CLOSE_SOCKET(m_sockfd);
|
||||||
m_sockfd= NDB_INVALID_SOCKET;
|
m_sockfd= NDB_INVALID_SOCKET;
|
||||||
return errno;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (::bind(m_sockfd, (struct sockaddr*)&local, sizeof(local)) == -1)
|
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 i;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
unsigned int totalLength;
|
unsigned int totalLength;
|
||||||
unsigned int index;
|
unsigned int idx;
|
||||||
|
|
||||||
if( !seq || !inputValues ) return(-1);
|
if( !seq || !inputValues ) return(-1);
|
||||||
|
|
||||||
@ -219,12 +219,12 @@ int initSequence(RandomSequence *seq, SequenceValues *inputValues)
|
|||||||
/*----------------------*/
|
/*----------------------*/
|
||||||
/* set the array values */
|
/* set the array values */
|
||||||
/*----------------------*/
|
/*----------------------*/
|
||||||
index = 0;
|
idx = 0;
|
||||||
|
|
||||||
for(i = 0; inputValues[i].length != 0; i++) {
|
for(i = 0; inputValues[i].length != 0; i++) {
|
||||||
for(j = 0; j < inputValues[i].length; j++ ) {
|
for(j = 0; j < inputValues[i].length; j++ ) {
|
||||||
seq->values[index] = inputValues[i].value;
|
seq->values[idx] = inputValues[i].value;
|
||||||
index++;
|
idx++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,8 +164,8 @@ write_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
|
|||||||
FD_SET(socket, &writeset);
|
FD_SET(socket, &writeset);
|
||||||
timeout.tv_sec = 1;
|
timeout.tv_sec = 1;
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
const int selectRes = select(socket + 1, 0, &writeset, 0, &timeout);
|
const int selectRes2 = select(socket + 1, 0, &writeset, 0, &timeout);
|
||||||
if(selectRes != 1){
|
if(selectRes2 != 1){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -389,7 +389,6 @@ CPCDAPISession::listProcesses(Parser_t::Context & /* unused */,
|
|||||||
void
|
void
|
||||||
CPCDAPISession::showVersion(Parser_t::Context & /* unused */,
|
CPCDAPISession::showVersion(Parser_t::Context & /* unused */,
|
||||||
const class Properties & args){
|
const class Properties & args){
|
||||||
Uint32 id;
|
|
||||||
CPCD::RequestStatus rs;
|
CPCD::RequestStatus rs;
|
||||||
|
|
||||||
m_output->println("show version");
|
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";
|
const char *progname = "ndb_cpcd";
|
||||||
|
|
||||||
int main(int argc, char** argv){
|
int main(int argc, char** argv){
|
||||||
int save_argc= argc;
|
|
||||||
char** save_argv= argv;
|
|
||||||
const char *load_default_groups[]= { "ndb_cpcd",0 };
|
const char *load_default_groups[]= { "ndb_cpcd",0 };
|
||||||
MY_INIT(argv[0]);
|
MY_INIT(argv[0]);
|
||||||
|
|
||||||
|
@ -1261,7 +1261,7 @@ Cmvmi::execTESTSIG(Signal* signal){
|
|||||||
fprintf(stdout, "\n");
|
fprintf(stdout, "\n");
|
||||||
|
|
||||||
for(i = 0; i<signal->header.m_noOfSections; i++){
|
for(i = 0; i<signal->header.m_noOfSections; i++){
|
||||||
SegmentedSectionPtr ptr = {0,0,0};
|
SegmentedSectionPtr ptr(0,0,0);
|
||||||
ndbout_c("-- Section %d --", i);
|
ndbout_c("-- Section %d --", i);
|
||||||
signal->getSection(ptr, i);
|
signal->getSection(ptr, i);
|
||||||
ndbrequire(ptr.p != 0);
|
ndbrequire(ptr.p != 0);
|
||||||
@ -1319,7 +1319,7 @@ Cmvmi::execTESTSIG(Signal* signal){
|
|||||||
LinearSectionPtr ptr[3];
|
LinearSectionPtr ptr[3];
|
||||||
const Uint32 secs = signal->getNoOfSections();
|
const Uint32 secs = signal->getNoOfSections();
|
||||||
for(i = 0; i<secs; i++){
|
for(i = 0; i<secs; i++){
|
||||||
SegmentedSectionPtr sptr = {0,0,0};
|
SegmentedSectionPtr sptr(0,0,0);
|
||||||
signal->getSection(sptr, i);
|
signal->getSection(sptr, i);
|
||||||
ptr[i].sz = sptr.sz;
|
ptr[i].sz = sptr.sz;
|
||||||
ptr[i].p = new Uint32[sptr.sz];
|
ptr[i].p = new Uint32[sptr.sz];
|
||||||
@ -1368,7 +1368,7 @@ Cmvmi::execTESTSIG(Signal* signal){
|
|||||||
LinearSectionPtr ptr[3];
|
LinearSectionPtr ptr[3];
|
||||||
const Uint32 secs = signal->getNoOfSections();
|
const Uint32 secs = signal->getNoOfSections();
|
||||||
for(i = 0; i<secs; i++){
|
for(i = 0; i<secs; i++){
|
||||||
SegmentedSectionPtr sptr = {0,0,0};
|
SegmentedSectionPtr sptr(0,0,0);
|
||||||
signal->getSection(sptr, i);
|
signal->getSection(sptr, i);
|
||||||
ptr[i].sz = sptr.sz;
|
ptr[i].sz = sptr.sz;
|
||||||
ptr[i].p = new Uint32[sptr.sz];
|
ptr[i].p = new Uint32[sptr.sz];
|
||||||
@ -1434,7 +1434,7 @@ Cmvmi::execTESTSIG(Signal* signal){
|
|||||||
const Uint32 secs = signal->getNoOfSections();
|
const Uint32 secs = signal->getNoOfSections();
|
||||||
memset(g_test, 0, sizeof(g_test));
|
memset(g_test, 0, sizeof(g_test));
|
||||||
for(i = 0; i<secs; i++){
|
for(i = 0; i<secs; i++){
|
||||||
SegmentedSectionPtr sptr = {0,0,0};
|
SegmentedSectionPtr sptr(0,0,0);
|
||||||
signal->getSection(sptr, i);
|
signal->getSection(sptr, i);
|
||||||
g_test[i].sz = sptr.sz;
|
g_test[i].sz = sptr.sz;
|
||||||
g_test[i].p = new Uint32[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->minRowsLow = tableDesc.MinRowsLow;
|
||||||
tablePtr.p->minRowsHigh = tableDesc.MinRowsHigh;
|
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;
|
tablePtr.p->frmLen = tableDesc.FrmLen;
|
||||||
memcpy(tablePtr.p->frmData, tableDesc.FrmData, tableDesc.FrmLen);
|
memcpy(tablePtr.p->frmData, tableDesc.FrmData, tableDesc.FrmLen);
|
||||||
|
|
||||||
|
@ -131,6 +131,7 @@ public:
|
|||||||
* on disk. Index trigger ids are volatile.
|
* on disk. Index trigger ids are volatile.
|
||||||
*/
|
*/
|
||||||
struct TableRecord : public MetaData::Table {
|
struct TableRecord : public MetaData::Table {
|
||||||
|
TableRecord() {}
|
||||||
Uint32 maxRowsLow;
|
Uint32 maxRowsLow;
|
||||||
Uint32 maxRowsHigh;
|
Uint32 maxRowsHigh;
|
||||||
Uint32 minRowsLow;
|
Uint32 minRowsLow;
|
||||||
@ -250,6 +251,7 @@ public:
|
|||||||
* attributes. This is wrong but convenient.
|
* attributes. This is wrong but convenient.
|
||||||
*/
|
*/
|
||||||
struct AttributeRecord : public MetaData::Attribute {
|
struct AttributeRecord : public MetaData::Attribute {
|
||||||
|
AttributeRecord() {}
|
||||||
union {
|
union {
|
||||||
/** Pointer to the next attribute used by ArrayPool */
|
/** Pointer to the next attribute used by ArrayPool */
|
||||||
Uint32 nextPool;
|
Uint32 nextPool;
|
||||||
@ -285,6 +287,7 @@ public:
|
|||||||
* trigger online creates the trigger in TC (if index) and LQH-TUP.
|
* trigger online creates the trigger in TC (if index) and LQH-TUP.
|
||||||
*/
|
*/
|
||||||
struct TriggerRecord {
|
struct TriggerRecord {
|
||||||
|
TriggerRecord() {}
|
||||||
|
|
||||||
/** Trigger state */
|
/** Trigger state */
|
||||||
enum TriggerState {
|
enum TriggerState {
|
||||||
@ -864,6 +867,7 @@ private:
|
|||||||
* seize/release invokes ctor/dtor automatically.
|
* seize/release invokes ctor/dtor automatically.
|
||||||
*/
|
*/
|
||||||
struct OpRecordCommon {
|
struct OpRecordCommon {
|
||||||
|
OpRecordCommon() {}
|
||||||
Uint32 key; // key shared between master and slaves
|
Uint32 key; // key shared between master and slaves
|
||||||
Uint32 nextHash;
|
Uint32 nextHash;
|
||||||
Uint32 prevHash;
|
Uint32 prevHash;
|
||||||
@ -879,6 +883,7 @@ private:
|
|||||||
* Create table record
|
* Create table record
|
||||||
*/
|
*/
|
||||||
struct CreateTableRecord : OpRecordCommon {
|
struct CreateTableRecord : OpRecordCommon {
|
||||||
|
CreateTableRecord() {}
|
||||||
Uint32 m_senderRef;
|
Uint32 m_senderRef;
|
||||||
Uint32 m_senderData;
|
Uint32 m_senderData;
|
||||||
Uint32 m_coordinatorRef;
|
Uint32 m_coordinatorRef;
|
||||||
@ -917,6 +922,7 @@ private:
|
|||||||
* Drop table record
|
* Drop table record
|
||||||
*/
|
*/
|
||||||
struct DropTableRecord : OpRecordCommon {
|
struct DropTableRecord : OpRecordCommon {
|
||||||
|
DropTableRecord() {}
|
||||||
DropTableReq m_request;
|
DropTableReq m_request;
|
||||||
|
|
||||||
Uint32 m_requestType;
|
Uint32 m_requestType;
|
||||||
|
@ -1288,6 +1288,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
struct LcpState {
|
struct LcpState {
|
||||||
|
LcpState() {}
|
||||||
LcpStatus lcpStatus;
|
LcpStatus lcpStatus;
|
||||||
Uint32 lcpStatusUpdatedPlace;
|
Uint32 lcpStatusUpdatedPlace;
|
||||||
|
|
||||||
@ -1394,6 +1395,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
class MasterTakeOverState {
|
class MasterTakeOverState {
|
||||||
public:
|
public:
|
||||||
|
MasterTakeOverState() {}
|
||||||
void set(LcpMasterTakeOverState s, Uint32 line) {
|
void set(LcpMasterTakeOverState s, Uint32 line) {
|
||||||
state = s; updatePlace = line;
|
state = s; updatePlace = line;
|
||||||
}
|
}
|
||||||
@ -1481,6 +1483,7 @@ private:
|
|||||||
* SwitchReplicaRecord - Should only be used by master
|
* SwitchReplicaRecord - Should only be used by master
|
||||||
*/
|
*/
|
||||||
struct SwitchReplicaRecord {
|
struct SwitchReplicaRecord {
|
||||||
|
SwitchReplicaRecord() {}
|
||||||
void clear(){}
|
void clear(){}
|
||||||
|
|
||||||
Uint32 nodeId;
|
Uint32 nodeId;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user