1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb

into mysql.com:/usr/local/home/marty/MySQL/test/mysql-5.0-ndb
This commit is contained in:
mskold@mysql.com
2005-01-07 15:34:25 +01:00
214 changed files with 7816 additions and 3168 deletions

View File

@ -549,13 +549,67 @@ mysql-max-4.0.2-alpha-pc-linux-gnu-i686.tar.gz
mysql-test/gmon.out mysql-test/gmon.out
mysql-test/install_test_db mysql-test/install_test_db
mysql-test/mysql-test-run mysql-test/mysql-test-run
mysql-test/mysql-test-run.log
mysql-test/mysql_test_run_new mysql-test/mysql_test_run_new
mysql-test/ndb/ndbcluster mysql-test/ndb/ndbcluster
mysql-test/r/*.reject mysql-test/r/*.reject
mysql-test/r/alter_table.err
mysql-test/r/archive.err
mysql-test/r/bdb-alter-table-1.err
mysql-test/r/bdb-alter-table-2.err
mysql-test/r/bdb-crash.err
mysql-test/r/bdb-deadlock.err
mysql-test/r/bdb.err
mysql-test/r/bdb_cache.err
mysql-test/r/client_test.err
mysql-test/r/csv.err
mysql-test/r/ctype_ucs.err
mysql-test/r/derived.err
mysql-test/r/exampledb.err
mysql-test/r/func_encrypt.err
mysql-test/r/index_merge_load.result mysql-test/r/index_merge_load.result
mysql-test/r/isam.err
mysql-test/r/lowercase_table2.err
mysql-test/r/multi_update.err
mysql-test/r/mysql_protocols.err
mysql-test/r/mysqlbinlog.err
mysql-test/r/mysqlbinlog2.err
mysql-test/r/mysqldump.err
mysql-test/r/mysqltest.err
mysql-test/r/ndb_alter_table.err
mysql-test/r/ndb_autodiscover.err
mysql-test/r/ndb_autodiscover2.err
mysql-test/r/ndb_basic.err
mysql-test/r/ndb_blob.err
mysql-test/r/ndb_cache.err
mysql-test/r/ndb_charset.err
mysql-test/r/ndb_index.err
mysql-test/r/ndb_index_ordered.err
mysql-test/r/ndb_index_unique.err
mysql-test/r/ndb_insert.err
mysql-test/r/ndb_limit.err
mysql-test/r/ndb_lock.err
mysql-test/r/ndb_minmax.err
mysql-test/r/ndb_replace.err
mysql-test/r/ndb_subquery.err
mysql-test/r/ndb_transaction.err
mysql-test/r/ndb_truncate.err
mysql-test/r/ndb_types.err
mysql-test/r/ndb_update.err
mysql-test/r/openssl_1.err
mysql-test/r/ps_1general.err
mysql-test/r/ps_6bdb.err
mysql-test/r/ps_7ndb.err
mysql-test/r/query_cache.err
mysql-test/r/query_cache_merge.err
mysql-test/r/raid.err
mysql-test/r/repair.err
mysql-test/r/replace.err
mysql-test/r/rpl000001.err
mysql-test/r/rpl000001.eval mysql-test/r/rpl000001.eval
mysql-test/r/rpl000002.eval mysql-test/r/rpl000002.eval
mysql-test/r/rpl000014.eval mysql-test/r/rpl000014.eval
mysql-test/r/rpl000015.err
mysql-test/r/rpl000015.eval mysql-test/r/rpl000015.eval
mysql-test/r/rpl000016.eval mysql-test/r/rpl000016.eval
mysql-test/r/rpl_log.eval mysql-test/r/rpl_log.eval
@ -698,6 +752,8 @@ ndb/examples/ndbapi_example2/ndbapi_example2
ndb/examples/ndbapi_example3/ndbapi_example3 ndb/examples/ndbapi_example3/ndbapi_example3
ndb/examples/ndbapi_example5/ndbapi_example5 ndb/examples/ndbapi_example5/ndbapi_example5
ndb/examples/select_all/select_all ndb/examples/select_all/select_all
ndb/include/ndb_global.h
ndb/include/ndb_version.h
ndb/lib/libMGM_API.so ndb/lib/libMGM_API.so
ndb/lib/libNDB_API.so ndb/lib/libNDB_API.so
ndb/lib/libNDB_ODBC.so ndb/lib/libNDB_ODBC.so

48
BUILD/compile-dist Executable file
View File

@ -0,0 +1,48 @@
#!/bin/sh
#
# This script's purpose is to update the automake/autoconf helper scripts and
# to run a plain "configure" without any special compile flags. Only features
# that affect the content of the source distribution are enabled. The resulting
# tree can then be picked up by "make dist" to create the "pristine source
# package" that is used as the basis for all other binary builds.
#
make distclean
aclocal
autoheader
libtoolize --automake --force --copy
automake --force --add-missing --copy
autoconf
(cd bdb/dist && sh s_all)
(cd innobase && aclocal && autoheader && aclocal && automake && autoconf)
# Default to gcc for CC and CXX
if test -z "$CXX" ; then
export CXX=gcc
fi
if test -z "$CC" ; then
export CC=gcc
fi
# Use ccache, if available
if ccache -V > /dev/null 2>&1
then
if ! (echo "$CC" | grep "ccache" > /dev/null)
then
export CC="ccache $CC"
fi
if ! (echo "$CXX" | grep "ccache" > /dev/null)
then
export CXX="ccache $CXX"
fi
fi
# Make sure to enable all features that affect "make dist"
./configure \
--with-embedded-server \
--with-berkeley-db \
--with-innodb \
--enable-thread-safe-client \
--with-extra-charsets=complex \
--with-ndbcluster
make

View File

@ -34,6 +34,7 @@ bk@mysql.r18.ru
brian@avenger.(none) brian@avenger.(none)
brian@brian-akers-computer.local brian@brian-akers-computer.local
brian@private-client-ip-101.oz.net brian@private-client-ip-101.oz.net
brian@zim.(none)
carsten@tsort.bitbybit.dk carsten@tsort.bitbybit.dk
cps@silver_beast.(none) cps@silver_beast.(none)
davida@isil.mysql.com davida@isil.mysql.com
@ -96,6 +97,7 @@ jcole@tetra.spaceapes.com
jimw@mysql.com jimw@mysql.com
joerg@mysql.com joerg@mysql.com
jon@gigan. jon@gigan.
jonas@mysql.com
joreland@bk-internal.mysql.com joreland@bk-internal.mysql.com
joreland@mysql.com joreland@mysql.com
jorge@linux.jorge.mysql.com jorge@linux.jorge.mysql.com
@ -175,6 +177,7 @@ paul@frost.snake.net
paul@ice.local paul@ice.local
paul@ice.snake.net paul@ice.snake.net
paul@kite-hub.kitebird.com paul@kite-hub.kitebird.com
paul@snake-hub.snake.net
paul@teton.kitebird.com paul@teton.kitebird.com
pekka@mysql.com pekka@mysql.com
pem@mysql.com pem@mysql.com

View File

@ -26,7 +26,7 @@ else
} }
# Some predefined settings # Some predefined settings
$build_command= "BUILD/compile-pentium-max"; $build_command= "BUILD/compile-dist";
$PWD= cwd(); $PWD= cwd();
$opt_docdir= $PWD . "/mysqldoc"; $opt_docdir= $PWD . "/mysqldoc";
$opt_archive_log= undef; $opt_archive_log= undef;
@ -70,7 +70,7 @@ GetOptions(
"test|t", "test|t",
"verbose|v", "verbose|v",
"win-dist|w", "win-dist|w",
"quiet|q", "quiet|q",
) || print_help(""); ) || print_help("");
# #
@ -122,18 +122,8 @@ if (($opt_directory ne $PWD) && (!-d $opt_directory && !$opt_dry_run))
# #
if ($opt_pull) if ($opt_pull)
{ {
&logger("Updating BK tree $REPO to latest ChangeSet first"); &bk_pull("$REPO");
chdir ($REPO) or &abort("Could not chdir to $REPO!"); &bk_pull("$opt_docdir") unless ($opt_skip_manual);
&run_command("bk pull", "Could not update $REPO!");
chdir ($PWD) or &abort("Could not chdir to $PWD!");
unless ($opt_skip_manual)
{
&logger("Updating manual tree in $opt_docdir");
chdir ($opt_docdir) or &abort("Could not chdir to $opt_docdir!");
&run_command("bk pull", "Could not update $opt_docdir!");
chdir ($PWD) or &abort("Could not chdir to $PWD!");
}
} }
# #
@ -262,7 +252,7 @@ if (defined $opt_changelog)
$msg= "Adding $target_dir/ChangeLog"; $msg= "Adding $target_dir/ChangeLog";
$msg.= " (down to revision $opt_changelog)" if $opt_changelog ne ""; $msg.= " (down to revision $opt_changelog)" if $opt_changelog ne "";
&logger($msg); &logger($msg);
$command= "bk changes -mv"; $command= "bk changes -v";
$command.= " -r" if ($opt_changelog ne "" || $opt_revision); $command.= " -r" if ($opt_changelog ne "" || $opt_revision);
$command.= $opt_changelog if $opt_changelog ne ""; $command.= $opt_changelog if $opt_changelog ne "";
$command.= ".." if ($opt_changelog ne "" && !$opt_revision); $command.= ".." if ($opt_changelog ne "" && !$opt_revision);
@ -270,7 +260,7 @@ if (defined $opt_changelog)
$command.= " " . $REPO . " > $target_dir/ChangeLog"; $command.= " " . $REPO . " > $target_dir/ChangeLog";
&logger($command); &logger($command);
# We cannot use run_command here because of output redirection # We cannot use run_command here because of output redirection
if (!$opt_dry_run) unless ($opt_dry_run)
{ {
system($command) == 0 or &abort("Could not create $target_dir/ChangeLog!"); system($command) == 0 or &abort("Could not create $target_dir/ChangeLog!");
} }
@ -281,17 +271,17 @@ if (defined $opt_changelog)
# #
unless ($opt_skip_manual) unless ($opt_skip_manual)
{ {
$msg= "Updating manual files"; &logger("Updating manual files");
&logger($msg);
foreach $file qw/internals manual reservedwords/ foreach $file qw/internals manual reservedwords/
{ {
system ("bk cat $opt_docdir/Docs/$file.texi > $target_dir/Docs/$file.texi") == 0 system ("bk cat $opt_docdir/Docs/$file.texi > $target_dir/Docs/$file.texi") == 0
or &abort("Could not update $file.texi in $target_dir/Docs/!"); or &abort("Could not update $file.texi in $target_dir/Docs/!");
} }
system ("rm -f $target_dir/Docs/Images/Makefile*") == 0
or &abort("Could not remove Makefiles in $target_dir/Docs/Images/!"); &run_command("rm -f $target_dir/Docs/Images/Makefile*",
system ("cp $opt_docdir/Docs/Images/*.* $target_dir/Docs/Images") == 0 "Could not remove Makefiles in $target_dir/Docs/Images/!");
or &abort("Could not copy image files in $target_dir/Docs/Images/!"); &run_command("cp $opt_docdir/Docs/Images/*.* $target_dir/Docs/Images",
"Could not copy image files in $target_dir/Docs/Images/!");
} }
# #
@ -377,6 +367,18 @@ if ($opt_archive_log)
exit 0; exit 0;
#
# Run a BK pull on the given BK tree
#
sub bk_pull
{
my $bk_tree= $_[0];
&logger("Updating BK tree $bk_tree to latest ChangeSet first");
chdir ($bk_tree) or &abort("Could not chdir to $bk_tree!");
&run_command("bk pull", "Could not update $bk_tree!");
chdir ($PWD) or &abort("Could not chdir to $PWD!");
}
# #
# Print the help text message (with an optional message on top) # Print the help text message (with an optional message on top)
# #

View File

@ -23,14 +23,14 @@ EXTRA_DIST = INSTALL-SOURCE README COPYING EXCEPTIONS-CLIENT
SUBDIRS = . include @docs_dirs@ @zlib_dir@ \ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
@readline_topdir@ sql-common \ @readline_topdir@ sql-common \
@thread_dirs@ pstack \ @thread_dirs@ pstack \
@sql_server_dirs@ @sql_client_dirs@ scripts man tests \ @sql_union_dirs@ scripts man tests \
netware @libmysqld_dirs@ \ netware @libmysqld_dirs@ \
@bench_dirs@ support-files @fs_dirs@ @tools_dirs@ @bench_dirs@ support-files @fs_dirs@ @tools_dirs@
DIST_SUBDIRS = . include @docs_dirs@ zlib \ DIST_SUBDIRS = . include @docs_dirs@ zlib \
@readline_topdir@ sql-common \ @readline_topdir@ sql-common \
@thread_dirs@ pstack \ @thread_dirs@ pstack \
@sql_server_dirs@ @sql_client_dirs@ scripts @man_dirs@ tests SSL\ @sql_union_dirs@ scripts @man_dirs@ tests SSL\
BUILD netware os2 @libmysqld_dirs@ \ BUILD netware os2 @libmysqld_dirs@ \
@bench_dirs@ support-files @fs_dirs@ @tools_dirs@ @bench_dirs@ support-files @fs_dirs@ @tools_dirs@

View File

@ -51,8 +51,8 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=xilink6.exe LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mysys.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqldump.exe" /libpath:"..\lib_release\\" # ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mysys.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqldump.exe" /libpath:"..\lib_release\\"
!ELSEIF "$(CFG)" == "mysqldump - Win32 Debug" !ELSEIF "$(CFG)" == "mysqldump - Win32 Debug"
@ -76,8 +76,8 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=xilink6.exe LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mysys.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqldump.exe" /pdbtype:sept /libpath:"..\lib_debug\\" # ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mysys.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqldump.exe" /pdbtype:sept /libpath:"..\lib_debug\\"
!ELSEIF "$(CFG)" == "mysqldump - Win32 classic" !ELSEIF "$(CFG)" == "mysqldump - Win32 classic"
@ -103,8 +103,8 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=xilink6.exe LINK32=xilink6.exe
# ADD BASE LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqldump.exe" /libpath:"..\lib_release\\" # ADD BASE LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mysys.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqldump.exe" /libpath:"..\lib_release\\"
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_classic/mysqldump.exe" /libpath:"..\lib_release\\" # ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mysys.lib /nologo /subsystem:console /machine:I386 /out:"../client_classic/mysqldump.exe" /libpath:"..\lib_release\\"
!ENDIF !ENDIF

View File

@ -67,8 +67,8 @@ LINK32=link.exe
# PROP Output_Dir ".\classic" # PROP Output_Dir ".\classic"
# PROP Intermediate_Dir ".\classic" # PROP Intermediate_Dir ".\classic"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /I "../include" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX # ADD BASE CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX
# ADD CPP /nologo /MT /I "../include" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX # ADD CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX
# ADD BASE MTL /nologo /tlb".\classic\mysqltest.tlb" /win32 # ADD BASE MTL /nologo /tlb".\classic\mysqltest.tlb" /win32
# ADD MTL /nologo /tlb".\classic\mysqltest.tlb" /win32 # ADD MTL /nologo /tlb".\classic\mysqltest.tlb" /win32
# ADD BASE RSC /l 1033 /d "NDEBUG" # ADD BASE RSC /l 1033 /d "NDEBUG"
@ -77,8 +77,8 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib /nologo /out:"..\client_classic\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\classic\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib mysys.lib regex.lib /nologo /out:"..\client_classic\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\classic\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib /nologo /out:"..\client_classic\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\classic\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib mysys.lib regex.lib /nologo /out:"..\client_classic\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\classic\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386
!ELSEIF "$(CFG)" == "mysqltest - Win32 Release" !ELSEIF "$(CFG)" == "mysqltest - Win32 Release"
@ -92,8 +92,8 @@ LINK32=link.exe
# PROP Output_Dir ".\release" # PROP Output_Dir ".\release"
# PROP Intermediate_Dir ".\release" # PROP Intermediate_Dir ".\release"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX # ADD BASE CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX
# ADD CPP /nologo /MT /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX # ADD CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX
# ADD BASE MTL /nologo /tlb".\release\mysqltest.tlb" /win32 # ADD BASE MTL /nologo /tlb".\release\mysqltest.tlb" /win32
# ADD MTL /nologo /tlb".\release\mysqltest.tlb" /win32 # ADD MTL /nologo /tlb".\release\mysqltest.tlb" /win32
# ADD BASE RSC /l 1033 /d "NDEBUG" # ADD BASE RSC /l 1033 /d "NDEBUG"
@ -102,8 +102,8 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib /nologo /out:"..\client_release\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\release\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib mysys.lib regex.lib /nologo /out:"..\client_release\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\release\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib /nologo /out:"..\client_release\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\release\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib mysys.lib regex.lib /nologo /out:"..\client_release\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\release\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386
!ENDIF !ENDIF

View File

@ -76,8 +76,8 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:no /pdb:".\Release\mysql_test_run_new.pdb" /pdbtype:sept /subsystem:windows # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:no /pdb:".\Release\mysql_test_run_new.pdb" /pdbtype:sept /subsystem:console
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:no /pdb:".\Release\mysql_test_run_new.pdb" /pdbtype:sept /subsystem:windows # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:no /pdb:".\Release\mysql_test_run_new.pdb" /pdbtype:sept /subsystem:console
!ENDIF !ENDIF

View File

@ -33,7 +33,8 @@
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ #define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3 #define MAX_TRUNC_LENGTH 3
char *host= NULL, *user= 0, *opt_password= 0; char *host= NULL, *user= 0, *opt_password= 0,
*default_charset= NULL;
char truncated_var_names[MAX_MYSQL_VAR][MAX_TRUNC_LENGTH]; char truncated_var_names[MAX_MYSQL_VAR][MAX_TRUNC_LENGTH];
char ex_var_names[MAX_MYSQL_VAR][FN_REFLEN]; char ex_var_names[MAX_MYSQL_VAR][FN_REFLEN];
ulonglong last_values[MAX_MYSQL_VAR]; ulonglong last_values[MAX_MYSQL_VAR];
@ -145,6 +146,9 @@ static struct my_option my_long_options[] =
{"character-sets-dir", OPT_CHARSETS_DIR, {"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.", (gptr*) &charsets_dir, "Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0}, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0, GET_STR, {"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0, GET_STR,
@ -343,6 +347,8 @@ int main(int argc,char *argv[])
if (shared_memory_base_name) if (shared_memory_base_name)
mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
#endif #endif
if (default_charset)
mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
if (sql_connect(&mysql, option_wait)) if (sql_connect(&mysql, option_wait))
{ {
unsigned int err= mysql_errno(&mysql); unsigned int err= mysql_errno(&mysql);
@ -827,13 +833,39 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
if (argv[1][0]) if (argv[1][0])
{ {
char *pw= argv[1]; char *pw= argv[1];
bool old= find_type(argv[0], &command_typelib, 2) == ADMIN_OLD_PASSWORD;
#ifdef __WIN__ #ifdef __WIN__
uint pw_len= strlen(pw); uint pw_len= strlen(pw);
if (pw_len > 1 && pw[0] == '\'' && pw[pw_len-1] == '\'') if (pw_len > 1 && pw[0] == '\'' && pw[pw_len-1] == '\'')
printf("Warning: single quotes were not trimmed from the password by" printf("Warning: single quotes were not trimmed from the password by"
" your command\nline client, as you might have expected.\n"); " your command\nline client, as you might have expected.\n");
#endif #endif
if (find_type(argv[0], &command_typelib, 2) == ADMIN_OLD_PASSWORD) /*
If we don't already know to use an old-style password, see what
the server is using
*/
if (!old) {
if (mysql_query(mysql, "SHOW VARIABLES LIKE 'old_passwords'")) {
my_printf_error(0, "Could not determine old_passwords setting from server; error: '%s'",
MYF(ME_BELL),mysql_error(mysql));
return -1;
} else {
MYSQL_RES *res= mysql_store_result(mysql);
if (!res) {
my_printf_error(0, "Could not get old_passwords setting from server; error: '%s'",
MYF(ME_BELL),mysql_error(mysql));
return -1;
}
if (!mysql_num_rows(res)) {
old= 1;
} else {
MYSQL_ROW row= mysql_fetch_row(res);
old= !strncmp(row[1], "ON", 2);
}
mysql_free_result(res);
}
}
if (old)
make_scrambled_password_323(crypted_pw, pw); make_scrambled_password_323(crypted_pw, pw);
else else
make_scrambled_password(crypted_pw, pw); make_scrambled_password(crypted_pw, pw);

View File

@ -106,7 +106,14 @@ FILE *md_result_file;
static char *shared_memory_base_name=0; static char *shared_memory_base_name=0;
#endif #endif
static uint opt_protocol= 0; static uint opt_protocol= 0;
static char *default_charset= (char*) MYSQL_UNIVERSAL_CLIENT_CHARSET; /*
Constant for detection of default value of default_charset.
If default_charset is equal to mysql_universal_client_charset, then
it is the default value which assigned at the very beginning of main().
*/
static const char *mysql_universal_client_charset=
MYSQL_UNIVERSAL_CLIENT_CHARSET;
static char *default_charset;
static CHARSET_INFO *charset_info= &my_charset_latin1; static CHARSET_INFO *charset_info= &my_charset_latin1;
const char *default_dbug_option="d:t:o,/tmp/mysqldump.trace"; const char *default_dbug_option="d:t:o,/tmp/mysqldump.trace";
/* do we met VIEWs during tables scaning */ /* do we met VIEWs during tables scaning */
@ -682,7 +689,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
Set charset to the default compiled value if it hasn't Set charset to the default compiled value if it hasn't
been reset yet by --default-character-set=xxx. been reset yet by --default-character-set=xxx.
*/ */
if (default_charset == (char*) MYSQL_UNIVERSAL_CLIENT_CHARSET) if (default_charset == mysql_universal_client_charset)
default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME; default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
break; break;
} }
@ -2610,6 +2617,7 @@ static my_bool getViewStructure(char *table, char* db)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
compatible_mode_normal_str[0]= 0; compatible_mode_normal_str[0]= 0;
default_charset= (char *)mysql_universal_client_charset;
MY_INIT(argv[0]); MY_INIT(argv[0]);
if (get_options(&argc, &argv)) if (get_options(&argc, &argv))

View File

@ -36,11 +36,6 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
;; ;;
esac esac
AC_ARG_WITH([ndb-shm],
[
--with-ndb-shm Include the NDB Cluster shared memory transporter],
[ndb_shm="$withval"],
[ndb_shm=no])
AC_ARG_WITH([ndb-test], AC_ARG_WITH([ndb-test],
[ [
--with-ndb-test Include the NDB Cluster ndbapi test programs], --with-ndb-test Include the NDB Cluster ndbapi test programs],
@ -61,23 +56,15 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
--with-ndb-port-base Base port for NDB Cluster transporters], --with-ndb-port-base Base port for NDB Cluster transporters],
[ndb_port_base="$withval"], [ndb_port_base="$withval"],
[ndb_port_base="default"]) [ndb_port_base="default"])
AC_ARG_WITH([ndb-debug],
[
--without-ndb-debug Disable special ndb debug features],
[ndb_debug="$withval"],
[ndb_debug="default"])
AC_MSG_CHECKING([for NDB Cluster options]) AC_MSG_CHECKING([for NDB Cluster options])
AC_MSG_RESULT([]) AC_MSG_RESULT([])
have_ndb_shm=no
case "$ndb_shm" in
yes )
AC_MSG_RESULT([-- including shared memory transporter])
AC_DEFINE([NDB_SHM_TRANSPORTER], [1],
[Including Ndb Cluster DB shared memory transporter])
have_ndb_shm="yes"
;;
* )
AC_MSG_RESULT([-- not including shared memory transporter])
;;
esac
have_ndb_test=no have_ndb_test=no
case "$ndb_test" in case "$ndb_test" in
yes ) yes )
@ -100,6 +87,24 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
;; ;;
esac esac
case "$ndb_debug" in
yes )
AC_MSG_RESULT([-- including ndb extra debug options])
have_ndb_debug="yes"
;;
full )
AC_MSG_RESULT([-- including ndb extra extra debug options])
have_ndb_debug="full"
;;
no )
AC_MSG_RESULT([-- not including ndb extra debug options])
have_ndb_debug="no"
;;
* )
have_ndb_debug="default"
;;
esac
AC_MSG_RESULT([done.]) AC_MSG_RESULT([done.])
]) ])

View File

@ -2450,7 +2450,7 @@ thread_dirs=
dnl This probably should be cleaned up more - for now the threaded dnl This probably should be cleaned up more - for now the threaded
dnl client is just using plain-old libs. dnl client is just using plain-old libs.
sql_client_dirs="libmysql client" sql_client_dirs="libmysql strings regex client"
linked_client_targets="linked_libmysql_sources" linked_client_targets="linked_libmysql_sources"
CLIENT_LIBS=$NON_THREADED_CLIENT_LIBS CLIENT_LIBS=$NON_THREADED_CLIENT_LIBS
if test "$THREAD_SAFE_CLIENT" != "no" if test "$THREAD_SAFE_CLIENT" != "no"
@ -2624,6 +2624,20 @@ AC_SUBST(sql_server_dirs)
AC_SUBST(thread_dirs) AC_SUBST(thread_dirs)
AC_SUBST(server_scripts) AC_SUBST(server_scripts)
# Now that sql_client_dirs and sql_server_dirs are stable, determine the union.
# Start with the (longer) server list, add each client item not yet present.
sql_union_dirs=" $sql_server_dirs "
for DIR in $sql_client_dirs
do
if echo $sql_union_dirs | grep " $DIR " >/dev/null
then
: # already present, skip
else
sql_union_dirs="$sql_union_dirs $DIR "
fi
done
AC_SUBST(sql_union_dirs)
#if test "$with_posix_threads" = "no" -o "$with_mit_threads" = "yes" #if test "$with_posix_threads" = "no" -o "$with_mit_threads" = "yes"
#then #then
# MIT pthreads does now support connecting with unix sockets # MIT pthreads does now support connecting with unix sockets

View File

@ -332,6 +332,9 @@ inline double ulonglong2double(ulonglong value)
#define SHAREDIR "share" #define SHAREDIR "share"
#define DEFAULT_CHARSET_HOME "C:/mysql/" #define DEFAULT_CHARSET_HOME "C:/mysql/"
#endif #endif
#ifndef DEFAULT_HOME_ENV
#define DEFAULT_HOME_ENV MYSQL_HOME
#endif
/* File name handling */ /* File name handling */

View File

@ -631,6 +631,7 @@ extern int pthread_dummy(int);
/* All thread specific variables are in the following struct */ /* All thread specific variables are in the following struct */
#define THREAD_NAME_SIZE 10 #define THREAD_NAME_SIZE 10
#ifndef DEFAULT_THREAD_STACK
#if defined(__ia64__) #if defined(__ia64__)
/* /*
MySQL can survive with 32K, but some glibc libraries require > 128K stack MySQL can survive with 32K, but some glibc libraries require > 128K stack
@ -640,6 +641,7 @@ extern int pthread_dummy(int);
#else #else
#define DEFAULT_THREAD_STACK (192*1024) #define DEFAULT_THREAD_STACK (192*1024)
#endif #endif
#endif
struct st_my_thread_var struct st_my_thread_var
{ {

View File

@ -340,8 +340,8 @@ typedef struct st_mi_check_param
ha_checksum key_crc[MI_MAX_POSSIBLE_KEY]; ha_checksum key_crc[MI_MAX_POSSIBLE_KEY];
ulong rec_per_key_part[MI_MAX_KEY_SEG*MI_MAX_POSSIBLE_KEY]; ulong rec_per_key_part[MI_MAX_KEY_SEG*MI_MAX_POSSIBLE_KEY];
void *thd; void *thd;
char *db_name,*table_name; const char *db_name, *table_name;
char *op_name; const char *op_name;
} MI_CHECK; } MI_CHECK;
typedef struct st_sort_ft_buf typedef struct st_sort_ft_buf

View File

@ -139,6 +139,14 @@ ib_time_t
ut_time(void); ut_time(void);
/*=========*/ /*=========*/
/************************************************************** /**************************************************************
Returns system time. */
void
ut_usectime(
/*========*/
ulint* sec, /* out: seconds since the Epoch */
ulint* ms); /* out: microseconds since the Epoch+*sec */
/**************************************************************
Returns the difference of two times in seconds. */ Returns the difference of two times in seconds. */
double double

View File

@ -3040,8 +3040,7 @@ recv_reset_log_files_for_backup(
memcpy(name + log_dir_len, logfilename, sizeof logfilename); memcpy(name + log_dir_len, logfilename, sizeof logfilename);
buf = ut_malloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE); buf = ut_malloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE);
memset(buf, LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE, '\0'); memset(buf, '\0', LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE);
for (i = 0; i < n_log_files; i++) { for (i = 0; i < n_log_files; i++) {

View File

@ -443,7 +443,8 @@ mlog_open_and_write_index(
type = dict_col_get_type(dict_field_get_col(field)); type = dict_col_get_type(dict_field_get_col(field));
len = field->fixed_len; len = field->fixed_len;
ut_ad(len < 0x7fff); ut_ad(len < 0x7fff);
if (len == 0 && dtype_get_len(type) > 255) { if (len == 0 && (dtype_get_len(type) > 255
|| dtype_get_mtype(type) == DATA_BLOB)) {
/* variable-length field /* variable-length field
with maximum length > 255 */ with maximum length > 255 */
len = 0x7fff; len = 0x7fff;

View File

@ -1767,7 +1767,21 @@ os_file_flush(
#else #else
int ret; int ret;
#ifdef HAVE_FDATASYNC #ifdef HAVE_DARWIN_THREADS
/* Apple has disabled fsync() for internal disk drives in OS X. That
caused corruption for a user when he tested a power outage. Let us in
OS X use a nonstandard flush method recommended by an Apple
engineer. */
ret = fcntl(file, F_FULLFSYNC, NULL);
if (ret) {
/* If we are not on a file system that supports this, then
fall back to a plain fsync. */
ret = fsync(file);
}
#elif HAVE_FDATASYNC
ret = fdatasync(file); ret = fdatasync(file);
#else #else
/* fprintf(stderr, "Flushing to file %p\n", file); */ /* fprintf(stderr, "Flushing to file %p\n", file); */

View File

@ -346,10 +346,10 @@ static ulint srv_n_rows_updated_old = 0;
static ulint srv_n_rows_deleted_old = 0; static ulint srv_n_rows_deleted_old = 0;
static ulint srv_n_rows_read_old = 0; static ulint srv_n_rows_read_old = 0;
ulint srv_n_lock_wait_count= 0; ulint srv_n_lock_wait_count = 0;
ulint srv_n_lock_wait_current_count= 0; ulint srv_n_lock_wait_current_count = 0;
ib_longlong srv_n_lock_wait_time= 0; ib_longlong srv_n_lock_wait_time = 0;
ulint srv_n_lock_max_wait_time= 0; ulint srv_n_lock_max_wait_time = 0;
/* /*
@ -1384,10 +1384,11 @@ srv_suspend_mysql_thread(
trx_t* trx; trx_t* trx;
ibool had_dict_lock = FALSE; ibool had_dict_lock = FALSE;
ibool was_declared_inside_innodb = FALSE; ibool was_declared_inside_innodb = FALSE;
ib_longlong start_time, finish_time; ib_longlong start_time = 0;
ulint diff_time; ib_longlong finish_time;
ulint sec; ulint diff_time;
ulint ms; ulint sec;
ulint ms;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)); ut_ad(!mutex_own(&kernel_mutex));
@ -1430,15 +1431,14 @@ srv_suspend_mysql_thread(
os_event_reset(event); os_event_reset(event);
slot->suspend_time = ut_time(); slot->suspend_time = ut_time();
if (thr->lock_state == QUE_THR_LOCK_ROW)
{
srv_n_lock_wait_count++;
srv_n_lock_wait_current_count++;
ut_usectime(&sec, &ms); if (thr->lock_state == QUE_THR_LOCK_ROW) {
start_time= (ib_longlong)sec * 1000000 + ms; srv_n_lock_wait_count++;
srv_n_lock_wait_current_count++;
} ut_usectime(&sec, &ms);
start_time = (ib_longlong)sec * 1000000 + ms;
}
/* Wake the lock timeout monitor thread, if it is suspended */ /* Wake the lock timeout monitor thread, if it is suspended */
os_event_set(srv_lock_timeout_thread_event); os_event_set(srv_lock_timeout_thread_event);
@ -1490,20 +1490,18 @@ srv_suspend_mysql_thread(
wait_time = ut_difftime(ut_time(), slot->suspend_time); wait_time = ut_difftime(ut_time(), slot->suspend_time);
if (thr->lock_state == QUE_THR_LOCK_ROW) if (thr->lock_state == QUE_THR_LOCK_ROW) {
{ ut_usectime(&sec, &ms);
ut_usectime(&sec, &ms); finish_time = (ib_longlong)sec * 1000000 + ms;
finish_time= (ib_longlong)sec * 1000000 + ms;
diff_time = finish_time - start_time;
diff_time= finish_time-start_time; srv_n_lock_wait_current_count--;
srv_n_lock_wait_time = srv_n_lock_wait_time + diff_time;
srv_n_lock_wait_current_count--; if (diff_time > srv_n_lock_max_wait_time) {
srv_n_lock_wait_time= srv_n_lock_wait_time + diff_time; srv_n_lock_max_wait_time = diff_time;
if (diff_time > srv_n_lock_max_wait_time) }
{ }
srv_n_lock_max_wait_time= diff_time;
}
}
if (trx->was_chosen_as_deadlock_victim) { if (trx->was_chosen_as_deadlock_victim) {

View File

@ -368,7 +368,7 @@ mutex_spin_wait(
{ {
ulint index; /* index of the reserved wait cell */ ulint index; /* index of the reserved wait cell */
ulint i; /* spin round count */ ulint i; /* spin round count */
ib_longlong lstart_time, lfinish_time; /* for timing os_wait */ ib_longlong lstart_time = 0, lfinish_time; /* for timing os_wait */
ulint ltime_diff; ulint ltime_diff;
ulint sec; ulint sec;
ulint ms; ulint ms;

View File

@ -74,18 +74,18 @@ ut_time(void)
} }
/************************************************************** /**************************************************************
Returns system time. We do not specify the format of the time returned: Returns system time. */
the only way to manipulate it is to use the function ut_difftime. */
void void
ut_usectime(ulint* sec, ulint* ms) ut_usectime(
/*=========*/ /*========*/
ulint* sec, /* out: seconds since the Epoch */
ulint* ms) /* out: microseconds since the Epoch+*sec */
{ {
struct timeval tv; struct timeval tv;
gettimeofday(&tv,NULL); gettimeofday(&tv,NULL);
*sec = (ulint) tv.tv_sec; *sec = (ulint) tv.tv_sec;
*ms = (ulint) tv.tv_usec; *ms = (ulint) tv.tv_usec;
return;
} }
/************************************************************** /**************************************************************

View File

@ -81,6 +81,7 @@ CLEANFILES = $(target_libadd) $(SHLIBOBJS) \
$(target) $(target)
DEFS = -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \ DEFS = -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \ -DDATADIR="\"$(MYSQLDATAdir)\"" \
-DDEFAULT_HOME_ENV=MYSQL_HOME \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" $(target_defs) -DSHAREDIR="\"$(MYSQLSHAREdir)\"" $(target_defs)
# The automatic dependencies miss this # The automatic dependencies miss this

View File

@ -1865,12 +1865,14 @@ my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
{ {
uchar *pos; uchar *pos;
uint field_count, param_count; uint field_count, param_count;
ulong packet_length;
MYSQL_DATA *fields_data; MYSQL_DATA *fields_data;
DBUG_ENTER("read_prepare_result"); DBUG_ENTER("cli_read_prepare_result");
mysql= mysql->last_used_con; mysql= mysql->last_used_con;
if (net_safe_read(mysql) == packet_error) if ((packet_length= net_safe_read(mysql)) == packet_error)
DBUG_RETURN(1); DBUG_RETURN(1);
mysql->warning_count= 0;
pos= (uchar*) mysql->net.read_pos; pos= (uchar*) mysql->net.read_pos;
stmt->stmt_id= uint4korr(pos+1); pos+= 5; stmt->stmt_id= uint4korr(pos+1); pos+= 5;
@ -1878,6 +1880,8 @@ my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
field_count= uint2korr(pos); pos+= 2; field_count= uint2korr(pos); pos+= 2;
/* Number of placeholders in the statement */ /* Number of placeholders in the statement */
param_count= uint2korr(pos); pos+= 2; param_count= uint2korr(pos); pos+= 2;
if (packet_length >= 12)
mysql->warning_count= uint2korr(pos+1);
if (param_count != 0) if (param_count != 0)
{ {
@ -1894,7 +1898,6 @@ my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
if (!(mysql->server_status & SERVER_STATUS_AUTOCOMMIT)) if (!(mysql->server_status & SERVER_STATUS_AUTOCOMMIT))
mysql->server_status|= SERVER_STATUS_IN_TRANS; mysql->server_status|= SERVER_STATUS_IN_TRANS;
mysql->extra_info= net_field_length_ll(&pos);
if (!(fields_data= (*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*)0,7))) if (!(fields_data= (*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*)0,7)))
DBUG_RETURN(1); DBUG_RETURN(1);
if (!(stmt->fields= unpack_fields(fields_data,&stmt->mem_root, if (!(stmt->fields= unpack_fields(fields_data,&stmt->mem_root,
@ -1902,9 +1905,10 @@ my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
mysql->server_capabilities))) mysql->server_capabilities)))
DBUG_RETURN(1); DBUG_RETURN(1);
} }
stmt->field_count= (uint) field_count; stmt->field_count= field_count;
stmt->param_count= (ulong) param_count; stmt->param_count= (ulong) param_count;
mysql->warning_count= 0; DBUG_PRINT("exit",("field_count: %u param_count: %u warning_count: %u",
field_count, param_count, (uint) mysql->warning_count));
DBUG_RETURN(0); DBUG_RETURN(0);
} }

View File

@ -17,11 +17,11 @@
## Process this file with automake to create Makefile.in ## Process this file with automake to create Makefile.in
man_MANS = mysql.1 isamchk.1 isamlog.1 mysql_zap.1 mysqlaccess.1 \ man_MANS = mysql.1 mysql_zap.1 mysqlaccess.1 \
mysqladmin.1 mysqld.1 mysqld_multi.1 mysqldump.1 mysqlshow.1 \ mysqladmin.1 mysqld.1 mysqld_multi.1 mysqldump.1 mysqlshow.1 \
perror.1 replace.1 mysqld_safe.1 mysql_fix_privilege_tables.1 perror.1 replace.1 mysqld_safe.1 mysql_fix_privilege_tables.1
EXTRA_DIST = mysql.1.in isamchk.1.in isamlog.1.in mysql_zap.1.in \ EXTRA_DIST = mysql.1.in mysql_zap.1.in \
mysqlaccess.1.in mysqladmin.1.in mysqld.1.in mysqld_multi.1.in \ mysqlaccess.1.in mysqladmin.1.in mysqld.1.in mysqld_multi.1.in \
mysqldump.1.in mysqlshow.1.in perror.1.in replace.1.in mysqlman.1.in \ mysqldump.1.in mysqlshow.1.in perror.1.in replace.1.in mysqlman.1.in \
mysqld_safe.1.in mysql_fix_privilege_tables.1.in mysqld_safe.1.in mysql_fix_privilege_tables.1.in

View File

@ -1,145 +0,0 @@
.TH isamchk 1 "19 December 2000" "MySQL @MYSQL_BASE_VERSION@" "MySQL database"
.SH NAME
.BR isamchk
\- Description, check and repair of ISAM tables.
Used without options all tables on the command will be checked for errors
.SH USAGE
isamchk [OPTIONS] tables[.ISM]
.SH SYNOPSIS
.B isamchk
.RB [ \-a | \-\-analyze ]
.RB [ \-# | \-\-debug=... ]
.RB [ \-\-character\-sets\-dir=...]
.RB [ \-C | \-\-default\-character\-set=...]
.RB [ \-d | \-\-description ]
.RB [ \-e | \-\-extend\-check ]
.RB [ \-f | \-\-force ]
.RB [ \-? | \-\-help ]
.RB [ \-i | \-\-information ]
.RB [ \-k | \-\-keys\-used=# ]
.RB [ \-l | \-\-no\-symlinks]
.RB [ \-q | \-\-quick ]
.RB [ \-r | \-\-recover ]
.RB [ \-o | \-\-safe\-recover ]
.RB [ \-O | "\-\-set\-variable var=option"]
.RB [ \-s | \-\-silent ]
.RB [ \-S | \-\-sort\-index ]
.RB [ \-R | \-\-sort\-records=#]
.RB [ \-u | \-\-unpack ]
.RB [ \-v | \-\-verbose ]
.RB [ \-V | \-\-version ]
.RB [ \-w | \-\-wait ]
.SH DESCRIPTION
.TP
.BR \-a | \-\-analyze
Analyze distribution of keys. Will make some joins in
MySQL faster.
.TP
.BR \-# | \-\-debug=...
Output debug log. Often this is 'd:t:o ,filename`
.TP
.BR \-\-character\-sets\-dir=...
Directory where character sets are
.TP
.BR \-C | \-\-default\-character\-set=...
Set the default character set
.TP
.BR \-d | \-\-description
Prints some information about table.
.TP
.BR \-e | \-\-extend\-check
Check the table VERY thoroughly. One need use this
only in extreme cases as isamchk should normally find
all errors even without this switch
.TP
.BR \-f | \-\-force
Overwrite old temporary files.
If one uses \-f when checking tables (running isamchk
without \-r), isamchk will automatically restart with
\-r on any wrong table.
.TP
.BR \-? | \-\-help
Display help and exit.
.TP
.BR \-i | \-\-information
Print statistics information about the table
.TP
.BR \-k | \-\-keys\-used=#
Used with '\-r'. Tell ISAM to update only the first
# keys. This can be used to get faster inserts!
.TP
.BR \-l | \-\-no\-symlinks
Do not follow symbolic links when repairing. Normally
isamchk repairs the table a symlink points at.
.TP
.BR \-q | \-\-quick
Used with \-r to get a faster repair. (The data file
isn't touched.) One can give a second '\-q' to force
isamchk to modify the original datafile.
.TP
.BR \-r | \-\-recover
Can fix almost anything except unique keys that aren't
unique.
.TP
.BR \-o | \-\-safe\-recover
Uses old recovery method; slower than '\-r' but can
handle a couple of cases that '\-r' cannot handle.
.TP
.BR \-O | " \-\-set\-variable var=option "
Change the value of a variable.
.TP
.BR \-s | \-\-silent
Only print errors. One can use two \-s to make isamchk
very silent
.TP
.BR \-S | \-\-sort\-index
Sort index blocks. This speeds up 'read\-next' in
applications
.TP
.BR \-R | \-\-sort\-records=#
Sort records according to an index. This makes your
data much more localized and may speed up things
(It may be VERY slow to do a sort the first time!)
.TP
.BR \-u | \-\-unpack
Unpack file packed with pack_isam.
.TP
.BR \-v | \-\-verbose
Print more information. This can be used with
\-d and \-e. Use many \-v for more verbosity!
.TP
.BR \-V | \-\-version
Print version and exit.
.TP
.BR \-w | \-\-wait
Wait if table is locked.
.SH "SEE ALSO"
isamlog(1),
mysql(1),
mysqlaccess(1),
mysqladmin(1),
mysqld(1),
mysqld_multi(1),
mysqld_safe(1),
mysqldump(1),
mysql_fix_privilege_tables(1),
mysqlshow(1),
mysql_zap(1),
perror(1),
replace(1)
.P
For more information please refer to the MySQL reference
manual, which may already be installed locally and which
is also available online at http://www.mysql.com/doc/en/
.SH BUGS
Please refer to http://bugs.mysql.com/ to report bugs.
.SH AUTHOR
Ver 1.0, distribution @MYSQL_NO_DASH_VERSION@
Michael (Monty) Widenius (monty@mysql.com),
MySQL AB (http://www.mysql.com/).
This software comes with no warranty.
Manual page by L. (Kill-9) Pedersen
(kill-9@kill\-9.dk), Mercurmedia Data Model Architect /
system developer (http://www.mercurmedia.com)
.\" end of man page

View File

@ -1,107 +0,0 @@
.TH isamlog 1 "19 December 2000" "MySQL @MYSQL_BASE_VERSION@" "MySQL database"
.SH NAME
isamlog - Write info about whats in a nisam log file.
.SH USAGE
isamlog [-?iruvIV] [-c #] [-f #] [-F filepath/] [-o #] [-R file recordpos] [-w write_file] [log-filename [table ...]]
.SH SYNOPSIS
.B isamlog
.RB [ -? | -I ]
.RB [ -V ]
.RB [ -c ]
.RB [ -f ]
.RB [ -F ]
.RB [ -i ]
.RB [ -o ]
.RB [ "-p #" ]
.RB [ -r ]
.RB [ -R ]
.RB [ -u ]
.RB [ -v ]
.RB [ -w ]
.SH DESCRIPTION
.TP
.BR isamlog
.TP
.BR -? | -I
info
.TP
.BR -V
version
.TP
.BR -c
do only # commands
.TP
.BR -f
max open files
.TP
.BR -F
file path
.TP
.BR -i
extra info
.TP
.BR -o
offset
.TP
.BR "-p #"
remove # components from path
.TP
.BR -r
recover
.TP
.BR -R
file recordposition
.TP
.BR -u
update
.TP
.BR -v
verbose
.TP
.BR -w
write file
.SH NOTE
If no file name is given isam.log is used
One can give a second and a third '-v' for more verbose.
Normaly one does a update (-u).
If a recover is done all writes and all possibly updates and deletes is done
and errors are only counted.
If one gives table names as arguments only these tables will be updated
.SH "SEE ALSO"
isamchk(1),
mysql(1),
mysqlaccess(1),
mysqladmin(1),
mysqld(1),
mysqld_multi(1),
mysqld_safe(1),
mysqldump(1),
mysql_fix_privilege_tables(1),
mysqlshow(1),
mysql_zap(1),
perror(1),
replace(1)
.P
For more information please refer to the MySQL reference
manual, which may already be installed locally and which
is also available online at http://www.mysql.com/doc/en/
.SH BUGS
Please refer to http://bugs.mysql.com/ to report bugs.
.SH AUTHOR
Ver 1.0, distribution @MYSQL_NO_DASH_VERSION@
Michael (Monty) Widenius (monty@mysql.com),
MySQL AB (http://www.mysql.com/).
This software comes with no warranty.
Manual page by L. (Kill-9) Pedersen
(kill-9@kill-9.dk), Mercurmedia Data Model Architect /
system developer (http://www.mercurmedia.com)
.\" end of man page

View File

@ -1467,12 +1467,14 @@ static int writekeys(MI_CHECK *param, register MI_INFO *info, byte *buff,
if (_mi_ft_add(info,i,(char*) key,buff,filepos)) if (_mi_ft_add(info,i,(char*) key,buff,filepos))
goto err; goto err;
} }
#ifdef HAVE_SPATIAL
else if (info->s->keyinfo[i].flag & HA_SPATIAL) else if (info->s->keyinfo[i].flag & HA_SPATIAL)
{ {
uint key_length=_mi_make_key(info,i,key,buff,filepos); uint key_length=_mi_make_key(info,i,key,buff,filepos);
if (rtree_insert(info, i, key, key_length)) if (rtree_insert(info, i, key, key_length))
goto err; goto err;
} }
#endif /*HAVE_SPATIAL*/
else else
{ {
uint key_length=_mi_make_key(info,i,key,buff,filepos); uint key_length=_mi_make_key(info,i,key,buff,filepos);

View File

@ -52,7 +52,7 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.000001 $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.000001 $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.frm $(distdir)/std_data
install-data-local: install-data-local:
$(mkinstalldirs) \ $(mkinstalldirs) \
@ -73,6 +73,7 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.frm $(DESTDIR)$(testdir)/std_data
std_data/%.pem: std_data/%.pem:
@CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,44 @@
# -*- cperl -*-
# This is a library file used by the Perl version of mysql-test-run,
# and is part of the translation of the Bourne shell script with the
# same name.
use strict;
# These are not to be prefixed with "mtr_"
sub gcov_prepare ();
sub gcov_collect ();
##############################################################################
#
#
#
##############################################################################
sub gcov_prepare () {
`find $::glob_basedir -name \*.gcov \
-or -name \*.da | xargs rm`;
}
sub gcov_collect () {
print "Collecting source coverage info...\n";
-f $::opt_gcov_msg and unlink($::opt_gcov_msg);
-f $::opt_gcov_err and unlink($::opt_gcov_err);
foreach my $d ( @::mysqld_src_dirs )
{
chdir("$::glob_basedir/$d");
foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) )
{
`$::opt_gcov $f 2>>$::opt_gcov_err >>$::opt_gcov_msg`;
}
chdir($::glob_mysql_test_dir);
}
print "gcov info in $::opt_gcov_msg, errors in $::opt_gcov_err\n";
}
1;

View File

@ -0,0 +1,50 @@
# -*- cperl -*-
# This is a library file used by the Perl version of mysql-test-run,
# and is part of the translation of the Bourne shell script with the
# same name.
use strict;
# These are not to be prefixed with "mtr_"
sub gprof_prepare ();
sub gprof_collect ();
##############################################################################
#
#
#
##############################################################################
sub gprof_prepare () {
rmtree($::opt_gprof_dir);
mkdir($::opt_gprof_dir);
}
# FIXME what about master1 and slave1?!
sub gprof_collect () {
if ( -f "$::master->[0]->{'path_myddir'}/gmon.out" )
{
# FIXME check result code?!
mtr_run("gprof",
[$::exe_master_mysqld,
"$::master->[0]->{'path_myddir'}/gmon.out"],
$::opt_gprof_master, "", "", "");
print "Master execution profile has been saved in $::opt_gprof_master\n";
}
if ( -f "$::slave->[0]->{'path_myddir'}/gmon.out" )
{
# FIXME check result code?!
mtr_run("gprof",
[$::exe_slave_mysqld,
"$::slave->[0]->{'path_myddir'}/gmon.out"],
$::opt_gprof_slave, "", "", "");
print "Slave execution profile has been saved in $::opt_gprof_slave\n";
}
}
1;

71
mysql-test/lib/mtr_io.pl Normal file
View File

@ -0,0 +1,71 @@
# -*- cperl -*-
# This is a library file used by the Perl version of mysql-test-run,
# and is part of the translation of the Bourne shell script with the
# same name.
use strict;
sub mtr_get_pid_from_file ($);
sub mtr_get_opts_from_file ($);
sub mtr_tofile ($@);
sub mtr_tonewfile($@);
##############################################################################
#
#
#
##############################################################################
sub mtr_get_pid_from_file ($) {
my $file= shift;
open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
my $pid= <FILE>;
chomp($pid);
close FILE;
return $pid;
}
sub mtr_get_opts_from_file ($) {
my $file= shift;
open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
my @args;
while ( <FILE> )
{
chomp;
s/\$MYSQL_TEST_DIR/$::glob_mysql_test_dir/g;
push(@args, split(' ', $_));
}
close FILE;
return \@args;
}
sub mtr_fromfile ($) {
my $file= shift;
open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
my $text= join('', <FILE>);
close FILE;
return $text;
}
sub mtr_tofile ($@) {
my $file= shift;
open(FILE,">>",$file) or mtr_error("can't open file \"$file\": $!");
print FILE join("", @_);
close FILE;
}
sub mtr_tonewfile ($@) {
my $file= shift;
open(FILE,">",$file) or mtr_error("can't open file \"$file\": $!");
print FILE join("", @_);
close FILE;
}
1;

View File

@ -0,0 +1,67 @@
# -*- cperl -*-
# This is a library file used by the Perl version of mysql-test-run,
# and is part of the translation of the Bourne shell script with the
# same name.
use strict;
sub mtr_match_prefix ($$);
sub mtr_match_extension ($$);
sub mtr_match_any_exact ($$);
##############################################################################
#
#
#
##############################################################################
# Match a prefix and return what is after the prefix
sub mtr_match_prefix ($$) {
my $string= shift;
my $prefix= shift;
if ( $string =~ /^\Q$prefix\E(.*)$/ ) # strncmp
{
return $1;
}
else
{
return undef; # NULL
}
}
# Match extension and return the name without extension
sub mtr_match_extension ($$) {
my $file= shift;
my $ext= shift;
if ( $file =~ /^(.*)\.\Q$ext\E$/ ) # strchr+strcmp or something
{
return $1;
}
else
{
return undef; # NULL
}
}
sub mtr_match_any_exact ($$) {
my $string= shift;
my $mlist= shift;
foreach my $m (@$mlist)
{
if ( $string eq $m )
{
return 1;
}
}
return 0;
}
1;

View File

@ -0,0 +1,50 @@
# -*- cperl -*-
# This is a library file used by the Perl version of mysql-test-run,
# and is part of the translation of the Bourne shell script with the
# same name.
use strict;
sub mtr_full_hostname ();
sub mtr_init_args ($);
sub mtr_add_arg ($$);
##############################################################################
#
# Misc
#
##############################################################################
# We want the fully qualified host name and hostname() may have returned
# only the short name. So we use the resolver to find out.
sub mtr_full_hostname () {
my $hostname= hostname();
if ( $hostname !~ /\./ )
{
my $address= gethostbyname($hostname)
or die "Couldn't resolve $hostname : $!";
my $fullname= gethostbyaddr($address, AF_INET);
$hostname= $fullname if $fullname;
}
return $hostname;
}
# FIXME move to own lib
sub mtr_init_args ($) {
my $args = shift;
$$args = []; # Empty list
}
sub mtr_add_arg ($$) {
my $args= shift;
my $format= shift;
my @fargs = @_;
push(@$args, sprintf($format, @fargs));
}
1;

View File

@ -0,0 +1,467 @@
# -*- cperl -*-
# This is a library file used by the Perl version of mysql-test-run,
# and is part of the translation of the Bourne shell script with the
# same name.
use Carp qw(cluck);
use strict;
use POSIX ":sys_wait_h";
sub mtr_run ($$$$$$);
sub mtr_spawn ($$$$$$);
sub mtr_stop_mysqld_servers ($$);
sub mtr_kill_leftovers ();
# static in C
sub spawn_impl ($$$$$$$);
##############################################################################
#
# Execute an external command
#
##############################################################################
# This function try to mimic the C version used in "netware/mysql_test_run.c"
# FIXME learn it to handle append mode as well, a "new" flag or a "append"
sub mtr_run ($$$$$$) {
my $path= shift;
my $arg_list_t= shift;
my $input= shift;
my $output= shift;
my $error= shift;
my $pid_file= shift;
return spawn_impl($path,$arg_list_t,1,$input,$output,$error,$pid_file);
}
sub mtr_spawn ($$$$$$) {
my $path= shift;
my $arg_list_t= shift;
my $input= shift;
my $output= shift;
my $error= shift;
my $pid_file= shift;
return spawn_impl($path,$arg_list_t,0,$input,$output,$error,$pid_file);
}
##############################################################################
#
# If $join is set, we return the error code, else we return the PID
#
##############################################################################
sub spawn_impl ($$$$$$$) {
my $path= shift;
my $arg_list_t= shift;
my $join= shift;
my $input= shift;
my $output= shift;
my $error= shift;
my $pid_file= shift; # FIXME
# FIXME really needing a PATH???
# $ENV{'PATH'}= "/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11:$ENV{'PATH'}";
$ENV{'TZ'}= "GMT-3"; # for UNIX_TIMESTAMP tests to work
$ENV{'LC_COLLATE'}= "C";
$ENV{'MYSQL_TEST_DIR'}= $::glob_mysql_test_dir;
$ENV{'MASTER_MYPORT'}= $::opt_master_myport;
$ENV{'SLAVE_MYPORT'}= $::opt_slave_myport;
# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME
$ENV{'MYSQL_TCP_PORT'}= 3306;
$ENV{'MASTER_MYSOCK'}= $::master->[0]->{'path_mysock'};
if ( $::opt_script_debug )
{
print STDERR "\n";
print STDERR "#### ", "-" x 78, "\n";
print STDERR "#### ", "STDIN $input\n" if $input;
print STDERR "#### ", "STDOUT $output\n" if $output;
print STDERR "#### ", "STDERR $error\n" if $error;
if ( $join )
{
print STDERR "#### ", "run";
}
else
{
print STDERR "#### ", "spawn";
}
print STDERR "$path ", join(" ",@$arg_list_t), "\n";
print STDERR "#### ", "-" x 78, "\n";
}
my $pid= fork();
if ( $pid )
{
# Parent, i.e. the main script
if ( $join )
{
# We run a command and wait for the result
# FIXME this need to be improved
waitpid($pid,0);
my $exit_value= $? >> 8;
my $signal_num= $? & 127;
my $dumped_core= $? & 128;
if ( $signal_num )
{
mtr_error("spawn got signal $signal_num");
}
if ( $dumped_core )
{
mtr_error("spawn dumped core");
}
return $exit_value;
}
else
{
# We spawned a process we don't wait for
return $pid;
}
}
else
{
# Child, redirect output and exec
# FIXME I tried POSIX::setsid() here to detach and, I hoped,
# avoid zombies. But everything went wild, somehow the parent
# became a deamon as well, and was hard to kill ;-)
# Need to catch SIGCHLD and do waitpid or something instead......
$SIG{INT}= 'DEFAULT'; # Parent do some stuff, we don't
if ( $output )
{
if ( ! open(STDOUT,">",$output) )
{
mtr_error("can't redirect STDOUT to \"$output\": $!");
}
}
if ( $error )
{
if ( $output eq $error )
{
if ( ! open(STDERR,">&STDOUT") )
{
mtr_error("can't dup STDOUT: $!");
}
}
else
{
if ( ! open(STDERR,">",$error) )
{
mtr_error("can't redirect STDERR to \"$output\": $!");
}
}
}
if ( $input )
{
if ( ! open(STDIN,"<",$input) )
{
mtr_error("can't redirect STDIN to \"$input\": $!");
}
}
exec($path,@$arg_list_t);
}
}
##############################################################################
#
# Kill processes left from previous runs
#
##############################################################################
sub mtr_kill_leftovers () {
# First, kill all masters and slaves that would conflict with
# this run. Make sure to remove the PID file, if any.
my @args;
for ( my $idx; $idx < 2; $idx++ )
{
push(@args,{
pid => 0, # We don't know the PID
pidfile => $::master->[$idx]->{'path_mypid'},
sockfile => $::master->[$idx]->{'path_mysock'},
port => $::master->[$idx]->{'path_myport'},
});
}
for ( my $idx; $idx < 3; $idx++ )
{
push(@args,{
pid => 0, # We don't know the PID
pidfile => $::slave->[$idx]->{'path_mypid'},
sockfile => $::slave->[$idx]->{'path_mysock'},
port => $::slave->[$idx]->{'path_myport'},
});
}
mtr_stop_mysqld_servers(\@args, 1);
# We scan the "var/run/" directory for other process id's to kill
my $rundir= "$::glob_mysql_test_dir/var/run"; # FIXME $path_run_dir or something
if ( -d $rundir )
{
opendir(RUNDIR, $rundir)
or mtr_error("can't open directory \"$rundir\": $!");
my @pids;
while ( my $elem= readdir(RUNDIR) )
{
my $pidfile= "$rundir/$elem";
if ( -f $pidfile )
{
my $pid= mtr_get_pid_from_file($pidfile);
if ( ! unlink($pidfile) )
{
mtr_error("can't remove $pidfile");
}
push(@pids, $pid);
}
}
closedir(RUNDIR);
start_reap_all();
if ( $::glob_cygwin_perl )
{
# We have no (easy) way of knowing the Cygwin controlling
# process, in the PID file we only have the Windows process id.
system("kill -f " . join(" ",@pids)); # Hope for the best....
}
else
{
my $retries= 10; # 10 seconds
do
{
kill(9, @pids);
} while ( $retries-- and kill(0, @pids) );
if ( kill(0, @pids) )
{
mtr_error("can't kill processes " . join(" ", @pids));
}
}
stop_reap_all();
}
}
##############################################################################
#
# Shut down mysqld servers
#
##############################################################################
# To speed things we kill servers in parallel.
# The argument is a list of 'pidfiles' and 'socketfiles'.
# We use the pidfiles and socketfiles to try to terminate the servers.
# This is not perfect, there could still be other server processes
# left.
# Force flag is to be set only for killing mysqld servers this script
# didn't create in this run, i.e. initial cleanup before we start working.
# If force flag is set, we try to kill all with mysqladmin, and
# give up if we have no PIDs.
# FIXME On some operating systems, $srv->{'pid'} and $srv->{'pidfile'}
# will not be the same PID. We need to try to kill both I think.
sub mtr_stop_mysqld_servers ($$) {
my $spec= shift;
my $force= shift;
# ----------------------------------------------------------------------
# If the process was not started from this file, we got no PID,
# we try to find it in the PID file.
# ----------------------------------------------------------------------
my $any_pid= 0; # If we have any PIDs
foreach my $srv ( @$spec )
{
if ( ! $srv->{'pid'} and -f $srv->{'pidfile'} )
{
$srv->{'pid'}= mtr_get_pid_from_file($srv->{'pidfile'});
}
if ( $srv->{'pid'} )
{
$any_pid= 1;
}
}
# If the processes where started from this script, and we know
# no PIDs, then we don't have to do anything.
if ( ! $any_pid and ! $force )
{
# cluck "This is how we got here!";
return;
}
# ----------------------------------------------------------------------
# First try nice normal shutdown using 'mysqladmin'
# ----------------------------------------------------------------------
start_reap_all(); # Don't require waitpid() of children
foreach my $srv ( @$spec )
{
if ( -e $srv->{'sockfile'} or $srv->{'port'} )
{
# FIXME wrong log.....
# FIXME, stderr.....
# Shutdown time must be high as slave may be in reconnect
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "-uroot");
if ( -e $srv->{'sockfile'} )
{
mtr_add_arg($args, "--socket=%s", $srv->{'sockfile'});
}
if ( $srv->{'port'} )
{
mtr_add_arg($args, "--port=%s", $srv->{'port'});
}
mtr_add_arg($args, "--connect_timeout=5");
mtr_add_arg($args, "--shutdown_timeout=70");
mtr_add_arg($args, "shutdown");
# We don't wait for termination of mysqladmin
mtr_spawn($::exe_mysqladmin, $args,
"", $::path_manager_log, $::path_manager_log, "");
}
}
# Wait for them all to remove their pid and socket file
PIDSOCKFILEREMOVED:
for (my $loop= $::opt_sleep_time_for_delete; $loop; $loop--)
{
my $pidsockfiles_left= 0;
foreach my $srv ( @$spec )
{
if ( -e $srv->{'sockfile'} or -f $srv->{'pidfile'} )
{
$pidsockfiles_left++; # Could be that pidfile is left
}
}
if ( ! $pidsockfiles_left )
{
last PIDSOCKFILEREMOVED;
}
mtr_debug("Sleep for 1 second waiting for pid and socket file removal");
sleep(1); # One second
}
# ----------------------------------------------------------------------
# If no known PIDs, we have nothing more to try
# ----------------------------------------------------------------------
if ( ! $any_pid )
{
stop_reap_all();
return;
}
# ----------------------------------------------------------------------
# We may have killed all that left a socket, but we are not sure we got
# them all killed. If we suspect it lives, try nice kill with SIG_TERM.
# Note that for true Win32 processes, kill(0,$pid) will not return 1.
# ----------------------------------------------------------------------
SIGNAL:
foreach my $sig (15,9)
{
my $process_left= 0;
foreach my $srv ( @$spec )
{
if ( $srv->{'pid'} and
( -f $srv->{'pidfile'} or kill(0,$srv->{'pid'}) ) )
{
$process_left++;
mtr_warning("process $srv->{'pid'} not cooperating, " .
"will send signal $sig to process");
kill($sig,$srv->{'pid'}); # SIG_TERM
}
if ( ! $process_left )
{
last SIGNAL;
}
}
mtr_debug("Sleep for 5 seconds waiting for processes to die");
sleep(5); # We wait longer than usual
}
# ----------------------------------------------------------------------
# Now, we check if all we can find using kill(0,$pid) are dead,
# and just assume the rest are. We cleanup socket and PID files.
# ----------------------------------------------------------------------
{
my $errors= 0;
foreach my $srv ( @$spec )
{
if ( $srv->{'pid'} )
{
if ( kill(0,$srv->{'pid'}) )
{
# FIXME In Cygwin there seem to be some fast reuse
# of PIDs, so dying may not be the right thing to do.
$errors++;
mtr_warning("can't kill process $srv->{'pid'}");
}
else
{
# We managed to kill it at last
# FIXME In Cygwin, we will get here even if the process lives.
# Not needed as we know the process is dead, but to be safe
# we unlink and check success in two steps. We first unlink
# without checking the error code, and then check if the
# file still exists.
foreach my $file ($srv->{'pidfile'}, $srv->{'sockfile'})
{
unlink($file);
if ( -e $file )
{
$errors++;
mtr_warning("couldn't delete $file");
}
}
}
}
}
if ( $errors )
{
# We are in trouble, just die....
mtr_error("we could not kill or clean up all processes");
}
}
stop_reap_all();
# FIXME We just assume they are all dead, we don't know....
}
sub start_reap_all {
$SIG{CHLD}= 'IGNORE'; # FIXME is this enough?
}
sub stop_reap_all {
$SIG{CHLD}= 'DEFAULT';
}
1;

View File

@ -0,0 +1,262 @@
# -*- cperl -*-
# This is a library file used by the Perl version of mysql-test-run,
# and is part of the translation of the Bourne shell script with the
# same name.
use strict;
sub mtr_report_test_name($);
sub mtr_report_test_passed($);
sub mtr_report_test_failed($);
sub mtr_report_test_skipped($);
sub mtr_show_failed_diff ($);
sub mtr_report_stats ($);
sub mtr_print_line ();
sub mtr_print_thick_line ();
sub mtr_print_header ();
sub mtr_report (@);
sub mtr_warning (@);
sub mtr_error (@);
sub mtr_debug (@);
##############################################################################
#
#
#
##############################################################################
# We can't use diff -u or diff -a as these are not portable
sub mtr_show_failed_diff ($) {
my $tname= shift;
my $reject_file= "r/$tname.reject";
my $result_file= "r/$tname.result";
my $eval_file= "r/$tname.eval";
if ( -f $eval_file )
{
$result_file= $eval_file;
}
elsif ( $::opt_result_ext and
( $::opt_record or -f "$result_file$::opt_result_ext" ))
{
# If we have an special externsion for result files we use it if we are
# recording or a result file with that extension exists.
$result_file= "$result_file$::opt_result_ext";
}
if ( -f $reject_file )
{
print "Below are the diffs between actual and expected results:\n";
print "-------------------------------------------------------\n";
# FIXME check result code?!
mtr_run("diff",["-c",$result_file,$reject_file], "", "", "", "");
print "-------------------------------------------------------\n";
print "Please follow the instructions outlined at\n";
print "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html\n";
print "to find the reason to this problem and how to report this.\n\n";
}
}
sub mtr_report_test_name ($) {
my $tinfo= shift;
printf "%-31s ", $tinfo->{'name'};
}
sub mtr_report_test_skipped ($) {
my $tinfo= shift;
$tinfo->{'result'}= 'MTR_RES_SKIPPED';
print "[ skipped ]\n";
}
sub mtr_report_test_passed ($) {
my $tinfo= shift;
my $timer= "";
# FIXME
# if ( $::opt_timer and -f "$::glob_mysql_test_dir/var/log/timer" )
# {
# $timer= `cat var/log/timer`;
# $timer= sprintf "%13s", $timer;
# }
$tinfo->{'result'}= 'MTR_RES_PASSED';
print "[ pass ] $timer\n";
}
sub mtr_report_test_failed ($) {
my $tinfo= shift;
$tinfo->{'result'}= 'MTR_RES_FAILED';
print "[ fail ]\n";
print "Errors are (from $::path_timefile) :\n";
print mtr_fromfile($::path_timefile); # FIXME print_file() instead
print "\n(the last lines may be the most important ones)\n";
}
sub mtr_report_stats ($) {
my $tests= shift;
# ----------------------------------------------------------------------
# Find out how we where doing
# ----------------------------------------------------------------------
my $tot_skiped= 0;
my $tot_passed= 0;
my $tot_failed= 0;
my $tot_tests= 0;
foreach my $tinfo (@$tests)
{
if ( $tinfo->{'result'} eq 'MTR_RES_SKIPPED' )
{
$tot_skiped++;
}
elsif ( $tinfo->{'result'} eq 'MTR_RES_PASSED' )
{
$tot_tests++;
$tot_passed++;
}
elsif ( $tinfo->{'result'} eq 'MTR_RES_FAILED' )
{
$tot_tests++;
$tot_failed++;
}
}
# ----------------------------------------------------------------------
# Print out a summary report to screen
# ----------------------------------------------------------------------
if ( ! $tot_failed )
{
print "All $tot_tests tests were successful.\n";
}
else
{
my $ratio= $tot_passed * 100 / $tot_tests;
printf "Failed $tot_failed/$tot_tests tests, " .
"%.2f\% successful.\n\n", $ratio;
print
"The log files in var/log may give you some hint\n",
"of what when wrong.\n",
"If you want to report this error, please read first ",
"the documentation at\n",
"http://www.mysql.com/doc/en/MySQL_test_suite.html\n";
}
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
if ( ! $::glob_use_running_server )
{
# Report if there was any fatal warnings/errors in the log files
#
unlink("$::glob_mysql_test_dir/var/log/warnings");
unlink("$::glob_mysql_test_dir/var/log/warnings.tmp");
# Remove some non fatal warnings from the log files
# FIXME what is going on ????? ;-)
# sed -e 's!Warning: Table:.* on delete!!g' -e 's!Warning: Setting lower_case_table_names=2!!g' -e 's!Warning: One can only use the --user.*root!!g' \
# var/log/*.err \
# | sed -e 's!Warning: Table:.* on rename!!g' \
# > var/log/warnings.tmp;
#
# found_error=0;
# # Find errors
# for i in "^Warning:" "^Error:" "^==.* at 0x"
# do
# if ( $GREP "$i" var/log/warnings.tmp >> var/log/warnings )
# {
# found_error=1
# }
# done
# unlink("$::glob_mysql_test_dir/var/log/warnings.tmp");
# if ( $found_error= "1" )
# {
# print "WARNING: Got errors/warnings while running tests. Please examine\n"
# print "$::glob_mysql_test_dir/var/log/warnings for details.\n"
# }
# }
}
print "\n";
if ( $tot_failed != 0 )
{
print "mysql-test-run: *** Failing the test(s):";
foreach my $tinfo (@$tests)
{
if ( $tinfo->{'result'} eq 'MTR_RES_FAILED' )
{
print " $tinfo->{'name'}";
}
}
print "\n";
mtr_error("there where failing test cases");
}
}
##############################################################################
#
# Text formatting
#
##############################################################################
sub mtr_print_line () {
print '-' x 55, "\n";
}
sub mtr_print_thick_line () {
print '=' x 55, "\n";
}
sub mtr_print_header () {
print "\n";
if ( $::opt_timer )
{
print "TEST RESULT TIME (ms)\n";
}
else
{
print "TEST RESULT\n";
}
mtr_print_line();
print "\n";
}
##############################################################################
#
# Misc
#
##############################################################################
sub mtr_report (@) {
print join(" ", @_),"\n";
}
sub mtr_warning (@) {
print STDERR "mysql-test-run: WARNING: ",join(" ", @_),"\n";
}
sub mtr_error (@) {
die "mysql-test-run: *** ERROR: ",join(" ", @_),"\n";
}
sub mtr_debug (@) {
if ( $::opt_script_debug )
{
print STDERR "####: ",join(" ", @_),"\n";
}
}
1;

View File

@ -327,7 +327,7 @@ int spawn(char *path, arg_list_t *al, int join, char *input,
int spawn(char *path, arg_list_t *al, int join, char *input, int spawn(char *path, arg_list_t *al, int join, char *input,
char *output, char *error, HANDLE *pid) char *output, char *error, HANDLE *pid)
{ {
intptr_t result; bool result;
int i; int i;
STARTUPINFO startup_info; STARTUPINFO startup_info;
PROCESS_INFORMATION process_information; PROCESS_INFORMATION process_information;
@ -665,7 +665,11 @@ void del_tree(char *dir)
rmdir(dir); rmdir(dir);
#else #else
struct _finddata_t parent; struct _finddata_t parent;
#if defined(_MSC_VER) && _MSC_VER > 1200
intptr_t handle; intptr_t handle;
#else
long handle;
#endif /* _MSC_VER && _MSC_VER > 1200 */
char temp[FN_REFLEN]; char temp[FN_REFLEN];
char mask[FN_REFLEN]; char mask[FN_REFLEN];
@ -728,7 +732,11 @@ int removef(const char *format, ...)
va_list ap; va_list ap;
char path[FN_REFLEN]; char path[FN_REFLEN];
struct _finddata_t parent; struct _finddata_t parent;
#if defined(_MSC_VER) && _MSC_VER > 1200
intptr_t handle; intptr_t handle;
#else
long handle;
#endif /* _MSC_VER && _MSC_VER > 1200 */
char temp[FN_REFLEN]; char temp[FN_REFLEN];
char *p; char *p;

2182
mysql-test/mysql-test-run.pl Executable file

File diff suppressed because it is too large Load Diff

View File

@ -239,11 +239,12 @@ MYSQL_TEST_SSL_OPTS=""
USE_TIMER="" USE_TIMER=""
USE_EMBEDDED_SERVER="" USE_EMBEDDED_SERVER=""
RESULT_EXT="" RESULT_EXT=""
TEST_MODE="default"
while test $# -gt 0; do while test $# -gt 0; do
case "$1" in case "$1" in
--embedded-server) USE_EMBEDDED_SERVER=1 ; USE_MANAGER=0 ; NO_SLAVE=1 ; \ --embedded-server) USE_EMBEDDED_SERVER=1 USE_MANAGER=0 NO_SLAVE=1 ; \
USE_RUNNING_SERVER="" RESULT_EXT=".es" ;; USE_RUNNING_SERVER="" RESULT_EXT=".es" TEST_MODE="embedded" ;;
--user=*) DBUSER=`$ECHO "$1" | $SED -e "s;--user=;;"` ;; --user=*) DBUSER=`$ECHO "$1" | $SED -e "s;--user=;;"` ;;
--force) FORCE=1 ;; --force) FORCE=1 ;;
--timer) USE_TIMER=1 ;; --timer) USE_TIMER=1 ;;
@ -323,7 +324,7 @@ while test $# -gt 0; do
SLEEP_TIME_AFTER_RESTART=`$ECHO "$1" | $SED -e "s;--sleep=;;"` SLEEP_TIME_AFTER_RESTART=`$ECHO "$1" | $SED -e "s;--sleep=;;"`
;; ;;
--ps-protocol) --ps-protocol)
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;; TEST_MODE="ps-protocol" EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
--user-test=*) --user-test=*)
USER_TEST=`$ECHO "$1" | $SED -e "s;--user-test=;;"` USER_TEST=`$ECHO "$1" | $SED -e "s;--user-test=;;"`
;; ;;
@ -537,7 +538,7 @@ else
MYSQLD="$VALGRIND $BASEDIR/bin/mysqld" MYSQLD="$VALGRIND $BASEDIR/bin/mysqld"
fi fi
CLIENT_BINDIR="$BASEDIR/bin" CLIENT_BINDIR="$BASEDIR/bin"
TESTS_BINDIR="$BASEDIR/tests" TESTS_BINDIR="$BASEDIR/bin"
MYSQL_TEST="$CLIENT_BINDIR/mysqltest" MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
MYSQL_DUMP="$CLIENT_BINDIR/mysqldump" MYSQL_DUMP="$CLIENT_BINDIR/mysqldump"
MYSQL_BINLOG="$CLIENT_BINDIR/mysqlbinlog" MYSQL_BINLOG="$CLIENT_BINDIR/mysqlbinlog"
@ -1566,7 +1567,7 @@ run_testcase ()
show_failed_diff $tname show_failed_diff $tname
$ECHO $ECHO
if [ x$FORCE != x1 ] ; then if [ x$FORCE != x1 ] ; then
$ECHO "Aborting: $tname failed. To continue, re-run with '--force'." $ECHO "Aborting: $tname failed in $TEST_MODE mode. To continue, re-run with '--force'."
$ECHO $ECHO
if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && \ if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && \
[ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ] [ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ]
@ -1745,7 +1746,7 @@ $ECHO
[ "$DO_GPROF" ] && gprof_collect # collect coverage information [ "$DO_GPROF" ] && gprof_collect # collect coverage information
if [ $TOT_FAIL -ne 0 ]; then if [ $TOT_FAIL -ne 0 ]; then
$ECHO "mysql-test-run: *** Failing the test(s):$FAILED_CASES" $ECHO "mysql-test-run in $TEST_MODE mode: *** Failing the test(s):$FAILED_CASES"
$ECHO $ECHO
exit 1 exit 1
else else

View File

@ -37,7 +37,8 @@
#include <sys/mode.h> #include <sys/mode.h>
#endif #endif
#ifdef __WIN__ #ifdef __WIN__
#include <Shlwapi.h> #include <windows.h>
#include <shlwapi.h>
#include <direct.h> #include <direct.h>
#endif #endif
@ -89,15 +90,25 @@ static char master_socket[FN_REFLEN]= "./var/tmp/master.sock";
static char slave_socket[FN_REFLEN]= "./var/tmp/slave.sock"; static char slave_socket[FN_REFLEN]= "./var/tmp/slave.sock";
#endif #endif
#define MAX_COUNT_TESTES 1024
#ifdef __WIN__
# define sting_compare_func _stricmp
#else
# ifdef HAVE_STRCASECMP
# define sting_compare_func strcasecmp
# else
# define sting_compare_func strcmp
# endif
#endif
/* comma delimited list of tests to skip or empty string */ /* comma delimited list of tests to skip or empty string */
#ifndef __WIN__ #ifndef __WIN__
static char skip_test[FN_REFLEN]= " lowercase_table3 , system_mysql_db_fix "; static char skip_test[FN_REFLEN]= " lowercase_table3 , system_mysql_db_fix ";
#else #else
/* /*
The most ignore testes contain the calls of system command The most ignore testes contain the calls of system command
*/
#define MAX_COUNT_TESTES 1024
/*
lowercase_table3 is disabled by Gerg lowercase_table3 is disabled by Gerg
system_mysql_db_fix is disabled by Gerg system_mysql_db_fix is disabled by Gerg
sp contains a command system sp contains a command system
@ -1437,12 +1448,11 @@ void setup(char *file __attribute__((unused)))
/* /*
Compare names of testes for right order Compare names of testes for right order
*/ */
#ifdef __WIN__
int compare( const void *arg1, const void *arg2 ) int compare( const void *arg1, const void *arg2 )
{ {
return _stricmp( * ( char** ) arg1, * ( char** ) arg2 ); return sting_compare_func( * ( char** ) arg1, * ( char** ) arg2 );
} }
#endif
/****************************************************************************** /******************************************************************************
@ -1454,6 +1464,10 @@ int compare( const void *arg1, const void *arg2 )
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int is_ignore_list= 0; int is_ignore_list= 0;
char **names= 0;
char **testes= 0;
int name_index;
int index;
/* setup */ /* setup */
setup(argv[0]); setup(argv[0]);
@ -1517,6 +1531,11 @@ int main(int argc, char **argv)
else else
{ {
/* run all tests */ /* run all tests */
testes= malloc(MAX_COUNT_TESTES*sizeof(void*));
if (!testes)
die("can not allcate memory for sorting");
names= testes;
name_index= 0;
#ifndef __WIN__ #ifndef __WIN__
struct dirent *entry; struct dirent *entry;
DIR *parent; DIR *parent;
@ -1534,74 +1553,79 @@ int main(int argc, char **argv)
/* find the test suffix */ /* find the test suffix */
if ((position= strinstr(test, TEST_SUFFIX)) != 0) if ((position= strinstr(test, TEST_SUFFIX)) != 0)
{ {
/* null terminate at the suffix */ if (name_index < MAX_COUNT_TESTES)
*(test + position - 1)= '\0'; {
/* run test */ /* null terminate at the suffix */
run_test(test); *(test + position - 1)= '\0';
/* insert test */
*names= malloc(FN_REFLEN);
strcpy(*names,test);
names++;
name_index++;
}
else
die("can not sort files, array is overloaded");
} }
} }
closedir(parent); closedir(parent);
} }
#else #else
struct _finddata_t dir;
intptr_t handle;
char test[FN_LEN];
char mask[FN_REFLEN];
char *p;
int position;
char **names= 0;
char **testes= 0;
int name_index;
int index;
/* single test */
single_test= FALSE;
snprintf(mask,FN_REFLEN,"%s/*.test",test_dir);
if ((handle=_findfirst(mask,&dir)) == -1L)
{ {
die("Unable to open tests directory."); struct _finddata_t dir;
} int* handle;
char test[FN_LEN];
char mask[FN_REFLEN];
char *p;
int position;
names= malloc(MAX_COUNT_TESTES*4); /* single test */
testes= names; single_test= FALSE;
name_index= 0;
do snprintf(mask,FN_REFLEN,"%s/*.test",test_dir);
{
if (!(dir.attrib & _A_SUBDIR)) if ((handle=_findfirst(mask,&dir)) == -1L)
{ {
strcpy(test, strlwr(dir.name)); die("Unable to open tests directory.");
/* find the test suffix */
if ((position= strinstr(test, TEST_SUFFIX)) != 0)
{
p= test + position - 1;
/* null terminate at the suffix */
*p= 0;
/* insert test */
*names= malloc(FN_REFLEN);
strcpy(*names,test);
names++;
name_index++;
}
} }
}while (_findnext(handle,&dir) == 0);
_findclose(handle);
do
{
if (!(dir.attrib & _A_SUBDIR))
{
strcpy(test, strlwr(dir.name));
/* find the test suffix */
if ((position= strinstr(test, TEST_SUFFIX)) != 0)
{
if (name_index < MAX_COUNT_TESTES)
{
/* null terminate at the suffix */
*(test + position - 1)= '\0';
/* insert test */
*names= malloc(FN_REFLEN);
strcpy(*names,test);
names++;
name_index++;
}
else
die("can not sort files, array is overloaded");
}
}
}while (_findnext(handle,&dir) == 0);
_findclose(handle);
}
#endif
qsort( (void *)testes, name_index, sizeof( char * ), compare ); qsort( (void *)testes, name_index, sizeof( char * ), compare );
for (index= 0; index <= name_index; index++) for (index= 0; index < name_index; index++)
{ {
run_test(testes[index]); run_test(testes[index]);
free(testes[index]); free(testes[index]);
} }
free(testes); free(testes);
#endif
} }
/* stop server */ /* stop server */

View File

@ -178,3 +178,12 @@ aaa aa
aab aa aab aa
aac aa aac aa
DROP TABLE t1; DROP TABLE t1;
select date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour);
date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour)
2004-12-30 00:00:00
select timediff(cast('2004-12-30 12:00:00' as time), '12:00:00');
timediff(cast('2004-12-30 12:00:00' as time), '12:00:00')
00:00:00
select timediff(cast('1 12:00:00' as time), '12:00:00');
timediff(cast('1 12:00:00' as time), '12:00:00')
24:00:00

View File

@ -22,6 +22,9 @@ insert delayed into t1 values (null,"c");
insert delayed into t1 values (3,"d"),(null,"e"); insert delayed into t1 values (3,"d"),(null,"e");
insert delayed into t1 values (3,"this will give an","error"); insert delayed into t1 values (3,"this will give an","error");
ERROR 21S01: Column count doesn't match value count at row 1 ERROR 21S01: Column count doesn't match value count at row 1
show status like 'not_flushed_delayed_rows';
Variable_name Value
Not_flushed_delayed_rows 0
select * from t1; select * from t1;
a b a b
1 b 1 b

View File

@ -474,12 +474,15 @@ unix_timestamp(@a)
select unix_timestamp('1969-12-01 19:00:01'); select unix_timestamp('1969-12-01 19:00:01');
unix_timestamp('1969-12-01 19:00:01') unix_timestamp('1969-12-01 19:00:01')
0 0
select from_unixtime(0); select from_unixtime(-1);
from_unixtime(0) from_unixtime(-1)
NULL NULL
select from_unixtime(2145916800); select from_unixtime(2145916800);
from_unixtime(2145916800) from_unixtime(2145916800)
NULL NULL
select from_unixtime(0);
from_unixtime(0)
1970-01-01 03:00:00
CREATE TABLE t1 (datetime datetime, timestamp timestamp, date date, time time); CREATE TABLE t1 (datetime datetime, timestamp timestamp, date date, time time);
INSERT INTO t1 values ("2001-01-02 03:04:05", "2002-01-02 03:04:05", "2003-01-02", "06:07:08"); INSERT INTO t1 values ("2001-01-02 03:04:05", "2002-01-02 03:04:05", "2003-01-02", "06:07:08");
SELECT * from t1; SELECT * from t1;

View File

@ -148,7 +148,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by 1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by
explain select a1,a2,b,max(c),min(c) from t2 group by a1,a2,b; explain select a1,a2,b,max(c),min(c) from t2 group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range NULL idx_t2_1 163 NULL 21 Using index for group-by 1 SIMPLE t2 range NULL idx_t2_1 # NULL 21 Using index for group-by
explain select min(a2), a1, max(a2), min(a2), a1 from t1 group by a1; explain select min(a2), a1, max(a2), min(a2), a1 from t1 group by a1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx_t1_1 65 NULL 5 Using index for group-by 1 SIMPLE t1 range NULL idx_t1_1 65 NULL 5 Using index for group-by

View File

@ -476,9 +476,7 @@ aclid bigint, index idx_acl(aclid)
insert into t2 values(1,null); insert into t2 values(1,null);
delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1'; delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1';
drop table t1, t2; drop table t1, t2;
set @ttype_save=@@storage_engine; create table t1 ( c char(8) not null ) engine=innodb;
set @@storage_engine=innodb;
create table t1 ( c char(8) not null );
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F'); insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
alter table t1 add b char(8) not null; alter table t1 add b char(8) not null;
@ -489,8 +487,7 @@ create table t2 like t1;
insert into t2 select * from t1; insert into t2 select * from t1;
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b; delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
drop table t1,t2; drop table t1,t2;
set @@storage_engine=bdb; create table t1 ( c char(8) not null ) engine=bdb;
create table t1 ( c char(8) not null );
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F'); insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
alter table t1 add b char(8) not null; alter table t1 add b char(8) not null;
@ -500,7 +497,6 @@ update t1 set a=c, b=c;
create table t2 like t1; create table t2 like t1;
insert into t2 select * from t1; insert into t2 select * from t1;
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b; delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
set @@storage_engine=@ttype_save;
drop table t1,t2; drop table t1,t2;
create table t1 (a int, b int); create table t1 (a int, b int);
insert into t1 values (1, 2), (2, 3), (3, 4); insert into t1 values (1, 2), (2, 3), (3, 4);

View File

@ -34,13 +34,13 @@ col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
col6 int not null, to_be_deleted int) ENGINE=ndbcluster; col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
show table status; show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ndbcluster 9 Dynamic 0 0 0 0 0 0 1 NULL NULL NULL latin1_swedish_ci NULL t1 ndbcluster 10 Dynamic 0 0 0 0 0 0 1 NULL NULL NULL latin1_swedish_ci NULL
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO; SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
insert into t1 values insert into t1 values
(0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7); (0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
show table status; show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ndbcluster 9 Dynamic 9 0 0 0 0 0 101 NULL NULL NULL latin1_swedish_ci NULL t1 ndbcluster 10 Dynamic 9 0 0 0 0 0 101 NULL NULL NULL latin1_swedish_ci NULL
select * from t1 order by col1; select * from t1 order by col1;
col1 col2 col3 col4 col5 col6 to_be_deleted col1 col2 col3 col4 col5 col6 to_be_deleted
0 4 3 5 PENDING 1 7 0 4 3 5 PENDING 1 7
@ -60,7 +60,7 @@ change column col2 fourth varchar(30) not null after col3,
modify column col6 int not null first; modify column col6 int not null first;
show table status; show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ndbcluster 9 Dynamic 9 0 0 0 0 0 102 NULL NULL NULL latin1_swedish_ci NULL t1 ndbcluster 10 Dynamic 9 0 0 0 0 0 102 NULL NULL NULL latin1_swedish_ci NULL
select * from t1 order by col1; select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8 col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 0 3 4 5 PENDING 0000-00-00 00:00:00 1 0 3 4 5 PENDING 0000-00-00 00:00:00
@ -75,7 +75,7 @@ col6 col1 col3 fourth col4 col4_5 col5 col7 col8
insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00'); insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
show table status; show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ndbcluster 9 Dynamic 10 0 0 0 0 0 103 NULL NULL NULL latin1_swedish_ci NULL t1 ndbcluster 10 Dynamic 10 0 0 0 0 0 103 NULL NULL NULL latin1_swedish_ci NULL
select * from t1 order by col1; select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8 col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 0 3 4 5 PENDING 0000-00-00 00:00:00 1 0 3 4 5 PENDING 0000-00-00 00:00:00

View File

@ -143,7 +143,7 @@ create table t1 (
pk1 bit(9) not null primary key, pk1 bit(9) not null primary key,
b int b int
) engine=ndbcluster; ) engine=ndbcluster;
ERROR HY000: Can't create table './test/t1.frm' (errno: 743) ERROR HY000: Can't create table './test/t1.frm' (errno: 739)
create table t1 ( create table t1 (
pk1 int not null primary key, pk1 int not null primary key,
b bit(9), b bit(9),

View File

@ -47,6 +47,40 @@ a
aAa aAa
drop table t1; drop table t1;
create table t1 ( create table t1 (
a varchar(20) character set latin1 collate latin1_swedish_ci primary key
) engine=ndb;
insert into t1 values ('A'),('b '),('C '),('d '),('E'),('f');
insert into t1 values('b');
ERROR 23000: Duplicate entry 'b' for key 1
insert into t1 values('a ');
ERROR 23000: Duplicate entry 'a ' for key 1
select a,length(a) from t1 order by a;
a length(a)
A 1
b 2
C 3
d 7
E 1
f 1
select a,length(a) from t1 order by a desc;
a length(a)
f 1
E 1
d 7
C 3
b 2
A 1
select * from t1 where a = 'a';
a
A
select * from t1 where a = 'a ';
a
A
select * from t1 where a = 'd';
a
d
drop table t1;
create table t1 (
p int primary key, p int primary key,
a char(3) character set latin1 collate latin1_bin not null, a char(3) character set latin1 collate latin1_bin not null,
unique key(a) unique key(a)
@ -99,6 +133,42 @@ p a
drop table t1; drop table t1;
create table t1 ( create table t1 (
p int primary key, p int primary key,
a varchar(20) character set latin1 collate latin1_swedish_ci not null,
unique key(a)
) engine=ndb;
insert into t1 values (1,'A'),(2,'b '),(3,'C '),(4,'d '),(5,'E'),(6,'f');
insert into t1 values(99,'b');
ERROR 23000: Duplicate entry '99' for key 1
insert into t1 values(99,'a ');
ERROR 23000: Duplicate entry '99' for key 1
select a,length(a) from t1 order by a;
a length(a)
A 1
b 2
C 3
d 7
E 1
f 1
select a,length(a) from t1 order by a desc;
a length(a)
f 1
E 1
d 7
C 3
b 2
A 1
select * from t1 where a = 'a';
p a
1 A
select * from t1 where a = 'a ';
p a
1 A
select * from t1 where a = 'd';
p a
4 d
drop table t1;
create table t1 (
p int primary key,
a char(3) character set latin1 collate latin1_bin not null, a char(3) character set latin1 collate latin1_bin not null,
index(a) index(a)
) engine=ndb; ) engine=ndb;
@ -190,7 +260,77 @@ p a
6 AAA 6 AAA
drop table t1; drop table t1;
create table t1 ( create table t1 (
a varchar(10) primary key p int primary key,
a varchar(20) character set latin1 collate latin1_swedish_ci not null,
index(a, p)
) engine=ndb;
insert into t1 values (1,'A'),(2,'b '),(3,'C '),(4,'d '),(5,'E'),(6,'f');
insert into t1 values (7,'a'),(8,'B '),(9,'c '),(10,'D'),(11,'e'),(12,'F ');
select p,a,length(a) from t1 order by a, p;
p a length(a)
1 A 1
7 a 1
2 b 2
8 B 2
3 C 3
9 c 3
4 d 7
10 D 1
5 E 1
11 e 1
6 f 1
12 F 3
select * from t1 where a = 'a ' order by a desc, p desc;
p a
7 a
1 A
select * from t1 where a >= 'D' order by a, p;
p a
4 d
10 D
5 E
11 e
6 f
12 F
select * from t1 where a < 'D' order by a, p;
p a
1 A
7 a
2 b
8 B
3 C
9 c
select count(*) from t1 x, t1 y, t1 z where x.a = y.a and y.a = z.a;
count(*)
48
drop table t1;
create table t1 (
a char(5) character set ucs2,
b varchar(7) character set utf8,
primary key(a, b)
) engine=ndb;
insert into t1 values
('a','A '),('B ','b'),('c','C '),('D','d'),('e ','E'),('F','f '),
('A','b '),('b ','C'),('C','d '),('d','E'),('E ','f'),
('a','C '),('B ','d'),('c','E '),('D','f');
insert into t1 values('d','f');
ERROR 23000: Duplicate entry '' for key 1
select a,b,length(a),length(b) from t1 order by a,b limit 3;
a b length(a) length(b)
a A 2 2
A b 2 2
a C 2 2
select a,b,length(a),length(b) from t1 order by a desc, b desc limit 3;
a b length(a) length(b)
F f 2 3
E f 2 1
e E 2 1
select a,b,length(a),length(b) from t1 where a='c' and b='c';
a b length(a) length(b)
c C 2 5
drop table t1;
create table t1 (
a char(10) primary key
) engine=ndb; ) engine=ndb;
insert into t1 values ('jonas % '); insert into t1 values ('jonas % ');
replace into t1 values ('jonas % '); replace into t1 values ('jonas % ');

View File

@ -3026,7 +3026,7 @@ c1 c13 c14 c15 c16 c17
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
60 NULL NULL 1991-01-01 01:01:01 NULL NULL 60 NULL NULL 1991-01-01 01:01:01 NULL NULL

View File

@ -3009,7 +3009,7 @@ c1 c13 c14 c15 c16 c17
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
60 NULL NULL 1991-01-01 01:01:01 NULL NULL 60 NULL NULL 1991-01-01 01:01:01 NULL NULL

View File

@ -3010,7 +3010,7 @@ c1 c13 c14 c15 c16 c17
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
60 NULL NULL 1991-01-01 01:01:01 NULL NULL 60 NULL NULL 1991-01-01 01:01:01 NULL NULL

View File

@ -2946,7 +2946,7 @@ c1 c13 c14 c15 c16 c17
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
60 NULL NULL 1991-01-01 01:01:01 NULL NULL 60 NULL NULL 1991-01-01 01:01:01 NULL NULL
@ -5955,7 +5955,7 @@ c1 c13 c14 c15 c16 c17
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
60 NULL NULL 1991-01-01 01:01:01 NULL NULL 60 NULL NULL 1991-01-01 01:01:01 NULL NULL

View File

@ -3009,7 +3009,7 @@ c1 c13 c14 c15 c16 c17
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
60 NULL NULL 1991-01-01 01:01:01 NULL NULL 60 NULL NULL 1991-01-01 01:01:01 NULL NULL

View File

@ -3009,7 +3009,7 @@ c1 c13 c14 c15 c16 c17
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
60 NULL NULL 1991-01-01 01:01:01 NULL NULL 60 NULL NULL 1991-01-01 01:01:01 NULL NULL

View File

@ -1,5 +1,5 @@
drop table if exists t1,t2,t3,t4; drop table if exists t1,t2,t3,t4;
drop table if exists t1_1,t1_2,t9_1,t9_2; drop table if exists t1_1,t1_2,t9_1,t9_2,t1aa,t2aa;
drop view if exists v1; drop view if exists v1;
CREATE TABLE t1 ( CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,

View File

@ -47,6 +47,8 @@ Warnings:
Note 1305 PROCEDURE foo does not exist Note 1305 PROCEDURE foo does not exist
show create procedure foo| show create procedure foo|
ERROR 42000: PROCEDURE foo does not exist ERROR 42000: PROCEDURE foo does not exist
show create function foo|
ERROR 42000: FUNCTION foo does not exist
create procedure foo() create procedure foo()
foo: loop foo: loop
leave bar; leave bar;

View File

@ -143,3 +143,13 @@ t
0000-00-00 00:00:00 0000-00-00 00:00:00
2003-01-01 00:00:00 2003-01-01 00:00:00
drop table t1; drop table t1;
create table t1 (dt datetime);
insert into t1 values ("12-00-00"), ("00-00-00 01:00:00");
insert into t1 values ("00-00-00"), ("00-00-00 00:00:00");
select * from t1;
dt
2012-00-00 00:00:00
2000-00-00 01:00:00
0000-00-00 00:00:00
0000-00-00 00:00:00
drop table t1;

View File

@ -363,107 +363,6 @@ v4 CREATE ALGORITHM=TEMPTABLE VIEW `mysqltest`.`v4` AS select (`mysqltest`.`t2`.
revoke all privileges on mysqltest.* from mysqltest_1@localhost; revoke all privileges on mysqltest.* from mysqltest_1@localhost;
delete from mysql.user where user='mysqltest_1'; delete from mysql.user where user='mysqltest_1';
drop database mysqltest; drop database mysqltest;
set GLOBAL query_cache_size=1355776;
flush status;
create table t1 (a int, b int);
create view v1 (c,d) as select sql_no_cache a,b from t1;
create view v2 (c,d) as select a+rand(),b from t1;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 0
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
select * from v1;
c d
select * from v2;
c d
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 0
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
select * from v1;
c d
select * from v2;
c d
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 0
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
drop view v1,v2;
set query_cache_type=demand;
flush status;
create view v1 (c,d) as select sql_cache a,b from t1;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 0
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
select * from v1;
c d
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
select * from t1;
a b
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
select * from v1;
c d
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 1
select * from t1;
a b
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 1
drop view v1;
set query_cache_type=default;
drop table t1;
set GLOBAL query_cache_size=default;
create table t1 (a int); create table t1 (a int);
insert into t1 values (1), (2), (3), (1), (2), (3); insert into t1 values (1), (2), (3), (1), (2), (3);
create view v1 as select distinct a from t1; create view v1 as select distinct a from t1;
@ -1433,7 +1332,8 @@ insert into v1 values (1) on duplicate key update a=2;
insert into v1 values (1) on duplicate key update a=2; insert into v1 values (1) on duplicate key update a=2;
ERROR HY000: CHECK OPTION failed 'test.v1' ERROR HY000: CHECK OPTION failed 'test.v1'
insert ignore into v1 values (1) on duplicate key update a=2; insert ignore into v1 values (1) on duplicate key update a=2;
ERROR HY000: CHECK OPTION failed 'test.v1' Warnings:
Error 1369 CHECK OPTION failed 'test.v1'
select * from t1; select * from t1;
a a
1 1

View File

@ -0,0 +1,101 @@
set GLOBAL query_cache_size=1355776;
flush status;
create table t1 (a int, b int);
create view v1 (c,d) as select sql_no_cache a,b from t1;
create view v2 (c,d) as select a+rand(),b from t1;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 0
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
select * from v1;
c d
select * from v2;
c d
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 0
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
select * from v1;
c d
select * from v2;
c d
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 0
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
drop view v1,v2;
set query_cache_type=demand;
flush status;
create view v1 (c,d) as select sql_cache a,b from t1;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 0
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
select * from v1;
c d
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
select * from t1;
a b
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
select * from v1;
c d
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 1
select * from t1;
a b
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 1
drop view v1;
set query_cache_type=default;
drop table t1;
set GLOBAL query_cache_size=default;

View File

@ -108,3 +108,13 @@ SELECT a, CAST(a AS CHAR(3)) FROM t1 ORDER BY CAST(a AS CHAR(2)), a;
SELECT a, CAST(a AS UNSIGNED) FROM t1 ORDER BY CAST(a AS CHAR) ; SELECT a, CAST(a AS UNSIGNED) FROM t1 ORDER BY CAST(a AS CHAR) ;
SELECT a, CAST(a AS CHAR(2)) FROM t1 ORDER BY CAST(a AS CHAR(3)), a; SELECT a, CAST(a AS CHAR(2)) FROM t1 ORDER BY CAST(a AS CHAR(3)), a;
DROP TABLE t1; DROP TABLE t1;
#
# Test for bug #6914 "Problems using time()/date() output in expressions".
# When we are casting datetime value to DATE/TIME we should throw away
# time/date parts (correspondingly).
#
select date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour);
select timediff(cast('2004-12-30 12:00:00' as time), '12:00:00');
# Still we should not throw away "days" part of time value
select timediff(cast('1 12:00:00' as time), '12:00:00');

View File

@ -273,8 +273,8 @@ create table t3 like t1;
show create table t3; show create table t3;
select * from t3; select * from t3;
# Disable PS becasue of @@warning_count # Disable PS becasue of @@warning_count
--disable_ps_protocol
create table if not exists t3 like t1; create table if not exists t3 like t1;
--disable_ps_protocol
select @@warning_count; select @@warning_count;
--enable_ps_protocol --enable_ps_protocol
create temporary table t3 like t2; create temporary table t3 like t2;

View File

@ -31,6 +31,8 @@ insert delayed into t1 values (null,"c");
insert delayed into t1 values (3,"d"),(null,"e"); insert delayed into t1 values (3,"d"),(null,"e");
--error 1136 --error 1136
insert delayed into t1 values (3,"this will give an","error"); insert delayed into t1 values (3,"this will give an","error");
--sleep 2 # 2 was not enough for --ps-protocol
--sleep 4
show status like 'not_flushed_delayed_rows';
select * from t1; select * from t1;
drop table t1; drop table t1;

View File

@ -32,9 +32,7 @@ create table t2 (grp int, a bigint unsigned, c char(10));
insert into t2 select grp,max(a)+max(grp),max(c) from t1 group by grp; insert into t2 select grp,max(a)+max(grp),max(c) from t1 group by grp;
# REPLACE ... SELECT doesn't yet work with PS # REPLACE ... SELECT doesn't yet work with PS
--disable_ps_protocol
replace into t2 select grp, a, c from t1 limit 2,1; replace into t2 select grp, a, c from t1 limit 2,1;
--enable_ps_protocol
select * from t2; select * from t2;
drop table t1,t2; drop table t1,t2;

View File

@ -231,10 +231,14 @@ select unix_timestamp('1969-12-01 19:00:01');
# #
# Test for bug #6439 "unix_timestamp() function returns wrong datetime # Test for bug #6439 "unix_timestamp() function returns wrong datetime
# values for too big argument". It should return error instead. # values for too big argument" and bug #7515 "from_unixtime(0) now
# returns NULL instead of the epoch". unix_timestamp() should return error
# for too big or negative argument. It should return Epoch value for zero
# argument since it seems that many user's rely on this fact.
# #
select from_unixtime(0); select from_unixtime(-1);
select from_unixtime(2145916800); select from_unixtime(2145916800);
select from_unixtime(0);
# #
# Test types from + INTERVAL # Test types from + INTERVAL
@ -267,7 +271,10 @@ select date_add(date,INTERVAL "1" QUARTER) from t1;
select timestampadd(MINUTE, 1, date) from t1; select timestampadd(MINUTE, 1, date) from t1;
select timestampadd(WEEK, 1, date) from t1; select timestampadd(WEEK, 1, date) from t1;
select timestampadd(SQL_TSI_SECOND, 1, date) from t1; select timestampadd(SQL_TSI_SECOND, 1, date) from t1;
# Prepared statements doesn't support FRAC_SECOND yet
--disable_ps_protocol
select timestampadd(SQL_TSI_FRAC_SECOND, 1, date) from t1; select timestampadd(SQL_TSI_FRAC_SECOND, 1, date) from t1;
--enable_ps_protocol
select timestampdiff(MONTH, '2001-02-01', '2001-05-01') as a; select timestampdiff(MONTH, '2001-02-01', '2001-05-01') as a;
select timestampdiff(YEAR, '2002-05-01', '2001-01-01') as a; select timestampdiff(YEAR, '2002-05-01', '2001-01-01') as a;

View File

@ -174,6 +174,7 @@ explain select a1, max(a2) from t1 group by a1;
explain select a1, min(a2), max(a2) from t1 group by a1; explain select a1, min(a2), max(a2) from t1 group by a1;
explain select a1, a2, b, min(c), max(c) from t1 group by a1,a2,b; explain select a1, a2, b, min(c), max(c) from t1 group by a1,a2,b;
explain select a1,a2,b,max(c),min(c) from t1 group by a1,a2,b; explain select a1,a2,b,max(c),min(c) from t1 group by a1,a2,b;
--replace_column 7 #
explain select a1,a2,b,max(c),min(c) from t2 group by a1,a2,b; explain select a1,a2,b,max(c),min(c) from t2 group by a1,a2,b;
-- Select fields in different order -- Select fields in different order
explain select min(a2), a1, max(a2), min(a2), a1 from t1 group by a1; explain select min(a2), a1, max(a2), min(a2), a1 from t1 group by a1;

View File

@ -280,7 +280,11 @@ insert into t1 values (1),(2),(3);
select count(*) from t1 group by s1 having s1 is null; select count(*) from t1 group by s1 having s1 is null;
# prepared statements prints warnings too early
--disable_ps_protocol
select s1*0 as s1 from t1 group by s1 having s1 <> 0; select s1*0 as s1 from t1 group by s1 having s1 <> 0;
--enable_ps_protocol
# ANSI requires: 3 rows # ANSI requires: 3 rows
# MySQL returns: 0 rows - because of GROUP BY name resolution # MySQL returns: 0 rows - because of GROUP BY name resolution

View File

@ -136,9 +136,7 @@ insert into t2 values (2,"t2:2"), (3,"t2:3");
insert into t1 select * from t2; insert into t1 select * from t2;
select * from t1; select * from t1;
# REPLACE .. SELECT is not yet supported by PS # REPLACE .. SELECT is not yet supported by PS
--disable_ps_protocol
replace into t1 select * from t2; replace into t1 select * from t2;
--enable_ps_protocol
select * from t1; select * from t1;
drop table t1,t2; drop table t1,t2;

View File

@ -6,9 +6,9 @@
drop table if exists t1,t2,t3; drop table if exists t1,t2,t3;
drop database if exists mysqltest; drop database if exists mysqltest;
drop view if exists v1; drop view if exists v1;
--error 0,1141 --error 0,1141,1147
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost; revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
--error 0,1141 --error 0,1141,1147
revoke all privileges on mysqltest.* from mysqltest_1@localhost; revoke all privileges on mysqltest.* from mysqltest_1@localhost;
delete from mysql.user where user=_binary'mysqltest_1'; delete from mysql.user where user=_binary'mysqltest_1';
--enable_warnings --enable_warnings
@ -452,11 +452,8 @@ drop table t1, t2;
# #
# Test for bug #1980. # Test for bug #1980.
# #
set @ttype_save=@@storage_engine;
--disable_warnings --disable_warnings
set @@storage_engine=innodb; create table t1 ( c char(8) not null ) engine=innodb;
create table t1 ( c char(8) not null );
--enable_warnings --enable_warnings
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
@ -475,8 +472,7 @@ delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
drop table t1,t2; drop table t1,t2;
--disable_warnings --disable_warnings
set @@storage_engine=bdb; create table t1 ( c char(8) not null ) engine=bdb;
create table t1 ( c char(8) not null );
--enable_warnings --enable_warnings
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
@ -492,7 +488,6 @@ insert into t2 select * from t1;
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b; delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
set @@storage_engine=@ttype_save;
drop table t1,t2; drop table t1,t2;
create table t1 (a int, b int); create table t1 (a int, b int);

View File

@ -53,6 +53,25 @@ select * from t1 where a = 'AaA';
select * from t1 where a = 'AAA'; select * from t1 where a = 'AAA';
drop table t1; drop table t1;
# pk - varchar
create table t1 (
a varchar(20) character set latin1 collate latin1_swedish_ci primary key
) engine=ndb;
#
insert into t1 values ('A'),('b '),('C '),('d '),('E'),('f');
-- error 1062
insert into t1 values('b');
-- error 1062
insert into t1 values('a ');
#
select a,length(a) from t1 order by a;
select a,length(a) from t1 order by a desc;
select * from t1 where a = 'a';
select * from t1 where a = 'a ';
select * from t1 where a = 'd';
drop table t1;
# unique hash index - binary # unique hash index - binary
create table t1 ( create table t1 (
@ -102,6 +121,27 @@ select * from t1 where a = 'AaA';
select * from t1 where a = 'AAA'; select * from t1 where a = 'AAA';
drop table t1; drop table t1;
# unique hash index - varchar
create table t1 (
p int primary key,
a varchar(20) character set latin1 collate latin1_swedish_ci not null,
unique key(a)
) engine=ndb;
#
insert into t1 values (1,'A'),(2,'b '),(3,'C '),(4,'d '),(5,'E'),(6,'f');
-- error 1062
insert into t1 values(99,'b');
-- error 1062
insert into t1 values(99,'a ');
#
select a,length(a) from t1 order by a;
select a,length(a) from t1 order by a desc;
select * from t1 where a = 'a';
select * from t1 where a = 'a ';
select * from t1 where a = 'd';
drop table t1;
# ordered index - binary # ordered index - binary
create table t1 ( create table t1 (
@ -158,9 +198,47 @@ select * from t1 where a = 'AaA' order by p;
select * from t1 where a = 'AAA' order by p; select * from t1 where a = 'AAA' order by p;
drop table t1; drop table t1;
# ordered index - varchar
create table t1 (
p int primary key,
a varchar(20) character set latin1 collate latin1_swedish_ci not null,
index(a, p)
) engine=ndb;
#
insert into t1 values (1,'A'),(2,'b '),(3,'C '),(4,'d '),(5,'E'),(6,'f');
insert into t1 values (7,'a'),(8,'B '),(9,'c '),(10,'D'),(11,'e'),(12,'F ');
select p,a,length(a) from t1 order by a, p;
select * from t1 where a = 'a ' order by a desc, p desc;
select * from t1 where a >= 'D' order by a, p;
select * from t1 where a < 'D' order by a, p;
#
select count(*) from t1 x, t1 y, t1 z where x.a = y.a and y.a = z.a;
drop table t1;
# minimal multi-byte test
create table t1 (
a char(5) character set ucs2,
b varchar(7) character set utf8,
primary key(a, b)
) engine=ndb;
#
insert into t1 values
('a','A '),('B ','b'),('c','C '),('D','d'),('e ','E'),('F','f '),
('A','b '),('b ','C'),('C','d '),('d','E'),('E ','f'),
('a','C '),('B ','d'),('c','E '),('D','f');
-- error 1062
insert into t1 values('d','f');
#
select a,b,length(a),length(b) from t1 order by a,b limit 3;
select a,b,length(a),length(b) from t1 order by a desc, b desc limit 3;
select a,b,length(a),length(b) from t1 where a='c' and b='c';
drop table t1;
# bug # bug
create table t1 ( create table t1 (
a varchar(10) primary key a char(10) primary key
) engine=ndb; ) engine=ndb;
insert into t1 values ('jonas % '); insert into t1 values ('jonas % ');
replace into t1 values ('jonas % '); replace into t1 values ('jonas % ');

View File

@ -1789,7 +1789,10 @@ CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned defa
INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL); INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL);
CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM; CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35); INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35);
# Disable PS becasue we get more warnings from PS than from normal execution
--disable_ps_protocol
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid; SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
--enable_ps_protocol
# Testing the same select with NULL's instead of invalid datetime values # Testing the same select with NULL's instead of invalid datetime values
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid; SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
DROP TABLE t1,t2; DROP TABLE t1,t2;

View File

@ -81,6 +81,8 @@ call foo()|
drop procedure if exists foo| drop procedure if exists foo|
--error 1305 --error 1305
show create procedure foo| show create procedure foo|
--error 1305
show create function foo|
# LEAVE/ITERATE/GOTO with no match # LEAVE/ITERATE/GOTO with no match
--error 1308 --error 1308

View File

@ -944,7 +944,7 @@ select fun(2.3, 3, 5)|
insert into t2 values (append("xxx", "yyy"), mul(4,3), e())| insert into t2 values (append("xxx", "yyy"), mul(4,3), e())|
insert into t2 values (append("a", "b"), mul(2,mul(3,4)), fun(1.7, 4, 6))| insert into t2 values (append("a", "b"), mul(2,mul(3,4)), fun(1.7, 4, 6))|
# These don't work yet. # Disable PS because double's give a bit different values
--disable_ps_protocol --disable_ps_protocol
select * from t2 where s = append("a", "b")| select * from t2 where s = append("a", "b")|
select * from t2 where i = mul(4,3) or i = mul(mul(3,4),2)| select * from t2 where i = mul(4,3) or i = mul(mul(3,4),2)|

View File

@ -1,6 +1,14 @@
# #
# This is the test for mysql_fix_privilege_tables # This is the test for mysql_fix_privilege_tables
# #
# Note: If this test fails, don't be confused about the errors reported
# by mysql-test-run; This shows warnings from generated by
# mysql_fix_system_tables which should be ignored.
# Instead, concentrate on the errors in r/system_mysql_db.reject
--disable_warnings
drop table if exists t1,t1aa,t2aa;
--enable_warnings
-- disable_result_log -- disable_result_log
-- disable_query_log -- disable_query_log

View File

@ -53,6 +53,7 @@ select @a;
drop trigger t1.trg; drop trigger t1.trg;
drop table t1; drop table t1;
# PS doesn't work with multi-row statements
--disable_ps_protocol --disable_ps_protocol
# Before update trigger # Before update trigger
# (In future we will achieve this via proper error handling in triggers) # (In future we will achieve this via proper error handling in triggers)

View File

@ -17,10 +17,8 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7;
CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000)); CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000));
show columns from t1; show columns from t1;
# PS doesn't give errors on prepare yet # PS doesn't give errors on prepare yet
--disable_ps_protocol
CREATE TABLE t2 (a char(255), b varbinary(70000), c varchar(70000000)); CREATE TABLE t2 (a char(255), b varbinary(70000), c varchar(70000000));
CREATE TABLE t4 (c varchar(65530) character set utf8 not null); CREATE TABLE t4 (c varchar(65530) character set utf8 not null);
--enable_ps_protocol
show columns from t2; show columns from t2;
create table t3 (a long, b long byte); create table t3 (a long, b long byte);
show create TABLE t3; show create TABLE t3;

View File

@ -89,3 +89,15 @@ delete from t1;
insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer"); insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
select * from t1; select * from t1;
drop table t1; drop table t1;
#
# Test for bug #7297 "Two digit year should be interpreted correctly even
# with zero month and day"
#
create table t1 (dt datetime);
# These dates should be treated as dates in 21st century
insert into t1 values ("12-00-00"), ("00-00-00 01:00:00");
# Zero dates are still special :/
insert into t1 values ("00-00-00"), ("00-00-00 00:00:00");
select * from t1;
drop table t1;

View File

@ -5,9 +5,6 @@
--disable_warnings --disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6; drop table if exists t1,t2,t3,t4,t5,t6;
--enable_warnings --enable_warnings
# PS doesn't work correctly with found_rows: to be fixed
--disable_ps_protocol
CREATE TABLE t1 (a int not null, b char (10) not null); CREATE TABLE t1 (a int not null, b char (10) not null);
insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c'); insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
@ -30,9 +27,12 @@ select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 g
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b; (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b;
explain extended (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc; explain extended (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2; (select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
# PS doesn't work correctly with found_rows: to be fixed
--disable_ps_protocol
select found_rows(); select found_rows();
select sql_calc_found_rows a,b from t1 union all select a,b from t2 limit 2; select sql_calc_found_rows a,b from t1 union all select a,b from t2 limit 2;
select found_rows(); select found_rows();
--enable_ps_protocol
# #
# Test some error conditions with UNION # Test some error conditions with UNION
@ -210,15 +210,27 @@ insert into t2 values (3),(4),(5);
# Test global limits # Test global limits
(SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2) LIMIT 1; (SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2) LIMIT 1;
# PS doesn't work correctly with found_rows: to be fixed
--disable_ps_protocol
select found_rows(); select found_rows();
--enable_ps_protocol
(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2) LIMIT 2; (SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2) LIMIT 2;
# PS doesn't work correctly with found_rows: to be fixed
--disable_ps_protocol
select found_rows(); select found_rows();
--enable_ps_protocol
# Test cases where found_rows() should return number of returned rows # Test cases where found_rows() should return number of returned rows
(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2); (SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2);
# PS doesn't work correctly with found_rows: to be fixed
--disable_ps_protocol
select found_rows(); select found_rows();
--enable_ps_protocol
(SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2 LIMIT 1); (SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2 LIMIT 1);
# PS doesn't work correctly with found_rows: to be fixed
--disable_ps_protocol
select found_rows(); select found_rows();
--enable_ps_protocol
# This used to work in 4.0 but not anymore in 4.1 # This used to work in 4.0 but not anymore in 4.1
--error 1064 --error 1064
(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 1; (SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 1;
@ -226,9 +238,15 @@ select found_rows();
# In these case found_rows() should work # In these case found_rows() should work
SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION all SELECT * FROM t2 LIMIT 2; SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION all SELECT * FROM t2 LIMIT 2;
# PS doesn't work correctly with found_rows: to be fixed
--disable_ps_protocol
select found_rows(); select found_rows();
--disable_ps_protocol
SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION all SELECT * FROM t2 LIMIT 2; SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION all SELECT * FROM t2 LIMIT 2;
# PS doesn't work correctly with found_rows: to be fixed
--disable_ps_protocol
select found_rows(); select found_rows();
--disable_ps_protocol
# The following examples will not be exact # The following examples will not be exact
SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2; SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2;

View File

@ -14,6 +14,9 @@ delete from mysql.tables_priv where user like 'mysqltest\_%';
delete from mysql.columns_priv where user like 'mysqltest\_%'; delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges; flush privileges;
# Limits doesn't work with prepared statements (yet)
--disable_ps_protocol
# Test of MAX_QUERIES_PER_HOUR limit # Test of MAX_QUERIES_PER_HOUR limit
grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 2; grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 2;
connect (mqph, localhost, mysqltest_1,,); connect (mqph, localhost, mysqltest_1,,);
@ -149,6 +152,7 @@ disconnect muca2;
disconnect muca3; disconnect muca3;
set global max_user_connections= 0; set global max_user_connections= 0;
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
--enable_ps_protocol
# Final cleanup # Final cleanup
drop table t1; drop table t1;

View File

@ -328,63 +328,6 @@ revoke all privileges on mysqltest.* from mysqltest_1@localhost;
delete from mysql.user where user='mysqltest_1'; delete from mysql.user where user='mysqltest_1';
drop database mysqltest; drop database mysqltest;
#
# QUERY CACHE options for VIEWs
#
set GLOBAL query_cache_size=1355776;
flush status;
create table t1 (a int, b int);
# queries with following views should not be in query cache
create view v1 (c,d) as select sql_no_cache a,b from t1;
create view v2 (c,d) as select a+rand(),b from t1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
select * from v1;
select * from v2;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
select * from v1;
select * from v2;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
drop view v1,v2;
# SQL_CACHE option
set query_cache_type=demand;
flush status;
# query with view will be cached, but direct acess to table will not
create view v1 (c,d) as select sql_cache a,b from t1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
select * from v1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
select * from t1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
select * from v1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
select * from t1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
drop view v1;
set query_cache_type=default;
drop table t1;
set GLOBAL query_cache_size=default;
# #
# DISTINCT option for VIEW # DISTINCT option for VIEW
# #
@ -1394,7 +1337,6 @@ create view v1 as select * from t1 where a < 2 with check option;
insert into v1 values (1) on duplicate key update a=2; insert into v1 values (1) on duplicate key update a=2;
-- error 1369 -- error 1369
insert into v1 values (1) on duplicate key update a=2; insert into v1 values (1) on duplicate key update a=2;
-- error 1369
insert ignore into v1 values (1) on duplicate key update a=2; insert ignore into v1 values (1) on duplicate key update a=2;
select * from t1; select * from t1;
drop view v1; drop view v1;

View File

@ -0,0 +1,58 @@
-- source include/have_query_cache.inc
#
# QUERY CACHE options for VIEWs
#
set GLOBAL query_cache_size=1355776;
flush status;
create table t1 (a int, b int);
# queries with following views should not be in query cache
create view v1 (c,d) as select sql_no_cache a,b from t1;
create view v2 (c,d) as select a+rand(),b from t1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
select * from v1;
select * from v2;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
select * from v1;
select * from v2;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
drop view v1,v2;
# SQL_CACHE option
set query_cache_type=demand;
flush status;
# query with view will be cached, but direct acess to table will not
create view v1 (c,d) as select sql_cache a,b from t1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
select * from v1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
select * from t1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
select * from v1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
select * from t1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
drop view v1;
set query_cache_type=default;
drop table t1;
set GLOBAL query_cache_size=default;

View File

@ -26,9 +26,8 @@ show warnings limit 1;
drop database if exists not_exists_db; drop database if exists not_exists_db;
show count(*) warnings; show count(*) warnings;
create table t1(id int); create table t1(id int);
# PS doesn't give warnings on prepare
--disable_ps_protocol
create table if not exists t1(id int); create table if not exists t1(id int);
--disable_ps_protocol
select @@warning_count; select @@warning_count;
--enable_ps_protocol --enable_ps_protocol
drop table t1; drop table t1;
@ -96,12 +95,9 @@ drop table t1;
# Test for deprecated TYPE= syntax # Test for deprecated TYPE= syntax
# #
# PS doesn't give warnings on prepare
--disable_ps_protocol
create table t1 (id int) type=heap; create table t1 (id int) type=heap;
alter table t1 type=myisam; alter table t1 type=myisam;
drop table t1; drop table t1;
--enable_ps_protocol
# #
# Test for deprecated table_type variable # Test for deprecated table_type variable

View File

@ -66,6 +66,7 @@ DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \ -DDATADIR="\"$(MYSQLDATAdir)\"" \
-DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \ -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \ -DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DDEFAULT_HOME_ENV=MYSQL_HOME \
@DEFS@ @DEFS@
libmysys_a_DEPENDENCIES= @THREAD_LOBJECTS@ libmysys_a_DEPENDENCIES= @THREAD_LOBJECTS@

View File

@ -45,23 +45,8 @@ char *defaults_extra_file=0;
/* Which directories are searched for options (and in which order) */ /* Which directories are searched for options (and in which order) */
const char *default_directories[]= { #define MAX_DEFAULT_DIRS 4
#ifdef __WIN__ const char *default_directories[MAX_DEFAULT_DIRS + 1];
"C:/",
#elif defined(__NETWARE__)
"sys:/etc/",
#else
"/etc/",
#endif
#ifdef DATADIR
DATADIR,
#endif
"", /* Place for defaults_extra_dir */
#if !defined(__WIN__) && !defined(__NETWARE__)
"~/",
#endif
NullS,
};
#ifdef __WIN__ #ifdef __WIN__
static const char *f_extensions[]= { ".ini", ".cnf", 0 }; static const char *f_extensions[]= { ".ini", ".cnf", 0 };
@ -89,6 +74,7 @@ static int search_default_file_with_ext(Process_option_func func,
void *func_ctx, void *func_ctx,
const char *dir, const char *ext, const char *dir, const char *ext,
const char *config_file); const char *config_file);
static void init_default_directories();
static char *remove_end_comment(char *ptr); static char *remove_end_comment(char *ptr);
@ -319,6 +305,7 @@ int load_defaults(const char *conf_file, const char **groups,
struct handle_option_ctx ctx; struct handle_option_ctx ctx;
DBUG_ENTER("load_defaults"); DBUG_ENTER("load_defaults");
init_default_directories();
init_alloc_root(&alloc,512,0); init_alloc_root(&alloc,512,0);
if (*argc >= 2 && !strcmp(argv[0][1],"--no-defaults")) if (*argc >= 2 && !strcmp(argv[0][1],"--no-defaults"))
{ {
@ -652,6 +639,7 @@ void print_defaults(const char *conf_file, const char **groups)
char name[FN_REFLEN], **ext; char name[FN_REFLEN], **ext;
const char **dirs; const char **dirs;
init_default_directories();
puts("\nDefault options are read from the following files in the given order:"); puts("\nDefault options are read from the following files in the given order:");
if (dirname_length(conf_file)) if (dirname_length(conf_file))
@ -714,3 +702,23 @@ void print_defaults(const char *conf_file, const char **groups)
} }
#include <help_end.h> #include <help_end.h>
static void init_default_directories()
{
const char *env, **ptr= default_directories;
#ifdef __WIN__
*ptr++= "C:/";
#elif defined(__NETWARE__)
*ptr++= "sys:/etc/";
#else
*ptr++= "/etc/";
#endif
if ((env= getenv(STRINGIFY_ARG(DEFAULT_HOME_ENV))))
*ptr++= env;
*ptr++= ""; /* Place for defaults_extra_file */
#if !defined(__WIN__) && !defined(__NETWARE__)
*ptr++= "~/";;
#endif
*ptr= 0; /* end marker */
}

View File

@ -235,7 +235,7 @@ static my_bool safe_hash_set(SAFE_HASH *hash, const byte *key, uint length,
if (my_hash_insert(&hash->hash, (byte*) entry)) if (my_hash_insert(&hash->hash, (byte*) entry))
{ {
/* This can only happen if hash got out of memory */ /* This can only happen if hash got out of memory */
my_delete((char*) entry, MYF(0)); my_free((char*) entry, MYF(0));
error= 1; error= 1;
goto end; goto end;
} }

View File

@ -23,6 +23,8 @@ void my_sleep(ulong m_seconds)
{ {
#ifdef __NETWARE__ #ifdef __NETWARE__
delay(m_seconds/1000+1); delay(m_seconds/1000+1);
#elif defined(__WIN__)
Sleep(m_seconds/1000+1); /* Sleep() has millisecond arg */
#elif defined(OS2) #elif defined(OS2)
DosSleep(m_seconds/1000+1); DosSleep(m_seconds/1000+1);
#elif defined(HAVE_SELECT) #elif defined(HAVE_SELECT)

View File

@ -381,7 +381,7 @@ int populate(Ndb * myNdb, int data, async_callback_t * cbData)
} }
/*Prepare transaction (the transaction is NOT yet sent to NDB)*/ /*Prepare transaction (the transaction is NOT yet sent to NDB)*/
transaction[current].conn->executeAsynchPrepare(Commit, transaction[current].conn->executeAsynchPrepare(NdbTransaction::Commit,
&callback, &callback,
cb); cb);
/** /**

View File

@ -99,7 +99,8 @@ int main()
myNdbOperation->setValue("ATTR2", 20 + i); myNdbOperation->setValue("ATTR2", 20 + i);
// Prepare transaction (the transaction is NOT yet sent to NDB) // Prepare transaction (the transaction is NOT yet sent to NDB)
myNdbTransaction[i]->executeAsynchPrepare(Commit, &callback, NULL); myNdbTransaction[i]->executeAsynchPrepare(NdbTransaction::Commit,
&callback, NULL);
} }
// Send all transactions to NDB // Send all transactions to NDB

View File

@ -36,7 +36,7 @@
* *
* NdbDictionary::Event * NdbDictionary::Event
* setTable() * setTable()
* addtableEvent() * addTableEvent()
* addEventColumn() * addEventColumn()
* *
* NdbEventOperation * NdbEventOperation
@ -63,12 +63,12 @@
* another process (e.g. flexBench -l 0 -stdtables). * another process (e.g. flexBench -l 0 -stdtables).
* We want to monitor what happens with columns COL0, COL2, COL11 * We want to monitor what happens with columns COL0, COL2, COL11
* *
* or together with the mysqlcluster client; * or together with the mysql client;
* *
* shell> mysqlcluster -u root * shell> mysql -u root
* mysql> create database TEST_DB; * mysql> create database TEST_DB;
* mysql> use TEST_DB; * mysql> use TEST_DB;
* mysql> create table TAB0 (COL0 int primary key, COL1 int, COL11 int); * mysql> create table TAB0 (COL0 int primary key, COL1 int, COL11 int) engine=ndb;
* *
* In another window start ndbapi_example5, wait until properly started * In another window start ndbapi_example5, wait until properly started
* *
@ -140,6 +140,7 @@ int main()
eventTableName, eventTableName,
eventColumnName, eventColumnName,
noEventColumnName); noEventColumnName);
int j= 0; int j= 0;
while (j < 5) { while (j < 5) {
@ -160,10 +161,9 @@ int main()
// set up the callbacks // set up the callbacks
printf("execute\n"); printf("execute\n");
if (op->execute()) { // This starts changes to "start flowing" // This starts changes to "start flowing"
printf("operation execution failed\n"); if (op->execute())
exit(-1); APIERROR(op->getNdbError());
}
int i= 0; int i= 0;
while(i < 40) { while(i < 40) {
@ -199,7 +199,7 @@ int main()
printf("NULL"); printf("NULL");
} }
if (recAttrPre[i]->isNULL() >= 0) { // we have a value if (recAttrPre[i]->isNULL() >= 0) { // we have a value
printf(" post[%u]=", i); printf(" pre[%u]=", i);
if (recAttrPre[i]->isNULL() == 0) // we have a non-null value if (recAttrPre[i]->isNULL() == 0) // we have a non-null value
printf("%u", recAttrPre[i]->u_32_value()); printf("%u", recAttrPre[i]->u_32_value());
else // we have a null value else // we have a null value
@ -212,7 +212,7 @@ int main()
;//printf("timed out\n"); ;//printf("timed out\n");
} }
// don't want to listen to events anymore // don't want to listen to events anymore
myNdb->dropEventOperation(op); if (myNdb->dropEventOperation(op)) APIERROR(myNdb->getNdbError());
j++; j++;
} }
@ -220,7 +220,8 @@ int main()
{ {
NdbDictionary::Dictionary *myDict = myNdb->getDictionary(); NdbDictionary::Dictionary *myDict = myNdb->getDictionary();
if (!myDict) APIERROR(myNdb->getNdbError()); if (!myDict) APIERROR(myNdb->getNdbError());
myDict->dropEvent(eventName); // remove event from database // remove event from database
if (myDict->dropEvent(eventName)) APIERROR(myDict->getNdbError());
} }
delete myNdb; delete myNdb;
@ -232,37 +233,36 @@ int main()
int myCreateEvent(Ndb* myNdb, int myCreateEvent(Ndb* myNdb,
const char *eventName, const char *eventName,
const char *eventTableName, const char *eventTableName,
const char **eventColumnName, const char **eventColumnNames,
const int noEventColumnName) const int noEventColumnNames)
{ {
NdbDictionary::Dictionary *myDict= myNdb->getDictionary(); NdbDictionary::Dictionary *myDict= myNdb->getDictionary();
if (!myDict) APIERROR(myNdb->getNdbError()); if (!myDict) APIERROR(myNdb->getNdbError());
NdbDictionary::Event myEvent(eventName); const NdbDictionary::Table *table= myDict->getTable(eventTableName);
myEvent.setTable(eventTableName); if (!table) APIERROR(myDict->getNdbError());
NdbDictionary::Event myEvent(eventName, *table);
myEvent.addTableEvent(NdbDictionary::Event::TE_ALL); myEvent.addTableEvent(NdbDictionary::Event::TE_ALL);
// myEvent.addTableEvent(NdbDictionary::Event::TE_INSERT); // myEvent.addTableEvent(NdbDictionary::Event::TE_INSERT);
// myEvent.addTableEvent(NdbDictionary::Event::TE_UPDATE); // myEvent.addTableEvent(NdbDictionary::Event::TE_UPDATE);
// myEvent.addTableEvent(NdbDictionary::Event::TE_DELETE); // myEvent.addTableEvent(NdbDictionary::Event::TE_DELETE);
for (int i = 0; i < noEventColumnName; i++) myEvent.addEventColumns(noEventColumnNames, eventColumnNames);
myEvent.addEventColumn(eventColumnName[i]);
int res = myDict->createEvent(myEvent); // Add event to database // Add event to database
if (myDict->createEvent(myEvent) == 0)
if (res == 0)
myEvent.print(); myEvent.print();
else { else if (myDict->getNdbError().classification ==
printf("Event creation failed\n"); NdbError::SchemaObjectExists) {
printf("trying drop Event, maybe event exists\n"); printf("Event creation failed, event exists\n");
res = myDict->dropEvent(eventName); printf("dropping Event...\n");
if (res) if (myDict->dropEvent(eventName)) APIERROR(myDict->getNdbError());
exit(-1);
// try again // try again
res = myDict->createEvent(myEvent); // Add event to database // Add event to database
if (res) if ( myDict->createEvent(myEvent)) APIERROR(myDict->getNdbError());
exit(-1); } else
} APIERROR(myDict->getNdbError());
return res; return 0;
} }

View File

@ -104,7 +104,7 @@ int insert(int transactionId, NdbTransaction* myTransaction) {
exit(-1); exit(-1);
} }
return myTransaction->execute(NoCommit); return myTransaction->execute(NdbTransaction::NoCommit);
} }
@ -131,7 +131,7 @@ int executeInsertTransaction(int transactionId, Ndb* myNdb) {
result = -1; // Failure result = -1; // Failure
} else if (insert(transactionId, myTransaction) || } else if (insert(transactionId, myTransaction) ||
insert(10000+transactionId, myTransaction) || insert(10000+transactionId, myTransaction) ||
myTransaction->execute(Commit)) { myTransaction->execute(NdbTransaction::Commit)) {
TRANSERROR(myTransaction); TRANSERROR(myTransaction);
ndberror = myTransaction->getNdbError(); ndberror = myTransaction->getNdbError();
result = -1; // Failure result = -1; // Failure

View File

@ -187,7 +187,7 @@ int populate(Ndb * myNdb)
myNdbOperation->setValue("COLOR", cars[i].color); myNdbOperation->setValue("COLOR", cars[i].color);
} }
int check = myTrans->execute(Commit); int check = myTrans->execute(NdbTransaction::Commit);
myTrans->close(); myTrans->close();
@ -280,7 +280,7 @@ int scan_delete(Ndb* myNdb,
/** /**
* Start scan (NoCommit since we are only reading at this stage); * Start scan (NoCommit since we are only reading at this stage);
*/ */
if(myTrans->execute(NoCommit) != 0){ if(myTrans->execute(NdbTransaction::NoCommit) != 0){
err = myTrans->getNdbError(); err = myTrans->getNdbError();
if(err.status == NdbError::TemporaryError){ if(err.status == NdbError::TemporaryError){
std::cout << myTrans->getNdbError().message << std::endl; std::cout << myTrans->getNdbError().message << std::endl;
@ -322,7 +322,7 @@ int scan_delete(Ndb* myNdb,
*/ */
if(check != -1) if(check != -1)
{ {
check = myTrans->execute(Commit); check = myTrans->execute(NdbTransaction::Commit);
} }
if(check == -1) if(check == -1)
@ -453,7 +453,7 @@ int scan_update(Ndb* myNdb,
/** /**
* Start scan (NoCommit since we are only reading at this stage); * Start scan (NoCommit since we are only reading at this stage);
*/ */
if(myTrans->execute(NoCommit) != 0) if(myTrans->execute(NdbTransaction::NoCommit) != 0)
{ {
err = myTrans->getNdbError(); err = myTrans->getNdbError();
if(err.status == NdbError::TemporaryError){ if(err.status == NdbError::TemporaryError){
@ -501,7 +501,7 @@ int scan_update(Ndb* myNdb,
*/ */
if(check != -1) if(check != -1)
{ {
check = myTrans->execute(NoCommit); check = myTrans->execute(NdbTransaction::NoCommit);
} }
/** /**
@ -525,7 +525,7 @@ int scan_update(Ndb* myNdb,
/** /**
* Commit all prepared operations * Commit all prepared operations
*/ */
if(myTrans->execute(Commit) == -1) if(myTrans->execute(NdbTransaction::Commit) == -1)
{ {
if(err.status == NdbError::TemporaryError){ if(err.status == NdbError::TemporaryError){
std::cout << myTrans->getNdbError().message << std::endl; std::cout << myTrans->getNdbError().message << std::endl;
@ -640,7 +640,7 @@ int scan_print(Ndb * myNdb)
/** /**
* Start scan (NoCommit since we are only reading at this stage); * Start scan (NoCommit since we are only reading at this stage);
*/ */
if(myTrans->execute(NoCommit) != 0){ if(myTrans->execute(NdbTransaction::NoCommit) != 0){
err = myTrans->getNdbError(); err = myTrans->getNdbError();
if(err.status == NdbError::TemporaryError){ if(err.status == NdbError::TemporaryError){
std::cout << myTrans->getNdbError().message << std::endl; std::cout << myTrans->getNdbError().message << std::endl;

View File

@ -72,7 +72,7 @@ int main()
} }
// Optionally connect and wait for the storage nodes (ndbd's) // Optionally connect and wait for the storage nodes (ndbd's)
if (cluster_connection.wait_until_ready(30,30)) if (cluster_connection.wait_until_ready(30,0) < 0)
{ {
std::cout << "Cluster was not ready within 30 secs.\n"; std::cout << "Cluster was not ready within 30 secs.\n";
exit(-1); exit(-1);
@ -92,7 +92,6 @@ int main()
run_application(mysql, cluster_connection); run_application(mysql, cluster_connection);
} }
// ndb_end should not be called until all "Ndb" objects are deleted
ndb_end(0); ndb_end(0);
std::cout << "\nTo drop created table use:\n" std::cout << "\nTo drop created table use:\n"
@ -170,7 +169,7 @@ static void do_insert(Ndb &myNdb)
myOperation->equal("ATTR1", i+5); myOperation->equal("ATTR1", i+5);
myOperation->setValue("ATTR2", i+5); myOperation->setValue("ATTR2", i+5);
if (myTransaction->execute( Commit ) == -1) if (myTransaction->execute( NdbTransaction::Commit ) == -1)
APIERROR(myTransaction->getNdbError()); APIERROR(myTransaction->getNdbError());
myNdb.closeTransaction(myTransaction); myNdb.closeTransaction(myTransaction);
@ -193,7 +192,7 @@ static void do_update(Ndb &myNdb)
myOperation->equal( "ATTR1", i ); myOperation->equal( "ATTR1", i );
myOperation->setValue( "ATTR2", i+10); myOperation->setValue( "ATTR2", i+10);
if( myTransaction->execute( Commit ) == -1 ) if( myTransaction->execute( NdbTransaction::Commit ) == -1 )
APIERROR(myTransaction->getNdbError()); APIERROR(myTransaction->getNdbError());
myNdb.closeTransaction(myTransaction); myNdb.closeTransaction(myTransaction);
@ -214,7 +213,7 @@ static void do_delete(Ndb &myNdb)
myOperation->deleteTuple(); myOperation->deleteTuple();
myOperation->equal( "ATTR1", 3 ); myOperation->equal( "ATTR1", 3 );
if (myTransaction->execute(Commit) == -1) if (myTransaction->execute(NdbTransaction::Commit) == -1)
APIERROR(myTransaction->getNdbError()); APIERROR(myTransaction->getNdbError());
myNdb.closeTransaction(myTransaction); myNdb.closeTransaction(myTransaction);
@ -240,7 +239,7 @@ static void do_read(Ndb &myNdb)
NdbRecAttr *myRecAttr= myOperation->getValue("ATTR2", NULL); NdbRecAttr *myRecAttr= myOperation->getValue("ATTR2", NULL);
if (myRecAttr == NULL) APIERROR(myTransaction->getNdbError()); if (myRecAttr == NULL) APIERROR(myTransaction->getNdbError());
if(myTransaction->execute( Commit ) == -1) if(myTransaction->execute( NdbTransaction::Commit ) == -1)
if (i == 3) { if (i == 3) {
std::cout << "Detected that deleted tuple doesn't exist!" << std::endl; std::cout << "Detected that deleted tuple doesn't exist!" << std::endl;
} else { } else {

View File

@ -127,7 +127,7 @@ int main()
myOperation->equal("ATTR1", i+5); myOperation->equal("ATTR1", i+5);
myOperation->setValue("ATTR2", i+5); myOperation->setValue("ATTR2", i+5);
if (myTransaction->execute( Commit ) == -1) if (myTransaction->execute( NdbTransaction::Commit ) == -1)
APIERROR(myTransaction->getNdbError()); APIERROR(myTransaction->getNdbError());
myNdb->closeTransaction(myTransaction); myNdb->closeTransaction(myTransaction);
@ -152,7 +152,7 @@ int main()
NdbRecAttr *myRecAttr= myIndexOperation->getValue("ATTR1", NULL); NdbRecAttr *myRecAttr= myIndexOperation->getValue("ATTR1", NULL);
if (myRecAttr == NULL) APIERROR(myTransaction->getNdbError()); if (myRecAttr == NULL) APIERROR(myTransaction->getNdbError());
if(myTransaction->execute( Commit ) != -1) if(myTransaction->execute( NdbTransaction::Commit ) != -1)
printf(" %2d %2d\n", myRecAttr->u_32_value(), i); printf(" %2d %2d\n", myRecAttr->u_32_value(), i);
myNdb->closeTransaction(myTransaction); myNdb->closeTransaction(myTransaction);
@ -173,7 +173,7 @@ int main()
myIndexOperation->equal( "ATTR2", i ); myIndexOperation->equal( "ATTR2", i );
myIndexOperation->setValue( "ATTR2", i+10); myIndexOperation->setValue( "ATTR2", i+10);
if( myTransaction->execute( Commit ) == -1 ) if( myTransaction->execute( NdbTransaction::Commit ) == -1 )
APIERROR(myTransaction->getNdbError()); APIERROR(myTransaction->getNdbError());
myNdb->closeTransaction(myTransaction); myNdb->closeTransaction(myTransaction);
@ -193,7 +193,7 @@ int main()
myIndexOperation->deleteTuple(); myIndexOperation->deleteTuple();
myIndexOperation->equal( "ATTR2", 3 ); myIndexOperation->equal( "ATTR2", 3 );
if (myTransaction->execute(Commit) == -1) if (myTransaction->execute(NdbTransaction::Commit) == -1)
APIERROR(myTransaction->getNdbError()); APIERROR(myTransaction->getNdbError());
myNdb->closeTransaction(myTransaction); myNdb->closeTransaction(myTransaction);
@ -218,7 +218,7 @@ int main()
NdbRecAttr *myRecAttr= myOperation->getValue("ATTR2", NULL); NdbRecAttr *myRecAttr= myOperation->getValue("ATTR2", NULL);
if (myRecAttr == NULL) APIERROR(myTransaction->getNdbError()); if (myRecAttr == NULL) APIERROR(myTransaction->getNdbError());
if(myTransaction->execute( Commit ) == -1) if(myTransaction->execute( NdbTransaction::Commit ) == -1)
if (i == 3) { if (i == 3) {
std::cout << "Detected that deleted tuple doesn't exist!\n"; std::cout << "Detected that deleted tuple doesn't exist!\n";
} else { } else {

View File

@ -44,3 +44,6 @@ dist-hook:
-rm -rf `find $(distdir) -type d -name SCCS` -rm -rf `find $(distdir) -type d -name SCCS`
windoze-dsp: windoze-dsp:
# Don't update the files from bitkeeper
%::SCCS/s.%

View File

@ -17,6 +17,7 @@
#ifndef CREATE_EVNT_HPP #ifndef CREATE_EVNT_HPP
#define CREATE_EVNT_HPP #define CREATE_EVNT_HPP
#include <ndberror.h>
#include "SignalData.hpp" #include "SignalData.hpp"
#include <NodeBitmask.hpp> #include <NodeBitmask.hpp>
#include <signaldata/DictTabInfo.hpp> #include <signaldata/DictTabInfo.hpp>
@ -101,7 +102,7 @@ public:
Busy = 701, Busy = 701,
NotMaster = 702, NotMaster = 702,
SeizeError = 703, SeizeError = 703,
EventNotFound = 4238, EventNotFound = 4710,
EventNameTooLong = 4241, EventNameTooLong = 4241,
TooManyEvents = 4242, TooManyEvents = 4242,
BadRequestType = 4247, BadRequestType = 4247,
@ -363,11 +364,10 @@ struct CreateEvntRef {
Busy = 701, Busy = 701,
NotMaster = 702, NotMaster = 702,
SeizeError = 703, SeizeError = 703,
EventNotFound = 4238, TooManyEvents = 4707,
EventExists = 4239, EventNameTooLong = 4708,
EventNameTooLong = 4241, EventNameExists = 746,
TooManyEvents = 4242, EventNotFound = 4731,
// EventExists = 4244,
AttributeNotStored = 4245, AttributeNotStored = 4245,
AttributeNullable = 4246, AttributeNullable = 4246,
BadRequestType = 4247, BadRequestType = 4247,
@ -376,7 +376,7 @@ struct CreateEvntRef {
InvalidEventType = 4250, InvalidEventType = 4250,
NotUnique = 4251, NotUnique = 4251,
AllocationError = 4252, AllocationError = 4252,
CreateEventTableFailed = 4253, CreateEventTableFailed = 4711,
InvalidAttributeOrder = 4255, InvalidAttributeOrder = 4255,
Temporary = 0x1 << 16 Temporary = 0x1 << 16
}; };

View File

@ -269,7 +269,9 @@ public:
ExtTimespec = NdbSqlUtil::Type::Timespec, ExtTimespec = NdbSqlUtil::Type::Timespec,
ExtBlob = NdbSqlUtil::Type::Blob, ExtBlob = NdbSqlUtil::Type::Blob,
ExtText = NdbSqlUtil::Type::Text, ExtText = NdbSqlUtil::Type::Text,
ExtBit = NdbSqlUtil::Type::Bit ExtBit = NdbSqlUtil::Type::Bit,
ExtLongvarchar = NdbSqlUtil::Type::Longvarchar,
ExtLongvarbinary = NdbSqlUtil::Type::Longvarbinary
}; };
// Attribute data interpretation // Attribute data interpretation
@ -297,98 +299,91 @@ public:
return ((1 << AttributeSize) * AttributeArraySize + 31) >> 5; return ((1 << AttributeSize) * AttributeArraySize + 31) >> 5;
} }
// translate to old kernel types and sizes // compute old-sty|e attribute size and array size
inline bool inline bool
translateExtType() { translateExtType() {
AttributeType = ~0; // deprecated
switch (AttributeExtType) { switch (AttributeExtType) {
case DictTabInfo::ExtUndefined: case DictTabInfo::ExtUndefined:
break; return false;
case DictTabInfo::ExtTinyint: case DictTabInfo::ExtTinyint:
AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = AttributeExtLength;
return true;
case DictTabInfo::ExtTinyunsigned: case DictTabInfo::ExtTinyunsigned:
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; break;
case DictTabInfo::ExtSmallint: case DictTabInfo::ExtSmallint:
AttributeSize = DictTabInfo::a16Bit;
AttributeArraySize = AttributeExtLength;
return true;
case DictTabInfo::ExtSmallunsigned: case DictTabInfo::ExtSmallunsigned:
AttributeSize = DictTabInfo::a16Bit; AttributeSize = DictTabInfo::a16Bit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; break;
case DictTabInfo::ExtMediumint: case DictTabInfo::ExtMediumint:
AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = 3 * AttributeExtLength;
return true;
case DictTabInfo::ExtMediumunsigned: case DictTabInfo::ExtMediumunsigned:
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = 3 * AttributeExtLength; AttributeArraySize = 3 * AttributeExtLength;
return true; break;
case DictTabInfo::ExtInt: case DictTabInfo::ExtInt:
AttributeSize = DictTabInfo::a32Bit;
AttributeArraySize = AttributeExtLength;
return true;
case DictTabInfo::ExtUnsigned: case DictTabInfo::ExtUnsigned:
AttributeSize = DictTabInfo::a32Bit; AttributeSize = DictTabInfo::a32Bit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; break;
case DictTabInfo::ExtBigint: case DictTabInfo::ExtBigint:
AttributeSize = DictTabInfo::a64Bit;
AttributeArraySize = AttributeExtLength;
return true;
case DictTabInfo::ExtBigunsigned: case DictTabInfo::ExtBigunsigned:
AttributeSize = DictTabInfo::a64Bit; AttributeSize = DictTabInfo::a64Bit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; break;
case DictTabInfo::ExtFloat: case DictTabInfo::ExtFloat:
AttributeSize = DictTabInfo::a32Bit; AttributeSize = DictTabInfo::a32Bit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; break;
case DictTabInfo::ExtDouble: case DictTabInfo::ExtDouble:
AttributeSize = DictTabInfo::a64Bit; AttributeSize = DictTabInfo::a64Bit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; break;
case DictTabInfo::ExtDecimal: case DictTabInfo::ExtDecimal:
// not yet implemented anywhere // not yet implemented anywhere
break; return false;
case DictTabInfo::ExtChar: case DictTabInfo::ExtChar:
case DictTabInfo::ExtBinary: case DictTabInfo::ExtBinary:
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; break;
case DictTabInfo::ExtVarchar: case DictTabInfo::ExtVarchar:
case DictTabInfo::ExtVarbinary: case DictTabInfo::ExtVarbinary:
// to fix if (AttributeExtLength > 0xff)
return false;
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = AttributeExtLength + 2; AttributeArraySize = AttributeExtLength + 1;
return true; break;
case DictTabInfo::ExtDatetime: case DictTabInfo::ExtDatetime:
// to fix // to fix
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = 8 * AttributeExtLength; AttributeArraySize = 8 * AttributeExtLength;
return true; break;
case DictTabInfo::ExtTimespec: case DictTabInfo::ExtTimespec:
// to fix // to fix
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = 12 * AttributeExtLength; AttributeArraySize = 12 * AttributeExtLength;
return true; break;
case DictTabInfo::ExtBlob: case DictTabInfo::ExtBlob:
case DictTabInfo::ExtText: case DictTabInfo::ExtText:
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
// head + inline part [ attr precision lower half ] // head + inline part (length in precision lower half)
AttributeArraySize = (NDB_BLOB_HEAD_SIZE << 2) + (AttributeExtPrecision & 0xFFFF); AttributeArraySize = (NDB_BLOB_HEAD_SIZE << 2) + (AttributeExtPrecision & 0xFFFF);
return true; break;
case DictTabInfo::ExtBit: case DictTabInfo::ExtBit:
AttributeSize = DictTabInfo::aBit; AttributeSize = DictTabInfo::aBit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; break;
case DictTabInfo::ExtLongvarchar:
case DictTabInfo::ExtLongvarbinary:
if (AttributeExtLength > 0xffff)
return false;
AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = AttributeExtLength + 2;
break;
default:
return false;
}; };
return true;
return false;
} }
inline void print(FILE *out) { inline void print(FILE *out) {

View File

@ -21,7 +21,7 @@
* Changing the values makes database upgrade impossible. * Changing the values makes database upgrade impossible.
* *
* New or removed definitions must be replicated to * New or removed definitions must be replicated to
* NdbDictionary.hpp and NdbSqlUtil.cpp. * NdbDictionary.hpp and NdbSqlUtil.hpp.
* *
* Not for use by application programs. * Not for use by application programs.
* Use the enums provided by NdbDictionary instead. * Use the enums provided by NdbDictionary instead.
@ -58,7 +58,9 @@
#define NDB_TYPE_BLOB 20 #define NDB_TYPE_BLOB 20
#define NDB_TYPE_TEXT 21 #define NDB_TYPE_TEXT 21
#define NDB_TYPE_BIT 22 #define NDB_TYPE_BIT 22
#define NDB_TYPE_LONG_VARCHAR 23
#define NDB_TYPE_LONG_VARBINARY 24
#define NDB_TYPE_MAX 23 #define NDB_TYPE_MAX 25
#endif #endif

View File

@ -309,8 +309,8 @@ private:
int invokeActiveHook(); int invokeActiveHook();
// blob handle maintenance // blob handle maintenance
int atPrepare(NdbTransaction* aCon, NdbOperation* anOp, const NdbColumnImpl* aColumn); int atPrepare(NdbTransaction* aCon, NdbOperation* anOp, const NdbColumnImpl* aColumn);
int preExecute(ExecType anExecType, bool& batch); int preExecute(NdbTransaction::ExecType anExecType, bool& batch);
int postExecute(ExecType anExecType); int postExecute(NdbTransaction::ExecType anExecType);
int preCommit(); int preCommit();
int atNextResult(); int atNextResult();
// errors // errors

View File

@ -149,14 +149,20 @@ public:
/** /**
* @class Column * @class Column
* @brief Represents an column in an NDB Cluster table * @brief Represents a column in an NDB Cluster table
* *
* Each column has a type. The type of a column is determind by a number * Each column has a type. The type of a column is determined by a number
* of type specifiers. * of type specifiers.
* The type specifiers are: * The type specifiers are:
* - Builtin type * - Builtin type
* - Array length or max length * - Array length or max length
* - Precision and scale * - Precision and scale (not used yet)
* - Character set for string types
* - Inline and part sizes for blobs
*
* Types in general correspond to MySQL types and their variants.
* Data formats are same as in MySQL. NDB API provides no support for
* constructing such formats. NDB kernel checks them however.
*/ */
class Column { class Column {
public: public:
@ -179,14 +185,16 @@ public:
Double = NDB_TYPE_DOUBLE, ///< 64-bit float. 8 byte float, can be used in array Double = NDB_TYPE_DOUBLE, ///< 64-bit float. 8 byte float, can be used in array
Decimal = NDB_TYPE_DECIMAL, ///< Precision, Scale are applicable Decimal = NDB_TYPE_DECIMAL, ///< Precision, Scale are applicable
Char = NDB_TYPE_CHAR, ///< Len. A fixed array of 1-byte chars Char = NDB_TYPE_CHAR, ///< Len. A fixed array of 1-byte chars
Varchar = NDB_TYPE_VARCHAR, ///< Max len Varchar = NDB_TYPE_VARCHAR, ///< Length bytes: 1, Max: 255
Binary = NDB_TYPE_BINARY, ///< Len Binary = NDB_TYPE_BINARY, ///< Len
Varbinary = NDB_TYPE_VARBINARY, ///< Max len Varbinary = NDB_TYPE_VARBINARY, ///< Length bytes: 1, Max: 255
Datetime = NDB_TYPE_DATETIME, ///< Precision down to 1 sec (sizeof(Datetime) == 8 bytes ) Datetime = NDB_TYPE_DATETIME, ///< Precision down to 1 sec (sizeof(Datetime) == 8 bytes )
Timespec = NDB_TYPE_TIMESPEC, ///< Precision down to 1 nsec(sizeof(Datetime) == 12 bytes ) Timespec = NDB_TYPE_TIMESPEC, ///< Precision down to 1 nsec(sizeof(Datetime) == 12 bytes )
Blob = NDB_TYPE_BLOB, ///< Binary large object (see NdbBlob) Blob = NDB_TYPE_BLOB, ///< Binary large object (see NdbBlob)
Text = NDB_TYPE_TEXT, ///< Text blob, Text = NDB_TYPE_TEXT, ///< Text blob
Bit = NDB_TYPE_BIT ///< Bit, length specifies no of bits Bit = NDB_TYPE_BIT, ///< Bit, length specifies no of bits
Longvarchar = NDB_TYPE_LONG_VARCHAR, ///< Length bytes: 2, little-endian
Longvarbinary = NDB_TYPE_LONG_VARBINARY ///< Length bytes: 2, little-endian
}; };
/** /**
@ -698,7 +706,7 @@ public:
/** @} *******************************************************************/ /** @} *******************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
void setStoredTable(bool x) { setLogging(x); } void setStoredTable(bool x) { setLogging(x); }
bool getStoredTable() const { return getLogging(); } bool getStoredTable() const { return getLogging(); }
@ -901,34 +909,120 @@ public:
*/ */
class Event : public Object { class Event : public Object {
public: public:
enum TableEvent { TE_INSERT=1, TE_DELETE=2, TE_UPDATE=4, TE_ALL=7 }; enum TableEvent {
TE_INSERT=1, ///< Insert event on table
TE_DELETE=2, ///< Delete event on table
TE_UPDATE=4, ///< Update event on table
TE_ALL=7 ///< Any/all event on table (not relevant when
///< events are received)
};
enum EventDurability { enum EventDurability {
ED_UNDEFINED = 0, ED_UNDEFINED
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
= 0
#endif
#if 0 // not supported #if 0 // not supported
ED_SESSION = 1, ,ED_SESSION = 1,
// Only this API can use it // Only this API can use it
// and it's deleted after api has disconnected or ndb has restarted // and it's deleted after api has disconnected or ndb has restarted
ED_TEMPORARY = 2, ED_TEMPORARY = 2
// All API's can use it, // All API's can use it,
// But's its removed when ndb is restarted // But's its removed when ndb is restarted
#endif #endif
ED_PERMANENT = 3 ,ED_PERMANENT ///< All API's can use it,
// All API's can use it, ///< It's still defined after a restart
// It's still defined after a restart #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
= 3
#endif
}; };
/*
* Constructor
* @param name Name of event
*/
Event(const char *name); Event(const char *name);
/*
* Constructor
* @param name Name of event
* @param table Reference retrieved from NdbDictionary
*/
Event(const char *name, const NdbDictionary::Table& table);
virtual ~Event(); virtual ~Event();
void setName(const char *); /**
void setTable(const char *); * Set/get unique identifier for the event
void addTableEvent(const TableEvent); */
void setDurability(const EventDurability); void setName(const char *name);
const char *getName() const;
/**
* Define table on which events should be detected
*
* @note calling this method will default to detection
* of events on all columns. Calling subsequent
* addEventColumn calls will override this.
*
* @param table reference retrieved from NdbDictionary
*/
void setTable(const NdbDictionary::Table& table);
/**
* Set table for which events should be detected
*
* @note preferred way is using setTable(const NdbDictionary::Table)
* or constructor with table object parameter
*/
void setTable(const char *tableName);
/**
* Get table name for events
*
* @return table name
*/
const char* getTableName() const;
/**
* Add type of event that should be detected
*/
void addTableEvent(const TableEvent te);
/**
* Get/set durability of the event
*/
void setDurability(EventDurability ed);
EventDurability getDurability() const;
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
void addColumn(const Column &c); void addColumn(const Column &c);
#endif
/**
* Add a column on which events should be detected
*
* @param attrId Column id
*
* @note errors will mot be detected until createEvent() is called
*/
void addEventColumn(unsigned attrId); void addEventColumn(unsigned attrId);
/**
* Add a column on which events should be detected
*
* @param columnName Column name
*
* @note errors will not be detected until createEvent() is called
*/
void addEventColumn(const char * columnName); void addEventColumn(const char * columnName);
/**
* Add several columns on which events should be detected
*
* @param n Number of columns
* @param columnNames Column names
*
* @note errors will mot be detected until
* NdbDictionary::Dictionary::createEvent() is called
*/
void addEventColumns(int n, const char ** columnNames); void addEventColumns(int n, const char ** columnNames);
/**
* Get no of columns defined in an Event
*
* @return Number of columns, -1 on error
*/
int getNoOfEventColumns() const;
/** /**
* Get object status * Get object status
*/ */
@ -939,7 +1033,9 @@ public:
*/ */
virtual int getObjectVersion() const; virtual int getObjectVersion() const;
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
void print(); void print();
#endif
private: private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
@ -1010,6 +1106,8 @@ public:
* Fetch list of all objects, optionally restricted to given type. * Fetch list of all objects, optionally restricted to given type.
*/ */
int listObjects(List & list, Object::Type type = Object::TypeUndefined); int listObjects(List & list, Object::Type type = Object::TypeUndefined);
int listObjects(List & list,
Object::Type type = Object::TypeUndefined) const;
/** /**
* Get the latest error * Get the latest error
@ -1048,6 +1146,7 @@ public:
* @return 0 if successful, otherwise -1 * @return 0 if successful, otherwise -1
*/ */
int listIndexes(List & list, const char * tableName); int listIndexes(List & list, const char * tableName);
int listIndexes(List & list, const char * tableName) const;
/** @} *******************************************************************/ /** @} *******************************************************************/
/** /**

View File

@ -168,7 +168,12 @@ struct NdbError {
/** /**
* Node shutdown * Node shutdown
*/ */
NodeShutdown = ndberror_cl_node_shutdown NodeShutdown = ndberror_cl_node_shutdown,
/**
* Schema object already exists
*/
SchemaObjectExists = ndberror_cl_schema_object_already_exists
}; };
/** /**

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