mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.0
into perch.ndb.mysql.com:/home/jonas/src/mysql-5.0
This commit is contained in:
commit
c43a7e2e87
117 changed files with 3584 additions and 1930 deletions
|
@ -1269,3 +1269,6 @@ vio/viotest.cpp
|
|||
zlib/*.ds?
|
||||
zlib/*.vcproj
|
||||
libmysqld/ha_blackhole.cc
|
||||
client/my_user.c
|
||||
libmysqld/my_user.c
|
||||
sql/my_user.c
|
||||
|
|
|
@ -46,7 +46,7 @@ mysqltestmanager_pwgen_SOURCES = mysqlmanager-pwgen.c
|
|||
mysqltestmanagerc_SOURCES= mysqlmanagerc.c $(yassl_dummy_link_fix)
|
||||
mysqlcheck_SOURCES= mysqlcheck.c $(yassl_dummy_link_fix)
|
||||
mysqlshow_SOURCES= mysqlshow.c $(yassl_dummy_link_fix)
|
||||
mysqldump_SOURCES= mysqldump.c $(yassl_dummy_link_fix)
|
||||
mysqldump_SOURCES= mysqldump.c my_user.c $(yassl_dummy_link_fix)
|
||||
mysqlimport_SOURCES= mysqlimport.c $(yassl_dummy_link_fix)
|
||||
sql_src=log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc
|
||||
strings_src=decimal.c
|
||||
|
@ -62,7 +62,10 @@ link_sources:
|
|||
for f in $(strings_src) ; do \
|
||||
rm -f $(srcdir)/$$f; \
|
||||
@LN_CP_F@ $(top_srcdir)/strings/$$f $$f; \
|
||||
done;
|
||||
done; \
|
||||
rm -f $(srcdir)/my_user.c; \
|
||||
@LN_CP_F@ $(top_srcdir)/sql-common/my_user.c my_user.c;
|
||||
|
||||
|
||||
# Don't update the files from bitkeeper
|
||||
%::SCCS/s.%
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
#include <my_global.h>
|
||||
#include <my_sys.h>
|
||||
#include <my_user.h>
|
||||
#include <m_string.h>
|
||||
#include <m_ctype.h>
|
||||
#include <hash.h>
|
||||
|
@ -1840,9 +1841,37 @@ static void dump_triggers_for_table (char *table, char *db)
|
|||
DELIMITER ;;\n");
|
||||
while ((row= mysql_fetch_row(result)))
|
||||
{
|
||||
fprintf(sql_file, "/*!50003 SET SESSION SQL_MODE=\"%s\" */;;\n\
|
||||
/*!50003 CREATE TRIGGER %s %s %s ON %s FOR EACH ROW%s%s */;;\n\n",
|
||||
row[6], /* sql_mode */
|
||||
fprintf(sql_file,
|
||||
"/*!50003 SET SESSION SQL_MODE=\"%s\" */;;\n"
|
||||
"/*!50003 CREATE */ ",
|
||||
row[6] /* sql_mode */);
|
||||
|
||||
if (mysql_num_fields(result) > 7)
|
||||
{
|
||||
/*
|
||||
mysqldump can be run against the server, that does not support definer
|
||||
in triggers (there is no DEFINER column in SHOW TRIGGERS output). So,
|
||||
we should check if we have this column before accessing it.
|
||||
*/
|
||||
|
||||
uint user_name_len;
|
||||
char user_name_str[USERNAME_LENGTH + 1];
|
||||
char quoted_user_name_str[USERNAME_LENGTH * 2 + 3];
|
||||
uint host_name_len;
|
||||
char host_name_str[HOSTNAME_LENGTH + 1];
|
||||
char quoted_host_name_str[HOSTNAME_LENGTH * 2 + 3];
|
||||
|
||||
parse_user(row[7], strlen(row[7]), user_name_str, &user_name_len,
|
||||
host_name_str, &host_name_len);
|
||||
|
||||
fprintf(sql_file,
|
||||
"/*!50017 DEFINER=%s@%s */ ",
|
||||
quote_name(user_name_str, quoted_user_name_str, FALSE),
|
||||
quote_name(host_name_str, quoted_host_name_str, FALSE));
|
||||
}
|
||||
|
||||
fprintf(sql_file,
|
||||
"/*!50003 TRIGGER %s %s %s ON %s FOR EACH ROW%s%s */;;\n\n",
|
||||
quote_name(row[0], name_buff, 0), /* Trigger */
|
||||
row[4], /* Timing */
|
||||
row[1], /* Event */
|
||||
|
|
2125
client/mysqltest.c
2125
client/mysqltest.c
File diff suppressed because it is too large
Load diff
|
@ -30,7 +30,9 @@ AC_DEFUN([MYSQL_CHECK_YASSL], [
|
|||
;;
|
||||
esac
|
||||
AC_SUBST([yassl_taocrypt_extra_cxxflags])
|
||||
|
||||
# Link extra/yassl/include/openssl subdir to include/
|
||||
yassl_h_ln_cmd="\$(LN) -s \$(top_srcdir)/extra/yassl/include/openssl openssl"
|
||||
AC_SUBST(yassl_h_ln_cmd)
|
||||
else
|
||||
yassl_dir=""
|
||||
AC_MSG_RESULT(no)
|
||||
|
|
|
@ -30,10 +30,11 @@ noinst_HEADERS = config-win.h config-os2.h config-netware.h \
|
|||
my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \
|
||||
my_aes.h my_tree.h hash.h thr_alarm.h \
|
||||
thr_lock.h t_ctype.h violite.h md5.h base64.h \
|
||||
mysql_version.h.in my_handler.h my_time.h decimal.h
|
||||
mysql_version.h.in my_handler.h my_time.h decimal.h \
|
||||
my_user.h
|
||||
|
||||
# mysql_version.h are generated
|
||||
CLEANFILES = mysql_version.h my_config.h readline
|
||||
CLEANFILES = mysql_version.h my_config.h readline openssl
|
||||
|
||||
# Some include files that may be moved and patched by configure
|
||||
DISTCLEANFILES = sched.h $(CLEANFILES)
|
||||
|
@ -41,6 +42,7 @@ DISTCLEANFILES = sched.h $(CLEANFILES)
|
|||
link_sources:
|
||||
-$(RM) -fr readline
|
||||
@readline_h_ln_cmd@
|
||||
@yassl_h_ln_cmd@
|
||||
|
||||
my_config.h: ../config.h
|
||||
$(CP) ../config.h my_config.h
|
||||
|
|
|
@ -95,6 +95,9 @@ extern "C" {
|
|||
/* On NetWare, stack grows towards lower address*/
|
||||
#define STACK_DIRECTION -1
|
||||
|
||||
/* On NetWare, we need to set stack size for threads, otherwise default 16K is used */
|
||||
#define NW_THD_STACKSIZE 65536
|
||||
|
||||
/* On NetWare, to fix the problem with the deletion of open files */
|
||||
#define CANT_DELETE_OPEN_FILES 1
|
||||
|
||||
|
|
|
@ -22,6 +22,11 @@ functions */
|
|||
#define _WIN32_WINNT 0x0500
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
/* Avoid endless warnings about sprintf() etc. being unsafe. */
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
#endif
|
||||
|
||||
#include <sys/locking.h>
|
||||
#include <windows.h>
|
||||
#include <math.h> /* Because of rint() */
|
||||
|
@ -103,11 +108,17 @@ functions */
|
|||
#undef _REENTRANT /* Crashes something for win32 */
|
||||
#undef SAFE_MUTEX /* Can't be used on windows */
|
||||
|
||||
#define LONGLONG_MIN ((__int64) 0x8000000000000000)
|
||||
#define LONGLONG_MAX ((__int64) 0x7FFFFFFFFFFFFFFF)
|
||||
#define ULONGLONG_MAX ((unsigned __int64) 0xFFFFFFFFFFFFFFFF)
|
||||
#define LL(A) ((__int64) A)
|
||||
#define ULL(A) ((unsigned __int64) A)
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1310
|
||||
#define LL(A) A##ll
|
||||
#define ULL(A) A##ull
|
||||
#else
|
||||
#define LL(A) ((__int64) A)
|
||||
#define ULL(A) ((unsigned __int64) A)
|
||||
#endif
|
||||
|
||||
#define LONGLONG_MIN LL(0x8000000000000000)
|
||||
#define LONGLONG_MAX LL(0x7FFFFFFFFFFFFFFF)
|
||||
#define ULONGLONG_MAX ULL(0xFFFFFFFFFFFFFFFF)
|
||||
|
||||
/* Type information */
|
||||
|
||||
|
@ -328,6 +339,7 @@ inline double ulonglong2double(ulonglong value)
|
|||
#define SPRINTF_RETURNS_INT
|
||||
#define HAVE_SETFILEPOINTER
|
||||
#define HAVE_VIO_READ_BUFF
|
||||
#define HAVE_STRNLEN
|
||||
|
||||
#ifndef __NT__
|
||||
#undef FILE_SHARE_DELETE
|
||||
|
|
|
@ -33,7 +33,7 @@ typedef void (*hash_free_key)(void *);
|
|||
|
||||
typedef struct st_hash {
|
||||
uint key_offset,key_length; /* Length of key if const length */
|
||||
uint records,blength,current_record;
|
||||
uint records, blength;
|
||||
uint flags;
|
||||
DYNAMIC_ARRAY array; /* Place for hash_keys */
|
||||
hash_get_key get_key;
|
||||
|
@ -41,6 +41,9 @@ typedef struct st_hash {
|
|||
CHARSET_INFO *charset;
|
||||
} HASH;
|
||||
|
||||
/* A search iterator state */
|
||||
typedef uint HASH_SEARCH_STATE;
|
||||
|
||||
#define hash_init(A,B,C,D,E,F,G,H) _hash_init(A,B,C,D,E,F,G, H CALLER_INFO)
|
||||
my_bool _hash_init(HASH *hash, CHARSET_INFO *charset,
|
||||
uint default_array_elements, uint key_offset,
|
||||
|
@ -49,12 +52,15 @@ my_bool _hash_init(HASH *hash, CHARSET_INFO *charset,
|
|||
void hash_free(HASH *tree);
|
||||
void my_hash_reset(HASH *hash);
|
||||
byte *hash_element(HASH *hash,uint idx);
|
||||
gptr hash_search(HASH *info,const byte *key,uint length);
|
||||
gptr hash_next(HASH *info,const byte *key,uint length);
|
||||
gptr hash_search(const HASH *info, const byte *key, uint length);
|
||||
gptr hash_first(const HASH *info, const byte *key, uint length,
|
||||
HASH_SEARCH_STATE *state);
|
||||
gptr hash_next(const HASH *info, const byte *key, uint length,
|
||||
HASH_SEARCH_STATE *state);
|
||||
my_bool my_hash_insert(HASH *info,const byte *data);
|
||||
my_bool hash_delete(HASH *hash,byte *record);
|
||||
my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length);
|
||||
void hash_replace(HASH *hash, uint idx, byte *new_row);
|
||||
void hash_replace(HASH *hash, HASH_SEARCH_STATE *state, byte *new_row);
|
||||
my_bool hash_check(HASH *hash); /* Only in debug library */
|
||||
|
||||
#define hash_clear(H) bzero((char*) (H),sizeof(*(H)))
|
||||
|
|
|
@ -862,6 +862,7 @@ typedef off_t os_off_t;
|
|||
#define SOCKET_EAGAIN WSAEINPROGRESS
|
||||
#define SOCKET_ETIMEDOUT WSAETIMEDOUT
|
||||
#define SOCKET_EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#define SOCKET_EADDRINUSE WSAEADDRINUSE
|
||||
#define SOCKET_ENFILE ENFILE
|
||||
#define SOCKET_EMFILE EMFILE
|
||||
#elif defined(OS2)
|
||||
|
@ -870,6 +871,7 @@ typedef off_t os_off_t;
|
|||
#define SOCKET_EAGAIN SOCEINPROGRESS
|
||||
#define SOCKET_ETIMEDOUT SOCKET_EINTR
|
||||
#define SOCKET_EWOULDBLOCK SOCEWOULDBLOCK
|
||||
#define SOCKET_EADDRINUSE SOCEADDRINUSE
|
||||
#define SOCKET_ENFILE SOCENFILE
|
||||
#define SOCKET_EMFILE SOCEMFILE
|
||||
#define closesocket(A) soclose(A)
|
||||
|
@ -880,6 +882,7 @@ typedef off_t os_off_t;
|
|||
#define SOCKET_EAGAIN EAGAIN
|
||||
#define SOCKET_ETIMEDOUT SOCKET_EINTR
|
||||
#define SOCKET_EWOULDBLOCK EWOULDBLOCK
|
||||
#define SOCKET_EADDRINUSE EADDRINUSE
|
||||
#define SOCKET_ENFILE ENFILE
|
||||
#define SOCKET_EMFILE EMFILE
|
||||
#endif
|
||||
|
|
35
include/my_user.h
Normal file
35
include/my_user.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/* Copyright (C) 2005 MySQL AB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/*
|
||||
This is a header for libraries containing functions used in both server and
|
||||
only some of clients (but not in libmysql)...
|
||||
*/
|
||||
|
||||
#ifndef _my_user_h_
|
||||
#define _my_user_h_
|
||||
|
||||
#include <my_global.h>
|
||||
|
||||
C_MODE_START
|
||||
|
||||
void parse_user(const char *user_id_str, uint user_id_len,
|
||||
char *user_name_str, uint *user_name_len,
|
||||
char *host_name_str, uint *host_name_len);
|
||||
|
||||
C_MODE_END
|
||||
|
||||
#endif /* _my_user_h_ */
|
|
@ -27,6 +27,14 @@
|
|||
#define SERVER_VERSION_LENGTH 60
|
||||
#define SQLSTATE_LENGTH 5
|
||||
|
||||
/*
|
||||
USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain
|
||||
username and hostname parts of the user identifier with trailing zero in
|
||||
MySQL standard format:
|
||||
user_name_part@host_name_part\0
|
||||
*/
|
||||
#define USER_HOST_BUFF_SIZE HOSTNAME_LENGTH + USERNAME_LENGTH + 2
|
||||
|
||||
#define LOCAL_HOST "localhost"
|
||||
#define LOCAL_HOST_NAMEDPIPE "."
|
||||
|
||||
|
|
|
@ -60,8 +60,8 @@ typedef struct SHA1_CONTEXT
|
|||
|
||||
C_MODE_START
|
||||
|
||||
int sha1_reset( SHA1_CONTEXT* );
|
||||
int sha1_input( SHA1_CONTEXT*, const uint8 *, unsigned int );
|
||||
int sha1_result( SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE] );
|
||||
int mysql_sha1_reset(SHA1_CONTEXT*);
|
||||
int mysql_sha1_input(SHA1_CONTEXT*, const uint8 *, unsigned int);
|
||||
int mysql_sha1_result(SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE]);
|
||||
|
||||
C_MODE_END
|
||||
|
|
|
@ -147,6 +147,15 @@ os_thread_create(
|
|||
"InnoDB: Error: pthread_attr_setstacksize returned %d\n", ret);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
#ifdef __NETWARE__
|
||||
ret = pthread_attr_setstacksize(&attr,
|
||||
(size_t) NW_THD_STACKSIZE);
|
||||
if (ret) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: pthread_attr_setstacksize returned %d\n", ret);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
os_mutex_enter(os_sync_mutex);
|
||||
os_thread_count++;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
target = libmysqlclient_r.la
|
||||
target_defs = -DDONT_USE_RAID -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@
|
||||
LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@ @yassl_libs@
|
||||
LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@
|
||||
|
||||
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
|
||||
$(openssl_includes) $(yassl_includes) @ZLIB_INCLUDES@
|
||||
|
@ -32,7 +32,7 @@ include $(top_srcdir)/libmysql/Makefile.shared
|
|||
libmysql_dir = $(top_srcdir)/libmysql
|
||||
|
||||
libmysqlclient_r_la_SOURCES = $(target_sources)
|
||||
libmysqlclient_r_la_LIBADD = $(target_libadd)
|
||||
libmysqlclient_r_la_LIBADD = $(target_libadd) $(yassl_libs_with_path)
|
||||
libmysqlclient_r_la_LDFLAGS = $(target_ldflags)
|
||||
|
||||
# This is called from the toplevel makefile
|
||||
|
|
|
@ -63,7 +63,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
|
|||
spatial.cc gstream.cc sql_help.cc tztime.cc sql_cursor.cc \
|
||||
sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
|
||||
parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
|
||||
ha_blackhole.cc ha_archive.cc
|
||||
ha_blackhole.cc ha_archive.cc my_user.c
|
||||
|
||||
libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources)
|
||||
libmysqld_a_SOURCES=
|
||||
|
|
|
@ -9,8 +9,8 @@ disable_query_log;
|
|||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
flush tables;
|
||||
@r/have_ndb.require show variables like "have_ndbcluster";
|
||||
# @r/server_id.require show variables like "server_id";
|
||||
--require r/have_ndb.require
|
||||
show variables like "have_ndbcluster";
|
||||
enable_query_log;
|
||||
|
||||
# Check that server2 has NDB support
|
||||
|
@ -20,8 +20,8 @@ disable_query_log;
|
|||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
flush tables;
|
||||
@r/have_ndb.require show variables like "have_ndbcluster";
|
||||
# @r/server_id1.require show variables like "server_id";
|
||||
--require r/have_ndb.require
|
||||
show variables like "have_ndbcluster";
|
||||
enable_query_log;
|
||||
|
||||
# Set the default connection to 'server1'
|
||||
|
|
|
@ -8,7 +8,8 @@ connection slave;
|
|||
--disable_warnings
|
||||
stop slave;
|
||||
--enable_warnings
|
||||
@r/slave-stopped.result show status like 'Slave_running';
|
||||
--require r/slave-stopped.result
|
||||
show status like 'Slave_running';
|
||||
connection master;
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
|
@ -21,7 +22,8 @@ reset slave;
|
|||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
--enable_warnings
|
||||
start slave;
|
||||
@r/slave-running.result show status like 'Slave_running';
|
||||
--require r/slave-running.result
|
||||
show status like 'Slave_running';
|
||||
|
||||
# Set the default connection to 'master'
|
||||
connection master;
|
||||
|
|
|
@ -52,7 +52,6 @@ execute stmt1;
|
|||
|
||||
##### parameter used for keyword like SELECT (must fail)
|
||||
set @arg00='SELECT' ;
|
||||
# mysqltest gives no output for the next statement, Why ??
|
||||
--error 1064
|
||||
@arg00 a from t1 where a=1;
|
||||
--error 1064
|
||||
|
|
|
@ -890,7 +890,14 @@ sub mtr_exit ($) {
|
|||
# cluck("Called mtr_exit()");
|
||||
mtr_timer_stop_all($::glob_timers);
|
||||
local $SIG{HUP} = 'IGNORE';
|
||||
kill('HUP', -$$);
|
||||
# ToDo: Signalling -$$ will only work if we are the process group
|
||||
# leader (in fact on QNX it will signal our session group leader,
|
||||
# which might be Do-compile or Pushbuild, causing tests to be
|
||||
# aborted). So we only do it if we are the group leader. We might
|
||||
# set ourselves as the group leader at startup (with
|
||||
# POSIX::setpgrp(0,0)), but then care must be needed to always do
|
||||
# proper child process cleanup.
|
||||
kill('HUP', -$$) if $$ == getpgrp();
|
||||
sleep 2;
|
||||
exit($code);
|
||||
}
|
||||
|
|
|
@ -152,6 +152,7 @@ our $path_client_bindir;
|
|||
our $path_language;
|
||||
our $path_timefile;
|
||||
our $path_manager_log; # Used by mysqldadmin
|
||||
our $path_mysqltest_log;
|
||||
our $path_slave_load_tmpdir; # What is this?!
|
||||
our $path_my_basedir;
|
||||
our $opt_vardir; # A path but set directly on cmd line
|
||||
|
@ -193,6 +194,9 @@ our $opt_ssl;
|
|||
our $opt_skip_ssl;
|
||||
our $opt_ssl_supported;
|
||||
our $opt_ps_protocol;
|
||||
our $opt_sp_protocol;
|
||||
our $opt_cursor_protocol;
|
||||
our $opt_view_protocol;
|
||||
|
||||
our $opt_current_test;
|
||||
our $opt_ddd;
|
||||
|
@ -268,6 +272,7 @@ our $opt_user;
|
|||
our $opt_user_test;
|
||||
|
||||
our $opt_valgrind;
|
||||
our $opt_valgrind_mysqld;
|
||||
our $opt_valgrind_mysqltest;
|
||||
our $opt_valgrind_all;
|
||||
our $opt_valgrind_options;
|
||||
|
@ -509,6 +514,9 @@ sub command_line_setup () {
|
|||
# Control what engine/variation to run
|
||||
'embedded-server' => \$opt_embedded_server,
|
||||
'ps-protocol' => \$opt_ps_protocol,
|
||||
'sp-protocol' => \$opt_sp_protocol,
|
||||
'view-protocol' => \$opt_view_protocol,
|
||||
'cursor-protocol' => \$opt_cursor_protocol,
|
||||
'ssl|with-openssl' => \$opt_ssl,
|
||||
'skip-ssl' => \$opt_skip_ssl,
|
||||
'compress' => \$opt_compress,
|
||||
|
@ -762,6 +770,7 @@ sub command_line_setup () {
|
|||
# "somestring" option is name/path of valgrind executable
|
||||
|
||||
# Take executable path from any of them, if any
|
||||
$opt_valgrind_mysqld= $opt_valgrind;
|
||||
$opt_valgrind= $opt_valgrind_mysqltest if $opt_valgrind_mysqltest;
|
||||
$opt_valgrind= $opt_valgrind_all if $opt_valgrind_all;
|
||||
|
||||
|
@ -804,6 +813,12 @@ sub command_line_setup () {
|
|||
}
|
||||
}
|
||||
|
||||
# On QNX, /tmp/dir/master.sock and /tmp/dir//master.sock seem to be
|
||||
# considered different, so avoid the extra slash (/) in the socket
|
||||
# paths.
|
||||
my $sockdir = $opt_tmpdir;
|
||||
$sockdir =~ s|/+$||;
|
||||
|
||||
# Put this into a hash, will be a C struct
|
||||
|
||||
$master->[0]=
|
||||
|
@ -812,7 +827,7 @@ sub command_line_setup () {
|
|||
path_myerr => "$opt_vardir/log/master.err",
|
||||
path_mylog => "$opt_vardir/log/master.log",
|
||||
path_mypid => "$opt_vardir/run/master.pid",
|
||||
path_mysock => "$opt_tmpdir/master.sock",
|
||||
path_mysock => "$sockdir/master.sock",
|
||||
path_myport => $opt_master_myport,
|
||||
start_timeout => 400, # enough time create innodb tables
|
||||
|
||||
|
@ -825,7 +840,7 @@ sub command_line_setup () {
|
|||
path_myerr => "$opt_vardir/log/master1.err",
|
||||
path_mylog => "$opt_vardir/log/master1.log",
|
||||
path_mypid => "$opt_vardir/run/master1.pid",
|
||||
path_mysock => "$opt_tmpdir/master1.sock",
|
||||
path_mysock => "$sockdir/master1.sock",
|
||||
path_myport => $opt_master_myport + 1,
|
||||
start_timeout => 400, # enough time create innodb tables
|
||||
};
|
||||
|
@ -836,7 +851,7 @@ sub command_line_setup () {
|
|||
path_myerr => "$opt_vardir/log/slave.err",
|
||||
path_mylog => "$opt_vardir/log/slave.log",
|
||||
path_mypid => "$opt_vardir/run/slave.pid",
|
||||
path_mysock => "$opt_tmpdir/slave.sock",
|
||||
path_mysock => "$sockdir/slave.sock",
|
||||
path_myport => $opt_slave_myport,
|
||||
start_timeout => 400,
|
||||
};
|
||||
|
@ -847,7 +862,7 @@ sub command_line_setup () {
|
|||
path_myerr => "$opt_vardir/log/slave1.err",
|
||||
path_mylog => "$opt_vardir/log/slave1.log",
|
||||
path_mypid => "$opt_vardir/run/slave1.pid",
|
||||
path_mysock => "$opt_tmpdir/slave1.sock",
|
||||
path_mysock => "$sockdir/slave1.sock",
|
||||
path_myport => $opt_slave_myport + 1,
|
||||
start_timeout => 300,
|
||||
};
|
||||
|
@ -858,7 +873,7 @@ sub command_line_setup () {
|
|||
path_myerr => "$opt_vardir/log/slave2.err",
|
||||
path_mylog => "$opt_vardir/log/slave2.log",
|
||||
path_mypid => "$opt_vardir/run/slave2.pid",
|
||||
path_mysock => "$opt_tmpdir/slave2.sock",
|
||||
path_mysock => "$sockdir/slave2.sock",
|
||||
path_myport => $opt_slave_myport + 2,
|
||||
start_timeout => 300,
|
||||
};
|
||||
|
@ -868,7 +883,7 @@ sub command_line_setup () {
|
|||
path_err => "$opt_vardir/log/im.err",
|
||||
path_log => "$opt_vardir/log/im.log",
|
||||
path_pid => "$opt_vardir/run/im.pid",
|
||||
path_sock => "$opt_tmpdir/im.sock",
|
||||
path_sock => "$sockdir/im.sock",
|
||||
port => $im_port,
|
||||
start_timeout => $master->[0]->{'start_timeout'},
|
||||
admin_login => 'im_admin',
|
||||
|
@ -883,7 +898,7 @@ sub command_line_setup () {
|
|||
server_id => 1,
|
||||
port => $im_mysqld1_port,
|
||||
path_datadir => "$opt_vardir/im_mysqld_1.data",
|
||||
path_sock => "$opt_tmpdir/mysqld_1.sock",
|
||||
path_sock => "$sockdir/mysqld_1.sock",
|
||||
path_pid => "$opt_vardir/run/mysqld_1.pid",
|
||||
};
|
||||
|
||||
|
@ -892,7 +907,7 @@ sub command_line_setup () {
|
|||
server_id => 2,
|
||||
port => $im_mysqld2_port,
|
||||
path_datadir => "$opt_vardir/im_mysqld_2.data",
|
||||
path_sock => "$opt_tmpdir/mysqld_2.sock",
|
||||
path_sock => "$sockdir/mysqld_2.sock",
|
||||
path_pid => "$opt_vardir/run/mysqld_2.pid",
|
||||
nonguarded => 1,
|
||||
};
|
||||
|
@ -905,6 +920,7 @@ sub command_line_setup () {
|
|||
}
|
||||
|
||||
$path_timefile= "$opt_vardir/log/mysqltest-time";
|
||||
$path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
|
||||
}
|
||||
|
||||
|
||||
|
@ -949,7 +965,19 @@ sub executable_setup () {
|
|||
}
|
||||
else
|
||||
{
|
||||
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
|
||||
if ( $opt_valgrind_mysqltest )
|
||||
{
|
||||
# client/mysqltest might be a libtool .sh script, so look for real exe
|
||||
# to avoid valgrinding bash ;)
|
||||
$exe_mysqltest=
|
||||
mtr_exe_exists("$path_client_bindir/.libs/lt-mysqltest",
|
||||
"$path_client_bindir/.libs/mysqltest",
|
||||
"$path_client_bindir/mysqltest");
|
||||
}
|
||||
else
|
||||
{
|
||||
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
|
||||
}
|
||||
$exe_mysql_client_test=
|
||||
mtr_exe_exists("$glob_basedir/tests/mysql_client_test",
|
||||
"/usr/bin/false");
|
||||
|
@ -1880,6 +1908,11 @@ sub run_testcase ($) {
|
|||
}
|
||||
report_failure_and_restart($tinfo);
|
||||
}
|
||||
# Save info from this testcase run to mysqltest.log
|
||||
mtr_tofile($path_mysqltest_log,"CURRENT TEST $tname\n");
|
||||
my $testcase_log= mtr_fromfile($path_timefile);
|
||||
mtr_tofile($path_mysqltest_log,
|
||||
$testcase_log);
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
@ -2040,7 +2073,7 @@ sub mysqld_arguments ($$$$$) {
|
|||
mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
|
||||
mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
|
||||
|
||||
if ( defined $opt_valgrind )
|
||||
if ( defined $opt_valgrind_mysqld )
|
||||
{
|
||||
mtr_add_arg($args, "%s--skip-safemalloc", $prefix);
|
||||
mtr_add_arg($args, "%s--skip-bdb", $prefix);
|
||||
|
@ -2266,7 +2299,7 @@ sub mysqld_start ($$$$) {
|
|||
|
||||
mtr_init_args(\$args);
|
||||
|
||||
if ( defined $opt_valgrind )
|
||||
if ( defined $opt_valgrind_mysqld )
|
||||
{
|
||||
valgrind_arguments($args, \$exe);
|
||||
}
|
||||
|
@ -2597,6 +2630,21 @@ sub run_mysqltest ($) {
|
|||
mtr_add_arg($args, "--ps-protocol");
|
||||
}
|
||||
|
||||
if ( $opt_sp_protocol )
|
||||
{
|
||||
mtr_add_arg($args, "--sp-protocol");
|
||||
}
|
||||
|
||||
if ( $opt_view_protocol )
|
||||
{
|
||||
mtr_add_arg($args, "--view-protocol");
|
||||
}
|
||||
|
||||
if ( $opt_cursor_protocol )
|
||||
{
|
||||
mtr_add_arg($args, "--cursor-protocol");
|
||||
}
|
||||
|
||||
if ( $opt_strace_client )
|
||||
{
|
||||
$exe= "strace"; # FIXME there are ktrace, ....
|
||||
|
@ -2705,6 +2753,7 @@ sub valgrind_arguments {
|
|||
mtr_add_arg($args, split(' ', $opt_valgrind_options));
|
||||
}
|
||||
|
||||
|
||||
mtr_add_arg($args, $$exe);
|
||||
|
||||
$$exe= $opt_valgrind || "valgrind";
|
||||
|
@ -2728,6 +2777,10 @@ Options to control what engine/variation to run
|
|||
|
||||
embedded-server Use the embedded server, i.e. no mysqld daemons
|
||||
ps-protocol Use the binary protocol between client and server
|
||||
cursor-protocol Use the cursor protocol between client and server
|
||||
(implies --ps-protocol)
|
||||
view-protocol Create a view to execute all non updating queries
|
||||
sp-protocol Create a stored procedure to execute all queries
|
||||
compress Use the compressed protocol between client and server
|
||||
ssl Use ssl protocol between client and server
|
||||
skip-ssl Dont start sterver with support for ssl connections
|
||||
|
@ -2780,9 +2833,8 @@ Options for coverage, profiling etc
|
|||
|
||||
gcov FIXME
|
||||
gprof FIXME
|
||||
valgrind[=EXE] Run the "mysqltest" executable as well as the "mysqld"
|
||||
server using valgrind, optionally specifying the
|
||||
executable path/name
|
||||
valgrind[=EXE] Run the "mysqld" server using valgrind, optionally
|
||||
specifying the executable path/name
|
||||
valgrind-mysqltest[=EXE] In addition, run the "mysqltest" executable with valgrind
|
||||
valgrind-all[=EXE] Adds verbose flag, and --show-reachable to valgrind
|
||||
valgrind-options=ARGS Extra options to give valgrind
|
||||
|
|
|
@ -110,6 +110,20 @@ wait_for_pid()
|
|||
#$WAIT_PID pid $SLEEP_TIME_FOR_DELETE
|
||||
}
|
||||
|
||||
# Check that valgrind is installed
|
||||
find_valgrind()
|
||||
{
|
||||
FIND_VALGRIND=`which valgrind` # this will print an error if not found
|
||||
# Give good warning to the user and stop
|
||||
if [ -z "$FIND_VALGRIND" ] ; then
|
||||
$ECHO "You need to have the 'valgrind' program in your PATH to run mysql-test-run with option --valgrind. Valgrind's home page is http://valgrind.kde.org ."
|
||||
exit 1
|
||||
fi
|
||||
# >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr
|
||||
valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && FIND_VALGRIND="$FIND_VALGRIND --tool=memcheck"
|
||||
FIND_VALGRIND="$FIND_VALGRIND --alignment=8 --leak-check=yes --num-callers=16 --suppressions=$CWD/valgrind.supp"
|
||||
}
|
||||
|
||||
# No paths below as we can't be sure where the program is!
|
||||
|
||||
SED=sed
|
||||
|
@ -255,7 +269,6 @@ DO_GDB=""
|
|||
MANUAL_GDB=""
|
||||
DO_DDD=""
|
||||
DO_CLIENT_GDB=""
|
||||
DO_VALGRIND_MYSQL_TEST=""
|
||||
SLEEP_TIME_AFTER_RESTART=1
|
||||
SLEEP_TIME_FOR_DELETE=10
|
||||
SLEEP_TIME_FOR_FIRST_MASTER=400 # Enough time to create innodb tables
|
||||
|
@ -470,15 +483,8 @@ while test $# -gt 0; do
|
|||
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
|
||||
;;
|
||||
--valgrind | --valgrind-all)
|
||||
VALGRIND=`which valgrind` # this will print an error if not found
|
||||
# Give good warning to the user and stop
|
||||
if [ -z "$VALGRIND" ] ; then
|
||||
$ECHO "You need to have the 'valgrind' program in your PATH to run mysql-test-run with option --valgrind. Valgrind's home page is http://valgrind.kde.org ."
|
||||
exit 1
|
||||
fi
|
||||
# >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr
|
||||
valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && VALGRIND="$VALGRIND --tool=memcheck"
|
||||
VALGRIND="$VALGRIND --alignment=8 --leak-check=yes --num-callers=16 --suppressions=$CWD/valgrind.supp"
|
||||
find_valgrind;
|
||||
VALGRIND=$FIND_VALGRIND
|
||||
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc --skip-bdb"
|
||||
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc --skip-bdb"
|
||||
SLEEP_TIME_AFTER_RESTART=10
|
||||
|
@ -493,8 +499,13 @@ while test $# -gt 0; do
|
|||
TMP=`$ECHO "$1" | $SED -e "s;--valgrind-options=;;"`
|
||||
VALGRIND="$VALGRIND $TMP"
|
||||
;;
|
||||
--valgrind-mysqltest)
|
||||
DO_VALGRIND_MYSQL_TEST=1
|
||||
--valgrind-mysqltest | --valgrind-mysqltest-all)
|
||||
find_valgrind;
|
||||
VALGRIND_MYSQLTEST=$FIND_VALGRIND
|
||||
if test "$1" = "--valgrind-mysqltest-all"
|
||||
then
|
||||
VALGRIND_MYSQLTEST="$VALGRIND_MYSQLTEST -v --show-reachable=yes"
|
||||
fi
|
||||
;;
|
||||
--skip-ndbcluster | --skip-ndb)
|
||||
USE_NDBCLUSTER=""
|
||||
|
@ -599,7 +610,7 @@ DASH72=`$ECHO '-------------------------------------------------------'|$CUT -c
|
|||
if [ x$SOURCE_DIST = x1 ] ; then
|
||||
if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
|
||||
if [ -f "$BASEDIR/libmysqld/examples/mysqltest_embedded" ] ; then
|
||||
MYSQL_TEST="$VALGRIND $BASEDIR/libmysqld/examples/mysqltest_embedded"
|
||||
MYSQL_TEST="$BASEDIR/libmysqld/examples/mysqltest_embedded"
|
||||
else
|
||||
echo "Fatal error: Cannot find embedded server 'mysqltest_embedded'" 1>&2
|
||||
exit 1
|
||||
|
@ -733,7 +744,7 @@ else
|
|||
fi
|
||||
if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
|
||||
if [ -f "$CLIENT_BINDIR/mysqltest_embedded" ] ; then
|
||||
MYSQL_TEST="$VALGRIND $CLIENT_BINDIR/mysqltest_embedded"
|
||||
MYSQL_TEST="$CLIENT_BINDIR/mysqltest_embedded"
|
||||
else
|
||||
echo "Fatal error: Cannot find embedded server 'mysqltest_embedded'" 1>&2
|
||||
exit 1
|
||||
|
@ -744,7 +755,7 @@ else
|
|||
MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test_embedded"
|
||||
fi
|
||||
else
|
||||
MYSQL_TEST="$VALGRIND_MYSQLTEST $CLIENT_BINDIR/mysqltest"
|
||||
MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
|
||||
MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test"
|
||||
fi
|
||||
fi
|
||||
|
@ -759,10 +770,6 @@ then
|
|||
SLAVE_MYSQLD=$MYSQLD
|
||||
fi
|
||||
|
||||
if [ x$DO_VALGRIND_MYSQL_TEST = x1 ] ; then
|
||||
MYSQL_TEST="$VALGRIND $MYSQL_TEST"
|
||||
fi
|
||||
|
||||
# If we should run all tests cases, we will use a local server for that
|
||||
|
||||
if [ -z "$1" -a -z "$DO_STRESS" ]
|
||||
|
@ -819,7 +826,10 @@ if [ x$USE_TIMER = x1 ] ; then
|
|||
fi
|
||||
MYSQL_TEST_BIN=$MYSQL_TEST
|
||||
MYSQL_TEST="$MYSQL_TEST $MYSQL_TEST_ARGS"
|
||||
|
||||
# Export MYSQL_TEST variable for use from .test files
|
||||
export MYSQL_TEST
|
||||
|
||||
GDB_CLIENT_INIT=$MYSQL_TMP_DIR/gdbinit.client
|
||||
GDB_MASTER_INIT=$MYSQL_TMP_DIR/gdbinit.master
|
||||
GDB_SLAVE_INIT=$MYSQL_TMP_DIR/gdbinit.slave
|
||||
|
@ -829,6 +839,7 @@ GPROF_DIR=$MYSQL_TMP_DIR/gprof
|
|||
GPROF_MASTER=$GPROF_DIR/master.gprof
|
||||
GPROF_SLAVE=$GPROF_DIR/slave.gprof
|
||||
TIMEFILE="$MYSQL_TEST_DIR/var/log/mysqltest-time"
|
||||
MYSQLTEST_LOG="$MYSQL_TEST_DIR/var/log/mysqltest.log"
|
||||
if [ -n "$DO_CLIENT_GDB" -o -n "$DO_GDB" ] ; then
|
||||
XTERM=`which xterm`
|
||||
fi
|
||||
|
@ -991,6 +1002,18 @@ report_stats () {
|
|||
echo "WARNING: Got errors/warnings while running tests. Please examine"
|
||||
echo "$MY_LOG_DIR/warnings for details."
|
||||
fi
|
||||
|
||||
fi # USE_RUNNING_SERVER
|
||||
|
||||
# Check valgrind errors from mysqltest
|
||||
if [ ! -z "$VALGRIND_MYSQLTEST" ]
|
||||
then
|
||||
if $GREP "ERROR SUMMARY" $MYSQLTEST_LOG | $GREP -v "0 errors" > /dev/null
|
||||
then
|
||||
$ECHO "Valgrind detected errors!"
|
||||
$GREP "ERROR SUMMARY" $MYSQLTEST_LOG | $GREP -v "0 errors"
|
||||
$ECHO "See $MYSQLTEST_LOG"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -1770,13 +1793,17 @@ run_testcase ()
|
|||
$RM -f r/$tname.*reject
|
||||
mysql_test_args="-R $result_file $EXTRA_MYSQL_TEST_OPT"
|
||||
if [ -z "$DO_CLIENT_GDB" ] ; then
|
||||
`$MYSQL_TEST $mysql_test_args < $tf 2> $TIMEFILE`;
|
||||
`$VALGRIND_MYSQLTEST $MYSQL_TEST $mysql_test_args < $tf 2> $TIMEFILE`;
|
||||
else
|
||||
do_gdb_test "$mysql_test_args" "$tf"
|
||||
fi
|
||||
|
||||
res=$?
|
||||
|
||||
# Save the testcase log to mysqltest log file
|
||||
echo "CURRENT_TEST: $tname" >> $MYSQLTEST_LOG
|
||||
cat $TIMEFILE >> $MYSQLTEST_LOG
|
||||
|
||||
pname=`$ECHO "$tname "|$CUT -c 1-24`
|
||||
RES="$pname"
|
||||
|
||||
|
|
|
@ -1923,4 +1923,9 @@ d varchar(255) character set utf8,
|
|||
e varchar(255) character set utf8,
|
||||
key (a,b,c,d,e)) engine=bdb;
|
||||
ERROR 42000: Specified key was too long; max key length is 3072 bytes
|
||||
set autocommit=0;
|
||||
create table t1 (a int) engine=bdb;
|
||||
commit;
|
||||
alter table t1 add primary key(a);
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
|
|
|
@ -272,7 +272,6 @@ a b
|
|||
create table if not exists t1 select 3 as 'a',4 as 'b';
|
||||
Warnings:
|
||||
Note 1050 Table 't1' already exists
|
||||
Warning 1364 Field 'a' doesn't have a default value
|
||||
create table if not exists t1 select 3 as 'a',3 as 'b';
|
||||
ERROR 23000: Duplicate entry '3' for key 1
|
||||
select * from t1;
|
||||
|
@ -630,8 +629,6 @@ create table t1 (
|
|||
a varchar(112) charset utf8 collate utf8_bin not null,
|
||||
primary key (a)
|
||||
) select 'test' as a ;
|
||||
Warnings:
|
||||
Warning 1364 Field 'a' doesn't have a default value
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
|
@ -647,9 +644,6 @@ create table t1 (
|
|||
a varchar(12) charset utf8 collate utf8_bin not null,
|
||||
b int not null, primary key (a)
|
||||
) select a, 1 as b from t2 ;
|
||||
Warnings:
|
||||
Warning 1364 Field 'a' doesn't have a default value
|
||||
Warning 1364 Field 'b' doesn't have a default value
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
|
@ -659,12 +653,37 @@ t1 CREATE TABLE `t1` (
|
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a varchar(12) charset utf8 collate utf8_bin not null,
|
||||
b int not null, primary key (a)
|
||||
) select a, 1 as c from t2 ;
|
||||
Warnings:
|
||||
Warning 1364 Field 'b' doesn't have a default value
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`b` int(11) NOT NULL,
|
||||
`a` varchar(12) character set utf8 collate utf8_bin NOT NULL,
|
||||
`c` bigint(1) NOT NULL default '0',
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a varchar(12) charset utf8 collate utf8_bin not null,
|
||||
b int null, primary key (a)
|
||||
) select a, 1 as c from t2 ;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`b` int(11) default NULL,
|
||||
`a` varchar(12) character set utf8 collate utf8_bin NOT NULL,
|
||||
`c` bigint(1) NOT NULL default '0',
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a varchar(12) charset utf8 collate utf8_bin not null,
|
||||
b int not null, primary key (a)
|
||||
) select 'a' as a , 1 as b from t2 ;
|
||||
Warnings:
|
||||
Warning 1364 Field 'a' doesn't have a default value
|
||||
Warning 1364 Field 'b' doesn't have a default value
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
|
@ -677,8 +696,6 @@ create table t1 (
|
|||
a varchar(12) charset utf8 collate utf8_bin,
|
||||
b int not null, primary key (a)
|
||||
) select 'a' as a , 1 as b from t2 ;
|
||||
Warnings:
|
||||
Warning 1364 Field 'b' doesn't have a default value
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
|
@ -697,8 +714,6 @@ a1 varchar(12) charset utf8 collate utf8_bin not null,
|
|||
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
|
||||
primary key (a1)
|
||||
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
|
||||
Warnings:
|
||||
Warning 1364 Field 'a1' doesn't have a default value
|
||||
drop table t2;
|
||||
create table t2 (
|
||||
a1 varchar(12) charset utf8 collate utf8_bin,
|
||||
|
@ -714,8 +729,6 @@ a1 varchar(12) charset utf8 collate utf8_bin not null,
|
|||
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
|
||||
primary key (a1)
|
||||
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
|
||||
Warnings:
|
||||
Warning 1364 Field 'a1' doesn't have a default value
|
||||
drop table t2;
|
||||
create table t2 ( a int default 3, b int default 3)
|
||||
select a1,a2 from t1;
|
||||
|
|
|
@ -1058,6 +1058,14 @@ char(a)
|
|||
1
|
||||
2
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (t TINYTEXT CHARACTER SET utf8);
|
||||
INSERT INTO t1 VALUES(REPEAT('a', 100));
|
||||
CREATE TEMPORARY TABLE t2 SELECT COALESCE(t) AS bug FROM t1;
|
||||
SELECT LENGTH(bug) FROM t2;
|
||||
LENGTH(bug)
|
||||
100
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8;
|
||||
INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa');
|
||||
SELECT id FROM t1;
|
||||
|
|
|
@ -615,3 +615,12 @@ show grants for root@localhost;
|
|||
Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
||||
set names latin1;
|
||||
create user mysqltest_7@;
|
||||
set password for mysqltest_7@ = password('systpass');
|
||||
show grants for mysqltest_7@;
|
||||
Grants for mysqltest_7@
|
||||
GRANT USAGE ON *.* TO 'mysqltest_7'@'' IDENTIFIED BY PASSWORD '*2FB071A056F9BB745219D9C876814231DAF46517'
|
||||
drop user mysqltest_7@;
|
||||
flush privileges;
|
||||
show grants for mysqltest_7@;
|
||||
ERROR 42000: There is no such grant defined for user 'mysqltest_7' on host ''
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
drop table if exists t1;
|
||||
drop table if exists t1,t3,t4,t5;
|
||||
create table t1 (a int, b char(10), key a(a), key b(a,b));
|
||||
insert into t1 values
|
||||
(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
|
||||
|
|
|
@ -128,6 +128,19 @@ id description c
|
|||
1 test 0
|
||||
2 test2 0
|
||||
drop table t1,t2,t3;
|
||||
CREATE TABLE t1 (a int);
|
||||
INSERT INTO t1 VALUES (3), (4), (1), (3), (1);
|
||||
SELECT SUM(a) FROM t1 GROUP BY a HAVING SUM(a)>0;
|
||||
SUM(a)
|
||||
2
|
||||
6
|
||||
4
|
||||
SELECT SUM(a) FROM t1 GROUP BY a HAVING SUM(a);
|
||||
SUM(a)
|
||||
2
|
||||
6
|
||||
4
|
||||
DROP TABLE t1;
|
||||
create table t1 (col1 int, col2 varchar(5), col_t1 int);
|
||||
create table t2 (col1 int, col2 varchar(5), col_t2 int);
|
||||
create table t3 (col1 int, col2 varchar(5), col_t3 int);
|
||||
|
|
|
@ -384,3 +384,21 @@ max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.ke
|
|||
8186
|
||||
set join_buffer_size= @save_join_buffer_size;
|
||||
drop table t0, t1, t2, t3, t4;
|
||||
CREATE TABLE t1 (
|
||||
cola char(3) not null, colb char(3) not null, filler char(200),
|
||||
key(cola), key(colb)
|
||||
);
|
||||
INSERT INTO t1 VALUES ('foo','bar', 'ZZ'),('fuz','baz', 'ZZ');
|
||||
OPTIMIZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize status OK
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
8704
|
||||
explain select * from t1 WHERE cola = 'foo' AND colb = 'bar';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge cola,colb cola,colb 3,3 NULL 24 Using intersect(cola,colb); Using where
|
||||
explain select * from t1 force index(cola,colb) WHERE cola = 'foo' AND colb = 'bar';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge cola,colb cola,colb 3,3 NULL 24 Using intersect(cola,colb); Using where
|
||||
drop table t1;
|
||||
|
|
|
@ -816,40 +816,34 @@ end if;
|
|||
end|
|
||||
show triggers;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer
|
||||
trg1 INSERT t1
|
||||
begin
|
||||
trg1 INSERT t1 begin
|
||||
if new.j > 10 then
|
||||
set new.j := 10;
|
||||
end if;
|
||||
end BEFORE NULL root@localhost
|
||||
trg2 UPDATE t1
|
||||
begin
|
||||
trg2 UPDATE t1 begin
|
||||
if old.i % 2 = 0 then
|
||||
set new.j := -1;
|
||||
end if;
|
||||
end BEFORE NULL root@localhost
|
||||
trg3 UPDATE t1
|
||||
begin
|
||||
trg3 UPDATE t1 begin
|
||||
if new.j = -1 then
|
||||
set @fired:= "Yes";
|
||||
end if;
|
||||
end AFTER NULL root@localhost
|
||||
select * from information_schema.triggers;
|
||||
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER
|
||||
NULL test trg1 INSERT NULL test t1 0 NULL
|
||||
begin
|
||||
NULL test trg1 INSERT NULL test t1 0 NULL begin
|
||||
if new.j > 10 then
|
||||
set new.j := 10;
|
||||
end if;
|
||||
end ROW BEFORE NULL NULL OLD NEW NULL root@localhost
|
||||
NULL test trg2 UPDATE NULL test t1 0 NULL
|
||||
begin
|
||||
NULL test trg2 UPDATE NULL test t1 0 NULL begin
|
||||
if old.i % 2 = 0 then
|
||||
set new.j := -1;
|
||||
end if;
|
||||
end ROW BEFORE NULL NULL OLD NEW NULL root@localhost
|
||||
NULL test trg3 UPDATE NULL test t1 0 NULL
|
||||
begin
|
||||
NULL test trg3 UPDATE NULL test t1 0 NULL begin
|
||||
if new.j = -1 then
|
||||
set @fired:= "Yes";
|
||||
end if;
|
||||
|
@ -1074,3 +1068,19 @@ character_maximum_length character_octet_length
|
|||
32 32
|
||||
64 64
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (f1 BIGINT, f2 VARCHAR(20), f3 BIGINT);
|
||||
INSERT INTO t1 SET f1 = 1, f2 = 'Schoenenbourg', f3 = 1;
|
||||
CREATE FUNCTION func2() RETURNS BIGINT RETURN 1;
|
||||
CREATE FUNCTION func1() RETURNS BIGINT
|
||||
BEGIN
|
||||
RETURN ( SELECT COUNT(*) FROM INFORMATION_SCHEMA.VIEWS);
|
||||
END//
|
||||
CREATE VIEW v1 AS SELECT 1 FROM t1
|
||||
WHERE f3 = (SELECT func2 ());
|
||||
SELECT func1();
|
||||
func1()
|
||||
1
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
DROP FUNCTION func1;
|
||||
DROP FUNCTION func2;
|
||||
|
|
1
mysql-test/r/init_file.result
Normal file
1
mysql-test/r/init_file.result
Normal file
|
@ -0,0 +1 @@
|
|||
ok
|
|
@ -5,8 +5,6 @@ select ((@id := kill_id) - kill_id) from t1;
|
|||
((@id := kill_id) - kill_id)
|
||||
0
|
||||
kill @id;
|
||||
select 1;
|
||||
Got one of the listed errors
|
||||
select ((@id := kill_id) - kill_id) from t1;
|
||||
((@id := kill_id) - kill_id)
|
||||
0
|
||||
|
|
1
mysql-test/r/mysql_client_test.result
Normal file
1
mysql-test/r/mysql_client_test.result
Normal file
|
@ -0,0 +1 @@
|
|||
ok
|
|
@ -1937,18 +1937,16 @@ end|
|
|||
set sql_mode=default|
|
||||
show triggers like "t1";
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer
|
||||
trg1 INSERT t1
|
||||
begin
|
||||
trg1 INSERT t1 begin
|
||||
if new.a > 10 then
|
||||
set new.a := 10;
|
||||
set new.a := 11;
|
||||
end if;
|
||||
end BEFORE 0000-00-00 00:00:00 root@localhost
|
||||
trg2 UPDATE t1 begin
|
||||
trg2 UPDATE t1 begin
|
||||
if old.a % 2 = 0 then set new.b := 12; end if;
|
||||
end BEFORE 0000-00-00 00:00:00 root@localhost
|
||||
trg3 UPDATE t1
|
||||
begin
|
||||
trg3 UPDATE t1 begin
|
||||
if new.a = -1 then
|
||||
set @fired:= "Yes";
|
||||
end if;
|
||||
|
@ -1986,8 +1984,7 @@ UNLOCK TABLES;
|
|||
/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
|
||||
DELIMITER ;;
|
||||
/*!50003 SET SESSION SQL_MODE="" */;;
|
||||
/*!50003 CREATE TRIGGER `trg1` BEFORE INSERT ON `t1` FOR EACH ROW
|
||||
begin
|
||||
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg1` BEFORE INSERT ON `t1` FOR EACH ROW begin
|
||||
if new.a > 10 then
|
||||
set new.a := 10;
|
||||
set new.a := 11;
|
||||
|
@ -1995,13 +1992,12 @@ end if;
|
|||
end */;;
|
||||
|
||||
/*!50003 SET SESSION SQL_MODE="" */;;
|
||||
/*!50003 CREATE TRIGGER `trg2` BEFORE UPDATE ON `t1` FOR EACH ROW begin
|
||||
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg2` BEFORE UPDATE ON `t1` FOR EACH ROW begin
|
||||
if old.a % 2 = 0 then set new.b := 12; end if;
|
||||
end */;;
|
||||
|
||||
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;;
|
||||
/*!50003 CREATE TRIGGER `trg3` AFTER UPDATE ON `t1` FOR EACH ROW
|
||||
begin
|
||||
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg3` AFTER UPDATE ON `t1` FOR EACH ROW begin
|
||||
if new.a = -1 then
|
||||
set @fired:= "Yes";
|
||||
end if;
|
||||
|
@ -2023,8 +2019,7 @@ UNLOCK TABLES;
|
|||
/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
|
||||
DELIMITER ;;
|
||||
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;;
|
||||
/*!50003 CREATE TRIGGER `trg4` BEFORE INSERT ON `t2` FOR EACH ROW
|
||||
begin
|
||||
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg4` BEFORE INSERT ON `t2` FOR EACH ROW begin
|
||||
if new.a > 10 then
|
||||
set @fired:= "No";
|
||||
end if;
|
||||
|
@ -2096,24 +2091,21 @@ t1
|
|||
t2
|
||||
show triggers;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer
|
||||
trg1 INSERT t1
|
||||
begin
|
||||
trg1 INSERT t1 begin
|
||||
if new.a > 10 then
|
||||
set new.a := 10;
|
||||
set new.a := 11;
|
||||
end if;
|
||||
end BEFORE # root@localhost
|
||||
trg2 UPDATE t1 begin
|
||||
trg2 UPDATE t1 begin
|
||||
if old.a % 2 = 0 then set new.b := 12; end if;
|
||||
end BEFORE # root@localhost
|
||||
trg3 UPDATE t1
|
||||
begin
|
||||
trg3 UPDATE t1 begin
|
||||
if new.a = -1 then
|
||||
set @fired:= "Yes";
|
||||
end if;
|
||||
end AFTER # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER root@localhost
|
||||
trg4 INSERT t2
|
||||
begin
|
||||
trg4 INSERT t2 begin
|
||||
if new.a > 10 then
|
||||
set @fired:= "No";
|
||||
end if;
|
||||
|
@ -2141,7 +2133,7 @@ a2
|
|||
1
|
||||
SHOW TRIGGERS;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer
|
||||
testref INSERT test1 BEGIN
|
||||
testref INSERT test1 BEGIN
|
||||
INSERT INTO test2 SET a2 = NEW.a1; END BEFORE NULL root@localhost
|
||||
SELECT * FROM `test1`;
|
||||
a1
|
||||
|
@ -2376,7 +2368,7 @@ UNLOCK TABLES;
|
|||
/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
|
||||
DELIMITER ;;
|
||||
/*!50003 SET SESSION SQL_MODE="" */;;
|
||||
/*!50003 CREATE TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN
|
||||
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN
|
||||
INSERT INTO `t2 test` SET a2 = NEW.a1; END */;;
|
||||
|
||||
DELIMITER ;
|
||||
|
@ -2532,7 +2524,7 @@ UNLOCK TABLES;
|
|||
/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
|
||||
DELIMITER ;;
|
||||
/*!50003 SET SESSION SQL_MODE="IGNORE_SPACE" */;;
|
||||
/*!50003 CREATE TRIGGER `tr1` BEFORE INSERT ON `t1` FOR EACH ROW BEGIN
|
||||
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `tr1` BEFORE INSERT ON `t1` FOR EACH ROW BEGIN
|
||||
SET new.a = 0;
|
||||
END */;;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
DROP TABLE IF EXISTS t1,t2;
|
||||
DROP TABLE IF EXISTS t1,t2,test1,test2;
|
||||
CREATE TABLE t1 (a int);
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
CREATE TABLE t2 (a int, b int);
|
||||
|
|
|
@ -16,7 +16,7 @@ otto
|
|||
mysqltest: At line 1: query 'select otto from (select 1 as otto) as t1' succeeded - should have failed with sqlstate 42S22...
|
||||
select friedrich from (select 1 as otto) as t1;
|
||||
ERROR 42S22: Unknown column 'friedrich' in 'field list'
|
||||
mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed with wrong sqlstate 42S22 instead of 00000...
|
||||
mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed with wrong sqlstate 42S22: 'Unknown column 'friedrich' in 'field list'', instead of 00000...
|
||||
select otto from (select 1 as otto) as t1;
|
||||
otto
|
||||
1
|
||||
|
@ -133,7 +133,7 @@ ERROR 42S02: Table 'test.t1' doesn't exist
|
|||
select 1146 as "after_!errno_masked_error" ;
|
||||
after_!errno_masked_error
|
||||
1146
|
||||
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146 instead of 1000...
|
||||
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146: 'Table 'test.t1' doesn't exist', instead of 1000...
|
||||
garbage ;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
|
||||
select 1064 as "after_--enable_abort_on_error" ;
|
||||
|
@ -141,7 +141,7 @@ after_--enable_abort_on_error
|
|||
1064
|
||||
select 3 from t1 ;
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146 instead of 1064...
|
||||
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146: 'Table 'test.t1' doesn't exist', instead of 1064...
|
||||
hello
|
||||
hello
|
||||
;;;;;;;;
|
||||
|
@ -149,6 +149,9 @@ hello
|
|||
mysqltest: At line 1: End of line junk detected: "6"
|
||||
mysqltest: At line 1: End of line junk detected: "6"
|
||||
mysqltest: At line 1: Missing delimiter
|
||||
mysqltest: At line 1: End of line junk detected: "sleep 7
|
||||
# Another comment
|
||||
"
|
||||
mysqltest: At line 1: Extra delimiter ";" found
|
||||
mysqltest: At line 1: Extra delimiter ";" found
|
||||
MySQL
|
||||
|
@ -301,6 +304,7 @@ mysqltest: At line 1: End of line junk detected: "1000"
|
|||
mysqltest: At line 1: Missing arguments to system, nothing to do!
|
||||
mysqltest: At line 1: Missing arguments to system, nothing to do!
|
||||
mysqltest: At line 1: system command 'false' failed
|
||||
system command 'NonExistsinfComamdn 2> /dev/null' failed
|
||||
test
|
||||
test2
|
||||
test3
|
||||
|
@ -328,6 +332,7 @@ mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_re
|
|||
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a;'
|
||||
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a'
|
||||
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a '
|
||||
OK
|
||||
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a b c'
|
||||
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a b c '
|
||||
select "a" as col1, "c" as col2;
|
||||
|
@ -350,9 +355,10 @@ mysqltest: At line 1: Missing connection user
|
|||
mysqltest: At line 1: Missing connection user
|
||||
mysqltest: At line 1: Missing connection password
|
||||
mysqltest: At line 1: Missing connection db
|
||||
mysqltest: At line 1: Could not open connection 'con2': Unknown database 'illegal_db'
|
||||
mysqltest: At line 1: Could not open connection 'con2': 1049 Unknown database 'illegal_db'
|
||||
mysqltest: At line 1: Illegal argument for port: 'illegal_port'
|
||||
mysqltest: At line 1: Illegal option to connect: SMTP
|
||||
OK
|
||||
mysqltest: In included file "./var/tmp/con.sql": At line 7: Connection limit exhausted - increase MAX_CONS in mysqltest.c
|
||||
mysqltest: In included file "./var/tmp/con.sql": At line 3: connection 'test_con1' not found in connection pool
|
||||
mysqltest: In included file "./var/tmp/con.sql": At line 2: Connection test_con1 already exists
|
||||
|
@ -391,12 +397,20 @@ root@localhost
|
|||
--------------------------------------------------------------------------------
|
||||
this will be executed
|
||||
this will be executed
|
||||
mysqltest: Result length mismatch
|
||||
mysqltest: The test didn't produce any output
|
||||
Failing multi statement query
|
||||
mysqltest: At line 3: query 'create table t1 (a int primary key);
|
||||
insert into t1 values (1);
|
||||
select 'select-me';
|
||||
insertz 'error query'' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'insertz 'error query'' at line 1
|
||||
drop table t1;
|
||||
mysqltest: At line 3: query 'create table t1 (a int primary key);
|
||||
insert into t1 values (1);
|
||||
select 'select-me';
|
||||
insertz 'error query'' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'insertz 'error query'' at line 1
|
||||
drop table t1;
|
||||
Multi statement using expected error
|
||||
create table t1 (a int primary key);
|
||||
insert into t1 values (1);
|
||||
select 'select-me';
|
||||
|
@ -405,11 +419,4 @@ select-me
|
|||
select-me
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'insertz error query' at line 1
|
||||
drop table t1;
|
||||
create table t1 (a int primary key);
|
||||
insert into t1 values (1);
|
||||
select 'select-me';
|
||||
insertz error query||||
|
||||
select-me
|
||||
select-me
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'insertz error query' at line 1
|
||||
drop table t1;
|
||||
|
|
|
@ -85,6 +85,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
|
|||
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
|
||||
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
|
||||
set @arg00='SELECT' ;
|
||||
@arg00 a from t1 where a=1;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1
|
||||
prepare stmt1 from ' ? a from t1 where a=1 ';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
|
||||
set @arg00=1 ;
|
||||
|
|
|
@ -85,6 +85,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
|
|||
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
|
||||
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
|
||||
set @arg00='SELECT' ;
|
||||
@arg00 a from t1 where a=1;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1
|
||||
prepare stmt1 from ' ? a from t1 where a=1 ';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
|
||||
set @arg00=1 ;
|
||||
|
|
|
@ -86,6 +86,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
|
|||
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
|
||||
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
|
||||
set @arg00='SELECT' ;
|
||||
@arg00 a from t1 where a=1;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1
|
||||
prepare stmt1 from ' ? a from t1 where a=1 ';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
|
||||
set @arg00=1 ;
|
||||
|
|
|
@ -128,6 +128,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
|
|||
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
|
||||
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
|
||||
set @arg00='SELECT' ;
|
||||
@arg00 a from t1 where a=1;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1
|
||||
prepare stmt1 from ' ? a from t1 where a=1 ';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
|
||||
set @arg00=1 ;
|
||||
|
@ -3140,6 +3142,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
|
|||
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
|
||||
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
|
||||
set @arg00='SELECT' ;
|
||||
@arg00 a from t1 where a=1;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1
|
||||
prepare stmt1 from ' ? a from t1 where a=1 ';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
|
||||
set @arg00=1 ;
|
||||
|
|
|
@ -85,6 +85,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
|
|||
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
|
||||
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
|
||||
set @arg00='SELECT' ;
|
||||
@arg00 a from t1 where a=1;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1
|
||||
prepare stmt1 from ' ? a from t1 where a=1 ';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
|
||||
set @arg00=1 ;
|
||||
|
|
|
@ -85,6 +85,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
|
|||
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
|
||||
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
|
||||
set @arg00='SELECT' ;
|
||||
@arg00 a from t1 where a=1;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1
|
||||
prepare stmt1 from ' ? a from t1 where a=1 ';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
|
||||
set @arg00=1 ;
|
||||
|
|
|
@ -1466,12 +1466,12 @@ flush logs;
|
|||
-------- switch to master -------
|
||||
SHOW TRIGGERS;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer
|
||||
trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost
|
||||
trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost
|
||||
|
||||
-------- switch to slave -------
|
||||
SHOW TRIGGERS;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer
|
||||
trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost
|
||||
trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost
|
||||
|
||||
######## DROP TRIGGER trg1 ########
|
||||
|
||||
|
|
28
mysql-test/r/rpl_ignore_revoke.result
Normal file
28
mysql-test/r/rpl_ignore_revoke.result
Normal file
|
@ -0,0 +1,28 @@
|
|||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
|
||||
revoke select on *.* from 'user_foo'@'%';
|
||||
select select_priv from mysql.user where user='user_foo' /* master:must be N */;
|
||||
select_priv
|
||||
N
|
||||
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
|
||||
revoke select on *.* from 'user_foo'@'%';
|
||||
select select_priv from mysql.user where user='user_foo' /* slave:must be N */;
|
||||
select_priv
|
||||
N
|
||||
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
|
||||
select select_priv from mysql.user where user='user_foo' /* slave:must be Y */;
|
||||
select_priv
|
||||
Y
|
||||
revoke select on *.* from 'user_foo';
|
||||
select select_priv from mysql.user where user='user_foo' /* master:must be N */;
|
||||
select_priv
|
||||
N
|
||||
select select_priv from mysql.user where user='user_foo' /* slave:must get Y */;
|
||||
select_priv
|
||||
Y
|
||||
revoke select on *.* FROM 'user_foo';
|
|
@ -57,6 +57,9 @@ insert into t1 values (15);
|
|||
grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1;
|
||||
grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1;
|
||||
grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
create procedure foo4()
|
||||
deterministic
|
||||
begin
|
||||
|
|
|
@ -918,6 +918,11 @@ drop function if exists f5|
|
|||
drop function if exists f6|
|
||||
drop function if exists f7|
|
||||
drop function if exists f8|
|
||||
drop function if exists f9|
|
||||
drop function if exists f10|
|
||||
drop function if exists f11|
|
||||
drop function if exists f12_1|
|
||||
drop function if exists f12_2|
|
||||
drop view if exists v0|
|
||||
drop view if exists v1|
|
||||
drop view if exists v2|
|
||||
|
@ -1097,6 +1102,62 @@ ERROR HY000: Table 't1' was not locked with LOCK TABLES
|
|||
select f4()|
|
||||
ERROR HY000: Table 't2' was not locked with LOCK TABLES
|
||||
unlock tables|
|
||||
create function f9() returns int
|
||||
begin
|
||||
declare a, b int;
|
||||
drop temporary table if exists t3;
|
||||
create temporary table t3 (id int);
|
||||
insert into t3 values (1), (2), (3);
|
||||
set a:= (select count(*) from t3);
|
||||
set b:= (select count(*) from t3 t3_alias);
|
||||
return a + b;
|
||||
end|
|
||||
select f9()|
|
||||
f9()
|
||||
6
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't3'
|
||||
select f9() from t1 limit 1|
|
||||
f9()
|
||||
6
|
||||
create function f10() returns int
|
||||
begin
|
||||
drop temporary table if exists t3;
|
||||
create temporary table t3 (id int);
|
||||
insert into t3 select id from t4;
|
||||
return (select count(*) from t3);
|
||||
end|
|
||||
select f10()|
|
||||
ERROR 42S02: Table 'test.t4' doesn't exist
|
||||
create table t4 as select 1 as id|
|
||||
select f10()|
|
||||
f10()
|
||||
1
|
||||
create function f11() returns int
|
||||
begin
|
||||
drop temporary table if exists t3;
|
||||
create temporary table t3 (id int);
|
||||
insert into t3 values (1), (2), (3);
|
||||
return (select count(*) from t3 as a, t3 as b);
|
||||
end|
|
||||
select f11()|
|
||||
ERROR HY000: Can't reopen table: 'a'
|
||||
select f11() from t1|
|
||||
ERROR HY000: Can't reopen table: 'a'
|
||||
create function f12_1() returns int
|
||||
begin
|
||||
drop temporary table if exists t3;
|
||||
create temporary table t3 (id int);
|
||||
insert into t3 values (1), (2), (3);
|
||||
return f12_2();
|
||||
end|
|
||||
create function f12_2() returns int
|
||||
return (select count(*) from t3)|
|
||||
drop temporary table t3|
|
||||
select f12_1()|
|
||||
ERROR 42S02: Table 'test.t3' doesn't exist
|
||||
select f12_1() from t1 limit 1|
|
||||
ERROR 42S02: Table 'test.t3' doesn't exist
|
||||
drop function f0|
|
||||
drop function f1|
|
||||
drop function f2|
|
||||
|
@ -1106,11 +1167,17 @@ drop function f5|
|
|||
drop function f6|
|
||||
drop function f7|
|
||||
drop function f8|
|
||||
drop function f9|
|
||||
drop function f10|
|
||||
drop function f11|
|
||||
drop function f12_1|
|
||||
drop function f12_2|
|
||||
drop view v0|
|
||||
drop view v1|
|
||||
drop view v2|
|
||||
delete from t1 |
|
||||
delete from t2 |
|
||||
drop table t4|
|
||||
drop table if exists fac|
|
||||
create table fac (n int unsigned not null primary key, f bigint unsigned)|
|
||||
drop procedure if exists ifac|
|
||||
|
|
|
@ -34,7 +34,5 @@ Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'wl2818_trg1'. The
|
|||
|
||||
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
|
||||
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER
|
||||
NULL mysqltest_db1 wl2818_trg1 INSERT NULL mysqltest_db1 t1 0 NULL
|
||||
INSERT INTO t2 VALUES(CURRENT_USER()) ROW BEFORE NULL NULL OLD NEW NULL
|
||||
NULL mysqltest_db1 wl2818_trg2 INSERT NULL mysqltest_db1 t1 0 NULL
|
||||
INSERT INTO t2 VALUES(CURRENT_USER()) ROW AFTER NULL NULL OLD NEW NULL mysqltest_dfn@localhost
|
||||
NULL mysqltest_db1 wl2818_trg1 INSERT NULL mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW BEFORE NULL NULL OLD NEW NULL
|
||||
NULL mysqltest_db1 wl2818_trg2 INSERT NULL mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW AFTER NULL NULL OLD NEW NULL mysqltest_dfn@localhost
|
||||
|
|
|
@ -185,10 +185,8 @@ INSERT INTO t1 VALUES(6);
|
|||
ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||
SHOW TRIGGERS;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer
|
||||
trg1 INSERT t1
|
||||
SET @new_sum = 0 BEFORE NULL mysqltest_inv@localhost
|
||||
trg2 INSERT t1
|
||||
SET @new_sum = 0 AFTER NULL mysqltest_nonexs@localhost
|
||||
trg1 INSERT t1 SET @new_sum = 0 BEFORE NULL mysqltest_inv@localhost
|
||||
trg2 INSERT t1 SET @new_sum = 0 AFTER NULL mysqltest_nonexs@localhost
|
||||
DROP TRIGGER trg1;
|
||||
DROP TRIGGER trg2;
|
||||
CREATE TRIGGER trg1 BEFORE INSERT ON t1
|
||||
|
@ -219,16 +217,11 @@ Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'trg1'. The trigge
|
|||
|
||||
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
|
||||
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER
|
||||
NULL mysqltest_db1 trg1 INSERT NULL mysqltest_db1 t1 0 NULL
|
||||
SET @a = 1 ROW BEFORE NULL NULL OLD NEW NULL
|
||||
NULL mysqltest_db1 trg2 INSERT NULL mysqltest_db1 t1 0 NULL
|
||||
SET @a = 2 ROW AFTER NULL NULL OLD NEW NULL @
|
||||
NULL mysqltest_db1 trg3 UPDATE NULL mysqltest_db1 t1 0 NULL
|
||||
SET @a = 3 ROW BEFORE NULL NULL OLD NEW NULL @abc@def@@
|
||||
NULL mysqltest_db1 trg4 UPDATE NULL mysqltest_db1 t1 0 NULL
|
||||
SET @a = 4 ROW AFTER NULL NULL OLD NEW NULL @hostname
|
||||
NULL mysqltest_db1 trg5 DELETE NULL mysqltest_db1 t1 0 NULL
|
||||
SET @a = 5 ROW BEFORE NULL NULL OLD NEW NULL @abcdef@@@hostname
|
||||
NULL mysqltest_db1 trg1 INSERT NULL mysqltest_db1 t1 0 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW NULL
|
||||
NULL mysqltest_db1 trg2 INSERT NULL mysqltest_db1 t1 0 NULL SET @a = 2 ROW AFTER NULL NULL OLD NEW NULL @
|
||||
NULL mysqltest_db1 trg3 UPDATE NULL mysqltest_db1 t1 0 NULL SET @a = 3 ROW BEFORE NULL NULL OLD NEW NULL @abc@def@@
|
||||
NULL mysqltest_db1 trg4 UPDATE NULL mysqltest_db1 t1 0 NULL SET @a = 4 ROW AFTER NULL NULL OLD NEW NULL @hostname
|
||||
NULL mysqltest_db1 trg5 DELETE NULL mysqltest_db1 t1 0 NULL SET @a = 5 ROW BEFORE NULL NULL OLD NEW NULL @abcdef@@@hostname
|
||||
|
||||
---> connection: default
|
||||
DROP USER mysqltest_dfn@localhost;
|
||||
|
|
|
@ -613,7 +613,7 @@ select @a;
|
|||
show triggers;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer
|
||||
t1_bi INSERT t1 set new."t1 column" = 5 BEFORE # REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI root@localhost
|
||||
t1_af INSERT t1 set @a=10 AFTER # root@localhost
|
||||
t1_af INSERT t1 set @a=10 AFTER # root@localhost
|
||||
drop table t1;
|
||||
set sql_mode="traditional";
|
||||
create table t1 (a date);
|
||||
|
@ -634,7 +634,7 @@ t1 CREATE TABLE `t1` (
|
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
show triggers;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer
|
||||
t1_bi INSERT t1 set new.a = '2004-01-00' BEFORE # root@localhost
|
||||
t1_bi INSERT t1 set new.a = '2004-01-00' BEFORE # root@localhost
|
||||
drop table t1;
|
||||
create table t1 (id int);
|
||||
create trigger t1_ai after insert on t1 for each row flush tables;
|
||||
|
@ -767,8 +767,7 @@ deallocate prepare stmt1;
|
|||
drop procedure p1;
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a int);
|
||||
drop procedure if exists p2;
|
||||
CREATE PROCEDURE `p2`()
|
||||
CREATE PROCEDURE `p1`()
|
||||
begin
|
||||
insert into t1 values (1);
|
||||
end//
|
||||
|
@ -777,8 +776,8 @@ begin
|
|||
declare done int default 0;
|
||||
set done= not done;
|
||||
end//
|
||||
CALL p2();
|
||||
drop procedure p2;
|
||||
CALL p1();
|
||||
drop procedure p1;
|
||||
drop table t1;
|
||||
create trigger t1_bi before insert on test.t1 for each row set @a:=0;
|
||||
ERROR 3D000: No database selected
|
||||
|
|
|
@ -85,27 +85,3 @@ sec_to_time(time_to_sec(t))
|
|||
13:00:00
|
||||
09:00:00
|
||||
drop table t1;
|
||||
SELECT CAST(235959.123456 AS TIME);
|
||||
CAST(235959.123456 AS TIME)
|
||||
23:59:59.123456
|
||||
SELECT CAST(0.235959123456e+6 AS TIME);
|
||||
CAST(0.235959123456e+6 AS TIME)
|
||||
23:59:59.123456
|
||||
SELECT CAST(235959123456e-6 AS TIME);
|
||||
CAST(235959123456e-6 AS TIME)
|
||||
23:59:59.123456
|
||||
SELECT CAST(235959.1234567 AS TIME);
|
||||
CAST(235959.1234567 AS TIME)
|
||||
23:59:59.123456
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '235959.1234567'
|
||||
SELECT CAST(0.2359591234567e6 AS TIME);
|
||||
CAST(0.2359591234567e6 AS TIME)
|
||||
23:59:59.123456
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '235959.1234567'
|
||||
SELECT CAST(0.2359591234567e+30 AS TIME);
|
||||
CAST(0.2359591234567e+30 AS TIME)
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '2.359591234567e+29'
|
||||
|
|
|
@ -2423,6 +2423,9 @@ drop view v1;
|
|||
drop table t1;
|
||||
create table t1(f1 int, f2 int);
|
||||
insert into t1 values (null, 10), (null,2);
|
||||
select f1, sum(f2) from t1 group by f1;
|
||||
f1 sum(f2)
|
||||
NULL 12
|
||||
create view v1 as select * from t1;
|
||||
select f1, sum(f2) from v1 group by f1;
|
||||
f1 sum(f2)
|
||||
|
@ -2472,3 +2475,32 @@ alias1 alias2
|
|||
5 5
|
||||
drop view v2, v1;
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a int PRIMARY KEY, b int);
|
||||
INSERT INTO t1 VALUES (2,20), (3,10), (1,10), (0,30), (5,10);
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
SELECT MAX(a) FROM t1;
|
||||
MAX(a)
|
||||
5
|
||||
SELECT MAX(a) FROM v1;
|
||||
MAX(a)
|
||||
5
|
||||
EXPLAIN SELECT MAX(a) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
EXPLAIN SELECT MAX(a) FROM v1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
SELECT MIN(a) FROM t1;
|
||||
MIN(a)
|
||||
0
|
||||
SELECT MIN(a) FROM v1;
|
||||
MIN(a)
|
||||
0
|
||||
EXPLAIN SELECT MIN(a) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
EXPLAIN SELECT MIN(a) FROM v1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -61,9 +61,7 @@ INSERT INTO t1 VALUES (3359361,406,3359361,'Mustermann Musterfrau',7001,'2000-05
|
|||
INSERT INTO t1 VALUES (3359362,406,3359362,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1509984,2145874,'+','','P',1909154,'MobilComSuper92000D1(Akquise)',NULL,NULL,'MS9ND1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
|
||||
|
||||
# This died because we used the field Kundentyp twice
|
||||
--disable_ps_protocol
|
||||
SELECT ELT(FIELD(kundentyp,'PP','PPA','PG','PGA','FK','FKA','FP','FPA','K','KA','V','VA',''), 'Privat (Private Nutzung)','Privat (Private Nutzung) Sitz im Ausland','Privat (geschaeftliche Nutzung)','Privat (geschaeftliche Nutzung) Sitz im Ausland','Firma (Kapitalgesellschaft)','Firma (Kapitalgesellschaft) Sitz im Ausland','Firma (Personengesellschaft)','Firma (Personengesellschaft) Sitz im Ausland','oeff. rechtl. Koerperschaft','oeff. rechtl. Koerperschaft Sitz im Ausland','Eingetragener Verein','Eingetragener Verein Sitz im Ausland','Typ unbekannt') AS Kundentyp ,kategorie FROM t1 WHERE hdl_nr < 2000000 AND kategorie IN ('Prepaid','Mobilfunk') AND st_klasse = 'Workflow' GROUP BY kundentyp ORDER BY kategorie;
|
||||
--enable_ps_protocol
|
||||
|
||||
drop table t1;
|
||||
|
||||
|
|
|
@ -1010,4 +1010,13 @@ create table t1 (a varchar(255) character set utf8,
|
|||
e varchar(255) character set utf8,
|
||||
key (a,b,c,d,e)) engine=bdb;
|
||||
|
||||
#
|
||||
# Bug #14212: Server crash after COMMIT + ALTER TABLE
|
||||
#
|
||||
set autocommit=0;
|
||||
create table t1 (a int) engine=bdb;
|
||||
commit;
|
||||
alter table t1 add primary key(a);
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
|
|
@ -564,6 +564,22 @@ create table t1 (
|
|||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
--warning 1364
|
||||
create table t1 (
|
||||
a varchar(12) charset utf8 collate utf8_bin not null,
|
||||
b int not null, primary key (a)
|
||||
) select a, 1 as c from t2 ;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
--warning 1364
|
||||
create table t1 (
|
||||
a varchar(12) charset utf8 collate utf8_bin not null,
|
||||
b int null, primary key (a)
|
||||
) select a, 1 as c from t2 ;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
--warning 1364
|
||||
create table t1 (
|
||||
a varchar(12) charset utf8 collate utf8_bin not null,
|
||||
|
|
|
@ -868,6 +868,16 @@ set names utf8;
|
|||
select distinct char(a) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#15581: COALESCE function truncates mutli-byte TINYTEXT values
|
||||
#
|
||||
CREATE TABLE t1 (t TINYTEXT CHARACTER SET utf8);
|
||||
INSERT INTO t1 VALUES(REPEAT('a', 100));
|
||||
CREATE TEMPORARY TABLE t2 SELECT COALESCE(t) AS bug FROM t1;
|
||||
SELECT LENGTH(bug) FROM t2;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
|
|
@ -11,6 +11,4 @@
|
|||
##############################################################################
|
||||
|
||||
sp-goto : GOTO is currently is disabled - will be fixed in the future
|
||||
kill : Unstable test case, bug#9712
|
||||
subselect : Bug#15706
|
||||
type_time : Bug#15805
|
||||
|
|
|
@ -499,4 +499,16 @@ revoke all privileges on
|
|||
show grants for root@localhost;
|
||||
set names latin1;
|
||||
|
||||
#
|
||||
# Bug #15598 Server crashes in specific case during setting new password
|
||||
# - Caused by a user with host ''
|
||||
#
|
||||
create user mysqltest_7@;
|
||||
set password for mysqltest_7@ = password('systpass');
|
||||
show grants for mysqltest_7@;
|
||||
drop user mysqltest_7@;
|
||||
flush privileges; # BUG#16297(flush should be removed when that bug is fixed)
|
||||
--error 1141
|
||||
show grants for mysqltest_7@;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
|
|
@ -596,9 +596,7 @@ drop table t1;
|
|||
|
||||
CREATE TABLE t1 (n int);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
--disable_ps_protocol
|
||||
SELECT n+1 AS n FROM t1 GROUP BY n;
|
||||
--enable_ps_protocol
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
|
@ -623,11 +621,9 @@ insert into t1 values ('aaa', 'bb1'), ('aaa', 'bb2');
|
|||
insert into t2 values ('aaa', 'bb1'), ('aaa', 'bb2');
|
||||
|
||||
# query with ambiguous column reference 'c2'
|
||||
--disable_ps_protocol
|
||||
select t1.c1 as c2 from t1, t2 where t1.c2 = t2.c4
|
||||
group by c2;
|
||||
show warnings;
|
||||
--enable_ps_protocol
|
||||
|
||||
# this query has no ambiguity
|
||||
select t1.c1 as c2 from t1, t2 where t1.c2 = t2.c4
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop table if exists t1,t3,t4,t5;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (a int, b char(10), key a(a), key b(a,b));
|
||||
|
|
|
@ -123,6 +123,18 @@ group by a.id, a.description
|
|||
having (a.description is not null) and (c=0);
|
||||
drop table t1,t2,t3;
|
||||
|
||||
#
|
||||
# Bug #14274: HAVING clause containing only set function
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int);
|
||||
INSERT INTO t1 VALUES (3), (4), (1), (3), (1);
|
||||
|
||||
SELECT SUM(a) FROM t1 GROUP BY a HAVING SUM(a)>0;
|
||||
SELECT SUM(a) FROM t1 GROUP BY a HAVING SUM(a);
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
|
|
@ -327,3 +327,33 @@ set join_buffer_size= @save_join_buffer_size;
|
|||
|
||||
drop table t0, t1, t2, t3, t4;
|
||||
|
||||
# BUG#16166
|
||||
CREATE TABLE t1 (
|
||||
cola char(3) not null, colb char(3) not null, filler char(200),
|
||||
key(cola), key(colb)
|
||||
);
|
||||
INSERT INTO t1 VALUES ('foo','bar', 'ZZ'),('fuz','baz', 'ZZ');
|
||||
|
||||
--disable_query_log
|
||||
let $1=9;
|
||||
while ($1)
|
||||
{
|
||||
eval INSERT INTO t1 SELECT * from t1 WHERE cola = 'foo';
|
||||
dec $1;
|
||||
}
|
||||
|
||||
let $1=13;
|
||||
while ($1)
|
||||
{
|
||||
eval INSERT INTO t1 SELECT * from t1 WHERE cola <> 'foo';
|
||||
dec $1;
|
||||
}
|
||||
|
||||
--enable_query_log
|
||||
|
||||
OPTIMIZE TABLE t1;
|
||||
select count(*) from t1;
|
||||
explain select * from t1 WHERE cola = 'foo' AND colb = 'bar';
|
||||
explain select * from t1 force index(cola,colb) WHERE cola = 'foo' AND colb = 'bar';
|
||||
drop table t1;
|
||||
|
||||
|
|
|
@ -767,3 +767,26 @@ create table t1(f1 binary(32), f2 varbinary(64));
|
|||
select character_maximum_length, character_octet_length
|
||||
from information_schema.columns where table_name='t1';
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#15533 crash, information_schema, function, view
|
||||
#
|
||||
CREATE TABLE t1 (f1 BIGINT, f2 VARCHAR(20), f3 BIGINT);
|
||||
INSERT INTO t1 SET f1 = 1, f2 = 'Schoenenbourg', f3 = 1;
|
||||
|
||||
CREATE FUNCTION func2() RETURNS BIGINT RETURN 1;
|
||||
|
||||
delimiter //;
|
||||
CREATE FUNCTION func1() RETURNS BIGINT
|
||||
BEGIN
|
||||
RETURN ( SELECT COUNT(*) FROM INFORMATION_SCHEMA.VIEWS);
|
||||
END//
|
||||
delimiter ;//
|
||||
|
||||
CREATE VIEW v1 AS SELECT 1 FROM t1
|
||||
WHERE f3 = (SELECT func2 ());
|
||||
SELECT func1();
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
DROP FUNCTION func1;
|
||||
DROP FUNCTION func2;
|
||||
|
|
|
@ -7,3 +7,4 @@
|
|||
#
|
||||
|
||||
# End of 4.1 tests
|
||||
echo ok;
|
||||
|
|
|
@ -25,11 +25,18 @@ select ((@id := kill_id) - kill_id) from t1;
|
|||
kill @id;
|
||||
|
||||
connection con1;
|
||||
--sleep 1
|
||||
--sleep 2
|
||||
|
||||
# this statement should fail
|
||||
--error 2006,2013
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
# One of the following statements should fail
|
||||
--error 0,2006,2013
|
||||
select 1;
|
||||
--error 0,2006,2013
|
||||
select 1;
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
|
||||
--enable_reconnect
|
||||
# this should work, and we should have a new connection_id()
|
||||
select ((@id := kill_id) - kill_id) from t1;
|
||||
|
|
|
@ -10,3 +10,5 @@
|
|||
--exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M
|
||||
|
||||
# End of 4.1 tests
|
||||
echo ok;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
DROP TABLE IF EXISTS t1,t2,test1,test2;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
|
|
|
@ -364,6 +364,15 @@ select 3 from t1 ;
|
|||
--error 1
|
||||
--exec $MYSQL_TEST < var/tmp/mysqltest.sql 2>&1
|
||||
|
||||
#
|
||||
# Missing delimiter until eof
|
||||
# The comment will be "sucked into" the sleep command since
|
||||
# delimiter is missing
|
||||
--system echo "sleep 7" > var/tmp/mysqltest.sql
|
||||
--system echo "# Another comment" >> var/tmp/mysqltest.sql
|
||||
--error 1
|
||||
--exec $MYSQL_TEST < var/tmp/mysqltest.sql 2>&1
|
||||
|
||||
#
|
||||
# Extra delimiter
|
||||
#
|
||||
|
@ -530,6 +539,42 @@ echo $novar1;
|
|||
--error 1
|
||||
--exec echo "let hi;" | $MYSQL_TEST 2>&1
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test to assign let from query
|
||||
# let $<var_name>=`<query>`;
|
||||
# ----------------------------------------------------------------------------
|
||||
--disable_parsing
|
||||
echo var1;
|
||||
let $var1= `select "hi" as "Col", 1 as "Column1", "hi there" as Col3`;
|
||||
echo $var1;
|
||||
echo $var1_Col;
|
||||
echo $var1_Column1;
|
||||
echo $var1_Col3;
|
||||
|
||||
echo var2;
|
||||
let $var2= `select 2 as "Column num 2"`;
|
||||
echo $var2;
|
||||
echo $var2_Column num 2;
|
||||
echo $var2_Column;
|
||||
|
||||
echo var2 again;
|
||||
let $var2= `select 2 as "Column num 2"`;
|
||||
echo $var2;
|
||||
echo $var2_Column num 2;
|
||||
echo $var2_Column_num_2;
|
||||
echo $var2_Column;
|
||||
|
||||
echo var3 two columns with same name;
|
||||
let $var3= `select 1 as "Col", 2 as "Col", 3 as "var3"`;
|
||||
echo $var3;
|
||||
echo $var3_Col;
|
||||
echo $var3_Col;
|
||||
echo $var3_var3;
|
||||
|
||||
#echo failing query in let;
|
||||
#--error 1
|
||||
#--exec echo "let $var2= `failing query;`" | $MYSQL_TEST 2>&1
|
||||
--enable_parsing
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test source command
|
||||
# ----------------------------------------------------------------------------
|
||||
|
@ -680,7 +725,7 @@ system echo "hej" > /dev/null;
|
|||
--exec echo "system false;" | $MYSQL_TEST 2>&1
|
||||
|
||||
--disable_abort_on_error
|
||||
system NonExistsinfComamdn;
|
||||
system NonExistsinfComamdn 2> /dev/null;
|
||||
--enable_abort_on_error
|
||||
|
||||
|
||||
|
@ -728,20 +773,20 @@ while ($i)
|
|||
--error 1
|
||||
--exec echo "{;" | $MYSQL_TEST 2>&1
|
||||
|
||||
--system echo "while (0)" > var/log/mysqltest.sql
|
||||
--system echo "echo hej;" >> var/log/mysqltest.sql
|
||||
--system echo "while (0)" > var/tmp/mysqltest.sql
|
||||
--system echo "echo hej;" >> var/tmp/mysqltest.sql
|
||||
--error 1
|
||||
--exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1
|
||||
--exec $MYSQL_TEST < var/tmp/mysqltest.sql 2>&1
|
||||
|
||||
--system echo "while (0)" > var/log/mysqltest.sql
|
||||
--system echo "{echo hej;" >> var/log/mysqltest.sql
|
||||
--system echo "while (0)" > var/tmp/mysqltest.sql
|
||||
--system echo "{echo hej;" >> var/tmp/mysqltest.sql
|
||||
--error 1
|
||||
--exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1
|
||||
--exec $MYSQL_TEST < var/tmp/mysqltest.sql 2>&1
|
||||
|
||||
--system echo "while (0){" > var/log/mysqltest.sql
|
||||
--system echo "echo hej;" >> var/log/mysqltest.sql
|
||||
--system echo "while (0){" > var/tmp/mysqltest.sql
|
||||
--system echo "echo hej;" >> var/tmp/mysqltest.sql
|
||||
--error 1
|
||||
--exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1
|
||||
--exec $MYSQL_TEST < var/tmp/mysqltest.sql 2>&1
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test error messages returned from comments starting with a command
|
||||
|
@ -769,7 +814,7 @@ select "a" as col1, "c" as col2;
|
|||
--exec echo "replace_result a;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "replace_result a ;" | $MYSQL_TEST 2>&1
|
||||
--exec echo "replace_result a b;" | $MYSQL_TEST 2>&1
|
||||
--exec echo "replace_result a b; echo OK;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "--replace_result a b c" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
|
@ -839,7 +884,7 @@ select "a" as col1, "c" as col2;
|
|||
--exec echo " disconnect test_con1; " >> var/tmp/con.sql
|
||||
--exec echo " dec \$i; " >> var/tmp/con.sql
|
||||
--exec echo "}" >> var/tmp/con.sql
|
||||
--exec echo "source var/tmp/con.sql;" | $MYSQL_TEST 2>&1
|
||||
--exec echo "source var/tmp/con.sql; echo OK;" | $MYSQL_TEST 2>&1
|
||||
|
||||
# Repeat connect/disconnect, exceed max number of connections
|
||||
--exec echo "let \$i=200;" > var/tmp/con.sql
|
||||
|
@ -946,13 +991,36 @@ select "this will not be executed";
|
|||
select "this will be executed";
|
||||
--enable_query_log
|
||||
|
||||
#
|
||||
# Test zero length result file. Should not pass
|
||||
#
|
||||
--exec touch $MYSQL_TEST_DIR/var/tmp/zero_length_file.result
|
||||
--exec echo "echo ok;" > $MYSQL_TEST_DIR/var/tmp/query.sql
|
||||
--error 1
|
||||
--exec $MYSQL_TEST -x var/tmp/query.sql -R var/tmp/zero_length_file.result 2>&1
|
||||
#
|
||||
# Test that a test file that does not generate any output fails.
|
||||
#
|
||||
--exec echo "let \$i= 1;" > $MYSQL_TEST_DIR/var/tmp/query.sql
|
||||
--error 1
|
||||
--exec $MYSQL_TEST -x var/tmp/query.sql 2>&1
|
||||
|
||||
#
|
||||
# Test that mysqltest fails when there are no queries executed
|
||||
# but a result file exist
|
||||
# NOTE! This will never happen as long as it's not allowed to have
|
||||
# test files that does not produce any output
|
||||
#--exec echo "something" > $MYSQL_TEST_DIR/var/tmp/result_file.result
|
||||
#--exec echo "let \$i= 1;" > $MYSQL_TEST_DIR/var/tmp/query.sql
|
||||
#--error 1
|
||||
#--exec $MYSQL_TEST -x var/tmp/query.sql -R var/tmp/result_file.result 2>&1
|
||||
|
||||
#
|
||||
# Bug #11731 mysqltest in multi-statement queries ignores errors in
|
||||
# non-1st queries
|
||||
#
|
||||
|
||||
# Failing multi statement query
|
||||
echo Failing multi statement query;
|
||||
# PS does not support multi statement
|
||||
--exec echo "--disable_ps_protocol" > var/tmp/bug11731.sql
|
||||
--exec echo "delimiter ||||;" >> var/tmp/bug11731.sql
|
||||
|
@ -967,14 +1035,13 @@ select "this will be executed";
|
|||
drop table t1;
|
||||
|
||||
--error 1
|
||||
--exec $MYSQL_TEST --record -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql -R $MYSQL_TEST_DIR/var/tmp/bug11731.out
|
||||
# The .out file should be empty
|
||||
--error 1
|
||||
--exec test -s $MYSQL_TEST_DIR/var/tmp/bug11731.out
|
||||
--exec $MYSQL_TEST --record -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql -R $MYSQL_TEST_DIR/var/tmp/bug11731.out 2>&1
|
||||
# The .out file should be non existent
|
||||
--exec test ! -s $MYSQL_TEST_DIR/var/tmp/bug11731.out
|
||||
drop table t1;
|
||||
|
||||
|
||||
# Using expected error
|
||||
echo Multi statement using expected error;
|
||||
# PS does not support multi statement
|
||||
--exec echo "--disable_ps_protocol" > var/tmp/bug11731.sql
|
||||
--exec echo "delimiter ||||;" >> var/tmp/bug11731.sql
|
||||
|
@ -986,12 +1053,12 @@ drop table t1;
|
|||
--exec echo "delimiter ;||||" >> var/tmp/bug11731.sql
|
||||
|
||||
# These two should work since the error is expected
|
||||
--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql 2>&1
|
||||
--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql 2>&1
|
||||
drop table t1;
|
||||
|
||||
--exec $MYSQL_TEST --record -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql -R $MYSQL_TEST_DIR/var/tmp/bug11731.out
|
||||
--exec cat $MYSQL_TEST_DIR/var/tmp/bug11731.out
|
||||
--exec $MYSQL_TEST --record -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql -R $MYSQL_TEST_DIR/var/tmp/bug11731.out 2>&1
|
||||
# The .out file should exist
|
||||
--exec test -s $MYSQL_TEST_DIR/var/tmp/bug11731.out
|
||||
drop table t1;
|
||||
|
||||
|
||||
|
||||
|
|
1
mysql-test/t/rpl_ignore_revoke-slave.opt
Normal file
1
mysql-test/t/rpl_ignore_revoke-slave.opt
Normal file
|
@ -0,0 +1 @@
|
|||
--replicate-wild-ignore-table=mysql.%
|
43
mysql-test/t/rpl_ignore_revoke.test
Normal file
43
mysql-test/t/rpl_ignore_revoke.test
Normal file
|
@ -0,0 +1,43 @@
|
|||
# test verifies that REVOKE must not be replicated when
|
||||
# slave server starts with --replicate-wild-ignore-table=mysql.%
|
||||
# the option is set in rpl_ignore_revoke-slave.opt
|
||||
# The first part of BUG#9483 for GRANT is checked by
|
||||
# existed specific rpl_ignore_grant test case (BUG#980)
|
||||
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
### CLEAN-UP: create an account and manually duplicate it on the slave
|
||||
|
||||
connection master;
|
||||
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
|
||||
revoke select on *.* from 'user_foo'@'%';
|
||||
select select_priv from mysql.user where user='user_foo' /* master:must be N */;
|
||||
|
||||
sync_slave_with_master;
|
||||
#connection slave;
|
||||
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
|
||||
revoke select on *.* from 'user_foo'@'%';
|
||||
select select_priv from mysql.user where user='user_foo' /* slave:must be N */;
|
||||
|
||||
|
||||
### TEST
|
||||
|
||||
#connection slave;
|
||||
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
|
||||
select select_priv from mysql.user where user='user_foo' /* slave:must be Y */;
|
||||
|
||||
connection master;
|
||||
revoke select on *.* from 'user_foo';
|
||||
select select_priv from mysql.user where user='user_foo' /* master:must be N */;
|
||||
|
||||
sync_slave_with_master;
|
||||
#connection slave;
|
||||
select select_priv from mysql.user where user='user_foo' /* slave:must get Y */;
|
||||
|
||||
### CLEAN-UP
|
||||
|
||||
connection slave;
|
||||
--disable_abort_on_error
|
||||
revoke select on *.* FROM 'user_foo';
|
||||
--enable_abort_on_error
|
|
@ -87,6 +87,14 @@ grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1;
|
|||
grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1;
|
||||
grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1;
|
||||
|
||||
# ToDo: BUG#14931: There is a race between the last grant binlogging, and
|
||||
# the binlogging in the new connection made below, causing sporadic test
|
||||
# failures due to switched statement order in binlog. To fix this we do
|
||||
# SELECT 1 in the first connection before starting the second, ensuring
|
||||
# that binlogging is done in the expected order.
|
||||
# Please remove this SELECT 1 when BUG#14931 is fixed.
|
||||
SELECT 1;
|
||||
|
||||
connect (con1,127.0.0.1,zedjzlcsjhd,,mysqltest1,$MASTER_MYPORT,);
|
||||
connection con1;
|
||||
|
||||
|
|
|
@ -1157,6 +1157,11 @@ drop function if exists f5|
|
|||
drop function if exists f6|
|
||||
drop function if exists f7|
|
||||
drop function if exists f8|
|
||||
drop function if exists f9|
|
||||
drop function if exists f10|
|
||||
drop function if exists f11|
|
||||
drop function if exists f12_1|
|
||||
drop function if exists f12_2|
|
||||
drop view if exists v0|
|
||||
drop view if exists v1|
|
||||
drop view if exists v2|
|
||||
|
@ -1234,8 +1239,6 @@ create function f7() returns int
|
|||
select f6()|
|
||||
select id, f6() from t1|
|
||||
|
||||
# TODO Test temporary table handling
|
||||
|
||||
#
|
||||
# Let us test how new locking work with views
|
||||
#
|
||||
|
@ -1316,6 +1319,73 @@ select * from v1, t1|
|
|||
select f4()|
|
||||
unlock tables|
|
||||
|
||||
# Tests for handling of temporary tables in functions.
|
||||
#
|
||||
# Unlike for permanent tables we should be able to create, use
|
||||
# and drop such tables in functions.
|
||||
#
|
||||
# Simplest function using temporary table. It is also test case for bug
|
||||
# #12198 "Temporary table aliasing does not work inside stored functions"
|
||||
create function f9() returns int
|
||||
begin
|
||||
declare a, b int;
|
||||
drop temporary table if exists t3;
|
||||
create temporary table t3 (id int);
|
||||
insert into t3 values (1), (2), (3);
|
||||
set a:= (select count(*) from t3);
|
||||
set b:= (select count(*) from t3 t3_alias);
|
||||
return a + b;
|
||||
end|
|
||||
# This will emit warning as t3 was not existing before.
|
||||
select f9()|
|
||||
select f9() from t1 limit 1|
|
||||
|
||||
# Function which uses both temporary and permanent tables.
|
||||
create function f10() returns int
|
||||
begin
|
||||
drop temporary table if exists t3;
|
||||
create temporary table t3 (id int);
|
||||
insert into t3 select id from t4;
|
||||
return (select count(*) from t3);
|
||||
end|
|
||||
# Check that we don't ignore completely tables used in function
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select f10()|
|
||||
create table t4 as select 1 as id|
|
||||
select f10()|
|
||||
|
||||
# Practical cases which we don't handle well (yet)
|
||||
#
|
||||
# Function which does not work because of well-known and documented
|
||||
# limitation of MySQL. We can't use the several instances of the
|
||||
# same temporary table in statement.
|
||||
create function f11() returns int
|
||||
begin
|
||||
drop temporary table if exists t3;
|
||||
create temporary table t3 (id int);
|
||||
insert into t3 values (1), (2), (3);
|
||||
return (select count(*) from t3 as a, t3 as b);
|
||||
end|
|
||||
--error ER_CANT_REOPEN_TABLE
|
||||
select f11()|
|
||||
--error ER_CANT_REOPEN_TABLE
|
||||
select f11() from t1|
|
||||
# We don't handle temporary tables used by nested functions well
|
||||
create function f12_1() returns int
|
||||
begin
|
||||
drop temporary table if exists t3;
|
||||
create temporary table t3 (id int);
|
||||
insert into t3 values (1), (2), (3);
|
||||
return f12_2();
|
||||
end|
|
||||
create function f12_2() returns int
|
||||
return (select count(*) from t3)|
|
||||
# We need clean start to get error
|
||||
drop temporary table t3|
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select f12_1()|
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select f12_1() from t1 limit 1|
|
||||
|
||||
# Cleanup
|
||||
drop function f0|
|
||||
|
@ -1327,11 +1397,17 @@ drop function f5|
|
|||
drop function f6|
|
||||
drop function f7|
|
||||
drop function f8|
|
||||
drop function f9|
|
||||
drop function f10|
|
||||
drop function f11|
|
||||
drop function f12_1|
|
||||
drop function f12_2|
|
||||
drop view v0|
|
||||
drop view v1|
|
||||
drop view v2|
|
||||
delete from t1 |
|
||||
delete from t2 |
|
||||
drop table t4|
|
||||
|
||||
# End of non-bug tests
|
||||
|
||||
|
|
|
@ -930,11 +930,8 @@ drop table t1, t2, t3;
|
|||
# operator.
|
||||
#
|
||||
create table t1 (a int);
|
||||
--disable_warnings
|
||||
drop procedure if exists p2;
|
||||
--enable_warnings
|
||||
DELIMITER //;
|
||||
CREATE PROCEDURE `p2`()
|
||||
CREATE PROCEDURE `p1`()
|
||||
begin
|
||||
insert into t1 values (1);
|
||||
end//
|
||||
|
@ -944,8 +941,8 @@ begin
|
|||
set done= not done;
|
||||
end//
|
||||
DELIMITER ;//
|
||||
CALL p2();
|
||||
drop procedure p2;
|
||||
CALL p1();
|
||||
drop procedure p1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
|
|
|
@ -26,13 +26,17 @@ drop table t1;
|
|||
# long fraction part and/or large exponent part.
|
||||
#
|
||||
# These must return normal result:
|
||||
SELECT CAST(235959.123456 AS TIME);
|
||||
SELECT CAST(0.235959123456e+6 AS TIME);
|
||||
SELECT CAST(235959123456e-6 AS TIME);
|
||||
# ##########################################################
|
||||
# To be uncommented after fix BUG #15805
|
||||
# ##########################################################
|
||||
# SELECT CAST(235959.123456 AS TIME);
|
||||
# SELECT CAST(0.235959123456e+6 AS TIME);
|
||||
# SELECT CAST(235959123456e-6 AS TIME);
|
||||
# These must cut fraction part and produce warning:
|
||||
SELECT CAST(235959.1234567 AS TIME);
|
||||
SELECT CAST(0.2359591234567e6 AS TIME);
|
||||
# SELECT CAST(235959.1234567 AS TIME);
|
||||
# SELECT CAST(0.2359591234567e6 AS TIME);
|
||||
# This must return NULL and produce warning:
|
||||
SELECT CAST(0.2359591234567e+30 AS TIME);
|
||||
# SELECT CAST(0.2359591234567e+30 AS TIME);
|
||||
# ##########################################################
|
||||
|
||||
# End of 4.1 tests
|
||||
|
|
|
@ -27,12 +27,9 @@ select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 g
|
|||
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b;
|
||||
explain extended (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
|
||||
(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
|
||||
# PS doesn't work correctly with found_rows: to be fixed
|
||||
--disable_ps_protocol
|
||||
select found_rows();
|
||||
select sql_calc_found_rows a,b from t1 union all select a,b from t2 limit 2;
|
||||
select found_rows();
|
||||
--enable_ps_protocol
|
||||
|
||||
#
|
||||
# Test some error conditions with UNION
|
||||
|
@ -210,27 +207,15 @@ insert into t2 values (3),(4),(5);
|
|||
|
||||
# Test global limits
|
||||
(SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2) LIMIT 1;
|
||||
# PS doesn't work correctly with found_rows: to be fixed
|
||||
--disable_ps_protocol
|
||||
select found_rows();
|
||||
--enable_ps_protocol
|
||||
(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2) LIMIT 2;
|
||||
# PS doesn't work correctly with found_rows: to be fixed
|
||||
--disable_ps_protocol
|
||||
select found_rows();
|
||||
--enable_ps_protocol
|
||||
|
||||
# Test cases where found_rows() should return number of returned rows
|
||||
(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2);
|
||||
# PS doesn't work correctly with found_rows: to be fixed
|
||||
--disable_ps_protocol
|
||||
select found_rows();
|
||||
--enable_ps_protocol
|
||||
(SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2 LIMIT 1);
|
||||
# PS doesn't work correctly with found_rows: to be fixed
|
||||
--disable_ps_protocol
|
||||
select found_rows();
|
||||
--enable_ps_protocol
|
||||
# This used to work in 4.0 but not anymore in 4.1
|
||||
--error 1064
|
||||
(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 1;
|
||||
|
@ -238,15 +223,9 @@ select found_rows();
|
|||
|
||||
# In these case found_rows() should work
|
||||
SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION all SELECT * FROM t2 LIMIT 2;
|
||||
# PS doesn't work correctly with found_rows: to be fixed
|
||||
--disable_ps_protocol
|
||||
select found_rows();
|
||||
--disable_ps_protocol
|
||||
SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION all SELECT * FROM t2 LIMIT 2;
|
||||
# PS doesn't work correctly with found_rows: to be fixed
|
||||
--disable_ps_protocol
|
||||
select found_rows();
|
||||
--disable_ps_protocol
|
||||
|
||||
# The following examples will not be exact
|
||||
SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2;
|
||||
|
|
|
@ -2275,6 +2275,7 @@ drop table t1;
|
|||
#
|
||||
create table t1(f1 int, f2 int);
|
||||
insert into t1 values (null, 10), (null,2);
|
||||
select f1, sum(f2) from t1 group by f1;
|
||||
create view v1 as select * from t1;
|
||||
select f1, sum(f2) from v1 group by f1;
|
||||
drop view v1;
|
||||
|
@ -2338,3 +2339,27 @@ order by v2.receipt_id;
|
|||
|
||||
drop view v2, v1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#16016: MIN/MAX optimization for views
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int PRIMARY KEY, b int);
|
||||
INSERT INTO t1 VALUES (2,20), (3,10), (1,10), (0,30), (5,10);
|
||||
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
|
||||
SELECT MAX(a) FROM t1;
|
||||
SELECT MAX(a) FROM v1;
|
||||
|
||||
EXPLAIN SELECT MAX(a) FROM t1;
|
||||
EXPLAIN SELECT MAX(a) FROM v1;
|
||||
|
||||
SELECT MIN(a) FROM t1;
|
||||
SELECT MIN(a) FROM v1;
|
||||
|
||||
EXPLAIN SELECT MIN(a) FROM t1;
|
||||
EXPLAIN SELECT MIN(a) FROM v1;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
|
60
mysys/hash.c
60
mysys/hash.c
|
@ -36,9 +36,10 @@ typedef struct st_hash_info {
|
|||
|
||||
static uint hash_mask(uint hashnr,uint buffmax,uint maxlength);
|
||||
static void movelink(HASH_LINK *array,uint pos,uint next_link,uint newlink);
|
||||
static int hashcmp(HASH *hash,HASH_LINK *pos,const byte *key,uint length);
|
||||
static int hashcmp(const HASH *hash, HASH_LINK *pos, const byte *key,
|
||||
uint length);
|
||||
|
||||
static uint calc_hash(HASH *hash,const byte *key,uint length)
|
||||
static uint calc_hash(const HASH *hash, const byte *key, uint length)
|
||||
{
|
||||
ulong nr1=1, nr2=4;
|
||||
hash->charset->coll->hash_sort(hash->charset,(uchar*) key,length,&nr1,&nr2);
|
||||
|
@ -63,7 +64,6 @@ _hash_init(HASH *hash,CHARSET_INFO *charset,
|
|||
hash->key_offset=key_offset;
|
||||
hash->key_length=key_length;
|
||||
hash->blength=1;
|
||||
hash->current_record= NO_RECORD; /* For the future */
|
||||
hash->get_key=get_key;
|
||||
hash->free=free_element;
|
||||
hash->flags=flags;
|
||||
|
@ -135,7 +135,6 @@ void my_hash_reset(HASH *hash)
|
|||
reset_dynamic(&hash->array);
|
||||
/* Set row pointers so that the hash can be reused at once */
|
||||
hash->blength= 1;
|
||||
hash->current_record= NO_RECORD;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -147,7 +146,8 @@ void my_hash_reset(HASH *hash)
|
|||
*/
|
||||
|
||||
static inline char*
|
||||
hash_key(HASH *hash,const byte *record,uint *length,my_bool first)
|
||||
hash_key(const HASH *hash, const byte *record, uint *length,
|
||||
my_bool first)
|
||||
{
|
||||
if (hash->get_key)
|
||||
return (*hash->get_key)(record,length,first);
|
||||
|
@ -163,8 +163,8 @@ static uint hash_mask(uint hashnr,uint buffmax,uint maxlength)
|
|||
return (hashnr & ((buffmax >> 1) -1));
|
||||
}
|
||||
|
||||
static uint hash_rec_mask(HASH *hash,HASH_LINK *pos,uint buffmax,
|
||||
uint maxlength)
|
||||
static uint hash_rec_mask(const HASH *hash, HASH_LINK *pos,
|
||||
uint buffmax, uint maxlength)
|
||||
{
|
||||
uint length;
|
||||
byte *key= (byte*) hash_key(hash,pos->data,&length,0);
|
||||
|
@ -186,14 +186,25 @@ unsigned int rec_hashnr(HASH *hash,const byte *record)
|
|||
}
|
||||
|
||||
|
||||
/* Search after a record based on a key */
|
||||
/* Sets info->current_ptr to found record */
|
||||
gptr hash_search(const HASH *hash, const byte *key, uint length)
|
||||
{
|
||||
HASH_SEARCH_STATE state;
|
||||
return hash_first(hash, key, length, &state);
|
||||
}
|
||||
|
||||
gptr hash_search(HASH *hash,const byte *key,uint length)
|
||||
/*
|
||||
Search after a record based on a key
|
||||
|
||||
NOTE
|
||||
Assigns the number of the found record to HASH_SEARCH_STATE state
|
||||
*/
|
||||
|
||||
gptr hash_first(const HASH *hash, const byte *key, uint length,
|
||||
HASH_SEARCH_STATE *current_record)
|
||||
{
|
||||
HASH_LINK *pos;
|
||||
uint flag,idx;
|
||||
DBUG_ENTER("hash_search");
|
||||
DBUG_ENTER("hash_first");
|
||||
|
||||
flag=1;
|
||||
if (hash->records)
|
||||
|
@ -206,7 +217,7 @@ gptr hash_search(HASH *hash,const byte *key,uint length)
|
|||
if (!hashcmp(hash,pos,key,length))
|
||||
{
|
||||
DBUG_PRINT("exit",("found key at %d",idx));
|
||||
hash->current_record= idx;
|
||||
*current_record= idx;
|
||||
DBUG_RETURN (pos->data);
|
||||
}
|
||||
if (flag)
|
||||
|
@ -218,31 +229,32 @@ gptr hash_search(HASH *hash,const byte *key,uint length)
|
|||
}
|
||||
while ((idx=pos->next) != NO_RECORD);
|
||||
}
|
||||
hash->current_record= NO_RECORD;
|
||||
*current_record= NO_RECORD;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
/* Get next record with identical key */
|
||||
/* Can only be called if previous calls was hash_search */
|
||||
|
||||
gptr hash_next(HASH *hash,const byte *key,uint length)
|
||||
gptr hash_next(const HASH *hash, const byte *key, uint length,
|
||||
HASH_SEARCH_STATE *current_record)
|
||||
{
|
||||
HASH_LINK *pos;
|
||||
uint idx;
|
||||
|
||||
if (hash->current_record != NO_RECORD)
|
||||
if (*current_record != NO_RECORD)
|
||||
{
|
||||
HASH_LINK *data=dynamic_element(&hash->array,0,HASH_LINK*);
|
||||
for (idx=data[hash->current_record].next; idx != NO_RECORD ; idx=pos->next)
|
||||
for (idx=data[*current_record].next; idx != NO_RECORD ; idx=pos->next)
|
||||
{
|
||||
pos=data+idx;
|
||||
if (!hashcmp(hash,pos,key,length))
|
||||
{
|
||||
hash->current_record= idx;
|
||||
*current_record= idx;
|
||||
return pos->data;
|
||||
}
|
||||
}
|
||||
hash->current_record=NO_RECORD;
|
||||
*current_record= NO_RECORD;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -281,7 +293,8 @@ static void movelink(HASH_LINK *array,uint find,uint next_link,uint newlink)
|
|||
!= 0 key of record != key
|
||||
*/
|
||||
|
||||
static int hashcmp(HASH *hash,HASH_LINK *pos,const byte *key,uint length)
|
||||
static int hashcmp(const HASH *hash, HASH_LINK *pos, const byte *key,
|
||||
uint length)
|
||||
{
|
||||
uint rec_keylength;
|
||||
byte *rec_key= (byte*) hash_key(hash,pos->data,&rec_keylength,1);
|
||||
|
@ -307,7 +320,6 @@ my_bool my_hash_insert(HASH *info,const byte *record)
|
|||
if (!(empty=(HASH_LINK*) alloc_dynamic(&info->array)))
|
||||
return(TRUE); /* No more memory */
|
||||
|
||||
info->current_record= NO_RECORD;
|
||||
data=dynamic_element(&info->array,0,HASH_LINK*);
|
||||
halfbuff= info->blength >> 1;
|
||||
|
||||
|
@ -450,7 +462,6 @@ my_bool hash_delete(HASH *hash,byte *record)
|
|||
}
|
||||
|
||||
if ( --(hash->records) < hash->blength >> 1) hash->blength>>=1;
|
||||
hash->current_record= NO_RECORD;
|
||||
lastpos=data+hash->records;
|
||||
|
||||
/* Remove link to record */
|
||||
|
@ -543,7 +554,6 @@ my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length)
|
|||
if ((idx=pos->next) == NO_RECORD)
|
||||
DBUG_RETURN(1); /* Not found in links */
|
||||
}
|
||||
hash->current_record= NO_RECORD;
|
||||
org_link= *pos;
|
||||
empty=idx;
|
||||
|
||||
|
@ -593,10 +603,10 @@ byte *hash_element(HASH *hash,uint idx)
|
|||
isn't changed
|
||||
*/
|
||||
|
||||
void hash_replace(HASH *hash, uint idx, byte *new_row)
|
||||
void hash_replace(HASH *hash, HASH_SEARCH_STATE *current_record, byte *new_row)
|
||||
{
|
||||
if (idx != NO_RECORD) /* Safety */
|
||||
dynamic_element(&hash->array,idx,HASH_LINK*)->data=new_row;
|
||||
if (*current_record != NO_RECORD) /* Safety */
|
||||
dynamic_element(&hash->array, *current_record, HASH_LINK*)->data= new_row;
|
||||
}
|
||||
|
||||
|
||||
|
|
16
mysys/sha1.c
16
mysys/sha1.c
|
@ -69,7 +69,7 @@ static void SHA1ProcessMessageBlock(SHA1_CONTEXT*);
|
|||
Initialize SHA1Context
|
||||
|
||||
SYNOPSIS
|
||||
sha1_reset()
|
||||
mysql_sha1_reset()
|
||||
context [in/out] The context to reset.
|
||||
|
||||
DESCRIPTION
|
||||
|
@ -92,7 +92,7 @@ const uint32 sha_const_key[5]=
|
|||
};
|
||||
|
||||
|
||||
int sha1_reset(SHA1_CONTEXT *context)
|
||||
int mysql_sha1_reset(SHA1_CONTEXT *context)
|
||||
{
|
||||
#ifndef DBUG_OFF
|
||||
if (!context)
|
||||
|
@ -119,7 +119,7 @@ int sha1_reset(SHA1_CONTEXT *context)
|
|||
Return the 160-bit message digest into the array provided by the caller
|
||||
|
||||
SYNOPSIS
|
||||
sha1_result()
|
||||
mysql_sha1_result()
|
||||
context [in/out] The context to use to calculate the SHA-1 hash.
|
||||
Message_Digest: [out] Where the digest is returned.
|
||||
|
||||
|
@ -132,8 +132,8 @@ int sha1_reset(SHA1_CONTEXT *context)
|
|||
!= SHA_SUCCESS sha Error Code.
|
||||
*/
|
||||
|
||||
int sha1_result(SHA1_CONTEXT *context,
|
||||
uint8 Message_Digest[SHA1_HASH_SIZE])
|
||||
int mysql_sha1_result(SHA1_CONTEXT *context,
|
||||
uint8 Message_Digest[SHA1_HASH_SIZE])
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -165,7 +165,7 @@ int sha1_result(SHA1_CONTEXT *context,
|
|||
Accepts an array of octets as the next portion of the message.
|
||||
|
||||
SYNOPSIS
|
||||
sha1_input()
|
||||
mysql_sha1_input()
|
||||
context [in/out] The SHA context to update
|
||||
message_array An array of characters representing the next portion
|
||||
of the message.
|
||||
|
@ -176,8 +176,8 @@ int sha1_result(SHA1_CONTEXT *context,
|
|||
!= SHA_SUCCESS sha Error Code.
|
||||
*/
|
||||
|
||||
int sha1_input(SHA1_CONTEXT *context, const uint8 *message_array,
|
||||
unsigned length)
|
||||
int mysql_sha1_input(SHA1_CONTEXT *context, const uint8 *message_array,
|
||||
unsigned length)
|
||||
{
|
||||
if (!length)
|
||||
return SHA_SUCCESS;
|
||||
|
|
|
@ -74,7 +74,7 @@ static int do_test()
|
|||
bzero((char*) key1,sizeof(key1[0])*1000);
|
||||
|
||||
printf("- Creating hash\n");
|
||||
if (hash_init(&hash,recant/2,0,6,0,free_record,0))
|
||||
if (hash_init(&hash, default_charset_info, recant/2, 0, 6, 0, free_record, 0))
|
||||
goto err;
|
||||
printf("- Writing records:\n");
|
||||
|
||||
|
@ -172,15 +172,16 @@ static int do_test()
|
|||
break;
|
||||
if (key1[j] > 1)
|
||||
{
|
||||
HASH_SEARCH_STATE state;
|
||||
printf("- Testing identical read\n");
|
||||
sprintf(key,"%6d",j);
|
||||
pos=1;
|
||||
if (!(recpos=hash_search(&hash,key,0)))
|
||||
if (!(recpos= hash_first(&hash, key, 0, &state)))
|
||||
{
|
||||
printf("can't find key1: \"%s\"\n",key);
|
||||
goto err;
|
||||
}
|
||||
while (hash_next(&hash,key,0) && pos < (ulong) (key1[j]+10))
|
||||
while (hash_next(&hash, key, 0, &state) && pos < (ulong) (key1[j]+10))
|
||||
pos++;
|
||||
if (pos != (ulong) key1[j])
|
||||
{
|
||||
|
@ -189,7 +190,7 @@ static int do_test()
|
|||
}
|
||||
}
|
||||
printf("- Creating output heap-file 2\n");
|
||||
if (hash_init(&hash2,hash.records,0,0,hash2_key,free_record,0))
|
||||
if (hash_init(&hash2, default_charset_info, hash.records, 0, 0, hash2_key, free_record,0))
|
||||
goto err;
|
||||
|
||||
printf("- Copying and removing records\n");
|
||||
|
|
|
@ -7,6 +7,6 @@ ndbapiincludedir = "$(pkgincludedir)/ndb/ndbapi"
|
|||
mgmapiincludedir = "$(pkgincludedir)/ndb/mgmapi"
|
||||
|
||||
INCLUDES = $(INCLUDES_LOC)
|
||||
LDADD = $(top_srcdir)/ndb/src/common/portlib/gcc.cpp $(LDADD_LOC)
|
||||
LDADD = $(LDADD_LOC)
|
||||
DEFS = @DEFS@ @NDB_DEFS@ $(DEFS_LOC) $(NDB_EXTRA_FLAGS)
|
||||
NDB_CXXFLAGS=@ndb_cxxflags_fix@ $(NDB_CXXFLAGS_LOC)
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
noinst_HEADERS = gcc.cpp
|
||||
|
||||
noinst_LTLIBRARIES = libportlib.la
|
||||
|
||||
libportlib_la_SOURCES = \
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
/**
|
||||
* GCC linking problem...
|
||||
*/
|
||||
#if 0
|
||||
extern "C" { int __cxa_pure_virtual() { return 0;} }
|
||||
#endif
|
File diff suppressed because it is too large
Load diff
|
@ -57,7 +57,7 @@ make
|
|||
cp extra/comp_err extra/comp_err.linux
|
||||
cp libmysql/conf_to_src libmysql/conf_to_src.linux
|
||||
#cp libmysql_r/conf_to_src libmysql_r/conf_to_src.linux
|
||||
cp sql/gen_lex_hash sql/gen_lex_hash.linux
|
||||
cp sql/.libs/gen_lex_hash sql/gen_lex_hash.linux
|
||||
cp strings/conf_to_src strings/conf_to_src.linux
|
||||
|
||||
# Delete mysql_version.h
|
||||
|
|
|
@ -258,11 +258,11 @@ void finish_defaults()
|
|||
void read_defaults(arg_list_t *pal)
|
||||
{
|
||||
arg_list_t al;
|
||||
char defaults_file[PATH_MAX];
|
||||
char defaults_file[PATH_MAX];
|
||||
char mydefaults[PATH_MAX];
|
||||
char line[PATH_MAX];
|
||||
FILE *fp;
|
||||
|
||||
|
||||
// defaults output file
|
||||
snprintf(defaults_file, PATH_MAX, "%s/bin/defaults.out", basedir);
|
||||
remove(defaults_file);
|
||||
|
@ -270,7 +270,7 @@ void read_defaults(arg_list_t *pal)
|
|||
// mysqladmin file
|
||||
snprintf(mydefaults, PATH_MAX, "%s/bin/my_print_defaults", basedir);
|
||||
|
||||
// args
|
||||
// args
|
||||
init_args(&al);
|
||||
add_arg(&al, mydefaults);
|
||||
if (default_option[0])
|
||||
|
@ -279,11 +279,11 @@ void read_defaults(arg_list_t *pal)
|
|||
add_arg(&al, "server");
|
||||
add_arg(&al, "mysqld_safe");
|
||||
add_arg(&al, "safe_mysqld");
|
||||
|
||||
|
||||
spawn(mydefaults, &al, TRUE, NULL, defaults_file, NULL);
|
||||
|
||||
|
||||
free_args(&al);
|
||||
|
||||
|
||||
// gather defaults
|
||||
if ((fp= fopen(defaults_file, "r")) != NULL)
|
||||
{
|
||||
|
|
|
@ -447,7 +447,7 @@ All benchmarks takes the following options:
|
|||
--create-options=#
|
||||
Extra argument to all create statements. If you for example want to
|
||||
create all MySQL tables as BDB tables use:
|
||||
--create-options=TYPE=BDB
|
||||
--create-options=ENGINE=BDB
|
||||
|
||||
--database (Default $opt_database)
|
||||
In which database the test tables are created.
|
||||
|
|
|
@ -174,29 +174,29 @@ sub new
|
|||
|
||||
# Some fixes that depends on the environment
|
||||
if (defined($main::opt_create_options) &&
|
||||
$main::opt_create_options =~ /type=heap/i)
|
||||
$main::opt_create_options =~ /engine=heap/i)
|
||||
{
|
||||
$limits{'working_blobs'} = 0; # HEAP tables can't handle BLOB's
|
||||
}
|
||||
if (defined($main::opt_create_options) &&
|
||||
$main::opt_create_options =~ /type=innodb/i)
|
||||
$main::opt_create_options =~ /engine=innodb/i)
|
||||
{
|
||||
$self->{'transactions'} = 1; # Transactions enabled
|
||||
}
|
||||
if (defined($main::opt_create_options) &&
|
||||
$main::opt_create_options =~ /type=ndb/i)
|
||||
$main::opt_create_options =~ /engine=ndb/i)
|
||||
{
|
||||
$self->{'transactions'} = 1; # Transactions enabled
|
||||
$limits{'max_columns'} = 90; # Max number of columns in table
|
||||
$limits{'max_tables'} = 32; # No comments
|
||||
}
|
||||
if (defined($main::opt_create_options) &&
|
||||
$main::opt_create_options =~ /type=bdb/i)
|
||||
$main::opt_create_options =~ /engine=bdb/i)
|
||||
{
|
||||
$self->{'transactions'} = 1; # Transactions enabled
|
||||
}
|
||||
if (defined($main::opt_create_options) &&
|
||||
$main::opt_create_options =~ /type=gemini/i)
|
||||
$main::opt_create_options =~ /engine=gemini/i)
|
||||
{
|
||||
$limits{'working_blobs'} = 0; # Blobs not implemented yet
|
||||
$limits{'max_tables'} = 500;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
## Process this file with automake to create Makefile.in
|
||||
EXTRA_DIST = client.c pack.c my_time.c
|
||||
EXTRA_DIST = client.c pack.c my_time.c my_user.c
|
||||
|
||||
# Don't update the files from bitkeeper
|
||||
%::SCCS/s.%
|
||||
|
|
57
sql-common/my_user.c
Normal file
57
sql-common/my_user.c
Normal file
|
@ -0,0 +1,57 @@
|
|||
/* Copyright (C) 2005 MySQL AB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#include <my_user.h>
|
||||
#include <m_string.h>
|
||||
|
||||
|
||||
/*
|
||||
Parse user value to user name and host name parts.
|
||||
|
||||
SYNOPSIS
|
||||
user_id_str [IN] User value string (the source).
|
||||
user_id_len [IN] Length of the user value.
|
||||
user_name_str [OUT] Buffer to store user name part.
|
||||
Must be not less than USERNAME_LENGTH + 1.
|
||||
user_name_len [OUT] A place to store length of the user name part.
|
||||
host_name_str [OUT] Buffer to store host name part.
|
||||
Must be not less than HOSTNAME_LENGTH + 1.
|
||||
host_name_len [OUT] A place to store length of the host name part.
|
||||
*/
|
||||
|
||||
void parse_user(const char *user_id_str, uint user_id_len,
|
||||
char *user_name_str, uint *user_name_len,
|
||||
char *host_name_str, uint *host_name_len)
|
||||
{
|
||||
char *p= strrchr(user_id_str, '@');
|
||||
|
||||
if (!p)
|
||||
{
|
||||
*user_name_len= 0;
|
||||
*host_name_len= 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*user_name_len= p - user_id_str;
|
||||
*host_name_len= user_id_len - *user_name_len - 1;
|
||||
|
||||
memcpy(user_name_str, user_id_str, *user_name_len);
|
||||
memcpy(host_name_str, p + 1, *host_name_len);
|
||||
}
|
||||
|
||||
user_name_str[*user_name_len]= 0;
|
||||
host_name_str[*host_name_len]= 0;
|
||||
}
|
|
@ -97,7 +97,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
|
|||
stacktrace.c repl_failsafe.h repl_failsafe.cc \
|
||||
sql_olap.cc sql_view.cc \
|
||||
gstream.cc spatial.cc sql_help.cc sql_cursor.cc \
|
||||
tztime.cc my_time.c my_decimal.cc\
|
||||
tztime.cc my_time.c my_user.c my_decimal.cc\
|
||||
sp_head.cc sp_pcontext.cc sp_rcontext.cc sp.cc \
|
||||
sp_cache.cc parse_file.cc sql_trigger.cc \
|
||||
examples/ha_example.cc ha_archive.cc \
|
||||
|
@ -133,6 +133,8 @@ link_sources: mysql_tzinfo_to_sql.cc
|
|||
@LN_CP_F@ $(top_srcdir)/sql-common/client.c client.c
|
||||
rm -f my_time.c
|
||||
@LN_CP_F@ $(top_srcdir)/sql-common/my_time.c my_time.c
|
||||
rm -f my_user.c
|
||||
@LN_CP_F@ $(top_srcdir)/sql-common/my_user.c my_user.c
|
||||
|
||||
mysql_tzinfo_to_sql.o: $(mysql_tzinfo_to_sql_SOURCES)
|
||||
$(CXXCOMPILE) -c $(INCLUDES) -DTZINFO2SQL $<
|
||||
|
|
10
sql/field.cc
10
sql/field.cc
|
@ -6212,8 +6212,8 @@ Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table)
|
|||
This is done to ensure that ALTER TABLE will convert old VARCHAR fields
|
||||
to now VARCHAR fields.
|
||||
*/
|
||||
if (new_field= new Field_varstring(field_length, maybe_null(),
|
||||
field_name, new_table, charset()))
|
||||
if ((new_field= new Field_varstring(field_length, maybe_null(),
|
||||
field_name, new_table, charset())))
|
||||
{
|
||||
/*
|
||||
delayed_insert::get_local_table() needs a ptr copied from old table.
|
||||
|
@ -8981,11 +8981,11 @@ uint32 Field_blob::max_length()
|
|||
switch (packlength)
|
||||
{
|
||||
case 1:
|
||||
return 255;
|
||||
return 255 * field_charset->mbmaxlen;
|
||||
case 2:
|
||||
return 65535;
|
||||
return 65535 * field_charset->mbmaxlen;
|
||||
case 3:
|
||||
return 16777215;
|
||||
return 16777215 * field_charset->mbmaxlen;
|
||||
case 4:
|
||||
return (uint32) 4294967295U;
|
||||
default:
|
||||
|
|
|
@ -2616,8 +2616,7 @@ int ha_federated::stash_remote_error()
|
|||
{
|
||||
DBUG_ENTER("ha_federated::stash_remote_error()");
|
||||
remote_error_number= mysql_errno(mysql);
|
||||
my_snprintf(remote_error_buf, sizeof(remote_error_buf), "%s",
|
||||
mysql_error(mysql));
|
||||
strmake(remote_error_buf, mysql_error(mysql), sizeof(remote_error_buf)-1);
|
||||
DBUG_RETURN(HA_FEDERATED_ERROR_WITH_REMOTE_SYSTEM);
|
||||
}
|
||||
|
||||
|
|
|
@ -300,7 +300,8 @@ Thd_ndb::~Thd_ndb()
|
|||
if (ndb)
|
||||
{
|
||||
#ifndef DBUG_OFF
|
||||
Ndb::Free_list_usage tmp; tmp.m_name= 0;
|
||||
Ndb::Free_list_usage tmp;
|
||||
tmp.m_name= 0;
|
||||
while (ndb->get_free_list_usage(&tmp))
|
||||
{
|
||||
uint leaked= (uint) tmp.m_created - tmp.m_free;
|
||||
|
@ -312,8 +313,8 @@ Thd_ndb::~Thd_ndb()
|
|||
}
|
||||
#endif
|
||||
delete ndb;
|
||||
ndb= NULL;
|
||||
}
|
||||
ndb= NULL;
|
||||
changed_tables.empty();
|
||||
}
|
||||
|
||||
|
@ -3255,6 +3256,10 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
|
|||
if (lock_type != F_UNLCK)
|
||||
{
|
||||
DBUG_PRINT("info", ("lock_type != F_UNLCK"));
|
||||
if (!thd->transaction.on)
|
||||
m_transaction_on= FALSE;
|
||||
else
|
||||
m_transaction_on= thd->variables.ndb_use_transactions;
|
||||
if (!thd_ndb->lock_count++)
|
||||
{
|
||||
PRINT_OPTION_FLAGS(thd);
|
||||
|
@ -3269,7 +3274,8 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
|
|||
ERR_RETURN(ndb->getNdbError());
|
||||
no_uncommitted_rows_reset(thd);
|
||||
thd_ndb->stmt= trans;
|
||||
trans_register_ha(thd, FALSE, &ndbcluster_hton);
|
||||
if (m_transaction_on)
|
||||
trans_register_ha(thd, FALSE, &ndbcluster_hton);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3284,7 +3290,8 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
|
|||
ERR_RETURN(ndb->getNdbError());
|
||||
no_uncommitted_rows_reset(thd);
|
||||
thd_ndb->all= trans;
|
||||
trans_register_ha(thd, TRUE, &ndbcluster_hton);
|
||||
if (m_transaction_on)
|
||||
trans_register_ha(thd, TRUE, &ndbcluster_hton);
|
||||
|
||||
/*
|
||||
If this is the start of a LOCK TABLE, a table look
|
||||
|
@ -3318,10 +3325,6 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
|
|||
m_ha_not_exact_count= !thd->variables.ndb_use_exact_count;
|
||||
m_autoincrement_prefetch=
|
||||
(ha_rows) thd->variables.ndb_autoincrement_prefetch_sz;
|
||||
if (!thd->transaction.on)
|
||||
m_transaction_on= FALSE;
|
||||
else
|
||||
m_transaction_on= thd->variables.ndb_use_transactions;
|
||||
|
||||
m_active_trans= thd_ndb->all ? thd_ndb->all : thd_ndb->stmt;
|
||||
DBUG_ASSERT(m_active_trans);
|
||||
|
@ -4903,7 +4906,8 @@ bool ndbcluster_end()
|
|||
if (g_ndb)
|
||||
{
|
||||
#ifndef DBUG_OFF
|
||||
Ndb::Free_list_usage tmp; tmp.m_name= 0;
|
||||
Ndb::Free_list_usage tmp;
|
||||
tmp.m_name= 0;
|
||||
while (g_ndb->get_free_list_usage(&tmp))
|
||||
{
|
||||
uint leaked= (uint) tmp.m_created - tmp.m_free;
|
||||
|
@ -4915,10 +4919,9 @@ bool ndbcluster_end()
|
|||
}
|
||||
#endif
|
||||
delete g_ndb;
|
||||
g_ndb= NULL;
|
||||
}
|
||||
g_ndb= NULL;
|
||||
if (g_ndb_cluster_connection)
|
||||
delete g_ndb_cluster_connection;
|
||||
delete g_ndb_cluster_connection;
|
||||
g_ndb_cluster_connection= NULL;
|
||||
|
||||
hash_free(&ndbcluster_open_tables);
|
||||
|
@ -7463,7 +7466,8 @@ ndbcluster_show_status(THD* thd)
|
|||
if (have_ndbcluster != SHOW_OPTION_YES)
|
||||
{
|
||||
my_message(ER_NOT_SUPPORTED_YET,
|
||||
"Cannot call SHOW NDBCLUSTER STATUS because skip-ndbcluster is defined",
|
||||
"Cannot call SHOW NDBCLUSTER STATUS because skip-ndbcluster is "
|
||||
"defined",
|
||||
MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
@ -7474,13 +7478,15 @@ ndbcluster_show_status(THD* thd)
|
|||
field_list.push_back(new Item_return_int("free", 10,MYSQL_TYPE_LONG));
|
||||
field_list.push_back(new Item_return_int("sizeof", 10,MYSQL_TYPE_LONG));
|
||||
|
||||
if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
if (protocol->send_fields(&field_list,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
if (get_thd_ndb(thd) && get_thd_ndb(thd)->ndb)
|
||||
{
|
||||
Ndb* ndb= (get_thd_ndb(thd))->ndb;
|
||||
Ndb::Free_list_usage tmp; tmp.m_name= 0;
|
||||
Ndb::Free_list_usage tmp;
|
||||
tmp.m_name= 0;
|
||||
while (ndb->get_free_list_usage(&tmp))
|
||||
{
|
||||
protocol->prepare_for_resend();
|
||||
|
|
|
@ -300,39 +300,56 @@ handler *get_new_handler(TABLE *table, MEM_ROOT *alloc, enum db_type db_type)
|
|||
case DB_TYPE_HASH:
|
||||
return new (alloc) ha_hash(table);
|
||||
#endif
|
||||
case DB_TYPE_MRG_MYISAM:
|
||||
case DB_TYPE_MRG_ISAM:
|
||||
return new (alloc) ha_myisammrg(table);
|
||||
#ifdef HAVE_BERKELEY_DB
|
||||
case DB_TYPE_BERKELEY_DB:
|
||||
return new (alloc) ha_berkeley(table);
|
||||
if (have_berkeley_db == SHOW_OPTION_YES)
|
||||
return new (alloc) ha_berkeley(table);
|
||||
return NULL;
|
||||
#endif
|
||||
#ifdef HAVE_INNOBASE_DB
|
||||
case DB_TYPE_INNODB:
|
||||
return new (alloc) ha_innobase(table);
|
||||
if (have_innodb == SHOW_OPTION_YES)
|
||||
return new (alloc) ha_innobase(table);
|
||||
return NULL;
|
||||
#endif
|
||||
#ifdef HAVE_EXAMPLE_DB
|
||||
case DB_TYPE_EXAMPLE_DB:
|
||||
return new (alloc) ha_example(table);
|
||||
if (have_example_db == SHOW_OPTION_YES)
|
||||
return new (alloc) ha_example(table);
|
||||
return NULL;
|
||||
#endif
|
||||
#if defined(HAVE_ARCHIVE_DB)
|
||||
case DB_TYPE_ARCHIVE_DB:
|
||||
return new (alloc) ha_archive(table);
|
||||
if (have_archive_db == SHOW_OPTION_YES)
|
||||
return new (alloc) ha_archive(table);
|
||||
return NULL;
|
||||
#endif
|
||||
#ifdef HAVE_BLACKHOLE_DB
|
||||
case DB_TYPE_BLACKHOLE_DB:
|
||||
return new (alloc) ha_blackhole(table);
|
||||
if (have_blackhole_db == SHOW_OPTION_YES)
|
||||
return new (alloc) ha_blackhole(table);
|
||||
return NULL;
|
||||
#endif
|
||||
#ifdef HAVE_FEDERATED_DB
|
||||
case DB_TYPE_FEDERATED_DB:
|
||||
return new (alloc) ha_federated(table);
|
||||
if (have_federated_db == SHOW_OPTION_YES)
|
||||
return new (alloc) ha_federated(table);
|
||||
return NULL;
|
||||
#endif
|
||||
#ifdef HAVE_CSV_DB
|
||||
case DB_TYPE_CSV_DB:
|
||||
return new (alloc) ha_tina(table);
|
||||
if (have_csv_db == SHOW_OPTION_YES)
|
||||
return new (alloc) ha_tina(table);
|
||||
return NULL;
|
||||
#endif
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
case DB_TYPE_NDBCLUSTER:
|
||||
return new (alloc) ha_ndbcluster(table);
|
||||
if (have_ndbcluster == SHOW_OPTION_YES)
|
||||
return new (alloc) ha_ndbcluster(table);
|
||||
return NULL;
|
||||
#endif
|
||||
case DB_TYPE_HEAP:
|
||||
return new (alloc) ha_heap(table);
|
||||
|
@ -346,8 +363,6 @@ handler *get_new_handler(TABLE *table, MEM_ROOT *alloc, enum db_type db_type)
|
|||
/* Fall back to MyISAM */
|
||||
case DB_TYPE_MYISAM:
|
||||
return new (alloc) ha_myisam(table);
|
||||
case DB_TYPE_MRG_MYISAM:
|
||||
return new (alloc) ha_myisammrg(table);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1911,7 +1926,8 @@ int ha_enable_transaction(THD *thd, bool on)
|
|||
is an optimization hint that storage engine is free to ignore.
|
||||
So, let's commit an open transaction (if any) now.
|
||||
*/
|
||||
error= end_trans(thd, COMMIT);
|
||||
if (!(error= ha_commit_stmt(thd)))
|
||||
error= end_trans(thd, COMMIT);
|
||||
}
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
|
|
@ -4890,6 +4890,12 @@ int Item_ref::save_in_field(Field *to, bool no_conversions)
|
|||
}
|
||||
|
||||
|
||||
void Item_ref::save_org_in_field(Field *field)
|
||||
{
|
||||
(*ref)->save_org_in_field(field);
|
||||
}
|
||||
|
||||
|
||||
void Item_ref::make_field(Send_field *field)
|
||||
{
|
||||
(*ref)->make_field(field);
|
||||
|
|
|
@ -1745,11 +1745,7 @@ public:
|
|||
void make_field(Send_field *field);
|
||||
bool fix_fields(THD *, Item **);
|
||||
int save_in_field(Field *field, bool no_conversions);
|
||||
void save_org_in_field(Field *field)
|
||||
{
|
||||
(*ref)->save_org_in_field(field);
|
||||
null_value= (*ref)->null_value;
|
||||
}
|
||||
void save_org_in_field(Field *field);
|
||||
enum Item_result result_type () const { return (*ref)->result_type(); }
|
||||
enum_field_types field_type() const { return (*ref)->field_type(); }
|
||||
Field *get_tmp_table_field()
|
||||
|
|
|
@ -153,11 +153,13 @@ String *Item_func_sha::val_str(String *str)
|
|||
SHA1_CONTEXT context; /* Context used to generate SHA1 hash */
|
||||
/* Temporary buffer to store 160bit digest */
|
||||
uint8 digest[SHA1_HASH_SIZE];
|
||||
sha1_reset(&context); /* We do not have to check for error here */
|
||||
mysql_sha1_reset(&context); /* We do not have to check for error here */
|
||||
/* No need to check error as the only case would be too long message */
|
||||
sha1_input(&context,(const unsigned char *) sptr->ptr(), sptr->length());
|
||||
mysql_sha1_input(&context,
|
||||
(const unsigned char *) sptr->ptr(), sptr->length());
|
||||
/* Ensure that memory is free and we got result */
|
||||
if (!( str->alloc(SHA1_HASH_SIZE*2) || (sha1_result(&context,digest))))
|
||||
if (!( str->alloc(SHA1_HASH_SIZE*2) ||
|
||||
(mysql_sha1_result(&context,digest))))
|
||||
{
|
||||
sprintf((char *) str->ptr(),
|
||||
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\
|
||||
|
|
|
@ -723,6 +723,7 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
|
|||
char key[MAX_DBKEY_LENGTH];
|
||||
char *db= table_list->db;
|
||||
uint key_length;
|
||||
HASH_SEARCH_STATE state;
|
||||
DBUG_ENTER("lock_table_name");
|
||||
DBUG_PRINT("enter",("db: %s name: %s", db, table_list->table_name));
|
||||
|
||||
|
@ -733,9 +734,9 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
|
|||
|
||||
|
||||
/* Only insert the table if we haven't insert it already */
|
||||
for (table=(TABLE*) hash_search(&open_cache,(byte*) key,key_length) ;
|
||||
for (table=(TABLE*) hash_first(&open_cache, (byte*)key, key_length, &state);
|
||||
table ;
|
||||
table = (TABLE*) hash_next(&open_cache,(byte*) key,key_length))
|
||||
table = (TABLE*) hash_next(&open_cache, (byte*)key, key_length, &state))
|
||||
if (table->in_use == thd)
|
||||
DBUG_RETURN(0);
|
||||
|
||||
|
|
|
@ -114,13 +114,24 @@ static char *pretty_print_str(char *packet, char *str, int len)
|
|||
|
||||
|
||||
/*
|
||||
slave_load_file_stem()
|
||||
Creates a temporary name for load data infile:
|
||||
|
||||
SYNOPSIS
|
||||
slave_load_file_stem()
|
||||
buf Store new filename here
|
||||
file_id File_id (part of file name)
|
||||
event_server_id Event_id (part of file name)
|
||||
ext Extension for file name
|
||||
|
||||
RETURN
|
||||
Pointer to start of extension
|
||||
*/
|
||||
|
||||
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
|
||||
static inline char* slave_load_file_stem(char*buf, uint file_id,
|
||||
int event_server_id)
|
||||
static char *slave_load_file_stem(char *buf, uint file_id,
|
||||
int event_server_id, const char *ext)
|
||||
{
|
||||
char *res;
|
||||
fn_format(buf,"SQL_LOAD-",slave_load_tmpdir, "", MY_UNPACK_FILENAME);
|
||||
to_unix_path(buf);
|
||||
|
||||
|
@ -129,7 +140,9 @@ static inline char* slave_load_file_stem(char*buf, uint file_id,
|
|||
*buf++ = '-';
|
||||
buf = int10_to_str(event_server_id, buf, 10);
|
||||
*buf++ = '-';
|
||||
return int10_to_str(file_id, buf, 10);
|
||||
res= int10_to_str(file_id, buf, 10);
|
||||
strmov(res, ext); // Add extension last
|
||||
return res; // Pointer to extension
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -901,7 +914,6 @@ void Log_event::print_header(FILE* file, PRINT_EVENT_INFO* print_event_info)
|
|||
/* Pretty-print event common header if header is exactly 19 bytes */
|
||||
if (print_event_info->common_header_len == LOG_EVENT_MINIMAL_HEADER_LEN)
|
||||
{
|
||||
DBUG_ASSERT(hexdump_from == (unsigned long) hexdump_from);
|
||||
fprintf(file, "# Position Timestamp Type Master ID "
|
||||
"Size Master Pos Flags \n");
|
||||
fprintf(file, "# %8.8lx %02x %02x %02x %02x %02x "
|
||||
|
@ -927,7 +939,6 @@ void Log_event::print_header(FILE* file, PRINT_EVENT_INFO* print_event_info)
|
|||
|
||||
if (i % 16 == 15)
|
||||
{
|
||||
DBUG_ASSERT(hexdump_from == (unsigned long) hexdump_from);
|
||||
fprintf(file, "# %8.8lx %-48.48s |%16s|\n",
|
||||
(unsigned long) (hexdump_from + (i & 0xfffffff0)),
|
||||
hex_string, char_string);
|
||||
|
@ -941,12 +952,10 @@ void Log_event::print_header(FILE* file, PRINT_EVENT_INFO* print_event_info)
|
|||
*c= '\0';
|
||||
|
||||
/* Non-full last line */
|
||||
if (hex_string[0]) {
|
||||
DBUG_ASSERT(hexdump_from == (unsigned long) hexdump_from);
|
||||
if (hex_string[0])
|
||||
fprintf(file, "# %8.8lx %-48.48s |%s|\n# ",
|
||||
(unsigned long) (hexdump_from + (i & 0xfffffff0)),
|
||||
hex_string, char_string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4160,16 +4169,15 @@ void Create_file_log_event::pack_info(Protocol *protocol)
|
|||
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
|
||||
int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
|
||||
{
|
||||
char proc_info[17+FN_REFLEN+10], *fname_buf= proc_info+17;
|
||||
char *p;
|
||||
char proc_info[17+FN_REFLEN+10], *fname_buf;
|
||||
char *ext;
|
||||
int fd = -1;
|
||||
IO_CACHE file;
|
||||
int error = 1;
|
||||
|
||||
bzero((char*)&file, sizeof(file));
|
||||
p = slave_load_file_stem(fname_buf, file_id, server_id);
|
||||
strmov(p, ".info"); // strmov takes less code than memcpy
|
||||
strnmov(proc_info, STRING_WITH_LEN("Making temp file ")); // no end 0
|
||||
fname_buf= strmov(proc_info, "Making temp file ");
|
||||
ext= slave_load_file_stem(fname_buf, file_id, server_id, ".info");
|
||||
thd->proc_info= proc_info;
|
||||
my_delete(fname_buf, MYF(0)); // old copy may exist already
|
||||
if ((fd= my_create(fname_buf, CREATE_MODE,
|
||||
|
@ -4178,19 +4186,21 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
|
|||
init_io_cache(&file, fd, IO_SIZE, WRITE_CACHE, (my_off_t)0, 0,
|
||||
MYF(MY_WME|MY_NABP)))
|
||||
{
|
||||
slave_print_error(rli,my_errno, "Error in Create_file event: could not open file '%s'", fname_buf);
|
||||
slave_print_error(rli,my_errno,
|
||||
"Error in Create_file event: could not open file '%s'",
|
||||
fname_buf);
|
||||
goto err;
|
||||
}
|
||||
|
||||
// a trick to avoid allocating another buffer
|
||||
strmov(p, ".data");
|
||||
fname = fname_buf;
|
||||
fname_len = (uint)(p-fname) + 5;
|
||||
fname= fname_buf;
|
||||
fname_len= (uint) (strmov(ext, ".data") - fname);
|
||||
if (write_base(&file))
|
||||
{
|
||||
strmov(p, ".info"); // to have it right in the error message
|
||||
strmov(ext, ".info"); // to have it right in the error message
|
||||
slave_print_error(rli,my_errno,
|
||||
"Error in Create_file event: could not write to file '%s'",
|
||||
"Error in Create_file event: could not write to file "
|
||||
"'%s'",
|
||||
fname_buf);
|
||||
goto err;
|
||||
}
|
||||
|
@ -4203,12 +4213,16 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
|
|||
O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW,
|
||||
MYF(MY_WME))) < 0)
|
||||
{
|
||||
slave_print_error(rli,my_errno, "Error in Create_file event: could not open file '%s'", fname_buf);
|
||||
slave_print_error(rli,my_errno,
|
||||
"Error in Create_file event: could not open file '%s'",
|
||||
fname_buf);
|
||||
goto err;
|
||||
}
|
||||
if (my_write(fd, (byte*) block, block_len, MYF(MY_WME+MY_NABP)))
|
||||
{
|
||||
slave_print_error(rli,my_errno, "Error in Create_file event: write to '%s' failed", fname_buf);
|
||||
slave_print_error(rli,my_errno,
|
||||
"Error in Create_file event: write to '%s' failed",
|
||||
fname_buf);
|
||||
goto err;
|
||||
}
|
||||
error=0; // Everything is ok
|
||||
|
@ -4332,13 +4346,12 @@ int Append_block_log_event::get_create_or_append() const
|
|||
int Append_block_log_event::exec_event(struct st_relay_log_info* rli)
|
||||
{
|
||||
char proc_info[17+FN_REFLEN+10], *fname= proc_info+17;
|
||||
char *p= slave_load_file_stem(fname, file_id, server_id);
|
||||
int fd;
|
||||
int error = 1;
|
||||
DBUG_ENTER("Append_block_log_event::exec_event");
|
||||
|
||||
memcpy(p, ".data", 6);
|
||||
strnmov(proc_info, STRING_WITH_LEN("Making temp file ")); // no end 0
|
||||
fname= strmov(proc_info, "Making temp file ");
|
||||
slave_load_file_stem(fname, file_id, server_id, ".data");
|
||||
thd->proc_info= proc_info;
|
||||
if (get_create_or_append())
|
||||
{
|
||||
|
@ -4464,10 +4477,9 @@ void Delete_file_log_event::pack_info(Protocol *protocol)
|
|||
int Delete_file_log_event::exec_event(struct st_relay_log_info* rli)
|
||||
{
|
||||
char fname[FN_REFLEN+10];
|
||||
char *p= slave_load_file_stem(fname, file_id, server_id);
|
||||
memcpy(p, ".data", 6);
|
||||
char *ext= slave_load_file_stem(fname, file_id, server_id, ".data");
|
||||
(void) my_delete(fname, MYF(MY_WME));
|
||||
memcpy(p, ".info", 6);
|
||||
strmov(ext, ".info");
|
||||
(void) my_delete(fname, MYF(MY_WME));
|
||||
return Log_event::exec_event(rli);
|
||||
}
|
||||
|
@ -4560,19 +4572,21 @@ void Execute_load_log_event::pack_info(Protocol *protocol)
|
|||
int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
|
||||
{
|
||||
char fname[FN_REFLEN+10];
|
||||
char *p= slave_load_file_stem(fname, file_id, server_id);
|
||||
char *ext;
|
||||
int fd;
|
||||
int error = 1;
|
||||
int error= 1;
|
||||
IO_CACHE file;
|
||||
Load_log_event* lev = 0;
|
||||
Load_log_event *lev= 0;
|
||||
|
||||
memcpy(p, ".info", 6);
|
||||
ext= slave_load_file_stem(fname, file_id, server_id, ".info");
|
||||
if ((fd = my_open(fname, O_RDONLY | O_BINARY | O_NOFOLLOW,
|
||||
MYF(MY_WME))) < 0 ||
|
||||
init_io_cache(&file, fd, IO_SIZE, READ_CACHE, (my_off_t)0, 0,
|
||||
MYF(MY_WME|MY_NABP)))
|
||||
{
|
||||
slave_print_error(rli,my_errno, "Error in Exec_load event: could not open file '%s'", fname);
|
||||
slave_print_error(rli,my_errno,
|
||||
"Error in Exec_load event: could not open file '%s'",
|
||||
fname);
|
||||
goto err;
|
||||
}
|
||||
if (!(lev = (Load_log_event*)Log_event::read_log_event(&file,
|
||||
|
@ -4580,7 +4594,9 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
|
|||
rli->relay_log.description_event_for_exec)) ||
|
||||
lev->get_type_code() != NEW_LOAD_EVENT)
|
||||
{
|
||||
slave_print_error(rli,0, "Error in Exec_load event: file '%s' appears corrupted", fname);
|
||||
slave_print_error(rli,0,
|
||||
"Error in Exec_load event: file '%s' appears corrupted",
|
||||
fname);
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -4625,7 +4641,7 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
|
|||
fd= -1;
|
||||
}
|
||||
(void) my_delete(fname, MYF(MY_WME));
|
||||
memcpy(p, ".data", 6);
|
||||
memcpy(ext, ".data", 6);
|
||||
(void) my_delete(fname, MYF(MY_WME));
|
||||
error = 0;
|
||||
|
||||
|
@ -4823,11 +4839,10 @@ Execute_load_query_log_event::exec_event(struct st_relay_log_info* rli)
|
|||
memcpy(p, query, fn_pos_start);
|
||||
p+= fn_pos_start;
|
||||
fname= (p= strmake(p, STRING_WITH_LEN(" INFILE \'")));
|
||||
p= slave_load_file_stem(p, file_id, server_id);
|
||||
fname_end= (p= strmake(p, STRING_WITH_LEN(".data")));
|
||||
p= slave_load_file_stem(p, file_id, server_id, ".data");
|
||||
fname_end= p= strend(p); // Safer than p=p+5
|
||||
*(p++)='\'';
|
||||
switch (dup_handling)
|
||||
{
|
||||
switch (dup_handling) {
|
||||
case LOAD_DUP_IGNORE:
|
||||
p= strmake(p, STRING_WITH_LEN(" IGNORE"));
|
||||
break;
|
||||
|
|
|
@ -1401,7 +1401,7 @@ static void network_init(void)
|
|||
{
|
||||
if (((ret= bind(ip_sock, my_reinterpret_cast(struct sockaddr *) (&IPaddr),
|
||||
sizeof(IPaddr))) >= 0) ||
|
||||
(socket_errno != EADDRINUSE) ||
|
||||
(socket_errno != SOCKET_EADDRINUSE) ||
|
||||
(waited >= mysqld_port_timeout))
|
||||
break;
|
||||
sql_print_information("Retrying bind on TCP/IP port %u", mysqld_port);
|
||||
|
@ -1613,7 +1613,7 @@ void end_thread(THD *thd, bool put_in_cache)
|
|||
wake_thread--;
|
||||
thd=thread_cache.get();
|
||||
thd->real_id=pthread_self();
|
||||
thd->thread_stack= (char *) &thd;
|
||||
thd->thread_stack= (char*) &thd; // For store_globals
|
||||
(void) thd->store_globals();
|
||||
thd->thr_create_time= time(NULL);
|
||||
threads.append(thd);
|
||||
|
@ -3322,6 +3322,11 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef __NETWARE__
|
||||
/* Increasing stacksize of threads on NetWare */
|
||||
|
||||
pthread_attr_setstacksize(&connection_attrib, NW_THD_STACKSIZE);
|
||||
#endif
|
||||
|
||||
(void) thr_setconcurrency(concurrency); // 10 by default
|
||||
|
||||
|
|
|
@ -5738,6 +5738,7 @@ bool QUICK_ROR_UNION_SELECT::check_if_keys_used(List<Item> *fields)
|
|||
|
||||
/*
|
||||
Create quick select from ref/ref_or_null scan.
|
||||
|
||||
SYNOPSIS
|
||||
get_quick_select_for_ref()
|
||||
thd Thread handle
|
||||
|
@ -5757,15 +5758,18 @@ bool QUICK_ROR_UNION_SELECT::check_if_keys_used(List<Item> *fields)
|
|||
QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
|
||||
TABLE_REF *ref, ha_rows records)
|
||||
{
|
||||
MEM_ROOT *old_root= thd->mem_root;
|
||||
/* The following call may change thd->mem_root */
|
||||
QUICK_RANGE_SELECT *quick= new QUICK_RANGE_SELECT(thd, table, ref->key, 0);
|
||||
/* save mem_root set by QUICK_RANGE_SELECT constructor */
|
||||
MEM_ROOT *alloc= thd->mem_root;
|
||||
MEM_ROOT *old_root, *alloc;
|
||||
QUICK_RANGE_SELECT *quick;
|
||||
KEY *key_info = &table->key_info[ref->key];
|
||||
KEY_PART *key_part;
|
||||
QUICK_RANGE *range;
|
||||
uint part;
|
||||
|
||||
old_root= thd->mem_root;
|
||||
/* The following call may change thd->mem_root */
|
||||
quick= new QUICK_RANGE_SELECT(thd, table, ref->key, 0);
|
||||
/* save mem_root set by QUICK_RANGE_SELECT constructor */
|
||||
alloc= thd->mem_root;
|
||||
/*
|
||||
return back default mem_root (thd->mem_root) changed by
|
||||
QUICK_RANGE_SELECT constructor
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue