Merge mysql.com:/home/mydev/mysql-5.1

into  mysql.com:/home/mydev/mysql-5.1-bug11527


mysql-test/r/innodb.result:
  Auto merged
This commit is contained in:
unknown 2006-02-27 19:05:08 +01:00
commit 97c82803ae
267 changed files with 16524 additions and 3184 deletions

View file

@ -1614,3 +1614,5 @@ vio/viotest-sslconnect.cpp
vio/viotest.cpp
zlib/*.ds?
zlib/*.vcproj
libmysqld/partition_info.cc
storage/ndb/src/common/util/testBitmask.cpp

View file

@ -157,7 +157,7 @@
InlineFunctionExpansion="1"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="../include,../libmysqld,../sql,../regex,../extra/yassl/include,../storage/bdb/build_win32,../zlib"
PreprocessorDefinitions="WIN32;_WINDOWS;_MBCS;NDEBUG;DBUG_OFF;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;USE_TLS;__WIN__"/>
PreprocessorDefinitions="WIN32;_WINDOWS;_MBCS;NDEBUG;DBUG_OFF;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;MYSQL_SERVER;HAVE_INNOBASE_DB;WITH_INNOBASE_STORAGE_ENGINE;USE_TLS;__WIN__"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"

View file

@ -25,10 +25,13 @@ endif
INCLUDES = -I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(top_srcdir)/regex \
$(openssl_includes) $(yassl_includes)
$(openssl_includes) $(yassl_includes)
LIBS = @CLIENT_LIBS@
LDADD= @CLIENT_EXTRA_LDFLAGS@ $(CLIENT_THREAD_LIBS) \
$(top_builddir)/libmysql/libmysqlclient.la
LDADD_R= @CLIENT_EXTRA_LDFLAGS@ \
$(CLIENT_THREAD_LIBS) \
$(top_builddir)/libmysql_r/libmysqlclient_r.la
bin_PROGRAMS = mysql mysqladmin mysqlcheck mysqlshow \
mysqldump mysqlimport mysqltest mysqlbinlog \
mysqltestmanagerc mysqltestmanager-pwgen \
@ -48,15 +51,11 @@ mysqlbinlog_SOURCES = mysqlbinlog.cc $(top_srcdir)/mysys/mf_tempdir.c \
$(top_srcdir)/mysys/my_vle.c \
$(top_srcdir)/mysys/base64.c
mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS)
mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
@CLIENT_EXTRA_LDFLAGS@ \
$(top_builddir)/libmysql_r/libmysqlclient_r.la \
$(top_builddir)/mysys/libmysys.a
mysqlimport_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
@CLIENT_EXTRA_LDFLAGS@ \
$(top_builddir)/libmysql_r/libmysqlclient_r.la \
$(top_builddir)/mysys/libmysys.a
mysqltestmanager_pwgen_SOURCES = mysqlmanager-pwgen.c
mysqlslap_LDADD = $(CXXLDFLAGS) $(LDADD_R) \
$(top_builddir)/mysys/libmysys.a
mysqlimport_LDADD = $(CXXLDFLAGS) $(LDADD_R) \
$(top_builddir)/mysys/libmysys.a
mysqltestmanager_pwgen_SOURCES = mysqlmanager-pwgen.c
mysqltestmanagerc_SOURCES= mysqlmanagerc.c $(yassl_dummy_link_fix)
mysqlcheck_SOURCES= mysqlcheck.c $(yassl_dummy_link_fix)
mysqlshow_SOURCES= mysqlshow.c $(yassl_dummy_link_fix)

View file

@ -1497,7 +1497,7 @@ int main(int argc, char** argv)
the server
*/
#ifdef __WIN__
#if defined(__WIN__) && !defined(USING_CMAKE)
#include "my_decimal.h"
#include "decimal.c"
#include "my_decimal.cpp"

View file

@ -860,6 +860,27 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res,
return 0;
}
/*
Open a new .sql file to dump the table or view into
SYNOPSIS
open_sql_file_for_table
name name of the table or view
RETURN VALUES
0 Failed to open file
> 0 Handle of the open file
*/
static FILE* open_sql_file_for_table(const char* table)
{
FILE* res;
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
convert_dirname(tmp_path,path,NullS);
res= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4),
O_WRONLY, MYF(MY_WME));
return res;
}
static void safe_exit(int error)
{
@ -1411,11 +1432,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
if (path)
{
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
convert_dirname(tmp_path,path,NullS);
sql_file= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4),
O_WRONLY, MYF(MY_WME));
if (!sql_file) /* If file couldn't be opened */
if (!(sql_file= open_sql_file_for_table(table)))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
@ -1580,11 +1597,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
{
if (path)
{
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
convert_dirname(tmp_path,path,NullS);
sql_file= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4),
O_WRONLY, MYF(MY_WME));
if (!sql_file) /* If file couldn't be opened */
if (!(sql_file= open_sql_file_for_table(table)))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
@ -3345,6 +3358,41 @@ cleanup:
}
/*
Replace a substring
SYNOPSIS
replace
ds_str The string to search and perform the replace in
search_str The string to search for
search_len Length of the string to search for
replace_str The string to replace with
replace_len Length of the string to replace with
RETURN
0 String replaced
1 Could not find search_str in str
*/
static int replace(DYNAMIC_STRING *ds_str,
const char *search_str, ulong search_len,
const char *replace_str, ulong replace_len)
{
DYNAMIC_STRING ds_tmp;
const char *start= strstr(ds_str->str, search_str);
if (!start)
return 1;
init_dynamic_string(&ds_tmp, "",
ds_str->length + replace_len, 256);
dynstr_append_mem(&ds_tmp, ds_str->str, start - ds_str->str);
dynstr_append_mem(&ds_tmp, replace_str, replace_len);
dynstr_append(&ds_tmp, start + search_len);
dynstr_set(ds_str, ds_tmp.str);
dynstr_free(&ds_tmp);
return 0;
}
/*
Getting VIEW structure
@ -3366,11 +3414,11 @@ static my_bool get_view_structure(char *table, char* db)
char *result_table, *opt_quoted_table;
char table_buff[NAME_LEN*2+3];
char table_buff2[NAME_LEN*2+3];
char buff[20+FN_REFLEN];
char query[QUERY_LENGTH];
FILE *sql_file = md_result_file;
DBUG_ENTER("get_view_structure");
if (tFlag)
if (tFlag) /* Don't write table creation info */
DBUG_RETURN(0);
if (verbose)
@ -3384,29 +3432,14 @@ static my_bool get_view_structure(char *table, char* db)
result_table= quote_name(table, table_buff, 1);
opt_quoted_table= quote_name(table, table_buff2, 0);
sprintf(buff,"show create table %s", result_table);
if (mysql_query(sock, buff))
my_snprintf(query, sizeof(query), "SHOW CREATE TABLE %s", result_table);
if (mysql_query_with_error_report(sock, &table_res, query))
{
fprintf(stderr, "%s: Can't get CREATE TABLE for view %s (%s)\n",
my_progname, result_table, mysql_error(sock));
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
}
if (path)
{
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
convert_dirname(tmp_path,path,NullS);
sql_file= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4),
O_WRONLY, MYF(MY_WME));
if (!sql_file) /* If file couldn't be opened */
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(1);
}
write_header(sql_file, db);
}
table_res= mysql_store_result(sock);
/* Check if this is a view */
field= mysql_fetch_field_direct(table_res, 0);
if (strcmp(field->name, "View") != 0)
{
@ -3415,6 +3448,17 @@ static my_bool get_view_structure(char *table, char* db)
DBUG_RETURN(0);
}
/* If requested, open separate .sql file for this view */
if (path)
{
if (!(sql_file= open_sql_file_for_table(table)))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(1);
}
write_header(sql_file, db);
}
if (!opt_xml && opt_comments)
{
fprintf(sql_file, "\n--\n-- View structure for view %s\n--\n\n",
@ -3430,11 +3474,102 @@ static my_bool get_view_structure(char *table, char* db)
check_io(sql_file);
}
row= mysql_fetch_row(table_res);
fprintf(sql_file, "/*!50001 %s*/;\n", row[1]);
check_io(sql_file);
mysql_free_result(table_res);
my_snprintf(query, sizeof(query),
"SELECT CHECK_OPTION, DEFINER, SECURITY_TYPE " \
"FROM information_schema.views " \
"WHERE table_name=\"%s\" AND table_schema=\"%s\"", table, db);
if (mysql_query(sock, query))
{
/*
Use the raw output from SHOW CREATE TABLE if
information_schema query fails.
*/
row= mysql_fetch_row(table_res);
fprintf(sql_file, "/*!50001 %s */;\n", row[1]);
check_io(sql_file);
mysql_free_result(table_res);
}
else
{
char *ptr;
ulong *lengths;
char search_buf[256], replace_buf[256];
ulong search_len, replace_len;
DYNAMIC_STRING ds_view;
/* Save the result of SHOW CREATE TABLE in ds_view */
row= mysql_fetch_row(table_res);
lengths= mysql_fetch_lengths(table_res);
init_dynamic_string(&ds_view, row[1], lengths[1] + 1, 1024);
mysql_free_result(table_res);
/* Get the result from "select ... information_schema" */
if (!(table_res= mysql_store_result(sock)))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(1);
}
row= mysql_fetch_row(table_res);
lengths= mysql_fetch_lengths(table_res);
/*
"WITH %s CHECK OPTION" is available from 5.0.2
Surround it with !50002 comments
*/
if (strcmp(row[0], "NONE"))
{
ptr= search_buf;
search_len= (ulong)(strxmov(ptr, "WITH ", row[0],
" CHECK OPTION", NullS) - ptr);
ptr= replace_buf;
replace_len=(ulong)(strxmov(ptr, "*/\n/*!50002 WITH ", row[0],
" CHECK OPTION", NullS) - ptr);
replace(&ds_view, search_buf, search_len, replace_buf, replace_len);
}
/*
"DEFINER=%s SQL SECURITY %s" is available from 5.0.13
Surround it with !50013 comments
*/
{
uint user_name_len;
char user_name_str[USERNAME_LENGTH + 1];
char quoted_user_name_str[USERNAME_LENGTH * 2 + 3];
uint host_name_len;
char host_name_str[HOSTNAME_LENGTH + 1];
char quoted_host_name_str[HOSTNAME_LENGTH * 2 + 3];
parse_user(row[1], lengths[1], user_name_str, &user_name_len,
host_name_str, &host_name_len);
ptr= search_buf;
search_len=
(ulong)(strxmov(ptr, "DEFINER=",
quote_name(user_name_str, quoted_user_name_str, FALSE),
"@",
quote_name(host_name_str, quoted_host_name_str, FALSE),
" SQL SECURITY ", row[2], NullS) - ptr);
ptr= replace_buf;
replace_len=
(ulong)(strxmov(ptr, "*/\n/*!50013 DEFINER=",
quote_name(user_name_str, quoted_user_name_str, FALSE),
"@",
quote_name(host_name_str, quoted_host_name_str, FALSE),
" SQL SECURITY ", row[2],
" */\n/*!50001", NullS) - ptr);
replace(&ds_view, search_buf, search_len, replace_buf, replace_len);
}
/* Dump view structure to file */
fprintf(sql_file, "/*!50001 %s */;\n", ds_view.str);
check_io(sql_file);
mysql_free_result(table_res);
dynstr_free(&ds_view);
}
/* If a separate .sql file was opened, close it now */
if (sql_file != md_result_file)
{
fputs("\n", sql_file);

View file

@ -29,12 +29,16 @@
#include "client_priv.h"
#include "mysql_version.h"
#ifdef HAVE_LIBPTHREAD
#include <my_pthread.h>
#endif
/* Global Thread counter */
int counter= 0;
#ifdef HAVE_LIBPTHREAD
pthread_mutex_t counter_mutex;
#endif
static void db_error_with_table(MYSQL *mysql, char *table);
static void db_error(MYSQL *mysql);
@ -145,13 +149,11 @@ static struct my_option my_long_options[] =
(gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
#if 0
{"use-threads", OPT_USE_THREADS,
"Load files in parallel. The argument is the number "
"of threads to use for loading data.",
(gptr*) &opt_use_threads, (gptr*) &opt_use_threads, 0,
GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.", (gptr*) &current_user,
(gptr*) &current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -292,7 +294,7 @@ static int write_to_table(char *filename, MYSQL *mysql)
DBUG_PRINT("enter",("filename: %s",filename));
fn_format(tablename, filename, "", "", 1 | 2); /* removes path & ext. */
if (! opt_local_file)
if (!opt_local_file)
strmov(hard_path,filename);
else
my_load_path(hard_path, filename, NULL); /* filename includes the path */
@ -518,6 +520,7 @@ static char *field_escape(char *to,const char *from,uint length)
int exitcode= 0;
#ifdef HAVE_LIBPTHREAD
pthread_handler_t worker_thread(void *arg)
{
int error;
@ -556,6 +559,7 @@ error:
return 0;
}
#endif
int main(int argc, char **argv)
@ -573,6 +577,7 @@ int main(int argc, char **argv)
return(1);
}
#ifdef HAVE_LIBPTHREAD
if (opt_use_threads && !lock_tables)
{
pthread_t mainthread; /* Thread descriptor */
@ -623,6 +628,7 @@ loop_label:
VOID(pthread_mutex_destroy(&counter_mutex));
}
else
#endif
{
MYSQL *mysql= 0;
if (!(mysql= db_connect(current_host,current_db,current_user,opt_password)))
@ -640,9 +646,9 @@ loop_label:
if (lock_tables)
lock_table(mysql, argc, argv);
for (; *argv != NULL; argv++)
if ((error=write_to_table(*argv, mysql)))
if ((error= write_to_table(*argv, mysql)))
if (exitcode == 0)
exitcode = error;
exitcode= error;
db_disconnect(current_host, mysql);
}
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));

View file

@ -76,7 +76,9 @@ TODO:
#define RAND_STRING_SIZE 126
#include "client_priv.h"
#ifdef HAVE_LIBPTHREAD
#include <my_pthread.h>
#endif
#include <my_sys.h>
#include <m_string.h>
#include <mysql.h>
@ -987,6 +989,7 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit)
exit(0);
}
#ifdef HAVE_LIBPTHREAD
if (opt_use_threads)
{
pthread_t mainthread; /* Thread descriptor */
@ -1008,8 +1011,11 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit)
}
}
}
#endif
#ifndef __WIN__
#ifdef HAVE_LIBPTHREAD
else
#endif
{
fflush(NULL);
for (x= 0; x < concur; x++)

View file

@ -74,7 +74,6 @@
#define MAX_QUERY (256*1024)
#define MAX_VAR_NAME 256
#define MAX_COLUMNS 256
#define PAD_SIZE 128
#define MAX_CONS 128
#define MAX_INCLUDE_DEPTH 16
#define INIT_Q_LINES 1024
@ -309,18 +308,6 @@ typedef struct
char *env_s;
} VAR;
#if defined(__NETWARE__) || defined(__WIN__)
/*
Netware doesn't proved environment variable substitution that is done
by the shell in unix environments. We do this in the following function:
*/
static char *subst_env_var(const char *cmd);
static FILE *my_popen(const char *cmd, const char *mode);
#undef popen
#define popen(A,B) my_popen((A),(B))
#endif /* __NETWARE__ */
VAR var_reg[10];
/*Perl/shell-like variable registers */
HASH var_hash;
@ -501,20 +488,21 @@ typedef struct st_pointer_array { /* when using array-strings */
struct st_replace;
struct st_replace *init_replace(my_string *from, my_string *to, uint count,
my_string word_end_chars);
uint replace_strings(struct st_replace *rep, my_string *start,
uint *max_length, const char *from);
void free_replace();
static void free_replace_regex();
static int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name);
static void replace_strings_append(struct st_replace *rep, DYNAMIC_STRING* ds,
const char *from, int len);
void free_pointer_array(POINTER_ARRAY *pa);
static int initialize_replace_buffer(void);
static void do_eval(DYNAMIC_STRING *query_eval, const char *query);
static void do_eval(DYNAMIC_STRING *query_eval, const char *query,
my_bool pass_through_escape_chars);
static void str_to_file(const char *fname, char *str, int size);
int do_server_op(struct st_query *q,const char *op);
#ifdef __WIN__
static void free_win_path_patterns();
#endif
struct st_replace *glob_replace;
static char *out_buff;
static uint out_length;
static int eval_result = 0;
/* For column replace */
@ -539,10 +527,11 @@ static void handle_error(const char *query, struct st_query *q,
const char *err_sqlstate, DYNAMIC_STRING *ds);
static void handle_no_error(struct st_query *q);
static void do_eval(DYNAMIC_STRING* query_eval, const char *query)
static void do_eval(DYNAMIC_STRING* query_eval, const char *query,
my_bool pass_through_escape_chars)
{
const char *p;
register char c;
register char c, next_c;
register int escaped = 0;
VAR* v;
DBUG_ENTER("do_eval");
@ -564,13 +553,25 @@ static void do_eval(DYNAMIC_STRING* query_eval, const char *query)
}
break;
case '\\':
next_c= *(p+1);
if (escaped)
{
escaped = 0;
dynstr_append_mem(query_eval, p, 1);
}
else
else if (next_c == '\\' || next_c == '$')
{
/* Set escaped only if next char is \ or $ */
escaped = 1;
if (pass_through_escape_chars)
{
/* The escape char should be added to the output string. */
dynstr_append_mem(query_eval, p, 1);
}
}
else
dynstr_append_mem(query_eval, p, 1);
break;
default:
dynstr_append_mem(query_eval, p, 1);
@ -646,6 +647,9 @@ static void free_used_memory()
free_defaults(default_argv);
mysql_server_end();
free_re();
#ifdef __WIN__
free_win_path_patterns();
#endif
DBUG_VOID_RETURN;
}
@ -754,7 +758,7 @@ static int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname)
init_dynamic_string(&res_ds, "", 0, 65536);
if (eval_result)
{
do_eval(&res_ds, tmp);
do_eval(&res_ds, tmp, FALSE);
res_ptr = res_ds.str;
if ((res_len = res_ds.length) != ds->length)
{
@ -1031,17 +1035,7 @@ int do_require_manager(struct st_query *query __attribute__((unused)) )
}
#ifndef EMBEDDED_LIBRARY
int do_server_start(struct st_query *q)
{
return do_server_op(q, "start");
}
int do_server_stop(struct st_query *q)
{
return do_server_op(q, "stop");
}
int do_server_op(struct st_query *q, const char *op)
static int do_server_op(struct st_query *q, const char *op)
{
char *p= q->first_argument;
char com_buf[256], *com_p;
@ -1071,6 +1065,17 @@ int do_server_op(struct st_query *q, const char *op)
q->last_argument= p;
return 0;
}
int do_server_start(struct st_query *q)
{
return do_server_op(q, "start");
}
int do_server_stop(struct st_query *q)
{
return do_server_op(q, "stop");
}
#endif
@ -1124,16 +1129,21 @@ int do_source(struct st_query *query)
expected error array, previously set with the --error command.
It can thus be used to execute a command that shall fail.
NOTE
Although mysqltest is executed from cygwin shell, the command will be
executed in "cmd.exe". Thus commands like "rm" etc can NOT be used, use
system for those commands.
*/
static void do_exec(struct st_query *query)
{
int error;
DYNAMIC_STRING *ds= NULL;
char buf[1024];
FILE *res_file;
char *cmd= query->first_argument;
DYNAMIC_STRING ds_cmd;
DBUG_ENTER("do_exec");
DBUG_PRINT("enter", ("cmd: '%s'", cmd));
while (*cmd && my_isspace(charset_info, *cmd))
cmd++;
@ -1141,24 +1151,28 @@ static void do_exec(struct st_query *query)
die("Missing argument in exec");
query->last_argument= query->end;
DBUG_PRINT("info", ("Executing '%s'", cmd));
init_dynamic_string(&ds_cmd, 0, strlen(cmd)+256, 256);
/* Eval the command, thus replacing all environment variables */
do_eval(&ds_cmd, cmd, TRUE);
cmd= ds_cmd.str;
DBUG_PRINT("info", ("Executing '%s' as '%s'",
query->first_argument, cmd));
if (!(res_file= popen(cmd, "r")) && query->abort_on_error)
die("popen(\"%s\", \"r\") failed", cmd);
die("popen(\"%s\", \"r\") failed", query->first_argument);
if (disable_result_log)
while (fgets(buf, sizeof(buf), res_file))
{
while (fgets(buf, sizeof(buf), res_file))
if (disable_result_log)
{
buf[strlen(buf)-1]=0;
DBUG_PRINT("exec_result",("%s", buf));
}
}
else
{
ds= &ds_res;
while (fgets(buf, sizeof(buf), res_file))
replace_dynstr_append(ds, buf);
else
{
replace_dynstr_append(&ds_res, buf);
}
}
error= pclose(res_file);
if (error != 0)
@ -1167,7 +1181,7 @@ static void do_exec(struct st_query *query)
my_bool ok= 0;
if (query->abort_on_error)
die("command \"%s\" failed", cmd);
die("command \"%s\" failed", query->first_argument);
DBUG_PRINT("info",
("error: %d, status: %d", error, status));
@ -1182,19 +1196,19 @@ static void do_exec(struct st_query *query)
{
ok= 1;
DBUG_PRINT("info", ("command \"%s\" failed with expected error: %d",
cmd, status));
query->first_argument, status));
}
}
if (!ok)
die("command \"%s\" failed with wrong error: %d",
cmd, status);
query->first_argument, status);
}
else if (query->expected_errno[0].type == ERR_ERRNO &&
query->expected_errno[0].code.errnum != 0)
{
/* Error code we wanted was != 0, i.e. not an expected success */
die("command \"%s\" succeeded - should have failed with errno %d...",
cmd, query->expected_errno[0].code.errnum);
query->first_argument, query->expected_errno[0].code.errnum);
}
free_replace();
@ -1406,38 +1420,49 @@ int do_modify_var(struct st_query *query, const char *name,
}
int do_system(struct st_query *q)
/*
SYNOPSIS
do_system
command called command
DESCRIPTION
system <command>
Eval the query to expand any $variables in the command.
Execute the command withe the "system" command.
NOTE
If mysqltest is executed from cygwin shell, the command will be
executed in cygwin shell. Thus commands like "rm" etc can be used.
*/
int do_system(struct st_query *command)
{
DYNAMIC_STRING *ds;
char *p=q->first_argument;
VAR v;
var_init(&v, 0, 0, 0, 0);
eval_expr(&v, p, 0); /* NULL terminated */
ds= &ds_res;
DYNAMIC_STRING ds_cmd;
if (v.str_val_len)
{
char expr_buf[1024];
if ((uint)v.str_val_len > sizeof(expr_buf) - 1)
v.str_val_len = sizeof(expr_buf) - 1;
memcpy(expr_buf, v.str_val, v.str_val_len);
expr_buf[v.str_val_len] = 0;
DBUG_PRINT("info", ("running system command '%s'", expr_buf));
if (system(expr_buf))
{
if (q->abort_on_error)
die("system command '%s' failed", expr_buf);
/* If ! abort_on_error, log message and continue */
dynstr_append(ds, "system command '");
replace_dynstr_append(ds, expr_buf);
dynstr_append(ds, "' failed\n");
}
}
else
if (strlen(command->first_argument) == 0)
die("Missing arguments to system, nothing to do!");
var_free(&v);
q->last_argument= q->end;
init_dynamic_string(&ds_cmd, 0, strlen(command->first_argument) + 64, 256);
/* Eval the system command, thus replacing all environment variables */
do_eval(&ds_cmd, command->first_argument, TRUE);
DBUG_PRINT("info", ("running system command '%s' as '%s'",
command->first_argument, ds_cmd.str));
if (system(ds_cmd.str))
{
if (command->abort_on_error)
die("system command '%s' failed", command->first_argument);
/* If ! abort_on_error, log message and continue */
dynstr_append(&ds_res, "system command '");
replace_dynstr_append(&ds_res, command->first_argument);
dynstr_append(&ds_res, "' failed\n");
}
command->last_argument= command->end;
return 0;
}
@ -1473,7 +1498,7 @@ int do_echo(struct st_query *command)
ds= &ds_res;
init_dynamic_string(&ds_echo, "", 256, 256);
do_eval(&ds_echo, command->first_argument);
do_eval(&ds_echo, command->first_argument, FALSE);
dynstr_append_mem(ds, ds_echo.str, ds_echo.length);
dynstr_append_mem(ds, "\n", 1);
dynstr_free(&ds_echo);
@ -2205,8 +2230,7 @@ static void get_replace(struct st_query *q)
if (!(glob_replace=init_replace((char**) from_array.typelib.type_names,
(char**) to_array.typelib.type_names,
(uint) from_array.typelib.count,
word_end_chars)) ||
initialize_replace_buffer())
word_end_chars)))
die("Can't initialize replace from '%s'", q->query);
free_pointer_array(&from_array);
free_pointer_array(&to_array);
@ -2234,7 +2258,6 @@ void free_replace()
{
my_free((char*) glob_replace,MYF(0));
glob_replace=0;
my_free(out_buff,MYF(MY_WME));
}
DBUG_VOID_RETURN;
}
@ -2712,12 +2735,41 @@ int do_done(struct st_query *q)
}
/*
Process start of a "if" or "while" statement
SYNOPSIS
do_block()
cmd Type of block
q called command
DESCRIPTION
if ([!]<expr>)
{
<block statements>
}
while ([!]<expr>)
{
<block statements>
}
Evaluates the <expr> and if it evaluates to
greater than zero executes the following code block.
A '!' can be used before the <expr> to indicate it should
be executed if it evaluates to zero.
*/
int do_block(enum block_cmd cmd, struct st_query* q)
{
char *p= q->first_argument;
const char *expr_start, *expr_end;
VAR v;
const char *cmd_name= (cmd == cmd_while ? "while" : "if");
my_bool not_expr= FALSE;
DBUG_ENTER("do_block");
DBUG_PRINT("enter", ("%s", cmd_name));
/* Check stack overflow */
if (cur_block == block_stack_end)
@ -2738,8 +2790,16 @@ int do_block(enum block_cmd cmd, struct st_query* q)
/* Parse and evaluate test expression */
expr_start= strchr(p, '(');
if (!expr_start)
if (!expr_start++)
die("missing '(' in %s", cmd_name);
/* Check for !<expr> */
if (*expr_start == '!')
{
not_expr= TRUE;
expr_start++; /* Step past the '!' */
}
/* Find ending ')' */
expr_end= strrchr(expr_start, ')');
if (!expr_end)
die("missing ')' in %s", cmd_name);
@ -2753,15 +2813,20 @@ int do_block(enum block_cmd cmd, struct st_query* q)
die("Missing '{' after %s. Found \"%s\"", cmd_name, p);
var_init(&v,0,0,0,0);
eval_expr(&v, ++expr_start, &expr_end);
eval_expr(&v, expr_start, &expr_end);
/* Define inner block */
cur_block++;
cur_block->cmd= cmd;
cur_block->ok= (v.int_val ? TRUE : FALSE);
if (not_expr)
cur_block->ok = !cur_block->ok;
DBUG_PRINT("info", ("OK: %d", cur_block->ok));
var_free(&v);
return 0;
DBUG_VOID_RETURN;
}
@ -2878,10 +2943,16 @@ int read_line(char *buf, int size)
continue;
}
/* Line counting is independent of state */
if (c == '\n')
{
/* Line counting is independent of state */
cur_file->lineno++;
/* Convert cr/lf to lf */
if (p != buf && *(p-1) == '\r')
*(p-1)= 0;
}
switch(state) {
case R_NORMAL:
/* Only accept '{' in the beginning of a line */
@ -3050,7 +3121,7 @@ int read_query(struct st_query** q_ptr)
check_eol_junk(read_query_buf);
DBUG_RETURN(1);
}
DBUG_PRINT("info", ("query: %s", read_query_buf));
if (*p == '#')
{
@ -3107,6 +3178,9 @@ static struct my_option my_long_options[] =
{"compress", 'C', "Use the compressed server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statment",
(gptr*) &cursor_protocol, (gptr*) &cursor_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"database", 'D', "Database to use.", (gptr*) &db, (gptr*) &db, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF
@ -3141,15 +3215,6 @@ static struct my_option my_long_options[] =
{"ps-protocol", OPT_PS_PROTOCOL, "Use prepared statements protocol for communication",
(gptr*) &ps_protocol, (gptr*) &ps_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"sp-protocol", OPT_SP_PROTOCOL, "Use stored procedures for select",
(gptr*) &sp_protocol, (gptr*) &sp_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statment",
(gptr*) &cursor_protocol, (gptr*) &cursor_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"view-protocol", OPT_VIEW_PROTOCOL, "Use views for select",
(gptr*) &view_protocol, (gptr*) &view_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"quiet", 's', "Suppress all normal output.", (gptr*) &silent,
(gptr*) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"record", 'r', "Record output of test_file into result file.",
@ -3172,6 +3237,9 @@ static struct my_option my_long_options[] =
{"socket", 'S', "Socket file to use for connection.",
(gptr*) &unix_sock, (gptr*) &unix_sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"sp-protocol", OPT_SP_PROTOCOL, "Use stored procedures for select",
(gptr*) &sp_protocol, (gptr*) &sp_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#include "sslopt-longopts.h"
{"test-file", 'x', "Read test from/in this file (default stdin).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -3185,6 +3253,9 @@ static struct my_option my_long_options[] =
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"view-protocol", OPT_VIEW_PROTOCOL, "Use views for select",
(gptr*) &view_protocol, (gptr*) &view_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@ -3575,34 +3646,136 @@ static int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
}
/* Append the string to ds, with optional replace */
#ifdef __WIN__
static void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val,
int len)
DYNAMIC_ARRAY patterns;
/*
init_win_path_patterns
DESCRIPTION
Setup string patterns that will be used to detect filenames that
needs to be converted from Win to Unix format
*/
static void init_win_path_patterns()
{
if (glob_replace)
/* List of string patterns to match in order to find paths */
const char* paths[] = { "$MYSQL_TEST_DIR", "./test/", 0 };
int num_paths= 2;
int i;
char* p;
DBUG_ENTER("init_win_path_patterns");
my_init_dynamic_array(&patterns, sizeof(const char*), 16, 16);
/* Loop through all paths in the array */
for (i= 0; i < num_paths; i++)
{
len=(int) replace_strings(glob_replace, &out_buff, &out_length, val);
if (len == -1)
die("Out of memory in replace");
val=out_buff;
VAR* v;
if (*(paths[i]) == '$')
{
v= var_get(paths[i], 0, 0, 0);
p= my_strdup(v->str_val, MYF(MY_FAE));
}
else
p= my_strdup(paths[i], MYF(MY_FAE));
if (insert_dynamic(&patterns, (gptr) &p))
die(NullS);
DBUG_PRINT("info", ("p: %s", p));
while (*p)
{
if (*p == '/')
*p='\\';
p++;
}
}
DBUG_VOID_RETURN;
}
static void free_win_path_patterns()
{
int i= 0;
for (i=0 ; i < patterns.elements ; i++)
{
const char** pattern= dynamic_element(&patterns, i, const char**);
my_free((gptr) *pattern, MYF(0));
}
delete_dynamic(&patterns);
}
/*
fix_win_paths
DESCRIPTION
Search the string 'val' for the patterns that are known to be
strings that contain filenames. Convert all \ to / in the
filenames that are found.
Ex:
val = 'Error "c:\mysql\mysql-test\var\test\t1.frm" didn't exist'
=> $MYSQL_TEST_DIR is found by strstr
=> all \ from c:\mysql\m... until next space is converted into /
*/
static void fix_win_paths(const char* val, int len)
{
uint i;
char *p;
DBUG_ENTER("fix_win_paths");
for (i= 0; i < patterns.elements; i++)
{
const char** pattern= dynamic_element(&patterns, i, const char**);
DBUG_PRINT("info", ("pattern: %s", *pattern));
/* Search for the path in string */
while ((p= strstr(val, *pattern)))
{
DBUG_PRINT("info", ("Found %s in val p: %s", *pattern, p));
while (*p && !my_isspace(charset_info, *p))
{
if (*p == '\\')
*p= '/';
p++;
}
DBUG_PRINT("info", ("Converted \\ to /, p: %s", p));
}
}
DBUG_PRINT("exit", (" val: %s, len: %d", val, len));
DBUG_VOID_RETURN;
}
#endif
/* Append the string to ds, with optional replace */
static void replace_dynstr_append_mem(DYNAMIC_STRING *ds,
const char *val, int len)
{
#ifdef __WIN__
fix_win_paths(val, len);
#endif
if (glob_replace_regex)
{
if (!multi_reg_replace(glob_replace_regex,(char*)val))
{
val= glob_replace_regex->buf;
if (!multi_reg_replace(glob_replace_regex, (char*)val))
{
val= glob_replace_regex->buf;
len= strlen(val);
}
}
}
dynstr_append_mem(ds, val, len);
if (glob_replace)
replace_strings_append(glob_replace, ds, val, len);
else
dynstr_append_mem(ds, val, len);
}
/* Append zero-terminated string to ds, with optional replace */
static void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val)
{
replace_dynstr_append_mem(ds, val, strlen(val));
@ -3616,8 +3789,6 @@ static void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val)
static void append_field(DYNAMIC_STRING *ds, uint col_idx, MYSQL_FIELD* field,
const char* val, ulonglong len, bool is_null)
{
char buf[256];
if (col_idx < max_replace_column && replace_column[col_idx])
{
val= replace_column[col_idx];
@ -4426,7 +4597,7 @@ static void run_query(MYSQL *mysql, struct st_query *command, int flags)
if (command->type == Q_EVAL)
{
init_dynamic_string(&eval_query, "", 16384, 65536);
do_eval(&eval_query, command->query);
do_eval(&eval_query, command->query, FALSE);
query = eval_query.str;
query_len = eval_query.length;
}
@ -4920,6 +5091,10 @@ int main(int argc, char **argv)
init_var_hash(&cur_con->mysql);
#ifdef __WIN__
init_win_path_patterns();
#endif
/*
Initialize $mysql_errno with -1, so we can
- distinguish it from valid values ( >= 0 ) and
@ -5990,60 +6165,57 @@ static uint replace_len(my_string str)
}
/* Replace strings; Return length of result string */
uint replace_strings(REPLACE *rep, my_string *start,uint *max_length,
const char *from)
/* Replace strings while appending to ds */
void replace_strings_append(REPLACE *rep, DYNAMIC_STRING* ds,
const char *str, int len)
{
reg1 REPLACE *rep_pos;
reg2 REPLACE_STRING *rep_str;
my_string to,end,pos,new_str;
const char *start, *from;
DBUG_ENTER("replace_strings_append");
end=(to= *start) + *max_length-1;
start= from= str;
rep_pos=rep+1;
for (;;)
{
/* Loop through states */
DBUG_PRINT("info", ("Looping through states"));
while (!rep_pos->found)
{
rep_pos= rep_pos->next[(uchar) *from];
if (to == end)
{
(*max_length)+=8192;
if (!(new_str=my_realloc(*start,*max_length,MYF(MY_WME))))
return (uint) -1;
to=new_str+(to - *start);
end=(*start=new_str)+ *max_length-1;
}
*to++= *from++;
}
rep_pos= rep_pos->next[(uchar) *from++];
/* Does this state contain a string to be replaced */
if (!(rep_str = ((REPLACE_STRING*) rep_pos))->replace_string)
return (uint) (to - *start)-1;
to-=rep_str->to_offset;
for (pos=rep_str->replace_string; *pos ; pos++)
{
if (to == end)
{
(*max_length)*=2;
if (!(new_str=my_realloc(*start,*max_length,MYF(MY_WME))))
return (uint) -1;
to=new_str+(to - *start);
end=(*start=new_str)+ *max_length-1;
}
*to++= *pos;
/* No match found */
dynstr_append_mem(ds, start, from - start - 1);
DBUG_PRINT("exit", ("Found no more string to replace, appended: %s", start));
DBUG_VOID_RETURN;
}
/* Found a string that needs to be replaced */
DBUG_PRINT("info", ("found: %d, to_offset: %d, from_offset: %d, string: %s",
rep_str->found, rep_str->to_offset,
rep_str->from_offset, rep_str->replace_string));
/* Append part of original string before replace string */
dynstr_append_mem(ds, start, (from - rep_str->to_offset) - start);
/* Append replace string */
dynstr_append_mem(ds, rep_str->replace_string,
strlen(rep_str->replace_string));
if (!*(from-=rep_str->from_offset) && rep_pos->found != 2)
return (uint) (to - *start);
{
/* End of from string */
DBUG_PRINT("exit", ("Found end of from string"));
DBUG_VOID_RETURN;
}
DBUG_ASSERT(from <= str+len);
start= from;
rep_pos=rep;
}
}
static int initialize_replace_buffer(void)
{
out_length=8192;
if (!(out_buff=my_malloc(out_length,MYF(MY_WME))))
return(1);
return 0;
}
/****************************************************************************
Replace results for a column
@ -6102,105 +6274,6 @@ static void get_replace_column(struct st_query *q)
q->last_argument= q->end;
}
#if defined(__NETWARE__) || defined(__WIN__)
/*
Substitute environment variables with text.
SYNOPSIS
subst_env_var()
arg String that should be substitute
DESCRIPTION
This function takes a string as an input and replaces the
environment variables, that starts with '$' character, with it value.
NOTES
Return string must be freed with my_free()
RETURN
String with environment variables replaced.
*/
static char *subst_env_var(const char *str)
{
char *result;
char *pos;
result= pos= my_malloc(MAX_QUERY, MYF(MY_FAE));
while (*str)
{
/*
need this only when we want to provide the functionality of
escaping through \ 'backslash'
if ((result == pos && *str=='$') ||
(result != pos && *str=='$' && str[-1] !='\\'))
*/
if (*str == '$')
{
char env_var[256], *env_pos= env_var, *subst;
/* Search for end of environment variable */
for (str++;
*str && !isspace(*str) && *str != '\\' && *str != '/' &&
*str != '$';
str++)
*env_pos++= *str;
*env_pos= 0;
if (!(subst= getenv(env_var)))
{
my_free(result, MYF(0));
die("MYSQLTEST.NLM: Environment variable %s is not defined",
env_var);
}
/* get the string to be substitued for env_var */
pos= strmov(pos, subst);
/* Process delimiter in *str again */
}
else
*pos++= *str++;
}
*pos= 0;
return result;
}
/*
popen replacement for Netware
SYNPOSIS
my_popen()
name Command to execute (with possible env variables)
mode Mode for popen.
NOTES
Environment variable expansion does not take place for popen function
on NetWare, so we use this function to wrap around popen to do this.
For the moment we ignore 'mode' and always use 'r0'
RETURN
# >= 0 File handle
-1 Error
*/
#undef popen /* Remove wrapper */
#ifdef __WIN__
#define popen _popen /* redefine for windows */
#endif
FILE *my_popen(const char *cmd, const char *mode __attribute__((unused)))
{
char *subst_cmd;
FILE *res_file;
subst_cmd= subst_env_var(cmd);
res_file= popen(subst_cmd, "r0");
my_free(subst_cmd, MYF(0));
return res_file;
}
#endif /* __NETWARE__ or __WIN__*/

View file

@ -1109,7 +1109,7 @@ read_history(const char *filename)
if (h == NULL || e == NULL)
rl_initialize();
return (history(h, &ev, H_LOAD, filename));
return (history(h, &ev, H_LOAD, filename) == -1);
}
@ -1123,7 +1123,7 @@ write_history(const char *filename)
if (h == NULL || e == NULL)
rl_initialize();
return (history(h, &ev, H_SAVE, filename));
return (history(h, &ev, H_SAVE, filename) == -1);
}

View file

@ -334,6 +334,9 @@ then
# mysqld requires -fno-implicit-templates.
# Disable exceptions as they seams to create problems with gcc and threads.
# mysqld doesn't use run-time-type-checking, so we disable it.
# We should use -Wno-invalid-offsetof flag to disable some warnings from gcc
# regarding offset() usage in C++ which are done in a safe manner in the
# server
CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti"
AC_DEFINE([HAVE_EXPLICIT_TEMPLATE_INSTANTIATION],
[1], [Defined by configure. Use explicit template instantiation.])

View file

@ -209,7 +209,7 @@ struct settings {
static BOOLEAN init_done= FALSE; /* Set to TRUE when initialization done */
static struct settings init_settings;
static char *db_process= 0; /* Pointer to process name; argv[0] */
static const char *db_process= 0;/* Pointer to process name; argv[0] */
typedef struct _db_code_state_ {
const char *process; /* Pointer to process name; usually argv[0] */

View file

@ -18,7 +18,7 @@
BUILT_SOURCES = mysql_version.h m_ctype.h my_config.h
pkginclude_HEADERS = my_dbug.h m_string.h my_sys.h my_list.h my_xml.h \
mysql.h mysql_com.h mysql_embed.h \
my_semaphore.h my_pthread.h my_no_pthread.h raid.h \
my_semaphore.h my_pthread.h my_no_pthread.h \
errmsg.h my_global.h my_net.h my_alloc.h \
my_getopt.h sslopt-longopts.h my_dir.h typelib.h \
sslopt-vars.h sslopt-case.h sql_common.h keycache.h \

View file

@ -211,7 +211,7 @@ typedef uint rf_SetTimer;
#define my_sigset(A,B) signal((A),(B))
#define finite(A) _finite(A)
#define sleep(A) Sleep((A)*1000)
#define popen(A) popen(A,B) _popen((A),(B))
#define popen(A,B) _popen((A),(B))
#define pclose(A) _pclose(A)
#ifndef __BORLANDC__

View file

@ -915,5 +915,4 @@ void netware_reg_user(const char *ip, const char *user,
#endif
C_MODE_END
#include "raid.h"
#endif /* _my_sys_h */

View file

@ -159,8 +159,6 @@ typedef struct st_mi_isaminfo /* Struct from h_info */
uint reflength;
ulong record_offset;
ulong *rec_per_key; /* for sql optimizing */
uint raid_type,raid_chunks;
ulong raid_chunksize;
} MI_ISAMINFO;
@ -172,8 +170,6 @@ typedef struct st_mi_create_info
ulonglong auto_increment;
ulonglong data_file_length;
ulonglong key_file_length;
uint raid_type,raid_chunks;
ulong raid_chunksize;
uint old_options;
uint8 language;
my_bool with_auto_increment;

View file

@ -1,159 +0,0 @@
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Parser needs these defines always, even if USE_RAID is not defined */
#define RAID_TYPE_0 1 /* Striping */
#define RAID_TYPE_x 2 /* Some new modes */
#define RAID_TYPE_y 3
#define RAID_DEFAULT_CHUNKS 4
#define RAID_DEFAULT_CHUNKSIZE 256*1024 /* 256kB */
C_MODE_START
#define my_raid_type(raid_type) raid_type_string[(int)(raid_type)]
extern const char *raid_type_string[];
C_MODE_END
#ifdef DONT_USE_RAID
#undef USE_RAID
#endif
#if defined(USE_RAID)
#include "my_dir.h"
/* Trap all occurences of my_...() in source and use our wrapper around this function */
#ifdef MAP_TO_USE_RAID
#define my_read(A,B,C,D) my_raid_read(A,B,C,D)
#define my_write(A,B,C,D) my_raid_write(A,B,C,D)
#define my_pwrite(A,B,C,D,E) my_raid_pwrite(A,B,C,D,E)
#define my_pread(A,B,C,D,E) my_raid_pread(A,B,C,D,E)
#define my_chsize(A,B,C,D) my_raid_chsize(A,B,C,D)
#define my_close(A,B) my_raid_close(A,B)
#define my_tell(A,B) my_raid_tell(A,B)
#define my_seek(A,B,C,D) my_raid_seek(A,B,C,D)
#define my_lock(A,B,C,D,E) my_raid_lock(A,B,C,D,E)
#define my_fstat(A,B,C) my_raid_fstat(A,B,C)
#endif /* MAP_TO_USE_RAID */
#ifdef __cplusplus
extern "C" {
#endif
void init_raid(void);
void end_raid(void);
bool is_raid(File fd);
File my_raid_create(const char *FileName, int CreateFlags, int access_flags,
uint raid_type, uint raid_chunks, ulong raid_chunksize,
myf MyFlags);
File my_raid_open(const char *FileName, int Flags,
uint raid_type, uint raid_chunks, ulong raid_chunksize,
myf MyFlags);
int my_raid_rename(const char *from, const char *to, uint raid_chunks,
myf MyFlags);
int my_raid_delete(const char *from, uint raid_chunks, myf MyFlags);
int my_raid_redel(const char *old_name, const char *new_name,
uint raid_chunks, myf MyFlags);
my_off_t my_raid_seek(File fd, my_off_t pos, int whence, myf MyFlags);
my_off_t my_raid_tell(File fd, myf MyFlags);
uint my_raid_write(File,const byte *Buffer, uint Count, myf MyFlags);
uint my_raid_read(File Filedes, byte *Buffer, uint Count, myf MyFlags);
uint my_raid_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset,
myf MyFlags);
uint my_raid_pwrite(int Filedes, const byte *Buffer, uint Count,
my_off_t offset, myf MyFlags);
int my_raid_lock(File,int locktype, my_off_t start, my_off_t length,
myf MyFlags);
int my_raid_chsize(File fd, my_off_t newlength, int filler, myf MyFlags);
int my_raid_close(File, myf MyFlags);
int my_raid_fstat(int Filedes, struct stat *buf, myf MyFlags);
#ifdef __cplusplus
}
#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
class RaidName {
public:
RaidName(const char *FileName);
~RaidName();
bool IsRaid();
int Rename(const char * from, const char * to, myf MyFlags);
private:
uint _raid_type; /* RAID_TYPE_0 or RAID_TYPE_1 or RAID_TYPE_5 */
uint _raid_chunks; /* 1..n */
ulong _raid_chunksize; /* 1..n in bytes */
};
class RaidFd {
public:
RaidFd(uint raid_type, uint raid_chunks , ulong raid_chunksize);
~RaidFd();
File Create(const char *FileName, int CreateFlags, int access_flags,
myf MyFlags);
File Open(const char *FileName, int Flags, myf MyFlags);
my_off_t Seek(my_off_t pos,int whence,myf MyFlags);
my_off_t Tell(myf MyFlags);
int Write(const byte *Buffer, uint Count, myf MyFlags);
int Read(const byte *Buffer, uint Count, myf MyFlags);
int Lock(int locktype, my_off_t start, my_off_t length, myf MyFlags);
int Chsize(File fd, my_off_t newlength, int filler, myf MyFlags);
int Fstat(int fd, MY_STAT *stat_area, myf MyFlags );
int Close(myf MyFlags);
static bool IsRaid(File fd);
static DYNAMIC_ARRAY _raid_map; /* Map of RaidFD* */
private:
uint _raid_type; /* RAID_TYPE_0 or RAID_TYPE_1 or RAID_TYPE_5 */
uint _raid_chunks; /* 1..n */
ulong _raid_chunksize; /* 1..n in bytes */
ulong _total_block; /* We are operating with block no x (can be 0..many). */
uint _this_block; /* can be 0.._raid_chunks */
uint _remaining_bytes; /* Maximum bytes that can be written in this block */
my_off_t _position;
my_off_t _size; /* Cached file size for faster seek(SEEK_END) */
File _fd;
File *_fd_vector; /* Array of File */
off_t *_seek_vector; /* Array of cached seek positions */
inline void Calculate()
{
DBUG_ENTER("RaidFd::_Calculate");
DBUG_PRINT("info",("_position: %lu _raid_chunksize: %d, _size: %lu",
(ulong) _position, _raid_chunksize, (ulong) _size));
_total_block = (ulong) (_position / _raid_chunksize);
_this_block = _total_block % _raid_chunks; /* can be 0.._raid_chunks */
_remaining_bytes = (uint) (_raid_chunksize -
(_position - _total_block * _raid_chunksize));
DBUG_PRINT("info",
("_total_block: %d this_block: %d _remaining_bytes:%d",
_total_block, _this_block, _remaining_bytes));
DBUG_VOID_RETURN;
}
};
#endif /* __cplusplus */
#endif /* USE_RAID */

View file

@ -1364,8 +1364,12 @@ mysql_stat(MYSQL *mysql)
int STDCALL
mysql_ping(MYSQL *mysql)
{
int res;
DBUG_ENTER("mysql_ping");
DBUG_RETURN(simple_command(mysql,COM_PING,0,0,0));
res= simple_command(mysql,COM_PING,0,0,0);
if (res == CR_SERVER_LOST && mysql->reconnect)
res= simple_command(mysql,COM_PING,0,0,0);
DBUG_RETURN(res);
}

View file

@ -67,7 +67,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
event_executor.cc event.cc event_timed.cc \
rpl_filter.cc sql_partition.cc handlerton.cc sql_plugin.cc \
sql_tablespace.cc \
rpl_injector.cc my_user.c
rpl_injector.cc my_user.c partition_info.cc
libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources)
EXTRA_libmysqld_a_SOURCES = ha_innodb.cc ha_berkeley.cc ha_archive.cc \

View file

@ -2,6 +2,7 @@
# misc binlogging tests that do not require a slave running
#
-- source include/not_embedded.inc
-- source include/have_bdb.inc
-- source include/have_innodb.inc
-- source include/have_debug.inc

View file

@ -2,6 +2,7 @@
# Simple test for blackhole example
# Taken from the select test
#
-- source include/not_embedded.inc
-- source include/have_blackhole.inc
--disable_warnings

View file

@ -398,28 +398,6 @@ DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;
# Test prepared statement with 0x8300 sequence in parameter while
# running with cp932 client character set.
RESET MASTER;
CREATE TABLE t1(f1 blob);
PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)';
SET @var1= x'8300';
# TODO: Note that this doesn't actually test the code which was added for
# bug#11338 because this syntax for prepared statements causes the PS to
# be replicated differently than if we executed the PS from C or Java.
# Using this syntax, variable names are inserted into the binlog instead
# of values. The real goal of this test is to check the code that was
# added to Item_param::query_val_str() in order to do hex encoding of
# PS parameters when the client character set is cp932;
# Bug#11338 has an example java program which can be used to verify this
# code (and I have used it to test the fix) until there is some way to
# exercise this code from mysql-test-run.
EXECUTE stmt1 USING @var1;
SHOW BINLOG EVENTS FROM 102;
SELECT HEX(f1) FROM t1;
DROP table t1;
# end test for bug#11338
SET collation_connection='cp932_japanese_ci';
-- source include/ctype_filesort.inc
SET collation_connection='cp932_bin';

View file

@ -2,7 +2,7 @@
-- source include/have_binlog_format_row.inc
CREATE TABLE t1 (word CHAR(20) NOT NULL);
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1;
SELECT * FROM t1 ORDER BY word LIMIT 10;

View file

@ -56,8 +56,8 @@ SHOW CREATE TABLE test.t1;
# then LOAD DATA INFILE in slave, and use a query to compare.
# This would have the advantage that it would not assume
# the system has a 'diff'
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/rpl_row_UUID_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/rpl_row_UUID_slave.sql
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_slave.sql
connection master;
# Let's cleanup
@ -72,7 +72,7 @@ DROP TABLE test.t2;
# will be created. You will need to go to the mysql-test dir and diff
# the files your self to see what is not matching :-)
--exec diff ./var/tmp/rpl_row_UUID_master.sql ./var/tmp/rpl_row_UUID_slave.sql;
--exec diff $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_master.sql $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_slave.sql;
# Cleanup dump files.
# Long-term "system rm" is not portable; we could live without

View file

@ -40,6 +40,7 @@ SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
save_master_pos;
connection slave;
sync_with_master;
sleep 5;
--echo
--echo **** Data Insert Validation Slave Section test.t1 ****
--echo
@ -61,10 +62,10 @@ SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
# Sleep is needed for NDB to allow time for
# Injector thread to populate the bin log.
sleep 10;
save_master_pos;
connection slave;
sync_with_master;
sleep 5;
--echo
--echo **** Data Update Validation Slave Section test.t1 ****
--echo
@ -135,6 +136,7 @@ FROM test.t2 WHERE c1=2;
save_master_pos;
connection slave;
sync_with_master;
sleep 5;
--echo
--echo **** Data Insert Validation Slave Section test.t2 ****
--echo
@ -159,10 +161,10 @@ SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=2;
# Sleep is needed for NDB to allow time for
# Injector thread to populate the bin log.
sleep 15;
save_master_pos;
connection slave;
sync_with_master;
sleep 5;
--echo
--echo **** Data Update Validation Slave Section test.t2 ****
--echo
@ -174,10 +176,10 @@ connection master;
--echo
# Post test clean up section
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/rpl_row_blob_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/rpl_row_blob_slave.sql
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_blob_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_blob_slave.sql
--exec diff ./var/tmp/rpl_row_blob_master.sql ./var/tmp/rpl_row_blob_slave.sql
--exec diff $MYSQLTEST_VARDIR/tmp/rpl_row_blob_master.sql $MYSQLTEST_VARDIR/tmp/rpl_row_blob_slave.sql
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;

View file

@ -162,8 +162,8 @@ select hex(c1), hex(c2) from t1;
connection master;
# Let's have a look at generated SETs.
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
#--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
--replace_result $MYSQLTEST_VARDIR MYSQL_TEST_DIR/var
#--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001
drop table t1;
sync_slave_with_master;

View file

@ -77,8 +77,8 @@ SET AUTOCOMMIT=1;
# time to dump the databases and so we can see if they match
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/func003_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/func003_slave.sql
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/func003_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/func003_slave.sql
# First lets cleanupi
DROP FUNCTION test.f1;
@ -88,9 +88,9 @@ DROP TABLE test.t1;
# the test will show that the diff statement failed and no reject file
# will be created. You will need to go to the mysql-test dir and diff
# the files yourself to see what is not matching :-) File are located
# in mysql-test/var/tmp
# in $MYSQLTEST_VARDIR/tmp
exec diff ./var/tmp/func003_master.sql ./var/tmp/func003_slave.sql;
exec diff $MYSQLTEST_VARDIR/tmp/func003_master.sql $MYSQLTEST_VARDIR/tmp/func003_slave.sql;
# End of 5.0 test case

View file

@ -68,8 +68,8 @@ sync_slave_with_master;
connection master;
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > ./var/tmp/sp006_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > ./var/tmp/sp006_slave.sql
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/sp006_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/sp006_slave.sql
DROP PROCEDURE IF EXISTS mysqltest1.p1;
@ -81,9 +81,9 @@ DROP TABLE IF EXISTS mysqltest1.t2;
# the test will show that the diff statement failed and not reject file
# will be created. You will need to go to the mysql-test dir and diff
# the files your self to see what is not matching :-) Failed test
# Dump files will be located in mysql-test/var/tmp.
# Dump files will be located in $MYSQLTEST_VARDIR/tmp.
exec diff ./var/tmp/sp006_master.sql ./var/tmp/sp006_slave.sql;
exec diff $MYSQLTEST_VARDIR/tmp/sp006_master.sql $MYSQLTEST_VARDIR/tmp/sp006_slave.sql;
sync_slave_with_master;

View file

@ -6,13 +6,13 @@
# there is no neat way to find the backupid, this is a hack to find it...
--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > var/tmp.dat
--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
--replace_column 1 <the_backup_id>

View file

@ -36,7 +36,7 @@ let $fixed_bug16370= 0;
##### Option, for displaying files #####
#
# Attention: Displaying the directory content via "ls var/master-data/test/t*"
# Attention: Displaying the directory content via "ls $MYSQLTEST_VARDIR/master-data/test/t*"
# is probably not portable.
# let $ls= 0; disables the execution of "ls ....."
let $ls= 0;

View file

@ -9,5 +9,5 @@ eval SHOW CREATE TABLE t1;
# listing of files belonging to the table t1
if ($ls)
{
--exec ls var/master-data/test/t1*
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1*
}

View file

@ -162,6 +162,7 @@ our $path_slave_load_tmpdir; # What is this?!
our $path_mysqltest_log;
our $path_my_basedir;
our $opt_vardir; # A path but set directly on cmd line
our $opt_vardir_trace; # unix formatted opt_vardir for trace files
our $opt_tmpdir; # A path but set directly on cmd line
our $opt_restart_cleanup; # Source a file with SQL drop statements
@ -692,7 +693,7 @@ sub command_line_setup () {
{
$opt_vardir= "$glob_mysql_test_dir/var";
}
$opt_vardir_trace= $opt_vardir;
# We make the path absolute, as the server will do a chdir() before usage
unless ( $opt_vardir =~ m,^/, or
($glob_win32 and $opt_vardir =~ m,^[a-z]:/,i) )
@ -981,16 +982,26 @@ sub executable_setup () {
if ( $glob_win32 )
{
$path_client_bindir= mtr_path_exists("$glob_basedir/client_release",
"$glob_basedir/bin");
"$glob_basedir/client_debug",
"$glob_basedir/bin",
# New CMake locations.
"$glob_basedir/client/release",
"$glob_basedir/client/debug");
$exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-max",
"$path_client_bindir/mysqld-nt",
"$path_client_bindir/mysqld",
"$path_client_bindir/mysqld-debug",);
$path_language= mtr_path_exists("$glob_basedir/share/english/");
$path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets");
"$path_client_bindir/mysqld-debug",
"$glob_basedir/sql/release/mysqld",
"$glob_basedir/sql/debug/mysqld");
$path_language= mtr_path_exists("$glob_basedir/share/english/",
"$glob_basedir/sql/share/english/");
$path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets",
"$glob_basedir/sql/share/charsets");
$exe_my_print_defaults=
mtr_exe_exists("$path_client_bindir/my_print_defaults");
mtr_exe_exists("$path_client_bindir/my_print_defaults",
"$glob_basedir/extra/release/my_print_defaults",
"$glob_basedir/extra/debug/my_print_defaults");
}
else
{
@ -1031,6 +1042,7 @@ sub executable_setup () {
}
$exe_mysql_client_test=
mtr_exe_exists("$glob_basedir/tests/mysql_client_test",
"$path_client_bindir/mysql_client_test",
"/usr/bin/false");
}
$exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck");
@ -1143,9 +1155,7 @@ sub environment_setup () {
$ENV{'LC_COLLATE'}= "C";
$ENV{'USE_RUNNING_SERVER'}= $glob_use_running_server;
$ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir;
$ENV{'MYSQL_TEST_WINDIR'}= $glob_mysql_test_dir;
$ENV{'MYSQLTEST_VARDIR'}= $opt_vardir;
$ENV{'MASTER_WINMYSOCK'}= $master->[0]->{'path_mysock'};
$ENV{'MASTER_MYSOCK'}= $master->[0]->{'path_mysock'};
$ENV{'MASTER_MYSOCK1'}= $master->[1]->{'path_mysock'};
$ENV{'MASTER_MYPORT'}= $master->[0]->{'path_myport'};
@ -1169,16 +1179,6 @@ sub environment_setup () {
$ENV{'IM_MYSQLD2_PORT'}= $instance_manager->{instances}->[1]->{port};
$ENV{'IM_MYSQLD2_PATH_PID'}=$instance_manager->{instances}->[1]->{path_pid};
if ( $glob_cygwin_perl )
{
foreach my $key ('MYSQL_TEST_WINDIR','MASTER_MYSOCK')
{
$ENV{$key}= `cygpath -w $ENV{$key}`;
$ENV{$key} =~ s,\\,\\\\,g;
chomp($ENV{$key});
}
}
$ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set
# We are nice and report a bit about our settings
@ -2490,12 +2490,12 @@ sub mysqld_arguments ($$$$$$) {
if ( $type eq 'master' )
{
mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/master%s.trace",
$prefix, $opt_vardir, $sidx);
$prefix, $opt_vardir_trace, $sidx);
}
if ( $type eq 'slave' )
{
mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/slave%s.trace",
$prefix, $opt_vardir, $sidx);
$prefix, $opt_vardir_trace, $sidx);
}
}
@ -2876,7 +2876,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqlcheck .=
" --debug=d:t:A,$opt_vardir/log/mysqldump.trace";
" --debug=d:t:A,$opt_vardir_trace/log/mysqldump.trace";
}
my $cmdline_mysqldump= "$exe_mysqldump --no-defaults -uroot " .
@ -2889,7 +2889,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqldump .=
" --debug=d:t:A,$opt_vardir/log/mysqldump.trace";
" --debug=d:t:A,$opt_vardir_trace/log/mysqldump.trace";
}
my $cmdline_mysqlslap;
@ -2903,7 +2903,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqlslap .=
" --debug=d:t:A,$opt_vardir/log/mysqldump.trace";
" --debug=d:t:A,$opt_vardir_trace/log/mysqldump.trace";
}
}
@ -2913,7 +2913,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqlimport .=
" --debug=d:t:A,$opt_vardir/log/mysqlimport.trace";
" --debug=d:t:A,$opt_vardir_trace/log/mysqlimport.trace";
}
my $cmdline_mysqlshow= "$exe_mysqlshow -uroot " .
@ -2922,7 +2922,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqlshow .=
" --debug=d:t:A,$opt_vardir/log/mysqlshow.trace";
" --debug=d:t:A,$opt_vardir_trace/log/mysqlshow.trace";
}
my $cmdline_mysqlbinlog=
@ -2933,7 +2933,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqlbinlog .=
" --debug=d:t:A,$opt_vardir/log/mysqlbinlog.trace";
" --debug=d:t:A,$opt_vardir_trace/log/mysqlbinlog.trace";
}
my $cmdline_mysql=
@ -3075,7 +3075,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", $opt_vardir);
mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", $opt_vardir_trace);
}
if ( $opt_ssl_supported )

View file

@ -217,8 +217,8 @@ MY_LOG_DIR="$MYSQL_TEST_DIR/var/log"
#
# Set LD_LIBRARY_PATH if we are using shared libraries
#
LD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$BASEDIR/zlib/.libs:$LD_LIBRARY_PATH"
DYLD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$BASEDIR/zlib/.libs:$DYLD_LIBRARY_PATH"
LD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$BASEDIR/libmysql_r/.libs:$BASEDIR/zlib/.libs:$LD_LIBRARY_PATH"
DYLD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$BASEDIR/libmysql_r/.libs:$BASEDIR/zlib/.libs:$DYLD_LIBRARY_PATH"
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH
#

View file

@ -1,4 +1,6 @@
BUILT_SOURCES = ndbcluster
benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test/ndb

View file

@ -6,26 +6,26 @@ Table Op Msg_type Msg_text
test.t4 backup error Failed copying .frm file (errno: X)
test.t4 backup status Operation failed
Warnings:
Warning 1287 'BACKUP TABLE' is deprecated; use 'Command will be removed in next version.' instead
Warning 1540 The 'BACKUP TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
Error 1 Can't create/write to file 'MYSQLTEST_VARDIR/bogus/t4.frm' (Errcode: X)
backup table t4 to '../tmp';
Table Op Msg_type Msg_text
test.t4 backup status OK
Warnings:
Warning 1287 'BACKUP TABLE' is deprecated; use 'Command will be removed in next version.' instead
Warning 1540 The 'BACKUP TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
backup table t4 to '../tmp';
Table Op Msg_type Msg_text
test.t4 backup error Failed copying .frm file (errno: X)
test.t4 backup status Operation failed
Warnings:
Warning 1287 'BACKUP TABLE' is deprecated; use 'Command will be removed in next version.' instead
Warning 1540 The 'BACKUP TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
Error 1 Can't create/write to file 'MYSQLTEST_VARDIR/tmp/t4.frm' (Errcode: X)
drop table t4;
restore table t4 from '../tmp';
Table Op Msg_type Msg_text
test.t4 restore status OK
Warnings:
Warning 1287 'RESTORE TABLE' is deprecated; use 'Command will be removed in next version.' instead
Warning 1540 The 'RESTORE TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
select count(*) from t4;
count(*)
0
@ -35,19 +35,19 @@ backup table t1 to '../tmp';
Table Op Msg_type Msg_text
test.t1 backup status OK
Warnings:
Warning 1287 'BACKUP TABLE' is deprecated; use 'Command will be removed in next version.' instead
Warning 1540 The 'BACKUP TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
drop table t1;
restore table t1 from '../bogus';
Table Op Msg_type Msg_text
t1 restore error Failed copying .frm file
Warnings:
Warning 1287 'RESTORE TABLE' is deprecated; use 'Command will be removed in next version.' instead
Warning 1540 The 'RESTORE TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
Error 29 File 'MYSQLTEST_VARDIR/bogus/t1.frm' not found (Errcode: X)
restore table t1 from '../tmp';
Table Op Msg_type Msg_text
test.t1 restore status OK
Warnings:
Warning 1287 'RESTORE TABLE' is deprecated; use 'Command will be removed in next version.' instead
Warning 1540 The 'RESTORE TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
select n from t1;
n
23
@ -62,7 +62,7 @@ Table Op Msg_type Msg_text
test.t2 backup status OK
test.t3 backup status OK
Warnings:
Warning 1287 'BACKUP TABLE' is deprecated; use 'Command will be removed in next version.' instead
Warning 1540 The 'BACKUP TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
drop table t1,t2,t3;
restore table t1,t2,t3 from '../tmp';
Table Op Msg_type Msg_text
@ -70,7 +70,7 @@ test.t1 restore status OK
test.t2 restore status OK
test.t3 restore status OK
Warnings:
Warning 1287 'RESTORE TABLE' is deprecated; use 'Command will be removed in next version.' instead
Warning 1540 The 'RESTORE TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
select n from t1;
n
23
@ -91,7 +91,7 @@ restore table t1 from '../tmp';
Table Op Msg_type Msg_text
test.t1 restore status OK
Warnings:
Warning 1287 'RESTORE TABLE' is deprecated; use 'Command will be removed in next version.' instead
Warning 1540 The 'RESTORE TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
rename table t1 to t5;
lock tables t5 write;
backup table t5 to '../tmp';
@ -99,5 +99,5 @@ unlock tables;
Table Op Msg_type Msg_text
test.t5 backup status OK
Warnings:
Warning 1287 'BACKUP TABLE' is deprecated; use 'Command will be removed in next version.' instead
Warning 1540 The 'BACKUP TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
drop table t5;

View file

@ -11315,20 +11315,6 @@ DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;
RESET MASTER;
CREATE TABLE t1(f1 blob);
PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)';
SET @var1= x'8300';
EXECUTE stmt1 USING @var1;
SHOW BINLOG EVENTS FROM 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 102 Query 1 189 use `test`; CREATE TABLE t1(f1 blob)
master-bin.000001 189 User var 1 228 @`var1`=_binary 0x8300 COLLATE binary
master-bin.000001 228 Query 1 321 use `test`; INSERT INTO t1 VALUES(@'var1')
SELECT HEX(f1) FROM t1;
HEX(f1)
8300
DROP table t1;
SET collation_connection='cp932_japanese_ci';
create table t1 select repeat('a',4000) a;
delete from t1;

View file

@ -1,4 +1,4 @@
drop table if exists t1;
drop table if exists t1,t2;
select CASE "b" when "a" then 1 when "b" then 2 END;
CASE "b" when "a" then 1 when "b" then 2 END
2

View file

@ -770,3 +770,9 @@ t1 CREATE TABLE `t1` (
`i` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=4294967295
drop table t1;
create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
character set utf8 collate utf8_general_ci;
Warnings:
Warning 1071 Specified key was too long; max key length is 765 bytes
insert into t1 values('aaa');
drop table t1;

View file

@ -8,9 +8,9 @@ SET @var1= x'8300';
EXECUTE stmt1 USING @var1;
SHOW BINLOG EVENTS FROM 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(f1 blob)
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 102 Query 1 189 use `test`; CREATE TABLE t1(f1 blob)
master-bin.000001 189 User var 1 228 @`var1`=_binary 0x8300 COLLATE binary
master-bin.000001 228 Query 1 321 use `test`; INSERT INTO t1 VALUES(@'var1')
SELECT HEX(f1) FROM t1;
HEX(f1)
8300

View file

@ -363,7 +363,7 @@ create event закачка on schedule every 10 hour do select get_lock("test_l
show processlist;
Id User Host db Command Time State Info
# root localhost events_test Query # NULL show processlist
# event_scheduler connecting host NULL Connect # Sleeping NULL
# event_scheduler localhost NULL Connect # Sleeping NULL
# root localhost events_test Connect # User lock select get_lock("test_lock2", 20)
"Release the mutex, the event worker should finish."
select release_lock("test_lock2");
@ -382,7 +382,7 @@ set global event_scheduler=0;
show processlist;
Id User Host db Command Time State Info
# root localhost events_test Query # NULL show processlist
# event_scheduler connecting host NULL Connect # Sleeping NULL
# event_scheduler localhost NULL Connect # Sleeping NULL
# root localhost events_test Connect # User lock select get_lock("test_lock2_1", 20)
"Release the lock so the child process should finish. Hence the scheduler also"
select release_lock("test_lock2_1");
@ -397,4 +397,24 @@ create table t_16 (s1 int);
create trigger t_16_bi before insert on t_16 for each row create event e_16 on schedule every 1 second do set @a=5;
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
drop table t_16;
create event white_space
on schedule every 10 hour
disable
do
select 1;
select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
event_schema event_name definer event_body
events_test white_space root@localhost select 1
drop event white_space;
create event white_space on schedule every 10 hour disable do
select 2;
select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
event_schema event_name definer event_body
events_test white_space root@localhost select 2
drop event white_space;
create event white_space on schedule every 10 hour disable do select 3;
select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
event_schema event_name definer event_body
events_test white_space root@localhost select 3
drop event white_space;
drop database events_test;

View file

@ -0,0 +1,149 @@
create database if not exists events_test;
use events_test;
set global event_scheduler=0;
"Wait a bit to settle down"
delete from mysql.event;
set global event_scheduler= 1;
set @old_sql_mode:=@@sql_mode;
set sql_mode=ansi;
select get_lock('test_bug16407', 60);
get_lock('test_bug16407', 60)
1
create event e_16407 on schedule every 60 second do
begin
select get_lock('test_bug16407', 60);
drop table "hashed_num";
end|
"Now if everything is fine the event has compiled and is locked
show processlist;
Id User Host db Command Time State Info
# root localhost events_test Query # NULL show processlist
# event_scheduler localhost NULL Connect # Sleeping NULL
# root localhost events_test Connect # User lock select get_lock('test_bug16407', 60)
select release_lock('test_bug16407');
release_lock('test_bug16407')
1
set global event_scheduler= 0;
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
event_schema event_name sql_mode
events_test e_16407 REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI
"Let's check whether we change the sql_mode on ALTER EVENT"
set sql_mode='traditional';
alter event e_16407 do select 1;
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
event_schema event_name sql_mode
events_test e_16407 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
drop event e_16407;
"Another sql_mode test"
set sql_mode="traditional";
create table events_smode_test(ev_name char(10), a date) engine=myisam;
"This should never insert something"
create event ee_16407_2 on schedule every 60 second do
begin
select get_lock('ee_16407_2', 60);
insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
end|
insert into events_smode_test values ('test','1980-19-02')|
ERROR 22007: Incorrect date value: '1980-19-02' for column 'a' at row 1
"This is ok"
create event ee_16407_3 on schedule every 60 second do
begin
select get_lock('ee_16407_2', 60);
insert into events_test.events_smode_test values ('ee_16407_3','1980-02-19');
insert into events_test.events_smode_test values ('ee_16407_3','1980-02-29');
end|
set sql_mode=""|
"This will insert rows but they will be truncated"
create event ee_16407_4 on schedule every 60 second do
begin
select get_lock('ee_16407_2', 60);
insert into events_test.events_smode_test values ('ee_16407_4','10-11-1956');
end|
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
event_schema event_name sql_mode
events_test ee_16407_2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
events_test ee_16407_3 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
events_test ee_16407_4
set sql_mode="ansi";
select get_lock('ee_16407_2', 60);
get_lock('ee_16407_2', 60)
1
set global event_scheduler= 1;
show processlist;
Id User Host db Command Time State Info
# root localhost events_test Query # NULL show processlist
# event_scheduler localhost NULL Connect # Sleeping NULL
# root localhost events_test Connect # User lock select get_lock('ee_16407_2', 60)
# root localhost events_test Connect # User lock select get_lock('ee_16407_2', 60)
# root localhost events_test Connect # User lock select get_lock('ee_16407_2', 60)
select release_lock('ee_16407_2');
release_lock('ee_16407_2')
1
show processlist;
Id User Host db Command Time State Info
# root localhost events_test Query # NULL show processlist
# event_scheduler localhost NULL Connect # Sleeping NULL
set global event_scheduler= 0;
select * from events_smode_test order by ev_name, a;
ev_name a
ee_16407_3 1980-02-19
ee_16407_3 1980-02-29
ee_16407_4 0000-00-00
"OK, last check before we drop them"
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
event_schema event_name sql_mode
events_test ee_16407_2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
events_test ee_16407_3 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
events_test ee_16407_4
drop event ee_16407_2;
drop event ee_16407_3;
drop event ee_16407_4;
"And now one last test regarding sql_mode and call of SP from an event"
delete from events_smode_test;
set sql_mode='traditional';
create procedure ee_16407_5_pendant() begin insert into events_test.events_smode_test values('ee_16407_5','2001-02-29'); end|
create procedure ee_16407_6_pendant() begin insert into events_test.events_smode_test values('ee_16407_6','2004-02-29'); end|
create event ee_16407_5 on schedule every 60 second do
begin
select get_lock('ee_16407_5', 60);
call events_test.ee_16407_5_pendant();
end|
create event ee_16407_6 on schedule every 60 second do
begin
select get_lock('ee_16407_5', 60);
call events_test.ee_16407_6_pendant();
end|
set sql_mode='ansi';
select get_lock('ee_16407_5', 60);
get_lock('ee_16407_5', 60)
1
set global event_scheduler= 1;
show processlist;
Id User Host db Command Time State Info
# root localhost events_test Query # NULL show processlist
# event_scheduler localhost NULL Connect # Sleeping NULL
# root localhost events_test Connect # User lock select get_lock('ee_16407_5', 60)
# root localhost events_test Connect # User lock select get_lock('ee_16407_5', 60)
select release_lock('ee_16407_5');
release_lock('ee_16407_5')
1
show processlist;
Id User Host db Command Time State Info
# root localhost events_test Query # NULL show processlist
# event_scheduler localhost NULL Connect # Sleeping NULL
select * from events_smode_test order by ev_name, a;
ev_name a
ee_16407_6 2004-02-29
"And here we check one more time before we drop the events"
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
event_schema event_name sql_mode
events_test ee_16407_5 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
events_test ee_16407_6 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
drop event ee_16407_5;
drop event ee_16407_6;
drop procedure ee_16407_5_pendant;
drop procedure ee_16407_6_pendant;
set global event_scheduler= 0;
drop table events_smode_test;
set sql_mode=@old_sql_mode;
drop database events_test;

View file

@ -0,0 +1,59 @@
create database if not exists events_test;
use events_test;
CREATE EVENT micro_test ON SCHEDULE EVERY 100 MICROSECOND DO SELECT 1;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
CREATE EVENT micro_test ON SCHEDULE EVERY 100 DAY_MICROSECOND DO SELECT 1;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
CREATE EVENT micro_test ON SCHEDULE EVERY 100 HOUR_MICROSECOND DO SELECT 1;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
CREATE EVENT micro_test ON SCHEDULE EVERY 100 MINUTE_MICROSECOND DO SELECT 1;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
CREATE EVENT micro_test ON SCHEDULE EVERY 100 SECOND_MICROSECOND DO SELECT 1;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
"Now create normal event and change it on SQL level"
CREATE EVENT micro_test2 ON SCHEDULE EVERY 1 MONTH DO SELECT 1;
UPDATE mysql.event SET interval_field='MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
SHOW CREATE EVENT micro_test2;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
SET GLOBAL event_scheduler=0;
"Should not be running:"
SHOW VARIABLES like 'event_scheduler';
Variable_name Value
event_scheduler OFF
UPDATE mysql.event SET interval_field='DAY_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
SHOW CREATE EVENT micro_test2;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
SET GLOBAL event_scheduler=0;
"Should not be running:"
SHOW VARIABLES like 'event_scheduler';
Variable_name Value
event_scheduler OFF
UPDATE mysql.event SET interval_field='SECOND_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
SHOW CREATE EVENT micro_test2;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
SET GLOBAL event_scheduler=0;
"Should not be running:"
SHOW VARIABLES like 'event_scheduler';
Variable_name Value
event_scheduler OFF
UPDATE mysql.event SET interval_field='HOUR_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
SHOW CREATE EVENT micro_test2;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
SET GLOBAL event_scheduler=0;
"Should not be running:"
SHOW VARIABLES like 'event_scheduler';
Variable_name Value
event_scheduler OFF
UPDATE mysql.event SET interval_field='MINUTE_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
SHOW CREATE EVENT micro_test2;
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
SET GLOBAL event_scheduler=0;
"Should not be running:"
SHOW VARIABLES like 'event_scheduler';
Variable_name Value
event_scheduler OFF
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER='event_scheduler';
COUNT(*)
0
DROP EVENT micro_test2;
drop database events_test;

View file

@ -42,13 +42,13 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select sql_no_cache database() AS `database()`,user() AS `user()`
create table t1 (version char(40)) select database(), user(), version() as 'version';
create table t1 (version char(60)) select database(), user(), version() as 'version';
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`database()` varchar(34) character set utf8 default NULL,
`user()` varchar(77) character set utf8 NOT NULL default '',
`version` char(40) default NULL
`version` char(60) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select charset(charset(_utf8'a')), charset(collation(_utf8'a'));

View file

@ -448,7 +448,7 @@ Create view Tables To create new views
Create user Server Admin To create new users
Delete Tables To delete existing rows
Drop Databases,Tables To drop databases, tables, and views
Event Server Admin Creation, alteration, deletion and execution of events.
Event Server Admin To create, alter, drop and execute events
Execute Functions,Procedures To execute stored routines
File File access on server To read and write files on the server
Grant option Databases,Tables,Functions,Procedures To give to other users those privileges you possess

View file

@ -1,3 +1,4 @@
drop table if exists t1;
create table t1 (col1 integer primary key, col2 integer) engine=innodb;
insert t1 values (1,100);
create function f1 () returns integer begin

View file

@ -5,7 +5,7 @@ insert into t1 values (3);
update t1 set a=a+2 where a=2;
update t1 set a=a+2 where a=3;
create table t2 (word varchar(20));
load data infile '../../std_data/words.dat' into table t2;
load data infile '../std_data_ln/words.dat' into table t2;
drop table t1;
drop table t2;
select * from t1;

View file

@ -1,3 +1,5 @@
DROP SCHEMA test;
CREATE SCHEMA test;
cluster_replication.binlog_index OK
mysql.columns_priv OK
mysql.db OK

View file

@ -1464,7 +1464,10 @@ DROP TABLE IF EXISTS `v2`;
) */;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') WITH CASCADED CHECK OPTION*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */
/*!50002 WITH CASCADED CHECK OPTION */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@ -1797,7 +1800,9 @@ DROP TABLE IF EXISTS `v1`;
) */;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v1` AS select `t1`.`a` AS `a` from `t1` */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@ -1853,7 +1858,10 @@ DROP TABLE IF EXISTS `v2`;
) */;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') WITH CASCADED CHECK OPTION*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */
/*!50002 WITH CASCADED CHECK OPTION */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@ -1959,13 +1967,19 @@ DROP TABLE IF EXISTS `v3`;
) */;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `v3` where (`v3`.`b` in (1,2,3,4,5,6,7))*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `v3` where (`v3`.`b` in (1,2,3,4,5,6,7)) */;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `v3`.`a` AS `a` from (`v3` join `v1`) where ((`v1`.`a` = `v3`.`a`) and (`v3`.`b` = 3)) limit 1*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v2` AS select `v3`.`a` AS `a` from (`v3` join `v1`) where ((`v1`.`a` = `v3`.`a`) and (`v3`.`b` = 3)) limit 1 */;
/*!50001 DROP TABLE IF EXISTS `v3`*/;
/*!50001 DROP VIEW IF EXISTS `v3`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b`,`t1`.`c` AS `c` from `t1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v3` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b`,`t1`.`c` AS `c` from `t1` */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@ -2399,10 +2413,10 @@ drop table t1;
set global time_zone=default;
set time_zone=default;
DROP TABLE IF EXISTS `t1 test`;
DROP TABLE IF EXISTS `t2 test`;
CREATE TABLE `t1 test` (
`a1` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `t2 test`;
CREATE TABLE `t2 test` (
`a2` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@ -2534,13 +2548,19 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
/*!50001 DROP TABLE IF EXISTS `v0`*/;
/*!50001 DROP VIEW IF EXISTS `v0`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v0` AS select `v1`.`a` AS `a`,`v1`.`b` AS `b`,`v1`.`c` AS `c` from `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v0` AS select `v1`.`a` AS `a`,`v1`.`b` AS `b`,`v1`.`c` AS `c` from `v1` */;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b`,`t1`.`c` AS `c` from `t1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b`,`t1`.`c` AS `c` from `t1` */;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `v0`.`a` AS `a`,`v0`.`b` AS `b`,`v0`.`c` AS `c` from `v0`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v2` AS select `v0`.`a` AS `a`,`v0`.`b` AS `b`,`v0`.`c` AS `c` from `v0` */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@ -2650,3 +2670,240 @@ DELIMITER ;
DROP TRIGGER tr1;
DROP TABLE t1;
create table t1 (a int);
insert into t1 values (289), (298), (234), (456), (789);
create definer = CURRENT_USER view v1 as select * from t1;
create SQL SECURITY INVOKER view v2 as select * from t1;
create view v3 as select * from t1 with local check option;
create algorithm=merge view v4 as select * from t1 with cascaded check option;
create algorithm =temptable view v5 as select * from t1;
drop table t1;
drop view v1, v2, v3, v4, v5;
show tables;
Tables_in_test
t1
v1
v2
v3
v4
v5
select * from v3 order by a;
a
234
289
298
456
789
drop table t1;
drop view v1, v2, v3, v4, v5;
create table t1 (a int, created datetime);
create table t2 (b int, created datetime);
create trigger tr1 before insert on t1 for each row set
new.created=now();
create trigger tr2 after insert on t1
for each row
begin
insert into t2 set b=new.a and created=new.created;
end|
drop trigger tr1;
drop trigger tr2;
drop table t1, t2;
show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer
tr1 INSERT t1 set
new.created=now() BEFORE # root@localhost
tr2 INSERT t1 begin
insert into t2 set b=new.a and created=new.created;
end AFTER # root@localhost
drop trigger tr1;
drop trigger tr2;
drop table t1, t2;
/*!50003 CREATE FUNCTION `f`() RETURNS bigint(20)
return 42 */|
/*!50003 CREATE PROCEDURE `p`()
select 42 */|
show create function f;
Function sql_mode Create Function
f CREATE FUNCTION `f`() RETURNS bigint(20)
return 42
show create procedure p;
Procedure sql_mode Create Procedure
p CREATE PROCEDURE `p`()
select 42
drop function f;
drop procedure p;
create table t1 (a text , b text);
create table t2 (a text , b text);
insert t1 values ("Duck, Duck", "goose");
insert t1 values ("Duck, Duck", "pidgeon");
insert t2 values ("We the people", "in order to perform");
insert t2 values ("a more perfect", "union");
select * from t1;
a b
Duck, Duck goose
Duck, Duck pidgeon
select * from t2;
a b
We the people in order to perform
a more perfect union
test.t1: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0
test.t2: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0
select * from t1;
a b
Duck, Duck goose
Duck, Duck pidgeon
Duck, Duck goose
Duck, Duck pidgeon
select * from t2;
a b
We the people in order to perform
a more perfect union
We the people in order to perform
a more perfect union
create table words(a varchar(255));
create table words2(b varchar(255));
select * from t1;
a b
Duck, Duck goose
Duck, Duck pidgeon
Duck, Duck goose
Duck, Duck pidgeon
Duck, Duck goose
Duck, Duck pidgeon
select * from t2;
a b
We the people in order to perform
a more perfect union
We the people in order to perform
a more perfect union
We the people in order to perform
a more perfect union
select * from words;
a
Aarhus
Aaron
Ababa
aback
abaft
abandon
abandoned
abandoning
abandonment
abandons
Aarhus
Aaron
Ababa
aback
abaft
abandon
abandoned
abandoning
abandonment
abandons
abase
abased
abasement
abasements
abases
abash
abashed
abashes
abashing
abasing
abate
abated
abatement
abatements
abater
abates
abating
Abba
abbe
abbey
abbeys
abbot
abbots
Abbott
abbreviate
abbreviated
abbreviates
abbreviating
abbreviation
abbreviations
Abby
abdomen
abdomens
abdominal
abduct
abducted
abduction
abductions
abductor
abductors
abducts
Abe
abed
Abel
Abelian
Abelson
Aberdeen
Abernathy
aberrant
aberration
select * from words2;
b
abase
abased
abasement
abasements
abases
abash
abashed
abashes
abashing
abasing
abate
abated
abatement
abatements
abater
abates
abating
Abba
abbe
abbey
abbeys
abbot
abbots
Abbott
abbreviate
abbreviated
abbreviates
abbreviating
abbreviation
abbreviations
Abby
abdomen
abdomens
abdominal
abduct
abducted
abduction
abductions
abductor
abductors
abducts
Abe
abed
Abel
Abelian
Abelson
Aberdeen
Abernathy
aberrant
aberration
drop table words;
mysql-import: Error: 1146, Table 'test.words' doesn't exist, when using table: words
drop table t1;
drop table t2;
drop table words2;

View file

@ -223,7 +223,7 @@ mysqltest: At line 1: Missing arguments to let
mysqltest: At line 1: Missing variable name in let
mysqltest: At line 1: Missing assignment operator in let
mysqltest: At line 1: Missing assignment operator in let
mysqltest: At line 1: Missing arguments to let
mysqltest: At line 1: Missing assignment operator in let
mysqltest: At line 1: Missing variable name in let
mysqltest: At line 1: Missing variable name in let
mysqltest: At line 1: Missing assignment operator in let
@ -323,7 +323,10 @@ test
test2
test3
test4
Counter is greater than 0, (counter=10)
Counter is not 0, (counter=0)
1
Testing while with not
mysqltest: In included file "./include/mysqltest_while.inc": At line 64: Nesting too deeply
mysqltest: At line 1: missing '(' in while
mysqltest: At line 1: missing ')' in while

View file

@ -3,10 +3,19 @@ create table t1 ( a int primary key, b varchar(10), c varchar(10), index (b) )
engine=ndb;
insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three');
create index c on t1(c);
show indexes from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 a A 3 NULL NULL BTREE
t1 1 b 1 b A 3 NULL NULL YES BTREE
t1 1 c 1 c A 3 NULL NULL YES BTREE
select * from t1 where c = 'two';
a b c
2 two two
alter table t1 drop index c;
show indexes from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 a A 3 NULL NULL BTREE
t1 1 b 1 b A 3 NULL NULL YES BTREE
select * from t1 where c = 'two';
a b c
2 two two

View file

@ -0,0 +1,12 @@
set session binlog_format=row;
ERROR HY000: The NDB cluster engine does not support changing the binlog format on the fly yet
set session binlog_format=statement;
ERROR HY000: The NDB cluster engine does not support changing the binlog format on the fly yet
set global binlog_format=row;
ERROR HY000: The NDB cluster engine does not support changing the binlog format on the fly yet
set global binlog_format=statement;
ERROR HY000: The NDB cluster engine does not support changing the binlog format on the fly yet
set session binlog_format=default;
ERROR HY000: The NDB cluster engine does not support changing the binlog format on the fly yet
set global binlog_format=default;
ERROR HY000: The NDB cluster engine does not support changing the binlog format on the fly yet

View file

@ -64,13 +64,10 @@ a
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 2
Qcache_queries_in_cache 3
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 3
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
Qcache_inserts 4
drop table t1, t2;
set GLOBAL query_cache_size=0;
set GLOBAL ndb_cache_check_time=0;

View file

@ -4,7 +4,9 @@ DROP TABLE IF EXISTS test.t3;
DROP TABLE IF EXISTS test.t4;
DROP TABLE IF EXISTS test.t5;
DROP TABLE IF EXISTS test.t6;
**** Test 1 Simple DD backup and restore **** CREATE LOGFILE GROUP log_group1 ADD UNDOFILE './log_group1/undofile.dat'
**** Test 1 Simple DD backup and restore ****
CREATE LOGFILE GROUP log_group1
ADD UNDOFILE './log_group1/undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
@ -14,7 +16,8 @@ USE LOGFILE GROUP log_group1
INITIAL_SIZE 12M
ENGINE NDB;
CREATE TABLE test.t1
(pk1 MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL) TABLESPACE table_space1 STORAGE DISK ENGINE=NDB; SELECT COUNT(*) FROM test.t1;
(pk1 MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 CHAR(50) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL) TABLESPACE table_space1 STORAGE DISK ENGINE=NDB;
SELECT COUNT(*) FROM test.t1;
COUNT(*)
500
SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
@ -24,8 +27,16 @@ pk1 c2 c3 hex(c4)
3 Sweden 498 1
4 Sweden 497 1
5 Sweden 496 1
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
DROP TABLE test.backup_info;
DROP TABLE test.t1;
CREATE TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; DELETE FROM test.backup_info; LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM test.backup_info; @the_backup_id:=backup_id <the_backup_id> DROP TABLE test.backup_info; ALTER TABLESPACE table_space1 DROP DATAFILE './table_space1/datafile.dat'
ALTER TABLESPACE table_space1
DROP DATAFILE './table_space1/datafile.dat'
ENGINE = NDB;
DROP TABLESPACE table_space1
ENGINE = NDB;
@ -41,8 +52,12 @@ pk1 c2 c3 hex(c4)
3 Sweden 498 1
4 Sweden 497 1
5 Sweden 496 1
**** Test 2 Mixed Cluster Test backup and restore **** CREATE TABLE test.t2
(pk1 MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL)ENGINE=NDB; CREATE TABLE test.t3 (c1 int not null auto_increment, data LONGBLOB, PRIMARY KEY(c1))TABLESPACE table_space1 STORAGE DISK ENGINE=NDB; CREATE TABLE test.t4 (c1 int not null auto_increment, data LONGBLOB, PRIMARY KEY(c1))ENGINE=NDB; SELECT COUNT(*) FROM test.t1;
**** Test 2 Mixed Cluster Test backup and restore ****
CREATE TABLE test.t2
(pk1 MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 VARCHAR(200) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL)ENGINE=NDB;
CREATE TABLE test.t3 (c1 int not null auto_increment, data LONGBLOB, PRIMARY KEY(c1))TABLESPACE table_space1 STORAGE DISK ENGINE=NDB;
CREATE TABLE test.t4 (c1 int not null auto_increment, data LONGBLOB, PRIMARY KEY(c1))ENGINE=NDB;
SELECT COUNT(*) FROM test.t1;
COUNT(*)
500
SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
@ -80,7 +95,19 @@ LENGTH(data)
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2;
LENGTH(data)
16384
CREATE TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; DELETE FROM test.backup_info; LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM test.backup_info; @the_backup_id:=backup_id <the_backup_id> DROP TABLE test.backup_info; DROP TABLE test.t1; DROP TABLE test.t2; DROP TABLE test.t3; DROP TABLE test.t4; ALTER TABLESPACE table_space1 DROP DATAFILE './table_space1/datafile.dat'
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
DROP TABLE test.backup_info;
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
DROP TABLE test.t4;
ALTER TABLESPACE table_space1
DROP DATAFILE './table_space1/datafile.dat'
ENGINE = NDB;
DROP TABLESPACE table_space1
ENGINE = NDB;
@ -128,59 +155,73 @@ DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
DROP TABLE test.t4;
**** Test 3 Adding partition Test backup and restore **** CREATE TABLESPACE table_space2 ADD DATAFILE './table_space2/datafile.dat'
**** Test 3 Adding partition Test backup and restore ****
CREATE TABLESPACE table_space2
ADD DATAFILE './table_space2/datafile.dat'
USE LOGFILE GROUP log_group1
INITIAL_SIZE 12M
ENGINE NDB;
CREATE TABLE test.t1 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space1 STORAGE DISK ENGINE=NDB PARTITION BY HASH(c3) PARTITIONS 4; CREATE TABLE test.t4 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY HASH(c3) PARTITIONS 2; CREATE TABLE test.t2 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY KEY(c3) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB); CREATE TABLE test.t5 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY KEY(pk1) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB); CREATE TABLE test.t3 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY RANGE (c3) PARTITIONS 3 (PARTITION x1 VALUES LESS THAN (105), PARTITION x2 VALUES LESS THAN (333), PARTITION x3 VALUES LESS THAN (720)); CREATE TABLE test.t6 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY RANGE (pk1) PARTITIONS 2 (PARTITION x1 VALUES LESS THAN (333), PARTITION x2 VALUES LESS THAN (720)); SHOW CREATE TABLE test.t1;
CREATE TABLE test.t1 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(150) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space1 STORAGE DISK ENGINE=NDB PARTITION BY HASH(c3) PARTITIONS 4;
CREATE TABLE test.t4 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(180) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY HASH(c3) PARTITIONS 2;
CREATE TABLE test.t2 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY KEY(c3) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
CREATE TABLE test.t5 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY KEY(pk1) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
CREATE TABLE test.t3 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(202) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY RANGE (c3) PARTITIONS 3 (PARTITION x1 VALUES LESS THAN (105), PARTITION x2 VALUES LESS THAN (333), PARTITION x3 VALUES LESS THAN (720));
CREATE TABLE test.t6 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 VARCHAR(220) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY RANGE (pk1) PARTITIONS 2 (PARTITION x1 VALUES LESS THAN (333), PARTITION x2 VALUES LESS THAN (720));
SHOW CREATE TABLE test.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c2` varchar(150) NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 4 SHOW CREATE TABLE test.t2;
PRIMARY KEY (`pk1`,`c3`)
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 4
SHOW CREATE TABLE test.t2;
Table Create Table
t2 CREATE TABLE `t2` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) SHOW CREATE TABLE test.t3;
PRIMARY KEY (`pk1`,`c3`)
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster)
SHOW CREATE TABLE test.t3;
Table Create Table
t3 CREATE TABLE `t3` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c2` varchar(202) NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) SHOW CREATE TABLE test.t4;
PRIMARY KEY (`pk1`,`c3`)
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster)
SHOW CREATE TABLE test.t4;
Table Create Table
t4 CREATE TABLE `t4` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c2` varchar(180) NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 2 SHOW CREATE TABLE test.t5;
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 2
SHOW CREATE TABLE test.t5;
Table Create Table
t5 CREATE TABLE `t5` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (pk1) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) SHOW CREATE TABLE test.t6;
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (pk1) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster)
SHOW CREATE TABLE test.t6;
Table Create Table
t6 CREATE TABLE `t6` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c2` varchar(220) NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster) SELECT * FROM information_schema.partitions WHERE table_name= 't1';
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster)
SELECT * FROM information_schema.partitions WHERE table_name= 't1';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t1 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t1 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
@ -267,7 +308,21 @@ pk1 c2 c3 hex(c4)
248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1
247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1
246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1
CREATE TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; DELETE FROM test.backup_info; LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM test.backup_info; @the_backup_id:=backup_id <the_backup_id> DROP TABLE test.backup_info; DROP TABLE test.t1; DROP TABLE test.t2; DROP TABLE test.t3; DROP TABLE test.t4; DROP TABLE test.t5; DROP TABLE test.t6; ALTER TABLESPACE table_space1 DROP DATAFILE './table_space1/datafile.dat'
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
DROP TABLE test.backup_info;
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
DROP TABLE test.t4;
DROP TABLE test.t5;
DROP TABLE test.t6;
ALTER TABLESPACE table_space1
DROP DATAFILE './table_space1/datafile.dat'
ENGINE = NDB;
ALTER TABLESPACE table_space2
DROP DATAFILE './table_space2/datafile.dat'
@ -282,51 +337,57 @@ SHOW CREATE TABLE test.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c2` varchar(150) NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 4 SHOW CREATE TABLE test.t2;
PRIMARY KEY (`pk1`,`c3`)
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 4
SHOW CREATE TABLE test.t2;
Table Create Table
t2 CREATE TABLE `t2` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) SHOW CREATE TABLE test.t3;
PRIMARY KEY (`pk1`,`c3`)
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster)
SHOW CREATE TABLE test.t3;
Table Create Table
t3 CREATE TABLE `t3` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c2` varchar(202) NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) SHOW CREATE TABLE test.t4;
PRIMARY KEY (`pk1`,`c3`)
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster)
SHOW CREATE TABLE test.t4;
Table Create Table
t4 CREATE TABLE `t4` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c2` varchar(180) NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 2 SHOW CREATE TABLE test.t5;
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 2
SHOW CREATE TABLE test.t5;
Table Create Table
t5 CREATE TABLE `t5` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (pk1) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) SHOW CREATE TABLE test.t6;
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (pk1) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster)
SHOW CREATE TABLE test.t6;
Table Create Table
t6 CREATE TABLE `t6` (
`pk1` mediumint(9) NOT NULL auto_increment,
`c2` text NOT NULL,
`c2` varchar(220) NOT NULL,
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster) SELECT * FROM information_schema.partitions WHERE table_name= 't1';
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster)
SELECT * FROM information_schema.partitions WHERE table_name= 't1';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t1 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
NULL test t1 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
@ -419,5 +480,8 @@ DROP TABLE test.t3;
DROP TABLE test.t4;
DROP TABLE test.t5;
DROP TABLE test.t6;
ALTER TABLESPACE table_space1 DROP DATAFILE './table_space1/datafile.dat' ENGINE=NDB; ALTER TABLESPACE table_space2 DROP DATAFILE './table_space2/datafile.dat' ENGINE=NDB; DROP TABLESPACE table_space1 ENGINE = NDB; DROP TABLESPACE table_space2 ENGINE = NDB; DROP LOGFILE GROUP log_group1 ENGINE = NDB;
ALTER TABLESPACE table_space1 DROP DATAFILE './table_space1/datafile.dat' ENGINE=NDB;
ALTER TABLESPACE table_space2 DROP DATAFILE './table_space2/datafile.dat' ENGINE=NDB;
DROP TABLESPACE table_space1 ENGINE = NDB;
DROP TABLESPACE table_space2 ENGINE = NDB;
DROP LOGFILE GROUP log_group1 ENGINE = NDB;

View file

@ -1,10 +1,10 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=NDB;
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1 ;
LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1 ;
ERROR 23000: Can't write; duplicate key in table 't1'
DROP TABLE t1;
CREATE TABLE t1 (word CHAR(20) NOT NULL) ENGINE=NDB;
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1 ;
LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1 ;
SELECT * FROM t1 ORDER BY word;
word
Aarhus

View file

@ -125,6 +125,13 @@ create table t6 engine=myisam as select * from t6_c;
create table t7 engine=myisam as select * from t7_c;
create table t8 engine=myisam as select * from t8_c;
create table t9 engine=myisam as select * from t9_c;
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
DROP TABLE test.backup_info;
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
select count(*) from t1;
count(*)
@ -241,6 +248,13 @@ PARTITION BY LINEAR HASH (`relatta`)
PARTITIONS 4;
ALTER TABLE t7_c
PARTITION BY LINEAR KEY (`dardtestard`);
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
DROP TABLE test.backup_info;
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
select count(*) from t1;
count(*)
@ -445,4 +459,4 @@ drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
Create table test/def/t2_c failed: Translate frm error
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
520093696,2
520093696,<the_backup_id>

View file

@ -1160,12 +1160,12 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (21' at line 3
CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
PARTITION BY HASH(f1) PARTITIONS 1000000;
ERROR HY000: Too many partitions were defined
ERROR HY000: Too many partitions (including subpartitions) were defined
CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
SUBPARTITIONS 1000000
(PARTITION part1 VALUES LESS THAN (100), PARTITION part2 VALUES LESS THAN (2147483647));
ERROR HY000: Too many partitions were defined
ERROR HY000: Too many partitions (including subpartitions) were defined
# 3.2.4 partition/subpartition numbers STRING notation
CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
PARTITION BY HASH(f1) PARTITIONS '2';

View file

@ -91,7 +91,7 @@ PARTITION BY KEY (a)
ALTER TABLE t1 ADD PARTITION PARTITIONS 0;
ERROR HY000: At least one partition must be added
ALTER TABLE t1 ADD PARTITION PARTITIONS 1024;
ERROR HY000: Too many partitions were defined
ERROR HY000: Too many partitions (including subpartitions) were defined
ALTER TABLE t1 DROP PARTITION x0;
ERROR HY000: DROP PARTITION can only be used on RANGE/LIST partitions
ALTER TABLE t1 COALESCE PARTITION 1;
@ -112,8 +112,6 @@ ALTER TABLE t1 DROP PARTITION x1;
ALTER TABLE t1 DROP PARTITION x0;
ERROR HY000: Cannot remove all partitions, use DROP TABLE instead
DROP TABLE t1;
INSERT INTO t1 VALUES (15);
DROP TABLE t1;
CREATE TABLE t1 ( id INT NOT NULL,
fname VARCHAR(50) NOT NULL,
lname VARCHAR(50) NOT NULL,
@ -142,3 +140,9 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
ALTER TABLE t1 ADD PARTITION PARTITIONS 4;
DROP TABLE t1;
CREATE TABLE t1 (s1 int, s2 int) PARTITION BY LIST (s1) (
PARTITION p1 VALUES IN (0) (SUBPARTITION p1b),
PARTITION p2 VALUES IN (2) (SUBPARTITION p1b)
);
ERROR HY000: Duplicate partition name p1b

View file

@ -0,0 +1,2 @@
INSERT INTO t1 VALUES (15);
DROP TABLE t1;

View file

@ -85,29 +85,29 @@ partition p1 values in (14)
insert into t5 values (10,2,0,0), (10,4,0,0), (10,2,0,1), (10,4,0,1);
explain partitions select * from t5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t5 p0_sp0,p0_sp1,p1_sp0,p1_sp1 ALL NULL NULL NULL NULL 4
1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 4
explain partitions select * from t5
where (a=10 and b=1) or (a=10 and b=2) or (a=10 and b = 3);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t5 p0_sp0,p0_sp1 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t5 p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t5 where (a=10 and b=2) or (a=10 and b=3)
or (a=10 and b = 4);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t5 p0_sp0,p0_sp1,p1_sp0,p1_sp1 ALL NULL NULL NULL NULL 4 Using where
1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 4 Using where
explain partitions select * from t5 where (c=1 and d=1);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t5 p0_sp0,p1_sp0 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t5 p0_p0sp0,p1_p1sp0 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t5 where (c=2 and d=1);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t5 p0_sp1,p1_sp1 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t5 p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t5 where (a=10 and b=2 and c=1 and d=1) or
(c=2 and d=1);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t5 p0_sp0,p0_sp1,p1_sp1 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 3 Using where
explain partitions select * from t5 where (a=10 and b=2 and c=1 and d=1) or
(b=2 and c=2 and d=1);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t5 p0_sp0,p0_sp1,p1_sp1 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 3 Using where
create table t6 (a int not null) partition by LIST(a) (
partition p1 values in (1),
partition p3 values in (3),
@ -242,13 +242,13 @@ partition p3 values in (4)
insert into t3 values (1,1),(2,2),(3,3);
explain partitions select * from t3 where a=2 or b=1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t3 p0_sp1,p1_sp0,p1_sp1,p1_sp2,p1_sp3,p2_sp1,p3_sp1 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t3 p0_p0sp1,p1_p1sp0,p1_p1sp1,p1_p1sp2,p1_p1sp3,p2_p2sp1,p3_p3sp1 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t3 where a=4 or b=2;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t3 p0_sp2,p1_sp2,p2_sp2,p3_sp0,p3_sp1,p3_sp2,p3_sp3 system NULL NULL NULL NULL 1
1 SIMPLE t3 p0_p0sp2,p1_p1sp2,p2_p2sp2,p3_p3sp0,p3_p3sp1,p3_p3sp2,p3_p3sp3 system NULL NULL NULL NULL 1
explain partitions select * from t3 where (a=2 or b=1) and (a=4 or b=2) ;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t3 p1_sp2,p3_sp1 system NULL NULL NULL NULL 1
1 SIMPLE t3 p1_p1sp2,p3_p3sp1 system NULL NULL NULL NULL 1
drop table t3;
create table t1 (a int) partition by hash(a) partitions 2;
insert into t1 values (1),(2);
@ -300,10 +300,10 @@ partition p3 values in (3)
insert into t1 values (1,1),(2,2),(3,3);
explain partitions select * from t1 where b > 1 and b < 3;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0_sp2,p1_sp2,p2_sp2,p3_sp2 system NULL NULL NULL NULL 1
1 SIMPLE t1 p0_p0sp2,p1_p1sp2,p2_p2sp2,p3_p3sp2 system NULL NULL NULL NULL 1
explain partitions select * from t1 where b > 1 and b < 3 and (a =1 or a =2);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1_sp2,p2_sp2 system NULL NULL NULL NULL 1
1 SIMPLE t1 p1_p1sp2,p2_p2sp2 system NULL NULL NULL NULL 1
drop table t1;
create table t1 (a int) partition by list(a) (
partition p0 values in (1,2),

View file

@ -3,7 +3,7 @@ flush query cache;
flush query cache;
reset query cache;
flush status;
drop table if exists t1,t2,t3,t4,t11,t21;
drop table if exists t1,t2,t3,t4,t11,t21,t1_1,t1_2,t9,t9_1,t9_2;
drop database if exists mysqltest;
drop table if exists ```a`;
drop view if exists v1;

View file

@ -6,10 +6,10 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a));
LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1;
DELETE FROM test.t1 WHERE a = 'abashed';
DELETE FROM test.t1;
LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1;
SELECT * FROM test.t1 ORDER BY a DESC;
a
aberration

View file

@ -29,9 +29,9 @@ drop table t1;
drop table t1;
set SQL_LOG_BIN=0;
create table t1 (word char(20) not null, index(word))ENGINE=MyISAM;
load data infile '../../std_data/words.dat' into table t1;
load data infile '../std_data_ln/words.dat' into table t1;
create table t2 (word char(20) not null)ENGINE=MyISAM;
load data infile '../../std_data/words.dat' into table t2;
load data infile '../std_data_ln/words.dat' into table t2;
create table t3 (word char(20) not null primary key)ENGINE=MyISAM;
load table t1 from master;
load table t2 from master;

View file

@ -5,7 +5,7 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (word CHAR(20) NOT NULL);
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
SELECT * FROM t1 ORDER BY word;
word
Aarhus

View file

@ -7,14 +7,14 @@ start slave;
drop database if exists mysqltest;
USE test;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE test.t1;
LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE test.t1;
SELECT COUNT(*) FROM test.t1;
COUNT(*)
2
CREATE DATABASE mysqltest;
USE mysqltest;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
SELECT COUNT(*) FROM mysqltest.t1;
COUNT(*)
2

View file

@ -8,11 +8,11 @@ DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a));
INSERT INTO test.t1 VALUES(1,'test');
UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1;
UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=1;
create procedure test.p1()
begin
INSERT INTO test.t1 VALUES(2,'test');
UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=2;
UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=2;
end|
CALL test.p1();
SELECT * FROM test.t1 ORDER BY blob_column;

View file

@ -49,7 +49,7 @@ CREATE DATABASE BANK;
RESET MASTER;
CREATE TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM cluster_replication.backup_info;
LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ',';
LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info;
@the_backup_id:=backup_id
<the_backup_id>

View file

@ -5,7 +5,7 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (word CHAR(20) NOT NULL);
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1;
SELECT * FROM t1 ORDER BY word LIMIT 10;
word

View file

@ -27,7 +27,7 @@ hex(c2) hex(c3) c1
0 0 DEFGHIJKL
CREATE TEMPORARY TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT)ENGINE=HEAP;
DELETE FROM cluster_replication.backup_info;
LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ',';
LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info;
@the_backup_id:=backup_id
<the_backup_id>

View file

@ -5,7 +5,7 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (word CHAR(20) NOT NULL);
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1;
SELECT * FROM t1 ORDER BY word LIMIT 10;
word

View file

@ -24,4 +24,4 @@ a
ABE
ANG
LIL
DROP TABLE t1,t2;
DROP DATABASE mysqltest1;

View file

@ -41,12 +41,6 @@ t1
t2
**** On Master ****
DROP TABLE t1,t2;
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
master-bin.000001 102 Query 1 188 use `test`; CREATE TABLE t1 (a int)
master-bin.000001 188 Query 1 274 use `test`; CREATE TABLE t2 (a int)
master-bin.000001 274 Query 1 378 use `test`; DROP TABLE `t1` /* generated by server */
SHOW TABLES;
Tables_in_test
t2

View file

@ -9,7 +9,7 @@ stop slave;
create database mysqltest;
use mysqltest;
create table t1(a int, b int, unique(b));
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # #

View file

@ -0,0 +1,266 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
---Setup Section --
set timestamp=1000000000;
DROP TABLE IF EXISTS t1,t2,t3;
CREATE TABLE t1(word VARCHAR(20));
CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY);
CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT);
---Test1 check table load --
SELECT COUNT(*) from t1;
COUNT(*)
351
SELECT COUNT(*) from t2;
COUNT(*)
500
SELECT COUNT(*) from t3;
COUNT(*)
500
SELECT * FROM t1 ORDER BY word LIMIT 5;
word
Aarhus
Aarhus
Aarhus
Aarhus
Aarhus
SELECT * FROM t2 ORDER BY id LIMIT 5;
id
1
2
3
4
5
SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
c1 c3 c4 c5
1 2006-02-22 00:00:00 Tested in Texas 2.2
2 2006-02-22 00:00:00 Tested in Texas 4.4
3 2006-02-22 00:00:00 Tested in Texas 6.6
4 2006-02-22 00:00:00 Tested in Texas 8.8
5 2006-02-22 00:00:00 Tested in Texas 11
SELECT COUNT(*) from t1;
COUNT(*)
351
SELECT COUNT(*) from t2;
COUNT(*)
500
SELECT COUNT(*) from t3;
COUNT(*)
500
SELECT * FROM t1 ORDER BY word LIMIT 5;
word
Aarhus
Aarhus
Aarhus
Aarhus
Aarhus
SELECT * FROM t2 ORDER BY id LIMIT 5;
id
1
2
3
4
5
SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
c1 c3 c4 c5
1 2006-02-22 00:00:00 Tested in Texas 2.2
2 2006-02-22 00:00:00 Tested in Texas 4.4
3 2006-02-22 00:00:00 Tested in Texas 6.6
4 2006-02-22 00:00:00 Tested in Texas 8.8
5 2006-02-22 00:00:00 Tested in Texas 11
insert into t1 values ("Alas");
flush logs;
--- Test 1 Dump binlog to file --
--- Test 1 delete tables, clean master and slave --
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
stop slave;
reset master;
reset slave;
start slave;
--- Test 1 Load from Dump binlog file --
--- Test 1 Check Load Results --
SELECT COUNT(*) from t1;
COUNT(*)
352
SELECT COUNT(*) from t2;
COUNT(*)
500
SELECT COUNT(*) from t3;
COUNT(*)
500
SELECT * FROM t1 ORDER BY word LIMIT 5;
word
Aarhus
Aarhus
Aarhus
Aarhus
Aarhus
SELECT * FROM t2 ORDER BY id LIMIT 5;
id
1
2
3
4
5
SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
c1 c3 c4 c5
1 2006-02-22 00:00:00 Tested in Texas 2.2
2 2006-02-22 00:00:00 Tested in Texas 4.4
3 2006-02-22 00:00:00 Tested in Texas 6.6
4 2006-02-22 00:00:00 Tested in Texas 8.8
5 2006-02-22 00:00:00 Tested in Texas 11
SELECT COUNT(*) from t1;
COUNT(*)
352
SELECT COUNT(*) from t2;
COUNT(*)
500
SELECT COUNT(*) from t3;
COUNT(*)
500
SELECT * FROM t1 ORDER BY word LIMIT 5;
word
Aarhus
Aarhus
Aarhus
Aarhus
Aarhus
SELECT * FROM t2 ORDER BY id LIMIT 5;
id
1
2
3
4
5
SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
c1 c3 c4 c5
1 2006-02-22 00:00:00 Tested in Texas 2.2
2 2006-02-22 00:00:00 Tested in Texas 4.4
3 2006-02-22 00:00:00 Tested in Texas 6.6
4 2006-02-22 00:00:00 Tested in Texas 8.8
5 2006-02-22 00:00:00 Tested in Texas 11
--- Test 2 position test --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
use test;
SET TIMESTAMP=1000000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
/*!\C latin1 */;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT);
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- Test 3 First Remote test --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
ROLLBACK;
use test;
SET TIMESTAMP=1000000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
/*!\C latin1 */;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
DROP TABLE IF EXISTS t1,t2,t3;
SET TIMESTAMP=1000000000;
CREATE TABLE t1(word VARCHAR(20));
SET TIMESTAMP=1000000000;
CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY);
SET TIMESTAMP=1000000000;
CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT);
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- Test 5 LOAD DATA --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- Test 6 reading stdin --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
ROLLBACK;
use test;
SET TIMESTAMP=1000000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
/*!\C latin1 */;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
DROP TABLE IF EXISTS t1,t2,t3;
SET TIMESTAMP=1000000000;
CREATE TABLE t1(word VARCHAR(20));
SET TIMESTAMP=1000000000;
CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY);
SET TIMESTAMP=1000000000;
CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT);
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- Test 7 reading stdin w/position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
use test;
SET TIMESTAMP=1000000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
/*!\C latin1 */;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT);
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- Test 8 switch internal charset --
stop slave;
reset master;
reset slave;
start slave;
create table t4 (f text character set utf8);
create table t5 (f text character set cp932);
flush logs;
rename table t4 to t04, t5 to t05;
select HEX(f) from t04;
HEX(f)
E382BD
select HEX(f) from t4;
HEX(f)
E382BD
select HEX(f) from t05;
HEX(f)
835C
select HEX(f) from t5;
HEX(f)
835C
select HEX(f) from t04;
HEX(f)
E382BD
select HEX(f) from t4;
HEX(f)
E382BD
select HEX(f) from t05;
HEX(f)
835C
select HEX(f) from t5;
HEX(f)
835C
--- Test cleanup --
DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5;

View file

@ -22,7 +22,7 @@ INSERT INTO test.t1 VALUES(1);
CALL test.p1();
END|
CALL test.p2();
SELECT * FROM test.t1;
SELECT * FROM test.t1 ORDER BY a;
a
1
2
@ -40,11 +40,11 @@ INSERT INTO test.t2 VALUES(6);
CALL test.p3();
END|
CALL test.p4();
SELECT * FROM test.t2;
SELECT * FROM test.t2 ORDER BY a;
a
6
7
SELECT * FROM test.t2;
SELECT * FROM test.t2 ORDER BY a;
a
6
7

View file

@ -5,7 +5,7 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1 (words varchar(20)) engine=myisam;
load data infile '../../std_data/words.dat' into table t1 (words);
load data infile '../std_data_ln/words.dat' into table t1 (words);
select count(*) from t1;
count(*)
70

View file

@ -0,0 +1,224 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop database if exists mysqltest1;
create database mysqltest1;
use mysqltest1;
show global variables like "binlog_format%";
Variable_name Value
binlog_format ROW
show session variables like "binlog_format%";
Variable_name Value
binlog_format ROW
select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
ROW ROW
CREATE TABLE t1 (a varchar(100));
prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
set @string="emergency";
insert into t1 values("work");
execute stmt1 using @string;
deallocate prepare stmt1;
prepare stmt1 from 'insert into t1 select ?';
insert into t1 values(concat(UUID(),"work"));
execute stmt1 using @string;
deallocate prepare stmt1;
insert into t1 values(concat("for",UUID()));
insert into t1 select "yesterday";
create temporary table tmp(a char(3));
insert into tmp values("see");
set binlog_format=statement;
ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables
insert into t1 select * from tmp;
drop temporary table tmp;
set binlog_format=statement;
show global variables like "binlog_format%";
Variable_name Value
binlog_format ROW
show session variables like "binlog_format%";
Variable_name Value
binlog_format STATEMENT
select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
ROW STATEMENT
set global binlog_format=statement;
show global variables like "binlog_format%";
Variable_name Value
binlog_format STATEMENT
show session variables like "binlog_format%";
Variable_name Value
binlog_format STATEMENT
select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
STATEMENT STATEMENT
prepare stmt1 from 'insert into t1 select ?';
set @string="emergency";
insert into t1 values("work");
execute stmt1 using @string;
deallocate prepare stmt1;
prepare stmt1 from 'insert into t1 select ?';
insert into t1 values("work");
execute stmt1 using @string;
deallocate prepare stmt1;
insert into t1 values("for");
insert into t1 select "yesterday";
set binlog_format=default;
select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
STATEMENT STATEMENT
set global binlog_format=default;
ERROR 42000: Variable 'binlog_format' doesn't have a default value
select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
STATEMENT STATEMENT
prepare stmt1 from 'insert into t1 select ?';
set @string="emergency";
insert into t1 values("work");
execute stmt1 using @string;
deallocate prepare stmt1;
prepare stmt1 from 'insert into t1 select ?';
insert into t1 values("work");
execute stmt1 using @string;
deallocate prepare stmt1;
insert into t1 values("for");
insert into t1 select "yesterday";
set binlog_format=mixed;
select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
STATEMENT MIXED
set global binlog_format=mixed;
select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
MIXED MIXED
prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
set @string="emergency";
insert into t1 values("work");
execute stmt1 using @string;
deallocate prepare stmt1;
prepare stmt1 from 'insert into t1 select ?';
insert into t1 values(concat(UUID(),"work"));
execute stmt1 using @string;
deallocate prepare stmt1;
insert into t1 values(concat("for",UUID()));
insert into t1 select "yesterday";
prepare stmt1 from 'insert into t1 select ?';
insert into t1 values(concat(UUID(),"work"));
execute stmt1 using @string;
deallocate prepare stmt1;
insert into t1 values(concat("for",UUID()));
insert into t1 select "yesterday";
create procedure foo()
begin
insert into t1 values("work");
insert into t1 values(concat("for",UUID()));
insert into t1 select "yesterday";
end|
create procedure foo2()
begin
insert into t1 values(concat("emergency",UUID()));
insert into t1 values("work");
insert into t1 values(concat("for",UUID()));
set session binlog_format=row; # accepted for stored procs
insert into t1 values("more work");
set session binlog_format=mixed;
end|
create function foo3() returns bigint unsigned
begin
set session binlog_format=row; # rejected for stored funcs
insert into t1 values("alarm");
return 100;
end|
call foo();
call foo2();
select foo3();
ERROR HY000: Cannot change the binary logging format inside a stored function or trigger
select * from t1 where a="alarm";
a
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 102 Query 1 205 drop database if exists mysqltest1
master-bin.000001 205 Query 1 300 create database mysqltest1
master-bin.000001 300 Query 1 401 use `mysqltest1`; CREATE TABLE t1 (a varchar(100))
master-bin.000001 401 Table_map 1 446 mysqltest1.t1
master-bin.000001 446 Write_rows 1 481
master-bin.000001 481 Table_map 1 526 mysqltest1.t1
master-bin.000001 526 Write_rows 1 602
master-bin.000001 602 Table_map 1 647 mysqltest1.t1
master-bin.000001 647 Write_rows 1 718
master-bin.000001 718 Table_map 1 763 mysqltest1.t1
master-bin.000001 763 Write_rows 1 803
master-bin.000001 803 Table_map 1 848 mysqltest1.t1
master-bin.000001 848 Write_rows 1 918
master-bin.000001 918 Table_map 1 963 mysqltest1.t1
master-bin.000001 963 Write_rows 1 1003
master-bin.000001 1003 Table_map 1 1048 mysqltest1.t1
master-bin.000001 1048 Write_rows 1 1082
master-bin.000001 1082 Query 1 1180 use `mysqltest1`; insert into t1 values("work")
master-bin.000001 1180 User var 1 1228 @`string`=_latin1 0x656D657267656E6379 COLLATE latin1_swedish_ci
master-bin.000001 1228 Query 1 1328 use `mysqltest1`; insert into t1 select @'string'
master-bin.000001 1328 Query 1 1426 use `mysqltest1`; insert into t1 values("work")
master-bin.000001 1426 User var 1 1474 @`string`=_latin1 0x656D657267656E6379 COLLATE latin1_swedish_ci
master-bin.000001 1474 Query 1 1574 use `mysqltest1`; insert into t1 select @'string'
master-bin.000001 1574 Query 1 1671 use `mysqltest1`; insert into t1 values("for")
master-bin.000001 1671 Query 1 1773 use `mysqltest1`; insert into t1 select "yesterday"
master-bin.000001 1773 Query 1 1871 use `mysqltest1`; insert into t1 values("work")
master-bin.000001 1871 User var 1 1919 @`string`=_latin1 0x656D657267656E6379 COLLATE latin1_swedish_ci
master-bin.000001 1919 Query 1 2019 use `mysqltest1`; insert into t1 select @'string'
master-bin.000001 2019 Query 1 2117 use `mysqltest1`; insert into t1 values("work")
master-bin.000001 2117 User var 1 2165 @`string`=_latin1 0x656D657267656E6379 COLLATE latin1_swedish_ci
master-bin.000001 2165 Query 1 2265 use `mysqltest1`; insert into t1 select @'string'
master-bin.000001 2265 Query 1 2362 use `mysqltest1`; insert into t1 values("for")
master-bin.000001 2362 Query 1 2464 use `mysqltest1`; insert into t1 select "yesterday"
master-bin.000001 2464 Query 1 2562 use `mysqltest1`; insert into t1 values("work")
master-bin.000001 2562 Table_map 1 2607 mysqltest1.t1
master-bin.000001 2607 Write_rows 1 2683
master-bin.000001 2683 Table_map 1 2728 mysqltest1.t1
master-bin.000001 2728 Write_rows 1 2799
master-bin.000001 2799 User var 1 2847 @`string`=_latin1 0x656D657267656E6379 COLLATE latin1_swedish_ci
master-bin.000001 2847 Query 1 2947 use `mysqltest1`; insert into t1 select @'string'
master-bin.000001 2947 Table_map 1 2992 mysqltest1.t1
master-bin.000001 2992 Write_rows 1 3062
master-bin.000001 3062 Query 1 3164 use `mysqltest1`; insert into t1 select "yesterday"
master-bin.000001 3164 Table_map 1 3209 mysqltest1.t1
master-bin.000001 3209 Write_rows 1 3280
master-bin.000001 3280 User var 1 3328 @`string`=_latin1 0x656D657267656E6379 COLLATE latin1_swedish_ci
master-bin.000001 3328 Query 1 3428 use `mysqltest1`; insert into t1 select @'string'
master-bin.000001 3428 Table_map 1 3473 mysqltest1.t1
master-bin.000001 3473 Write_rows 1 3543
master-bin.000001 3543 Query 1 3645 use `mysqltest1`; insert into t1 select "yesterday"
master-bin.000001 3645 Query 1 3857 use `mysqltest1`; create procedure foo()
begin
insert into t1 values("work");
insert into t1 values(concat("for",UUID()));
insert into t1 select "yesterday";
end
master-bin.000001 3857 Query 1 4214 use `mysqltest1`; create procedure foo2()
begin
insert into t1 values(concat("emergency",UUID()));
insert into t1 values("work");
insert into t1 values(concat("for",UUID()));
set session binlog_format=row; # accepted for stored procs
insert into t1 values("more work");
set session binlog_format=mixed;
end
master-bin.000001 4214 Query 1 4442 use `mysqltest1`; create function foo3() returns bigint unsigned
begin
set session binlog_format=row; # rejected for stored funcs
insert into t1 values("alarm");
return 100;
end
master-bin.000001 4442 Query 1 4548 use `mysqltest1`; insert into t1 values("work")
master-bin.000001 4548 Table_map 1 4593 mysqltest1.t1
master-bin.000001 4593 Write_rows 1 4663
master-bin.000001 4663 Query 1 4773 use `mysqltest1`; insert into t1 select "yesterday"
master-bin.000001 4773 Table_map 1 4818 mysqltest1.t1
master-bin.000001 4818 Write_rows 1 4894
master-bin.000001 4894 Query 1 5000 use `mysqltest1`; insert into t1 values("work")
master-bin.000001 5000 Table_map 1 5045 mysqltest1.t1
master-bin.000001 5045 Write_rows 1 5115
master-bin.000001 5115 Table_map 1 5160 mysqltest1.t1
master-bin.000001 5160 Write_rows 1 5200
drop database mysqltest1;

View file

@ -1163,3 +1163,6 @@ end|
call bug15091();
ERROR 42S02: Unknown table 'c' in field list
drop procedure bug15091;
drop function if exists bug16896;
create aggregate function bug16896() returns int return 1;
ERROR 42000: AGGREGATE is not supported for stored functions

View file

@ -314,3 +314,12 @@ select * from db_bug14533.t1;
ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table 't1'
drop user user_bug14533@localhost;
drop database db_bug14533;
CREATE DATABASE db_bug7787;
use db_bug7787;
CREATE PROCEDURE p1()
SHOW INNODB STATUS;
Warnings:
Warning 1287 'SHOW INNODB STATUS' is deprecated; use 'SHOW ENGINE INNODB STATUS' instead
GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost;
DROP DATABASE db_bug7787;
use test;

View file

@ -539,7 +539,7 @@ drop procedure if exists into_outfile|
create procedure into_outfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
select * into outfile "/tmp/spout" from test.t1;
select * into outfile "../tmp/spout" from test.t1;
insert into test.t1 values (concat(x, "2"), y+2);
end|
call into_outfile("ofile", 1)|
@ -549,7 +549,7 @@ drop procedure if exists into_dumpfile|
create procedure into_dumpfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
select * into dumpfile "/tmp/spdump" from test.t1 limit 1;
select * into dumpfile "../tmp/spdump" from test.t1 limit 1;
insert into test.t1 values (concat(x, "2"), y+2);
end|
call into_dumpfile("dfile", 1)|
@ -1413,8 +1413,6 @@ select `foo` ()|
5
drop function `foo`|
drop function if exists t1max|
Warnings:
Note 1305 FUNCTION t1max does not exist
create function t1max() returns int
begin
declare x int;
@ -1470,6 +1468,339 @@ zip 3
foo 1
drop table t3|
drop function getcount|
drop table if exists t3|
drop procedure if exists h_ee|
drop procedure if exists h_es|
drop procedure if exists h_en|
drop procedure if exists h_ew|
drop procedure if exists h_ex|
drop procedure if exists h_se|
drop procedure if exists h_ss|
drop procedure if exists h_sn|
drop procedure if exists h_sw|
drop procedure if exists h_sx|
drop procedure if exists h_ne|
drop procedure if exists h_ns|
drop procedure if exists h_nn|
drop procedure if exists h_we|
drop procedure if exists h_ws|
drop procedure if exists h_ww|
drop procedure if exists h_xe|
drop procedure if exists h_xs|
drop procedure if exists h_xx|
create table t3 (a smallint primary key)|
insert into t3 (a) values (1)|
create procedure h_ee()
deterministic
begin
declare continue handler for 1062 -- ER_DUP_ENTRY
select 'Outer (bad)' as 'h_ee';
begin
declare continue handler for 1062 -- ER_DUP_ENTRY
select 'Inner (good)' as 'h_ee';
insert into t3 values (1);
end;
end|
create procedure h_es()
deterministic
begin
declare continue handler for 1062 -- ER_DUP_ENTRY
select 'Outer (good)' as 'h_es';
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
select 'Inner (bad)' as 'h_es';
insert into t3 values (1);
end;
end|
create procedure h_en()
deterministic
begin
declare continue handler for 1329 -- ER_SP_FETCH_NO_DATA
select 'Outer (good)' as 'h_en';
begin
declare x int;
declare continue handler for sqlstate '02000' -- no data
select 'Inner (bad)' as 'h_en';
select a into x from t3 where a = 42;
end;
end|
create procedure h_ew()
deterministic
begin
declare continue handler for 1264 -- ER_WARN_DATA_OUT_OF_RANGE
select 'Outer (good)' as 'h_ew';
begin
declare continue handler for sqlwarning
select 'Inner (bad)' as 'h_ew';
insert into t3 values (123456789012);
end;
delete from t3;
insert into t3 values (1);
end|
create procedure h_ex()
deterministic
begin
declare continue handler for 1062 -- ER_DUP_ENTRY
select 'Outer (good)' as 'h_ex';
begin
declare continue handler for sqlexception
select 'Inner (bad)' as 'h_ex';
insert into t3 values (1);
end;
end|
create procedure h_se()
deterministic
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
select 'Outer (bad)' as 'h_se';
begin
declare continue handler for 1062 -- ER_DUP_ENTRY
select 'Inner (good)' as 'h_se';
insert into t3 values (1);
end;
end|
create procedure h_ss()
deterministic
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
select 'Outer (bad)' as 'h_ss';
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
select 'Inner (good)' as 'h_ss';
insert into t3 values (1);
end;
end|
create procedure h_sn()
deterministic
begin
-- Note: '02000' is more specific than NOT FOUND ;
-- there might be other not found states
declare continue handler for sqlstate '02000' -- no data
select 'Outer (good)' as 'h_sn';
begin
declare x int;
declare continue handler for not found
select 'Inner (bad)' as 'h_sn';
select a into x from t3 where a = 42;
end;
end|
create procedure h_sw()
deterministic
begin
-- data exception - numeric value out of range
declare continue handler for sqlstate '22003'
select 'Outer (good)' as 'h_sw';
begin
declare continue handler for sqlwarning
select 'Inner (bad)' as 'h_sw';
insert into t3 values (123456789012);
end;
delete from t3;
insert into t3 values (1);
end|
create procedure h_sx()
deterministic
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
select 'Outer (good)' as 'h_sx';
begin
declare continue handler for sqlexception
select 'Inner (bad)' as 'h_sx';
insert into t3 values (1);
end;
end|
create procedure h_ne()
deterministic
begin
declare continue handler for not found
select 'Outer (bad)' as 'h_ne';
begin
declare x int;
declare continue handler for 1329 -- ER_SP_FETCH_NO_DATA
select 'Inner (good)' as 'h_ne';
select a into x from t3 where a = 42;
end;
end|
create procedure h_ns()
deterministic
begin
declare continue handler for not found
select 'Outer (bad)' as 'h_ns';
begin
declare x int;
declare continue handler for sqlstate '02000' -- no data
select 'Inner (good)' as 'h_ns';
select a into x from t3 where a = 42;
end;
end|
create procedure h_nn()
deterministic
begin
declare continue handler for not found
select 'Outer (bad)' as 'h_nn';
begin
declare x int;
declare continue handler for not found
select 'Inner (good)' as 'h_nn';
select a into x from t3 where a = 42;
end;
end|
create procedure h_we()
deterministic
begin
declare continue handler for sqlwarning
select 'Outer (bad)' as 'h_we';
begin
declare continue handler for 1264 -- ER_WARN_DATA_OUT_OF_RANGE
select 'Inner (good)' as 'h_we';
insert into t3 values (123456789012);
end;
delete from t3;
insert into t3 values (1);
end|
create procedure h_ws()
deterministic
begin
declare continue handler for sqlwarning
select 'Outer (bad)' as 'h_ws';
begin
-- data exception - numeric value out of range
declare continue handler for sqlstate '22003'
select 'Inner (good)' as 'h_ws';
insert into t3 values (123456789012);
end;
delete from t3;
insert into t3 values (1);
end|
create procedure h_ww()
deterministic
begin
declare continue handler for sqlwarning
select 'Outer (bad)' as 'h_ww';
begin
declare continue handler for sqlwarning
select 'Inner (good)' as 'h_ww';
insert into t3 values (123456789012);
end;
delete from t3;
insert into t3 values (1);
end|
create procedure h_xe()
deterministic
begin
declare continue handler for sqlexception
select 'Outer (bad)' as 'h_xe';
begin
declare continue handler for 1062 -- ER_DUP_ENTRY
select 'Inner (good)' as 'h_xe';
insert into t3 values (1);
end;
end|
create procedure h_xs()
deterministic
begin
declare continue handler for sqlexception
select 'Outer (bad)' as 'h_xs';
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
select 'Inner (good)' as 'h_xs';
insert into t3 values (1);
end;
end|
create procedure h_xx()
deterministic
begin
declare continue handler for sqlexception
select 'Outer (bad)' as 'h_xx';
begin
declare continue handler for sqlexception
select 'Inner (good)' as 'h_xx';
insert into t3 values (1);
end;
end|
call h_ee()|
h_ee
Inner (good)
call h_es()|
h_es
Outer (good)
call h_en()|
h_en
Outer (good)
call h_ew()|
h_ew
Outer (good)
call h_ex()|
h_ex
Outer (good)
call h_se()|
h_se
Inner (good)
call h_ss()|
h_ss
Inner (good)
call h_sn()|
h_sn
Outer (good)
call h_sw()|
h_sw
Outer (good)
call h_sx()|
h_sx
Outer (good)
call h_ne()|
h_ne
Inner (good)
call h_ns()|
h_ns
Inner (good)
call h_nn()|
h_nn
Inner (good)
call h_we()|
h_we
Inner (good)
call h_ws()|
h_ws
Inner (good)
call h_ww()|
h_ww
Inner (good)
call h_xe()|
h_xe
Inner (good)
call h_xs()|
h_xs
Inner (good)
call h_xx()|
h_xx
Inner (good)
drop table t3|
drop procedure h_ee|
drop procedure h_es|
drop procedure h_en|
drop procedure h_ew|
drop procedure h_ex|
drop procedure h_se|
drop procedure h_ss|
drop procedure h_sn|
drop procedure h_sw|
drop procedure h_sx|
drop procedure h_ne|
drop procedure h_ns|
drop procedure h_nn|
drop procedure h_we|
drop procedure h_ws|
drop procedure h_ww|
drop procedure h_xe|
drop procedure h_xs|
drop procedure h_xx|
drop procedure if exists bug822|
create procedure bug822(a_id char(16), a_data int)
begin
@ -2170,7 +2501,7 @@ Create view Tables To create new views
Create user Server Admin To create new users
Delete Tables To delete existing rows
Drop Databases,Tables To drop databases, tables, and views
Event Server Admin Creation, alteration, deletion and execution of events.
Event Server Admin To create, alter, drop and execute events
Execute Functions,Procedures To execute stored routines
File File access on server To read and write files on the server
Grant option Databases,Tables,Functions,Procedures To give to other users those privileges you possess
@ -2224,7 +2555,7 @@ Create view Tables To create new views
Create user Server Admin To create new users
Delete Tables To delete existing rows
Drop Databases,Tables To drop databases, tables, and views
Event Server Admin Creation, alteration, deletion and execution of events.
Event Server Admin To create, alter, drop and execute events
Execute Functions,Procedures To execute stored routines
File File access on server To read and write files on the server
Grant option Databases,Tables,Functions,Procedures To give to other users those privileges you possess

4853
mysql-test/r/sp.result.orig Normal file

File diff suppressed because it is too large Load diff

View file

@ -117,7 +117,7 @@ create procedure bug10100p(prm int, inout res int)
begin
set res = res * prm;
if prm > 1 then
call bug10100p(prm - 1, res);
call bug10100p(prm - 1, res);
end if;
end|
create procedure bug10100t(prm int)

View file

@ -2987,7 +2987,6 @@ select * from (select max(fld) from t1) as foo;
max(fld)
1
drop table t1;
purge master logs before (select adddate(current_timestamp(), interval -4 day));
CREATE TABLE t1 (a int, b int);
CREATE TABLE t2 (c int, d int);
CREATE TABLE t3 (e int);

View file

@ -1,43 +1,43 @@
drop database if exists `testdb1`;
drop database if exists `testdb-1`;
drop database if exists `#mysql50#testdb-1`;
create database `testdb1`;
create database `#mysql50#testdb-1`;
create table `testdb1`.`t1` (a int);
create table `testdb1`.`#mysql50#t-1` (a int);
create table `#mysql50#testdb-1`.`t1` (a int);
create table `#mysql50#testdb-1`.`#mysql50#t-1` (a int);
show create database `testdb1`;
drop database if exists `mysqltest1`;
drop database if exists `mysqltest-1`;
drop database if exists `#mysql50#mysqltest-1`;
create database `mysqltest1`;
create database `#mysql50#mysqltest-1`;
create table `mysqltest1`.`t1` (a int);
create table `mysqltest1`.`#mysql50#t-1` (a int);
create table `#mysql50#mysqltest-1`.`t1` (a int);
create table `#mysql50#mysqltest-1`.`#mysql50#t-1` (a int);
show create database `mysqltest1`;
Database Create Database
testdb1 CREATE DATABASE `testdb1` /*!40100 DEFAULT CHARACTER SET latin1 */
show create database `testdb-1`;
ERROR 42000: Unknown database 'testdb-1'
show create database `#mysql50#testdb-1`;
mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 */
show create database `mysqltest-1`;
ERROR 42000: Unknown database 'mysqltest-1'
show create database `#mysql50#mysqltest-1`;
Database Create Database
#mysql50#testdb-1 CREATE DATABASE `#mysql50#testdb-1` /*!40100 DEFAULT CHARACTER SET latin1 */
show tables in `testdb1`;
Tables_in_testdb1
#mysql50#mysqltest-1 CREATE DATABASE `#mysql50#mysqltest-1` /*!40100 DEFAULT CHARACTER SET latin1 */
show tables in `mysqltest1`;
Tables_in_mysqltest1
#mysql50#t-1
t1
show tables in `#mysql50#testdb-1`;
Tables_in_#mysql50#testdb-1
show tables in `#mysql50#mysqltest-1`;
Tables_in_#mysql50#mysqltest-1
#mysql50#t-1
t1
show create database `testdb1`;
show create database `mysqltest1`;
Database Create Database
testdb1 CREATE DATABASE `testdb1` /*!40100 DEFAULT CHARACTER SET latin1 */
show create database `testdb-1`;
mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 */
show create database `mysqltest-1`;
Database Create Database
testdb-1 CREATE DATABASE `testdb-1` /*!40100 DEFAULT CHARACTER SET latin1 */
show create database `#mysql50#testdb-1`;
ERROR 42000: Unknown database '#mysql50#testdb-1'
show tables in `testdb1`;
Tables_in_testdb1
mysqltest-1 CREATE DATABASE `mysqltest-1` /*!40100 DEFAULT CHARACTER SET latin1 */
show create database `#mysql50#mysqltest-1`;
ERROR 42000: Unknown database '#mysql50#mysqltest-1'
show tables in `mysqltest1`;
Tables_in_mysqltest1
t1
t-1
show tables in `testdb-1`;
Tables_in_testdb-1
show tables in `mysqltest-1`;
Tables_in_mysqltest-1
t1
t-1
drop database `testdb1`;
drop database `testdb-1`;
drop database `mysqltest1`;
drop database `mysqltest-1`;

View file

@ -6,3 +6,11 @@ ERROR HY000: MySQL server has gone away
select 3;
3
3
select 1;
1
1
select 2;
ERROR HY000: MySQL server has gone away
select 3;
3
3

View file

@ -542,3 +542,5 @@ a
select extractvalue('<a>a<b>B</b></a>','a|/b');
extractvalue('<a>a<b>B</b></a>','a|/b')
a
select extractvalue('<a>A</a>','/<a>');
ERROR HY000: XPATH syntax error: '>'

View file

@ -0,0 +1 @@
--loose-innodb_lock_wait_timeout=2

View file

@ -3,7 +3,7 @@
#
--disable_warnings
drop table if exists t1;
drop table if exists t1,t2;
--enable_warnings
select CASE "b" when "a" then 1 when "b" then 2 END;

View file

@ -9,13 +9,13 @@ create table t1 (
`a>b` text
);
insert into t1 values (1, 2, 'a&b a<b a>b');
--exec $MYSQL --xml test -e 'select * from t1'
--exec $MYSQL --xml test -e "select * from t1"
--exec $MYSQL_DUMP --xml --skip-create test
--exec $MYSQL --xml test -e 'select count(*) from t1'
--exec $MYSQL --xml test -e 'select 1 < 2 from dual'
--exec $MYSQL --xml test -e 'select 1 > 2 from dual'
--exec $MYSQL --xml test -e 'select 1 & 3 from dual'
--exec $MYSQL --xml test -e 'select null from dual'
--exec $MYSQL --xml test -e "select count(*) from t1"
--exec $MYSQL --xml test -e "select 1 < 2 from dual"
--exec $MYSQL --xml test -e "select 1 > 2 from dual"
--exec $MYSQL --xml test -e "select 1 & 3 from dual"
--exec $MYSQL --xml test -e "select null from dual"
drop table t1;

View file

@ -661,4 +661,12 @@ alter table t1 max_rows=100000000000;
show create table t1;
drop table t1;
#
# Bug#17530: Incorrect key truncation on table creation caused server crash.
#
create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
character set utf8 collate utf8_general_ci;
insert into t1 values('aaa');
drop table t1;
# End of 5.0 tests

View file

@ -0,0 +1,32 @@
-- source include/not_embedded.inc
-- source include/have_cp932.inc
--character_set cp932
--disable_warnings
drop table if exists t1;
--enable_warnings
set names cp932;
set character_set_database = cp932;
# Test prepared statement with 0x8300 sequence in parameter while
# running with cp932 client character set.
RESET MASTER;
CREATE TABLE t1(f1 blob);
PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)';
SET @var1= x'8300';
# TODO: Note that this doesn't actually test the code which was added for
# bug#11338 because this syntax for prepared statements causes the PS to
# be replicated differently than if we executed the PS from C or Java.
# Using this syntax, variable names are inserted into the binlog instead
# of values. The real goal of this test is to check the code that was
# added to Item_param::query_val_str() in order to do hex encoding of
# PS parameters when the client character set is cp932;
# Bug#11338 has an example java program which can be used to verify this
# code (and I have used it to test the fix) until there is some way to
# exercise this code from mysql-test-run.
EXECUTE stmt1 USING @var1;
SHOW BINLOG EVENTS FROM 102;
SELECT HEX(f1) FROM t1;
DROP table t1;
# end test for bug#11338

View file

@ -10,11 +10,13 @@
#
##############################################################################
#ndb_alter_table_row : sometimes wrong error 1015!=1046
events_bugs : test case unstable (race conditions). andrey will fix
events_stress : test case unstable. andrey will fix
events : test case unstable. andrey will fix
ndb_autodiscover : Needs to be fixed w.r.t binlog
ndb_autodiscover2 : Needs to be fixed w.r.t binlog
ndb_binlog_basic : Results are not deterministic, Tomas will fix
ndb_binlog_ddl_multi : Bug#17038 [PATCH PENDING]
ndb_dd_backuprestore : Bug#17045 NdbDictionaryImpl::fix_blob_events causes core
ndb_load : Bug#17233
partition_03ndb : Bug#16385
ps_7ndb : dbug assert in RBR mode when executing test suite
@ -26,14 +28,10 @@ rpl_ndb_charset : Bug#17246
rpl_ndb_ddl : Bug#17400: delete & update of rows in table without pk fails
rpl_ndb_delete_nowhere : Bug#17400: delete & update of rows in table without pk fails
rpl_ndb_insert_ignore : Bugs: #17431: INSERT IGNORE INTO returns failed: 1296
#rpl_ndb_log : result not deterministic
rpl_ndb_log : result not deterministic
rpl_ndb_relay_space : Bug#16993
rpl_ndb_multi_update3 : Bug#17400: delete & update of rows in table without pk fails
rpl_ndb_sp007 : Bug #17290
rpl_sp : Bug#16456
rpl_until : Unstable test case, bug#15886
sp-goto : GOTO is currently is disabled - will be fixed in the future
rpl_ndb_blob : Bug#17505
rpl_ndb_blob2 : Bug#17505
rpl_ndb_log : results are not deterministic
mysqldump : Bug#17443 mysqlimport --use-threads=5 gives crashes

View file

@ -374,6 +374,27 @@ drop table t_16;
# end of test case
####
#
# START: BUG #17453: Creating Event crash the server
#
create event white_space
on schedule every 10 hour
disable
do
select 1;
select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
drop event white_space;
create event white_space on schedule every 10 hour disable do
select 2;
select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
drop event white_space;
create event white_space on schedule every 10 hour disable do select 3;
select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
drop event white_space;
#
# END: BUG #17453: Creating Event crash the server
#
##set global event_scheduler=1;
##select get_lock("test_lock3", 20);
##create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20);

View file

@ -0,0 +1,121 @@
create database if not exists events_test;
use events_test;
#
# Start - 16407: Events: Changes in sql_mode won't be taken into account
#
set global event_scheduler=0;
--echo "Wait a bit to settle down"
--sleep 1
delete from mysql.event;
set global event_scheduler= 1;
set @old_sql_mode:=@@sql_mode;
set sql_mode=ansi;
select get_lock('test_bug16407', 60);
delimiter |;
create event e_16407 on schedule every 60 second do
begin
select get_lock('test_bug16407', 60);
drop table "hashed_num";
end|
delimiter ;|
--sleep 1
--echo "Now if everything is fine the event has compiled and is locked
--replace_column 1 # 6 #
show processlist;
select release_lock('test_bug16407');
set global event_scheduler= 0;
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
--echo "Let's check whether we change the sql_mode on ALTER EVENT"
set sql_mode='traditional';
alter event e_16407 do select 1;
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
drop event e_16407;
--echo "Another sql_mode test"
set sql_mode="traditional";
create table events_smode_test(ev_name char(10), a date) engine=myisam;
--echo "This should never insert something"
delimiter |;
create event ee_16407_2 on schedule every 60 second do
begin
select get_lock('ee_16407_2', 60);
insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
end|
--error 1292
insert into events_smode_test values ('test','1980-19-02')|
--echo "This is ok"
create event ee_16407_3 on schedule every 60 second do
begin
select get_lock('ee_16407_2', 60);
insert into events_test.events_smode_test values ('ee_16407_3','1980-02-19');
insert into events_test.events_smode_test values ('ee_16407_3','1980-02-29');
end|
set sql_mode=""|
--echo "This will insert rows but they will be truncated"
create event ee_16407_4 on schedule every 60 second do
begin
select get_lock('ee_16407_2', 60);
insert into events_test.events_smode_test values ('ee_16407_4','10-11-1956');
end|
delimiter ;|
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
set sql_mode="ansi";
select get_lock('ee_16407_2', 60);
set global event_scheduler= 1;
--sleep 1
--replace_column 1 # 6 #
show processlist;
select release_lock('ee_16407_2');
--sleep 3
--replace_column 1 # 6 #
show processlist;
set global event_scheduler= 0;
select * from events_smode_test order by ev_name, a;
--echo "OK, last check before we drop them"
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
drop event ee_16407_2;
drop event ee_16407_3;
drop event ee_16407_4;
--echo "And now one last test regarding sql_mode and call of SP from an event"
delete from events_smode_test;
set sql_mode='traditional';
delimiter |;
create procedure ee_16407_5_pendant() begin insert into events_test.events_smode_test values('ee_16407_5','2001-02-29'); end|
create procedure ee_16407_6_pendant() begin insert into events_test.events_smode_test values('ee_16407_6','2004-02-29'); end|
create event ee_16407_5 on schedule every 60 second do
begin
select get_lock('ee_16407_5', 60);
call events_test.ee_16407_5_pendant();
end|
create event ee_16407_6 on schedule every 60 second do
begin
select get_lock('ee_16407_5', 60);
call events_test.ee_16407_6_pendant();
end|
delimiter ;|
set sql_mode='ansi';
select get_lock('ee_16407_5', 60);
set global event_scheduler= 1;
--sleep 1
--replace_column 1 # 6 #
show processlist;
select release_lock('ee_16407_5');
--sleep 3
--replace_column 1 # 6 #
show processlist;
select * from events_smode_test order by ev_name, a;
--echo "And here we check one more time before we drop the events"
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
drop event ee_16407_5;
drop event ee_16407_6;
drop procedure ee_16407_5_pendant;
drop procedure ee_16407_6_pendant;
set global event_scheduler= 0;
drop table events_smode_test;
set sql_mode=@old_sql_mode;
#
# End - 16407: Events: Changes in sql_mode won't be taken into account
#
drop database events_test;

View file

@ -0,0 +1,55 @@
create database if not exists events_test;
use events_test;
--error 1235
CREATE EVENT micro_test ON SCHEDULE EVERY 100 MICROSECOND DO SELECT 1;
--error 1235
CREATE EVENT micro_test ON SCHEDULE EVERY 100 DAY_MICROSECOND DO SELECT 1;
--error 1235
CREATE EVENT micro_test ON SCHEDULE EVERY 100 HOUR_MICROSECOND DO SELECT 1;
--error 1235
CREATE EVENT micro_test ON SCHEDULE EVERY 100 MINUTE_MICROSECOND DO SELECT 1;
--error 1235
CREATE EVENT micro_test ON SCHEDULE EVERY 100 SECOND_MICROSECOND DO SELECT 1;
--echo "Now create normal event and change it on SQL level"
CREATE EVENT micro_test2 ON SCHEDULE EVERY 1 MONTH DO SELECT 1;
UPDATE mysql.event SET interval_field='MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
--error 1235
SHOW CREATE EVENT micro_test2;
SET GLOBAL event_scheduler=0;
--sleep 1
--echo "Should not be running:"
SHOW VARIABLES like 'event_scheduler';
UPDATE mysql.event SET interval_field='DAY_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
--error 1235
SHOW CREATE EVENT micro_test2;
SET GLOBAL event_scheduler=0;
--sleep 1
--echo "Should not be running:"
SHOW VARIABLES like 'event_scheduler';
UPDATE mysql.event SET interval_field='SECOND_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
--error 1235
SHOW CREATE EVENT micro_test2;
SET GLOBAL event_scheduler=0;
--sleep 1
--echo "Should not be running:"
SHOW VARIABLES like 'event_scheduler';
UPDATE mysql.event SET interval_field='HOUR_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
--error 1235
SHOW CREATE EVENT micro_test2;
SET GLOBAL event_scheduler=0;
--sleep 1
--echo "Should not be running:"
SHOW VARIABLES like 'event_scheduler';
UPDATE mysql.event SET interval_field='MINUTE_MICROSECOND' WHERE db=database() AND definer=user() AND name='micro_test2';
--error 1235
SHOW CREATE EVENT micro_test2;
SET GLOBAL event_scheduler=0;
--sleep 1
--echo "Should not be running:"
SHOW VARIABLES like 'event_scheduler';
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER='event_scheduler';
DROP EVENT micro_test2;
drop database events_test;

View file

@ -19,7 +19,7 @@ select version()>=_latin1"3.23.29";
select charset(version());
explain extended select database(), user();
create table t1 (version char(40)) select database(), user(), version() as 'version';
create table t1 (version char(60)) select database(), user(), version() as 'version';
show create table t1;
drop table t1;

View file

@ -1,6 +1,10 @@
-- source include/not_embedded.inc
-- source include/have_innodb.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
connect (a,localhost,root,,);
connect (b,localhost,root,,);

View file

@ -135,6 +135,6 @@ select @@character_set_filesystem;
LOAD DATA INFILE 't@002d1' INTO TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
--exec rm $MYSQL_TEST_DIR/var/master-data/test/t@002d1
--exec rm $MYSQLTEST_VARDIR/master-data/test/t@002d1
SET character_set_filesystem=default;
select @@character_set_filesystem;

View file

@ -9,7 +9,6 @@
# var/log/mysql_client_test.trace
--disable_result_log
--exec echo $MYSQL_CLIENT_TEST --getopt-ll-test=25600M
--exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M
# End of 4.1 tests

View file

@ -10,19 +10,19 @@ update t1 set a=a+2 where a=2;
update t1 set a=a+2 where a=3;
create table t2 (word varchar(20));
load data infile '../../std_data/words.dat' into table t2;
load data infile '../std_data_ln/words.dat' into table t2;
#
# Save binlog
#
--exec $MYSQL_BINLOG --hexdump $MYSQL_TEST_DIR/var/log/master-bin.000001 > $MYSQL_TEST_DIR/var/tmp/mysqlbinlog_base64.sql
--exec $MYSQL_BINLOG --hexdump $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
#
# Clear database and restore from binlog
#
drop table t1;
drop table t2;
--exec $MYSQL test < $MYSQL_TEST_DIR/var/tmp/mysqlbinlog_base64.sql
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
#
# Verify that all binlog events have been executed
@ -33,6 +33,6 @@ select * from t2;
#
# Test cleanup
#
--exec rm $MYSQL_TEST_DIR/var/tmp/mysqlbinlog_base64.sql
--exec rm $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
drop table t1;
drop table t2;

View file

@ -5,6 +5,8 @@
# depends on the presence of the log tables (which are CSV-based).
--source include/have_csv.inc
DROP SCHEMA test;
CREATE SCHEMA test;
#
# Bug #13783 mysqlcheck tries to optimize and analyze information_schema
#

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