Merge pnousiainen@bk-internal.mysql.com:/home/bk/mysql-5.1

into  orca.ndb.mysql.com:/export/home/space/pekka/ndb/version/my51-ndb


sql/sql_show.cc:
  Auto merged
This commit is contained in:
unknown 2006-08-22 10:24:58 +02:00
commit 239c28be85
69 changed files with 934 additions and 586 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

@ -48,6 +48,7 @@ int decimal_bin_size(int precision, int scale);
int decimal_result_size(decimal_t *from1, decimal_t *from2, char op,
int param);
int decimal_intg(decimal_t *from);
int decimal_add(decimal_t *from1, decimal_t *from2, decimal_t *to);
int decimal_sub(decimal_t *from1, decimal_t *from2, decimal_t *to);
int decimal_cmp(decimal_t *from1, decimal_t *from2);

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

@ -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

@ -103,7 +103,7 @@ Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
select 10.0+cast('a' as decimal);
10.0+cast('a' as decimal)
10.00
10.0
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'a'
select 10E+0+'a';
@ -368,7 +368,9 @@ create table t1(s1 time);
insert into t1 values ('11:11:11');
select cast(s1 as decimal(7,2)) from t1;
cast(s1 as decimal(7,2))
111111.00
99999.99
Warnings:
Error 1264 Out of range value for column 'cast(s1 as decimal(7,2))' at row 1
drop table t1;
CREATE TABLE t1 (v varchar(10), tt tinytext, t text,
mt mediumtext, lt longtext);
@ -376,7 +378,7 @@ INSERT INTO t1 VALUES ('1.01', '2.02', '3.03', '4.04', '5.05');
SELECT CAST(v AS DECIMAL), CAST(tt AS DECIMAL), CAST(t AS DECIMAL),
CAST(mt AS DECIMAL), CAST(lt AS DECIMAL) from t1;
CAST(v AS DECIMAL) CAST(tt AS DECIMAL) CAST(t AS DECIMAL) CAST(mt AS DECIMAL) CAST(lt AS DECIMAL)
1.01 2.02 3.03 4.04 5.05
1 2 3 4 5
DROP TABLE t1;
select cast(NULL as decimal(6)) as t1;
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:

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

@ -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));
@ -1418,3 +1422,30 @@ i2 count(distinct j)
1.0 2
2.0 2
drop table t1;
select cast(143.481 as decimal(4,1));
cast(143.481 as decimal(4,1))
143.5
select cast(143.481 as decimal(4,0));
cast(143.481 as decimal(4,0))
143
select cast(143.481 as decimal(2,1));
cast(143.481 as decimal(2,1))
9.9
Warnings:
Error 1264 Out of range value for column 'cast(143.481 as decimal(2,1))' at row 1
select cast(-3.4 as decimal(2,1));
cast(-3.4 as decimal(2,1))
-3.4
select cast(99.6 as decimal(2,0));
cast(99.6 as decimal(2,0))
99
Warnings:
Error 1264 Out of range value for column 'cast(99.6 as decimal(2,0))' at row 1
select cast(-13.4 as decimal(2,1));
cast(-13.4 as decimal(2,1))
-9.9
Warnings:
Error 1264 Out of range value for column 'cast(-13.4 as decimal(2,1))' at row 1
select cast(98.6 as decimal(2,0));
cast(98.6 as decimal(2,0))
99

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

@ -1787,7 +1787,7 @@ drop table t1;
create view v1 as select cast(1 as decimal);
select * from v1;
cast(1 as decimal)
1.00
1
drop view v1;
create table t1(f1 int);
create table t2(f2 int);

View file

@ -704,3 +704,9 @@ a
select extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element/@xmlns:ns');
extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element/@xmlns:ns')
myns
select extractValue('<foo><foo.bar>Data</foo.bar><something>Otherdata</something></foo>','/foo/foo.bar');
extractValue('<foo><foo.bar>Data</foo.bar><something>Otherdata</something></foo>','/foo/foo.bar')
Data
select extractValue('<foo><foo.bar>Data</foo.bar><something>Otherdata</something></foo>','/foo/something');
extractValue('<foo><foo.bar>Data</foo.bar><something>Otherdata</something></foo>','/foo/something')
Otherdata

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

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

@ -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

@ -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

@ -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)
#
@ -1115,3 +1119,14 @@ insert into t1 values (1,1), (1,2), (2,3), (2,4);
select i, count(distinct j) from t1 group by i;
select i+0.0 as i2, count(distinct j) from t1 group by i2;
drop table t1;
#
# Bug#16172 DECIMAL data type processed incorrectly
#
select cast(143.481 as decimal(4,1));
select cast(143.481 as decimal(4,0));
select cast(143.481 as decimal(2,1));
select cast(-3.4 as decimal(2,1));
select cast(99.6 as decimal(2,0));
select cast(-13.4 as decimal(2,1));
select cast(98.6 as decimal(2,0));

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

@ -354,3 +354,9 @@ DROP PROCEDURE p2;
select extractValue('<ns:element xmlns:ns="myns"/>','count(ns:element)');
select extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element');
select extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element/@xmlns:ns');
#
# Bug#20795 extractvalue() won't accept names containing a dot (.)
#
select extractValue('<foo><foo.bar>Data</foo.bar><something>Otherdata</something></foo>','/foo/foo.bar');
select extractValue('<foo><foo.bar>Data</foo.bar><something>Otherdata</something></foo>','/foo/something');

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

@ -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 ? dec : 2);
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

@ -955,9 +955,32 @@ longlong Item_decimal_typecast::val_int()
my_decimal *Item_decimal_typecast::val_decimal(my_decimal *dec)
{
my_decimal tmp_buf, *tmp= args[0]->val_decimal(&tmp_buf);
bool sign;
if ((null_value= args[0]->null_value))
return NULL;
my_decimal_round(E_DEC_FATAL_ERROR, tmp, decimals, FALSE, dec);
sign= dec->sign();
if (unsigned_flag)
{
if (sign)
{
my_decimal_set_zero(dec);
goto err;
}
}
if (max_length - 2 - decimals < (uint) my_decimal_intg(dec))
{
max_my_decimal(dec, max_length - 2, decimals);
dec->sign(sign);
goto err;
}
return dec;
err:
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_WARN_DATA_OUT_OF_RANGE,
ER(ER_WARN_DATA_OUT_OF_RANGE),
name, 1);
return dec;
}

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

@ -1356,7 +1356,8 @@ my_xpath_lex_scan(MY_XPATH *xpath,
(length= xpath->cs->cset->ctype(xpath->cs, &ctype,
(const uchar*) beg,
(const uchar*) end)) > 0 &&
((ctype & (_MY_L | _MY_U | _MY_NMR)) || *beg == '_' || *beg == '-') ;
((ctype & (_MY_L | _MY_U | _MY_NMR)) ||
*beg == '_' || *beg == '-' || *beg == '.') ;
beg+= length) /* no op */;
lex->end= beg;

View file

@ -383,5 +383,13 @@ int my_decimal_cmp(const my_decimal *a, const my_decimal *b)
return decimal_cmp((decimal_t*) a, (decimal_t*) b);
}
inline
int my_decimal_intg(const my_decimal *a)
{
return decimal_intg((decimal_t*) a);
}
#endif /*my_decimal_h*/

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;

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

@ -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

@ -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

@ -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);
@ -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

@ -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

@ -456,8 +456,10 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
share->frm_version= FRM_VER_TRUE_VARCHAR;
#ifdef WITH_PARTITION_STORAGE_ENGINE
share->default_part_db_type=
ha_checktype(thd, (enum legacy_db_type) (uint) *(head+61), 0, 0);
if (*(head+61) &&
!(share->default_part_db_type=
ha_checktype(thd, (enum legacy_db_type) (uint) *(head+61), 1, 0)))
goto err;
DBUG_PRINT("info", ("default_part_db_type = %u", head[61]));
#endif
legacy_db_type= (enum legacy_db_type) (uint) *(head+3);

View file

@ -686,6 +686,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

@ -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

@ -80,35 +80,35 @@ struct my_cs_file_section_st
static struct my_cs_file_section_st sec[] =
{
{_CS_MISC, "xml"},
{_CS_MISC, "xml.version"},
{_CS_MISC, "xml.encoding"},
{_CS_MISC, "xml/version"},
{_CS_MISC, "xml/encoding"},
{_CS_MISC, "charsets"},
{_CS_MISC, "charsets.max-id"},
{_CS_CHARSET, "charsets.charset"},
{_CS_PRIMARY_ID, "charsets.charset.primary-id"},
{_CS_BINARY_ID, "charsets.charset.binary-id"},
{_CS_CSNAME, "charsets.charset.name"},
{_CS_FAMILY, "charsets.charset.family"},
{_CS_CSDESCRIPT, "charsets.charset.description"},
{_CS_MISC, "charsets.charset.alias"},
{_CS_MISC, "charsets.charset.ctype"},
{_CS_CTYPEMAP, "charsets.charset.ctype.map"},
{_CS_MISC, "charsets.charset.upper"},
{_CS_UPPERMAP, "charsets.charset.upper.map"},
{_CS_MISC, "charsets.charset.lower"},
{_CS_LOWERMAP, "charsets.charset.lower.map"},
{_CS_MISC, "charsets.charset.unicode"},
{_CS_UNIMAP, "charsets.charset.unicode.map"},
{_CS_COLLATION, "charsets.charset.collation"},
{_CS_COLNAME, "charsets.charset.collation.name"},
{_CS_ID, "charsets.charset.collation.id"},
{_CS_ORDER, "charsets.charset.collation.order"},
{_CS_FLAG, "charsets.charset.collation.flag"},
{_CS_COLLMAP, "charsets.charset.collation.map"},
{_CS_RESET, "charsets.charset.collation.rules.reset"},
{_CS_DIFF1, "charsets.charset.collation.rules.p"},
{_CS_DIFF2, "charsets.charset.collation.rules.s"},
{_CS_DIFF3, "charsets.charset.collation.rules.t"},
{_CS_MISC, "charsets/max-id"},
{_CS_CHARSET, "charsets/charset"},
{_CS_PRIMARY_ID, "charsets/charset/primary-id"},
{_CS_BINARY_ID, "charsets/charset/binary-id"},
{_CS_CSNAME, "charsets/charset/name"},
{_CS_FAMILY, "charsets/charset/family"},
{_CS_CSDESCRIPT, "charsets/charset/description"},
{_CS_MISC, "charsets/charset/alias"},
{_CS_MISC, "charsets/charset/ctype"},
{_CS_CTYPEMAP, "charsets/charset/ctype/map"},
{_CS_MISC, "charsets/charset/upper"},
{_CS_UPPERMAP, "charsets/charset/upper/map"},
{_CS_MISC, "charsets/charset/lower"},
{_CS_LOWERMAP, "charsets/charset/lower/map"},
{_CS_MISC, "charsets/charset/unicode"},
{_CS_UNIMAP, "charsets/charset/unicode/map"},
{_CS_COLLATION, "charsets/charset/collation"},
{_CS_COLNAME, "charsets/charset/collation/name"},
{_CS_ID, "charsets/charset/collation/id"},
{_CS_ORDER, "charsets/charset/collation/order"},
{_CS_FLAG, "charsets/charset/collation/flag"},
{_CS_COLLMAP, "charsets/charset/collation/map"},
{_CS_RESET, "charsets/charset/collation/rules/reset"},
{_CS_DIFF1, "charsets/charset/collation/rules/p"},
{_CS_DIFF2, "charsets/charset/collation/rules/s"},
{_CS_DIFF3, "charsets/charset/collation/rules/t"},
{0, NULL}
};

View file

@ -1896,6 +1896,14 @@ static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to)
return error;
}
int decimal_intg(decimal_t *from)
{
int res;
dec1 *tmp_res;
tmp_res= remove_leading_zeroes(from, &res);
return res;
}
int decimal_add(decimal_t *from1, decimal_t *from2, decimal_t *to)
{
if (likely(from1->sign == from2->sign))

View file

@ -159,7 +159,7 @@ static int my_xml_enter(MY_XML_PARSER *st, const char *str, uint len)
}
if (st->attrend > st->attr)
{
st->attrend[0]='.';
st->attrend[0]= '/';
st->attrend++;
}
memcpy(st->attrend,str,len);
@ -188,9 +188,9 @@ static int my_xml_leave(MY_XML_PARSER *p, const char *str, uint slen)
char g[32];
int rc;
/* Find previous '.' or beginning */
for( e=p->attrend; (e>p->attr) && (e[0] != '.') ; e--);
glen = (uint) ((e[0] == '.') ? (p->attrend-e-1) : p->attrend-e);
/* Find previous '/' or beginning */
for( e=p->attrend; (e>p->attr) && (e[0] != '/') ; e--);
glen = (uint) ((e[0] == '/') ? (p->attrend-e-1) : p->attrend-e);
if (str && (slen != glen))
{

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");