Commit 47a5ac0e authored by unknown's avatar unknown

Merge with 4.1 to get new thd->mem_root handling


BitKeeper/etc/ignore:
  auto-union
client/mysqldump.c:
  Auto merged
client/mysqltest.c:
  Auto merged
innobase/include/row0mysql.h:
  Auto merged
libmysql/libmysql.c:
  Auto merged
mysql-test/r/ctype_ucs.result:
  Auto merged
mysql-test/r/fulltext.result:
  Auto merged
mysql-test/r/func_in.result:
  Auto merged
mysql-test/r/ps.result:
  Auto merged
mysql-test/r/ps_2myisam.result:
  Auto merged
mysql-test/r/ps_3innodb.result:
  Auto merged
mysql-test/r/ps_4heap.result:
  Auto merged
mysql-test/r/ps_5merge.result:
  Auto merged
mysql-test/r/ps_6bdb.result:
  Auto merged
mysql-test/r/type_float.result:
  Auto merged
mysql-test/r/user_var.result:
  Auto merged
mysql-test/t/innodb.test:
  Auto merged
mysql-test/t/user_var.test:
  Auto merged
mysql-test/t/variables.test:
  Auto merged
sql/ha_berkeley.cc:
  Auto merged
sql/ha_innodb.cc:
  Auto merged
sql/ha_innodb.h:
  Auto merged
sql/ha_ndbcluster.h:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/repl_failsafe.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_db.cc:
  Auto merged
sql/sql_error.cc:
  Auto merged
sql/sql_help.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_select.h:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
parents 87abc13d 8793e219
...@@ -519,6 +519,7 @@ mysql-max-4.0.2-alpha-pc-linux-gnu-i686.tar.gz ...@@ -519,6 +519,7 @@ mysql-max-4.0.2-alpha-pc-linux-gnu-i686.tar.gz
mysql-test/gmon.out mysql-test/gmon.out
mysql-test/install_test_db mysql-test/install_test_db
mysql-test/mysql-test-run mysql-test/mysql-test-run
mysql-test/mysql_test_run_new
mysql-test/ndb/ndbcluster mysql-test/ndb/ndbcluster
mysql-test/r/*.reject mysql-test/r/*.reject
mysql-test/r/index_merge_load.result mysql-test/r/index_merge_load.result
......
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library 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
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA
## Process this file with automake to create Makefile.in
# This is a dummy file to satisfy the hierarchy of Makefiles.
# When a release is built, the true Makefile will be copied
# together with the "real" files in this directory.
EXTRA_DIST =
# Nothing to create in this dummy directory.
all:
:
# Nothing to cleanup in this dummy directory.
clean:
:
# Don't update the files from bitkeeper
%::SCCS/s.%
...@@ -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[] =
{ {
......
...@@ -126,7 +126,7 @@ const char *compatible_mode_names[]= ...@@ -126,7 +126,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[] =
...@@ -319,7 +319,7 @@ static struct my_option my_long_options[] = ...@@ -319,7 +319,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}
}; };
...@@ -1543,10 +1543,12 @@ static void dumpTable(uint numFields, char *table) ...@@ -1543,10 +1543,12 @@ 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_VAR_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;
...@@ -1564,6 +1566,13 @@ static void dumpTable(uint numFields, char *table) ...@@ -1564,6 +1566,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);
...@@ -1572,15 +1581,11 @@ static void dumpTable(uint numFields, char *table) ...@@ -1572,15 +1581,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
{ {
......
...@@ -951,7 +951,6 @@ static void do_exec(struct st_query* q) ...@@ -951,7 +951,6 @@ 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));
} }
error= pclose(res_file); error= pclose(res_file);
if (error != 0) if (error != 0)
...@@ -4520,8 +4519,7 @@ static void get_replace_column(struct st_query *q) ...@@ -4520,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.
...@@ -4617,4 +4615,4 @@ FILE *my_popen(const char *cmd, const char *mode __attribute__((unused))) ...@@ -4617,4 +4615,4 @@ FILE *my_popen(const char *cmd, const char *mode __attribute__((unused)))
return res_file; return res_file;
} }
#endif /* __NETWARE__ */ #endif /* __NETWARE__ or __WIN__*/
...@@ -175,6 +175,8 @@ typedef uint rf_SetTimer; ...@@ -175,6 +175,8 @@ typedef uint rf_SetTimer;
#define sigset(A,B) signal((A),(B)) #define sigset(A,B) signal((A),(B))
#define finite(A) _finite(A) #define finite(A) _finite(A)
#define sleep(A) Sleep((A)*1000) #define sleep(A) Sleep((A)*1000)
#define popen(A) popen(A,B) _popen((A),(B))
#define pclose(A) _pclose(A)
#ifndef __BORLANDC__ #ifndef __BORLANDC__
#define access(A,B) _access(A,B) #define access(A,B) _access(A,B)
......
...@@ -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);
if (table) {
err = lock_table(0, table, LOCK_IX, thr);
} else {
err = lock_table(LOCK_TABLE_EXP, prebuilt->table, err = lock_table(LOCK_TABLE_EXP, prebuilt->table,
prebuilt->select_lock_type, thr); 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,12 @@ test_SCRIPTS = mysql-test-run install_test_db ...@@ -36,6 +36,12 @@ 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
noinst_HEADERS = my_manage.h
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
#define strlwr(STRARG) (STRARG)
#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 */
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 \
...@@ -150,21 +181,32 @@ if ( cd "$fs_ndb" ; $exec_mgmtsrvr -f config.ini ) ; then :; else ...@@ -150,21 +181,32 @@ 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 "$kill_pids echo "Failed to shutdown ndbcluster, executing kill "$kill_pids2
kill $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;
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.
...@@ -201,3 +201,7 @@ SET @`v`:=_ucs2 0x006100620063 COLLATE ucs2_general_ci; ...@@ -201,3 +201,7 @@ SET @`v`:=_ucs2 0x006100620063 COLLATE ucs2_general_ci;
SET TIMESTAMP=10000; SET TIMESTAMP=10000;
insert into t2 values (@v); insert into t2 values (@v);
drop table t1, t2; drop table t1, t2;
set @var= NULL ;
select FIELD( @var,'1it','Hit') as my_column;
my_column
0
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.
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.
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.
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.
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.
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