Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0

into  neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint


BitKeeper/etc/ignore:
  auto-union
Docs/Makefile.am:
  Auto merged
Makefile.am:
  Auto merged
client/mysql.cc:
  Auto merged
client/mysqltest.c:
  Auto merged
include/Makefile.am:
  Auto merged
myisam/myisampack.c:
  Auto merged
mysql-test/lib/mtr_io.pl:
  Auto merged
mysql-test/lib/mtr_process.pl:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/view_grant.result:
  Auto merged
mysql-test/t/view_grant.test:
  Auto merged
sql/handler.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql-common/my_time.c:
  Auto merged
sql/sql_handler.cc:
  Auto merged
extra/yassl/taocrypt/include/algebra.hpp:
  Manual merge with import of upstream yaSSL
This commit is contained in:
unknown 2006-12-04 19:28:38 +01:00
commit 2e5a6f9eaa
152 changed files with 1871 additions and 632 deletions

View File

@ -9,6 +9,8 @@
*.d *.d
*.da *.da
*.exe *.exe
*.gcda
*.gcno
*.gcov *.gcov
*.idb *.idb
*.la *.la
@ -209,6 +211,11 @@ bdb/dist/autom4te.cache/requests
bdb/dist/autom4te.cache/traces.0 bdb/dist/autom4te.cache/traces.0
bdb/dist/config.hin bdb/dist/config.hin
bdb/dist/configure bdb/dist/configure
bdb/dist/db.h
bdb/dist/db_config.h
bdb/dist/db_cxx.h
bdb/dist/db_int.h
bdb/dist/include.tcl
bdb/dist/tags bdb/dist/tags
bdb/dist/template/db_server_proc bdb/dist/template/db_server_proc
bdb/dist/template/gen_client_ret bdb/dist/template/gen_client_ret

View File

@ -49,6 +49,14 @@ BUILT_SOURCES = linked_client_sources linked_server_sources \
CLEANFILES = $(BUILT_SOURCES) bdb/build_unix/db.h CLEANFILES = $(BUILT_SOURCES) bdb/build_unix/db.h
DISTCLEANFILES = ac_available_languages_fragment DISTCLEANFILES = ac_available_languages_fragment
# Our current filtering of "sql_yacc.cc" in "sql/Makefile.am" creates
# a problem, if a VPATH build and "sql_yacc.cc" was part of the source
# distribution we end up with one "sql_yacc.cc" in the source tree,
# and one in the build tree. This breaks "distcleancheck", until this
# is sorted out we redefine the find that scans for files not removed
distcleancheck_listfiles = find . -name sql_yacc.cc -o -type f -print
linked_include_sources: linked_include_sources:
cd include; $(MAKE) link_sources cd include; $(MAKE) link_sources
echo timestamp > linked_include_sources echo timestamp > linked_include_sources
@ -92,15 +100,12 @@ bin-dist: all
# Create initial database files for Windows installations. # Create initial database files for Windows installations.
dist-hook: dist-hook:
rm -rf `find $(distdir) -type d -name SCCS -print` rm -rf `find $(distdir) -type d -name SCCS -print`
if echo "$(distdir)" | grep -q '^/' ; then \ rm -f `find $(distdir) -type l -print`
scripts/mysql_install_db --no-defaults --windows \ mkdir -p $(distdir)/win
--basedir=$(top_srcdir) \ scripts/mysql_install_db --no-defaults --windows \
--datadir="$(distdir)/win/data"; \ --basedir=$(top_builddir) \
else \ --datadir=$(distdir)/win/data \
scripts/mysql_install_db --no-defaults --windows \ --srcdir=$(top_srcdir)
--basedir=$(top_srcdir) \
--datadir="$$(pwd)/$(distdir)/win/data"; \
fi
tags: tags:
support-files/build-tags support-files/build-tags

View File

@ -2410,7 +2410,6 @@ print_table_data(MYSQL_RES *result)
const char *buffer; const char *buffer;
uint data_length; uint data_length;
uint field_max_length; uint field_max_length;
bool right_justified;
uint visible_length; uint visible_length;
uint extra_padding; uint extra_padding;
@ -3467,7 +3466,6 @@ server_version_string(MYSQL *mysql)
{ {
char *bufp = buf; char *bufp = buf;
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW cur;
bufp = strnmov(buf, mysql_get_server_info(mysql), sizeof buf); bufp = strnmov(buf, mysql_get_server_info(mysql), sizeof buf);

View File

@ -1419,7 +1419,7 @@ static uint dump_routines_for_db(char *db)
routine body of other routines that are not the creator of! routine body of other routines that are not the creator of!
*/ */
DBUG_PRINT("info",("length of body for %s row[2] '%s' is %d", DBUG_PRINT("info",("length of body for %s row[2] '%s' is %d",
routine_name, row[2], strlen(row[2]))); routine_name, row[2], (int) strlen(row[2])));
if (strlen(row[2])) if (strlen(row[2]))
{ {
char *query_str= NULL; char *query_str= NULL;
@ -2001,7 +2001,7 @@ continue_xml:
write_footer(sql_file); write_footer(sql_file);
my_fclose(sql_file, MYF(MY_WME)); my_fclose(sql_file, MYF(MY_WME));
} }
DBUG_RETURN(num_fields); DBUG_RETURN((uint) num_fields);
} /* get_table_structure */ } /* get_table_structure */

View File

@ -222,11 +222,13 @@ struct st_connection
char *name; char *name;
MYSQL_STMT* stmt; MYSQL_STMT* stmt;
#ifdef EMBEDDED_LIBRARY
const char *cur_query; const char *cur_query;
int cur_query_len; int cur_query_len;
pthread_mutex_t mutex; pthread_mutex_t mutex;
pthread_cond_t cond; pthread_cond_t cond;
int query_done; int query_done;
#endif /*EMBEDDED_LIBRARY*/
}; };
struct st_connection connections[128]; struct st_connection connections[128];
struct st_connection* cur_con, *next_con, *connections_end; struct st_connection* cur_con, *next_con, *connections_end;
@ -963,8 +965,8 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname)
die(NullS); die(NullS);
if (!eval_result && (uint) stat_info.st_size != ds->length) if (!eval_result && (uint) stat_info.st_size != ds->length)
{ {
DBUG_PRINT("info",("Size differs: result size: %u file size: %llu", DBUG_PRINT("info",("Size differs: result size: %u file size: %lu",
ds->length, stat_info.st_size)); ds->length, (ulong) stat_info.st_size));
DBUG_PRINT("info",("result: '%s'", ds->str)); DBUG_PRINT("info",("result: '%s'", ds->str));
DBUG_RETURN(RESULT_LENGTH_MISMATCH); DBUG_RETURN(RESULT_LENGTH_MISMATCH);
} }
@ -3191,14 +3193,15 @@ void do_connect(struct st_command *command)
else if (!strncmp(con_options, "COMPRESS", 8)) else if (!strncmp(con_options, "COMPRESS", 8))
con_compress= 1; con_compress= 1;
else else
die("Illegal option to connect: %.*s", end - con_options, con_options); die("Illegal option to connect: %.*s",
(int) (end - con_options), con_options);
/* Process next option */ /* Process next option */
con_options= end; con_options= end;
} }
if (next_con == connections_end) if (next_con == connections_end)
die("Connection limit exhausted, you can have max %d connections", die("Connection limit exhausted, you can have max %d connections",
(sizeof(connections)/sizeof(struct st_connection))); (int) (sizeof(connections)/sizeof(struct st_connection)));
if (find_connection_by_name(ds_connection_name.str)) if (find_connection_by_name(ds_connection_name.str))
die("Connection %s already exists", ds_connection_name.str); die("Connection %s already exists", ds_connection_name.str);
@ -3519,10 +3522,10 @@ int read_line(char *buf, int size)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
else if ((c == '{' && else if ((c == '{' &&
(!my_strnncoll_simple(charset_info, "while", 5, (!my_strnncoll_simple(charset_info, (const uchar*) "while", 5,
buf, min(5, p - buf), 0) || (uchar*) buf, min(5, p - buf), 0) ||
!my_strnncoll_simple(charset_info, "if", 2, !my_strnncoll_simple(charset_info, (const uchar*) "if", 2,
buf, min(2, p - buf), 0)))) (uchar*) buf, min(2, p - buf), 0))))
{ {
/* Only if and while commands can be terminated by { */ /* Only if and while commands can be terminated by { */
*p++= c; *p++= c;

View File

@ -337,6 +337,7 @@ rl_generic_bind (type, keyseq, data, map)
KEYMAP_ENTRY k; KEYMAP_ENTRY k;
k.function = 0; k.function = 0;
k.type= 0;
/* If no keys to bind to, exit right away. */ /* If no keys to bind to, exit right away. */
if (!keyseq || !*keyseq) if (!keyseq || !*keyseq)
@ -735,7 +736,8 @@ _rl_read_file (filename, sizep)
file_size = (size_t)finfo.st_size; file_size = (size_t)finfo.st_size;
/* check for overflow on very large files */ /* check for overflow on very large files */
if (file_size != finfo.st_size || file_size + 1 < file_size) if ((long long) file_size != (long long) finfo.st_size ||
file_size + 1 < file_size)
{ {
if (file >= 0) if (file >= 0)
close (file); close (file);

View File

@ -184,7 +184,8 @@ read_history_range (filename, from, to)
file_size = (size_t)finfo.st_size; file_size = (size_t)finfo.st_size;
/* check for overflow on very large files */ /* check for overflow on very large files */
if (file_size != finfo.st_size || file_size + 1 < file_size) if ((long long) file_size != (long long) finfo.st_size ||
file_size + 1 < file_size)
{ {
errno = overflow_errno; errno = overflow_errno;
goto error_and_exit; goto error_and_exit;

View File

@ -1052,8 +1052,10 @@ static int convert_file(REPLACE *rep, my_string name)
{ {
int error; int error;
FILE *in,*out; FILE *in,*out;
char dir_buff[FN_REFLEN], tempname[FN_REFLEN]; char dir_buff[FN_REFLEN], tempname[FN_REFLEN], *org_name = name;
char link_name[FN_REFLEN], *org_name = name; #ifdef HAVE_READLINK
char link_name[FN_REFLEN];
#endif
File temp_file; File temp_file;
DBUG_ENTER("convert_file"); DBUG_ENTER("convert_file");

View File

@ -36,7 +36,8 @@ void hp_clear(HP_SHARE *info)
(byte*) 0)); (byte*) 0));
info->block.levels=0; info->block.levels=0;
hp_clear_keys(info); hp_clear_keys(info);
info->records=info->deleted=info->data_length=0; info->records= info->deleted= 0;
info->data_length= 0;
info->blength=1; info->blength=1;
info->changed=0; info->changed=0;
info->del_link=0; info->del_link=0;

View File

@ -68,7 +68,7 @@ int heap_write(HP_INFO *info, const byte *record)
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
DBUG_PRINT("info",("Duplicate key: %d", keydef - share->keydef)); DBUG_PRINT("info",("Duplicate key: %d", (int) (keydef - share->keydef)));
info->errkey= keydef - share->keydef; info->errkey= keydef - share->keydef;
if (keydef->algorithm == HA_KEY_ALG_BTREE) if (keydef->algorithm == HA_KEY_ALG_BTREE)
{ {

View File

@ -15,14 +15,17 @@
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA # MA 02111-1307, USA
BUILT_SOURCES = mysql_version.h my_config.h BUILT_SOURCES = $(HEADERS_GEN) abi_check
pkginclude_HEADERS = my_dbug.h m_string.h my_sys.h my_list.h my_xml.h \ HEADERS_GEN = mysql_version.h my_config.h
mysql.h mysql_com.h mysql_embed.h \ HEADERS_ABI = mysql.h mysql_com.h mysql_time.h \
my_semaphore.h my_pthread.h my_no_pthread.h raid.h \ my_list.h my_alloc.h typelib.h
errmsg.h my_global.h my_net.h my_alloc.h \ pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \
my_getopt.h sslopt-longopts.h my_dir.h typelib.h \ my_xml.h mysql_embed.h \
my_semaphore.h my_pthread.h my_no_pthread.h raid.h \
errmsg.h my_global.h my_net.h \
my_getopt.h sslopt-longopts.h my_dir.h \
sslopt-vars.h sslopt-case.h sql_common.h keycache.h \ sslopt-vars.h sslopt-case.h sql_common.h keycache.h \
mysql_time.h m_ctype.h $(BUILT_SOURCES) m_ctype.h $(HEADERS_GEN)
noinst_HEADERS = config-win.h config-os2.h config-netware.h \ noinst_HEADERS = config-win.h config-os2.h config-netware.h \
heap.h my_bitmap.h\ heap.h my_bitmap.h\
myisam.h myisampack.h myisammrg.h ft_global.h\ myisam.h myisampack.h myisammrg.h ft_global.h\
@ -59,8 +62,7 @@ dist-hook:
# #
# Create a icheck file and compare it to the reference # Create a icheck file and compare it to the reference
abi_check: mysql.h mysql_version.h mysql_com.h mysql_time.h my_list.h \ abi_check: $(HEADERS_ABI) mysql_version.h mysql_h.ic
my_alloc.h typelib.h mysql_h.ic
@set -ex; \ @set -ex; \
if [ @ICHECK@ != no ] ; then \ if [ @ICHECK@ != no ] ; then \
@ICHECK@ --canonify --skip-from-re /usr/ -o $@.ic mysql.h; \ @ICHECK@ --canonify --skip-from-re /usr/ -o $@.ic mysql.h; \
@ -69,8 +71,5 @@ abi_check: mysql.h mysql_version.h mysql_com.h mysql_time.h my_list.h \
fi; \ fi; \
touch abi_check; touch abi_check;
all: abi_check
# Don't update the files from bitkeeper # Don't update the files from bitkeeper
%::SCCS/s.% %::SCCS/s.%

View File

@ -46,8 +46,8 @@ typedef struct st_heapinfo /* Struct from heap_info */
ulong records; /* Records in database */ ulong records; /* Records in database */
ulong deleted; /* Deleted records in database */ ulong deleted; /* Deleted records in database */
ulong max_records; ulong max_records;
ulong data_length; ulonglong data_length;
ulong index_length; ulonglong index_length;
uint reclength; /* Length of one record */ uint reclength; /* Length of one record */
int errkey; int errkey;
ulonglong auto_increment; ulonglong auto_increment;
@ -135,7 +135,7 @@ typedef struct st_heap_share
HP_BLOCK block; HP_BLOCK block;
HP_KEYDEF *keydef; HP_KEYDEF *keydef;
ulong min_records,max_records; /* Params to open */ ulong min_records,max_records; /* Params to open */
ulong data_length,index_length,max_table_size; ulonglong data_length,index_length,max_table_size;
uint key_stat_version; /* version to indicate insert/delete */ uint key_stat_version; /* version to indicate insert/delete */
uint records; /* records */ uint records; /* records */
uint blength; /* records rounded up to 2^n */ uint blength; /* records rounded up to 2^n */
@ -187,7 +187,7 @@ typedef struct st_heap_create_info
{ {
uint auto_key; /* keynr [1 - maxkey] for auto key */ uint auto_key; /* keynr [1 - maxkey] for auto key */
uint auto_key_type; uint auto_key_type;
ulong max_table_size; ulonglong max_table_size;
ulonglong auto_increment; ulonglong auto_increment;
my_bool with_auto_increment; my_bool with_auto_increment;
} HP_CREATE_INFO; } HP_CREATE_INFO;

View File

@ -1040,8 +1040,8 @@ typedef char bool; /* Ordinary boolean values 0 1 */
#define set_timespec_nsec(ABSTIME,NSEC) \ #define set_timespec_nsec(ABSTIME,NSEC) \
{\ {\
ulonglong now= my_getsystime() + (NSEC/100); \ ulonglong now= my_getsystime() + (NSEC/100); \
(ABSTIME).tv_sec= (now / ULL(10000000)); \ (ABSTIME).tv_sec= (time_t) (now / ULL(10000000)); \
(ABSTIME).tv_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \ (ABSTIME).tv_nsec= (long) (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
} }
#endif /* !set_timespec_nsec */ #endif /* !set_timespec_nsec */
#endif /* HAVE_TIMESPEC_TS_SEC */ #endif /* HAVE_TIMESPEC_TS_SEC */

View File

@ -677,14 +677,13 @@ struct st_my_thread_var
}; };
extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const)); extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const));
extern uint my_thread_end_wait_time;
#define my_thread_var (_my_thread_var()) #define my_thread_var (_my_thread_var())
#define my_errno my_thread_var->thr_errno #define my_errno my_thread_var->thr_errno
/* /*
Keep track of shutdown,signal, and main threads so that my_end() will not Keep track of shutdown,signal, and main threads so that my_end() will not
report errors with them report errors with them
*/ */
extern pthread_t shutdown_th, main_th, signal_th;
/* statistics_xxx functions are for not essential statistic */ /* statistics_xxx functions are for not essential statistic */
#ifndef thread_safe_increment #ifndef thread_safe_increment

View File

@ -59,7 +59,8 @@ typedef struct st_tree_element {
typedef struct st_tree { typedef struct st_tree {
TREE_ELEMENT *root,null_element; TREE_ELEMENT *root,null_element;
TREE_ELEMENT **parents[MAX_TREE_HEIGHT]; TREE_ELEMENT **parents[MAX_TREE_HEIGHT];
uint offset_to_key,elements_in_tree,size_of_element,memory_limit,allocated; uint offset_to_key,elements_in_tree,size_of_element;
ulong memory_limit, allocated;
qsort_cmp2 compare; qsort_cmp2 compare;
void *custom_arg; void *custom_arg;
MEM_ROOT mem_root; MEM_ROOT mem_root;
@ -69,7 +70,7 @@ typedef struct st_tree {
} TREE; } TREE;
/* Functions on whole tree */ /* Functions on whole tree */
void init_tree(TREE *tree, uint default_alloc_size, uint memory_limit, void init_tree(TREE *tree, ulong default_alloc_size, ulong memory_limit,
int size, qsort_cmp2 compare, my_bool with_delete, int size, qsort_cmp2 compare, my_bool with_delete,
tree_element_free free_element, void *custom_arg); tree_element_free free_element, void *custom_arg);
void delete_tree(TREE*); void delete_tree(TREE*);

View File

@ -1718,7 +1718,7 @@ os_file_set_size(
} }
/* Print about progress for each 100 MB written */ /* Print about progress for each 100 MB written */
if ((current_size + n_bytes) / (ib_longlong)(100 * 1024 * 1024) if ((ib_longlong) (current_size + n_bytes) / (ib_longlong)(100 * 1024 * 1024)
!= current_size / (ib_longlong)(100 * 1024 * 1024)) { != current_size / (ib_longlong)(100 * 1024 * 1024)) {
fprintf(stderr, " %lu00", fprintf(stderr, " %lu00",

View File

@ -175,6 +175,9 @@ void STDCALL mysql_server_end()
#ifdef EMBEDDED_LIBRARY #ifdef EMBEDDED_LIBRARY
end_embedded_server(); end_embedded_server();
#endif #endif
finish_client_errs();
vio_end();
/* If library called my_init(), free memory allocated by it */ /* If library called my_init(), free memory allocated by it */
if (!org_my_init_done) if (!org_my_init_done)
{ {
@ -185,10 +188,11 @@ void STDCALL mysql_server_end()
#endif #endif
} }
else else
{
free_charsets();
mysql_thread_end(); mysql_thread_end();
finish_client_errs(); }
free_charsets();
vio_end();
mysql_client_init= org_my_init_done= 0; mysql_client_init= org_my_init_done= 0;
#ifdef EMBEDDED_SERVER #ifdef EMBEDDED_SERVER
if (stderror_file) if (stderror_file)
@ -2478,6 +2482,8 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
NET *net= &mysql->net; NET *net= &mysql->net;
char buff[4 /* size of stmt id */ + char buff[4 /* size of stmt id */ +
5 /* execution flags */]; 5 /* execution flags */];
my_bool res;
DBUG_ENTER("execute"); DBUG_ENTER("execute");
DBUG_DUMP("packet", packet, length); DBUG_DUMP("packet", packet, length);
@ -2485,16 +2491,18 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
int4store(buff, stmt->stmt_id); /* Send stmt id to server */ int4store(buff, stmt->stmt_id); /* Send stmt id to server */
buff[4]= (char) stmt->flags; buff[4]= (char) stmt->flags;
int4store(buff+5, 1); /* iteration count */ int4store(buff+5, 1); /* iteration count */
if (cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff),
packet, length, 1, NULL) || res= test(cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff),
(*mysql->methods->read_query_result)(mysql)) packet, length, 1, NULL) ||
(*mysql->methods->read_query_result)(mysql));
stmt->affected_rows= mysql->affected_rows;
stmt->server_status= mysql->server_status;
stmt->insert_id= mysql->insert_id;
if (res)
{ {
set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate); set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
stmt->affected_rows= mysql->affected_rows;
stmt->server_status= mysql->server_status;
stmt->insert_id= mysql->insert_id;
DBUG_RETURN(0); DBUG_RETURN(0);
} }

View File

@ -278,26 +278,27 @@ static int emb_stmt_execute(MYSQL_STMT *stmt)
{ {
DBUG_ENTER("emb_stmt_execute"); DBUG_ENTER("emb_stmt_execute");
char header[5]; char header[5];
MYSQL_DATA *res;
THD *thd; THD *thd;
my_bool res;
int4store(header, stmt->stmt_id); int4store(header, stmt->stmt_id);
header[4]= stmt->flags; header[4]= stmt->flags;
thd= (THD*)stmt->mysql->thd; thd= (THD*)stmt->mysql->thd;
thd->client_param_count= stmt->param_count; thd->client_param_count= stmt->param_count;
thd->client_params= stmt->params; thd->client_params= stmt->params;
if (emb_advanced_command(stmt->mysql, COM_STMT_EXECUTE,0,0,
header, sizeof(header), 1, stmt) || res= test(emb_advanced_command(stmt->mysql, COM_STMT_EXECUTE, 0, 0,
emb_read_query_result(stmt->mysql)) header, sizeof(header), 1, stmt) ||
emb_read_query_result(stmt->mysql));
stmt->affected_rows= stmt->mysql->affected_rows;
stmt->insert_id= stmt->mysql->insert_id;
stmt->server_status= stmt->mysql->server_status;
if (res)
{ {
NET *net= &stmt->mysql->net; NET *net= &stmt->mysql->net;
set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate); set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
stmt->affected_rows= stmt->mysql->affected_rows;
stmt->insert_id= stmt->mysql->insert_id;
stmt->server_status= stmt->mysql->server_status;
DBUG_RETURN(0); DBUG_RETURN(0);
} }

View File

@ -428,8 +428,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
key_segs) key_segs)
share.state.rec_per_key_part[key_segs-1]=1L; share.state.rec_per_key_part[key_segs-1]=1L;
length+=key_length; length+=key_length;
keydef->block_length= MI_BLOCK_SIZE(length-real_length_diff, keydef->block_length= (uint16) MI_BLOCK_SIZE(length-real_length_diff,
pointer,MI_MAX_KEYPTR_SIZE); pointer,MI_MAX_KEYPTR_SIZE);
if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH || if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH ||
length >= MI_MAX_KEY_BUFF) length >= MI_MAX_KEY_BUFF)
{ {

View File

@ -1105,18 +1105,18 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
my_off_t total_count; my_off_t total_count;
char llbuf[32]; char llbuf[32];
DBUG_PRINT("info", ("column: %3u", count - huff_counts + 1)); DBUG_PRINT("info", ("column: %3u", (uint) (count - huff_counts + 1)));
if (verbose >= 2) if (verbose >= 2)
VOID(printf("column: %3u\n", count - huff_counts + 1)); VOID(printf("column: %3u\n", (uint) (count - huff_counts + 1)));
if (count->tree_buff) if (count->tree_buff)
{ {
DBUG_PRINT("info", ("number of distinct values: %u", DBUG_PRINT("info", ("number of distinct values: %u",
(count->tree_pos - count->tree_buff) / (uint) ((count->tree_pos - count->tree_buff) /
count->field_length)); count->field_length)));
if (verbose >= 2) if (verbose >= 2)
VOID(printf("number of distinct values: %u\n", VOID(printf("number of distinct values: %u\n",
(count->tree_pos - count->tree_buff) / (uint) ((count->tree_pos - count->tree_buff) /
count->field_length)); count->field_length)));
} }
total_count= 0; total_count= 0;
for (idx= 0; idx < 256; idx++) for (idx= 0; idx < 256; idx++)
@ -1965,7 +1965,7 @@ static char *bindigits(ulonglong value, uint bits)
DBUG_ASSERT(idx < sizeof(digits)); DBUG_ASSERT(idx < sizeof(digits));
while (idx) while (idx)
*(ptr++)= '0' + ((value >> (--idx)) & 1); *(ptr++)= '0' + ((char) (value >> (--idx)) & (char) 1);
*ptr= '\0'; *ptr= '\0';
return digits; return digits;
} }
@ -1995,7 +1995,7 @@ static char *hexdigits(ulonglong value)
DBUG_ASSERT(idx < sizeof(digits)); DBUG_ASSERT(idx < sizeof(digits));
while (idx) while (idx)
{ {
if ((*(ptr++)= '0' + ((value >> (4 * (--idx))) & 0xf)) > '9') if ((*(ptr++)= '0' + ((char) (value >> (4 * (--idx))) & (char) 0xf)) > '9')
*(ptr - 1)+= 'a' - '9' - 1; *(ptr - 1)+= 'a' - '9' - 1;
} }
*ptr= '\0'; *ptr= '\0';
@ -2280,11 +2280,11 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
{ {
VOID(fflush(stdout)); VOID(fflush(stdout));
VOID(fprintf(stderr, "error: Huffman code too long: %u/%u\n", VOID(fprintf(stderr, "error: Huffman code too long: %u/%u\n",
bits, 8 * sizeof(code))); bits, (uint) (8 * sizeof(code))));
errors++; errors++;
break; break;
} }
idx+= code & 1; idx+= (uint) code & 1;
if (idx >= length) if (idx >= length)
{ {
VOID(fflush(stdout)); VOID(fflush(stdout));

View File

@ -88,7 +88,7 @@ int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key,
mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table; mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;
mi->once_flags|= RRND_PRESERVE_LASTINX; mi->once_flags|= RRND_PRESERVE_LASTINX;
DBUG_PRINT("info", ("using table no: %d", DBUG_PRINT("info", ("using table no: %d",
info->current_table - info->open_tables + 1)); (int) (info->current_table - info->open_tables + 1)));
DBUG_DUMP("result key", (byte*) mi->lastkey, mi->lastkey_length); DBUG_DUMP("result key", (byte*) mi->lastkey, mi->lastkey_length);
DBUG_RETURN(_myrg_mi_read_record(mi,buf)); DBUG_RETURN(_myrg_mi_read_record(mi,buf));
} }

View File

@ -582,7 +582,7 @@ sub mtr_im_start($$) {
mtr_add_arg($args, $opt); mtr_add_arg($args, $opt);
} }
$im->{'pid'} = $im->{'spawner_pid'} =
mtr_spawn( mtr_spawn(
$::exe_im, # path to the executable $::exe_im, # path to the executable
$args, # cmd-line args $args, # cmd-line args
@ -593,7 +593,7 @@ sub mtr_im_start($$) {
{ append_log_file => 1 } # append log files { append_log_file => 1 } # append log files
); );
unless ( $im->{'pid'} ) unless ( $im->{'spawner_pid'} )
{ {
mtr_error('Could not start Instance Manager.') mtr_error('Could not start Instance Manager.')
} }

View File

@ -41,6 +41,7 @@ sub mtr_get_pid_from_file ($) {
# Read pid number from file # Read pid number from file
my $pid= <FILE>; my $pid= <FILE>;
chomp $pid;
close FILE; close FILE;
return $pid if $pid=~ /^(\d+)/; return $pid if $pid=~ /^(\d+)/;

View File

@ -936,6 +936,12 @@ sub check_expected_crash_and_restart($)
} }
} }
} }
if ($::instance_manager->{'spawner_pid'} eq $ret_pid)
{
return;
}
mtr_warning("check_expected_crash_and_restart couldn't find an entry for pid: $ret_pid"); mtr_warning("check_expected_crash_and_restart couldn't find an entry for pid: $ret_pid");
} }
@ -1052,7 +1058,7 @@ sub sleep_until_file_created ($$$) {
# Print extra message every 60 seconds # Print extra message every 60 seconds
my $seconds= ($loop * $sleeptime) / 1000; my $seconds= ($loop * $sleeptime) / 1000;
if ( $seconds > 1 and int($seconds) % 60 == 0 ) if ( $seconds > 1 and int($seconds * 10) % 600 == 0 )
{ {
my $left= $timeout - $seconds; my $left= $timeout - $seconds;
mtr_warning("Waited $seconds seconds for $pidfile to be created, " . mtr_warning("Waited $seconds seconds for $pidfile to be created, " .

View File

@ -63,7 +63,6 @@ use Getopt::Long;
use Sys::Hostname; use Sys::Hostname;
use IO::Socket; use IO::Socket;
use IO::Socket::INET; use IO::Socket::INET;
use Data::Dumper;
use strict; use strict;
use warnings; use warnings;
@ -1227,6 +1226,12 @@ sub command_line_setup () {
sub set_mtr_build_thread_ports($) { sub set_mtr_build_thread_ports($) {
my $mtr_build_thread= shift; my $mtr_build_thread= shift;
if ( lc($mtr_build_thread) eq 'auto' ) {
print "Requesting build thread... ";
$ENV{'MTR_BUILD_THREAD'} = $mtr_build_thread = mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299);
print "got ".$mtr_build_thread."\n";
}
# Up to two masters, up to three slaves # Up to two masters, up to three slaves
$opt_master_myport= $mtr_build_thread * 10 + 10000; # and 1 $opt_master_myport= $mtr_build_thread * 10 + 10000; # and 1
$opt_slave_myport= $opt_master_myport + 2; # and 3 4 $opt_slave_myport= $opt_master_myport + 2; # and 3 4

View File

@ -46,6 +46,10 @@ create table t1 (a tinyint(1),b binary(1));
insert into t1 values (0x01,0x01); insert into t1 values (0x01,0x01);
select * from t1 where a=b; select * from t1 where a=b;
a b a b
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
select * from t1 where a=b and b=0x01; select * from t1 where a=b and b=0x01;
a b a b
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
drop table if exists t1; drop table if exists t1;

View File

@ -202,6 +202,14 @@ select count(*) from t1 where id not in (1,2);
count(*) count(*)
1 1
drop table t1; drop table t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 SELECT 1 IN (2, NULL);
SELECT should return NULL.
SELECT * FROM t1;
1 IN (2, NULL)
NULL
DROP TABLE t1;
End of 4.1 tests
CREATE TABLE t1 (a int PRIMARY KEY); CREATE TABLE t1 (a int PRIMARY KEY);
INSERT INTO t1 VALUES (44), (45), (46); INSERT INTO t1 VALUES (44), (45), (46);
SELECT * FROM t1 WHERE a IN (45); SELECT * FROM t1 WHERE a IN (45);
@ -343,3 +351,4 @@ some_id
1 1
2 2
drop table t1; drop table t1;
End of 5.0 tests

View File

@ -1903,4 +1903,17 @@ Warnings:
Error 1292 Truncated incorrect DECIMAL value: '' Error 1292 Truncated incorrect DECIMAL value: ''
Error 1292 Truncated incorrect DECIMAL value: '' Error 1292 Truncated incorrect DECIMAL value: ''
Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated
SET @orig_sql_mode = @@SQL_MODE;
SET SQL_MODE=traditional;
SELECT CHAR(0xff,0x8f USING utf8);
CHAR(0xff,0x8f USING utf8)
NULL
Warnings:
Error 1300 Invalid utf8 character string: 'FF8F'
SELECT CHAR(0xff,0x8f USING utf8) IS NULL;
CHAR(0xff,0x8f USING utf8) IS NULL
1
Warnings:
Error 1300 Invalid utf8 character string: 'FF8F'
SET SQL_MODE=@orig_sql_mode;
End of 5.0 tests End of 5.0 tests

View File

@ -2162,3 +2162,127 @@ SELECT MIN(c) FROM t2 WHERE b = 2 and a = 1 and c > 1 GROUP BY a;
MIN(c) MIN(c)
2 2
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE TABLE t1 (a INT, b INT, INDEX (a,b));
INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3), (1,4), (1,5),
(2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6);
EXPLAIN SELECT max(b), a FROM t1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL a 5 NULL 8 Using index for group-by
FLUSH STATUS;
SELECT max(b), a FROM t1 GROUP BY a;
max(b) a
5 1
3 2
1 3
6 4
SHOW STATUS LIKE 'handler_read__e%';
Variable_name Value
Handler_read_key 8
Handler_read_next 0
EXPLAIN SELECT max(b), a FROM t1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL a 5 NULL 8 Using index for group-by
FLUSH STATUS;
CREATE TABLE t2 SELECT max(b), a FROM t1 GROUP BY a;
SHOW STATUS LIKE 'handler_read__e%';
Variable_name Value
Handler_read_key 8
Handler_read_next 0
FLUSH STATUS;
SELECT * FROM (SELECT max(b), a FROM t1 GROUP BY a) b;
max(b) a
5 1
3 2
1 3
6 4
SHOW STATUS LIKE 'handler_read__e%';
Variable_name Value
Handler_read_key 8
Handler_read_next 0
FLUSH STATUS;
(SELECT max(b), a FROM t1 GROUP BY a) UNION
(SELECT max(b), a FROM t1 GROUP BY a);
max(b) a
5 1
3 2
1 3
6 4
SHOW STATUS LIKE 'handler_read__e%';
Variable_name Value
Handler_read_key 16
Handler_read_next 0
EXPLAIN (SELECT max(b), a FROM t1 GROUP BY a) UNION
(SELECT max(b), a FROM t1 GROUP BY a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 range NULL a 5 NULL 8 Using index for group-by
2 UNION t1 range NULL a 5 NULL 8 Using index for group-by
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
EXPLAIN SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
FROM t1 AS t1_outer;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index
2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE EXISTS
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index
2 SUBQUERY t1 index NULL a 10 NULL 8 Using index
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer index NULL a 10 NULL 15 Using where; Using index
2 DEPENDENT SUBQUERY t1 index NULL a 10 NULL 8 Using index
EXPLAIN SELECT 1 FROM t1 AS t1_outer GROUP BY a HAVING
a > (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer range NULL a 5 NULL 8 Using index for group-by
2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
EXPLAIN SELECT 1 FROM t1 AS t1_outer1 JOIN t1 AS t1_outer2
ON t1_outer1.a = (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2)
AND t1_outer1.b = t1_outer2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer1 ref a a 5 const 1 Using where; Using index
1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using where; Using index
2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
EXPLAIN SELECT (SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
FROM t1 AS t1_outer) x2 FROM t1 AS t1_outer2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using index
2 SUBQUERY t1_outer index NULL a 10 NULL 15 Using index
3 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by
CREATE TABLE t3 LIKE t1;
FLUSH STATUS;
INSERT INTO t3 SELECT a,MAX(b) FROM t1 GROUP BY a;
SHOW STATUS LIKE 'handler_read__e%';
Variable_name Value
Handler_read_key 8
Handler_read_next 0
DELETE FROM t3;
FLUSH STATUS;
INSERT INTO t3 SELECT 1, (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2)
FROM t1 LIMIT 1;
SHOW STATUS LIKE 'handler_read__e%';
Variable_name Value
Handler_read_key 8
Handler_read_next 0
FLUSH STATUS;
DELETE FROM t3 WHERE (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) > 10000;
SHOW STATUS LIKE 'handler_read__e%';
Variable_name Value
Handler_read_key 8
Handler_read_next 0
FLUSH STATUS;
DELETE FROM t3 WHERE (SELECT (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) x
FROM t1) > 10000;
Warnings:
Error 1242 Subquery returns more than 1 row
SHOW STATUS LIKE 'handler_read__e%';
Variable_name Value
Handler_read_key 8
Handler_read_next 1
DROP TABLE t1,t2,t3;

View File

@ -6,7 +6,7 @@ instance_name status
mysqld1 online mysqld1 online
mysqld2 offline mysqld2 offline
Killing the process... Killing the process...
Sleeping... Waiting...
Success: the process was restarted. Success: the process was restarted.
Success: server is ready to accept connection on socket. Success: server is ready to accept connection on socket.
@ -16,7 +16,7 @@ Success: server is ready to accept connection on socket.
START INSTANCE mysqld2; START INSTANCE mysqld2;
Success: the process has been started. Success: the process has been started.
Killing the process... Killing the process...
Sleeping... Waiting...
Success: the process was restarted. Success: the process was restarted.
Success: server is ready to accept connection on socket. Success: server is ready to accept connection on socket.
SHOW INSTANCE STATUS mysqld1; SHOW INSTANCE STATUS mysqld1;

View File

@ -39,7 +39,7 @@ ERROR HY000: Bad instance name. Check that the instance with such a name exists
-- 1.1.6. -- 1.1.6.
-------------------------------------------------------------------- --------------------------------------------------------------------
Killing the process... Killing the process...
Sleeping... Waiting...
Success: the process was restarted. Success: the process was restarted.
SHOW INSTANCES; SHOW INSTANCES;
instance_name status instance_name status
@ -52,7 +52,7 @@ mysqld2 offline
START INSTANCE mysqld2; START INSTANCE mysqld2;
Success: the process has been started. Success: the process has been started.
Killing the process... Killing the process...
Sleeping... Waiting...
Success: the process was killed. Success: the process was killed.
-------------------------------------------------------------------- --------------------------------------------------------------------

View File

@ -795,12 +795,12 @@ set @old_max_prepared_stmt_count= @@max_prepared_stmt_count;
show variables like 'max_prepared_stmt_count'; show variables like 'max_prepared_stmt_count';
Variable_name Value Variable_name Value
max_prepared_stmt_count 16382 max_prepared_stmt_count 16382
show variables like 'prepared_stmt_count'; show status like 'prepared_stmt_count';
Variable_name Value Variable_name Value
prepared_stmt_count 0 Prepared_stmt_count 0
select @@max_prepared_stmt_count, @@prepared_stmt_count; select @@max_prepared_stmt_count;
@@max_prepared_stmt_count @@prepared_stmt_count @@max_prepared_stmt_count
16382 0 16382
set global max_prepared_stmt_count=-1; set global max_prepared_stmt_count=-1;
select @@max_prepared_stmt_count; select @@max_prepared_stmt_count;
@@max_prepared_stmt_count @@max_prepared_stmt_count
@ -819,67 +819,70 @@ set max_prepared_stmt_count=1;
ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set local max_prepared_stmt_count=1; set local max_prepared_stmt_count=1;
ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set local prepared_stmt_count=0;
ERROR HY000: Variable 'prepared_stmt_count' is a read only variable
set @@prepared_stmt_count=0;
ERROR HY000: Variable 'prepared_stmt_count' is a read only variable
set global prepared_stmt_count=1;
ERROR HY000: Variable 'prepared_stmt_count' is a read only variable
set global max_prepared_stmt_count=1; set global max_prepared_stmt_count=1;
select @@max_prepared_stmt_count; select @@max_prepared_stmt_count;
@@max_prepared_stmt_count @@max_prepared_stmt_count
1 1
set global max_prepared_stmt_count=0; set global max_prepared_stmt_count=0;
select @@max_prepared_stmt_count, @@prepared_stmt_count; select @@max_prepared_stmt_count;
@@max_prepared_stmt_count @@prepared_stmt_count @@max_prepared_stmt_count
0 0 0
show status like 'prepared_stmt_count';
Variable_name Value
Prepared_stmt_count 0
prepare stmt from "select 1"; prepare stmt from "select 1";
ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 0) ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 0)
select @@prepared_stmt_count; show status like 'prepared_stmt_count';
@@prepared_stmt_count Variable_name Value
0 Prepared_stmt_count 0
set global max_prepared_stmt_count=1; set global max_prepared_stmt_count=1;
prepare stmt from "select 1"; prepare stmt from "select 1";
select @@prepared_stmt_count; show status like 'prepared_stmt_count';
@@prepared_stmt_count Variable_name Value
1 Prepared_stmt_count 1
prepare stmt1 from "select 1"; prepare stmt1 from "select 1";
ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 1) ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 1)
select @@prepared_stmt_count; show status like 'prepared_stmt_count';
@@prepared_stmt_count Variable_name Value
1 Prepared_stmt_count 1
deallocate prepare stmt; deallocate prepare stmt;
select @@prepared_stmt_count; show status like 'prepared_stmt_count';
@@prepared_stmt_count Variable_name Value
0 Prepared_stmt_count 0
prepare stmt from "select 1"; prepare stmt from "select 1";
select @@prepared_stmt_count; show status like 'prepared_stmt_count';
@@prepared_stmt_count Variable_name Value
1 Prepared_stmt_count 1
prepare stmt from "select 2"; prepare stmt from "select 2";
select @@prepared_stmt_count; show status like 'prepared_stmt_count';
@@prepared_stmt_count Variable_name Value
Prepared_stmt_count 1
show status like 'prepared_stmt_count';
Variable_name Value
Prepared_stmt_count 1
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
1 1
select @@prepared_stmt_count, @@max_prepared_stmt_count;
@@prepared_stmt_count @@max_prepared_stmt_count
1 1
set global max_prepared_stmt_count=0; set global max_prepared_stmt_count=0;
prepare stmt from "select 1"; prepare stmt from "select 1";
ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 0) ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 0)
execute stmt; execute stmt;
ERROR HY000: Unknown prepared statement handler (stmt) given to EXECUTE ERROR HY000: Unknown prepared statement handler (stmt) given to EXECUTE
select @@prepared_stmt_count; show status like 'prepared_stmt_count';
@@prepared_stmt_count Variable_name Value
0 Prepared_stmt_count 0
prepare stmt from "select 1"; prepare stmt from "select 1";
ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 0) ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 0)
select @@prepared_stmt_count; show status like 'prepared_stmt_count';
@@prepared_stmt_count Variable_name Value
0 Prepared_stmt_count 0
set global max_prepared_stmt_count=3; set global max_prepared_stmt_count=3;
select @@max_prepared_stmt_count, @@prepared_stmt_count; select @@max_prepared_stmt_count;
@@max_prepared_stmt_count @@prepared_stmt_count @@max_prepared_stmt_count
3 0 3
show status like 'prepared_stmt_count';
Variable_name Value
Prepared_stmt_count 0
prepare stmt from "select 1"; prepare stmt from "select 1";
prepare stmt from "select 2"; prepare stmt from "select 2";
prepare stmt1 from "select 3"; prepare stmt1 from "select 3";
@ -887,13 +890,13 @@ prepare stmt2 from "select 4";
ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 3) ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 3)
prepare stmt2 from "select 4"; prepare stmt2 from "select 4";
ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 3) ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 3)
select @@max_prepared_stmt_count, @@prepared_stmt_count; select @@max_prepared_stmt_count;
@@max_prepared_stmt_count @@prepared_stmt_count @@max_prepared_stmt_count
3 3 3
show status like 'prepared_stmt_count';
Variable_name Value
Prepared_stmt_count 3
deallocate prepare stmt; deallocate prepare stmt;
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count @@prepared_stmt_count
3 0
set global max_prepared_stmt_count= @old_max_prepared_stmt_count; set global max_prepared_stmt_count= @old_max_prepared_stmt_count;
drop table if exists t1; drop table if exists t1;
create temporary table if not exists t1 (a1 int); create temporary table if not exists t1 (a1 int);
@ -1475,6 +1478,24 @@ i
1 1
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;
DROP TABLE t1, t2; DROP TABLE t1, t2;
CREATE TABLE t1 (i INT);
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1), (2);
SELECT t1.i FROM t1 JOIN v1 ON t1.i = v1.i
WHERE EXISTS (SELECT * FROM t1 WHERE v1.i = 1);
i
1
PREPARE stmt FROM "SELECT t1.i FROM t1 JOIN v1 ON t1.i = v1.i
WHERE EXISTS (SELECT * FROM t1 WHERE v1.i = 1)";
EXECUTE stmt;
i
1
EXECUTE stmt;
i
1
DEALLOCATE PREPARE stmt;
DROP VIEW v1;
DROP TABLE t1;
DROP PROCEDURE IF EXISTS p1; DROP PROCEDURE IF EXISTS p1;
flush status; flush status;
prepare sq from 'show status like "slow_queries"'; prepare sq from 'show status like "slow_queries"';

View File

@ -941,3 +941,30 @@ c
---> Cleaning up... ---> Cleaning up...
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
drop table if exists t1;
create table t1(a int, b varchar(50));
drop trigger not_a_trigger;
ERROR HY000: Trigger does not exist
drop trigger if exists not_a_trigger;
Warnings:
Note 1360 Trigger does not exist
create trigger t1_bi before insert on t1
for each row set NEW.b := "In trigger t1_bi";
insert into t1 values (1, "a");
drop trigger if exists t1_bi;
insert into t1 values (2, "b");
drop trigger if exists t1_bi;
Warnings:
Note 1360 Trigger does not exist
insert into t1 values (3, "c");
select * from t1;
a b
1 In trigger t1_bi
2 b
3 c
select * from t1;
a b
1 In trigger t1_bi
2 b
3 c
drop table t1;

View File

@ -296,7 +296,7 @@ SET sql_quote_show_create= @old_sql_quote_show_create;
SET sql_mode= @old_sql_mode; SET sql_mode= @old_sql_mode;
select @@max_heap_table_size; select @@max_heap_table_size;
@@max_heap_table_size @@max_heap_table_size
1047552 1048576
CREATE TABLE t1 ( CREATE TABLE t1 (
a int(11) default NULL, a int(11) default NULL,
KEY a USING BTREE (a) KEY a USING BTREE (a)

View File

@ -1241,4 +1241,41 @@ i j
2 2 2 2
13 13 13 13
drop table t1; drop table t1;
drop table if exists t1;
drop function if exists f1;
create table t1 (i int);
create function f1() returns int return 10;
create trigger t1_bi before insert on t1 for each row set @a:= f1() + 10;
insert into t1 values ();
select @a;
@a
20
insert into t1 values ();
select @a;
@a
20
drop table t1;
drop function f1;
drop table if exists t1;
create table t1(a int, b varchar(50));
drop trigger not_a_trigger;
ERROR HY000: Trigger does not exist
drop trigger if exists not_a_trigger;
Warnings:
Note 1360 Trigger does not exist
create trigger t1_bi before insert on t1
for each row set NEW.b := "In trigger t1_bi";
insert into t1 values (1, "a");
drop trigger if exists t1_bi;
insert into t1 values (2, "b");
drop trigger if exists t1_bi;
Warnings:
Note 1360 Trigger does not exist
insert into t1 values (3, "c");
select * from t1;
a b
1 In trigger t1_bi
2 b
3 c
drop table t1;
End of 5.0 tests End of 5.0 tests

View File

@ -610,4 +610,12 @@ select hex(a), b from t1;
hex(a) b hex(a) b
1 2 1 2
drop table t1; drop table t1;
create table t1(bit_field bit(2), int_field int, key a(bit_field));
insert into t1 values (1,2);
handler t1 open as t1;
handler t1 read a=(1);
bit_field int_field
 2
handler t1 close;
drop table t1;
End of 5.0 tests End of 5.0 tests

View File

@ -453,3 +453,39 @@ id name_id id en cz
2 3 2 en string 2 cz string 2 2 3 2 en string 2 cz string 2
3 3 3 en string 3 cz string 3 3 3 3 en string 3 cz string 3
drop table t1, t2, t3; drop table t1, t2, t3;
CREATE TABLE t1 (a CHAR(2));
INSERT INTO t1 VALUES (10), (50), (30), ('1a'), (60), ('t');
SELECT a,(a + 0) FROM t1 ORDER BY a;
a (a + 0)
10 10
1a 1
30 30
50 50
60 60
t 0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '1a'
Warning 1292 Truncated incorrect DOUBLE value: 't '
SELECT a,(a DIV 2) FROM t1 ORDER BY a;
a (a DIV 2)
10 5
1a 0
30 15
50 25
60 30
t 0
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '1a'
Warning 1292 Truncated incorrect INTEGER value: 't '
SELECT a,CAST(a AS SIGNED) FROM t1 ORDER BY a;
a CAST(a AS SIGNED)
10 10
1a 1
30 30
50 50
60 60
t 0
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '1a'
Warning 1292 Truncated incorrect INTEGER value: 't'
DROP TABLE t1;

View File

@ -712,3 +712,22 @@ DROP FUNCTION f1;
DROP VIEW v2; DROP VIEW v2;
DROP VIEW v1; DROP VIEW v1;
DROP USER mysqltest_u1@localhost; DROP USER mysqltest_u1@localhost;
CREATE DATABASE db17254;
USE db17254;
CREATE TABLE t1 (f1 INT);
INSERT INTO t1 VALUES (10),(20);
CREATE USER def_17254@localhost;
GRANT SELECT ON db17254.* TO def_17254@localhost;
CREATE USER inv_17254@localhost;
GRANT SELECT ON db17254.t1 TO inv_17254@localhost;
GRANT CREATE VIEW ON db17254.* TO def_17254@localhost;
CREATE VIEW v1 AS SELECT * FROM t1;
DROP USER def_17254@localhost;
for a user
SELECT * FROM v1;
ERROR 42000: SELECT command denied to user 'inv_17254'@'localhost' for table 'v1'
for a superuser
SELECT * FROM v1;
ERROR HY000: There is no 'def_17254'@'localhost' registered
DROP USER inv_17254@localhost;
DROP DATABASE db17254;

View File

@ -29,8 +29,10 @@ select grp,group_concat(c order by c) from t1 group by grp;
select grp,group_concat(c order by c desc) from t1 group by grp; select grp,group_concat(c order by c desc) from t1 group by grp;
select grp,group_concat(d order by a) from t1 group by grp; select grp,group_concat(d order by a) from t1 group by grp;
select grp,group_concat(d order by a desc) from t1 group by grp; select grp,group_concat(d order by a desc) from t1 group by grp;
--disable_warnings
select grp,group_concat(a order by a,d+c-ascii(c)-a) from t1 group by grp; select grp,group_concat(a order by a,d+c-ascii(c)-a) from t1 group by grp;
select grp,group_concat(a order by d+c-ascii(c),a) from t1 group by grp; select grp,group_concat(a order by d+c-ascii(c),a) from t1 group by grp;
--enable_warnings
select grp,group_concat(c order by 1) from t1 group by grp; select grp,group_concat(c order by 1) from t1 group by grp;
select grp,group_concat(distinct c order by c) from t1 group by grp; select grp,group_concat(distinct c order by c) from t1 group by grp;
select grp,group_concat(distinct c order by c desc) from t1 group by grp; select grp,group_concat(distinct c order by c desc) from t1 group by grp;

View File

@ -29,7 +29,9 @@ select count(distinct a),count(distinct grp) from t1;
select sum(all a),count(all a),avg(all a),std(all a),variance(all a),bit_or(all a),bit_and(all a),min(all a),max(all a),min(all c),max(all c) from t1; select sum(all a),count(all a),avg(all a),std(all a),variance(all a),bit_or(all a),bit_and(all a),min(all a),max(all a),min(all c),max(all c) from t1;
select grp, sum(a),count(a),avg(a),std(a),variance(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1 group by grp; select grp, sum(a),count(a),avg(a),std(a),variance(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1 group by grp;
--disable_warnings
select grp, sum(a)+count(a)+avg(a)+std(a)+variance(a)+bit_or(a)+bit_and(a)+min(a)+max(a)+min(c)+max(c) as sum from t1 group by grp; select grp, sum(a)+count(a)+avg(a)+std(a)+variance(a)+bit_or(a)+bit_and(a)+min(a)+max(a)+min(c)+max(c) as sum from t1 group by grp;
--enable_warnings
create table t2 (grp int, a bigint unsigned, c char(10)); create table t2 (grp int, a bigint unsigned, c char(10));
insert into t2 select grp,max(a)+max(grp),max(c) from t1 group by grp; insert into t2 select grp,max(a)+max(grp),max(c) from t1 group by grp;

View File

@ -109,7 +109,28 @@ select count(*) from t1 where id not in (1);
select count(*) from t1 where id not in (1,2); select count(*) from t1 where id not in (1,2);
drop table t1; drop table t1;
# End of 4.1 tests
#
# BUG#17047: CHAR() and IN() can return NULL without signaling NULL
# result
#
# The problem was in the IN() function that ignored maybe_null flags
# of all arguments except the first (the one _before_ the IN
# keyword, '1' in the test case below).
#
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 SELECT 1 IN (2, NULL);
--echo SELECT should return NULL.
SELECT * FROM t1;
DROP TABLE t1;
--echo End of 4.1 tests
# #
# Bug #11885: WHERE condition with NOT IN (one element) # Bug #11885: WHERE condition with NOT IN (one element)
@ -232,3 +253,6 @@ select some_id from t1 where some_id not in(2,-1);
select some_id from t1 where some_id not in(-4,-1,-4); select some_id from t1 where some_id not in(-4,-1,-4);
select some_id from t1 where some_id not in(-4,-1,3423534,2342342); select some_id from t1 where some_id not in(-4,-1,3423534,2342342);
drop table t1; drop table t1;
--echo End of 5.0 tests

View File

@ -788,6 +788,7 @@ SELECT * FROM t1 INNER JOIN t2 ON code=id
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
# Bug #10963 # Bug #10963
# 4294967296 18446744073709551616 # 4294967296 18446744073709551616
@ -977,4 +978,18 @@ select lpad('hello', 18446744073709551616, '1');
select lpad('hello', -18446744073709551617, '1'); select lpad('hello', -18446744073709551617, '1');
select lpad('hello', 18446744073709551617, '1'); select lpad('hello', 18446744073709551617, '1');
#
# BUG#17047: CHAR() and IN() can return NULL without signaling NULL
# result
#
SET @orig_sql_mode = @@SQL_MODE;
SET SQL_MODE=traditional;
SELECT CHAR(0xff,0x8f USING utf8);
SELECT CHAR(0xff,0x8f USING utf8) IS NULL;
SET SQL_MODE=@orig_sql_mode;
--echo End of 5.0 tests --echo End of 5.0 tests

View File

@ -810,3 +810,63 @@ explain SELECT MIN(c) FROM t2 WHERE b = 2 and a = 1 and c > 1 GROUP BY a;
SELECT MIN(c) FROM t2 WHERE b = 2 and a = 1 and c > 1 GROUP BY a; SELECT MIN(c) FROM t2 WHERE b = 2 and a = 1 and c > 1 GROUP BY a;
DROP TABLE t1,t2; DROP TABLE t1,t2;
#
# Bug#24156: Loose index scan not used with CREATE TABLE ...SELECT and similar statements
#
CREATE TABLE t1 (a INT, b INT, INDEX (a,b));
INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3), (1,4), (1,5),
(2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6);
EXPLAIN SELECT max(b), a FROM t1 GROUP BY a;
FLUSH STATUS;
SELECT max(b), a FROM t1 GROUP BY a;
SHOW STATUS LIKE 'handler_read__e%';
EXPLAIN SELECT max(b), a FROM t1 GROUP BY a;
FLUSH STATUS;
CREATE TABLE t2 SELECT max(b), a FROM t1 GROUP BY a;
SHOW STATUS LIKE 'handler_read__e%';
FLUSH STATUS;
SELECT * FROM (SELECT max(b), a FROM t1 GROUP BY a) b;
SHOW STATUS LIKE 'handler_read__e%';
FLUSH STATUS;
(SELECT max(b), a FROM t1 GROUP BY a) UNION
(SELECT max(b), a FROM t1 GROUP BY a);
SHOW STATUS LIKE 'handler_read__e%';
EXPLAIN (SELECT max(b), a FROM t1 GROUP BY a) UNION
(SELECT max(b), a FROM t1 GROUP BY a);
EXPLAIN SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
FROM t1 AS t1_outer;
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE EXISTS
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
EXPLAIN SELECT 1 FROM t1 AS t1_outer GROUP BY a HAVING
a > (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
EXPLAIN SELECT 1 FROM t1 AS t1_outer1 JOIN t1 AS t1_outer2
ON t1_outer1.a = (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2)
AND t1_outer1.b = t1_outer2.b;
EXPLAIN SELECT (SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
FROM t1 AS t1_outer) x2 FROM t1 AS t1_outer2;
CREATE TABLE t3 LIKE t1;
FLUSH STATUS;
INSERT INTO t3 SELECT a,MAX(b) FROM t1 GROUP BY a;
SHOW STATUS LIKE 'handler_read__e%';
DELETE FROM t3;
FLUSH STATUS;
INSERT INTO t3 SELECT 1, (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2)
FROM t1 LIMIT 1;
SHOW STATUS LIKE 'handler_read__e%';
FLUSH STATUS;
DELETE FROM t3 WHERE (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) > 10000;
SHOW STATUS LIKE 'handler_read__e%';
FLUSH STATUS;
DELETE FROM t3 WHERE (SELECT (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) x
FROM t1) > 10000;
SHOW STATUS LIKE 'handler_read__e%';
DROP TABLE t1,t2,t3;

View File

@ -6,59 +6,73 @@
# #
########################################################################### ###########################################################################
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle im_daemon_life_cycle.imtest started.
###########################################################################
--source include/im_check_env.inc --source include/im_check_env.inc
# Turn on reconnect, not on by default anymore # Turn on reconnect, not on by default anymore.
--enable_reconnect --enable_reconnect
########################################################################### ###########################################################################
#
# Kill the IM main process and check that the IM Angel will restart the main # The main daemon-life-cycle test case -- check that IM-angel will restart
# process. # IM-main if it got killed:
# - kill IM-main and check that IM-angel will restart it;
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted 30 # - wait for IM-main to start accepting connections before continue test
# case;
#
########################################################################### ###########################################################################
# Wait for IM to start accepting connections. --exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Main-test: starting...
--exec $MYSQL_TEST_DIR/t/wait_for_socket.sh $EXE_MYSQL $IM_PATH_SOCK $IM_USERNAME $IM_PASSWORD '' 30 --exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Killing IM-main...
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted 30 im_daemon_life_cycle
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Waiting for IM-main to start accepting connections...
--exec $MYSQL_TEST_DIR/t/wait_for_socket.sh $EXE_MYSQL $IM_PATH_SOCK $IM_USERNAME $IM_PASSWORD '' 30 im_daemon_life_cycle
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Main-test: done.
########################################################################### ###########################################################################
# #
# BUG#12751: Instance Manager: client hangs # BUG#12751: Instance Manager: client hangs
# - start nonguarded instance (mysqld2);
# - kill IM-main and get it restarted by IM-angel;
# - check that guarded instance (mysqld1) is accepting connections.
# - check that non-guarded instance (mysqld2) were not stopped.
# #
###########################################################################
--echo --echo
--echo -------------------------------------------------------------------- --echo --------------------------------------------------------------------
--echo -- Test for BUG#12751 --echo -- Test for BUG#12751
--echo -------------------------------------------------------------------- --echo --------------------------------------------------------------------
# Give some time to begin accepting connections after restart. --exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle BUG12751: starting...
# FIXME: race condition here.
--sleep 3
# 1. Start mysqld; # 1. Start mysqld;
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle mysqld2: starting...
START INSTANCE mysqld2; START INSTANCE mysqld2;
# FIXME: START INSTANCE should be synchronous.
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started
# 2. Restart IM-main: kill it and IM-angel will restart it; wait for IM to --exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle mysqld2: waiting to start...
# start accepting connections again. --exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started im_daemon_life_cycle
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted 30 --exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle mysqld2: started.
--exec $MYSQL_TEST_DIR/t/wait_for_socket.sh $EXE_MYSQL $IM_PATH_SOCK $IM_USERNAME $IM_PASSWORD '' 30 # 2. Restart IM-main;
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Killing IM-main...
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted 30 im_daemon_life_cycle
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Waiting for IM-main to start accepting connections...
--exec $MYSQL_TEST_DIR/t/wait_for_socket.sh $EXE_MYSQL $IM_PATH_SOCK $IM_USERNAME $IM_PASSWORD '' 30 im_daemon_life_cycle
# 3. Issue some statement -- connection should be re-established. # 3. Issue some statement -- connection should be re-established.
# Give some time to begin accepting connections after restart. --exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Checking that IM-main processing commands...
# FIXME: race condition here.
--sleep 3
--replace_column 3 VERSION --replace_column 3 VERSION
SHOW INSTANCE STATUS mysqld1; SHOW INSTANCE STATUS mysqld1;
@ -67,6 +81,13 @@ SHOW INSTANCE STATUS mysqld1;
# So, if it we do not stop it, it will be stopped by mysql-test-run.pl with # So, if it we do not stop it, it will be stopped by mysql-test-run.pl with
# warning. # warning.
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle mysqld2: stopping...
STOP INSTANCE mysqld2; STOP INSTANCE mysqld2;
# FIXME: STOP INSTANCE should be synchronous.
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped --exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle mysqld2: waiting to stop...
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped im_daemon_life_cycle
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle mysqld2: stopped.
###########################################################################
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle BUG12751: done.

View File

@ -25,7 +25,7 @@
START INSTANCE mysqld2; START INSTANCE mysqld2;
# FIXME: START INSTANCE should be synchronous. # FIXME: START INSTANCE should be synchronous.
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started --exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started im_life_cycle
# FIXME: Result of SHOW INSTANCES here is not deterministic unless START # FIXME: Result of SHOW INSTANCES here is not deterministic unless START
# INSTANCE is synchronous. Even waiting for mysqld to start by looking at # INSTANCE is synchronous. Even waiting for mysqld to start by looking at
@ -58,7 +58,7 @@ SHOW VARIABLES LIKE 'port';
STOP INSTANCE mysqld2; STOP INSTANCE mysqld2;
# FIXME: STOP INSTANCE should be synchronous. # FIXME: STOP INSTANCE should be synchronous.
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped --exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped im_life_cycle
# FIXME: Result of SHOW INSTANCES here is not deterministic unless START # FIXME: Result of SHOW INSTANCES here is not deterministic unless START
# INSTANCE is synchronous. Even waiting for mysqld to start by looking at # INSTANCE is synchronous. Even waiting for mysqld to start by looking at
@ -121,7 +121,7 @@ STOP INSTANCE mysqld3;
--echo -- 1.1.6. --echo -- 1.1.6.
--echo -------------------------------------------------------------------- --echo --------------------------------------------------------------------
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted 30 --exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted 30 im_life_cycle
# Give some time to IM to detect that mysqld was restarted. It should be # Give some time to IM to detect that mysqld was restarted. It should be
# longer than monitoring interval. # longer than monitoring interval.
@ -143,7 +143,7 @@ SHOW INSTANCES;
START INSTANCE mysqld2; START INSTANCE mysqld2;
# FIXME: START INSTANCE should be synchronous. # FIXME: START INSTANCE should be synchronous.
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started --exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started im_life_cycle
# FIXME: Result of SHOW INSTANCES here is not deterministic unless START # FIXME: Result of SHOW INSTANCES here is not deterministic unless START
# INSTANCE is synchronous. Even waiting for mysqld to start by looking at # INSTANCE is synchronous. Even waiting for mysqld to start by looking at
@ -151,7 +151,7 @@ START INSTANCE mysqld2;
# mysqld has started. # mysqld has started.
# SHOW INSTANCES; # SHOW INSTANCES;
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed 10 --exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed 10 im_life_cycle
# FIXME: Result of SHOW INSTANCES here is not deterministic unless START # FIXME: Result of SHOW INSTANCES here is not deterministic unless START
# INSTANCE is synchronous. Even waiting for mysqld to start by looking at # INSTANCE is synchronous. Even waiting for mysqld to start by looking at

View File

@ -31,10 +31,10 @@ SHOW INSTANCE OPTIONS mysqld2;
# #
START INSTANCE mysqld2; START INSTANCE mysqld2;
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started --exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started im_utils
STOP INSTANCE mysqld2; STOP INSTANCE mysqld2;
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped --exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped im_utils
# #
# Check 'SHOW LOG FILES' command: # Check 'SHOW LOG FILES' command:

View File

@ -2,74 +2,101 @@
########################################################################### ###########################################################################
# NOTE: this script returns 0 (success) even in case of failure. This is # NOTE: this script returns 0 (success) even in case of failure (except for
# because this script is executed under mysql-test-run[.pl] and it's better to # usage-error). This is because this script is executed under
# examine particular problem in log file, than just having said that the test # mysql-test-run[.pl] and it's better to examine particular problem in log
# case has failed. # file, than just having said that the test case has failed.
###########################################################################
basename=`basename "$0"`
dirname=`dirname "$0"`
###########################################################################
. "$dirname/utils.sh"
########################################################################### ###########################################################################
check_restart() check_restart()
{ {
if [ ! -r "$pid_path" ]; then if [ ! -r "$pid_path" ]; then
log_debug "No '$pid_path' found."
user_msg='the process was killed' user_msg='the process was killed'
return 1 return 1
fi fi
new_pid=`cat "$pid_path" 2>/dev/null` new_pid=`cat "$pid_path" 2>/dev/null`
err_code=$?
if [ $? -eq 0 -a "$original_pid" = "$new_pid" ]; then log_debug "err_code: $err_code; original_pid: $original_pid; new_pid: $new_pid."
if [ $err_code -eq 0 -a "$original_pid" = "$new_pid" ]; then
log_debug "The process was not restarted."
user_msg='the process was not restarted' user_msg='the process was not restarted'
return 1 return 1
fi fi
log_debug "The process was restarted."
user_msg='the process was restarted' user_msg='the process was restarted'
return 0 return 0
} }
########################################################################### ###########################################################################
if [ $# -ne 3 ]; then if [ $# -ne 4 ]; then
echo "Usage: kill_n_check.sh <pid file path> killed|restarted <timeout>" echo "Usage: $basename <pid file path> killed|restarted <timeout> <test id>"
exit 0 exit 1
fi fi
pid_path="$1" pid_path="$1"
expected_result="$2" expected_result="$2"
total_timeout="$3" total_timeout="$3"
test_id="$4"
log_file="$MYSQLTEST_VARDIR/log/$test_id.log"
log_debug "-- $basename: starting --"
log_debug "pid_path: '$pid_path'"
log_debug "expected_result: '$expected_result'"
log_debug "total_timeout: '$total_timeout'"
log_debug "test_id: '$test_id'"
log_debug "log_file: '$log_file'"
###########################################################################
if [ "$expected_result" != 'killed' -a \ if [ "$expected_result" != 'killed' -a \
"$expected_result" != 'restarted' ]; then "$expected_result" != 'restarted' ]; then
echo "Error: invalid second argument ('killed' or 'restarted' expected)." log_error "Invalid second argument ($expected_result): 'killed' or 'restarted' expected."
exit 0 quit 0
fi fi
if [ -z "$pid_path" ]; then if [ -z "$pid_path" ]; then
echo "Error: invalid PID path ($pid_path)." log_error "Invalid PID path ($pid_path)."
exit 0 quit 0
fi fi
if [ ! -r "$pid_path" ]; then if [ ! -r "$pid_path" ]; then
echo "Error: PID file ($pid_path) does not exist." log_error "PID file ($pid_path) does not exist."
exit 0 quit 0
fi fi
if [ -z "$total_timeout" ]; then if [ -z "$total_timeout" ]; then
echo "Error: timeout is not specified." log_error "Timeout is not specified."
exit 0 quit 0
fi fi
########################################################################### ###########################################################################
original_pid=`cat "$pid_path"` original_pid=`cat "$pid_path"`
log_debug "original_pid: $original_pid."
echo "Killing the process..." log_info "Killing the process..."
kill -9 $original_pid kill -9 $original_pid
########################################################################### ###########################################################################
echo "Sleeping..." log_info "Waiting..."
if [ "$expected_result" = "restarted" ]; then if [ "$expected_result" = "restarted" ]; then
@ -79,37 +106,42 @@ if [ "$expected_result" = "restarted" ]; then
while true; do while true; do
log_debug "cur_attempt: $cur_attempt."
if check_restart; then if check_restart; then
echo "Success: $user_msg." log_info "Success: $user_msg."
exit 0 quit 0
fi fi
[ $cur_attempt -ge $total_timeout ] && break [ $cur_attempt -ge $total_timeout ] && break
log_debug "Sleeping for 1 second..."
sleep 1 sleep 1
cur_attempt=`expr $cur_attempt + 1` cur_attempt=`expr $cur_attempt + 1`
done done
echo "Error: $user_msg." log_error "$user_msg."
exit 0 quit 0
else # $expected_result == killed else # $expected_result == killed
# Here we have to sleep for some long time to ensure that the process will # Here we have to sleep for some long time to ensure that the process will
# not be restarted. # not be restarted.
log_debug "Sleeping for $total_timeout seconds..."
sleep $total_timeout sleep $total_timeout
new_pid=`cat "$pid_path" 2>/dev/null` new_pid=`cat "$pid_path" 2>/dev/null`
log_debug "new_pid: $new_pid."
if [ "$new_pid" -a "$new_pid" -ne "$original_pid" ]; then if [ "$new_pid" -a "$new_pid" -ne "$original_pid" ]; then
echo "Error: the process was restarted." log_error "The process was restarted."
else else
echo "Success: the process was killed." log_info "Success: the process was killed."
fi fi
exit 0 quit 0
fi fi

24
mysql-test/t/log.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
###########################################################################
basename=`basename "$0"`
dirname=`dirname "$0"`
###########################################################################
. "$dirname/utils.sh"
###########################################################################
if [ $# -lt 2 ]; then
echo "Usage: $basename <test id> log message ..."
exit 1
fi
test_id="$1"
log_file="$MYSQLTEST_VARDIR/log/$test_id.log"
shift
log_debug "$*"

View File

@ -848,6 +848,9 @@ drop table t1;
# Bug#16365 Prepared Statements: DoS with too many open statements # Bug#16365 Prepared Statements: DoS with too many open statements
# Check that the limit @@max_prpeared_stmt_count works. # Check that the limit @@max_prpeared_stmt_count works.
# #
# This is also the test for bug#23159 prepared_stmt_count should be
# status variable.
#
# Save the old value # Save the old value
set @old_max_prepared_stmt_count= @@max_prepared_stmt_count; set @old_max_prepared_stmt_count= @@max_prepared_stmt_count;
# #
@ -857,17 +860,17 @@ set @old_max_prepared_stmt_count= @@max_prepared_stmt_count;
# #
--disable_ps_protocol --disable_ps_protocol
# #
# A. Check that the new variables are present in SHOW VARIABLES list. # A. Check that the new variables are present in SHOW VARIABLES and
# SHOW STATUS lists.
# #
show variables like 'max_prepared_stmt_count'; show variables like 'max_prepared_stmt_count';
show variables like 'prepared_stmt_count'; show status like 'prepared_stmt_count';
# #
# B. Check that the new variables are selectable. # B. Check that the new system variable is selectable.
# #
select @@max_prepared_stmt_count, @@prepared_stmt_count; select @@max_prepared_stmt_count;
# #
# C. Check that max_prepared_stmt_count is settable (global only), # C. Check that max_prepared_stmt_count is settable (global only).
# whereas prepared_stmt_count is readonly.
# #
set global max_prepared_stmt_count=-1; set global max_prepared_stmt_count=-1;
select @@max_prepared_stmt_count; select @@max_prepared_stmt_count;
@ -881,12 +884,6 @@ set @@max_prepared_stmt_count=1;
set max_prepared_stmt_count=1; set max_prepared_stmt_count=1;
--error ER_GLOBAL_VARIABLE --error ER_GLOBAL_VARIABLE
set local max_prepared_stmt_count=1; set local max_prepared_stmt_count=1;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set local prepared_stmt_count=0;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set @@prepared_stmt_count=0;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set global prepared_stmt_count=1;
# set to a reasonable limit works # set to a reasonable limit works
set global max_prepared_stmt_count=1; set global max_prepared_stmt_count=1;
select @@max_prepared_stmt_count; select @@max_prepared_stmt_count;
@ -894,47 +891,50 @@ select @@max_prepared_stmt_count;
# D. Check that the variables actually work. # D. Check that the variables actually work.
# #
set global max_prepared_stmt_count=0; set global max_prepared_stmt_count=0;
select @@max_prepared_stmt_count, @@prepared_stmt_count; select @@max_prepared_stmt_count;
show status like 'prepared_stmt_count';
--error ER_MAX_PREPARED_STMT_COUNT_REACHED --error ER_MAX_PREPARED_STMT_COUNT_REACHED
prepare stmt from "select 1"; prepare stmt from "select 1";
select @@prepared_stmt_count; show status like 'prepared_stmt_count';
set global max_prepared_stmt_count=1; set global max_prepared_stmt_count=1;
prepare stmt from "select 1"; prepare stmt from "select 1";
select @@prepared_stmt_count; show status like 'prepared_stmt_count';
--error ER_MAX_PREPARED_STMT_COUNT_REACHED --error ER_MAX_PREPARED_STMT_COUNT_REACHED
prepare stmt1 from "select 1"; prepare stmt1 from "select 1";
select @@prepared_stmt_count; show status like 'prepared_stmt_count';
deallocate prepare stmt; deallocate prepare stmt;
select @@prepared_stmt_count; show status like 'prepared_stmt_count';
# #
# E. Check that we can prepare a statement with the same name # E. Check that we can prepare a statement with the same name
# successfully, without hitting the limit. # successfully, without hitting the limit.
# #
prepare stmt from "select 1"; prepare stmt from "select 1";
select @@prepared_stmt_count; show status like 'prepared_stmt_count';
prepare stmt from "select 2"; prepare stmt from "select 2";
select @@prepared_stmt_count; show status like 'prepared_stmt_count';
# #
# F. We can set the max below the current count. In this case no new # F. We can set the max below the current count. In this case no new
# statements should be allowed to prepare. # statements should be allowed to prepare.
# #
select @@prepared_stmt_count, @@max_prepared_stmt_count; show status like 'prepared_stmt_count';
select @@max_prepared_stmt_count;
set global max_prepared_stmt_count=0; set global max_prepared_stmt_count=0;
--error ER_MAX_PREPARED_STMT_COUNT_REACHED --error ER_MAX_PREPARED_STMT_COUNT_REACHED
prepare stmt from "select 1"; prepare stmt from "select 1";
# Result: the old statement is deallocated, the new is not created. # Result: the old statement is deallocated, the new is not created.
--error 1243 # ER_UNKNOWN_STMT_HANDLER --error ER_UNKNOWN_STMT_HANDLER
execute stmt; execute stmt;
select @@prepared_stmt_count; show status like 'prepared_stmt_count';
--error ER_MAX_PREPARED_STMT_COUNT_REACHED --error ER_MAX_PREPARED_STMT_COUNT_REACHED
prepare stmt from "select 1"; prepare stmt from "select 1";
select @@prepared_stmt_count; show status like 'prepared_stmt_count';
# #
# G. Show that the variables are up to date even after a connection with all # G. Show that the variables are up to date even after a connection with all
# statements in it was terminated. # statements in it was terminated.
# #
set global max_prepared_stmt_count=3; set global max_prepared_stmt_count=3;
select @@max_prepared_stmt_count, @@prepared_stmt_count; select @@max_prepared_stmt_count;
show status like 'prepared_stmt_count';
prepare stmt from "select 1"; prepare stmt from "select 1";
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
connection con1; connection con1;
@ -943,26 +943,20 @@ prepare stmt1 from "select 3";
--error ER_MAX_PREPARED_STMT_COUNT_REACHED --error ER_MAX_PREPARED_STMT_COUNT_REACHED
prepare stmt2 from "select 4"; prepare stmt2 from "select 4";
connection default; connection default;
--error ER_MAX_PREPARED_STMT_COUNT_REACHED --error ER_MAX_PREPARED_STMT_COUNT_REACHED
prepare stmt2 from "select 4"; prepare stmt2 from "select 4";
select @@max_prepared_stmt_count, @@prepared_stmt_count; select @@max_prepared_stmt_count;
show status like 'prepared_stmt_count';
disconnect con1; disconnect con1;
connection default; connection default;
# Wait for the connection to die: deal with a possible race
deallocate prepare stmt; deallocate prepare stmt;
let $count= `select @@prepared_stmt_count`;
if ($count)
{
--sleep 2
let $count= `select @@prepared_stmt_count`;
}
select @@max_prepared_stmt_count, @@prepared_stmt_count;
# #
# Restore the old value. # Restore the old value.
# #
set global max_prepared_stmt_count= @old_max_prepared_stmt_count; set global max_prepared_stmt_count= @old_max_prepared_stmt_count;
--enable_ps_protocol --enable_ps_protocol
# #
# Bug#19399 "Stored Procedures 'Lost Connection' when dropping/creating # Bug#19399 "Stored Procedures 'Lost Connection' when dropping/creating
# tables" # tables"
@ -1513,6 +1507,29 @@ DEALLOCATE PREPARE stmt;
DROP TABLE t1, t2; DROP TABLE t1, t2;
#
# BUG#20327: Marking of a wrong field leads to a wrong result on select with
# view, prepared statement and subquery.
#
CREATE TABLE t1 (i INT);
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1), (2);
let $query = SELECT t1.i FROM t1 JOIN v1 ON t1.i = v1.i
WHERE EXISTS (SELECT * FROM t1 WHERE v1.i = 1);
eval $query;
eval PREPARE stmt FROM "$query";
# Statement execution should return '1'.
EXECUTE stmt;
# Check re-execution.
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP VIEW v1;
DROP TABLE t1;
# #
# BUG#21856: Prepared Statments: crash if bad create # BUG#21856: Prepared Statments: crash if bad create
# #

View File

@ -423,6 +423,43 @@ DROP TABLE t2;
--sync_with_master --sync_with_master
--connection master --connection master
#
# BUG#23703: DROP TRIGGER needs an IF EXISTS
#
connection master;
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1(a int, b varchar(50));
-- error ER_TRG_DOES_NOT_EXIST
drop trigger not_a_trigger;
drop trigger if exists not_a_trigger;
create trigger t1_bi before insert on t1
for each row set NEW.b := "In trigger t1_bi";
insert into t1 values (1, "a");
drop trigger if exists t1_bi;
insert into t1 values (2, "b");
drop trigger if exists t1_bi;
insert into t1 values (3, "c");
select * from t1;
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
connection master;
drop table t1;
# #
# End of tests # End of tests

View File

@ -1499,4 +1499,52 @@ select * from t1;
drop table t1; drop table t1;
#
# Bug #23651 "Server crashes when trigger which uses stored function
# invoked from different connections".
#
--disable_warnings
drop table if exists t1;
drop function if exists f1;
--enable_warnings
create table t1 (i int);
create function f1() returns int return 10;
create trigger t1_bi before insert on t1 for each row set @a:= f1() + 10;
insert into t1 values ();
select @a;
connection addconroot1;
insert into t1 values ();
select @a;
connection default;
drop table t1;
drop function f1;
#
# Bug#23703: DROP TRIGGER needs an IF EXISTS
#
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1(a int, b varchar(50));
-- error ER_TRG_DOES_NOT_EXIST
drop trigger not_a_trigger;
drop trigger if exists not_a_trigger;
create trigger t1_bi before insert on t1
for each row set NEW.b := "In trigger t1_bi";
insert into t1 values (1, "a");
drop trigger if exists t1_bi;
insert into t1 values (2, "b");
drop trigger if exists t1_bi;
insert into t1 values (3, "c");
select * from t1;
drop table t1;
--echo End of 5.0 tests --echo End of 5.0 tests

View File

@ -261,4 +261,15 @@ insert into t1 (b, a) values ('2', '1');
select hex(a), b from t1; select hex(a), b from t1;
drop table t1; drop table t1;
#
# type was not properly initalized, which caused key_copy to fail
#
create table t1(bit_field bit(2), int_field int, key a(bit_field));
insert into t1 values (1,2);
handler t1 open as t1;
handler t1 read a=(1);
handler t1 close;
drop table t1;
--echo End of 5.0 tests --echo End of 5.0 tests

View File

@ -187,3 +187,13 @@ left join t3 on t1.id=t3.id order by t3.id;
--disable_metadata --disable_metadata
--enable_ps_protocol --enable_ps_protocol
drop table t1, t2, t3; drop table t1, t2, t3;
#
# Bug #11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
#
CREATE TABLE t1 (a CHAR(2));
INSERT INTO t1 VALUES (10), (50), (30), ('1a'), (60), ('t');
SELECT a,(a + 0) FROM t1 ORDER BY a;
SELECT a,(a DIV 2) FROM t1 ORDER BY a;
SELECT a,CAST(a AS SIGNED) FROM t1 ORDER BY a;
DROP TABLE t1;

55
mysql-test/t/utils.sh Normal file
View File

@ -0,0 +1,55 @@
###########################################################################
#
# This file provides utility functions and is included by other scripts.
#
# The following global variables must be set before calling functions from this
# file:
# - basename -- base name of the calling script (main application);
# - log_file -- where to store log records;
#
###########################################################################
log()
{
[ -z "$log_file" ] && return;
log_level="$1"
log_msg="$2"
ts=`date`
echo "[$ts] [$basename] [$log_level] $log_msg" >> "$log_file";
}
###########################################################################
log_debug()
{
log 'DEBUG' "$1"
}
###########################################################################
log_info()
{
log 'INFO' "$1"
echo "$1"
}
###########################################################################
log_error()
{
log 'ERROR' "$1"
echo "Error: $1"
}
###########################################################################
quit()
{
exit_status="$1"
log_debug "-- $basename: finished (exit_status: $exit_status) --"
exit $exit_status
}

View File

@ -927,4 +927,41 @@ DROP VIEW v2;
DROP VIEW v1; DROP VIEW v1;
DROP USER mysqltest_u1@localhost; DROP USER mysqltest_u1@localhost;
#
# Bug#17254: Error for DEFINER security on VIEW provides too much info
#
connect (root,localhost,root,,);
connection root;
CREATE DATABASE db17254;
USE db17254;
CREATE TABLE t1 (f1 INT);
INSERT INTO t1 VALUES (10),(20);
CREATE USER def_17254@localhost;
GRANT SELECT ON db17254.* TO def_17254@localhost;
CREATE USER inv_17254@localhost;
GRANT SELECT ON db17254.t1 TO inv_17254@localhost;
GRANT CREATE VIEW ON db17254.* TO def_17254@localhost;
connect (def,localhost,def_17254,,db17254);
connection def;
CREATE VIEW v1 AS SELECT * FROM t1;
connection root;
DROP USER def_17254@localhost;
connect (inv,localhost,inv_17254,,db17254);
connection inv;
--echo for a user
--error 1142
SELECT * FROM v1;
connection root;
--echo for a superuser
--error 1449
SELECT * FROM v1;
DROP USER inv_17254@localhost;
DROP DATABASE db17254;
disconnect def;
disconnect inv;
# End of 5.0 tests. # End of 5.0 tests.

View File

@ -2,11 +2,79 @@
########################################################################### ###########################################################################
# NOTE: this script returns 0 (success) even in case of failure (except for
# usage-error). This is because this script is executed under
# mysql-test-run[.pl] and it's better to examine particular problem in log
# file, than just having said that the test case has failed.
###########################################################################
basename=`basename "$0"`
dirname=`dirname "$0"`
###########################################################################
. "$dirname/utils.sh"
###########################################################################
check_started()
{
if [ ! -r "$pid_path" ]; then
log_debug "No PID-file ($pid_path) found -- not started."
return 1
fi
new_pid=`cat "$pid_path" 2>/dev/null`
err_code=$?
log_debug "err_code: $err_code; new_pid: $new_pid."
if [ $? -ne 0 -o -z "$new_pid" ]; then
log_debug "The process was not started."
return 1
fi
log_debug "The process was started."
return 0
}
###########################################################################
check_stopped()
{
if [ -r "$pid_path" ]; then
log_debug "PID-file '$pid_path' exists -- not stopped."
return 1
fi
log_debug "No PID-file ($pid_path) found -- stopped."
return 0
}
###########################################################################
if [ $# -ne 4 ]; then
echo "Usage: $basename <pid file path> <total attempts> started|stopped <test id>"
exit 1
fi
pid_path="$1" pid_path="$1"
total_attempts="$2" total_attempts="$2"
event="$3" event="$3"
test_id="$4"
log_file="$MYSQLTEST_VARDIR/log/$test_id.log"
case "$3" in log_debug "-- $basename: starting --"
log_debug "pid_path: '$pid_path'"
log_debug "total_attempts: '$total_attempts'"
log_debug "event: '$event'"
log_debug "test_id: '$test_id'"
log_debug "log_file: '$log_file'"
###########################################################################
case "$event" in
started) started)
check_fn='check_started'; check_fn='check_started';
;; ;;
@ -16,51 +84,31 @@ case "$3" in
;; ;;
*) *)
echo "Error: invalid third argument ('started' or 'stopped' expected)." log_error "Invalid third argument ('started' or 'stopped' expected)."
exit 0 quit 0
esac esac
########################################################################### ###########################################################################
check_started()
{
[ ! -r "$pid_path" ] && return 1
new_pid=`cat "$pid_path" 2>/dev/null`
[ $? -eq 0 -a "$original_pid" = "$new_pid" ] && return 1
return 0
}
###########################################################################
check_stopped()
{
[ -r "$pid_path" ] && return 1
return 0
}
###########################################################################
cur_attempt=1 cur_attempt=1
while true; do while true; do
log_debug "cur_attempt: $cur_attempt."
if ( eval $check_fn ); then if ( eval $check_fn ); then
echo "Success: the process has been $event." log_info "Success: the process has been $event."
exit 0 quit 0
fi fi
[ $cur_attempt -ge $total_attempts ] && break [ $cur_attempt -ge $total_attempts ] && break
log_debug "Sleeping for 1 second..."
sleep 1 sleep 1
cur_attempt=`expr $cur_attempt + 1` cur_attempt=`expr $cur_attempt + 1`
done done
echo "Error: the process has not been $event in $total_attempts secs." log_error "The process has not been $event in $total_attempts secs."
exit 0 quit 0

View File

@ -2,9 +2,25 @@
########################################################################### ###########################################################################
if [ $# -ne 6 ]; then # NOTE: this script returns 0 (success) even in case of failure (except for
echo "Usage: wait_for_socket.sh <executable path> <socket path> <username> <password> <db> <timeout>" # usage-error). This is because this script is executed under
exit 0 # mysql-test-run[.pl] and it's better to examine particular problem in log
# file, than just having said that the test case has failed.
###########################################################################
basename=`basename "$0"`
dirname=`dirname "$0"`
###########################################################################
. "$dirname/utils.sh"
###########################################################################
if [ $# -ne 7 ]; then
echo "Usage: wait_for_socket.sh <executable path> <socket path> <username> <password> <db> <timeout> <test id>"
exit 1
fi fi
client_exe="$1" client_exe="$1"
@ -13,22 +29,34 @@ username="$3"
password="$4" password="$4"
db="$5" db="$5"
total_timeout="$6" total_timeout="$6"
test_id="$7"
log_file="$MYSQLTEST_VARDIR/log/$test_id.log"
log_debug "-- $basename: starting --"
log_debug "client_exe: '$client_exe'"
log_debug "socket_path: '$socket_path'"
log_debug "username: '$username'"
log_debug "password: '$password'"
log_debug "db: '$db'"
log_debug "total_timeout: '$total_timeout'"
log_debug "test_id: '$test_id'"
log_debug "log_file: '$log_file'"
########################################################################### ###########################################################################
if [ -z "$client_exe" ]; then if [ -z "$client_exe" ]; then
echo "Error: invalid path to client executable ($client_exe)." log_error "Invalid path to client executable ($client_exe)."
exit 0; quit 0;
fi fi
if [ ! -x "$client_exe" ]; then if [ ! -x "$client_exe" ]; then
echo "Error: client by path '$client_exe' is not available." log_error "Client by path '$client_exe' is not available."
exit 0; quit 0;
fi fi
if [ -z "$socket_path" ]; then if [ -z "$socket_path" ]; then
echo "Error: invalid socket patch." log_error "Invalid socket patch ($socket_path)."
exit 0 quit 0
fi fi
########################################################################### ###########################################################################
@ -39,15 +67,19 @@ client_args="--silent --socket=$socket_path --connect_timeout=1 "
[ -n "$password" ] && client_args="$client_args --password=$password " [ -n "$password" ] && client_args="$client_args --password=$password "
[ -n "$db" ] && client_args="$client_args $db" [ -n "$db" ] && client_args="$client_args $db"
log_debug "client_args: '$client_args'"
########################################################################### ###########################################################################
cur_attempt=1 cur_attempt=1
while true; do while true; do
log_debug "cur_attempt: $cur_attempt."
if ( echo 'quit' | "$client_exe" $client_args >/dev/null 2>&1 ); then if ( echo 'quit' | "$client_exe" $client_args >/dev/null 2>&1 ); then
echo "Success: server is ready to accept connection on socket." log_info "Success: server is ready to accept connection on socket."
exit 0 quit 0
fi fi
[ $cur_attempt -ge $total_timeout ] && break [ $cur_attempt -ge $total_timeout ] && break
@ -58,5 +90,5 @@ while true; do
done done
echo "Error: server does not accept connections after $total_timeout seconds." log_error "Server does not accept connections after $total_timeout seconds."
exit 0 quit 0

View File

@ -40,7 +40,7 @@ base64_needed_encoded_length(int length_of_data)
int int
base64_needed_decoded_length(int length_of_encoded_data) base64_needed_decoded_length(int length_of_encoded_data)
{ {
return ceil(length_of_encoded_data * 3 / 4); return (int) ceil(length_of_encoded_data * 3 / 4);
} }

View File

@ -30,7 +30,10 @@ pthread_key(struct st_my_thread_var, THR_KEY_mysys);
#endif /* USE_TLS */ #endif /* USE_TLS */
pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open, pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,
THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_myisam,THR_LOCK_heap, THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_myisam,THR_LOCK_heap,
THR_LOCK_net, THR_LOCK_charset; THR_LOCK_net, THR_LOCK_charset, THR_LOCK_threads;
pthread_cond_t THR_COND_threads;
uint THR_thread_count= 0;
uint my_thread_end_wait_time= 5;
#if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R) #if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)
pthread_mutex_t LOCK_localtime_r; pthread_mutex_t LOCK_localtime_r;
#endif #endif
@ -79,7 +82,7 @@ my_bool my_thread_global_init(void)
#endif #endif
#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP #ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
/* /*
Set mutex type to "errorcheck" a.k.a "adaptive" Set mutex type to "errorcheck"
*/ */
pthread_mutexattr_init(&my_errorcheck_mutexattr); pthread_mutexattr_init(&my_errorcheck_mutexattr);
pthread_mutexattr_settype(&my_errorcheck_mutexattr, pthread_mutexattr_settype(&my_errorcheck_mutexattr,
@ -94,6 +97,8 @@ my_bool my_thread_global_init(void)
pthread_mutex_init(&THR_LOCK_heap,MY_MUTEX_INIT_FAST); pthread_mutex_init(&THR_LOCK_heap,MY_MUTEX_INIT_FAST);
pthread_mutex_init(&THR_LOCK_net,MY_MUTEX_INIT_FAST); pthread_mutex_init(&THR_LOCK_net,MY_MUTEX_INIT_FAST);
pthread_mutex_init(&THR_LOCK_charset,MY_MUTEX_INIT_FAST); pthread_mutex_init(&THR_LOCK_charset,MY_MUTEX_INIT_FAST);
pthread_mutex_init(&THR_LOCK_threads,MY_MUTEX_INIT_FAST);
pthread_cond_init(&THR_COND_threads, NULL);
#if defined( __WIN__) || defined(OS2) #if defined( __WIN__) || defined(OS2)
win_pthread_init(); win_pthread_init();
#endif #endif
@ -114,6 +119,27 @@ my_bool my_thread_global_init(void)
void my_thread_global_end(void) void my_thread_global_end(void)
{ {
struct timespec abstime;
my_bool all_threads_killed= 1;
set_timespec(abstime, my_thread_end_wait_time);
pthread_mutex_lock(&THR_LOCK_threads);
while (THR_thread_count > 0)
{
int error= pthread_cond_timedwait(&THR_COND_threads, &THR_LOCK_threads,
&abstime);
if (error == ETIMEDOUT || error == ETIME)
{
if (THR_thread_count)
fprintf(stderr,
"Error in my_thread_global_end(): %d threads didn't exit\n",
THR_thread_count);
all_threads_killed= 0;
break;
}
}
pthread_mutex_unlock(&THR_LOCK_threads);
pthread_key_delete(THR_KEY_mysys); pthread_key_delete(THR_KEY_mysys);
#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
pthread_mutexattr_destroy(&my_fast_mutexattr); pthread_mutexattr_destroy(&my_fast_mutexattr);
@ -129,6 +155,11 @@ void my_thread_global_end(void)
pthread_mutex_destroy(&THR_LOCK_heap); pthread_mutex_destroy(&THR_LOCK_heap);
pthread_mutex_destroy(&THR_LOCK_net); pthread_mutex_destroy(&THR_LOCK_net);
pthread_mutex_destroy(&THR_LOCK_charset); pthread_mutex_destroy(&THR_LOCK_charset);
if (all_threads_killed)
{
pthread_mutex_destroy(&THR_LOCK_threads);
pthread_cond_destroy (&THR_COND_threads);
}
#if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R) #if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)
pthread_mutex_destroy(&LOCK_localtime_r); pthread_mutex_destroy(&LOCK_localtime_r);
#endif #endif
@ -140,10 +171,23 @@ void my_thread_global_end(void)
static long thread_id=0; static long thread_id=0;
/* /*
We can't use mutex_locks here if we are using windows as Allocate thread specific memory for the thread, used by mysys and dbug
we may have compiled the program with SAFE_MUTEX, in which
case the checking of mutex_locks will not work until SYNOPSIS
the pthread_self thread specific variable is initialized. my_thread_init()
NOTES
We can't use mutex_locks here if we are using windows as
we may have compiled the program with SAFE_MUTEX, in which
case the checking of mutex_locks will not work until
the pthread_self thread specific variable is initialized.
This function may called multiple times for a thread, for example
if one uses my_init() followed by mysql_server_init().
RETURN
0 ok
1 Fatal error; mysys/dbug functions can't be used
*/ */
my_bool my_thread_init(void) my_bool my_thread_init(void)
@ -154,9 +198,6 @@ my_bool my_thread_init(void)
#ifdef EXTRA_DEBUG_THREADS #ifdef EXTRA_DEBUG_THREADS
fprintf(stderr,"my_thread_init(): thread_id=%ld\n",pthread_self()); fprintf(stderr,"my_thread_init(): thread_id=%ld\n",pthread_self());
#endif #endif
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
pthread_mutex_lock(&THR_LOCK_lock);
#endif
#if !defined(__WIN__) || defined(USE_TLS) #if !defined(__WIN__) || defined(USE_TLS)
if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys)) if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys))
@ -174,7 +215,7 @@ my_bool my_thread_init(void)
} }
pthread_setspecific(THR_KEY_mysys,tmp); pthread_setspecific(THR_KEY_mysys,tmp);
#else #else /* defined(__WIN__) && !(defined(USE_TLS) */
/* /*
Skip initialization if the thread specific variable is already initialized Skip initialization if the thread specific variable is already initialized
*/ */
@ -182,7 +223,6 @@ my_bool my_thread_init(void)
goto end; goto end;
tmp= &THR_KEY_mysys; tmp= &THR_KEY_mysys;
#endif #endif
tmp->id= ++thread_id;
#if defined(__WIN__) && defined(EMBEDDED_LIBRARY) #if defined(__WIN__) && defined(EMBEDDED_LIBRARY)
tmp->thread_self= (pthread_t)getpid(); tmp->thread_self= (pthread_t)getpid();
#endif #endif
@ -190,22 +230,35 @@ my_bool my_thread_init(void)
pthread_cond_init(&tmp->suspend, NULL); pthread_cond_init(&tmp->suspend, NULL);
tmp->init= 1; tmp->init= 1;
pthread_mutex_lock(&THR_LOCK_threads);
tmp->id= ++thread_id;
++THR_thread_count;
pthread_mutex_unlock(&THR_LOCK_threads);
end: end:
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
pthread_mutex_unlock(&THR_LOCK_lock);
#endif
return error; return error;
} }
/*
Deallocate memory used by the thread for book-keeping
SYNOPSIS
my_thread_end()
NOTE
This may be called multiple times for a thread.
This happens for example when one calls 'mysql_server_init()'
mysql_server_end() and then ends with a mysql_end().
*/
void my_thread_end(void) void my_thread_end(void)
{ {
struct st_my_thread_var *tmp; struct st_my_thread_var *tmp;
tmp= my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys); tmp= my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
#ifdef EXTRA_DEBUG_THREADS #ifdef EXTRA_DEBUG_THREADS
fprintf(stderr,"my_thread_end(): tmp=%p,thread_id=%ld\n", fprintf(stderr,"my_thread_end(): tmp: 0x%lx thread_id=%ld\n",
tmp,pthread_self()); (long) tmp, pthread_self());
#endif #endif
if (tmp && tmp->init) if (tmp && tmp->init)
{ {
@ -227,6 +280,18 @@ void my_thread_end(void)
#else #else
tmp->init= 0; tmp->init= 0;
#endif #endif
/*
Decrement counter for number of running threads. We are using this
in my_thread_global_end() to wait until all threads have called
my_thread_end and thus freed all memory they have allocated in
my_thread_init() and DBUG_xxxx
*/
pthread_mutex_lock(&THR_LOCK_threads);
DBUG_ASSERT(THR_thread_count != 0);
if (--THR_thread_count == 0)
pthread_cond_signal(&THR_COND_threads);
pthread_mutex_unlock(&THR_LOCK_threads);
} }
/* The following free has to be done, even if my_thread_var() is 0 */ /* The following free has to be done, even if my_thread_var() is 0 */
#if (!defined(__WIN__) && !defined(OS2)) || defined(USE_TLS) #if (!defined(__WIN__) && !defined(OS2)) || defined(USE_TLS)

View File

@ -84,7 +84,7 @@ static void rb_delete_fixup(TREE *tree,TREE_ELEMENT ***parent);
static int test_rb_tree(TREE_ELEMENT *element); static int test_rb_tree(TREE_ELEMENT *element);
#endif #endif
void init_tree(TREE *tree, uint default_alloc_size, uint memory_limit, void init_tree(TREE *tree, ulong default_alloc_size, ulong memory_limit,
int size, qsort_cmp2 compare, my_bool with_delete, int size, qsort_cmp2 compare, my_bool with_delete,
tree_element_free free_element, void *custom_arg) tree_element_free free_element, void *custom_arg)
{ {
@ -128,7 +128,7 @@ void init_tree(TREE *tree, uint default_alloc_size, uint memory_limit,
} }
if (!(tree->with_delete=with_delete)) if (!(tree->with_delete=with_delete))
{ {
init_alloc_root(&tree->mem_root, default_alloc_size,0); init_alloc_root(&tree->mem_root, (uint) default_alloc_size, 0);
tree->mem_root.min_malloc=(sizeof(TREE_ELEMENT)+tree->size_of_element); tree->mem_root.min_malloc=(sizeof(TREE_ELEMENT)+tree->size_of_element);
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;

View File

@ -178,7 +178,7 @@ ndb_mgm_create_handle()
h->mgmd_version_minor= -1; h->mgmd_version_minor= -1;
h->mgmd_version_build= -1; h->mgmd_version_build= -1;
DBUG_PRINT("info", ("handle=0x%x", (UintPtr)h)); DBUG_PRINT("info", ("handle: 0x%lx", (long)h));
DBUG_RETURN(h); DBUG_RETURN(h);
} }
@ -195,7 +195,7 @@ int
ndb_mgm_set_connectstring(NdbMgmHandle handle, const char * mgmsrv) ndb_mgm_set_connectstring(NdbMgmHandle handle, const char * mgmsrv)
{ {
DBUG_ENTER("ndb_mgm_set_connectstring"); DBUG_ENTER("ndb_mgm_set_connectstring");
DBUG_PRINT("info", ("handle=0x%x", (UintPtr)handle)); DBUG_PRINT("info", ("handle: 0x%lx", (long)handle));
handle->cfg.~LocalConfig(); handle->cfg.~LocalConfig();
new (&(handle->cfg)) LocalConfig; new (&(handle->cfg)) LocalConfig;
if (!handle->cfg.init(mgmsrv, 0) || if (!handle->cfg.init(mgmsrv, 0) ||
@ -237,7 +237,7 @@ ndb_mgm_destroy_handle(NdbMgmHandle * handle)
DBUG_ENTER("ndb_mgm_destroy_handle"); DBUG_ENTER("ndb_mgm_destroy_handle");
if(!handle) if(!handle)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
DBUG_PRINT("info", ("handle=0x%x", (UintPtr)(* handle))); DBUG_PRINT("info", ("handle: 0x%lx", (long)(* handle)));
/** /**
* important! only disconnect if connected * important! only disconnect if connected
* other code relies on this * other code relies on this

View File

@ -777,7 +777,7 @@ Ndb::getAutoIncrementValue(const char* aTableName,
} }
if (getTupleIdFromNdb(info, tupleId, cacheSize) == -1) if (getTupleIdFromNdb(info, tupleId, cacheSize) == -1)
DBUG_RETURN(-1); DBUG_RETURN(-1);
DBUG_PRINT("info", ("value %llu", (ulonglong)tupleId)); DBUG_PRINT("info", ("value %lu", (ulong) tupleId));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -798,7 +798,7 @@ Ndb::getAutoIncrementValue(const NdbDictionary::Table * aTable,
} }
if (getTupleIdFromNdb(info, tupleId, cacheSize) == -1) if (getTupleIdFromNdb(info, tupleId, cacheSize) == -1)
DBUG_RETURN(-1); DBUG_RETURN(-1);
DBUG_PRINT("info", ("value %llu", (ulonglong)tupleId)); DBUG_PRINT("info", ("value %lu", (ulong)tupleId));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -811,7 +811,7 @@ Ndb::getTupleIdFromNdb(Ndb_local_table_info* info,
{ {
assert(info->m_first_tuple_id < info->m_last_tuple_id); assert(info->m_first_tuple_id < info->m_last_tuple_id);
tupleId = ++info->m_first_tuple_id; tupleId = ++info->m_first_tuple_id;
DBUG_PRINT("info", ("next cached value %llu", (ulonglong)tupleId)); DBUG_PRINT("info", ("next cached value %lu", (ulong)tupleId));
} }
else else
{ {
@ -845,7 +845,7 @@ Ndb::readAutoIncrementValue(const char* aTableName,
} }
if (readTupleIdFromNdb(info, tupleId) == -1) if (readTupleIdFromNdb(info, tupleId) == -1)
DBUG_RETURN(-1); DBUG_RETURN(-1);
DBUG_PRINT("info", ("value %llu", (ulonglong)tupleId)); DBUG_PRINT("info", ("value %lu", (ulong)tupleId));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -866,7 +866,7 @@ Ndb::readAutoIncrementValue(const NdbDictionary::Table * aTable,
} }
if (readTupleIdFromNdb(info, tupleId) == -1) if (readTupleIdFromNdb(info, tupleId) == -1)
DBUG_RETURN(-1); DBUG_RETURN(-1);
DBUG_PRINT("info", ("value %llu", (ulonglong)tupleId)); DBUG_PRINT("info", ("value %lu", (ulong)tupleId));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -948,8 +948,8 @@ Ndb::setTupleIdInNdb(Ndb_local_table_info* info,
{ {
info->m_first_tuple_id = tupleId - 1; info->m_first_tuple_id = tupleId - 1;
DBUG_PRINT("info", DBUG_PRINT("info",
("Setting next auto increment cached value to %llu", ("Setting next auto increment cached value to %lu",
(ulonglong)tupleId)); (ulong)tupleId));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
} }
@ -976,7 +976,8 @@ Ndb::opTupleIdOnNdb(Ndb_local_table_info* info, Uint64 & opValue, Uint32 op)
{ {
DBUG_ENTER("Ndb::opTupleIdOnNdb"); DBUG_ENTER("Ndb::opTupleIdOnNdb");
Uint32 aTableId = info->m_table_impl->m_tableId; Uint32 aTableId = info->m_table_impl->m_tableId;
DBUG_PRINT("enter", ("table=%u value=%llu op=%u", aTableId, opValue, op)); DBUG_PRINT("enter", ("table: %u value: %lu op: %u",
aTableId, (ulong) opValue, op));
NdbTransaction* tConnection; NdbTransaction* tConnection;
NdbOperation* tOperation= 0; // Compiler warning if not initialized NdbOperation* tOperation= 0; // Compiler warning if not initialized
@ -1050,8 +1051,8 @@ Ndb::opTupleIdOnNdb(Ndb_local_table_info* info, Uint64 & opValue, Uint32 op)
else else
{ {
DBUG_PRINT("info", DBUG_PRINT("info",
("Setting next auto increment value (db) to %llu", ("Setting next auto increment value (db) to %lu",
(ulonglong)opValue)); (ulong)opValue));
info->m_first_tuple_id = info->m_last_tuple_id = opValue - 1; info->m_first_tuple_id = info->m_last_tuple_id = opValue - 1;
} }
break; break;
@ -1247,7 +1248,7 @@ Ndb::internalize_index_name(const NdbTableImpl * table,
if (!table) if (!table)
{ {
DBUG_PRINT("error", ("!table")); DBUG_PRINT("error", ("!table"));
return ret; DBUG_RETURN(ret);
} }
if (fullyQualifiedNames) if (fullyQualifiedNames)

View File

@ -653,9 +653,9 @@ NdbScanOperation::doSend(int ProcessorId)
void NdbScanOperation::close(bool forceSend, bool releaseOp) void NdbScanOperation::close(bool forceSend, bool releaseOp)
{ {
DBUG_ENTER("NdbScanOperation::close"); DBUG_ENTER("NdbScanOperation::close");
DBUG_PRINT("enter", ("this=%x tcon=%x con=%x force=%d release=%d", DBUG_PRINT("enter", ("this: 0x%lx tcon: 0x%lx con: 0x%lx force: %d release: %d",
(UintPtr)this, (long)this,
(UintPtr)m_transConnection, (UintPtr)theNdbCon, (long)m_transConnection, (long)theNdbCon,
forceSend, releaseOp)); forceSend, releaseOp));
if(m_transConnection){ if(m_transConnection){

View File

@ -1007,7 +1007,8 @@ void
NdbTransaction::releaseExecutedScanOperation(NdbIndexScanOperation* cursorOp) NdbTransaction::releaseExecutedScanOperation(NdbIndexScanOperation* cursorOp)
{ {
DBUG_ENTER("NdbTransaction::releaseExecutedScanOperation"); DBUG_ENTER("NdbTransaction::releaseExecutedScanOperation");
DBUG_PRINT("enter", ("this=0x%x op=0x%x", (UintPtr)this, (UintPtr)cursorOp)); DBUG_PRINT("enter", ("this: 0x%lx op=0x%lx",
(long)this, (long)cursorOp));
releaseScanOperation(&m_firstExecutedScanOp, 0, cursorOp); releaseScanOperation(&m_firstExecutedScanOp, 0, cursorOp);

View File

@ -361,7 +361,7 @@ void
Ndb::releaseScanOperation(NdbIndexScanOperation* aScanOperation) Ndb::releaseScanOperation(NdbIndexScanOperation* aScanOperation)
{ {
DBUG_ENTER("Ndb::releaseScanOperation"); DBUG_ENTER("Ndb::releaseScanOperation");
DBUG_PRINT("enter", ("op=%x", (UintPtr)aScanOperation)); DBUG_PRINT("enter", ("op: 0x%lx", (long)aScanOperation));
#ifdef ndb_release_check_dup #ifdef ndb_release_check_dup
{ NdbIndexScanOperation* tOp = theScanOpIdleList; { NdbIndexScanOperation* tOp = theScanOpIdleList;
while (tOp != NULL) { while (tOp != NULL) {

View File

@ -30,6 +30,8 @@ netware_build_files = client/mysql.def client/mysqladmin.def \
client/mysqlbinlog.def client/mysqlcheck.def \ client/mysqlbinlog.def client/mysqlcheck.def \
client/mysqldump.def client/mysqlimport.def \ client/mysqldump.def client/mysqlimport.def \
client/mysqlshow.def client/mysqltest.def \ client/mysqlshow.def client/mysqltest.def \
client/mysql_upgrade.def \
tests/mysql_client_test.def \
extra/my_print_defaults.def \ extra/my_print_defaults.def \
extra/perror.def extra/replace.def \ extra/perror.def extra/replace.def \
extra/resolveip.def extra/comp_err.def \ extra/resolveip.def extra/comp_err.def \
@ -69,7 +71,8 @@ EXTRA_DIST= $(BUILT_SOURCES) comp_err.def init_db.sql install_test_db.ncf \
mysql_test_run.def mysql_waitpid.def mysqladmin.def \ mysql_test_run.def mysql_waitpid.def mysqladmin.def \
mysqlbinlog.def mysqlcheck.def mysqld.def \ mysqlbinlog.def mysqlcheck.def mysqld.def \
mysqld_safe.c mysqld_safe.def mysqldump.def mysqlimport.def \ mysqld_safe.c mysqld_safe.def mysqldump.def mysqlimport.def \
mysqlshow.def mysqltest.def perror.def \ mysqlshow.def mysqltest.def mysql_upgrade.def perror.def \
mysql_client_test.def \
replace.def resolve_stack_dump.def resolveip.def test_db.sql \ replace.def resolve_stack_dump.def resolveip.def test_db.sql \
static_init_db.sql \ static_init_db.sql \
BUILD/apply-patch BUILD/compile-AUTOTOOLS \ BUILD/apply-patch BUILD/compile-AUTOTOOLS \

View File

@ -5,6 +5,7 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Error File Compiler" DESCRIPTION "MySQL Error File Compiler"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -6,7 +6,7 @@ SCREENNAME "MySQL ISAM Table Check Tool"
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL ISAM Table Check Tool" DESCRIPTION "MySQL ISAM Table Check Tool"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 65536 STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -5,6 +5,7 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL ISAM Table Log Tool" DESCRIPTION "MySQL ISAM Table Log Tool"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -7,6 +7,6 @@ COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Res
DESCRIPTION "MySQL Client Library" DESCRIPTION "MySQL Client Library"
VERSION 4, 0 VERSION 4, 0
AUTOUNLOAD AUTOUNLOAD
STACKSIZE 32768 STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -5,7 +5,7 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Print Defaults Tool" DESCRIPTION "MySQL Print Defaults Tool"
VERSION 5, 0, 17 VERSION 5, 0, 17
STACKSIZE 32767 STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -6,7 +6,7 @@ SCREENNAME "MySQL MyISAM Table Dump Tool"
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL MyISAM Table Dump Tool" DESCRIPTION "MySQL MyISAM Table Dump Tool"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 65536 STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -6,7 +6,7 @@ SCREENNAME "MySQL MyISAM Table Check Tool[scrollable]"
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL MyISAM Table Check Tool" DESCRIPTION "MySQL MyISAM Table Check Tool"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 65536 STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -6,7 +6,7 @@ SCREENNAME "MySQL MyISAM Table Log Tool"
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL MyISAM Table Log Tool" DESCRIPTION "MySQL MyISAM Table Log Tool"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 32768 STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -6,7 +6,7 @@ SCREENNAME "MySQL MyISAM Table Pack Tool"
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL MyISAM Table Pack Tool" DESCRIPTION "MySQL MyISAM Table Pack Tool"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 32768 STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -6,7 +6,7 @@ SCREENNAME "MySQL Monitor[scrollable]"
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Monitor" DESCRIPTION "MySQL Monitor"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 32768 STACKSIZE 131072
MULTIPLE MULTIPLE
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -0,0 +1,10 @@
#------------------------------------------------------------------------------
# MySQL Test
#------------------------------------------------------------------------------
MODULE libc.nlm
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Client Test"
VERSION 4, 0
STACKSIZE 131072
XDCDATA ../netware/mysql.xdc
#DEBUG

View File

@ -6,7 +6,7 @@ SCREENNAME "MySQL Install"
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Initial Database Installer" DESCRIPTION "MySQL Initial Database Installer"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 32768 STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -2,10 +2,10 @@
# MySQL Test Run # MySQL Test Run
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
MODULE libc.nlm MODULE libc.nlm
STACKSIZE 65536
SCREENNAME "MySQL Test Run" SCREENNAME "MySQL Test Run"
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Test Run" DESCRIPTION "MySQL Test Run"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

11
netware/mysql_upgrade.def Normal file
View File

@ -0,0 +1,11 @@
#------------------------------------------------------------------------------
# MySQL Admin
#------------------------------------------------------------------------------
MODULE libc.nlm
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Upgrade Tool"
VERSION 4, 0
STACKSIZE 131072
XDCDATA ../netware/mysql.xdc
#DEBUG

View File

@ -6,7 +6,7 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Tool - Wait for a Program to Terminate" DESCRIPTION "MySQL Tool - Wait for a Program to Terminate"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 65536 STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -6,7 +6,7 @@ SCREENNAME "MySQL Admin[scrollable]"
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Admin Tool" DESCRIPTION "MySQL Admin Tool"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 32768 STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -6,7 +6,7 @@ SCREENNAME "MySQL Binary Log Dump Tool[scrollable]"
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Binary Log Dump Tool" DESCRIPTION "MySQL Binary Log Dump Tool"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 32768 STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -6,7 +6,7 @@ SCREENNAME "MySQL Check Tool[scrollable]"
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Check Tool" DESCRIPTION "MySQL Check Tool"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 32768 STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -6,7 +6,7 @@ COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Res
DESCRIPTION "MySQL Database Server" DESCRIPTION "MySQL Database Server"
VERSION 4, 0 VERSION 4, 0
MULTIPLE MULTIPLE
STACKSIZE 65536 STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -6,7 +6,7 @@ SCREENNAME "MySQL Database Server"
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Database Server Monitor" DESCRIPTION "MySQL Database Server Monitor"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 32768 STACKSIZE 131072
MULTIPLE MULTIPLE
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -6,7 +6,7 @@ SCREENNAME "MySQL Dump Tool[scrollable]"
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Dump Tool" DESCRIPTION "MySQL Dump Tool"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 32768 STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -6,7 +6,7 @@ SCREENNAME "MySQL Import[scrollable]"
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Import Tool" DESCRIPTION "MySQL Import Tool"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 32768 STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -6,6 +6,7 @@ SCREENNAME "MySQL Show[scrollable]"
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Show Tool" DESCRIPTION "MySQL Show Tool"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -5,6 +5,7 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Test Case Tool" DESCRIPTION "MySQL Test Case Tool"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -7,6 +7,7 @@ COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Res
DESCRIPTION "MySQL ISAM Table Pack Tool" DESCRIPTION "MySQL ISAM Table Pack Tool"
SCREENNAME "MySQL ISAM Table Pack Tool" SCREENNAME "MySQL ISAM Table Pack Tool"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -5,7 +5,7 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Error Code Description Tool" DESCRIPTION "MySQL Error Code Description Tool"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 32768 STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -5,6 +5,7 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Text Replacement Tool" DESCRIPTION "MySQL Text Replacement Tool"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -6,7 +6,7 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Stack Dump Resolve Tool" DESCRIPTION "MySQL Stack Dump Resolve Tool"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 65536 STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -5,6 +5,7 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL IP/Hostname Resolve Tool" DESCRIPTION "MySQL IP/Hostname Resolve Tool"
VERSION 4, 0 VERSION 4, 0
STACKSIZE 131072
XDCDATA ../netware/mysql.xdc XDCDATA ../netware/mysql.xdc
#DEBUG #DEBUG

View File

@ -33,6 +33,7 @@ parse_arguments() {
case "$arg" in case "$arg" in
--force) force=1 ;; --force) force=1 ;;
--basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; --basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--srcdir=*) srcdir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--ldata=*|--datadir=*) ldata=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; --ldata=*|--datadir=*) ldata=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--user=*) --user=*)
# Note that the user will be passed to mysqld so that it runs # Note that the user will be passed to mysqld so that it runs
@ -78,6 +79,7 @@ ldata=
execdir= execdir=
bindir= bindir=
basedir= basedir=
srcdir=
force=0 force=0
verbose=0 verbose=0
fill_help_tables="" fill_help_tables=""
@ -106,18 +108,24 @@ else
fi fi
# find fill_help_tables.sh # find fill_help_tables.sh
for i in $basedir/support-files $basedir/share $basedir/share/mysql $basedir/scripts `pwd` `pwd`/scripts @pkgdatadir@ if test -n "$srcdir"
do
if test -f $i/fill_help_tables.sql
then
pkgdatadir=$i
fi
done
if test -f $pkgdatadir/fill_help_tables.sql
then then
fill_help_tables=$pkgdatadir/fill_help_tables.sql fill_help_tables=$srcdir/scripts/fill_help_tables.sql
else else
for i in $basedir/support-files $basedir/share $basedir/share/mysql \
$basedir/scripts `pwd` `pwd`/scripts @pkgdatadir@
do
if test -f $i/fill_help_tables.sql
then
pkgdatadir=$i
fi
done
fill_help_tables=$pkgdatadir/fill_help_tables.sql
fi
if test ! -f $fill_help_tables
then
echo "Could not find help file 'fill_help_tables.sql' in @pkgdatadir@ or inside $basedir". echo "Could not find help file 'fill_help_tables.sql' in @pkgdatadir@ or inside $basedir".
exit 1; exit 1;
fi fi
@ -130,7 +138,13 @@ scriptdir=$bindir
if test "$windows" = 1 if test "$windows" = 1
then then
mysqld="./sql/mysqld" mysqld="./sql/mysqld"
mysqld_opt="--language=./sql/share/english" if test -n "$srcdir" -a -f $srcdir/sql/share/english/errmsg.sys
then
langdir=$srcdir/sql/share/english
else
langdir=./sql/share/english
fi
mysqld_opt="--language=$langdir"
scriptdir="./scripts" scriptdir="./scripts"
fi fi

View File

@ -222,8 +222,6 @@ void Guardian_thread::run()
while (node != NULL) while (node != NULL)
{ {
struct timespec timeout;
GUARD_NODE *current_node= (GUARD_NODE *) node->data; GUARD_NODE *current_node= (GUARD_NODE *) node->data;
instance= ((GUARD_NODE *) node->data)->instance; instance= ((GUARD_NODE *) node->data)->instance;
process_instance(instance, current_node, &guarded_instances, node); process_instance(instance, current_node, &guarded_instances, node);

View File

@ -15,7 +15,6 @@
#define snprintf _snprintf #define snprintf _snprintf
#define SIGKILL 9 #define SIGKILL 9
#define SHUT_RDWR 0x2
/*TODO: fix this */ /*TODO: fix this */
#define PROTOCOL_VERSION 10 #define PROTOCOL_VERSION 10

View File

@ -1217,7 +1217,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
{ {
uchar *pos; uchar *pos;
/* fields count may be wrong */ /* fields count may be wrong */
DBUG_ASSERT ((field - result) < fields); DBUG_ASSERT((uint) (field - result) < fields);
cli_fetch_lengths(&lengths[0], row->data, default_value ? 8 : 7); cli_fetch_lengths(&lengths[0], row->data, default_value ? 8 : 7);
field->catalog = strdup_root(alloc,(char*) row->data[0]); field->catalog = strdup_root(alloc,(char*) row->data[0]);
field->db = strdup_root(alloc,(char*) row->data[1]); field->db = strdup_root(alloc,(char*) row->data[1]);

View File

@ -431,7 +431,7 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
goto err; goto err;
} }
if (check_date(l_time, not_zero_date, flags, was_cut)) if (check_date(l_time, not_zero_date != 0, flags, was_cut))
goto err; goto err;
l_time->time_type= (number_of_fields <= 3 ? l_time->time_type= (number_of_fields <= 3 ?
@ -532,15 +532,15 @@ my_bool str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
if ((uint) (end-str) > 1 && str != end_of_days && if ((uint) (end-str) > 1 && str != end_of_days &&
my_isdigit(&my_charset_latin1, *str)) my_isdigit(&my_charset_latin1, *str))
{ /* Found days part */ { /* Found days part */
date[0]= value; date[0]= (ulong) value;
state= 1; /* Assume next is hours */ state= 1; /* Assume next is hours */
found_days= 1; found_days= 1;
} }
else if ((end-str) > 1 && *str == time_separator && else if ((end-str) > 1 && *str == time_separator &&
my_isdigit(&my_charset_latin1, str[1])) my_isdigit(&my_charset_latin1, str[1]))
{ {
date[0]=0; /* Assume we found hours */ date[0]= 0; /* Assume we found hours */
date[1]=value; date[1]= (ulong) value;
state=2; state=2;
found_hours=1; found_hours=1;
str++; /* skip ':' */ str++; /* skip ':' */
@ -549,9 +549,9 @@ my_bool str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
{ {
/* String given as one number; assume HHMMSS format */ /* String given as one number; assume HHMMSS format */
date[0]= 0; date[0]= 0;
date[1]= value/10000; date[1]= (ulong) (value/10000);
date[2]= value/100 % 100; date[2]= (ulong) (value/100 % 100);
date[3]= value % 100; date[3]= (ulong) (value % 100);
state=4; state=4;
goto fractional; goto fractional;
} }
@ -561,7 +561,7 @@ my_bool str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
{ {
for (value=0; str != end && my_isdigit(&my_charset_latin1,*str) ; str++) for (value=0; str != end && my_isdigit(&my_charset_latin1,*str) ; str++)
value=value*10L + (long) (*str - '0'); value=value*10L + (long) (*str - '0');
date[state++]=value; date[state++]= (ulong) value;
if (state == 4 || (end-str) < 2 || *str != time_separator || if (state == 4 || (end-str) < 2 || *str != time_separator ||
!my_isdigit(&my_charset_latin1,str[1])) !my_isdigit(&my_charset_latin1,str[1]))
break; break;
@ -596,7 +596,7 @@ fractional:
value*= (long) log_10_int[field_length]; value*= (long) log_10_int[field_length];
else if (field_length < 0) else if (field_length < 0)
*warning|= MYSQL_TIME_WARN_TRUNCATED; *warning|= MYSQL_TIME_WARN_TRUNCATED;
date[4]=value; date[4]= (ulong) value;
} }
else else
date[4]=0; date[4]=0;

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