Merge dator5.(none):/home/pappa/clean-mysql-5.1-kt

into  dator5.(none):/home/pappa/bug21388
This commit is contained in:
mikael/pappa@dator5.(none) 2006-08-26 06:14:05 -04:00
commit b28a550eb4
100 changed files with 3153 additions and 870 deletions

View file

@ -5,7 +5,7 @@ configure="./configure $base_configs $extra_configs"
commands="\
$make -k distclean || true
/bin/rm -rf */.deps/*.P config.cache storage/innobase/config.cache storage/bdb/build_unix/config.cache bdb/dist/autom4te.cache autom4te.cache innobase/autom4te.cache;
/bin/rm -rf */.deps/*.P config.cache storage/innobase/config.cache autom4te.cache innobase/autom4te.cache;
path=`dirname $0`
. \"$path/autorun.sh\""

View file

@ -1,7 +1,7 @@
/bin/rm -f */.deps/*.P */*.o
make -k clean
/bin/rm -f */.deps/*.P */*.o
/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache storage/bdb/build_unix/config.cache mysql-*.tar.gz
/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache mysql-*.tar.gz
path=`dirname $0`
. "$path/autorun.sh"

View file

@ -1,7 +1,7 @@
/bin/rm -f */.deps/*.P */*.o
make -k clean
/bin/rm -f */.deps/*.P */*.o
/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache storage/bdb/build_unix/config.cache mysql-*.tar.gz
/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache mysql-*.tar.gz
path=`dirname $0`
. "$path/autorun.sh"

View file

@ -7,7 +7,6 @@
# package" that is used as the basis for all other binary builds.
#
test -f Makefile && make distclean
(cd storage/bdb/dist && sh s_all)
(cd storage/innobase && aclocal && autoheader && \
libtoolize --automake --force --copy && \
automake --force --add-missing --copy && autoconf)

View file

@ -1,5 +1,5 @@
gmake -k clean || true
/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache storage/bdb/build_unix/config.cache
/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache
path=`dirname $0`
. "$path/autorun.sh"

View file

@ -49,10 +49,6 @@ IF(WITH_FEDERATED_STORAGE_ENGINE)
ADD_DEFINITIONS(-D WITH_FEDERATED_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_federated_plugin")
ENDIF(WITH_FEDERATED_STORAGE_ENGINE)
IF(WITH_BERKELEY_STORAGE_ENGINE)
ADD_DEFINITIONS(-D WITH_BERKELEY_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_berkeley_plugin")
ENDIF(WITH_BERKELEY_STORAGE_ENGINE)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc.in
${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc @ONLY)

View file

@ -39,11 +39,7 @@ BUILT_SOURCES = linked_client_sources linked_server_sources \
@linked_libmysqld_targets@ \
linked_include_sources @linked_netware_sources@
# The db.h file is a bit special, see note in "configure.in".
# In the case we didn't compile with bdb, a dummy file is put
# there, but will not be removed by the bdb make file becuase
# it will never be called.
CLEANFILES = $(BUILT_SOURCES) bdb/build_unix/db.h
CLEANFILES = $(BUILT_SOURCES)
DISTCLEANFILES = ac_available_languages_fragment
linked_include_sources:

View file

@ -338,7 +338,7 @@ static void end_timer(ulong start_time,char *buff);
static void mysql_end_timer(ulong start_time,char *buff);
static void nice_time(double sec,char *buff,bool part_second);
static sig_handler mysql_end(int sig);
static sig_handler handle_sigint(int sig);
static sig_handler mysql_sigint(int sig);
int main(int argc,char *argv[])
{
@ -420,7 +420,8 @@ int main(int argc,char *argv[])
if (opt_sigint_ignore)
signal(SIGINT, SIG_IGN);
else
signal(SIGINT, handle_sigint); // Catch SIGINT to clean up
signal(SIGINT, mysql_sigint); // Catch SIGINT to clean up
signal(SIGQUIT, mysql_end); // Catch SIGQUIT to clean up
/*
@ -488,6 +489,28 @@ int main(int argc,char *argv[])
#endif
}
sig_handler mysql_sigint(int sig)
{
char kill_buffer[40];
MYSQL *kill_mysql= NULL;
signal(SIGINT, mysql_sigint);
/* terminate if no query being executed, or we already tried interrupting */
if (!executing_query || interrupted_query++)
mysql_end(sig);
kill_mysql= mysql_init(kill_mysql);
if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password,
"", opt_mysql_port, opt_mysql_unix_port,0))
mysql_end(sig);
/* kill_buffer is always big enough because max length of %lu is 15 */
sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql));
mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer));
mysql_close(kill_mysql);
tee_fprintf(stdout, "Query aborted by Ctrl+C\n");
}
sig_handler mysql_end(int sig)
{
mysql_close(&mysql);
@ -1035,6 +1058,8 @@ static int read_and_execute(bool interactive)
if (opt_outfile && glob_buffer.is_empty())
fflush(OUTFILE);
interrupted_query= 0;
#if defined( __WIN__) || defined(__NETWARE__)
tee_fputs(prompt, stdout);
#if defined(__NETWARE__)
@ -2016,7 +2041,9 @@ com_go(String *buffer,char *line __attribute__((unused)))
}
timer=start_timer();
executing_query= 1;
error= mysql_real_query_for_lazy(buffer->ptr(),buffer->length());
#ifdef HAVE_READLINE
@ -2032,6 +2059,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
{
executing_query= 0;
buffer->length(0); // Remove query on error
executing_query= 0;
return error;
}
error=0;
@ -2115,6 +2143,9 @@ com_go(String *buffer,char *line __attribute__((unused)))
fflush(stdout);
mysql_free_result(result);
} while (!(err= mysql_next_result(&mysql)));
executing_query= 0;
if (err >= 1)
error= put_error(&mysql);
@ -3665,12 +3696,14 @@ static const char* construct_prompt()
case 'U':
if (!full_username)
init_username();
processed_prompt.append(full_username);
processed_prompt.append(full_username ? full_username :
(current_user ? current_user : "(unknown)"));
break;
case 'u':
if (!full_username)
init_username();
processed_prompt.append(part_username);
processed_prompt.append(part_username ? part_username :
(current_user ? current_user : "(unknown)"));
break;
case PROMPT_CHAR:
processed_prompt.append(PROMPT_CHAR);

View file

@ -17,6 +17,14 @@
#include "client_priv.h"
#include <my_dir.h>
#ifdef __WIN__
const char *mysqlcheck_name= "mysqlcheck.exe";
const char *mysql_name= "mysql.exe";
#else
const char *mysqlcheck_name= "mysqlcheck";
const char *mysql_name= "mysql";
#endif /*__WIN__*/
static my_bool opt_force= 0, opt_verbose= 0, tty_password= 0;
static char *user= (char*) "root", *basedir= 0, *datadir= 0, *opt_password= 0;
static my_bool upgrade_defaults_created= 0;
@ -65,7 +73,7 @@ static struct my_option my_long_options[]=
};
static const char *load_default_groups[]=
{
"mysql_upgrade", "client", 0
"mysql_upgrade", 0
};
#include <help_end.h>
@ -272,7 +280,7 @@ int main(int argc, char **argv)
strmake(bindir_end, "/bin", sizeof(bindir) - (int) (bindir_end - bindir)-1);
if (!test_file_exists_res
(bindir, "mysqlcheck", mysqlcheck_line, &mysqlcheck_end))
(bindir, mysqlcheck_name, mysqlcheck_line, &mysqlcheck_end))
{
printf("Can't find program '%s'\n", mysqlcheck_line);
puts("Please restart with --basedir=mysql-install-directory");
@ -342,7 +350,8 @@ int main(int argc, char **argv)
goto err_exit;
fix_priv_tables:
if (!test_file_exists_res(bindir, "mysql", fix_priv_tables_cmd, &fix_cmd_end))
if (!test_file_exists_res(bindir, mysql_name,
fix_priv_tables_cmd, &fix_cmd_end))
{
puts("Could not find MySQL command-line client (mysql).");
puts

View file

@ -1,263 +0,0 @@
dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_CHECK_BDB
dnl Sets HAVE_BERKELEY_DB if inst library is found
dnl Makes sure db version is correct.
dnl Looks in $srcdir for Berkeley distribution if not told otherwise
dnl ---------------------------------------------------------------------------
AC_DEFUN([MYSQL_SETUP_BERKELEY_DB], [
AC_ARG_WITH([berkeley-db],
AS_HELP_STRING([--with-berkeley-db[[[[[=DIR]]]]]],
[Use BerkeleyDB located in DIR]),
[bdb="$withval"],
[bdb=yes])
AC_ARG_WITH([berkeley-db-includes],
AS_HELP_STRING([--with-berkeley-db-includes=DIR],
[Find Berkeley DB headers in DIR]),
[bdb_includes="$withval"],
[bdb_includes=default])
AC_ARG_WITH([berkeley-db-libs],
AS_HELP_STRING([--with-berkeley-db-libs=DIR],
[Find Berkeley DB libraries in DIR]),
[bdb_libs="$withval"],
[bdb_libs=default])
# echo " bdb $bdb $bdb_includes---$bdb_libs "
case "$bdb" in
yes )
case "$bdb_includes---$bdb_libs" in
default---default )
mode=search-$bdb
;;
default---* | *---default | yes---* | *---yes )
AC_MSG_ERROR([if either 'includes' or 'libs' is specified, both must be specified])
;;
* )
mode=supplied-two
;;
esac
;;
* )
mode=supplied-one
;;
esac
case $mode in
supplied-two )
MYSQL_CHECK_INSTALLED_BDB([$bdb_includes], [$bdb_libs])
case $bdb_dir_ok in
installed ) mode=yes ;;
* ) AC_MSG_ERROR([didn't find valid BerkeleyDB: $bdb_dir_ok]) ;;
esac
;;
supplied-one )
MYSQL_CHECK_BDB_DIR([$bdb])
case $bdb_dir_ok in
source ) mode=compile ;;
installed ) mode=yes ;;
* ) AC_MSG_ERROR([didn't find valid BerkeleyDB: $bdb_dir_ok]) ;;
esac
;;
search-* )
MYSQL_SEARCH_FOR_BDB
case $bdb_dir_ok in
source ) mode=compile ;;
installed ) mode=yes ;;
* ) AC_MSG_ERROR([no suitable BerkeleyDB found]) ;;
esac
;;
*)
AC_MSG_ERROR([impossible case condition '$mode': please report this to bugs@lists.mysql.com])
;;
esac
case $mode in
yes )
have_berkeley_db="yes"
AC_MSG_RESULT([Using Berkeley DB in '$bdb_includes'])
;;
compile )
have_berkeley_db="$bdb"
AC_MSG_RESULT([Compiling Berekeley DB in '$have_berkeley_db'])
;;
* )
AC_MSG_ERROR([impossible case condition '$mode': please report this to bugs@lists.mysql.com])
;;
esac
bdb_conf_flags="--disable-shared --build=$build_alias"
if test $with_debug = "yes"
then
bdb_conf_flags="$bdb_conf_flags --enable-debug --enable-diagnostic"
fi
# NOTICE: if you're compiling BDB, it needs to be a SUBDIR
# of $srcdir (i.e., you can 'cd $srcdir/$bdb'). It won't
# work otherwise.
if test -d "$bdb"; then :
else
# This should only happen when doing a VPATH build
echo "NOTICE: I have to make the BDB directory: `pwd`:$bdb"
mkdir "$bdb" || exit 1
fi
if test -d "$bdb"/build_unix; then :
else
# This should only happen when doing a VPATH build
echo "NOTICE: I have to make the build_unix directory: `pwd`:$bdb/build_unix"
mkdir "$bdb/build_unix" || exit 1
fi
rel_srcdir=
case "$srcdir" in
/* ) rel_srcdir="$srcdir" ;;
* ) rel_srcdir="../../../$srcdir" ;;
esac
(cd $bdb/build_unix && \
sh $rel_srcdir/$bdb/dist/configure $bdb_conf_flags) || \
AC_MSG_ERROR([could not configure Berkeley DB])
AC_SUBST(bdb_includes)
AC_SUBST(bdb_libs)
AC_SUBST(bdb_libs_with_path)
])
AC_DEFUN([MYSQL_CHECK_INSTALLED_BDB], [
dnl echo ["MYSQL_CHECK_INSTALLED_BDB ($1) ($2)"]
inc="$1"
lib="$2"
if test -f "$inc/db.h"
then
MYSQL_CHECK_BDB_VERSION([$inc/db.h],
[.*#define[ ]*], [[ ][ ]*])
if test X"$bdb_version_ok" = Xyes; then
save_LDFLAGS="$LDFLAGS"
LDFLAGS="-L$lib $LDFLAGS"
AC_CHECK_LIB(db,db_env_create, [
bdb_dir_ok=installed
MYSQL_TOP_BUILDDIR([inc])
MYSQL_TOP_BUILDDIR([lib])
bdb_includes="-I$inc"
bdb_libs="-L$lib -ldb"
bdb_libs_with_path="$lib/libdb.a"
])
LDFLAGS="$save_LDFLAGS"
else
bdb_dir_ok="$bdb_version_ok"
fi
else
bdb_dir_ok="no db.h file in '$inc'"
fi
])
AC_DEFUN([MYSQL_CHECK_BDB_DIR], [
dnl ([$bdb])
dnl echo ["MYSQL_CHECK_BDB_DIR ($1)"]
dir="$1"
MYSQL_CHECK_INSTALLED_BDB([$dir/include], [$dir/lib])
if test X"$bdb_dir_ok" != Xinstalled; then
# test to see if it's a source dir
rel="$dir/dist/RELEASE"
if test -f "$rel"; then
MYSQL_CHECK_BDB_VERSION([$rel], [], [=])
if test X"$bdb_version_ok" = Xyes; then
bdb_dir_ok=source
bdb="$dir"
MYSQL_TOP_BUILDDIR([dir])
bdb_includes="-I$dir/build_unix"
bdb_libs="-L$dir/build_unix -ldb"
bdb_libs_with_path="$dir/build_unix/libdb.a"
else
bdb_dir_ok="$bdb_version_ok"
fi
else
bdb_dir_ok="'$dir' doesn't look like a BDB directory ($bdb_dir_ok)"
fi
fi
])
AC_DEFUN([MYSQL_SEARCH_FOR_BDB], [
dnl echo ["MYSQL_SEARCH_FOR_BDB"]
bdb_dir_ok="no BerkeleyDB found"
for test_dir in $srcdir/storage/bdb $srcdir/db-*.*.* /usr/local/BerkeleyDB*; do
dnl echo "-----------> Looking at ($test_dir; `cd $test_dir && pwd`)"
MYSQL_CHECK_BDB_DIR([$test_dir])
if test X"$bdb_dir_ok" = Xsource || test X"$bdb_dir_ok" = Xinstalled; then
dnl echo "-----------> Found it ($bdb), ($srcdir)"
dnl This is needed so that 'make distcheck' works properly (VPATH build).
dnl VPATH build won't work if bdb is not under the source tree; but in
dnl that case, hopefully people will just make and install inside the
dnl tree, or install BDB first, and then use the installed version.
case "$bdb" in
"$srcdir/"* ) bdb=`echo "$bdb" | sed -e "s,^$srcdir/,,"` ;;
esac
break
fi
done
])
dnl MYSQL_CHECK_BDB_VERSION takes 3 arguments:
dnl 1) the file to look in
dnl 2) the search pattern before DB_VERSION_XXX
dnl 3) the search pattern between DB_VERSION_XXX and the number
dnl It assumes that the number is the last thing on the line
AC_DEFUN([MYSQL_CHECK_BDB_VERSION], [
db_major=`sed -e '/^[$2]DB_VERSION_MAJOR[$3]/ !d' -e 's///' [$1]`
db_minor=`sed -e '/^[$2]DB_VERSION_MINOR[$3]/ !d' -e 's///' [$1]`
db_patch=`sed -e '/^[$2]DB_VERSION_PATCH[$3]/ !d' -e 's///' [$1]`
test -z "$db_major" && db_major=0
test -z "$db_minor" && db_minor=0
test -z "$db_patch" && db_patch=0
dnl # This is ugly, but about as good as it can get
dnl # mysql_bdb=
dnl # if test $db_major -eq 3 && test $db_minor -eq 2 && test $db_patch -eq 3
dnl # then
dnl # mysql_bdb=h
dnl # elif test $db_major -eq 3 && test $db_minor -eq 2 && test $db_patch -eq 9
dnl # then
dnl # want_bdb_version="3.2.9a" # hopefully this will stay up-to-date
dnl # mysql_bdb=a
dnl # fi
dnl RAM:
want_bdb_version="4.1.24"
bdb_version_ok=yes
dnl # if test -n "$mysql_bdb" && \
dnl # grep "DB_VERSION_STRING.*:.*$mysql_bdb: " [$1] > /dev/null
dnl # then
dnl # bdb_version_ok=yes
dnl # else
dnl # bdb_version_ok="invalid version $db_major.$db_minor.$db_patch"
dnl # bdb_version_ok="$bdb_version_ok (must be version 3.2.3h or $want_bdb_version)"
dnl # fi
])
AC_DEFUN([MYSQL_TOP_BUILDDIR], [
case "$[$1]" in
/* ) ;; # don't do anything with an absolute path
"$srcdir"/* )
# If BDB is under the source directory, we need to look under the
# build directory for bdb/build_unix.
# NOTE: I'm being lazy, and assuming the user did not specify
# something like --with-berkeley-db=bdb (it would be missing "./").
[$1]="\$(top_builddir)/"`echo "$[$1]" | sed -e "s,^$srcdir/,,"`
;;
* )
AC_MSG_ERROR([The BDB directory must be directly under the MySQL source directory, or be specified using the full path. ('$srcdir'; '$[$1]')])
;;
esac
if test X"$[$1]" != "/"
then
[$1]=`echo $[$1] | sed -e 's,/$,,'`
fi
])
dnl ---------------------------------------------------------------------------
dnl END OF MYSQL_CHECK_BDB SECTION
dnl ---------------------------------------------------------------------------

View file

@ -524,11 +524,7 @@ int init_embedded_server(int argc, char **argv, char **groups)
(void) thr_setconcurrency(concurrency); // 10 by default
if (
#ifdef HAVE_BERKELEY_DB
(have_berkeley_db == SHOW_OPTION_YES) ||
#endif
(flush_time && flush_time != ~(ulong) 0L))
if (flush_time && flush_time != ~(ulong) 0L)
{
pthread_t hThread;
if (pthread_create(&hThread,&connection_attrib,handle_manager,0))

View file

@ -83,7 +83,14 @@ sub mtr_path_exists (@) {
sub mtr_script_exists (@) {
foreach my $path ( @_ )
{
return $path if -x $path;
if($::glob_win32)
{
return $path if -f $path;
}
else
{
return $path if -x $path;
}
}
if ( @_ == 1 )
{

View file

@ -1299,8 +1299,8 @@ sub executable_setup () {
$path_ndb_tools_dir= "$glob_basedir/bin";
$exe_ndb_mgm= "$glob_basedir/bin/ndb_mgm";
$exe_ndb_waiter= "$glob_basedir/bin/ndb_waiter";
$exe_ndbd= "$glob_basedir/libexec/ndbd";
$exe_ndb_mgmd= "$glob_basedir/libexec/ndb_mgmd";
$exe_ndbd= "$glob_basedir/bin/ndbd";
$exe_ndb_mgmd= "$glob_basedir/bin/ndb_mgmd";
}
$exe_master_mysqld= $exe_master_mysqld || $exe_mysqld;
@ -1320,30 +1320,34 @@ sub executable_setup () {
sub environment_setup () {
my $extra_ld_library_paths;
umask(022);
# --------------------------------------------------------------------------
# We might not use a standard installation directory, like /usr/lib.
# Set LD_LIBRARY_PATH to make sure we find our installed libraries.
# Setup LD_LIBRARY_PATH so the libraries from this distro/clone
# are used in favor of the system installed ones
# --------------------------------------------------------------------------
unless ( $opt_source_dist )
if ( $opt_source_dist )
{
$ENV{'LD_LIBRARY_PATH'}=
"$glob_basedir/lib" .
($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");
$ENV{'DYLD_LIBRARY_PATH'}=
"$glob_basedir/lib" .
($ENV{'DYLD_LIBRARY_PATH'} ? ":$ENV{'DYLD_LIBRARY_PATH'}" : "");
$extra_ld_library_paths= "$glob_basedir/libmysql/.libs/";
}
else
{
$extra_ld_library_paths= "$glob_basedir/lib";
}
# --------------------------------------------------------------------------
# Add the path where mysqld will find udf_example.so
# --------------------------------------------------------------------------
$ENV{'LD_LIBRARY_PATH'}=
($lib_udf_example ? dirname($lib_udf_example) : "") .
($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");
$extra_ld_library_paths .= ":" .
($lib_udf_example ? dirname($lib_udf_example) : "");
$ENV{'LD_LIBRARY_PATH'}=
"$extra_ld_library_paths" .
($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");
$ENV{'DYLD_LIBRARY_PATH'}=
"$extra_ld_library_paths" .
($ENV{'DYLD_LIBRARY_PATH'} ? ":$ENV{'DYLD_LIBRARY_PATH'}" : "");
# --------------------------------------------------------------------------
# Also command lines in .opt files may contain env vars

View file

@ -5195,3 +5195,13 @@ select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
i v
4 3r4f
drop table t1;
create table bug15205 (val int(11) default null) engine=csv;
create table bug15205_2 (val int(11) default null) engine=csv;
select * from bug15205;
ERROR HY000: Can't get stat of './test/bug15205.CSV' (Errcode: 2)
select * from bug15205_2;
val
select * from bug15205;
val
drop table bug15205;
drop table bug15205_2;

View file

@ -43,3 +43,11 @@ id str
6 aaaaaa
7 aaaaaaa
drop table t1;
set names cp1250;
create table t1 (a varchar(15) collate cp1250_czech_cs NOT NULL, primary key(a));
insert into t1 values("abcdefghá");
insert into t1 values("ááèè");
select a from t1 where a like "abcdefghá";
a
abcdefghá
drop table t1;

View file

@ -1066,6 +1066,18 @@ LENGTH(bug)
100
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 (item varchar(255)) default character set utf8;
INSERT INTO t1 VALUES (N'\\');
INSERT INTO t1 VALUES (_utf8'\\');
INSERT INTO t1 VALUES (N'Cote d\'Ivoire');
INSERT INTO t1 VALUES (_utf8'Cote d\'Ivoire');
SELECT item FROM t1 ORDER BY item;
item
Cote d'Ivoire
Cote d'Ivoire
\
\
DROP TABLE t1;
SET NAMES utf8;
DROP TABLE IF EXISTS t1;
Warnings:
@ -1281,6 +1293,22 @@ id tid val
42749 72 VOLNÝ ADSL
44205 72 VOLNÝ ADSL
DROP TABLE t1;
create table t1(a char(200) collate utf8_unicode_ci NOT NULL default '')
default charset=utf8 collate=utf8_unicode_ci;
insert into t1 values (unhex('65')), (unhex('C3A9')), (unhex('65'));
explain select distinct a from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary
select distinct a from t1;
a
e
explain select a from t1 group by a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
select a from t1 group by a;
a
e
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;

View file

@ -74,3 +74,16 @@ show tables;
Tables_in_test
t1
drop table t1;
drop database if exists mysqltest;
drop table if exists t1;
create table t1 (i int);
lock tables t1 read;
create database mysqltest;
drop table t1;
show open tables;
drop database mysqltest;
select 1;
1
1
unlock tables;
End of 5.0 tests

View file

@ -1788,7 +1788,33 @@ length(a)
5000
drop table t1;
drop table t1;
End of 5.0 tests
DROP TABLE IF EXISTS federated.test;
CREATE TABLE federated.test (
`i` int(11) NOT NULL,
`j` int(11) NOT NULL,
`c` varchar(30) default NULL,
PRIMARY KEY (`i`,`j`),
UNIQUE KEY `i` (`i`,`c`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS federated.test1;
DROP TABLE IF EXISTS federated.test2;
create table federated.test1 (
i int not null,
j int not null,
c varchar(30),
primary key (i,j),
unique key (i, c))
engine = federated
connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/test';
create table federated.test2 (
i int default null,
j int not null,
c varchar(30),
key (i))
engine = federated
connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/test';
drop table federated.test1, federated.test2;
drop table federated.test;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;

View file

@ -16,7 +16,7 @@ CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`name` varchar(32) NOT NULL default ''
)
DEFAULT CHARSET=latin1 ENGINE=InnoDB;
DEFAULT CHARSET=latin1 ENGINE=innodb;
DROP TABLE IF EXISTS federated.t1;
Warnings:
Note 1051 Unknown table 't1'

View file

@ -891,6 +891,26 @@ t1 CREATE TABLE `t1` (
`from_unixtime(1) + 0` double(23,6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H)
union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H);
H
120
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H)
union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H);
H
120
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H)
union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H);
H
05
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H)
union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
H
5
End of 4.1 tests
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;

View file

@ -574,11 +574,11 @@ INSERT INTO t1 VALUES(GeomFromText('POINT(367894677 368542487)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(580848489 219587743)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(11247614 782797569)'));
drop table t1;
create table t1 select POINT(1,3);
create table t1 select GeomFromWKB(POINT(1,3));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`POINT(1,3)` longblob NOT NULL
`GeomFromWKB(POINT(1,3))` geometry NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo`
@ -706,3 +706,8 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def asbinary(g) 252 8192 0 Y 128 0 63
asbinary(g)
drop table t1;
create table t1 select GeomFromText('point(1 1)');
desc t1;
Field Type Null Key Default Extra
GeomFromText('point(1 1)') geometry NO
drop table t1;

View file

@ -528,7 +528,7 @@ Db char(64) NO PRI
User char(16) NO PRI
Table_name char(64) NO PRI
Grantor char(77) NO MUL
Timestamp timestamp YES CURRENT_TIMESTAMP
Timestamp timestamp NO CURRENT_TIMESTAMP
Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') NO
Column_priv set('Select','Insert','Update','References') NO
use test;
@ -870,3 +870,81 @@ insert into mysql.user select * from t2;
flush privileges;
drop table t2;
drop table t1;
CREATE DATABASE mysqltest3;
use mysqltest3;
CREATE TABLE t_nn (c1 INT);
CREATE VIEW v_nn AS SELECT * FROM t_nn;
CREATE DATABASE mysqltest2;
use mysqltest2;
CREATE TABLE t_nn (c1 INT);
CREATE VIEW v_nn AS SELECT * FROM t_nn;
CREATE VIEW v_yn AS SELECT * FROM t_nn;
CREATE VIEW v_gy AS SELECT * FROM t_nn;
CREATE VIEW v_ny AS SELECT * FROM t_nn;
CREATE VIEW v_yy AS SELECT * FROM t_nn WHERE c1=55;
GRANT SHOW VIEW ON mysqltest2.v_ny TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1';
GRANT SELECT ON mysqltest2.v_yn TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1';
GRANT SELECT ON mysqltest2.* TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1';
GRANT SHOW VIEW,SELECT ON mysqltest2.v_yy TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1';
SHOW CREATE VIEW mysqltest2.v_nn;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_nn'
SHOW CREATE TABLE mysqltest2.v_nn;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_nn'
SHOW CREATE VIEW mysqltest2.v_yn;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_yn'
SHOW CREATE TABLE mysqltest2.v_yn;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_yn'
SHOW CREATE TABLE mysqltest2.v_ny;
View Create View
v_ny CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_ny` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn`
SHOW CREATE VIEW mysqltest2.v_ny;
View Create View
v_ny CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_ny` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn`
SHOW CREATE TABLE mysqltest3.t_nn;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't_nn'
SHOW CREATE VIEW mysqltest3.t_nn;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't_nn'
SHOW CREATE VIEW mysqltest3.v_nn;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v_nn'
SHOW CREATE TABLE mysqltest3.v_nn;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v_nn'
SHOW CREATE TABLE mysqltest2.t_nn;
Table Create Table
t_nn CREATE TABLE `t_nn` (
`c1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE VIEW mysqltest2.t_nn;
ERROR HY000: 'mysqltest2.t_nn' is not VIEW
SHOW CREATE VIEW mysqltest2.v_yy;
View Create View
v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where (`mysqltest2`.`t_nn`.`c1` = 55)
SHOW CREATE TABLE mysqltest2.v_yy;
View Create View
v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where (`mysqltest2`.`t_nn`.`c1` = 55)
SHOW CREATE TABLE mysqltest2.v_nn;
View Create View
v_nn CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_nn` AS select `t_nn`.`c1` AS `c1` from `t_nn`
SHOW CREATE VIEW mysqltest2.v_nn;
View Create View
v_nn CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_nn` AS select `t_nn`.`c1` AS `c1` from `t_nn`
SHOW CREATE TABLE mysqltest2.t_nn;
Table Create Table
t_nn CREATE TABLE `t_nn` (
`c1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE VIEW mysqltest2.t_nn;
ERROR HY000: 'mysqltest2.t_nn' is not VIEW
DROP VIEW mysqltest2.v_nn;
DROP VIEW mysqltest2.v_yn;
DROP VIEW mysqltest2.v_ny;
DROP VIEW mysqltest2.v_yy;
DROP TABLE mysqltest2.t_nn;
DROP DATABASE mysqltest2;
DROP VIEW mysqltest3.v_nn;
DROP TABLE mysqltest3.t_nn;
DROP DATABASE mysqltest3;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'mysqltest_1'@'localhost';
DROP USER 'mysqltest_1'@'localhost';
create user mysqltest1_thisisreallytoolong;
ERROR HY000: Operation CREATE USER failed for 'mysqltest1_thisisreallytoolong'@'%'
End of 5.0 tests

View file

@ -69,3 +69,6 @@ START INSTANCE mysqld1,mysqld2,mysqld3;
ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
STOP INSTANCE mysqld1,mysqld2,mysqld3;
ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
STOP INSTANCE mysqld2;
ERROR HY000: Cannot stop instance. Perhaps the instance is not started, or was started manually, so IM cannot find the pidfile.
End of 5.0 tests

View file

@ -104,3 +104,50 @@ v2 VIEW View 'test.v2' references invalid table(s) or column(s) or function(s) o
drop function f1;
drop function f2;
drop view v1, v2;
create database testdb_1;
create user testdb_1@localhost;
grant all on testdb_1.* to testdb_1@localhost with grant option;
create user testdb_2@localhost;
grant all on test.* to testdb_2@localhost with grant option;
use testdb_1;
create table t1 (f1 char(4));
create view v1 as select f1 from t1;
grant insert on v1 to testdb_2@localhost;
create table t3 (f1 char(4), f2 char(4));
create view v3 as select f1,f2 from t3;
grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
create view v2 as select f1 from testdb_1.v1;
create view v4 as select f1,f2 from testdb_1.v3;
revoke insert(f1) on v3 from testdb_2@localhost;
show create view v4;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show fields from v4;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show fields from v2;
Field Type Null Key Default Extra
f1 char(4) YES NULL
show fields from testdb_1.v1;
Field Type Null Key Default Extra
f1 char(4) YES NULL
show create view v2;
View Create View
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v2` AS select `v1`.`f1` AS `f1` from `testdb_1`.`v1`
show create view testdb_1.v1;
ERROR 42000: SHOW VIEW command denied to user 'testdb_2'@'localhost' for table 'v1'
select table_name from information_schema.columns a
where a.table_name = 'v2';
table_name
v2
select view_definition from information_schema.views a
where a.table_name = 'v2';
view_definition
/* ALGORITHM=UNDEFINED */ select `v1`.`f1` AS `f1` from `testdb_1`.`v1`
select view_definition from information_schema.views a
where a.table_name = 'testdb_1.v1';
view_definition
select * from v2;
ERROR HY000: View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view testdb_1.v1,v2, testdb_1.v3, v4;
drop database testdb_1;
drop user testdb_1@localhost;
drop user testdb_2@localhost;

View file

@ -114,4 +114,12 @@ a int(11) YES NULL
b varchar(255) YES NULL
c int(11) YES NULL
drop table t1;
1
1
ERROR 1064 (42000) at line 3: 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 '' at line 1
ERROR at line 1: USE must be followed by a database name
\
\\
';
';
End of 5.0 tests

View file

@ -1,56 +0,0 @@
1
1
ERROR 1064 (42000) at line 3: 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 '' at line 1
ERROR at line 1: USE must be followed by a database name
? (\?) Synonym for `help'.
clear (\c) Clear command.
connect (\r) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set statement delimiter. NOTE: Takes the rest of the line as new delimiter.
edit (\e) Edit command with $EDITOR.
ego (\G) Send command to mysql server, display result vertically.
exit (\q) Exit mysql. Same as quit.
go (\g) Send command to mysql server.
help (\h) Display this help.
nopager (\n) Disable pager, print to stdout.
notee (\t) Don't write into outfile.
pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
print (\p) Print current command.
prompt (\R) Change your mysql prompt.
quit (\q) Quit mysql.
rehash (\#) Rebuild completion hash.
source (\.) Execute an SQL script file. Takes a file name as an argument.
status (\s) Get status information from the server.
system (\!) Execute a system shell command.
tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
use (\u) Use another database. Takes database name as argument.
charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
warnings (\W) Show warnings after every statement.
nowarning (\w) Don't show warnings after every statement.
? (\?) Synonym for `help'.
clear (\c) Clear command.
connect (\r) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set statement delimiter. NOTE: Takes the rest of the line as new delimiter.
edit (\e) Edit command with $EDITOR.
ego (\G) Send command to mysql server, display result vertically.
exit (\q) Exit mysql. Same as quit.
go (\g) Send command to mysql server.
help (\h) Display this help.
nopager (\n) Disable pager, print to stdout.
notee (\t) Don't write into outfile.
pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
print (\p) Print current command.
prompt (\R) Change your mysql prompt.
quit (\q) Quit mysql.
rehash (\#) Rebuild completion hash.
source (\.) Execute an SQL script file. Takes a file name as an argument.
status (\s) Get status information from the server.
system (\!) Execute a system shell command.
tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
use (\u) Use another database. Takes database name as argument.
charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
warnings (\W) Show warnings after every statement.
nowarning (\w) Don't show warnings after every statement.
\
\\
';
';

View file

@ -1277,3 +1277,885 @@ ERROR 3D000: No database selected
create temporary table t1 (i int);
ERROR 3D000: No database selected
use test;
create procedure proc_1() reset query cache;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
create function func_1() returns int begin reset query cache; return 1; end|
select func_1(), func_1(), func_1() from dual;
ERROR 0A000: FLUSH is not allowed in stored function or trigger
drop function func_1;
prepare abc from "reset query cache";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() reset master;
drop procedure proc_1;
create function func_1() returns int begin reset master; return 1; end|
select func_1(), func_1(), func_1() from dual;
ERROR 0A000: FLUSH is not allowed in stored function or trigger
drop function func_1;
prepare abc from "reset master";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() reset slave;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
create function func_1() returns int begin reset slave; return 1; end|
select func_1(), func_1(), func_1() from dual;
ERROR 0A000: FLUSH is not allowed in stored function or trigger
drop function func_1;
prepare abc from "reset slave";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1(a integer) kill a;
call proc_1(0);
ERROR HY000: Unknown thread id: 0
call proc_1(0);
ERROR HY000: Unknown thread id: 0
call proc_1(0);
ERROR HY000: Unknown thread id: 0
drop procedure proc_1;
create function func_1() returns int begin kill 0; return 1; end|
select func_1() from dual;
ERROR HY000: Unknown thread id: 0
select func_1() from dual;
ERROR HY000: Unknown thread id: 0
select func_1() from dual;
ERROR HY000: Unknown thread id: 0
drop function func_1;
prepare abc from "kill 0";
execute abc;
ERROR HY000: Unknown thread id: 0
execute abc;
ERROR HY000: Unknown thread id: 0
execute abc;
ERROR HY000: Unknown thread id: 0
deallocate prepare abc;
create procedure proc_1() flush hosts;
call proc_1();
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
create function func_1() returns int begin flush hosts; return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "flush hosts";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() flush privileges;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
create function func_1() returns int begin flush privileges; return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "flush privileges";
deallocate prepare abc;
create procedure proc_1() flush tables with read lock;
call proc_1();
unlock tables;
call proc_1();
unlock tables;
call proc_1();
unlock tables;
drop procedure proc_1;
create function func_1() returns int begin flush tables with read lock; return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
prepare abc from "flush tables with read lock";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
unlock tables;
create procedure proc_1() flush tables;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
create function func_1() returns int begin flush tables; return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "flush tables";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() flush tables;
flush tables;
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
select Host, User from mysql.user limit 0;
Host User
select Host, Db from mysql.host limit 0;
Host Db
show open tables from mysql;
Database Table In_use Name_locked
mysql user 0 0
mysql general_log 1 0
mysql host 0 0
call proc_1();
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
select Host, User from mysql.user limit 0;
Host User
select Host, Db from mysql.host limit 0;
Host Db
show open tables from mysql;
Database Table In_use Name_locked
mysql user 0 0
mysql general_log 1 0
mysql host 0 0
call proc_1();
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
select Host, User from mysql.user limit 0;
Host User
select Host, Db from mysql.host limit 0;
Host Db
show open tables from mysql;
Database Table In_use Name_locked
mysql user 0 0
mysql general_log 1 0
mysql host 0 0
call proc_1();
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
select Host, User from mysql.user limit 0;
Host User
select Host, Db from mysql.host limit 0;
Host Db
show open tables from mysql;
Database Table In_use Name_locked
mysql user 0 0
mysql general_log 1 0
mysql host 0 0
flush tables;
drop procedure proc_1;
create function func_1() returns int begin flush tables; return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
flush tables;
select Host, User from mysql.user limit 0;
Host User
select Host, Db from mysql.host limit 0;
Host Db
show open tables from mysql;
Database Table In_use Name_locked
mysql user 0 0
mysql general_log 1 0
mysql host 0 0
prepare abc from "flush tables";
execute abc;
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
select Host, User from mysql.user limit 0;
Host User
select Host, Db from mysql.host limit 0;
Host Db
show open tables from mysql;
Database Table In_use Name_locked
mysql user 0 0
mysql general_log 1 0
mysql host 0 0
execute abc;
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
select Host, User from mysql.user limit 0;
Host User
select Host, Db from mysql.host limit 0;
Host Db
show open tables from mysql;
Database Table In_use Name_locked
mysql user 0 0
mysql general_log 1 0
mysql host 0 0
execute abc;
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
select Host, User from mysql.user limit 0;
Host User
select Host, Db from mysql.host limit 0;
Host Db
show open tables from mysql;
Database Table In_use Name_locked
mysql user 0 0
mysql general_log 1 0
mysql host 0 0
flush tables;
deallocate prepare abc;
create procedure proc_1() flush logs;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
create function func_1() returns int begin flush logs; return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "flush logs";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() flush status;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
create function func_1() returns int begin flush status; return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "flush status";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() flush slave;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
create function func_1() returns int begin flush slave; return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "flush slave";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() flush master;
drop procedure proc_1;
create function func_1() returns int begin flush master; return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "flush master";
deallocate prepare abc;
create procedure proc_1() flush des_key_file;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
create function func_1() returns int begin flush des_key_file; return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "flush des_key_file";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() flush user_resources;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
create function func_1() returns int begin flush user_resources; return 1; end|
ERROR 0A000: FLUSH is not allowed in stored function or trigger
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "flush user_resources";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() start slave;
drop procedure proc_1;
create function func_1() returns int begin start slave; return 1; end|
drop function func_1;
prepare abc from "start slave";
deallocate prepare abc;
create procedure proc_1() stop slave;
drop procedure proc_1;
create function func_1() returns int begin stop slave; return 1; end|
drop function func_1;
prepare abc from "stop slave";
deallocate prepare abc;
create procedure proc_1() show binlog events;
drop procedure proc_1;
create function func_1() returns int begin show binlog events; return 1; end|
ERROR 0A000: Not allowed to return a result set from a function
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "show binlog events";
deallocate prepare abc;
create procedure proc_1() show slave status;
drop procedure proc_1;
create function func_1() returns int begin show slave status; return 1; end|
ERROR 0A000: Not allowed to return a result set from a function
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "show slave status";
deallocate prepare abc;
create procedure proc_1() show master status;
drop procedure proc_1;
create function func_1() returns int begin show master status; return 1; end|
ERROR 0A000: Not allowed to return a result set from a function
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "show master status";
deallocate prepare abc;
create procedure proc_1() show master logs;
drop procedure proc_1;
create function func_1() returns int begin show master logs; return 1; end|
ERROR 0A000: Not allowed to return a result set from a function
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "show master logs";
deallocate prepare abc;
create procedure proc_1() show events;
call proc_1();
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
call proc_1();
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
call proc_1();
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
drop procedure proc_1;
create function func_1() returns int begin show events; return 1; end|
ERROR 0A000: Not allowed to return a result set from a function
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "show events";
execute abc;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
execute abc;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
execute abc;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
deallocate prepare abc;
create procedure proc_1() show scheduler status;
drop procedure proc_1;
create function func_1() returns int begin show scheduler status; return 1; end|
ERROR 0A000: Not allowed to return a result set from a function
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "show scheduler status";
ERROR HY000: This command is not supported in the prepared statement protocol yet
deallocate prepare abc;
ERROR HY000: Unknown prepared statement handler (abc) given to DEALLOCATE PREPARE
drop procedure if exists a;
create procedure a() select 42;
create procedure proc_1(a char(2)) show create procedure a;
call proc_1("bb");
Procedure sql_mode Create Procedure
a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
select 42
call proc_1("bb");
Procedure sql_mode Create Procedure
a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
select 42
call proc_1("bb");
Procedure sql_mode Create Procedure
a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
select 42
drop procedure proc_1;
create function func_1() returns int begin show create procedure a; return 1; end|
ERROR 0A000: Not allowed to return a result set from a function
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "show create procedure a";
execute abc;
Procedure sql_mode Create Procedure
a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
select 42
execute abc;
Procedure sql_mode Create Procedure
a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
select 42
execute abc;
Procedure sql_mode Create Procedure
a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
select 42
deallocate prepare abc;
drop procedure a;
drop function if exists a;
create function a() returns int return 42+13;
create procedure proc_1(a char(2)) show create function a;
call proc_1("bb");
Function sql_mode Create Function
a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
return 42+13
call proc_1("bb");
Function sql_mode Create Function
a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
return 42+13
call proc_1("bb");
Function sql_mode Create Function
a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
return 42+13
drop procedure proc_1;
create function func_1() returns int begin show create function a; return 1; end|
ERROR 0A000: Not allowed to return a result set from a function
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "show create function a";
execute abc;
Function sql_mode Create Function
a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
return 42+13
execute abc;
Function sql_mode Create Function
a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
return 42+13
execute abc;
Function sql_mode Create Function
a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
return 42+13
deallocate prepare abc;
drop function a;
drop table if exists tab1;
create table tab1(a int, b char(1), primary key(a,b));
create procedure proc_1() show create table tab1;
call proc_1();
Table Create Table
tab1 CREATE TABLE `tab1` (
`a` int(11) NOT NULL DEFAULT '0',
`b` char(1) NOT NULL DEFAULT '',
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
call proc_1();
Table Create Table
tab1 CREATE TABLE `tab1` (
`a` int(11) NOT NULL DEFAULT '0',
`b` char(1) NOT NULL DEFAULT '',
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
call proc_1();
Table Create Table
tab1 CREATE TABLE `tab1` (
`a` int(11) NOT NULL DEFAULT '0',
`b` char(1) NOT NULL DEFAULT '',
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop procedure proc_1;
create function func_1() returns int begin show create table tab1; return 1; end|
ERROR 0A000: Not allowed to return a result set from a function
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "show create table tab1";
execute abc;
Table Create Table
tab1 CREATE TABLE `tab1` (
`a` int(11) NOT NULL DEFAULT '0',
`b` char(1) NOT NULL DEFAULT '',
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
execute abc;
Table Create Table
tab1 CREATE TABLE `tab1` (
`a` int(11) NOT NULL DEFAULT '0',
`b` char(1) NOT NULL DEFAULT '',
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
execute abc;
Table Create Table
tab1 CREATE TABLE `tab1` (
`a` int(11) NOT NULL DEFAULT '0',
`b` char(1) NOT NULL DEFAULT '',
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
deallocate prepare abc;
drop table tab1;
drop view if exists v1;
drop table if exists t1;
create table t1(a int, b char(5));
insert into t1 values (1, "one"), (1, "edno"), (2, "two"), (2, "dve");
create view v1 as
(select a, count(*) from t1 group by a)
union all
(select b, count(*) from t1 group by b);
create procedure proc_1() show create view v1;
call proc_1();
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`)
call proc_1();
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`)
call proc_1();
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`)
drop procedure proc_1;
create function func_1() returns int begin show create view v1; return 1; end|
ERROR 0A000: Not allowed to return a result set from a function
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "show create view v1";
execute abc;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`)
execute abc;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`)
execute abc;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`)
deallocate prepare abc;
drop view v1;
drop table t1;
create procedure proc_1() install plugin my_plug soname '/root/some_plugin.so';
call proc_1();
ERROR HY000: No paths allowed for shared library
call proc_1();
ERROR HY000: No paths allowed for shared library
call proc_1();
ERROR HY000: No paths allowed for shared library
drop procedure proc_1;
create procedure proc_1() install plugin my_plug soname 'some_plugin.so';
call proc_1();
ERROR HY000: Can't open shared library '/work/mysql-5.1-runtime/mysql-test/lib/mysql/some_plugin.so' (errno: 0 cannot open shared object file: No such file or directory)
call proc_1();
ERROR HY000: Can't open shared library '/work/mysql-5.1-runtime/mysql-test/lib/mysql/some_plugin.so' (errno: 22 cannot open shared object file: No such file or directory)
call proc_1();
ERROR HY000: Can't open shared library '/work/mysql-5.1-runtime/mysql-test/lib/mysql/some_plugin.so' (errno: 22 cannot open shared object file: No such file or directory)
drop procedure proc_1;
create function func_1() returns int begin install plugin my_plug soname '/tmp/plugin'; return 1; end|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "install plugin my_plug soname '/root/some_plugin.so'";
execute abc;
ERROR HY000: No paths allowed for shared library
execute abc;
ERROR HY000: No paths allowed for shared library
deallocate prepare abc;
prepare abc from "install plugin my_plug soname 'some_plugin.so'";
deallocate prepare abc;
create procedure proc_1() uninstall plugin my_plug;
call proc_1();
ERROR 42000: PLUGIN my_plug does not exist
call proc_1();
ERROR 42000: PLUGIN my_plug does not exist
call proc_1();
ERROR 42000: PLUGIN my_plug does not exist
drop procedure proc_1;
create function func_1() returns int begin uninstall plugin my_plug; return 1; end|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "uninstall plugin my_plug";
execute abc;
ERROR 42000: PLUGIN my_plug does not exist
execute abc;
ERROR 42000: PLUGIN my_plug does not exist
execute abc;
ERROR 42000: PLUGIN my_plug does not exist
deallocate prepare abc;
drop database if exists mysqltest_xyz;
create procedure proc_1() create database mysqltest_xyz;
call proc_1();
drop database if exists mysqltest_xyz;
call proc_1();
call proc_1();
ERROR HY000: Can't create database 'mysqltest_xyz'; database exists
drop database if exists mysqltest_xyz;
call proc_1();
drop database if exists mysqltest_xyz;
drop procedure proc_1;
create function func_1() returns int begin create database mysqltest_xyz; return 1; end|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "create database mysqltest_xyz";
execute abc;
drop database if exists mysqltest_xyz;
execute abc;
execute abc;
ERROR HY000: Can't create database 'mysqltest_xyz'; database exists
drop database if exists mysqltest_xyz;
execute abc;
drop database if exists mysqltest_xyz;
deallocate prepare abc;
drop table if exists t1;
create table t1 (a int, b char(5));
insert into t1 values (1, "one"), (2, "two"), (3, "three");
create procedure proc_1() checksum table xyz;
call proc_1();
Table Checksum
test.xyz NULL
Warnings:
Error 1146 Table 'test.xyz' doesn't exist
call proc_1();
Table Checksum
test.xyz NULL
Warnings:
Error 1146 Table 'test.xyz' doesn't exist
call proc_1();
Table Checksum
test.xyz NULL
Warnings:
Error 1146 Table 'test.xyz' doesn't exist
drop procedure proc_1;
create function func_1() returns int begin checksum table t1; return 1; end|
ERROR 0A000: Not allowed to return a result set from a function
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "checksum table t1";
execute abc;
Table Checksum
test.t1 645809265
execute abc;
Table Checksum
test.t1 645809265
execute abc;
Table Checksum
test.t1 645809265
deallocate prepare abc;
create procedure proc_1() create user pstest_xyz@localhost;
call proc_1();
drop user pstest_xyz@localhost;
call proc_1();
call proc_1();
ERROR HY000: Operation CREATE USER failed for 'pstest_xyz'@'localhost'
drop user pstest_xyz@localhost;
call proc_1();
drop user pstest_xyz@localhost;
drop procedure proc_1;
create function func_1() returns int begin create user pstest_xyz@localhost; return 1; end|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "create user pstest_xyz@localhost";
execute abc;
drop user pstest_xyz@localhost;
execute abc;
execute abc;
ERROR HY000: Operation CREATE USER failed for 'pstest_xyz'@'localhost'
drop user pstest_xyz@localhost;
execute abc;
drop user pstest_xyz@localhost;
deallocate prepare abc;
drop event if exists xyz;
create function func_1() returns int begin create event xyz on schedule at now() do select 123; return 1; end|
ERROR 0A000: Not allowed to return a result set from a function
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "create event xyz on schedule at now() do select 123";
ERROR HY000: This command is not supported in the prepared statement protocol yet
deallocate prepare abc;
ERROR HY000: Unknown prepared statement handler (abc) given to DEALLOCATE PREPARE
drop event if exists xyz;
create event xyz on schedule every 5 minute disable do select 123;
create procedure proc_1() alter event xyz comment 'xyz';
call proc_1();
drop event xyz;
create event xyz on schedule every 5 minute disable do select 123;
call proc_1();
drop event xyz;
create event xyz on schedule every 5 minute disable do select 123;
call proc_1();
drop event xyz;
drop procedure proc_1;
create function func_1() returns int begin alter event xyz comment 'xyz'; return 1; end|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
prepare abc from "alter event xyz comment 'xyz'";
ERROR HY000: This command is not supported in the prepared statement protocol yet
deallocate prepare abc;
ERROR HY000: Unknown prepared statement handler (abc) given to DEALLOCATE PREPARE
drop event if exists xyz;
create event xyz on schedule every 5 minute disable do select 123;
create procedure proc_1() drop event xyz;
call proc_1();
create event xyz on schedule every 5 minute disable do select 123;
call proc_1();
call proc_1();
ERROR HY000: Unknown event 'xyz'
drop procedure proc_1;
create function func_1() returns int begin drop event xyz; return 1; end|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
prepare abc from "drop event xyz";
ERROR HY000: This command is not supported in the prepared statement protocol yet
deallocate prepare abc;
ERROR HY000: Unknown prepared statement handler (abc) given to DEALLOCATE PREPARE
drop table if exists t1;
create table t1 (a int, b char(5)) engine=myisam;
insert into t1 values (1, "one"), (2, "two"), (3, "three");
SET GLOBAL new_cache.key_buffer_size=128*1024;
create procedure proc_1() cache index t1 in new_cache;
call proc_1();
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
call proc_1();
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
call proc_1();
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
drop procedure proc_1;
SET GLOBAL second_cache.key_buffer_size=128*1024;
prepare abc from "cache index t1 in second_cache";
execute abc;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
execute abc;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
execute abc;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
deallocate prepare abc;
drop table t1;
drop table if exists t1;
drop table if exists t2;
create table t1 (a int, b char(5)) engine=myisam;
insert into t1 values (1, "one"), (2, "two"), (3, "three");
create table t2 (a int, b char(5)) engine=myisam;
insert into t2 values (1, "one"), (2, "two"), (3, "three");
create procedure proc_1() load index into cache t1 ignore leaves;
call proc_1();
Table Op Msg_type Msg_text
test.t1 preload_keys status OK
call proc_1();
Table Op Msg_type Msg_text
test.t1 preload_keys status OK
call proc_1();
Table Op Msg_type Msg_text
test.t1 preload_keys status OK
drop procedure proc_1;
create function func_1() returns int begin load index into cache t1 ignore leaves; return 1; end|
ERROR 0A000: Not allowed to return a result set from a function
prepare abc from "load index into cache t2 ignore leaves";
execute abc;
Table Op Msg_type Msg_text
test.t2 preload_keys status OK
execute abc;
Table Op Msg_type Msg_text
test.t2 preload_keys status OK
execute abc;
Table Op Msg_type Msg_text
test.t2 preload_keys status OK
deallocate prepare abc;
drop table t1, t2;
create procedure proc_1() show errors;
call proc_1();
Level Code Message
call proc_1();
Level Code Message
call proc_1();
Level Code Message
drop procedure proc_1;
create function func_1() returns int begin show errors; return 1; end|
ERROR 0A000: Not allowed to return a result set from a function
prepare abc from "show errors";
deallocate prepare abc;
drop table if exists t1;
drop table if exists t2;
create procedure proc_1() show warnings;
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
call proc_1();
Level Code Message
drop table if exists t2;
Warnings:
Note 1051 Unknown table 't2'
call proc_1();
Level Code Message
drop table if exists t1, t2;
Warnings:
Note 1051 Unknown table 't1'
Note 1051 Unknown table 't2'
call proc_1();
Level Code Message
drop procedure proc_1;
create function func_1() returns int begin show warnings; return 1; end|
ERROR 0A000: Not allowed to return a result set from a function
prepare abc from "show warnings";
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
execute abc;
Level Code Message
Note 1051 Unknown table 't1'
drop table if exists t2;
Warnings:
Note 1051 Unknown table 't2'
execute abc;
Level Code Message
Note 1051 Unknown table 't2'
drop table if exists t1, t2;
Warnings:
Note 1051 Unknown table 't1'
Note 1051 Unknown table 't2'
execute abc;
Level Code Message
Note 1051 Unknown table 't1'
Note 1051 Unknown table 't2'
deallocate prepare abc;

View file

@ -308,17 +308,11 @@ prepare stmt4 from ' show engine bdb logs ';
execute stmt4;
prepare stmt4 from ' show grants for user ';
prepare stmt4 from ' show create table t2 ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' show master status ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' show master logs ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' show slave status ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' show warnings limit 20 ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' show errors limit 20 ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' show storage engines ';
execute stmt4;
drop table if exists t5;
@ -387,10 +381,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
prepare stmt4 from ' use test ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt3 from ' create database mysqltest ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
create database mysqltest ;
prepare stmt3 from ' drop database mysqltest ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
drop database mysqltest ;
prepare stmt3 from ' describe t2 ';
execute stmt3;
@ -412,7 +404,6 @@ execute stmt1 ;
prepare stmt1 from ' optimize table t1 ' ;
prepare stmt1 from ' analyze table t1 ' ;
prepare stmt1 from ' checksum table t1 ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' repair table t1 ' ;
prepare stmt1 from ' restore table t1 from ''data.txt'' ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
@ -440,11 +431,8 @@ execute stmt5;
1
SET sql_mode="";
prepare stmt1 from ' flush local privileges ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' reset query cache ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' KILL 0 ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' explain select a from t1 order by b ';
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr

View file

@ -78,13 +78,10 @@ ERROR 42000: There is no such grant defined for user 'second_user' on host 'loca
drop database mysqltest;
prepare stmt3 from ' grant all on test.t1 to drop_user@localhost
identified by ''looser'' ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
grant all on test.t1 to drop_user@localhost
identified by 'looser' ;
prepare stmt3 from ' revoke all privileges on test.t1 from
drop_user@localhost ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
revoke all privileges on test.t1 from drop_user@localhost ;
prepare stmt3 from ' drop user drop_user@localhost ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
drop user drop_user@localhost;

View file

@ -284,11 +284,11 @@ call p1()|
select * from t1|
id stmt_text status
1 select 1 supported
2 flush tables not supported
2 flush tables supported
3 handler t1 open as ha not supported
4 analyze table t1 supported
5 check table t1 not supported
6 checksum table t1 not supported
6 checksum table t1 supported
7 check table t1 not supported
8 optimize table t1 supported
9 repair table t1 supported

View file

@ -915,9 +915,13 @@ drop table t1;
select cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15));
cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15))
0.000000000100000
select ln(14000) c1, convert(ln(14000),decimal(2,3)) c2, cast(ln(14000) as decimal(2,3)) c3;
select ln(14000) c1, convert(ln(14000),decimal(5,3)) c2, cast(ln(14000) as decimal(5,3)) c3;
c1 c2 c3
9.5468126085974 9.547 9.547
select convert(ln(14000),decimal(2,3)) c1;
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '').
select cast(ln(14000) as decimal(2,3)) c1;
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '').
create table t1 (sl decimal(70,30));
ERROR 42000: Too big precision 70 specified for column 'sl'. Maximum is 65.
create table t1 (sl decimal(32,31));

View file

@ -57,7 +57,7 @@ ushort smallint(5) unsigned zerofill NULL NO MUL 00000 #
umedium mediumint(8) unsigned NULL NO MUL 0 #
ulong int(11) unsigned NULL NO MUL 0 #
ulonglong bigint(13) unsigned NULL NO MUL 0 #
time_stamp timestamp NULL YES CURRENT_TIMESTAMP #
time_stamp timestamp NULL NO CURRENT_TIMESTAMP #
date_field date NULL YES NULL #
time_field time NULL YES NULL #
date_time datetime NULL YES NULL #
@ -229,7 +229,7 @@ ushort smallint(5) unsigned zerofill NULL NO 00000 #
umedium mediumint(8) unsigned NULL NO MUL 0 #
ulong int(11) unsigned NULL NO MUL 0 #
ulonglong bigint(13) unsigned NULL NO MUL 0 #
time_stamp timestamp NULL YES CURRENT_TIMESTAMP #
time_stamp timestamp NULL NO CURRENT_TIMESTAMP #
date_field char(10) latin1_swedish_ci YES NULL #
time_field time NULL YES NULL #
date_time datetime NULL YES NULL #
@ -255,7 +255,7 @@ ushort smallint(5) unsigned zerofill NULL NO 00000 #
umedium mediumint(8) unsigned NULL NO 0 #
ulong int(11) unsigned NULL NO 0 #
ulonglong bigint(13) unsigned NULL NO 0 #
time_stamp timestamp NULL YES 0000-00-00 00:00:00 #
time_stamp timestamp NULL NO 0000-00-00 00:00:00 #
date_field char(10) latin1_swedish_ci YES NULL #
time_field time NULL YES NULL #
date_time datetime NULL YES NULL #

View file

@ -201,9 +201,9 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
t1 timestamp YES 2003-01-01 00:00:00
t1 timestamp NO 2003-01-01 00:00:00
t2 datetime YES NULL
t3 timestamp YES 0000-00-00 00:00:00
t3 timestamp NO 0000-00-00 00:00:00
drop table t1;
create table t1 (t1 timestamp default now(), t2 datetime, t3 timestamp);
SET TIMESTAMP=1000000002;
@ -225,9 +225,9 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
t1 timestamp YES CURRENT_TIMESTAMP
t1 timestamp NO CURRENT_TIMESTAMP
t2 datetime YES NULL
t3 timestamp YES 0000-00-00 00:00:00
t3 timestamp NO 0000-00-00 00:00:00
drop table t1;
create table t1 (t1 timestamp default '2003-01-01 00:00:00' on update now(), t2 datetime);
SET TIMESTAMP=1000000004;
@ -251,7 +251,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
t1 timestamp YES 2003-01-01 00:00:00
t1 timestamp NO 2003-01-01 00:00:00
t2 datetime YES NULL
drop table t1;
create table t1 (t1 timestamp default now() on update now(), t2 datetime);
@ -276,7 +276,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
t1 timestamp YES CURRENT_TIMESTAMP
t1 timestamp NO CURRENT_TIMESTAMP
t2 datetime YES NULL
drop table t1;
create table t1 (t1 timestamp, t2 datetime, t3 timestamp);
@ -302,9 +302,9 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
t1 timestamp YES CURRENT_TIMESTAMP
t1 timestamp NO CURRENT_TIMESTAMP
t2 datetime YES NULL
t3 timestamp YES 0000-00-00 00:00:00
t3 timestamp NO 0000-00-00 00:00:00
drop table t1;
create table t1 (t1 timestamp default current_timestamp on update current_timestamp, t2 datetime);
SET TIMESTAMP=1000000009;
@ -328,7 +328,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
t1 timestamp YES CURRENT_TIMESTAMP
t1 timestamp NO CURRENT_TIMESTAMP
t2 datetime YES NULL
truncate table t1;
insert into t1 values ('2004-04-01 00:00:00', '2004-04-01 00:00:00');
@ -493,3 +493,18 @@ a b c
6 NULL 2006-06-06 06:06:06
drop table t1;
set time_zone= @@global.time_zone;
CREATE TABLE t1 (
`id` int(11) NOT NULL auto_increment,
`username` varchar(80) NOT NULL default '',
`posted_on` timestamp NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
show fields from t1;
Field Type Null Key Default Extra
id int(11) NO PRI NULL auto_increment
username varchar(80) NO
posted_on timestamp NO 0000-00-00 00:00:00
select is_nullable from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='t1' and COLUMN_NAME='posted_on';
is_nullable
NO
drop table t1;

View file

@ -1558,3 +1558,27 @@ select * from t1;
alter table t1 add unique key (i, v);
select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
drop table t1;
#
# Bug #15205 Select from CSV table without the datafile causes crash
#
# NOTE: the bug is not deterministic
# The crash happens because the necessary cleanup after an error wasn't
# performed. Namely, the table share, inserted in the hash during table
# open, was not deleted from hash. At the same time the share was freed
# when an error was encountered. Thus, subsequent access to the hash
# resulted in scanning through deleted memory and we were geting a crash.
# that's why we need two tables in the bugtest
create table bug15205 (val int(11) default null) engine=csv;
create table bug15205_2 (val int(11) default null) engine=csv;
--exec rm $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV
# system error (can't open the datafile)
--error 13
select * from bug15205;
select * from bug15205_2;
--exec touch $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV
select * from bug15205;
drop table bug15205;
drop table bug15205_2;

View file

@ -47,4 +47,14 @@ INSERT INTO t1 VALUES (NULL, 'aaaaaaa');
select * from t1 where str like 'aa%';
drop table t1;
#
# Bug#19741 segfault with cp1250 charset + like + primary key + 64bit os
#
set names cp1250;
create table t1 (a varchar(15) collate cp1250_czech_cs NOT NULL, primary key(a));
insert into t1 values("abcdefghá");
insert into t1 values("ááèè");
select a from t1 where a like "abcdefghá";
drop table t1;
# End of 4.1 tests

View file

@ -878,6 +878,17 @@ SELECT LENGTH(bug) FROM t2;
DROP TABLE t2;
DROP TABLE t1;
#
# Bug#17313: N'xxx' and _utf8'xxx' are not equivalent
#
CREATE TABLE t1 (item varchar(255)) default character set utf8;
INSERT INTO t1 VALUES (N'\\');
INSERT INTO t1 VALUES (_utf8'\\');
INSERT INTO t1 VALUES (N'Cote d\'Ivoire');
INSERT INTO t1 VALUES (_utf8'Cote d\'Ivoire');
SELECT item FROM t1 ORDER BY item;
DROP TABLE t1;
#
# Bug#17705: Corruption of compressed index when index length changes between
# 254 and 256
@ -1026,6 +1037,20 @@ ALTER TABLE t1 ADD KEY idx (tid,val(11));
SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLNÝ ADSL';
DROP TABLE t1;
#
# Bug 20709: problem with utf8 fields in temporary tables
#
create table t1(a char(200) collate utf8_unicode_ci NOT NULL default '')
default charset=utf8 collate=utf8_unicode_ci;
insert into t1 values (unhex('65')), (unhex('C3A9')), (unhex('65'));
explain select distinct a from t1;
select distinct a from t1;
explain select a from t1 group by a;
select a from t1 group by a;
drop table t1;
# End of 4.1 tests
#

View file

@ -21,6 +21,7 @@ ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t
ndb_binlog_ignore_db : BUG#21279 2006-07-25 ingo Randomly throws a warning
ndb_load : BUG#17233 2006-05-04 tomas failed load data from infile causes mysqld dbug_assert, binlog not flushed
ndb_restore_compat : BUG#21283 2006-07-26 ingo Test fails randomly
partition : BUG#21658 2006-08-16 Partition test fails, --ps-protocol
partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when updating a range partitioned NDB table
ps : BUG#21524 2006-08-08 pgalbraith 'ps' test fails in --ps-protocol test AMD64 bit
ps_7ndb : BUG#18950 2006-02-16 jmiller create table like does not obtain LOCK_open
@ -44,4 +45,3 @@ rpl_row_basic_7ndb : BUG#21298 2006-07-27 msvensson
rpl_truncate_7ndb : BUG#21298 2006-07-27 msvensson
crash_commit_before : 2006-08-02 msvensson
rpl_ndb_dd_advance : BUG#18679 2006-07-28 jimw (Test fails randomly)
federated_transactions : Need to be re-enabled once Patrick's merge is complete

View file

@ -81,3 +81,44 @@ show tables;
drop table t1;
# End of 4.1 tests
#
# Test for bug#21216 "Simultaneous DROP TABLE and SHOW OPEN TABLES causes
# server to crash". Crash (caused by failed assertion in 5.0 or by null
# pointer dereference in 5.1) happened when one ran SHOW OPEN TABLES
# while concurrently doing DROP TABLE (or RENAME TABLE, CREATE TABLE LIKE
# or any other command that takes name-lock) in other connection.
#
# Also includes test for similar bug#12212 "Crash that happens during
# removing of database name from cache" reappeared in 5.1 as bug#19403
# In its case crash happened when one concurrently executed DROP DATABASE
# and one of name-locking command.
#
--disable_warnings
drop database if exists mysqltest;
drop table if exists t1;
--enable_warnings
create table t1 (i int);
lock tables t1 read;
create database mysqltest;
connect (addconroot1, localhost, root,,);
--send drop table t1
connect (addconroot2, localhost, root,,);
# Server should not crash in any of the following statements
--disable_result_log
show open tables;
--enable_result_log
--send drop database mysqltest
connection default;
select 1;
unlock tables;
connection addconroot1;
--reap
connection addconroot2;
--reap
disconnect addconroot1;
disconnect addconroot2;
connection default;
--echo End of 5.0 tests

View file

@ -1553,5 +1553,49 @@ drop table t1;
connection master;
drop table t1;
--echo End of 5.0 tests
#
# BUG #15133: unique index with nullable value not accepted in federated table
#
connection slave;
--disable_warnings
DROP TABLE IF EXISTS federated.test;
CREATE TABLE federated.test (
`i` int(11) NOT NULL,
`j` int(11) NOT NULL,
`c` varchar(30) default NULL,
PRIMARY KEY (`i`,`j`),
UNIQUE KEY `i` (`i`,`c`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--enable_warnings
connection master;
--disable_warnings
DROP TABLE IF EXISTS federated.test1;
DROP TABLE IF EXISTS federated.test2;
--enable_warnings
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval create table federated.test1 (
i int not null,
j int not null,
c varchar(30),
primary key (i,j),
unique key (i, c))
engine = federated
connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/test';
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval create table federated.test2 (
i int default null,
j int not null,
c varchar(30),
key (i))
engine = federated
connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/test';
drop table federated.test1, federated.test2;
connection slave;
drop table federated.test;
source include/federated_cleanup.inc;

View file

@ -446,6 +446,24 @@ create table t1 select now() - now(), curtime() - curtime(),
show create table t1;
drop table t1;
#
# Bug #19844 time_format in Union truncates values
#
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H)
union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H);
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H)
union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H);
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H)
union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H);
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H)
union
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
--echo End of 4.1 tests
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,

View file

@ -281,7 +281,7 @@ INSERT INTO t1 VALUES(GeomFromText('POINT(580848489 219587743)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(11247614 782797569)'));
drop table t1;
create table t1 select POINT(1,3);
create table t1 select GeomFromWKB(POINT(1,3));
show create table t1;
drop table t1;
@ -416,3 +416,9 @@ select * from t1;
select asbinary(g) from t1;
--disable_metadata
drop table t1;
create table t1 select GeomFromText('point(1 1)');
desc t1;
drop table t1;

View file

@ -683,3 +683,136 @@ drop table t2;
drop table t1;
#
# Bug#20214: Incorrect error when user calls SHOW CREATE VIEW on non
# privileged view
#
connection master;
CREATE DATABASE mysqltest3;
use mysqltest3;
CREATE TABLE t_nn (c1 INT);
CREATE VIEW v_nn AS SELECT * FROM t_nn;
CREATE DATABASE mysqltest2;
use mysqltest2;
CREATE TABLE t_nn (c1 INT);
CREATE VIEW v_nn AS SELECT * FROM t_nn;
CREATE VIEW v_yn AS SELECT * FROM t_nn;
CREATE VIEW v_gy AS SELECT * FROM t_nn;
CREATE VIEW v_ny AS SELECT * FROM t_nn;
CREATE VIEW v_yy AS SELECT * FROM t_nn WHERE c1=55;
GRANT SHOW VIEW ON mysqltest2.v_ny TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1';
GRANT SELECT ON mysqltest2.v_yn TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1';
GRANT SELECT ON mysqltest2.* TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1';
GRANT SHOW VIEW,SELECT ON mysqltest2.v_yy TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1';
connect (mysqltest_1, localhost, mysqltest_1, mysqltest_1,);
# fail because of missing SHOW VIEW (have generic SELECT)
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE VIEW mysqltest2.v_nn;
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE mysqltest2.v_nn;
# fail because of missing SHOW VIEW
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE VIEW mysqltest2.v_yn;
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE mysqltest2.v_yn;
# succeed (despite of missing SELECT, having SHOW VIEW bails us out)
SHOW CREATE TABLE mysqltest2.v_ny;
# succeed (despite of missing SELECT, having SHOW VIEW bails us out)
SHOW CREATE VIEW mysqltest2.v_ny;
# fail because of missing (specific or generic) SELECT
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE mysqltest3.t_nn;
# fail because of missing (specific or generic) SELECT (not because it's not a view!)
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE VIEW mysqltest3.t_nn;
# fail because of missing missing (specific or generic) SELECT (and SHOW VIEW)
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE VIEW mysqltest3.v_nn;
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE mysqltest3.v_nn;
# succeed thanks to generic SELECT
SHOW CREATE TABLE mysqltest2.t_nn;
# fail because it's not a view! (have generic SELECT though)
--error ER_WRONG_OBJECT
SHOW CREATE VIEW mysqltest2.t_nn;
# succeed, have SELECT and SHOW VIEW
SHOW CREATE VIEW mysqltest2.v_yy;
# succeed, have SELECT and SHOW VIEW
SHOW CREATE TABLE mysqltest2.v_yy;
#clean-up
connection master;
# succeed, we're root
SHOW CREATE TABLE mysqltest2.v_nn;
SHOW CREATE VIEW mysqltest2.v_nn;
SHOW CREATE TABLE mysqltest2.t_nn;
# fail because it's not a view!
--error ER_WRONG_OBJECT
SHOW CREATE VIEW mysqltest2.t_nn;
DROP VIEW mysqltest2.v_nn;
DROP VIEW mysqltest2.v_yn;
DROP VIEW mysqltest2.v_ny;
DROP VIEW mysqltest2.v_yy;
DROP TABLE mysqltest2.t_nn;
DROP DATABASE mysqltest2;
DROP VIEW mysqltest3.v_nn;
DROP TABLE mysqltest3.t_nn;
DROP DATABASE mysqltest3;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'mysqltest_1'@'localhost';
DROP USER 'mysqltest_1'@'localhost';
#
# Bug #10668: CREATE USER does not enforce username length limit
#
--error ER_CANNOT_USER
create user mysqltest1_thisisreallytoolong;
--echo End of 5.0 tests

View file

@ -37,7 +37,7 @@
# Check that the configuration file contains only instances that we expect.
--echo --------------------------------------------------------------------
--exec grep server_id $MYSQLTEST_VARDIR/im.cnf;
--exec grep '^server_id\>' $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
# Check that mysqld1 is reported as running.
@ -79,7 +79,7 @@ CREATE INSTANCE mysqld3
SHOW INSTANCES;
--echo --------------------------------------------------------------------
--exec grep server_id $MYSQLTEST_VARDIR/im.cnf ;
--exec grep '^server_id\>' $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
# Check that CREATE INSTANCE fails for existing instance. Let's all three
@ -101,7 +101,7 @@ CREATE INSTANCE mysqld3;
# - without values;
--echo --------------------------------------------------------------------
--exec grep nonguarded $MYSQLTEST_VARDIR/im.cnf;
--exec grep '^nonguarded\>' $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
CREATE INSTANCE mysqld4
@ -112,15 +112,15 @@ CREATE INSTANCE mysqld4
SHOW INSTANCES;
--echo --------------------------------------------------------------------
--exec grep nonguarded $MYSQLTEST_VARDIR/im.cnf;
--exec grep '^nonguarded\>' $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
# - with value;
--echo --------------------------------------------------------------------
--exec grep test-A $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^test-A\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep test-B $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^test-B\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
CREATE INSTANCE mysqld5
@ -132,9 +132,9 @@ CREATE INSTANCE mysqld5
SHOW INSTANCES;
--echo --------------------------------------------------------------------
--exec grep test-A $MYSQLTEST_VARDIR/im.cnf;
--exec grep '^test-A\>' $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
--exec grep test-B $MYSQLTEST_VARDIR/im.cnf;
--exec grep '^test-B\>' $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
# Check that CREATE INSTANCE parses options and handles grammar errors
@ -144,7 +144,7 @@ SHOW INSTANCES;
# - check handling of extra spaces;
--echo --------------------------------------------------------------------
--exec grep test-C $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^test-C\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
CREATE INSTANCE mysqld6
@ -156,17 +156,17 @@ CREATE INSTANCE mysqld6
SHOW INSTANCES;
--echo --------------------------------------------------------------------
--exec grep test-C1 $MYSQLTEST_VARDIR/im.cnf;
--exec grep '^test-C1\>' $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
--exec grep test-C2 $MYSQLTEST_VARDIR/im.cnf;
--exec grep '^test-C2\>' $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
# - check handling of grammar error;
--echo --------------------------------------------------------------------
--exec grep test-D $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^test-D\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep test-E $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^test-E\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--error ER_SYNTAX_ERROR
@ -182,21 +182,21 @@ CREATE INSTANCE mysqld8 test-F = ;
SHOW INSTANCES;
--echo --------------------------------------------------------------------
--exec grep test-D $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^test-D\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep test-E $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^test-E\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
# - check parsing of string option values
--echo --------------------------------------------------------------------
--exec grep test-1 $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^test-1\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep test-2 $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^test-2\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep test-3 $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^test-3\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep test-4 $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^test-4\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
CREATE INSTANCE mysqld9
@ -233,21 +233,21 @@ CREATE INSTANCE mysqld13 test-bad=' \ ';
SHOW INSTANCES;
--echo --------------------------------------------------------------------
--exec grep test-1 $MYSQLTEST_VARDIR/im.cnf;
--exec grep '^test-1\>' $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
--exec grep test-2 $MYSQLTEST_VARDIR/im.cnf;
--exec grep '^test-2\>' $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
--exec grep test-3 $MYSQLTEST_VARDIR/im.cnf;
--exec grep '^test-3\>' $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
--exec grep test-4 $MYSQLTEST_VARDIR/im.cnf;
--exec grep '^test-4\>' $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
--exec grep test-5 $MYSQLTEST_VARDIR/im.cnf;
--exec grep '^test-5\>' $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
--exec grep test-6 $MYSQLTEST_VARDIR/im.cnf;
--exec grep '^test-6\>' $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
--exec grep test-7 $MYSQLTEST_VARDIR/im.cnf;
--exec grep '^test-7\>' $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
--exec grep test-bad $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^test-bad\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------

View file

@ -194,3 +194,11 @@ START INSTANCE mysqld1,mysqld2,mysqld3;
--error ER_SYNTAX_ERROR
STOP INSTANCE mysqld1,mysqld2,mysqld3;
#
# Bug #12673: Instance Manager: allows to stop the instance many times
#
--error 3001
STOP INSTANCE mysqld2;
--echo End of 5.0 tests

View file

@ -43,7 +43,7 @@
# - check the configuration file;
--echo --------------------------------------------------------------------
--exec grep server_id $MYSQLTEST_VARDIR/im.cnf ;
--exec grep '^server_id\>' $MYSQLTEST_VARDIR/im.cnf ;
--echo --------------------------------------------------------------------
# - check the running instances.
@ -133,25 +133,25 @@ UNSET mysqld2.server_id = 11;
SET mysqld2.aaa, mysqld3.bbb, mysqld2.ccc = 0010, mysqld3.ddd = 0020;
--echo --------------------------------------------------------------------
--exec grep aaa $MYSQLTEST_VARDIR/im.cnf ;
--exec grep '^aaa\>' $MYSQLTEST_VARDIR/im.cnf ;
--echo --------------------------------------------------------------------
--exec grep bbb $MYSQLTEST_VARDIR/im.cnf ;
--exec grep '^bbb\>' $MYSQLTEST_VARDIR/im.cnf ;
--echo --------------------------------------------------------------------
--exec grep ccc $MYSQLTEST_VARDIR/im.cnf ;
--exec grep '^ccc\>' $MYSQLTEST_VARDIR/im.cnf ;
--echo --------------------------------------------------------------------
--exec grep ddd $MYSQLTEST_VARDIR/im.cnf ;
--exec grep '^ddd\>' $MYSQLTEST_VARDIR/im.cnf ;
--echo --------------------------------------------------------------------
UNSET mysqld2.aaa, mysqld3.bbb, mysqld2.ccc, mysqld3.ddd;
--echo --------------------------------------------------------------------
--exec grep aaa $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^aaa\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep bbb $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^bbb\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep ccc $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^ccc\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep ddd $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^ddd\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
# - check that if some instance name is invalid or the active is active,
@ -161,22 +161,22 @@ UNSET mysqld2.aaa, mysqld3.bbb, mysqld2.ccc, mysqld3.ddd;
SET mysqld2.aaa, mysqld3.bbb, mysqld.ccc = 0010;
--echo --------------------------------------------------------------------
--exec grep aaa $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^aaa\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep bbb $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^bbb\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep ccc $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^ccc\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--error 3015 # ER_INSTANCE_IS_ACTIVE
SET mysqld2.aaa, mysqld3.bbb, mysqld1.ccc = 0010;
--echo --------------------------------------------------------------------
--exec grep aaa $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^aaa\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep bbb $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^bbb\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep ccc $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^ccc\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
# - check that if some instance name is invalid or the active is active,
@ -186,14 +186,14 @@ SET mysqld2.aaa, mysqld3.bbb, mysqld1.ccc = 0010;
UNSET mysqld2.server_id, mysqld3.server_id, mysqld.ccc;
--echo --------------------------------------------------------------------
--exec grep server_id $MYSQLTEST_VARDIR/im.cnf;
--exec grep '^server_id\>' $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
--error 3015 # ER_INSTANCE_IS_ACTIVE
UNSET mysqld2.server_id, mysqld3.server_id, mysqld1.ccc;
--echo --------------------------------------------------------------------
--exec grep server_id $MYSQLTEST_VARDIR/im.cnf;
--exec grep '^server_id\>' $MYSQLTEST_VARDIR/im.cnf;
--echo --------------------------------------------------------------------
DROP INSTANCE mysqld3;
@ -207,21 +207,21 @@ SET mysqld2 . server_id = 222 ;
SET mysqld2 . server_id = 222 , mysqld2 . aaa , mysqld2 . bbb ;
--echo --------------------------------------------------------------------
--exec grep server_id $MYSQLTEST_VARDIR/im.cnf ;
--exec grep '^server_id\>' $MYSQLTEST_VARDIR/im.cnf ;
--echo --------------------------------------------------------------------
--exec grep aaa $MYSQLTEST_VARDIR/im.cnf ;
--exec grep '^aaa\>' $MYSQLTEST_VARDIR/im.cnf ;
--echo --------------------------------------------------------------------
--exec grep bbb $MYSQLTEST_VARDIR/im.cnf ;
--exec grep '^bbb\>' $MYSQLTEST_VARDIR/im.cnf ;
--echo --------------------------------------------------------------------
UNSET mysqld2 . aaa , mysqld2 . bbb ;
--echo --------------------------------------------------------------------
--exec grep server_id $MYSQLTEST_VARDIR/im.cnf ;
--exec grep '^server_id\>' $MYSQLTEST_VARDIR/im.cnf ;
--echo --------------------------------------------------------------------
--exec grep aaa $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^aaa\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
--exec grep bbb $MYSQLTEST_VARDIR/im.cnf || true;
--exec grep '^bbb\>' $MYSQLTEST_VARDIR/im.cnf || true;
--echo --------------------------------------------------------------------
###########################################################################
@ -235,7 +235,7 @@ UNSET mysqld2 . aaa , mysqld2 . bbb ;
# server_id=SERVER_ID for mysqld2);
--echo --------------------------------------------------------------------
--exec grep server_id $MYSQLTEST_VARDIR/im.cnf ;
--exec grep '^server_id\>' $MYSQLTEST_VARDIR/im.cnf ;
--echo --------------------------------------------------------------------
# - (for mysqld1) check that the running instance has not been affected:

View file

@ -98,3 +98,60 @@ where table_schema='test';
drop function f1;
drop function f2;
drop view v1, v2;
#
# Bug#20543: select on information_schema strange warnings, view, different
# schemas/users
#
#
create database testdb_1;
create user testdb_1@localhost;
grant all on testdb_1.* to testdb_1@localhost with grant option;
create user testdb_2@localhost;
grant all on test.* to testdb_2@localhost with grant option;
connect (testdb_1,localhost,testdb_1,,test);
use testdb_1;
create table t1 (f1 char(4));
create view v1 as select f1 from t1;
grant insert on v1 to testdb_2@localhost;
create table t3 (f1 char(4), f2 char(4));
create view v3 as select f1,f2 from t3;
grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
connect (testdb_2,localhost,testdb_2,,test);
create view v2 as select f1 from testdb_1.v1;
create view v4 as select f1,f2 from testdb_1.v3;
connection testdb_1;
revoke insert(f1) on v3 from testdb_2@localhost;
connection testdb_2;
--error 1345
show create view v4;
--error 1345
show fields from v4;
show fields from v2;
show fields from testdb_1.v1;
show create view v2;
--error 1142
show create view testdb_1.v1;
select table_name from information_schema.columns a
where a.table_name = 'v2';
select view_definition from information_schema.views a
where a.table_name = 'v2';
select view_definition from information_schema.views a
where a.table_name = 'testdb_1.v1';
--error 1356
select * from v2;
connection default;
drop view testdb_1.v1,v2, testdb_1.v3, v4;
drop database testdb_1;
drop user testdb_1@localhost;
drop user testdb_2@localhost;

View file

@ -94,6 +94,50 @@ drop table t1;
--exec $MYSQL test -e "connect verylongdatabasenamethatshouldblowthe256byteslongbufferincom_connectfunctionxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxendcccccccdxxxxxxxxxxxxxxxxxkskskskskkskskskskskskskskskskkskskskskkskskskskskskskskskend" 2>&1
--enable_parsing
#
# Bug #20432: mysql client interprets commands in comments
#
# if the client sees the 'use' within the comment, we haven't fixed
--exec echo "/*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "*/" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
# SQL can have embedded comments => workie
--exec echo "select /*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "*/ 1" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
# client commands on the other hand must be at BOL => error
--exec echo "/*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "xxx" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "*/ use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--error 1
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
# client comment recognized, but parameter missing => error
--exec echo "use" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
#
# Bug #20328: mysql client interprets commands in comments
#
--exec $MYSQL -e 'help' > $MYSQLTEST_VARDIR/tmp/bug20328_1.result
--exec $MYSQL -e 'help ' > $MYSQLTEST_VARDIR/tmp/bug20328_2.result
--exec diff $MYSQLTEST_VARDIR/tmp/bug20328_1.result $MYSQLTEST_VARDIR/tmp/bug20328_2.result
#
# Bug #20103: Escaping with backslash does not work
#
--exec echo "SET SQL_MODE = 'NO_BACKSLASH_ESCAPES';" > $MYSQLTEST_VARDIR/tmp/bug20103.sql
--exec echo "SELECT '\';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1
--exec echo "SET SQL_MODE = '';" > $MYSQLTEST_VARDIR/tmp/bug20103.sql
--exec echo "SELECT '\';';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1
--echo End of 5.0 tests

View file

@ -1,46 +0,0 @@
# This test should work in embedded server after we fix mysqltest
-- source include/not_embedded.inc
#
# Bug #20432: mysql client interprets commands in comments
#
# if the client sees the 'use' within the comment, we haven't fixed
--exec echo "/*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "*/" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
# SQL can have embedded comments => workie
--exec echo "select /*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "*/ 1" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
# client commands on the other hand must be at BOL => error
--exec echo "/*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "xxx" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "*/ use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--error 1
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
# client comment recognized, but parameter missing => error
--exec echo "use" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
#
# Bug #20328: mysql client interprets commands in comments
#
--exec echo 'help' | $MYSQL
--exec echo 'help ' | $MYSQL
#
# Bug #20103: Escaping with backslash does not work
#
--exec echo "SET SQL_MODE = 'NO_BACKSLASH_ESCAPES';" > $MYSQLTEST_VARDIR/tmp/bug20103.sql
--exec echo "SELECT '\';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1
--exec echo "SET SQL_MODE = '';" > $MYSQLTEST_VARDIR/tmp/bug20103.sql
--exec echo "SELECT '\';';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1

View file

@ -8,8 +8,8 @@
# server or run mysql-test-run --debug mysql_client_test and check
# var/log/mysql_client_test.trace
--disable_result_log
--exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M
--exec echo "$MYSQL_CLIENT_TEST" > $MYSQLTEST_VARDIR/log/mysql_client_test.log 2>&1
--exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M >> $MYSQLTEST_VARDIR/log/mysql_client_test.log 2>&1
# End of 4.1 tests
echo ok;

View file

@ -1330,3 +1330,874 @@ create temporary table t1 (i int);
#
use test;
# End of 5.0 tests
#
# Bug #20665: All commands supported in Stored Procedures should work in
# Prepared Statements
#
create procedure proc_1() reset query cache;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
create function func_1() returns int begin reset query cache; return 1; end|
delimiter ;|
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
select func_1(), func_1(), func_1() from dual;
drop function func_1;
prepare abc from "reset query cache";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() reset master;
drop procedure proc_1;
delimiter |;
create function func_1() returns int begin reset master; return 1; end|
delimiter ;|
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
select func_1(), func_1(), func_1() from dual;
drop function func_1;
prepare abc from "reset master";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() reset slave;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
create function func_1() returns int begin reset slave; return 1; end|
delimiter ;|
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
select func_1(), func_1(), func_1() from dual;
drop function func_1;
prepare abc from "reset slave";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1(a integer) kill a;
--error ER_NO_SUCH_THREAD
call proc_1(0);
--error ER_NO_SUCH_THREAD
call proc_1(0);
--error ER_NO_SUCH_THREAD
call proc_1(0);
drop procedure proc_1;
delimiter |;
create function func_1() returns int begin kill 0; return 1; end|
delimiter ;|
--error ER_NO_SUCH_THREAD
select func_1() from dual;
--error ER_NO_SUCH_THREAD
select func_1() from dual;
--error ER_NO_SUCH_THREAD
select func_1() from dual;
drop function func_1;
prepare abc from "kill 0";
--error ER_NO_SUCH_THREAD
execute abc;
--error ER_NO_SUCH_THREAD
execute abc;
--error ER_NO_SUCH_THREAD
execute abc;
deallocate prepare abc;
create procedure proc_1() flush hosts;
call proc_1();
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush hosts; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "flush hosts";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() flush privileges;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush privileges; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "flush privileges";
deallocate prepare abc;
create procedure proc_1() flush tables with read lock;
call proc_1();
unlock tables;
call proc_1();
unlock tables;
call proc_1();
unlock tables;
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush tables with read lock; return 1; end|
delimiter ;|
prepare abc from "flush tables with read lock";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
unlock tables;
create procedure proc_1() flush tables;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush tables; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "flush tables";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() flush tables;
flush tables;
show open tables from mysql;
select Host, User from mysql.user limit 0;
select Host, Db from mysql.host limit 0;
show open tables from mysql;
call proc_1();
show open tables from mysql;
select Host, User from mysql.user limit 0;
select Host, Db from mysql.host limit 0;
show open tables from mysql;
call proc_1();
show open tables from mysql;
select Host, User from mysql.user limit 0;
select Host, Db from mysql.host limit 0;
show open tables from mysql;
call proc_1();
show open tables from mysql;
select Host, User from mysql.user limit 0;
select Host, Db from mysql.host limit 0;
show open tables from mysql;
flush tables;
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush tables; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
flush tables;
select Host, User from mysql.user limit 0;
select Host, Db from mysql.host limit 0;
show open tables from mysql;
prepare abc from "flush tables";
execute abc;
show open tables from mysql;
select Host, User from mysql.user limit 0;
select Host, Db from mysql.host limit 0;
show open tables from mysql;
execute abc;
show open tables from mysql;
select Host, User from mysql.user limit 0;
select Host, Db from mysql.host limit 0;
show open tables from mysql;
execute abc;
show open tables from mysql;
select Host, User from mysql.user limit 0;
select Host, Db from mysql.host limit 0;
show open tables from mysql;
flush tables;
deallocate prepare abc;
create procedure proc_1() flush logs;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush logs; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "flush logs";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() flush status;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush status; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "flush status";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() flush slave;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush slave; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "flush slave";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() flush master;
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush master; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "flush master";
deallocate prepare abc;
create procedure proc_1() flush des_key_file;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush des_key_file; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "flush des_key_file";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() flush user_resources;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush user_resources; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "flush user_resources";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() start slave;
drop procedure proc_1;
delimiter |;
create function func_1() returns int begin start slave; return 1; end|
delimiter ;|
drop function func_1;
prepare abc from "start slave";
deallocate prepare abc;
create procedure proc_1() stop slave;
drop procedure proc_1;
delimiter |;
create function func_1() returns int begin stop slave; return 1; end|
delimiter ;|
drop function func_1;
prepare abc from "stop slave";
deallocate prepare abc;
create procedure proc_1() show binlog events;
drop procedure proc_1;
delimiter |;
--error ER_SP_NO_RETSET
create function func_1() returns int begin show binlog events; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "show binlog events";
deallocate prepare abc;
create procedure proc_1() show slave status;
drop procedure proc_1;
delimiter |;
--error ER_SP_NO_RETSET
create function func_1() returns int begin show slave status; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "show slave status";
deallocate prepare abc;
create procedure proc_1() show master status;
drop procedure proc_1;
delimiter |;
--error ER_SP_NO_RETSET
create function func_1() returns int begin show master status; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "show master status";
deallocate prepare abc;
create procedure proc_1() show master logs;
drop procedure proc_1;
delimiter |;
--error ER_SP_NO_RETSET
create function func_1() returns int begin show master logs; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "show master logs";
deallocate prepare abc;
create procedure proc_1() show events;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_SP_NO_RETSET
create function func_1() returns int begin show events; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "show events";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() show scheduler status;
drop procedure proc_1;
delimiter |;
--error ER_SP_NO_RETSET
create function func_1() returns int begin show scheduler status; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
--error ER_UNSUPPORTED_PS
prepare abc from "show scheduler status";
--error ER_UNKNOWN_STMT_HANDLER
deallocate prepare abc;
--disable_warnings
drop procedure if exists a;
--enable_warnings
create procedure a() select 42;
create procedure proc_1(a char(2)) show create procedure a;
call proc_1("bb");
call proc_1("bb");
call proc_1("bb");
drop procedure proc_1;
delimiter |;
--error ER_SP_NO_RETSET
create function func_1() returns int begin show create procedure a; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "show create procedure a";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
drop procedure a;
--disable_warnings
drop function if exists a;
--enable_warnings
create function a() returns int return 42+13;
create procedure proc_1(a char(2)) show create function a;
call proc_1("bb");
call proc_1("bb");
call proc_1("bb");
drop procedure proc_1;
delimiter |;
--error ER_SP_NO_RETSET
create function func_1() returns int begin show create function a; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "show create function a";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
drop function a;
--disable_warnings
drop table if exists tab1;
--enable_warnings
create table tab1(a int, b char(1), primary key(a,b));
create procedure proc_1() show create table tab1;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_SP_NO_RETSET
create function func_1() returns int begin show create table tab1; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "show create table tab1";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
drop table tab1;
--disable_warnings
drop view if exists v1;
drop table if exists t1;
--enable_warnings
create table t1(a int, b char(5));
insert into t1 values (1, "one"), (1, "edno"), (2, "two"), (2, "dve");
create view v1 as
(select a, count(*) from t1 group by a)
union all
(select b, count(*) from t1 group by b);
create procedure proc_1() show create view v1;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_SP_NO_RETSET
create function func_1() returns int begin show create view v1; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "show create view v1";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
drop view v1;
drop table t1;
create procedure proc_1() install plugin my_plug soname '/root/some_plugin.so';
--error ER_UDF_NO_PATHS
call proc_1();
--error ER_UDF_NO_PATHS
call proc_1();
--error ER_UDF_NO_PATHS
call proc_1();
drop procedure proc_1;
create procedure proc_1() install plugin my_plug soname 'some_plugin.so';
--error ER_CANT_OPEN_LIBRARY
call proc_1();
--error ER_CANT_OPEN_LIBRARY
call proc_1();
--error ER_CANT_OPEN_LIBRARY
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin install plugin my_plug soname '/tmp/plugin'; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "install plugin my_plug soname '/root/some_plugin.so'";
--error ER_UDF_NO_PATHS
execute abc;
--error ER_UDF_NO_PATHS
execute abc;
deallocate prepare abc;
prepare abc from "install plugin my_plug soname 'some_plugin.so'";
deallocate prepare abc;
create procedure proc_1() uninstall plugin my_plug;
--error ER_SP_DOES_NOT_EXIST
call proc_1();
--error ER_SP_DOES_NOT_EXIST
call proc_1();
--error ER_SP_DOES_NOT_EXIST
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin uninstall plugin my_plug; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "uninstall plugin my_plug";
--error ER_SP_DOES_NOT_EXIST
execute abc;
--error ER_SP_DOES_NOT_EXIST
execute abc;
--error ER_SP_DOES_NOT_EXIST
execute abc;
deallocate prepare abc;
--disable_warnings
drop database if exists mysqltest_xyz;
--enable_warnings
create procedure proc_1() create database mysqltest_xyz;
call proc_1();
drop database if exists mysqltest_xyz;
call proc_1();
--error ER_DB_CREATE_EXISTS
call proc_1();
drop database if exists mysqltest_xyz;
call proc_1();
drop database if exists mysqltest_xyz;
drop procedure proc_1;
delimiter |;
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin create database mysqltest_xyz; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "create database mysqltest_xyz";
execute abc;
drop database if exists mysqltest_xyz;
execute abc;
--error ER_DB_CREATE_EXISTS
execute abc;
drop database if exists mysqltest_xyz;
execute abc;
drop database if exists mysqltest_xyz;
deallocate prepare abc;
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (a int, b char(5));
insert into t1 values (1, "one"), (2, "two"), (3, "three");
create procedure proc_1() checksum table xyz;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_SP_NO_RETSET
create function func_1() returns int begin checksum table t1; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "checksum table t1";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
create procedure proc_1() create user pstest_xyz@localhost;
call proc_1();
drop user pstest_xyz@localhost;
call proc_1();
--error ER_CANNOT_USER
call proc_1();
drop user pstest_xyz@localhost;
call proc_1();
drop user pstest_xyz@localhost;
drop procedure proc_1;
delimiter |;
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin create user pstest_xyz@localhost; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
prepare abc from "create user pstest_xyz@localhost";
execute abc;
drop user pstest_xyz@localhost;
execute abc;
--error ER_CANNOT_USER
execute abc;
drop user pstest_xyz@localhost;
execute abc;
drop user pstest_xyz@localhost;
deallocate prepare abc;
--disable_warnings
drop event if exists xyz;
--enable_warnings
#create procedure proc_1() create event xyz on schedule every 5 minute disable do select 123;
#call proc_1();
#drop event xyz;
#call proc_1();
#--error ER_EVENT_ALREADY_EXISTS
#call proc_1();
#drop event xyz;
#call proc_1();
#drop event xyz;
#drop procedure proc_1;
delimiter |;
--error ER_SP_NO_RETSET
create function func_1() returns int begin create event xyz on schedule at now() do select 123; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
--error ER_UNSUPPORTED_PS
prepare abc from "create event xyz on schedule at now() do select 123";
--error ER_UNKNOWN_STMT_HANDLER
deallocate prepare abc;
--disable_warnings
drop event if exists xyz;
create event xyz on schedule every 5 minute disable do select 123;
--enable_warnings
create procedure proc_1() alter event xyz comment 'xyz';
call proc_1();
drop event xyz;
create event xyz on schedule every 5 minute disable do select 123;
call proc_1();
drop event xyz;
create event xyz on schedule every 5 minute disable do select 123;
call proc_1();
drop event xyz;
drop procedure proc_1;
delimiter |;
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin alter event xyz comment 'xyz'; return 1; end|
delimiter ;|
--error ER_UNSUPPORTED_PS
prepare abc from "alter event xyz comment 'xyz'";
--error ER_UNKNOWN_STMT_HANDLER
deallocate prepare abc;
--disable_warnings
drop event if exists xyz;
create event xyz on schedule every 5 minute disable do select 123;
--enable_warnings
create procedure proc_1() drop event xyz;
call proc_1();
create event xyz on schedule every 5 minute disable do select 123;
call proc_1();
--error ER_EVENT_DOES_NOT_EXIST
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin drop event xyz; return 1; end|
delimiter ;|
--error ER_UNSUPPORTED_PS
prepare abc from "drop event xyz";
--error ER_UNKNOWN_STMT_HANDLER
deallocate prepare abc;
--disable_warnings
drop table if exists t1;
create table t1 (a int, b char(5)) engine=myisam;
insert into t1 values (1, "one"), (2, "two"), (3, "three");
--enable_warnings
SET GLOBAL new_cache.key_buffer_size=128*1024;
create procedure proc_1() cache index t1 in new_cache;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
SET GLOBAL second_cache.key_buffer_size=128*1024;
prepare abc from "cache index t1 in second_cache";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
drop table t1;
--disable_warnings
drop table if exists t1;
drop table if exists t2;
create table t1 (a int, b char(5)) engine=myisam;
insert into t1 values (1, "one"), (2, "two"), (3, "three");
create table t2 (a int, b char(5)) engine=myisam;
insert into t2 values (1, "one"), (2, "two"), (3, "three");
--enable_warnings
create procedure proc_1() load index into cache t1 ignore leaves;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_SP_NO_RETSET
create function func_1() returns int begin load index into cache t1 ignore leaves; return 1; end|
delimiter ;|
prepare abc from "load index into cache t2 ignore leaves";
execute abc;
execute abc;
execute abc;
deallocate prepare abc;
drop table t1, t2;
#
# Bug #21422: GRANT/REVOKE possible inside stored function, probably in a trigger
# This is disabled for now till it is resolved in 5.0
#
#create procedure proc_1() grant all on *.* to abc@host;
#drop procedure proc_1;
#delimiter |;
#--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
#create function func_1() returns int begin grant all on *.* to abc@host; return 1; end|
#delimiter ;|
#prepare abc from "grant all on *.* to abc@host";
#
#create procedure proc_1() revoke all on *.* from abc@host;
#drop procedure proc_1;
#delimiter |;#--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
#create function func_1() returns int begin revoke all on *.* from abc@host; return 1; end|
#delimiter ;|
#prepare abc from "revoke all on *.* from abc@host";
create procedure proc_1() show errors;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_SP_NO_RETSET
create function func_1() returns int begin show errors; return 1; end|
delimiter ;|
prepare abc from "show errors";
deallocate prepare abc;
--disable_warnings
drop table if exists t1;
drop table if exists t2;
--enable_warnings
create procedure proc_1() show warnings;
drop table if exists t1;
call proc_1();
drop table if exists t2;
call proc_1();
drop table if exists t1, t2;
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_SP_NO_RETSET
create function func_1() returns int begin show warnings; return 1; end|
delimiter ;|
prepare abc from "show warnings";
drop table if exists t1;
execute abc;
drop table if exists t2;
execute abc;
drop table if exists t1, t2;
execute abc;
deallocate prepare abc;

View file

@ -330,17 +330,11 @@ prepare stmt4 from ' show engine bdb logs ';
execute stmt4;
--enable_result_log
prepare stmt4 from ' show grants for user ';
--error 1295
prepare stmt4 from ' show create table t2 ';
--error 1295
prepare stmt4 from ' show master status ';
--error 1295
prepare stmt4 from ' show master logs ';
--error 1295
prepare stmt4 from ' show slave status ';
--error 1295
prepare stmt4 from ' show warnings limit 20 ';
--error 1295
prepare stmt4 from ' show errors limit 20 ';
prepare stmt4 from ' show storage engines ';
# The output depends upon the precise order in which
@ -427,14 +421,12 @@ prepare stmt1 from ' execute stmt2 ' ;
prepare stmt1 from ' deallocate prepare never_prepared ' ;
## switch the database connection
--error 1295
--error ER_UNSUPPORTED_PS
prepare stmt4 from ' use test ' ;
## create/drop database
--error 1295
prepare stmt3 from ' create database mysqltest ';
create database mysqltest ;
--error 1295
prepare stmt3 from ' drop database mysqltest ';
drop database mysqltest ;
@ -446,12 +438,12 @@ drop table t2 ;
--error 1146
execute stmt3;
## lock/unlock
--error 1295
--error ER_UNSUPPORTED_PS
prepare stmt3 from ' lock tables t1 read ' ;
--error 1295
--error ER_UNSUPPORTED_PS
prepare stmt3 from ' unlock tables ' ;
## Load/Unload table contents
--error 1295
--error ER_UNSUPPORTED_PS
prepare stmt1 from ' load data infile ''data.txt''
into table t1 fields terminated by ''\t'' ';
prepare stmt1 from ' select * into outfile ''data.txt'' from t1 ';
@ -459,13 +451,12 @@ execute stmt1 ;
##
prepare stmt1 from ' optimize table t1 ' ;
prepare stmt1 from ' analyze table t1 ' ;
--error 1295
prepare stmt1 from ' checksum table t1 ' ;
prepare stmt1 from ' repair table t1 ' ;
--error 1295
--error ER_UNSUPPORTED_PS
prepare stmt1 from ' restore table t1 from ''data.txt'' ' ;
## handler
--error 1295
--error ER_UNSUPPORTED_PS
prepare stmt1 from ' handler t1 open ';
@ -491,11 +482,8 @@ SET sql_mode=ansi;
execute stmt5;
SET sql_mode="";
--error 1295
prepare stmt1 from ' flush local privileges ' ;
--error 1295
prepare stmt1 from ' reset query cache ' ;
--error 1295
prepare stmt1 from ' KILL 0 ';
## simple explain

View file

@ -117,15 +117,12 @@ drop database mysqltest;
#
# grant/revoke + drop user
#
--error 1295
prepare stmt3 from ' grant all on test.t1 to drop_user@localhost
identified by ''looser'' ';
grant all on test.t1 to drop_user@localhost
identified by 'looser' ;
--error 1295
prepare stmt3 from ' revoke all privileges on test.t1 from
drop_user@localhost ';
revoke all privileges on test.t1 from drop_user@localhost ;
--error 1295
prepare stmt3 from ' drop user drop_user@localhost ';
drop user drop_user@localhost;

View file

@ -947,8 +947,12 @@ select cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(3
#
# Bug #11708 (conversion to decimal fails in decimal part)
#
select ln(14000) c1, convert(ln(14000),decimal(2,3)) c2, cast(ln(14000) as decimal(2,3)) c3;
select ln(14000) c1, convert(ln(14000),decimal(5,3)) c2, cast(ln(14000) as decimal(5,3)) c3;
--error 1427
select convert(ln(14000),decimal(2,3)) c1;
--error 1427
select cast(ln(14000) as decimal(2,3)) c1;
#
# Bug #8449 (Silent column changes)
#

View file

@ -328,3 +328,14 @@ drop table t1;
# Restore timezone to default
set time_zone= @@global.time_zone;
CREATE TABLE t1 (
`id` int(11) NOT NULL auto_increment,
`username` varchar(80) NOT NULL default '',
`posted_on` timestamp NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
show fields from t1;
select is_nullable from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='t1' and COLUMN_NAME='posted_on';
drop table t1;

View file

@ -501,44 +501,45 @@ int Instance::stop()
struct timespec timeout;
uint waitchild= (uint) DEFAULT_SHUTDOWN_DELAY;
if (options.shutdown_delay)
if (is_running())
{
/*
NOTE: it is important to check shutdown_delay here, but use
shutdown_delay_val. The idea is that if the option is unset,
shutdown_delay will be NULL, but shutdown_delay_val will not be reset.
*/
waitchild= options.shutdown_delay_val;
if (options.shutdown_delay)
{
/*
NOTE: it is important to check shutdown_delay here, but use
shutdown_delay_val. The idea is that if the option is unset,
shutdown_delay will be NULL, but shutdown_delay_val will not be reset.
*/
waitchild= options.shutdown_delay_val;
}
kill_instance(SIGTERM);
/* sleep on condition to wait for SIGCHLD */
timeout.tv_sec= time(NULL) + waitchild;
timeout.tv_nsec= 0;
if (pthread_mutex_lock(&LOCK_instance))
return ER_STOP_INSTANCE;
while (options.get_pid() != 0) /* while server isn't stopped */
{
int status;
status= pthread_cond_timedwait(&COND_instance_stopped,
&LOCK_instance,
&timeout);
if (status == ETIMEDOUT || status == ETIME)
break;
}
pthread_mutex_unlock(&LOCK_instance);
kill_instance(SIGKILL);
return 0;
}
kill_instance(SIGTERM);
/* sleep on condition to wait for SIGCHLD */
timeout.tv_sec= time(NULL) + waitchild;
timeout.tv_nsec= 0;
if (pthread_mutex_lock(&LOCK_instance))
goto err;
while (options.get_pid() != 0) /* while server isn't stopped */
{
int status;
status= pthread_cond_timedwait(&COND_instance_stopped,
&LOCK_instance,
&timeout);
if (status == ETIMEDOUT || status == ETIME)
break;
}
pthread_mutex_unlock(&LOCK_instance);
kill_instance(SIGKILL);
return 0;
return ER_INSTANCE_IS_NOT_STARTED;
err:
return ER_STOP_INSTANCE;
}
#ifdef __WIN__

View file

@ -47,8 +47,8 @@ static const char *mysqld_error_message(unsigned sql_errno)
case ER_BAD_INSTANCE_NAME:
return "Bad instance name. Check that the instance with such a name exists";
case ER_INSTANCE_IS_NOT_STARTED:
return "Cannot stop instance. Perhaps the instance is not started, or was started"
"manually, so IM cannot find the pidfile.";
return "Cannot stop instance. Perhaps the instance is not started, or was"
" started manually, so IM cannot find the pidfile.";
case ER_INSTANCE_ALREADY_STARTED:
return "The instance is already started";
case ER_CANNOT_START_INSTANCE:
@ -66,7 +66,7 @@ static const char *mysqld_error_message(unsigned sql_errno)
return "Cannot open log file";
case ER_GUESS_LOGFILE:
return "Cannot guess the log filename. Try specifying full log name"
"in the instance options";
" in the instance options";
case ER_ACCESS_OPTION_FILE:
return "Cannot open the option file to edit. Check permissions";
case ER_DROP_ACTIVE_INSTANCE:

View file

@ -1,7 +1,11 @@
#ifndef INCLUDES_MYSQL_INSTANCE_MANAGER_PORTABILITY_H
#define INCLUDES_MYSQL_INSTANCE_MANAGER_PORTABILITY_H
#if defined(_SCO_DS) && !defined(SHUT_RDWR)
#if (defined(_SCO_DS) || defined(UNIXWARE_7)) && !defined(SHUT_RDWR)
/*
SHUT_* functions are defined only if
"(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 >= 1)"
*/
#define SHUT_RDWR 2
#endif

View file

@ -332,6 +332,7 @@
*/
#include "mysql_priv.h"
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation

View file

@ -117,9 +117,10 @@ public:
ulonglong table_flags() const
{
/* fix server to be able to get remote server table flags */
return (HA_PRIMARY_KEY_IN_READ_INDEX | HA_FILE_BASED | HA_REC_NOT_IN_SEQ |
HA_AUTO_PART_KEY | HA_CAN_INDEX_BLOBS| HA_NO_PREFIX_CHAR_KEYS |
HA_PRIMARY_KEY_REQUIRED_FOR_DELETE | HA_PARTIAL_COLUMN_READ);
return (HA_PRIMARY_KEY_IN_READ_INDEX | HA_FILE_BASED
| HA_REC_NOT_IN_SEQ | HA_AUTO_PART_KEY | HA_CAN_INDEX_BLOBS |
HA_NO_PREFIX_CHAR_KEYS | HA_PRIMARY_KEY_REQUIRED_FOR_DELETE |
HA_PARTIAL_COLUMN_READ | HA_NULL_IN_KEY);
}
/*
This is a bitmap of flags that says how the storage engine

View file

@ -1581,6 +1581,17 @@ void ha_partition::update_create_info(HA_CREATE_INFO *create_info)
}
void ha_partition::change_table_ptr(TABLE *table_arg, TABLE_SHARE *share)
{
handler **file_array= m_file;
table= table_arg;
table_share= share;
do
{
(*file_array)->change_table_ptr(table_arg, share);
} while (*(++file_array));
}
/*
Change comments specific to handler

View file

@ -199,6 +199,7 @@ public:
*no_parts= m_tot_parts;
DBUG_RETURN(0);
}
virtual void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share);
private:
int prepare_for_delete();
int copy_partitions(ulonglong *copied, ulonglong *deleted);

View file

@ -72,10 +72,10 @@ ulong savepoint_alloc_size= 0;
static const LEX_STRING sys_table_aliases[]=
{
{(char*)STRING_WITH_LEN("INNOBASE")}, {(char*)STRING_WITH_LEN("INNODB")},
{(char*)STRING_WITH_LEN("NDB")}, {(char*)STRING_WITH_LEN("NDBCLUSTER")},
{(char*)STRING_WITH_LEN("HEAP")}, {(char*)STRING_WITH_LEN("MEMORY")},
{(char*)STRING_WITH_LEN("MERGE")}, {(char*)STRING_WITH_LEN("MRG_MYISAM")},
{ C_STRING_WITH_LEN("INNOBASE") }, { C_STRING_WITH_LEN("INNODB") },
{ C_STRING_WITH_LEN("NDB") }, { C_STRING_WITH_LEN("NDBCLUSTER") },
{ C_STRING_WITH_LEN("HEAP") }, { C_STRING_WITH_LEN("MEMORY") },
{ C_STRING_WITH_LEN("MERGE") }, { C_STRING_WITH_LEN("MRG_MYISAM") },
{NullS, 0}
};

View file

@ -983,7 +983,7 @@ public:
virtual void print_error(int error, myf errflag);
virtual bool get_error_message(int error, String *buf);
uint get_dup_key(int error);
void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share)
virtual void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share)
{
table= table_arg;
table_share= share;

View file

@ -1004,7 +1004,7 @@ bool Item_splocal::set_value(THD *thd, sp_rcontext *ctx, Item **it)
*****************************************************************************/
Item_case_expr::Item_case_expr(int case_expr_id)
:Item_sp_variable((char *) STRING_WITH_LEN("case_expr")),
:Item_sp_variable( C_STRING_WITH_LEN("case_expr")),
m_case_expr_id(case_expr_id)
{
}

View file

@ -454,6 +454,8 @@ Item *create_func_cast(Item *a, Cast_target cast_type, int len, int dec,
CHARSET_INFO *cs)
{
Item *res;
int tmp_len;
LINT_INIT(res);
switch (cast_type) {
case ITEM_CAST_BINARY: res= new Item_func_binary(a); break;
@ -463,7 +465,13 @@ Item *create_func_cast(Item *a, Cast_target cast_type, int len, int dec,
case ITEM_CAST_TIME: res= new Item_time_typecast(a); break;
case ITEM_CAST_DATETIME: res= new Item_datetime_typecast(a); break;
case ITEM_CAST_DECIMAL:
res= new Item_decimal_typecast(a, (len > 0) ? len : 10, dec);
tmp_len= (len>0) ? len : 10;
if (tmp_len < dec)
{
my_error(ER_M_BIGGER_THAN_D, MYF(0), "");
return 0;
}
res= new Item_decimal_typecast(a, tmp_len, dec);
break;
case ITEM_CAST_CHAR:
res= new Item_char_typecast(a, len, cs ? cs :

View file

@ -25,6 +25,15 @@
#ifdef HAVE_SPATIAL
#include <m_ctype.h>
Field *Item_geometry_func::tmp_table_field(TABLE *t_arg)
{
Field *result;
if ((result= new Field_geom(max_length, maybe_null, name, t_arg->s,
(Field::geometry_type) get_geometry_type())))
result->init(t_arg);
return result;
}
void Item_geometry_func::fix_length_and_dec()
{
collation.set(&my_charset_bin);
@ -32,6 +41,10 @@ void Item_geometry_func::fix_length_and_dec()
max_length=MAX_BLOB_WIDTH;
}
int Item_geometry_func::get_geometry_type() const
{
return (int)Field::GEOM_GEOMETRY;
}
String *Item_func_geometry_from_text::val_str(String *str)
{
@ -152,6 +165,12 @@ String *Item_func_geometry_type::val_str(String *str)
}
int Item_func_envelope::get_geometry_type() const
{
return (int) Field::GEOM_POLYGON;
}
String *Item_func_envelope::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
@ -176,6 +195,12 @@ String *Item_func_envelope::val_str(String *str)
}
int Item_func_centroid::get_geometry_type() const
{
return (int) Field::GEOM_POINT;
}
String *Item_func_centroid::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
@ -310,6 +335,12 @@ err:
*/
int Item_func_point::get_geometry_type() const
{
return (int) Field::GEOM_POINT;
}
String *Item_func_point::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);

View file

@ -33,6 +33,8 @@ public:
Item_geometry_func(List<Item> &list) :Item_str_func(list) {}
void fix_length_and_dec();
enum_field_types field_type() const { return MYSQL_TYPE_GEOMETRY; }
Field *tmp_table_field(TABLE *t_arg);
virtual int get_geometry_type() const;
};
class Item_func_geometry_from_text: public Item_geometry_func
@ -89,6 +91,7 @@ public:
Item_func_centroid(Item *a): Item_geometry_func(a) {}
const char *func_name() const { return "centroid"; }
String *val_str(String *);
int get_geometry_type() const;
};
class Item_func_envelope: public Item_geometry_func
@ -97,6 +100,7 @@ public:
Item_func_envelope(Item *a): Item_geometry_func(a) {}
const char *func_name() const { return "envelope"; }
String *val_str(String *);
int get_geometry_type() const;
};
class Item_func_point: public Item_geometry_func
@ -106,6 +110,7 @@ public:
Item_func_point(Item *a, Item *b, Item *srid): Item_geometry_func(a, b, srid) {}
const char *func_name() const { return "point"; }
String *val_str(String *);
int get_geometry_type() const;
};
class Item_func_spatial_decomp: public Item_geometry_func

View file

@ -1680,14 +1680,12 @@ uint Item_func_date_format::format_length(const String *format)
case 'u': /* week (00..52), where week starts with Monday */
case 'V': /* week 1..53 used with 'x' */
case 'v': /* week 1..53 used with 'x', where week starts with Monday */
case 'H': /* hour (00..23) */
case 'y': /* year, numeric, 2 digits */
case 'm': /* month, numeric */
case 'd': /* day (of the month), numeric */
case 'h': /* hour (01..12) */
case 'I': /* --||-- */
case 'i': /* minutes, numeric */
case 'k': /* hour ( 0..23) */
case 'l': /* hour ( 1..12) */
case 'p': /* locale's AM or PM */
case 'S': /* second (00..61) */
@ -1696,6 +1694,10 @@ uint Item_func_date_format::format_length(const String *format)
case 'e': /* day (0..31) */
size += 2;
break;
case 'k': /* hour ( 0..23) */
case 'H': /* hour (00..23; value > 23 OK, padding always 2-digit) */
size += 7; /* docs allow > 23, range depends on sizeof(unsigned int) */
break;
case 'r': /* time, 12-hour (hh:mm:ss [AP]M) */
size += 11;
break;

View file

@ -874,6 +874,8 @@ end:
int lock_table_name(THD *thd, TABLE_LIST *table_list, bool check_in_use)
{
TABLE *table;
TABLE_SHARE *share;
char *key_buff;
char key[MAX_DBKEY_LENGTH];
char *db= table_list->db;
uint key_length;
@ -903,17 +905,18 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list, bool check_in_use)
}
/*
Create a table entry with the right key and with an old refresh version
Note that we must use my_malloc() here as this is freed by the table
cache
Note that we must use my_multi_malloc() here as this is freed by the
table cache
*/
if (!(table= (TABLE*) my_malloc(sizeof(*table)+ sizeof(TABLE_SHARE)+
key_length, MYF(MY_WME | MY_ZEROFILL))))
if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
&table, sizeof(*table),
&share, sizeof(*share),
&key_buff, key_length,
NULL))
DBUG_RETURN(-1);
table->s= (TABLE_SHARE*) (table+1);
memcpy((table->s->table_cache_key.str= (char*) (table->s+1)), key,
key_length);
table->s->table_cache_key.length= key_length;
table->s->tmp_table= INTERNAL_TMP_TABLE; // for intern_close_table
table->s= share;
share->set_table_cache_key(key_buff, key, key_length);
share->tmp_table= INTERNAL_TMP_TABLE; // for intern_close_table
table->in_use= thd;
table->locked_by_name=1;
table_list->table=table;

View file

@ -1378,8 +1378,6 @@ bool mysql_load(THD *thd, sql_exchange *ex, TABLE_LIST *table_list,
int write_record(THD *thd, TABLE *table, COPY_INFO *info);
/* sql_manager.cc */
/* bits set in manager_status */
#define MANAGER_BERKELEY_LOG_CLEANUP (1L << 0)
extern ulong volatile manager_status;
extern bool volatile manager_thread_in_use, mqh_used;
extern pthread_t manager_thread;
@ -1479,7 +1477,7 @@ extern char *mysql_data_home,server_version[SERVER_VERSION_LENGTH],
def_ft_boolean_syntax[sizeof(ft_boolean_syntax)];
#define mysql_tmpdir (my_tmpdir(&mysql_tmpdir_list))
extern MY_TMPDIR mysql_tmpdir_list;
extern LEX_STRING command_name[];
extern const LEX_STRING command_name[];
extern const char *first_keyword, *my_localhost, *delayed_user, *binary_keyword;
extern const char **errmesg; /* Error messages */
extern const char *myisam_recover_options_str;

View file

@ -2785,9 +2785,8 @@ static int init_common_variables(const char *conf_file_name, int argc,
get corrupted if accesses with names of different case.
*/
DBUG_PRINT("info", ("lower_case_table_names: %d", lower_case_table_names));
if (!lower_case_table_names &&
(lower_case_file_system=
(test_if_case_insensitive(mysql_real_data_home) == 1)))
lower_case_file_system= test_if_case_insensitive(mysql_real_data_home);
if (!lower_case_table_names && lower_case_file_system == 1)
{
if (lower_case_table_names_used)
{

View file

@ -487,7 +487,7 @@ sys_var_const_str sys_version_compile_os("version_compile_os",
SYSTEM_TYPE);
sys_var_thd_ulong sys_net_wait_timeout("wait_timeout",
&SV::net_wait_timeout);
#ifdef WITH_INNOBASE_STORAGE_ENGINE
sys_var_long_ptr sys_innodb_fast_shutdown("innodb_fast_shutdown",
&innobase_fast_shutdown);
sys_var_long_ptr sys_innodb_max_dirty_pages_pct("innodb_max_dirty_pages_pct",
@ -513,7 +513,7 @@ sys_var_long_ptr sys_innodb_commit_concurrency("innodb_commit_concurrency",
sys_var_long_ptr sys_innodb_flush_log_at_trx_commit(
"innodb_flush_log_at_trx_commit",
&srv_flush_log_at_trx_commit);
#endif
/* Condition pushdown to storage engine */
sys_var_thd_bool
sys_engine_condition_pushdown("engine_condition_pushdown",
@ -816,6 +816,7 @@ SHOW_VAR init_vars[]= {
{"init_connect", (char*) &sys_init_connect, SHOW_SYS},
{"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR},
{"init_slave", (char*) &sys_init_slave, SHOW_SYS},
#ifdef WITH_INNOBASE_STORAGE_ENGINE
{"innodb_additional_mem_pool_size", (char*) &innobase_additional_mem_pool_size, SHOW_LONG },
{sys_innodb_autoextend_increment.name, (char*) &sys_innodb_autoextend_increment, SHOW_SYS},
{"innodb_buffer_pool_awe_mem_mb", (char*) &innobase_buffer_pool_awe_mem_mb, SHOW_LONG },
@ -849,6 +850,7 @@ SHOW_VAR init_vars[]= {
{sys_innodb_thread_concurrency.name, (char*) &sys_innodb_thread_concurrency, SHOW_SYS},
{sys_innodb_thread_sleep_delay.name, (char*) &sys_innodb_thread_sleep_delay, SHOW_SYS},
{sys_innodb_flush_log_at_trx_commit.name, (char*) &sys_innodb_flush_log_at_trx_commit, SHOW_SYS},
#endif
{sys_interactive_timeout.name,(char*) &sys_interactive_timeout, SHOW_SYS},
{sys_join_buffer_size.name, (char*) &sys_join_buffer_size, SHOW_SYS},
{sys_key_buffer_size.name, (char*) &sys_key_buffer_size, SHOW_SYS},

View file

@ -3051,7 +3051,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
rli->is_until_satisfied())
{
char buf[22];
sql_print_error("Slave SQL thread stopped because it reached its"
sql_print_information("Slave SQL thread stopped because it reached its"
" UNTIL position %s", llstr(rli->until_pos(), buf));
/*
Setting abort_slave flag because we do not want additional message about

View file

@ -161,17 +161,20 @@ sp_get_flags_for_command(LEX *lex)
}
/* fallthrough */
case SQLCOM_ANALYZE:
case SQLCOM_BACKUP_TABLE:
case SQLCOM_OPTIMIZE:
case SQLCOM_PRELOAD_KEYS:
case SQLCOM_ASSIGN_TO_KEYCACHE:
case SQLCOM_CHECKSUM:
case SQLCOM_CHECK:
case SQLCOM_HA_READ:
case SQLCOM_SHOW_AUTHORS:
case SQLCOM_SHOW_BINLOGS:
case SQLCOM_SHOW_BINLOG_EVENTS:
case SQLCOM_SHOW_CHARSETS:
case SQLCOM_SHOW_COLLATIONS:
case SQLCOM_SHOW_COLUMN_TYPES:
case SQLCOM_SHOW_CONTRIBUTORS:
case SQLCOM_SHOW_CREATE:
case SQLCOM_SHOW_CREATE_DB:
case SQLCOM_SHOW_CREATE_FUNC:
@ -180,16 +183,20 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_SHOW_DATABASES:
case SQLCOM_SHOW_ERRORS:
case SQLCOM_SHOW_FIELDS:
case SQLCOM_SHOW_FUNC_CODE:
case SQLCOM_SHOW_GRANTS:
case SQLCOM_SHOW_ENGINE_STATUS:
case SQLCOM_SHOW_ENGINE_LOGS:
case SQLCOM_SHOW_ENGINE_MUTEX:
case SQLCOM_SHOW_EVENTS:
case SQLCOM_SHOW_KEYS:
case SQLCOM_SHOW_MASTER_STAT:
case SQLCOM_SHOW_NEW_MASTER:
case SQLCOM_SHOW_OPEN_TABLES:
case SQLCOM_SHOW_PRIVILEGES:
case SQLCOM_SHOW_PROCESSLIST:
case SQLCOM_SHOW_PROC_CODE:
case SQLCOM_SHOW_SCHEDULER_STATUS:
case SQLCOM_SHOW_SLAVE_HOSTS:
case SQLCOM_SHOW_SLAVE_STAT:
case SQLCOM_SHOW_STATUS:
@ -199,12 +206,7 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_SHOW_TABLES:
case SQLCOM_SHOW_VARIABLES:
case SQLCOM_SHOW_WARNS:
case SQLCOM_SHOW_PROC_CODE:
case SQLCOM_SHOW_FUNC_CODE:
case SQLCOM_SHOW_AUTHORS:
case SQLCOM_SHOW_CONTRIBUTORS:
case SQLCOM_REPAIR:
case SQLCOM_BACKUP_TABLE:
case SQLCOM_RESTORE_TABLE:
flags= sp_head::MULTI_RESULTS;
break;
@ -262,6 +264,9 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_CREATE_EVENT:
case SQLCOM_ALTER_EVENT:
case SQLCOM_DROP_EVENT:
case SQLCOM_FLUSH:
case SQLCOM_INSTALL_PLUGIN:
case SQLCOM_UNINSTALL_PLUGIN:
flags= sp_head::HAS_COMMIT_OR_ROLLBACK;
break;
default:

View file

@ -36,114 +36,114 @@ time_t mysql_db_table_last_check= 0L;
TABLE_FIELD_W_TYPE mysql_db_table_fields[MYSQL_DB_FIELD_COUNT] = {
{
{(char *) STRING_WITH_LEN("Host")},
{(char *) STRING_WITH_LEN("char(60)")},
{ C_STRING_WITH_LEN("Host") },
{ C_STRING_WITH_LEN("char(60)") },
{NULL, 0}
},
{
{(char *) STRING_WITH_LEN("Db")},
{(char *) STRING_WITH_LEN("char(64)")},
{ C_STRING_WITH_LEN("Db") },
{ C_STRING_WITH_LEN("char(64)") },
{NULL, 0}
},
{
{(char *) STRING_WITH_LEN("User")},
{(char *) STRING_WITH_LEN("char(16)")},
{ C_STRING_WITH_LEN("User") },
{ C_STRING_WITH_LEN("char(16)") },
{NULL, 0}
},
{
{(char *) STRING_WITH_LEN("Select_priv")},
{(char *) STRING_WITH_LEN("enum('N','Y')")},
{(char *) STRING_WITH_LEN("utf8")}
{ C_STRING_WITH_LEN("Select_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{(char *) STRING_WITH_LEN("Insert_priv")},
{(char *) STRING_WITH_LEN("enum('N','Y')")},
{(char *) STRING_WITH_LEN("utf8")}
{ C_STRING_WITH_LEN("Insert_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{(char *) STRING_WITH_LEN("Update_priv")},
{(char *) STRING_WITH_LEN("enum('N','Y')")},
{(char *) STRING_WITH_LEN("utf8")}
{ C_STRING_WITH_LEN("Update_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{(char *) STRING_WITH_LEN("Delete_priv")},
{(char *) STRING_WITH_LEN("enum('N','Y')")},
{(char *) STRING_WITH_LEN("utf8")}
{ C_STRING_WITH_LEN("Delete_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{(char *) STRING_WITH_LEN("Create_priv")},
{(char *) STRING_WITH_LEN("enum('N','Y')")},
{(char *) STRING_WITH_LEN("utf8")}
{ C_STRING_WITH_LEN("Create_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{(char *) STRING_WITH_LEN("Drop_priv")},
{(char *) STRING_WITH_LEN("enum('N','Y')")},
{(char *) STRING_WITH_LEN("utf8")}
{ C_STRING_WITH_LEN("Drop_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{(char *) STRING_WITH_LEN("Grant_priv")},
{(char *) STRING_WITH_LEN("enum('N','Y')")},
{(char *) STRING_WITH_LEN("utf8")}
{ C_STRING_WITH_LEN("Grant_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{(char *) STRING_WITH_LEN("References_priv")},
{(char *) STRING_WITH_LEN("enum('N','Y')")},
{(char *) STRING_WITH_LEN("utf8")}
{ C_STRING_WITH_LEN("References_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{(char *) STRING_WITH_LEN("Index_priv")},
{(char *) STRING_WITH_LEN("enum('N','Y')")},
{(char *) STRING_WITH_LEN("utf8")}
{ C_STRING_WITH_LEN("Index_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{(char *) STRING_WITH_LEN("Alter_priv")},
{(char *) STRING_WITH_LEN("enum('N','Y')")},
{(char *) STRING_WITH_LEN("utf8")}
{ C_STRING_WITH_LEN("Alter_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{(char *) STRING_WITH_LEN("Create_tmp_table_priv")},
{(char *) STRING_WITH_LEN("enum('N','Y')")},
{(char *) STRING_WITH_LEN("utf8")}
{ C_STRING_WITH_LEN("Create_tmp_table_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{(char *) STRING_WITH_LEN("Lock_tables_priv")},
{(char *) STRING_WITH_LEN("enum('N','Y')")},
{(char *) STRING_WITH_LEN("utf8")}
{ C_STRING_WITH_LEN("Lock_tables_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{(char *) STRING_WITH_LEN("Create_view_priv")},
{(char *) STRING_WITH_LEN("enum('N','Y')")},
{(char *) STRING_WITH_LEN("utf8")}
{ C_STRING_WITH_LEN("Create_view_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{(char *) STRING_WITH_LEN("Show_view_priv")},
{(char *) STRING_WITH_LEN("enum('N','Y')")},
{(char *) STRING_WITH_LEN("utf8")}
{ C_STRING_WITH_LEN("Show_view_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{(char *) STRING_WITH_LEN("Create_routine_priv")},
{(char *) STRING_WITH_LEN("enum('N','Y')")},
{(char *) STRING_WITH_LEN("utf8")}
{ C_STRING_WITH_LEN("Create_routine_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{(char *) STRING_WITH_LEN("Alter_routine_priv")},
{(char *) STRING_WITH_LEN("enum('N','Y')")},
{(char *) STRING_WITH_LEN("utf8")}
{ C_STRING_WITH_LEN("Alter_routine_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{(char *) STRING_WITH_LEN("Execute_priv")},
{(char *) STRING_WITH_LEN("enum('N','Y')")},
{(char *) STRING_WITH_LEN("utf8")}
{ C_STRING_WITH_LEN("Execute_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{(char *) STRING_WITH_LEN("Event_priv")},
{(char *) STRING_WITH_LEN("enum('N','Y')")},
{(char *) STRING_WITH_LEN("utf8")}
{ C_STRING_WITH_LEN("Event_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{(char *) STRING_WITH_LEN("Trigger_priv")},
{(char *) STRING_WITH_LEN("enum('N','Y')")},
{(char *) STRING_WITH_LEN("utf8")}
{ C_STRING_WITH_LEN("Trigger_priv") },
{ C_STRING_WITH_LEN("enum('N','Y')") },
{ C_STRING_WITH_LEN("utf8") }
}
};
@ -3932,9 +3932,24 @@ bool check_column_grant_in_table_ref(THD *thd, TABLE_LIST * table_ref,
if (table_ref->view || table_ref->field_translation)
{
/* View or derived information schema table. */
ulong view_privs;
grant= &(table_ref->grant);
db_name= table_ref->view_db.str;
table_name= table_ref->view_name.str;
if (table_ref->belong_to_view &&
(thd->lex->sql_command == SQLCOM_SHOW_FIELDS ||
thd->lex->sql_command == SQLCOM_SHOW_CREATE))
{
view_privs= get_column_grant(thd, grant, db_name, table_name, name);
if (view_privs & VIEW_ANY_ACL)
{
table_ref->belong_to_view->allowed_show= TRUE;
return FALSE;
}
table_ref->belong_to_view->allowed_show= FALSE;
my_message(ER_VIEW_NO_EXPLAIN, ER(ER_VIEW_NO_EXPLAIN), MYF(0));
return TRUE;
}
}
else
{
@ -4823,6 +4838,32 @@ int open_grant_tables(THD *thd, TABLE_LIST *tables)
DBUG_RETURN(0);
}
ACL_USER *check_acl_user(LEX_USER *user_name,
uint *acl_acl_userdx)
{
ACL_USER *acl_user= 0;
uint counter;
safe_mutex_assert_owner(&acl_cache->lock);
for (counter= 0 ; counter < acl_users.elements ; counter++)
{
const char *user,*host;
acl_user= dynamic_element(&acl_users, counter, ACL_USER*);
if (!(user=acl_user->user))
user= "";
if (!(host=acl_user->host.hostname))
host= "";
if (!strcmp(user_name->user.str,user) &&
!my_strcasecmp(system_charset_info, user_name->host.str, host))
break;
}
if (counter == acl_users.elements)
return 0;
*acl_acl_userdx= counter;
return acl_user;
}
/*
Modify a privilege table.
@ -4871,7 +4912,6 @@ static int modify_grant_table(TABLE *table, Field *host_field,
DBUG_RETURN(error);
}
/*
Handle a privilege table.
@ -5367,7 +5407,16 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
{
result= TRUE;
continue;
}
}
if (user_name->host.length > HOSTNAME_LENGTH ||
user_name->user.length > USERNAME_LENGTH)
{
append_user(&wrong_users, user_name);
result= TRUE;
continue;
}
/*
Search all in-memory structures and grant tables
for a mention of the new user name.
@ -5508,7 +5557,7 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
result= TRUE;
}
}
/* Rebuild 'acl_check_hosts' since 'acl_users' has been modified */
rebuild_check_host();

View file

@ -634,6 +634,7 @@ TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name)
static void close_handle_and_leave_table_as_lock(TABLE *table)
{
TABLE_SHARE *share, *old_share= table->s;
char *key_buff;
MEM_ROOT *mem_root= &table->mem_root;
DBUG_ENTER("close_handle_and_leave_table_as_lock");
@ -642,20 +643,14 @@ static void close_handle_and_leave_table_as_lock(TABLE *table)
This has to be done to ensure that the table share is removed from
the table defintion cache as soon as the last instance is removed
*/
if ((share= (TABLE_SHARE*) alloc_root(mem_root, sizeof(*share))))
if (multi_alloc_root(mem_root,
&share, sizeof(*share),
&key_buff, old_share->table_cache_key.length,
NULL))
{
bzero((char*) share, sizeof(*share));
share->db.str= memdup_root(mem_root, old_share->db.str,
old_share->db.length+1);
share->db.length= old_share->db.length;
share->table_name.str= memdup_root(mem_root,
old_share->table_name.str,
old_share->table_name.length+1);
share->table_name.length= old_share->table_name.length;
share->table_cache_key.str= memdup_root(mem_root,
old_share->table_cache_key.str,
old_share->table_cache_key.length);
share->table_cache_key.length= old_share->table_cache_key.length;
share->set_table_cache_key(key_buff, old_share->table_cache_key.str,
old_share->table_cache_key.length);
share->tmp_table= INTERNAL_TMP_TABLE; // for intern_close_table()
}
@ -1603,28 +1598,18 @@ bool rename_temporary_table(THD* thd, TABLE *table, const char *db,
const char *table_name)
{
char *key;
uint key_length;
TABLE_SHARE *share= table->s;
TABLE_LIST table_list;
uint db_length, table_length;
DBUG_ENTER("rename_temporary_table");
if (!(key=(char*) alloc_root(&share->mem_root,
(uint) (db_length= strlen(db))+
(uint) (table_length= strlen(table_name))+6+4)))
if (!(key=(char*) alloc_root(&share->mem_root, MAX_DBKEY_LENGTH)))
DBUG_RETURN(1); /* purecov: inspected */
table_list.db= (char*) db;
table_list.table_name= (char*) table_name;
share->db.str= share->table_cache_key.str= key;
share->db.length= db_length;
share->table_cache_key.length= create_table_def_key(thd, key,
&table_list, 1);
/*
Here we use the fact that table_name is stored as the second component
in the 'key' (after db_name), where components are separated with \0
*/
share->table_name.str= key+db_length+1;
share->table_name.length= table_length;
key_length= create_table_def_key(thd, key, &table_list, 1);
share->set_table_cache_key(key, key_length);
DBUG_RETURN(0);
}
@ -1749,10 +1734,7 @@ bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list)
{
TABLE *table= table_list->table;
TABLE_SHARE *share;
char *db= table_list->db;
char *table_name= table_list->table_name;
char key[MAX_DBKEY_LENGTH];
uint key_length;
TABLE orig_table;
DBUG_ENTER("reopen_name_locked_table");
@ -1762,7 +1744,6 @@ bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list)
DBUG_RETURN(TRUE);
orig_table= *table;
key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1;
if (open_unireg_entry(thd, table, table_list, table_name,
table->s->table_cache_key.str,

View file

@ -212,12 +212,12 @@ void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level,
TRUE Error sending data to client
*/
LEX_STRING warning_level_names[]=
const LEX_STRING warning_level_names[]=
{
{(char*) STRING_WITH_LEN("Note")},
{(char*) STRING_WITH_LEN("Warning")},
{(char*) STRING_WITH_LEN("Error")},
{(char*) STRING_WITH_LEN("?")}
{ C_STRING_WITH_LEN("Note") },
{ C_STRING_WITH_LEN("Warning") },
{ C_STRING_WITH_LEN("Error") },
{ C_STRING_WITH_LEN("?") }
};
bool mysqld_show_warnings(THD *thd, ulong levels_to_show)

View file

@ -41,4 +41,4 @@ void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level,
void mysql_reset_errors(THD *thd, bool force);
bool mysqld_show_warnings(THD *thd, ulong levels_to_show);
extern LEX_STRING warning_level_names[];
extern const LEX_STRING warning_level_names[];

View file

@ -567,23 +567,20 @@ int MYSQLlex(void *arg, void *yythd)
case MY_LEX_IDENT_OR_NCHAR:
if (yyPeek() != '\'')
{ // Found x'hex-number'
{
state= MY_LEX_IDENT;
break;
}
yyGet(); // Skip '
while ((c = yyGet()) && (c !='\'')) ;
length=(lex->ptr - lex->tok_start); // Length of hexnum+3
if (c != '\'')
/* Found N'string' */
lex->tok_start++; // Skip N
yySkip(); // Skip '
if (!(yylval->lex_str.str = get_text(lex)))
{
return(ABORT_SYM); // Illegal hex constant
state= MY_LEX_CHAR; // Read char by char
break;
}
yyGet(); // get_token makes an unget
yylval->lex_str=get_token(lex,length);
yylval->lex_str.str+=2; // Skip x'
yylval->lex_str.length-=3; // Don't count x' and last '
lex->yytoklen-=3;
return (NCHAR_STRING);
yylval->lex_str.length= lex->yytoklen;
return(NCHAR_STRING);
case MY_LEX_IDENT_OR_HEX:
if (yyPeek() == '\'')

View file

@ -149,11 +149,11 @@ enum enum_sp_data_access
const LEX_STRING sp_data_access_name[]=
{
{ (char*) STRING_WITH_LEN("") },
{ (char*) STRING_WITH_LEN("CONTAINS SQL") },
{ (char*) STRING_WITH_LEN("NO SQL") },
{ (char*) STRING_WITH_LEN("READS SQL DATA") },
{ (char*) STRING_WITH_LEN("MODIFIES SQL DATA") }
{ C_STRING_WITH_LEN("") },
{ C_STRING_WITH_LEN("CONTAINS SQL") },
{ C_STRING_WITH_LEN("NO SQL") },
{ C_STRING_WITH_LEN("READS SQL DATA") },
{ C_STRING_WITH_LEN("MODIFIES SQL DATA") }
};
#define DERIVED_SUBQUERY 1

View file

@ -72,38 +72,38 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables);
const char *any_db="*any*"; // Special symbol for check_access
LEX_STRING command_name[]={
(char *)STRING_WITH_LEN("Sleep"),
(char *)STRING_WITH_LEN("Quit"),
(char *)STRING_WITH_LEN("Init DB"),
(char *)STRING_WITH_LEN("Query"),
(char *)STRING_WITH_LEN("Field List"),
(char *)STRING_WITH_LEN("Create DB"),
(char *)STRING_WITH_LEN("Drop DB"),
(char *)STRING_WITH_LEN("Refresh"),
(char *)STRING_WITH_LEN("Shutdown"),
(char *)STRING_WITH_LEN("Statistics"),
(char *)STRING_WITH_LEN("Processlist"),
(char *)STRING_WITH_LEN("Connect"),
(char *)STRING_WITH_LEN("Kill"),
(char *)STRING_WITH_LEN("Debug"),
(char *)STRING_WITH_LEN("Ping"),
(char *)STRING_WITH_LEN("Time"),
(char *)STRING_WITH_LEN("Delayed insert"),
(char *)STRING_WITH_LEN("Change user"),
(char *)STRING_WITH_LEN("Binlog Dump"),
(char *)STRING_WITH_LEN("Table Dump"),
(char *)STRING_WITH_LEN("Connect Out"),
(char *)STRING_WITH_LEN("Register Slave"),
(char *)STRING_WITH_LEN("Prepare"),
(char *)STRING_WITH_LEN("Execute"),
(char *)STRING_WITH_LEN("Long Data"),
(char *)STRING_WITH_LEN("Close stmt"),
(char *)STRING_WITH_LEN("Reset stmt"),
(char *)STRING_WITH_LEN("Set option"),
(char *)STRING_WITH_LEN("Fetch"),
(char *)STRING_WITH_LEN("Daemon"),
(char *)STRING_WITH_LEN("Error") // Last command number
const LEX_STRING command_name[]={
C_STRING_WITH_LEN("Sleep"),
C_STRING_WITH_LEN("Quit"),
C_STRING_WITH_LEN("Init DB"),
C_STRING_WITH_LEN("Query"),
C_STRING_WITH_LEN("Field List"),
C_STRING_WITH_LEN("Create DB"),
C_STRING_WITH_LEN("Drop DB"),
C_STRING_WITH_LEN("Refresh"),
C_STRING_WITH_LEN("Shutdown"),
C_STRING_WITH_LEN("Statistics"),
C_STRING_WITH_LEN("Processlist"),
C_STRING_WITH_LEN("Connect"),
C_STRING_WITH_LEN("Kill"),
C_STRING_WITH_LEN("Debug"),
C_STRING_WITH_LEN("Ping"),
C_STRING_WITH_LEN("Time"),
C_STRING_WITH_LEN("Delayed insert"),
C_STRING_WITH_LEN("Change user"),
C_STRING_WITH_LEN("Binlog Dump"),
C_STRING_WITH_LEN("Table Dump"),
C_STRING_WITH_LEN("Connect Out"),
C_STRING_WITH_LEN("Register Slave"),
C_STRING_WITH_LEN("Prepare"),
C_STRING_WITH_LEN("Execute"),
C_STRING_WITH_LEN("Long Data"),
C_STRING_WITH_LEN("Close stmt"),
C_STRING_WITH_LEN("Reset stmt"),
C_STRING_WITH_LEN("Set option"),
C_STRING_WITH_LEN("Fetch"),
C_STRING_WITH_LEN("Daemon"),
C_STRING_WITH_LEN("Error") // Last command number
};
const char *xa_state_names[]={
@ -4924,9 +4924,9 @@ end_with_restore_list:
{
String buff;
const LEX_STRING command[3]=
{{(char *)STRING_WITH_LEN("CREATE ")},
{(char *)STRING_WITH_LEN("ALTER ")},
{(char *)STRING_WITH_LEN("CREATE OR REPLACE ")}};
{{ C_STRING_WITH_LEN("CREATE ") },
{ C_STRING_WITH_LEN("ALTER ") },
{ C_STRING_WITH_LEN("CREATE OR REPLACE ") }};
thd->clear_error();
buff.append(command[thd->lex->create_view_mode].str,

View file

@ -46,12 +46,12 @@
*/
const LEX_STRING partition_keywords[]=
{
{ (char *) STRING_WITH_LEN("HASH") },
{ (char *) STRING_WITH_LEN("RANGE") },
{ (char *) STRING_WITH_LEN("LIST") },
{ (char *) STRING_WITH_LEN("KEY") },
{ (char *) STRING_WITH_LEN("MAXVALUE") },
{ (char *) STRING_WITH_LEN("LINEAR ") }
{ C_STRING_WITH_LEN("HASH") },
{ C_STRING_WITH_LEN("RANGE") },
{ C_STRING_WITH_LEN("LIST") },
{ C_STRING_WITH_LEN("KEY") },
{ C_STRING_WITH_LEN("MAXVALUE") },
{ C_STRING_WITH_LEN("LINEAR ") }
};
static const char *part_str= "PARTITION";
static const char *sub_str= "SUB";

View file

@ -25,9 +25,9 @@ char *opt_plugin_dir_ptr;
char opt_plugin_dir[FN_REFLEN];
const LEX_STRING plugin_type_names[MYSQL_MAX_PLUGIN_TYPE_NUM]=
{
{ (char *)STRING_WITH_LEN("UDF") },
{ (char *)STRING_WITH_LEN("STORAGE ENGINE") },
{ (char *)STRING_WITH_LEN("FTPARSER") }
{ C_STRING_WITH_LEN("UDF") },
{ C_STRING_WITH_LEN("STORAGE ENGINE") },
{ C_STRING_WITH_LEN("FTPARSER") }
};
plugin_type_init plugin_type_initialize[MYSQL_MAX_PLUGIN_TYPE_NUM]=

View file

@ -1740,6 +1740,20 @@ static bool check_prepared_statement(Prepared_statement *stmt,
case SQLCOM_SHOW_ENGINE_MUTEX:
case SQLCOM_SHOW_CREATE_DB:
case SQLCOM_SHOW_GRANTS:
case SQLCOM_SHOW_BINLOG_EVENTS:
case SQLCOM_SHOW_MASTER_STAT:
case SQLCOM_SHOW_SLAVE_STAT:
case SQLCOM_SHOW_CREATE_PROC:
case SQLCOM_SHOW_CREATE_FUNC:
case SQLCOM_SHOW_CREATE_EVENT:
case SQLCOM_SHOW_CREATE:
case SQLCOM_SHOW_PROC_CODE:
case SQLCOM_SHOW_FUNC_CODE:
case SQLCOM_SHOW_AUTHORS:
case SQLCOM_SHOW_CONTRIBUTORS:
case SQLCOM_SHOW_WARNS:
case SQLCOM_SHOW_ERRORS:
case SQLCOM_SHOW_BINLOGS:
case SQLCOM_DROP_TABLE:
case SQLCOM_RENAME_TABLE:
case SQLCOM_ALTER_TABLE:
@ -1754,6 +1768,25 @@ static bool check_prepared_statement(Prepared_statement *stmt,
case SQLCOM_REPAIR:
case SQLCOM_ANALYZE:
case SQLCOM_OPTIMIZE:
case SQLCOM_CHANGE_MASTER:
case SQLCOM_RESET:
case SQLCOM_FLUSH:
case SQLCOM_SLAVE_START:
case SQLCOM_SLAVE_STOP:
case SQLCOM_INSTALL_PLUGIN:
case SQLCOM_UNINSTALL_PLUGIN:
case SQLCOM_CREATE_DB:
case SQLCOM_DROP_DB:
case SQLCOM_RENAME_DB:
case SQLCOM_CHECKSUM:
case SQLCOM_CREATE_USER:
case SQLCOM_RENAME_USER:
case SQLCOM_DROP_USER:
case SQLCOM_ASSIGN_TO_KEYCACHE:
case SQLCOM_PRELOAD_KEYS:
case SQLCOM_GRANT:
case SQLCOM_REVOKE:
case SQLCOM_KILL:
break;
default:

View file

@ -8645,8 +8645,6 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
share->primary_key= MAX_KEY; // Indicate no primary key
share->keys_for_keyread.init();
share->keys_in_use.init();
/* For easier error reporting */
share->table_cache_key= share->db;
/* Calculate which type of fields we will store in the temporary table */

View file

@ -2171,7 +2171,7 @@ LEX_STRING *make_lex_string(THD *thd, LEX_STRING *lex_str,
/* INFORMATION_SCHEMA name */
LEX_STRING information_schema_name= {(char*)"information_schema", 18};
LEX_STRING information_schema_name= { C_STRING_WITH_LEN("information_schema")};
/* This is only used internally, but we need it here as a forward reference */
extern ST_SCHEMA_TABLE schema_tables[];
@ -3070,9 +3070,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
table->field[5]->store("",0, cs);
table->field[5]->set_notnull();
}
pos=(byte*) ((flags & NOT_NULL_FLAG) &&
field->type() != FIELD_TYPE_TIMESTAMP ?
"NO" : "YES");
pos=(byte*) ((flags & NOT_NULL_FLAG) ? "NO" : "YES");
table->field[6]->store((const char*) pos,
strlen((const char*) pos), cs);
is_blob= (field->type() == FIELD_TYPE_BLOB);
@ -3214,10 +3212,10 @@ static my_bool iter_schema_engines(THD *thd, st_plugin_int *plugin,
if (!(wild && wild[0] &&
wild_case_compare(scs, plugin->name.str,wild)))
{
LEX_STRING state[2]= {{(char*) STRING_WITH_LEN("ENABLED")},
{(char*) STRING_WITH_LEN("DISABLED")}};
LEX_STRING yesno[2]= {{(char*) STRING_WITH_LEN("NO")},
{(char*) STRING_WITH_LEN("YES")}};
LEX_STRING state[2]= {{ C_STRING_WITH_LEN("ENABLED") },
{ C_STRING_WITH_LEN("DISABLED") }};
LEX_STRING yesno[2]= {{ C_STRING_WITH_LEN("NO") },
{ C_STRING_WITH_LEN("YES") }};
LEX_STRING *tmp;
restore_record(table, s->default_values);
@ -3549,31 +3547,18 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables,
if (tables->view)
{
Security_context *sctx= thd->security_ctx;
ulong grant= SHOW_VIEW_ACL;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
char *save_table_name= tables->table_name;
if (!my_strcasecmp(system_charset_info, tables->definer.user.str,
sctx->priv_user) &&
!my_strcasecmp(system_charset_info, tables->definer.host.str,
sctx->priv_host))
grant= SHOW_VIEW_ACL;
else
if (!tables->allowed_show)
{
tables->table_name= tables->view_name.str;
if (check_access(thd, SHOW_VIEW_ACL , base_name,
&tables->grant.privilege, 0, 1,
test(tables->schema_table)))
grant= get_table_grant(thd, tables);
else
grant= tables->grant.privilege;
if (!my_strcasecmp(system_charset_info, tables->definer.user.str,
sctx->priv_user) &&
!my_strcasecmp(system_charset_info, tables->definer.host.str,
sctx->priv_host))
tables->allowed_show= TRUE;
}
tables->table_name= save_table_name;
#endif
restore_record(table, s->default_values);
table->field[1]->store(tables->view_db.str, tables->view_db.length, cs);
table->field[2]->store(tables->view_name.str, tables->view_name.length, cs);
if (grant & SHOW_VIEW_ACL)
if (tables->allowed_show)
{
char buff[2048];
String qwe_str(buff, sizeof(buff), cs);

View file

@ -22,7 +22,7 @@
#include "parse_file.h"
static const LEX_STRING triggers_file_type=
{(char *) STRING_WITH_LEN("TRIGGERS")};
{ C_STRING_WITH_LEN("TRIGGERS") };
const char * const triggers_file_ext= ".TRG";
@ -35,17 +35,17 @@ const char * const triggers_file_ext= ".TRG";
static File_option triggers_file_parameters[]=
{
{
{(char *) STRING_WITH_LEN("triggers") },
{ C_STRING_WITH_LEN("triggers") },
offsetof(class Table_triggers_list, definitions_list),
FILE_OPTIONS_STRLIST
},
{
{(char *) STRING_WITH_LEN("sql_modes") },
{ C_STRING_WITH_LEN("sql_modes") },
offsetof(class Table_triggers_list, definition_modes_list),
FILE_OPTIONS_ULLLIST
},
{
{(char *) STRING_WITH_LEN("definers") },
{ C_STRING_WITH_LEN("definers") },
offsetof(class Table_triggers_list, definers_list),
FILE_OPTIONS_STRLIST
},
@ -54,7 +54,7 @@ static File_option triggers_file_parameters[]=
File_option sql_modes_parameters=
{
{(char*) STRING_WITH_LEN("sql_modes") },
{ C_STRING_WITH_LEN("sql_modes") },
offsetof(class Table_triggers_list, definition_modes_list),
FILE_OPTIONS_ULLLIST
};
@ -78,14 +78,14 @@ struct st_trigname
};
static const LEX_STRING trigname_file_type=
{(char *) STRING_WITH_LEN("TRIGGERNAME")};
{ C_STRING_WITH_LEN("TRIGGERNAME") };
const char * const trigname_file_ext= ".TRN";
static File_option trigname_file_parameters[]=
{
{
{(char *) STRING_WITH_LEN("trigger_table")},
{ C_STRING_WITH_LEN("trigger_table")},
offsetof(struct st_trigname, trigger_table),
FILE_OPTIONS_ESTRING
},
@ -95,15 +95,15 @@ static File_option trigname_file_parameters[]=
const LEX_STRING trg_action_time_type_names[]=
{
{ (char *) STRING_WITH_LEN("BEFORE") },
{ (char *) STRING_WITH_LEN("AFTER") }
{ C_STRING_WITH_LEN("BEFORE") },
{ C_STRING_WITH_LEN("AFTER") }
};
const LEX_STRING trg_event_type_names[]=
{
{ (char *) STRING_WITH_LEN("INSERT") },
{ (char *) STRING_WITH_LEN("UPDATE") },
{ (char *) STRING_WITH_LEN("DELETE") }
{ C_STRING_WITH_LEN("INSERT") },
{ C_STRING_WITH_LEN("UPDATE") },
{ C_STRING_WITH_LEN("DELETE") }
};

View file

@ -25,7 +25,7 @@
#define MD5_BUFF_LENGTH 33
const LEX_STRING view_type= { (char*) STRING_WITH_LEN("VIEW") };
const LEX_STRING view_type= { C_STRING_WITH_LEN("VIEW") };
static int mysql_register_view(THD *thd, TABLE_LIST *view,
enum_view_create_mode mode);
@ -581,40 +581,40 @@ static const int num_view_backups= 3;
parse()
*/
static File_option view_parameters[]=
{{{(char*) STRING_WITH_LEN("query")},
{{{ C_STRING_WITH_LEN("query")},
offsetof(TABLE_LIST, query),
FILE_OPTIONS_ESTRING},
{{(char*) STRING_WITH_LEN("md5")},
{{ C_STRING_WITH_LEN("md5")},
offsetof(TABLE_LIST, md5),
FILE_OPTIONS_STRING},
{{(char*) STRING_WITH_LEN("updatable")},
{{ C_STRING_WITH_LEN("updatable")},
offsetof(TABLE_LIST, updatable_view),
FILE_OPTIONS_ULONGLONG},
{{(char*) STRING_WITH_LEN("algorithm")},
{{ C_STRING_WITH_LEN("algorithm")},
offsetof(TABLE_LIST, algorithm),
FILE_OPTIONS_ULONGLONG},
{{(char*) STRING_WITH_LEN("definer_user")},
{{ C_STRING_WITH_LEN("definer_user")},
offsetof(TABLE_LIST, definer.user),
FILE_OPTIONS_STRING},
{{(char*) STRING_WITH_LEN("definer_host")},
{{ C_STRING_WITH_LEN("definer_host")},
offsetof(TABLE_LIST, definer.host),
FILE_OPTIONS_STRING},
{{(char*) STRING_WITH_LEN("suid")},
{{ C_STRING_WITH_LEN("suid")},
offsetof(TABLE_LIST, view_suid),
FILE_OPTIONS_ULONGLONG},
{{(char*) STRING_WITH_LEN("with_check_option")},
{{ C_STRING_WITH_LEN("with_check_option")},
offsetof(TABLE_LIST, with_check),
FILE_OPTIONS_ULONGLONG},
{{(char*) STRING_WITH_LEN("revision")},
{{ C_STRING_WITH_LEN("revision")},
offsetof(TABLE_LIST, revision),
FILE_OPTIONS_REV},
{{(char*) STRING_WITH_LEN("timestamp")},
{{ C_STRING_WITH_LEN("timestamp")},
offsetof(TABLE_LIST, timestamp),
FILE_OPTIONS_TIMESTAMP},
{{(char*)STRING_WITH_LEN("create-version")},
{{ C_STRING_WITH_LEN("create-version")},
offsetof(TABLE_LIST, file_version),
FILE_OPTIONS_ULONGLONG},
{{(char*) STRING_WITH_LEN("source")},
{{ C_STRING_WITH_LEN("source")},
offsetof(TABLE_LIST, source),
FILE_OPTIONS_ESTRING},
{{NullS, 0}, 0,
@ -1001,7 +1001,8 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
}
}
else if (!table->prelocking_placeholder &&
old_lex->sql_command == SQLCOM_SHOW_CREATE)
old_lex->sql_command == SQLCOM_SHOW_CREATE &&
!table->belong_to_view)
{
if (check_table_access(thd, SHOW_VIEW_ACL, table, 0))
goto err;

View file

@ -6075,6 +6075,8 @@ simple_expr:
lex->length ? atoi(lex->length) : -1,
lex->dec ? atoi(lex->dec) : 0,
lex->charset);
if (!$$)
YYABORT;
}
| CASE_SYM opt_expr WHEN_SYM when_list opt_else END
{ $$= new Item_func_case(* $4, $2, $5 ); }
@ -6084,6 +6086,8 @@ simple_expr:
Lex->length ? atoi(Lex->length) : -1,
Lex->dec ? atoi(Lex->dec) : 0,
Lex->charset);
if (!$$)
YYABORT;
}
| CONVERT_SYM '(' expr USING charset_name ')'
{ $$= new Item_func_conv_charset($3,$5); }

View file

@ -93,6 +93,7 @@ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key,
{
MEM_ROOT mem_root;
TABLE_SHARE *share;
char *key_buff, *path_buff;
char path[FN_REFLEN];
uint path_length;
DBUG_ENTER("alloc_table_share");
@ -103,22 +104,17 @@ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key,
table_list->db,
table_list->table_name, "", 0);
init_sql_alloc(&mem_root, TABLE_ALLOC_BLOCK_SIZE, 0);
if ((share= (TABLE_SHARE*) alloc_root(&mem_root,
sizeof(*share) + key_length +
path_length +1)))
if (multi_alloc_root(&mem_root,
&share, sizeof(*share),
&key_buff, key_length,
&path_buff, path_length + 1,
NULL))
{
bzero((char*) share, sizeof(*share));
share->table_cache_key.str= (char*) (share+1);
share->table_cache_key.length= key_length;
memcpy(share->table_cache_key.str, key, key_length);
/* Use the fact the key is db/0/table_name/0 */
share->db.str= share->table_cache_key.str;
share->db.length= strlen(share->db.str);
share->table_name.str= share->db.str + share->db.length + 1;
share->table_name.length= strlen(share->table_name.str);
share->set_table_cache_key(key_buff, key, key_length);
share->path.str= share->table_cache_key.str+ key_length;
share->path.str= path_buff;
share->path.length= path_length;
strmov(share->path.str, path);
share->normalized_path.str= share->path.str;

View file

@ -138,7 +138,16 @@ typedef struct st_table_share
CHARSET_INFO *table_charset; /* Default charset of string fields */
MY_BITMAP all_set;
/* A pair "database_name\0table_name\0", widely used as simply a db name */
/*
Key which is used for looking-up table in table cache and in the list
of thread's temporary tables. Has the form of:
"database_name\0table_name\0" + optional part for temporary tables.
Note that all three 'table_cache_key', 'db' and 'table_name' members
must be set (and be non-zero) for tables in table cache. They also
should correspond to each other.
To ensure this one can use set_table_cache() methods.
*/
LEX_STRING table_cache_key;
LEX_STRING db; /* Pointer to db */
LEX_STRING table_name; /* Table name (for open) */
@ -223,6 +232,60 @@ typedef struct st_table_share
uint part_state_len;
handlerton *default_part_db_type;
#endif
/*
Set share's table cache key and update its db and table name appropriately.
SYNOPSIS
set_table_cache_key()
key_buff Buffer with already built table cache key to be
referenced from share.
key_length Key length.
NOTES
Since 'key_buff' buffer will be referenced from share it should has same
life-time as share itself.
This method automatically ensures that TABLE_SHARE::table_name/db have
appropriate values by using table cache key as their source.
*/
void set_table_cache_key(char *key_buff, uint key_length)
{
table_cache_key.str= key_buff;
table_cache_key.length= key_length;
/*
Let us use the fact that the key is "db/0/table_name/0" + optional
part for temporary tables.
*/
db.str= table_cache_key.str;
db.length= strlen(db.str);
table_name.str= db.str + db.length + 1;
table_name.length= strlen(table_name.str);
}
/*
Set share's table cache key and update its db and table name appropriately.
SYNOPSIS
set_table_cache_key()
key_buff Buffer to be used as storage for table cache key
(should be at least key_length bytes).
key Value for table cache key.
key_length Key length.
NOTE
Since 'key_buff' buffer will be used as storage for table cache key
it should has same life-time as share itself.
*/
void set_table_cache_key(char *key_buff, const char *key, uint key_length)
{
memcpy(key_buff, key, key_length);
set_table_cache_key(key_buff, key_length);
}
} TABLE_SHARE;
@ -686,6 +749,7 @@ typedef struct st_table_list
tables. Unlike 'next_local', this in this list views are *not*
leaves. Created in setup_tables() -> make_leaves_list().
*/
bool allowed_show;
st_table_list *next_leaf;
Item *where; /* VIEW WHERE clause condition */
Item *check_option; /* WITH CHECK OPTION condition */

View file

@ -1389,15 +1389,15 @@ static bool time_zone_tables_exist= 1;
static const LEX_STRING tz_tables_names[MY_TZ_TABLES_COUNT]=
{
{(char *) STRING_WITH_LEN("time_zone_name")},
{(char *) STRING_WITH_LEN("time_zone")},
{(char *) STRING_WITH_LEN("time_zone_transition_type")},
{(char *) STRING_WITH_LEN("time_zone_transition")}
{ C_STRING_WITH_LEN("time_zone_name")},
{ C_STRING_WITH_LEN("time_zone")},
{ C_STRING_WITH_LEN("time_zone_transition_type")},
{ C_STRING_WITH_LEN("time_zone_transition")}
};
/* Name of database to which those tables belong. */
static const LEX_STRING tz_tables_db_name= {(char *) STRING_WITH_LEN("mysql")};
static const LEX_STRING tz_tables_db_name= { C_STRING_WITH_LEN("mysql")};
class Tz_names_entry: public Sql_alloc

View file

@ -180,7 +180,7 @@ static int tina_done_func()
}
return 0;
}
/*
Simple lock controls.
@ -229,6 +229,11 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table)
MY_REPLACE_EXT|MY_UNPACK_FILENAME);
fn_format(meta_file_name, table_name, "", CSM_EXT,
MY_REPLACE_EXT|MY_UNPACK_FILENAME);
if (my_stat(share->data_file_name, &file_stat, MYF(MY_WME)) == NULL)
goto error;
share->saved_data_file_length= file_stat.st_size;
if (my_hash_insert(&tina_open_tables, (byte*) share))
goto error;
thr_lock_init(&share->lock);
@ -250,10 +255,6 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table)
*/
if (read_meta_file(share->meta_file, &share->rows_recorded))
share->crashed= TRUE;
if (my_stat(share->data_file_name, &file_stat, MYF(MY_WME)) == NULL)
goto error2;
share->saved_data_file_length= file_stat.st_size;
}
share->use_count++;
pthread_mutex_unlock(&tina_mutex);

View file

@ -71,7 +71,7 @@ LINK32=xilink6.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "NDB_WIN32" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /D "NDB_WIN32" /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c
# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /D "NDB_WIN32" /I "../include" /I "../regex" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c
# ADD BASE CPP @includes@
# ADD CPP @includes@
# SUBTRACT CPP /Fr /YX

View file

@ -168,10 +168,8 @@ then
if [ -d storage ]
then
(cd storage/innobase; aclocal; autoheader; autoconf; automake)
(cd storage/bdb/dist; sh s_all)
else
(cd innobase; aclocal; autoheader; autoconf; automake)
(cd bdb/dist; sh s_all)
fi
fi
eval $configure --prefix=$install_dir

View file

@ -636,11 +636,11 @@ my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)),
ptr++; /* Skip escape */
else if (*ptr == w_one || *ptr == w_many) /* '_' or '%' in SQL */
break;
*min_str = like_range_prefix_min_win1250ch[(uint)(*ptr)];
*min_str= like_range_prefix_min_win1250ch[(uint) (uchar) (*ptr)];
if (*min_str != min_sort_char)
only_min_found= 0;
min_str++;
*max_str++= like_range_prefix_max_win1250ch[(uint)(*ptr)];
*max_str++= like_range_prefix_max_win1250ch[(uint) (uchar) (*ptr)];
}
if (cs->state & MY_CS_BINSORT)

View file

@ -114,10 +114,6 @@ server-id = 1
#tmpdir = /tmp/
#log-update = /path-to-dedicated-directory/hostname
# Uncomment the following if you are using BDB tables
#bdb_cache_size = 384M
#bdb_max_lock = 100000
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = @localstatedir@/
#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend

View file

@ -114,10 +114,6 @@ server-id = 1
#tmpdir = /tmp/
#log-update = /path-to-dedicated-directory/hostname
# Uncomment the following if you are using BDB tables
#bdb_cache_size = 256M
#bdb_max_lock = 100000
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = @localstatedir@/
#innodb_data_file_path = ibdata1:10M:autoextend

View file

@ -112,10 +112,6 @@ server-id = 1
#tmpdir = /tmp/
#log-update = /path-to-dedicated-directory/hostname
# Uncomment the following if you are using BDB tables
#bdb_cache_size = 16M
#bdb_max_lock = 10000
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = @localstatedir@/
#innodb_data_file_path = ibdata1:10M:autoextend

View file

@ -122,6 +122,7 @@ static void client_disconnect();
void die(const char *file, int line, const char *expr)
{
fprintf(stderr, "%s:%d: check failed: '%s'\n", file, line, expr);
fflush(NULL);
abort();
}
@ -3976,6 +3977,7 @@ static void test_fetch_date()
c7 timestamp(6))");
myquery(rc);
rc= mysql_query(mysql, "SET SQL_MODE=''");
rc= mysql_query(mysql, "INSERT INTO test_bind_result VALUES('2002-01-02', \
'12:49:00', \
'2002-01-02 17:46:59', \
@ -8350,6 +8352,7 @@ static void test_bug19671()
int rc;
myheader("test_bug19671");
mysql_query(mysql, "set sql_mode=''");
rc= mysql_query(mysql, "drop table if exists t1");
myquery(rc);
@ -8920,7 +8923,7 @@ static void test_bug1500()
rc= mysql_query(mysql, "DROP TABLE test_bg1500");
myquery(rc);
rc= mysql_query(mysql, "CREATE TABLE test_bg1500 (s VARCHAR(25), FULLTEXT(s))");
rc= mysql_query(mysql, "CREATE TABLE test_bg1500 (s VARCHAR(25), FULLTEXT(s)) engine=MyISAM");
myquery(rc);
rc= mysql_query(mysql,
@ -10996,7 +10999,8 @@ static void test_view()
{
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
assert(1 == my_process_stmt_result(stmt));
rc= my_process_stmt_result(stmt);
assert(1 == rc);
}
mysql_stmt_close(stmt);
@ -11038,7 +11042,8 @@ static void test_view_where()
{
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
assert(4 == my_process_stmt_result(stmt));
rc= my_process_stmt_result(stmt);
assert(4 == rc);
}
mysql_stmt_close(stmt);
@ -11120,7 +11125,8 @@ static void test_view_2where()
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
assert(0 == my_process_stmt_result(stmt));
rc= my_process_stmt_result(stmt);
assert(0 == rc);
mysql_stmt_close(stmt);
@ -11172,7 +11178,8 @@ static void test_view_star()
{
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
assert(0 == my_process_stmt_result(stmt));
rc= my_process_stmt_result(stmt);
assert(0 == rc);
}
mysql_stmt_close(stmt);
@ -11226,6 +11233,7 @@ static void test_view_insert()
for (i= 0; i < 3; i++)
{
int rowcount= 0;
my_val= i;
rc= mysql_stmt_execute(insert_stmt);
@ -11233,7 +11241,8 @@ static void test_view_insert()
rc= mysql_stmt_execute(select_stmt);
check_execute(select_stmt, rc);
assert(i + 1 == (int) my_process_stmt_result(select_stmt));
rowcount= (int)my_process_stmt_result(select_stmt);
assert((i+1) == rowcount);
}
mysql_stmt_close(insert_stmt);
mysql_stmt_close(select_stmt);
@ -11273,7 +11282,8 @@ static void test_left_join_view()
{
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
assert(3 == my_process_stmt_result(stmt));
rc= my_process_stmt_result(stmt);
assert(3 == rc);
}
mysql_stmt_close(stmt);
@ -11348,7 +11358,8 @@ static void test_view_insert_fields()
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
assert(1 == my_process_stmt_result(stmt));
rc= my_process_stmt_result(stmt);
assert(1 == rc);
mysql_stmt_close(stmt);
rc= mysql_query(mysql, "DROP VIEW v1");
@ -12012,6 +12023,7 @@ static void test_bug6096()
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
mysql_query(mysql, "set sql_mode=''");
stmt_text= "create table t1 (c_tinyint tinyint, c_smallint smallint, "
" c_mediumint mediumint, c_int int, "
" c_bigint bigint, c_float float, "
@ -12897,6 +12909,7 @@ static void test_bug8378()
DIE_UNLESS(memcmp(out, TEST_BUG8378_OUT, len) == 0);
sprintf(buf, "SELECT '%s'", out);
rc=mysql_real_query(mysql, buf, strlen(buf));
myquery(rc);
@ -14932,7 +14945,7 @@ static void test_bug17667()
{ "insert into bug17667 (c) values ('5 NULs=\0\0\0\0\0')", 48 },
{ "/* NUL=\0 with comment */ insert into bug17667 (c) values ('encore')", 67 },
{ "drop table bug17667", 19 },
{ NULL, 0 } };
{ NULL, 0 } };
struct buffer_and_length *statement_cursor;
FILE *log_file;
@ -14947,11 +14960,14 @@ static void test_bug17667()
myquery(rc);
}
sleep(1); /* The server may need time to flush the data to the log. */
/* Make sure the server has written the logs to disk before reading it */
rc= mysql_query(mysql, "flush logs");
myquery(rc);
master_log_filename = (char *) malloc(strlen(opt_vardir) + strlen("/log/master.log") + 1);
strcpy(master_log_filename, opt_vardir);
strcat(master_log_filename, "/log/master.log");
printf("Opening '%s'\n", master_log_filename);
log_file= fopen(master_log_filename, "r");
free(master_log_filename);
@ -14959,18 +14975,30 @@ static void test_bug17667()
for (statement_cursor= statements; statement_cursor->buffer != NULL;
statement_cursor++) {
char line_buffer[MAX_TEST_QUERY_LENGTH*2];
/* more than enough room for the query and some marginalia. */
char line_buffer[MAX_TEST_QUERY_LENGTH*2];
/* more than enough room for the query and some marginalia. */
do {
memset(line_buffer, '/', MAX_TEST_QUERY_LENGTH*2);
DIE_UNLESS(fgets(line_buffer, MAX_TEST_QUERY_LENGTH*2, log_file) !=
NULL);
/* If we reach EOF before finishing the statement list, then we failed. */
if(fgets(line_buffer, MAX_TEST_QUERY_LENGTH*2, log_file) == NULL)
{
/* If fgets returned NULL, it indicates either error or EOF */
if (feof(log_file))
DIE("Found EOF before all statements where found");
else
{
fprintf(stderr, "Got error %d while reading from file\n",
ferror(log_file));
DIE("Read error");
}
}
} while (my_memmem(line_buffer, MAX_TEST_QUERY_LENGTH*2,
statement_cursor->buffer, statement_cursor->length) == NULL);
printf("Found statement starting with \"%s\"\n",
statement_cursor->buffer);
}
printf("success. All queries found intact in the log.\n");