Commit a4accebc authored by unknown's avatar unknown

Merge mskold@bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/usr/local/home/marty/MySQL/test/mysql-4.1
parents 3df9efc2 4d8eb5e3
...@@ -208,7 +208,7 @@ INCLUDES="$INCLUDES $ZLIB_INCLUDES" ...@@ -208,7 +208,7 @@ INCLUDES="$INCLUDES $ZLIB_INCLUDES"
LIBS="$LIBS $ZLIB_LIBS" LIBS="$LIBS $ZLIB_LIBS"
AC_CACHE_VAL([mysql_cv_compress], AC_CACHE_VAL([mysql_cv_compress],
[AC_TRY_LINK([#include <zlib.h>], [AC_TRY_LINK([#include <zlib.h>],
[int link_test() { return compress(0, (unsigned long*) 0, "", 0); }], [return compress(0, (unsigned long*) 0, "", 0);],
[mysql_cv_compress="yes" [mysql_cv_compress="yes"
AC_MSG_RESULT([ok])], AC_MSG_RESULT([ok])],
[mysql_cv_compress="no"]) [mysql_cv_compress="no"])
......
...@@ -108,7 +108,7 @@ static const char *command_names[]= { ...@@ -108,7 +108,7 @@ static const char *command_names[]= {
}; };
static TYPELIB command_typelib= static TYPELIB command_typelib=
{ array_elements(command_names)-1,"commands", command_names}; { array_elements(command_names)-1,"commands", command_names, NULL};
static struct my_option my_long_options[] = static struct my_option my_long_options[] =
{ {
......
...@@ -124,7 +124,7 @@ const char *compatible_mode_names[]= ...@@ -124,7 +124,7 @@ const char *compatible_mode_names[]=
(1<<10) /* ANSI */\ (1<<10) /* ANSI */\
) )
TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1, TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1,
"", compatible_mode_names}; "", compatible_mode_names, NULL};
static struct my_option my_long_options[] = static struct my_option my_long_options[] =
...@@ -317,7 +317,7 @@ static struct my_option my_long_options[] = ...@@ -317,7 +317,7 @@ static struct my_option my_long_options[] =
{"comments", 'i', "Write additional information.", {"comments", 'i', "Write additional information.",
(gptr*) &opt_comments, (gptr*) &opt_comments, 0, GET_BOOL, NO_ARG, (gptr*) &opt_comments, (gptr*) &opt_comments, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0}, 1, 0, 0, 0, 0, 0},
{"hex-blob", OPT_HEXBLOB, "Dump BLOBs in HEX. this mode does not work with extended-insert", {"hex-blob", OPT_HEXBLOB, "Dump BLOBs in HEX.",
(gptr*) &opt_hex_blob, (gptr*) &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &opt_hex_blob, (gptr*) &opt_hex_blob, 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} {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
}; };
...@@ -1523,10 +1523,11 @@ static void dumpTable(uint numFields, char *table) ...@@ -1523,10 +1523,11 @@ static void dumpTable(uint numFields, char *table)
/* /*
63 is my_charset_bin. If charsetnr is not 63, 63 is my_charset_bin. If charsetnr is not 63,
we have not a BLOB but a TEXT column. we have not a BLOB but a TEXT column.
we'll dump it in hex only BLOB columns. we'll dump in hex only BLOB columns.
*/ */
is_blob= (opt_hex_blob && field->charsetnr == 63 && is_blob= (opt_hex_blob && field->charsetnr == 63 &&
(field->type == FIELD_TYPE_BLOB || (field->type == FIELD_TYPE_STRING ||
field->type == FIELD_TYPE_BLOB ||
field->type == FIELD_TYPE_LONG_BLOB || field->type == FIELD_TYPE_LONG_BLOB ||
field->type == FIELD_TYPE_MEDIUM_BLOB || field->type == FIELD_TYPE_MEDIUM_BLOB ||
field->type == FIELD_TYPE_TINY_BLOB)) ? 1 : 0; field->type == FIELD_TYPE_TINY_BLOB)) ? 1 : 0;
...@@ -1544,6 +1545,13 @@ static void dumpTable(uint numFields, char *table) ...@@ -1544,6 +1545,13 @@ static void dumpTable(uint numFields, char *table)
{ {
if (!IS_NUM_FIELD(field)) if (!IS_NUM_FIELD(field))
{ {
/*
"length * 2 + 2" is OK for both HEX and non-HEX modes:
- In HEX mode we need exactly 2 bytes per character
plus 2 bytes for '0x' prefix.
- In non-HEX mode we need up to 2 bytes per character,
plus 2 bytes for leading and trailing '\'' characters.
*/
if (dynstr_realloc(&extended_row,length * 2+2)) if (dynstr_realloc(&extended_row,length * 2+2))
{ {
fputs("Aborting dump (out of memory)",stderr); fputs("Aborting dump (out of memory)",stderr);
...@@ -1552,15 +1560,11 @@ static void dumpTable(uint numFields, char *table) ...@@ -1552,15 +1560,11 @@ static void dumpTable(uint numFields, char *table)
} }
if (opt_hex_blob && is_blob) if (opt_hex_blob && is_blob)
{ {
ulong counter;
unsigned char *ptr= row[i];
dynstr_append(&extended_row, "0x"); dynstr_append(&extended_row, "0x");
for (counter = 0; counter < lengths[i]; counter++) extended_row.length+= mysql_hex_string(extended_row.str +
{ extended_row.length,
char xx[3]; row[i], length);
sprintf(xx, "%02X", ptr[counter]); extended_row.str[extended_row.length]= '\0';
dynstr_append(&extended_row, xx);
}
} }
else else
{ {
......
...@@ -949,8 +949,11 @@ static void do_exec(struct st_query* q) ...@@ -949,8 +949,11 @@ static void do_exec(struct st_query* q)
while (fgets(buf, sizeof(buf), res_file)) while (fgets(buf, sizeof(buf), res_file))
replace_dynstr_append_mem(ds, buf, strlen(buf)); replace_dynstr_append_mem(ds, buf, strlen(buf));
} }
#ifndef __WIN__
error= pclose(res_file); error= pclose(res_file);
#else
error= _pclose(res_file);
#endif
if (error != 0) if (error != 0)
die("command \"%s\" failed", cmd); die("command \"%s\" failed", cmd);
...@@ -4516,8 +4519,7 @@ static void get_replace_column(struct st_query *q) ...@@ -4516,8 +4519,7 @@ static void get_replace_column(struct st_query *q)
my_free(start, MYF(0)); my_free(start, MYF(0));
} }
#ifdef __NETWARE__ #if defined(__NETWARE__) || defined(__WIN__)
/* /*
Substitute environment variables with text. Substitute environment variables with text.
...@@ -4608,9 +4610,13 @@ FILE *my_popen(const char *cmd, const char *mode __attribute__((unused))) ...@@ -4608,9 +4610,13 @@ FILE *my_popen(const char *cmd, const char *mode __attribute__((unused)))
FILE *res_file; FILE *res_file;
subst_cmd= subst_env_var(cmd); subst_cmd= subst_env_var(cmd);
#ifndef __WIN__
res_file= popen(subst_cmd, "r0"); res_file= popen(subst_cmd, "r0");
#else
res_file= _popen(subst_cmd, "r0");
#endif
my_free(subst_cmd, MYF(0)); my_free(subst_cmd, MYF(0));
return res_file; return res_file;
} }
#endif /* __NETWARE__ */ #endif /* __NETWARE__ or __WIN__*/
...@@ -463,6 +463,14 @@ lock_rec_hash( ...@@ -463,6 +463,14 @@ lock_rec_hash(
ulint space, /* in: space */ ulint space, /* in: space */
ulint page_no);/* in: page number */ ulint page_no);/* in: page number */
/************************************************************************* /*************************************************************************
Gets the table covered by an IX table lock. */
dict_table_t*
lock_get_ix_table(
/*==============*/
/* out: the table covered by the lock */
lock_t* lock); /* in: table lock */
/*************************************************************************
Checks that a transaction id is sensible, i.e., not in the future. */ Checks that a transaction id is sensible, i.e., not in the future. */
ibool ibool
......
...@@ -175,8 +175,12 @@ int ...@@ -175,8 +175,12 @@ int
row_lock_table_for_mysql( row_lock_table_for_mysql(
/*=====================*/ /*=====================*/
/* out: error code or DB_SUCCESS */ /* out: error code or DB_SUCCESS */
row_prebuilt_t* prebuilt); /* in: prebuilt struct in the MySQL row_prebuilt_t* prebuilt, /* in: prebuilt struct in the MySQL
table handle */ table handle */
dict_table_t* table); /* in: table to LOCK_IX, or NULL
if prebuilt->table should be
locked as LOCK_TABLE_EXP |
prebuilt->select_lock_type */
/************************************************************************* /*************************************************************************
Does an insert for MySQL. */ Does an insert for MySQL. */
......
...@@ -395,6 +395,19 @@ lock_rec_get_nth_bit( ...@@ -395,6 +395,19 @@ lock_rec_get_nth_bit(
return(ut_bit_get_nth(b, bit_index)); return(ut_bit_get_nth(b, bit_index));
} }
/*************************************************************************
Gets the table covered by an IX table lock. */
dict_table_t*
lock_get_ix_table(
/*==============*/
/* out: the table covered by the lock */
lock_t* lock) /* in: table lock */
{
ut_a(lock->type_mode == (LOCK_TABLE | LOCK_IX));
return(lock->un_member.tab_lock.table);
}
/*************************************************************************/ /*************************************************************************/
#define lock_mutex_enter_kernel() mutex_enter(&kernel_mutex) #define lock_mutex_enter_kernel() mutex_enter(&kernel_mutex)
......
...@@ -779,8 +779,12 @@ int ...@@ -779,8 +779,12 @@ int
row_lock_table_for_mysql( row_lock_table_for_mysql(
/*=====================*/ /*=====================*/
/* out: error code or DB_SUCCESS */ /* out: error code or DB_SUCCESS */
row_prebuilt_t* prebuilt) /* in: prebuilt struct in the MySQL row_prebuilt_t* prebuilt, /* in: prebuilt struct in the MySQL
table handle */ table handle */
dict_table_t* table) /* in: table to LOCK_IX, or NULL
if prebuilt->table should be
locked as LOCK_TABLE_EXP |
prebuilt->select_lock_type */
{ {
trx_t* trx = prebuilt->trx; trx_t* trx = prebuilt->trx;
que_thr_t* thr; que_thr_t* thr;
...@@ -813,8 +817,12 @@ row_lock_table_for_mysql( ...@@ -813,8 +817,12 @@ row_lock_table_for_mysql(
trx_start_if_not_started(trx); trx_start_if_not_started(trx);
err = lock_table(LOCK_TABLE_EXP, prebuilt->table, if (table) {
prebuilt->select_lock_type, thr); err = lock_table(0, table, LOCK_IX, thr);
} else {
err = lock_table(LOCK_TABLE_EXP, prebuilt->table,
prebuilt->select_lock_type, thr);
}
trx->error_state = err; trx->error_state = err;
......
...@@ -1563,7 +1563,8 @@ void my_net_local_init(NET *net) ...@@ -1563,7 +1563,8 @@ void my_net_local_init(NET *net)
trailing '. The caller must supply whichever of those is desired. trailing '. The caller must supply whichever of those is desired.
*/ */
ulong mysql_hex_string(char *to, const char *from, ulong length) ulong STDCALL
mysql_hex_string(char *to, const char *from, ulong length)
{ {
char *to0= to; char *to0= to;
const char *end; const char *end;
......
...@@ -47,6 +47,7 @@ EXPORTS ...@@ -47,6 +47,7 @@ EXPORTS
mysql_errno mysql_errno
mysql_error mysql_error
mysql_escape_string mysql_escape_string
mysql_hex_string
mysql_stmt_execute mysql_stmt_execute
mysql_stmt_fetch mysql_stmt_fetch
mysql_stmt_fetch_column mysql_stmt_fetch_column
......
...@@ -36,6 +36,11 @@ test_SCRIPTS = mysql-test-run install_test_db ...@@ -36,6 +36,11 @@ test_SCRIPTS = mysql-test-run install_test_db
test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem
CLEANFILES = $(test_SCRIPTS) $(test_DATA) CLEANFILES = $(test_SCRIPTS) $(test_DATA)
INCLUDES = -I$(srcdir)/../include -I../include -I..
bin_PROGRAMS = mysql_test_run_new
mysql_test_run_new_SOURCES= mysql_test_run_new.c my_manage.c
dist-hook: dist-hook:
mkdir -p $(distdir)/t $(distdir)/r $(distdir)/include \ mkdir -p $(distdir)/t $(distdir)/r $(distdir)/include \
$(distdir)/std_data $(distdir)/std_data
......
CREATE DATABASE mysql;
CREATE DATABASE test;
USE mysql;
CREATE TABLE db (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User)) comment='Database privileges';
INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
CREATE TABLE host (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db)) comment='Host privileges; Merged with database privileges';
CREATE TABLE user (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(45) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') DEFAULT 'N' NOT NULL, File_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User)) comment='Users and global privileges';
INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
INSERT INTO user VALUES ('','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
INSERT INTO user (host,user) values ('localhost','');
INSERT INTO user (host,user) values ('','');
CREATE TABLE func (name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') NOT NULL, PRIMARY KEY (name)) comment='User defined functions';
CREATE TABLE tables_priv (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(60) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor)) comment='Table privileges';
CREATE TABLE columns_priv (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name)) comment='Column privileges';
This diff is collapsed.
/*
Copyright (c) 2002 Novell, Inc. All Rights Reserved.
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
*/
#ifndef _MY_MANAGE
#define _MY_MANAGE
/******************************************************************************
includes
******************************************************************************/
#include <stdlib.h>
#ifndef __WIN__
#include <unistd.h>
#endif
#ifndef __NETWARE__
#include <string.h>
#include <my_global.h>
#include <m_string.h>
#ifndef __WIN__
#define strnicmp strncasecmp
char *strlwr(const char *s);
#else
int my_vsnprintf_(char *to, size_t n, const char* value, ...);
#endif
#endif
/******************************************************************************
macros
******************************************************************************/
#define ARG_BUF 10
#define TRY_MAX 5
#ifdef __WIN__
#define PATH_MAX _MAX_PATH
#define NAME_MAX _MAX_FNAME
#define kill(A,B) TerminateProcess((HANDLE)A,0)
#define NOT_NEED_PID 0
#define MASTER_PID 1
#define SLAVE_PID 2
#define mysqld_timeout 60000
int pid_mode;
bool run_server;
bool skip_first_param;
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#endif
/******************************************************************************
structures
******************************************************************************/
typedef struct
{
int argc;
char **argv;
size_t size;
} arg_list_t;
#ifdef __WIN__
typedef int pid_t;
#endif
/******************************************************************************
global variables
******************************************************************************/
/******************************************************************************
prototypes
******************************************************************************/
void init_args(arg_list_t *);
void add_arg(arg_list_t *, const char *, ...);
void free_args(arg_list_t *);
#ifndef __WIN__
int sleep_until_file_exists(char *);
int sleep_until_file_deleted(char *);
#else
int sleep_until_file_exists(HANDLE);
int sleep_until_file_deleted(HANDLE);
#endif
int wait_for_server_start(char *, char *, char *, char *, int,char *);
#ifndef __WIN__
int spawn(char *, arg_list_t *, int, char *, char *, char *, char *);
#else
int spawn(char *, arg_list_t *, int , char *, char *, char *, HANDLE *);
#endif
#ifndef __WIN__
int stop_server(char *, char *, char *, char *, int, char *,char *);
pid_t get_server_pid(char *);
void kill_server(pid_t pid);
#else
int stop_server(char *, char *, char *, char *, int, HANDLE,char *);
#endif
void del_tree(char *);
int removef(const char *, ...);
void get_basedir(char *, char *);
void remove_empty_file(const char *file_name);
#endif /* _MY_MANAGE */
...@@ -994,9 +994,11 @@ start_master() ...@@ -994,9 +994,11 @@ start_master()
if [ -n "$1" ] ; then if [ -n "$1" ] ; then
id=`$EXPR $1 + 101`; id=`$EXPR $1 + 101`;
this_master_myport=`$EXPR $MASTER_MYPORT + $1` this_master_myport=`$EXPR $MASTER_MYPORT + $1`
NOT_FIRST_MASTER_EXTRA_OPTS="--skip-innodb"
else else
id=1; id=1;
this_master_myport=$MASTER_MYPORT this_master_myport=$MASTER_MYPORT
NOT_FIRST_MASTER_EXTRA_OPTS=""
fi fi
if [ -z "$DO_BENCH" ] if [ -z "$DO_BENCH" ]
then then
...@@ -1020,7 +1022,8 @@ start_master() ...@@ -1020,7 +1022,8 @@ start_master()
--open-files-limit=1024 \ --open-files-limit=1024 \
$MASTER_40_ARGS \ $MASTER_40_ARGS \
$SMALL_SERVER \ $SMALL_SERVER \
$EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT" $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT \
$NOT_FIRST_MASTER_EXTRA_OPTS"
else else
master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1 \ master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1 \
--server-id=$id --rpl-recovery-rank=1 \ --server-id=$id --rpl-recovery-rank=1 \
...@@ -1039,7 +1042,8 @@ start_master() ...@@ -1039,7 +1042,8 @@ start_master()
--innodb_data_file_path=ibdata1:50M \ --innodb_data_file_path=ibdata1:50M \
$MASTER_40_ARGS \ $MASTER_40_ARGS \
$SMALL_SERVER \ $SMALL_SERVER \
$EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT" $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT \
$NOT_FIRST_MASTER_EXTRA_OPTS"
fi fi
CUR_MYERR=$MASTER_MYERR CUR_MYERR=$MASTER_MYERR
......
This diff is collapsed.
This diff is collapsed.
...@@ -102,12 +102,43 @@ if [ ! -x "$exec_mgmtsrvr" ]; then ...@@ -102,12 +102,43 @@ if [ ! -x "$exec_mgmtsrvr" ]; then
echo "$exec_mgmtsrvr missing" echo "$exec_mgmtsrvr missing"
exit 1 exit 1
fi fi
if [ ! -x "$exec_waiter" ]; then
echo "$exec_waiter missing"
exit 1
fi
exec_mgmtclient="$exec_mgmtclient --no-defaults"
exec_mgmtsrvr="$exec_mgmtsrvr --no-defaults"
exec_ndb="$exec_ndb --no-defaults"
exec_waiter="$exec_waiter --no-defaults"
ndb_host="localhost" ndb_host="localhost"
ndb_mgmd_port=$port_base ndb_mgmd_port=$port_base
NDB_CONNECTSTRING="host=$ndb_host:$ndb_mgmd_port" NDB_CONNECTSTRING="host=$ndb_host:$ndb_mgmd_port"
export NDB_CONNECTSTRING export NDB_CONNECTSTRING
sleep_until_file_created () {
file=$1
loop=$2
org_time=$2
message=$3
while (test $loop -gt 0)
do
if [ -r $file ]
then
return 0
fi
sleep 1
loop=`expr $loop - 1`
done
if [ $message ]
then
echo $message
fi
echo "ERROR: $file was not created in $org_time seconds; Aborting"
return 1;
}
start_default_ndbcluster() { start_default_ndbcluster() {
# do some checks # do some checks
...@@ -127,8 +158,8 @@ port_transporter=`expr $ndb_mgmd_port + 2` ...@@ -127,8 +158,8 @@ port_transporter=`expr $ndb_mgmd_port + 2`
# Start management server as deamon # Start management server as deamon
# Edit file system path and ports in config file # Edit file system path and ports in config file
if [ $initial_ndb ] ; then if [ $initial_ndb ] ; then
rm -f $fs_ndb/ndb_*
sed \ sed \
-e s,"CHOOSE_MaxNoOfOrderedIndexes","$ndb_no_ord",g \ -e s,"CHOOSE_MaxNoOfOrderedIndexes","$ndb_no_ord",g \
-e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \ -e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \
...@@ -146,25 +177,36 @@ fi ...@@ -146,25 +177,36 @@ fi
rm -f "$cfgfile" 2>&1 | cat > /dev/null rm -f "$cfgfile" 2>&1 | cat > /dev/null
rm -f "$fs_ndb/$cfgfile" 2>&1 | cat > /dev/null rm -f "$fs_ndb/$cfgfile" 2>&1 | cat > /dev/null
if ( cd "$fs_ndb" ; $exec_mgmtsrvr -c config.ini ) ; then :; else if ( cd "$fs_ndb" ; $exec_mgmtsrvr -f config.ini ) ; then :; else
echo "Unable to start $exec_mgmtsrvr from `pwd`" echo "Unable to start $exec_mgmtsrvr from `pwd`"
exit 1 exit 1
fi fi
if sleep_until_file_created $fs_ndb/ndb_3.pid 30
then :; else
exit 1
fi
cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
# Start database node # Start database node
echo "Starting ndbd" echo "Starting ndbd"
( cd "$fs_ndb" ; $exec_ndb $flags_ndb & ) ( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
if sleep_until_file_created $fs_ndb/ndb_1.pid 30
then :; else
stop_default_ndbcluster
exit 1
fi
cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
# Start database node # Start database node
echo "Starting ndbd" echo "Starting ndbd"
( cd "$fs_ndb" ; $exec_ndb $flags_ndb & ) ( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
if sleep_until_file_created $fs_ndb/ndb_2.pid 30
then :; else
stop_default_ndbcluster
exit 1
fi
cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
# test if Ndb Cluster starts properly # test if Ndb Cluster starts properly
...@@ -172,6 +214,7 @@ cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" ...@@ -172,6 +214,7 @@ cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
echo "Waiting for started..." echo "Waiting for started..."
if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else
echo "Ndbcluster startup failed" echo "Ndbcluster startup failed"
stop_default_ndbcluster
exit 1 exit 1
fi fi
...@@ -198,10 +241,12 @@ if [ -f "$fs_ndb/$pidfile" ] ; then ...@@ -198,10 +241,12 @@ if [ -f "$fs_ndb/$pidfile" ] ; then
attempt=0 attempt=0
while [ $attempt -lt 10 ] ; do while [ $attempt -lt 10 ] ; do
new_kill_pid="" new_kill_pid=""
kill_pids2=""
for p in $kill_pids ; do for p in $kill_pids ; do
kill -0 $p 2> /dev/null kill -0 $p 2> /dev/null
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
new_kill_pid="$p $new_kill_pid" new_kill_pid="$p $new_kill_pid"
kill_pids2="-$p $kill_pids2"
fi fi
done done
kill_pids=$new_kill_pid kill_pids=$new_kill_pid
...@@ -211,9 +256,14 @@ if [ -f "$fs_ndb/$pidfile" ] ; then ...@@ -211,9 +256,14 @@ if [ -f "$fs_ndb/$pidfile" ] ; then
sleep 1 sleep 1
attempt=`expr $attempt + 1` attempt=`expr $attempt + 1`
done done
if [ "$kill_pids" != "" ] ; then if [ "$kill_pids2" != "" ] ; then
echo "Failed to shutdown ndbcluster, executing kill -9 "$kill_pids echo "Failed to shutdown ndbcluster, executing kill "$kill_pids2
kill -9 $kill_pids kill -9 -- $kill_pids2 2> /dev/null
/bin/kill -9 -- $kill_pids2 2> /dev/null
/usr/bin/kill -9 -- $kill_pids2 2> /dev/null
kill -9 $kill_pids2 2> /dev/null
/bin/kill -9 $kill_pids2 2> /dev/null
/usr/bin/kill -9 $kill_pids2 2> /dev/null
fi fi
rm "$fs_ndb/$pidfile" rm "$fs_ndb/$pidfile"
fi fi
......
...@@ -480,3 +480,10 @@ a 0061 ...@@ -480,3 +480,10 @@ a 0061
b 0062 b 0062
c 0063 c 0063
drop table t1; drop table t1;
set @ivar= 1234;
set @str1 = 'select ?';
set @str2 = convert(@str1 using ucs2);
prepare stmt1 from @str2;
execute stmt1 using @ivar;
?
1234
...@@ -355,9 +355,9 @@ t collation(t) ...@@ -355,9 +355,9 @@ t collation(t)
aus Osnabrck utf8_general_ci aus Osnabrck utf8_general_ci
SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrueck'); SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrueck');
t collation(t) t collation(t)
SELECT t, collation(t),MATCH t AGAINST ('Osnabruck') FROM t1 WHERE MATCH t AGAINST ('Osnabruck'); SELECT t, collation(t),FORMAT(MATCH t AGAINST ('Osnabruck'),6) FROM t1 WHERE MATCH t AGAINST ('Osnabruck');
t collation(t) MATCH t AGAINST ('Osnabruck') t collation(t) FORMAT(MATCH t AGAINST ('Osnabruck'),6)
aus Osnabrck utf8_general_ci 1.591139793396 aus Osnabrck utf8_general_ci 1.591140
alter table t1 modify t varchar(200) collate latin1_german2_ci not null; alter table t1 modify t varchar(200) collate latin1_german2_ci not null;
Warnings: Warnings:
Warning 1265 Data truncated for column 't' at row 3 Warning 1265 Data truncated for column 't' at row 3
......
...@@ -6,53 +6,53 @@ FULLTEXT(message) ...@@ -6,53 +6,53 @@ FULLTEXT(message)
) comment = 'original testcase by sroussey@network54.com'; ) comment = 'original testcase by sroussey@network54.com';
INSERT INTO t1 (message) VALUES ("Testing"),("table"),("testbug"), INSERT INTO t1 (message) VALUES ("Testing"),("table"),("testbug"),
("steve"),("is"),("cool"),("steve is cool"); ("steve"),("is"),("cool"),("steve is cool");
SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve'); SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve');
a MATCH (message) AGAINST ('steve') a FORMAT(MATCH (message) AGAINST ('steve'),6)
4 0.90587323904037 4 0.905873
7 0.89568990468979 7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve'); SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve');
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
4 1 4 1
7 1 7 1
SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE); SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
a MATCH (message) AGAINST ('steve') a FORMAT(MATCH (message) AGAINST ('steve'),6)
4 0.90587323904037 4 0.905873
7 0.89568990468979 7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE); SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
4 1 4 1
7 1 7 1
SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a; SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
a MATCH (message) AGAINST ('steve') a FORMAT(MATCH (message) AGAINST ('steve'),6)
4 0.90587323904037 4 0.905873
7 0.89568990468979 7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a; SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a;
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
4 1 4 1
7 1 7 1
SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC; SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
a MATCH (message) AGAINST ('steve') a FORMAT(MATCH (message) AGAINST ('steve'),6)
7 0.89568990468979 7 0.895690
4 0.90587323904037 4 0.905873
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a DESC; SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a DESC;
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
7 1 7 1
4 1 4 1
SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1; SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
a MATCH (message) AGAINST ('steve') a FORMAT(MATCH (message) AGAINST ('steve'),6)
7 0.89568990468979 7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY 1; SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY 1;
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
7 1 7 1
SELECT a, MATCH (message) AGAINST ('steve') as rel FROM t1 ORDER BY rel; SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) as rel FROM t1 ORDER BY rel;
a rel a rel
1 0 1 0.000000
2 0 2 0.000000
3 0 3 0.000000
5 0 5 0.000000
6 0 6 0.000000
7 0.89568990468979 7 0.895690
4 0.90587323904037 4 0.905873
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel; SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel;
a rel a rel
1 0 1 0
......
...@@ -179,3 +179,9 @@ select 1 in ('1.1',2); ...@@ -179,3 +179,9 @@ select 1 in ('1.1',2);
select 1 in ('1.1',2.0); select 1 in ('1.1',2.0);
1 in ('1.1',2.0) 1 in ('1.1',2.0)
0 0
create table t1 (a char(20) character set binary);
insert into t1 values ('aa'), ('bb');
select * from t1 where a in (NULL, 'aa');
a
aa
drop table t1;
...@@ -106,12 +106,6 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp ...@@ -106,12 +106,6 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
set @fvar= 123.4567; set @fvar= 123.4567;
prepare stmt1 from @fvar; prepare stmt1 from @fvar;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '123.4567' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '123.4567' at line 1
set @str1 = 'select ?';
set @str2 = convert(@str1 using ucs2);
prepare stmt1 from @str2;
execute stmt1 using @ivar;
?
1234
drop table t1,t2; drop table t1,t2;
PREPARE stmt1 FROM "select _utf8 'A' collate utf8_bin = ?"; PREPARE stmt1 FROM "select _utf8 'A' collate utf8_bin = ?";
set @var='A'; set @var='A';
......
...@@ -22,14 +22,14 @@ select * from t1; ...@@ -22,14 +22,14 @@ select * from t1;
f1 f2 f1 f2
10 10 10 10
100000 100000 100000 100000
1.23457e+09 1234567890 1.23457e+9 1234567890
1e+10 10000000000 1e+10 10000000000
1e+15 1e+15 1e+15 1e+15
1e+20 1e+20 1e+20 1e+20
3.40282e+38 1e+50 3.40282e+38 1e+50
3.40282e+38 1e+150 3.40282e+38 1e+150
-10 -10 -10 -10
1e-05 1e-05 1e-5 1e-5
1e-10 1e-10 1e-10 1e-10
1e-15 1e-15 1e-15 1e-15
1e-20 1e-20 1e-20 1e-20
......
...@@ -315,3 +315,11 @@ alter table t1 modify a char(5); ...@@ -315,3 +315,11 @@ alter table t1 modify a char(5);
select a, hex(a) from t1; select a, hex(a) from t1;
drop table t1; drop table t1;
#
# Check prepare statement from an UCS2 string
#
set @ivar= 1234;
set @str1 = 'select ?';
set @str2 = convert(@str1 using ucs2);
prepare stmt1 from @str2;
execute stmt1 using @ivar;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment