Merge with 4.1

BitKeeper/etc/ignore:
  auto-union
BitKeeper/etc/logging_ok:
  auto-union
Build-tools/Do-compile:
  Auto merged
VC++Files/sql/mysqld.dsp:
  Auto merged
client/Makefile.am:
  Auto merged
client/mysql.cc:
  Auto merged
BitKeeper/deleted/.del-acinclude.m4~f4ab416bac5003:
  Auto merged
client/mysqltest.c:
  Auto merged
include/my_base.h:
  Auto merged
innobase/dict/dict0dict.c:
  Auto merged
innobase/dict/dict0load.c:
  Auto merged
innobase/include/dict0dict.h:
  Auto merged
innobase/include/row0mysql.h:
  Auto merged
innobase/os/os0file.c:
  Auto merged
innobase/srv/srv0srv.c:
  Auto merged
libmysql/libmysql.c:
  Auto merged
myisam/mi_check.c:
  Auto merged
myisam/mi_rnext_same.c:
  Auto merged
myisam/mi_write.c:
  Auto merged
myisam/sort.c:
  Auto merged
mysql-test/mysql-test-run.sh:
  Auto merged
mysql-test/r/ctype_ucs.result:
  Auto merged
mysql-test/r/ctype_ujis.result:
  Auto merged
mysql-test/r/gis-rtree.result:
  Auto merged
mysql-test/r/group_by.result:
  Auto merged
mysql-test/r/merge.result:
  Auto merged
mysql-test/r/metadata.result:
  Auto merged
mysql-test/r/ndb_alter_table.result:
  Auto merged
mysql-test/r/ps_1general.result:
  Auto merged
mysql-test/r/insert_update.result:
  Auto merged
mysql-test/r/timezone2.result:
  Auto merged
mysql-test/r/type_enum.result:
  Auto merged
mysql-test/r/variables.result:
  Auto merged
mysql-test/t/ctype_ucs.test:
  Auto merged
mysql-test/t/merge.test:
  Auto merged
mysql-test/t/ps_1general.test:
  Auto merged
mysql-test/t/subselect.test:
  Auto merged
mysql-test/t/system_mysql_db_fix.test:
  Auto merged
mysql-test/t/variables.test:
  Auto merged
ndb/include/ndbapi/NdbConnection.hpp:
  Auto merged
ndb/include/ndbapi/NdbDictionary.hpp:
  Auto merged
ndb/src/common/util/version.c:
  Auto merged
ndb/src/kernel/blocks/dbacc/DbaccInit.cpp:
  Auto merged
ndb/src/kernel/blocks/dbacc/Makefile.am:
  Auto merged
ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  Auto merged
ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
  Auto merged
ndb/src/kernel/blocks/dblqh/DblqhInit.cpp:
  Auto merged
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp:
  Auto merged
ndb/src/kernel/blocks/dbtux/Dbtux.hpp:
  Auto merged
ndb/src/ndbapi/NdbBlob.cpp:
  Auto merged
ndb/src/ndbapi/NdbConnection.cpp:
  Auto merged
ndb/src/ndbapi/NdbDictionary.cpp:
  Auto merged
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  Auto merged
ndb/src/ndbapi/NdbDictionaryImpl.hpp:
  Auto merged
ndb/src/ndbapi/NdbOperationExec.cpp:
  Auto merged
ndb/src/ndbapi/NdbScanOperation.cpp:
  Auto merged
ndb/test/ndbapi/Makefile.am:
  Auto merged
scripts/make_win_src_distribution.sh:
  Auto merged
scripts/mysql_install_db.sh:
  Auto merged
sql/field.cc:
  Auto merged
sql/ha_innodb.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/ha_ndbcluster.h:
  Auto merged
sql/handler.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_create.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_geofunc.cc:
  Auto merged
sql/item_row.cc:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/item_strfunc.h:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/item_sum.h:
  Auto merged
sql/log.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/net_serv.cc:
  Auto merged
sql/password.c:
  Auto merged
sql/protocol.cc:
  Auto merged
sql/repl_failsafe.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_cache.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_derived.cc:
  Auto merged
sql/sql_do.cc:
  Auto merged
sql/sql_handler.cc:
  Auto merged
sql/sql_help.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_repl.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_union.cc:
  Auto merged
sql/examples/ha_archive.cc:
  Auto merged
sql/strfunc.cc:
  Auto merged
sql/table.cc:
  Auto merged
sql/table.h:
  Auto merged
sql/tztime.h:
  Auto merged
sql/udf_example.cc:
  Auto merged
sql/unireg.cc:
  Auto merged
Makefile.am:
  Simple merge
client/mysqldump.c:
  Simple merge
configure.in:
  Simple merge
libmysqld/lib_sql.cc:
  Automatic merge
mysql-test/r/func_str.result:
  Automatic merge
mysql-test/r/grant.result:
  simple merge
mysql-test/r/multi_update.result:
  automatc merge
mysql-test/r/ps.result:
  automatic merge
mysql-test/r/ps_2myisam.result:
  Automatic merge
mysql-test/r/ps_3innodb.result:
  Automatic merge
mysql-test/r/ps_4heap.result:
  Automatic merge
mysql-test/r/ps_5merge.result:
  Automatic merge
mysql-test/r/ps_6bdb.result:
  Automatic merge
mysql-test/r/ps_7ndb.result:
  Automatic merge
mysql-test/r/show_check.result:
  Automatic merge
mysql-test/r/subselect.result:
  Automatic merge
mysql-test/t/grant.test:
  Automatic merge
mysql-test/t/multi_update.test:
  Automatic merge
mysql-test/t/ps.test:
  Automatic merge
mysql-test/t/show_check.test:
  Automatic merge
ndb/docs/wl2077.txt:
  merge
ndb/src/mgmsrv/main.cpp:
  merge
scripts/mysql_fix_privilege_tables.sh:
  merge
sql/item.cc:
  Merge (difficult)
sql/item.h:
  simple merge
sql/item_cmpfunc.h:
  Automatic merge
sql/item_subselect.cc:
  Simple merge
sql/item_subselect.h:
  Automatic merge
sql/mysql_priv.h:
  Simple merge
sql/slave.h:
  Automatic merge
sql/sql_base.cc:
  Removed code that was backported to 4.1
sql/sql_class.h:
  Merge (some code moved to sql_insert.cc)
sql/sql_db.cc:
  simple merge
sql/sql_insert.cc:
  Merge (difficult as logic had changed both in 4.1 and 5.0)
  Some coded moved here from sql_class.h
sql/sql_parse.cc:
  Merge (difficult)
sql/sql_prepare.cc:
  Simple merge
sql/sql_select.cc:
  Automatic merge
sql/sql_table.cc:
  Simple merge
sql/sql_update.cc:
  Difficult merge because of different logic for multi-updates
sql/sql_yacc.yy:
  Simple merge
tests/client_test.c:
  Simple merge
This commit is contained in:
unknown 2004-12-22 13:54:39 +02:00
commit bb2d3eaa30
395 changed files with 11807 additions and 25533 deletions

View File

@ -104,6 +104,7 @@ PENDING/*
TAGS
ac_available_languages_fragment
aclocal.m4
analyse.test
autom4te-2.53.cache/*
autom4te-2.53.cache/output.0
autom4te-2.53.cache/requests
@ -260,6 +261,7 @@ client/mf_iocache.c
client/mf_iocache.cc
client/mysql
client/mysqladmin
client/mysqladmin.c
client/mysqlbinlog
client/mysqlcheck
client/mysqldump
@ -300,14 +302,17 @@ depcomp
emacs.h
extra/charset2html
extra/comp_err
extra/created_include_files
extra/my_print_defaults
extra/mysql_install
extra/mysql_tzinfo_to_sql
extra/mysql_waitpid
extra/mysqld_error.h
extra/perror
extra/replace
extra/resolve_stack_dump
extra/resolveip
extra/sql_state.h
extra/tztime.cc
fcns.c
fcns.h
@ -538,6 +543,7 @@ myisam/test2.MYD
myisam/test2.MYI
mysql-4.0.2-alpha-pc-linux-gnu-i686.tar.gz
mysql-4.0.2-alpha.tar.gz
mysql-4.1.8-win-src.zip
mysql-5.0.2-alpha.tar.gz
mysql-max-4.0.2-alpha-pc-linux-gnu-i686.tar.gz
mysql-test/gmon.out
@ -983,6 +989,3 @@ vio/test-ssl
vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
extra/mysqld_error.h
extra/sql_state.h
extra/created_include_files

View File

@ -2,6 +2,7 @@ Administrador@light.
Administrator@co3064164-a.
Administrator@co3064164-a.rochd1.qld.optushome.com.au
Administrator@fred.
Administrator@w2k.
Greg@greg-laptop.
Miguel@light.local
Sinisa@sinisa.nasamreza.org
@ -108,6 +109,7 @@ magnus@neptunus.(none)
magnus@shellback.(none)
marko@hundin.mysql.fi
mats@mysql.com
matt@booty.(none)
matt@mysql.com
matthias@three.local.lan
miguel@hegel.(none)
@ -163,6 +165,7 @@ papa@gbichot.local
patg@krsna.patg.net
patg@patrick-galbraiths-computer.local
paul@central.snake.net
paul@frost.snake.net
paul@ice.local
paul@ice.snake.net
paul@kite-hub.kitebird.com
@ -202,6 +205,7 @@ serg@sergbook.mylan
serg@sergbook.mysql.com
sergefp@mysql.com
sinisa@rhols221.adsl.netsonic.fi
stewart@mysql.com
tfr@beta.frontier86.ee
tfr@indrek.tfr.cafe.ee
tfr@sarvik.tfr.cafe.ee

View File

@ -10,8 +10,8 @@ use Sys::Hostname;
$opt_distribution=$opt_user=$opt_config_env=$opt_config_extra_env="";
$opt_dbd_options=$opt_perl_options=$opt_config_options=$opt_make_options=$opt_suffix="";
$opt_tmp=$opt_version_suffix="";
$opt_bundled_zlib=$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_one_error=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_archive=$opt_with_cluster=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=$opt_without_embedded=$opt_readline=0;
$opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=$opt_clearlogs=0;
$opt_bundled_zlib=$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_one_error=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_archive=$opt_with_cluster=$opt_with_csv=$opt_with_example=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=$opt_without_embedded=$opt_readline=0;
$opt_embedded_test=$opt_ps_test=$opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=$opt_clearlogs=0;
GetOptions(
"bdb",
@ -25,6 +25,7 @@ GetOptions(
"delete",
"distribution=s",
"enable-shared",
"embedded-test",
"fast-benchmark",
"help|Information",
"innodb",
@ -40,6 +41,7 @@ GetOptions(
"one-error",
"perl-files=s",
"perl-options=s",
"ps-test",
"raid",
"readline",
"stage=i",
@ -55,6 +57,8 @@ GetOptions(
"version-suffix=s",
"with-archive",
"with-cluster",
"with-csv",
"with-example",
"with-debug",
"with-low-memory",
"with-other-libc=s",
@ -274,8 +278,11 @@ if ($opt_stage <= 1)
$opt_config_options.= " --with-libedit";
}
$opt_config_options.= " --with-embedded-server" unless ($opt_without_embedded);
$opt_embedded_test= 0 if ($opt_without_embedded);
$opt_config_options.= " --with-archive-storage-engine" if ($opt_with_archive);
$opt_config_options.= " --with-ndbcluster" if ($opt_with_cluster);
$opt_config_options.= " --with-csv-storage-engine" if ($opt_with_csv);
$opt_config_options.= " --with-example-storage-engine" if ($opt_with_example);
# Only enable InnoDB when requested (required to be able to
# build the "Classic" packages that do not include InnoDB)
@ -376,13 +383,29 @@ $ENV{"LD_LIBRARY_PATH"}= ("$test_dir/lib" .
if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest)
{
my $flags= "";
my $force= "";
$flags.= " --with-ndbcluster" if ($opt_with_cluster);
$flags.= " --force" if (!$opt_one_error);
log_timestamp();
info("Running test suite");
system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir);
safe_cd("${test_dir}/mysql-test");
check_system("./mysql-test-run $flags --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --ndbcluster_port=$ndbcluster_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful");
if ($opt_ps_test)
{
log_timestamp();
info("Running test suite using prepared statements");
check_system("./mysql-test-run $flags --ps-protocol --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --ndbcluster_port=$ndbcluster_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful");
}
if ($opt_embedded_test)
{
log_timestamp();
info("Running embedded server test suite");
# Embedded server and NDB don't jive
$flags=~ s/ --with-ndbcluster//;
check_system("./mysql-test-run $flags --embedded-server --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful");
}
# 'mysql-test-run' writes its own final message for log evaluation.
}
@ -528,6 +551,9 @@ Delete the distribution file.
--distribution=<distribution_file>
Name of the MySQL source distribution file.
--embedded-test
Run the test suite against the embedded server
--enable-shared
Compile with shared libraries
@ -576,6 +602,9 @@ Compile and install the given perl modules.
--perl-options=<options>
Build Perl modules with the additional options
--ps-test
Run an additional test run, using prepared statements
--raid
Compile with RAID support
@ -612,11 +641,17 @@ If user is empty then no mail is sent.
Set name suffix (e.g. 'com' or '-max') for a distribution
--with archive
Enable the Archive storage Engine
Enable the Archive storage engine
--with cluster
Compile and test with NDB Cluster enabled
--with-csv
Enable the CSV storage engine
--with-example
Enable the Example storage engine
--with-debug
Build binaries with debug information (implies "--no-strip")

View File

@ -100,7 +100,7 @@ tags:
# Test installation
test:
cd mysql-test ; ./mysql-test-run
cd mysql-test; ./mysql-test-run && ./mysql-test-run --ps-protocol
# Don't update the files from bitkeeper
%::SCCS/s.%

View File

@ -42,8 +42,8 @@ RSC=rc.exe
# PROP Output_Dir ".\debug"
# PROP Intermediate_Dir ".\debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_WINDOWS" /D "USE_TLS" /D "_MBCS" /Fp".\debug/mysqltest.pch" /Fo".\debug/" /Fd".\debug/" /GZ /c /GX
# ADD CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_WINDOWS" /D "USE_TLS" /D "_MBCS" /Fp".\debug/mysqltest.pch" /Fo".\debug/" /Fd".\debug/" /GZ /c /GX
# ADD BASE CPP /nologo /MTd /I "../include" /I "../regex" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_WINDOWS" /D "_MBCS" /Fp".\debug/mysqltest.pch" /Fo".\debug/" /Fd".\debug/" /GZ /c /GX
# ADD CPP /nologo /MTd /I "../include" /I "../regex" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_WINDOWS" /D "_MBCS" /Fp".\debug/mysqltest.pch" /Fo".\debug/" /Fd".\debug/" /GZ /c /GX
# ADD BASE MTL /nologo /tlb".\debug\mysqltest.tlb" /win32
# ADD MTL /nologo /tlb".\debug\mysqltest.tlb" /win32
# ADD BASE RSC /l 1033 /d "_DEBUG"
@ -52,8 +52,8 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
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 mysqlclient.lib wsock32.lib odbc32.lib odbccp32.lib mysys.lib /nologo /out:"..\client_debug\mysqltest.exe" /incremental:no /libpath:"..\lib_debug\" /debug /pdb:".\debug\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 mysqlclient.lib wsock32.lib odbc32.lib odbccp32.lib mysys.lib /nologo /out:"..\client_debug\mysqltest.exe" /incremental:no /libpath:"..\lib_debug\" /debug /pdb:".\debug\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_debug\mysqltest.exe" /incremental:no /libpath:"..\lib_debug\" /debug /pdb:".\debug\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_debug\mysqltest.exe" /incremental:no /libpath:"..\lib_debug\" /debug /pdb:".\debug\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386
!ELSEIF "$(CFG)" == "mysqltest - Win32 classic"
@ -77,8 +77,8 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
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 mysqlclient.lib wsock32.lib odbc32.lib odbccp32.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 mysqlclient.lib wsock32.lib odbc32.lib odbccp32.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 /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
!ELSEIF "$(CFG)" == "mysqltest - Win32 Release"
@ -102,8 +102,8 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
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 mysqlclient.lib wsock32.lib odbc32.lib odbccp32.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 mysqlclient.lib wsock32.lib odbc32.lib odbccp32.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 /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
!ENDIF

View File

@ -2,7 +2,7 @@
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=mysql_test_run_new - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
@ -17,8 +17,8 @@ CFG=mysql_test_run_new - Win32 Debug
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "mysql_test_run_new - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE "mysql_test_run_new - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "mysql_test_run_new - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE "mysql_test_run_new - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
@ -33,51 +33,51 @@ RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Output_Dir ".\Debug"
# PROP Intermediate_Dir ".\Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /Fp".\debug/mysql_test_run.pch" /Fo".\debug/" /Fd".\debug/" /GZ /c /GX
# ADD CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /Fp".\debug/mysql_test_run.pch" /Fo".\debug/" /Fd".\debug/" /GZ /c /GX
# ADD BASE MTL /nologo /win32
# ADD MTL /nologo /win32
# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /Fp".\Debug/mysql_test_run_new.pch" /Fo".\Debug/" /Fd".\Debug/" /GZ /c /GX
# ADD CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /Fp".\Debug/mysql_test_run_new.pch" /Fo".\Debug/" /Fd".\Debug/" /GZ /c /GX
# ADD BASE MTL /nologo /tlb".\Debug\mysql_test_run_new.tlb" /win32
# ADD MTL /nologo /tlb".\Debug\mysql_test_run_new.tlb" /win32
# ADD BASE RSC /l 1033
# ADD RSC /l 1033
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
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 Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /debug /pdb:".\debug\mysql_test_run_new.pdb" /pdbtype:sept /map /mapinfo:exports /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 Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /debug /pdb:".\debug\mysql_test_run_new.pdb" /pdbtype:sept /map /mapinfo:exports /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:yes /debug /pdb:".\Debug\mysql_test_run_new.pdb" /pdbtype:sept /map:".\Debug\mysql_test_run_new.map" /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:yes /debug /pdb:".\Debug\mysql_test_run_new.pdb" /pdbtype:sept /map:".\Debug\mysql_test_run_new.map" /subsystem:console
!ELSEIF "$(CFG)" == "mysql_test_run_new - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fo".\release/" /Fd".\release/" /c /GX
# ADD CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fo".\release/" /Fd".\release/" /c /GX
# ADD BASE MTL /nologo /win32
# ADD MTL /nologo /win32
# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/mysql_test_run_new.pch" /Fo".\Release/" /Fd".\Release/" /c /GX
# ADD CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/mysql_test_run_new.pch" /Fo".\Release/" /Fd".\Release/" /c /GX
# ADD BASE MTL /nologo /tlb".\Release\mysql_test_run_new.tlb" /win32
# ADD MTL /nologo /tlb".\Release\mysql_test_run_new.tlb" /win32
# ADD BASE RSC /l 1033
# ADD RSC /l 1033
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
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 Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /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 Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /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: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:windows
!ENDIF
@ -87,19 +87,19 @@ LINK32=link.exe
# Name "mysql_test_run_new - Win32 Release"
# Begin Source File
SOURCE=my_create_tables.c
SOURCE=.\my_create_tables.c
# End Source File
# Begin Source File
SOURCE=my_manage.c
SOURCE=.\my_manage.c
# End Source File
# Begin Source File
SOURCE=my_manage.h
SOURCE=.\my_manage.h
# End Source File
# Begin Source File
SOURCE=mysql_test_run_new.c
SOURCE=.\mysql_test_run_new.c
# End Source File
# End Target
# End Project

View File

@ -824,11 +824,20 @@ Package=<5>
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name libmysql
End Project Dependency
Begin Project Dependency
Project_Dep_Name mysys
End Project Dependency
Begin Project Dependency
Project_Dep_Name regex
End Project Dependency
}}}
###############################################################################
Project: "mysql_test_run_new"=.\mysql-test\mysql_test_run_new.dsp - Package Owner=<4>
Project: "mysql_test_run_new"=".\mysql-test\mysql_test_run_new.dsp" - Package Owner=<4>
Package=<5>
{{{
@ -836,6 +845,12 @@ Package=<5>
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name mysqltest
End Project Dependency
Begin Project Dependency
Project_Dep_Name mysqladmin
End Project Dependency
}}}
###############################################################################

View File

@ -924,76 +924,139 @@ SOURCE=.\message.mc
!IF "$(CFG)" == "mysqld - Win32 Release"
# Begin Custom Build
InputPath=.\message.mc
BuildCmds= \
mc message.mc
"message.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"message.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "mysqld - Win32 Debug"
# Begin Custom Build
InputPath=.\message.mc
BuildCmds= \
mc message.mc
"message.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"message.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "mysqld - Win32 nt"
# Begin Custom Build - Compiling messages
InputDir=.
# Begin Custom Build
InputPath=.\message.mc
InputName=message
BuildCmds= \
mc.exe "$(InputDir)\$(InputName).mc"
mc message.mc
"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
"message.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
"message.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "mysqld - Win32 Max nt"
# Begin Custom Build - Compiling messages
InputDir=.
# Begin Custom Build
InputPath=.\message.mc
InputName=message
BuildCmds= \
mc.exe "$(InputDir)\$(InputName).mc"
mc message.mc
"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
"message.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
"message.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "mysqld - Win32 Max"
# Begin Custom Build
InputPath=.\message.mc
BuildCmds= \
mc message.mc
"message.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"message.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "mysqld - Win32 classic"
# Begin Custom Build
InputPath=.\message.mc
BuildCmds= \
mc message.mc
"message.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"message.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "mysqld - Win32 pro"
# Begin Custom Build
InputPath=.\message.mc
BuildCmds= \
mc message.mc
"message.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"message.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "mysqld - Win32 classic nt"
# Begin Custom Build - Compiling messages
InputDir=.
# Begin Custom Build
InputPath=.\message.mc
InputName=message
BuildCmds= \
mc.exe "$(InputDir)\$(InputName).mc"
mc message.mc
"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
"message.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
"message.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "mysqld - Win32 pro nt"
# Begin Custom Build - Compiling messages
InputDir=.
# Begin Custom Build
InputPath=.\message.mc
InputName=message
BuildCmds= \
mc.exe "$(InputDir)\$(InputName).mc"
mc message.mc
"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
"message.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
"message.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ENDIF
# End Source File

View File

@ -21,6 +21,7 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/regex \
$(openssl_includes) -I$(top_srcdir)/extra
LIBS = @CLIENT_LIBS@
DEPLIB= ../libmysql/libmysqlclient.la
REGEXLIB= ../regex/libregex.a
LDADD = @CLIENT_EXTRA_LDFLAGS@ $(DEPLIB)
bin_PROGRAMS = mysql mysqladmin mysqlcheck mysqlshow \
mysqldump mysqlimport mysqltest mysqlbinlog mysqlmanagerc mysqlmanager-pwgen
@ -37,8 +38,8 @@ mysqlshow_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
mysqldump_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
mysqlimport_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
mysqltest_SOURCES= mysqltest.c ../mysys/my_getsystime.c
mysqltest_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
mysqltest_LDADD = $(LDADD) $(top_builddir)/regex/libregex.a
mysqltest_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(REGEXLIB) $(DEPLIB)
mysqltest_LDADD = $(REGEXLIB) $(LDADD)
mysqlbinlog_SOURCES = mysqlbinlog.cc ../mysys/mf_tempdir.c
mysqlbinlog_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
mysqlmanagerc_SOURCES = mysqlmanagerc.c

View File

@ -1677,7 +1677,7 @@ static int com_server_help(String *buffer __attribute__((unused)),
if (num_fields == 2)
{
put_info("Many help items for your request exist.", INFO_INFO);
put_info("To make a more specific request, please type 'help <item>',\nwhere item is one of the following", INFO_INFO);
put_info("To make a more specific request, please type 'help <item>',\nwhere <item> is one of the following", INFO_INFO);
num_name= 0;
num_cat= 1;
last_char= '_';
@ -1685,7 +1685,7 @@ static int com_server_help(String *buffer __attribute__((unused)),
else if ((cur= mysql_fetch_row(result)))
{
tee_fprintf(PAGER, "You asked for help about help category: \"%s\"\n", cur[0]);
put_info("For more information, type 'help <item>', where item is one of the following", INFO_INFO);
put_info("For more information, type 'help <item>', where <item> is one of the following", INFO_INFO);
num_name= 1;
num_cat= 2;
print_help_item(&cur,1,2,&last_char);

View File

@ -160,7 +160,7 @@ static struct my_option my_long_options[] =
(gptr*) &opt_compatible_mode_str, (gptr*) &opt_compatible_mode_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compact", OPT_COMPACT,
"Give less verbose output (useful for debugging). Disables structure comments and header/footer constructs. Enables options --skip-add-drop-table --no-set-names --skip-disable-keys --skip-lock-tables",
"Give less verbose output (useful for debugging). Disables structure comments and header/footer constructs. Enables options --skip-add-drop-table --no-set-names --skip-disable-keys --skip-add-locks",
(gptr*) &opt_compact, (gptr*) &opt_compact, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"complete-insert", 'c', "Use complete insert statements.", (gptr*) &cFlag,
@ -1848,8 +1848,6 @@ static void dumpTable(uint numFields, char *table)
err:
if (query != query_buf)
my_free(query, MYF(MY_ALLOW_ZERO_PTR));
if (order_by)
my_free(order_by, MYF(0));
safe_exit(error);
return;
} /* dumpTable */
@ -1967,7 +1965,7 @@ static int init_dumping(char *database)
sprintf(qbuf,"SHOW CREATE DATABASE IF NOT EXISTS %s",
qdatabase);
if (mysql_query_with_error_report(sock, &dbinfo, qbuf))
if (mysql_query(sock, qbuf) || !(dbinfo = mysql_store_result(sock)))
{
/* Old server version, dump generic CREATE DATABASE */
fprintf(md_result_file,
@ -2029,6 +2027,8 @@ static int dump_all_tables_in_db(char *database)
numrows = getTableStructure(table, database);
if (!dFlag && numrows > 0)
dumpTable(numrows,table);
my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
order_by= 0;
}
if (opt_xml)
{
@ -2130,6 +2130,8 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
numrows = getTableStructure(table_names[i], db);
if (!dFlag && numrows > 0)
dumpTable(numrows, table_names[i]);
my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
order_by= 0;
}
if (was_views)
{

View File

@ -227,7 +227,7 @@ typedef struct
int alloced;
} VAR;
#ifdef __NETWARE__
#if defined(__NETWARE__) || defined(__WIN__)
/*
Netware doesn't proved environment variable substitution that is done
by the shell in unix environments. We do this in the following function:
@ -4609,6 +4609,9 @@ static char *subst_env_var(const char *str)
*/
#undef popen /* Remove wrapper */
#ifdef __WIN__
#define popen _popen /* redefine for windows */
#endif
FILE *my_popen(const char *cmd, const char *mode __attribute__((unused)))
{

View File

@ -749,7 +749,8 @@ AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \
sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h linux/config.h)
sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h linux/config.h \
sys/resource.h sys/param.h)
#--------------------------------------------------------------------
# Check for system libraries. Adds the library to $LIBS
@ -1919,7 +1920,9 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bzero chsize cuserid fchmod fcntl \
pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
realpath rename rint rwlock_init setupterm sighold sigset sigthreadmask \
realpath rename rint rwlock_init setupterm \
shmget shmat shmdt shmctl \
sighold sigset sigthreadmask \
snprintf socket stpcpy strcasecmp strerror strnlen strpbrk strstr strtol \
strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr)
@ -2648,15 +2651,26 @@ then
MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --with-ndbcluster"
CXXFLAGS="$CXXFLAGS \$(NDB_CXXFLAGS)"
if test "$with_debug" = "yes"
if test "$have_ndb_debug" = "default"
then
have_ndb_debug=$with_debug
fi
if test "$have_ndb_debug" = "yes"
then
# Medium debug.
NDB_DEFS="-DNDB_DEBUG -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
elif test "$with_debug" = "full"
elif test "$have_ndb_debug" = "full"
then
NDB_DEFS="-DNDB_DEBUG_FULL -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
else
NDB_DEFS="-DNDEBUG"
# no extra ndb debug but still do asserts if debug version
if test "$with_debug" = "yes" -o "$with_debug" = "full"
then
NDB_DEFS=""
else
NDB_DEFS="-DNDEBUG"
fi
fi
AC_SUBST([NDB_DEFS])
@ -2676,10 +2690,19 @@ fi
AC_SUBST([ndb_port_base])
ndb_transporter_opt_objs=""
if test X"$have_ndb_shm" = Xyes
if test "$ac_cv_func_shmget" = "yes" &&
test "$ac_cv_func_shmat" = "yes" &&
test "$ac_cv_func_shmdt" = "yes" &&
test "$ac_cv_func_shmctl" = "yes"
then
ndb_transporter_opt_objs="$ndb_transporter_opt_objs SHM_Transporter.lo SHM_Transporter.unix.lo"
AC_DEFINE([NDB_SHM_TRANSPORTER], [1],
[Including Ndb Cluster DB shared memory transporter])
AC_MSG_RESULT([Including ndb shared memory transporter])
ndb_transporter_opt_objs="$ndb_transporter_opt_objs SHM_Transporter.lo SHM_Transporter.unix.lo"
else
AC_MSG_RESULT([Not including ndb shared memory transporter])
fi
if test X"$have_ndb_sci" = Xyes
then
ndb_transporter_opt_objs="$ndb_transporter_opt_objs SCI_Transporter.lo"
@ -2742,6 +2765,7 @@ AC_CONFIG_FILES(ndb/Makefile ndb/include/Makefile dnl
ndb/test/ndbapi/bank/Makefile dnl
ndb/test/tools/Makefile dnl
ndb/test/run-test/Makefile mysql-test/ndb/Makefile dnl
ndb/include/ndb_version.h ndb/include/ndb_global.h dnl
)
fi

View File

@ -90,3 +90,4 @@ extern const char *client_errors[]; /* Error messages */
#define CR_SECURE_AUTH 2049
#define CR_FETCH_CANCELED 2050
#define CR_NO_DATA 2051
#define CR_NO_STMT_METADATA 2052

View File

@ -308,6 +308,7 @@ enum ha_base_keytype {
#define HA_ERR_NO_SUCH_TABLE 155 /* The table does not exist in engine */
#define HA_ERR_TABLE_EXIST 156 /* The table existed in storage engine */
#define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */
#define HA_ERR_NULL_IN_SPATIAL 158 /* NULLs are not supported in spatial index */
/* Other constants */

View File

@ -32,9 +32,6 @@ C_MODE_END
#endif
#if defined(USE_RAID)
#ifdef __GNUC__
#pragma interface /* gcc class implementation */
#endif
#include "my_dir.h"
/* Trap all occurences of my_...() in source and use our wrapper around this function */
@ -92,6 +89,10 @@ extern "C" {
#ifdef __cplusplus
}
#ifdef __GNUC__
#pragma interface /* gcc class implementation */
#endif
class RaidName {
public:
RaidName(const char *FileName);

View File

@ -2391,6 +2391,8 @@ dict_scan_id(
ulint len = 0;
const char* s;
char* d;
ulint id_len;
byte* b;
*id = NULL;
@ -2452,6 +2454,28 @@ dict_scan_id(
*id = s;
}
if (heap && !quote) {
/* EMS MySQL Manager sometimes adds characters 0xA0 (in
latin1, a 'non-breakable space') to the end of a table name.
But isspace(0xA0) is not true, which confuses our foreign key
parser. After the UTF-8 conversion in ha_innodb.cc, bytes 0xC2
and 0xA0 are at the end of the string.
TODO: we should lex the string using thd->charset_info, and
my_isspace(). Only after that, convert id names to UTF-8. */
b = (byte*)(*id);
id_len = strlen(b);
if (id_len >= 3 && b[id_len - 1] == 0xA0
&& b[id_len - 2] == 0xC2) {
/* Strip the 2 last bytes */
b[id_len - 2] = '\0';
}
}
return(ptr);
}
@ -2506,7 +2530,7 @@ dict_scan_col(
}
/*************************************************************************
Scans the referenced table name from an SQL string. */
Scans a table name from an SQL string. */
static
const char*
dict_scan_table_name(
@ -2517,7 +2541,7 @@ dict_scan_table_name(
const char* name, /* in: foreign key table name */
ibool* success,/* out: TRUE if ok name found */
mem_heap_t* heap, /* in: heap where to allocate the id */
const char** ref_name)/* out,own: the referenced table name;
const char** ref_name)/* out,own: the table name;
NULL if no name was scannable */
{
const char* database_name = NULL;

View File

@ -766,6 +766,22 @@ dict_load_table(
return(NULL);
}
#if MYSQL_VERSION_ID < 50300
/* Starting from MySQL 5.0.3, the high-order bit of MIX_LEN is the
"compact format" flag. */
field = rec_get_nth_field(rec, 7, &len);
if (mach_read_from_1(field) & 0x80) {
btr_pcur_close(&pcur);
mtr_commit(&mtr);
mem_heap_free(heap);
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: table %s is in the new compact format\n"
"InnoDB: of MySQL 5.0.3 or later\n", name);
return(NULL);
}
#endif /* MYSQL_VERSION_ID < 50300 */
ut_a(0 == ut_strcmp("SPACE",
dict_field_get_col(
dict_index_get_nth_field(sys_index, 9))->name));

View File

@ -398,10 +398,19 @@ os_file_lock(
lk.l_start = lk.l_len = 0;
if (fcntl(fd, F_SETLK, &lk) == -1) {
fprintf(stderr,
"InnoDB: Unable to lock %s, error: %d", name, errno);
"InnoDB: Unable to lock %s, error: %d\n", name, errno);
if (errno == EAGAIN || errno == EACCES) {
fprintf(stderr,
"InnoDB: Check that you do not already have another mysqld process\n"
"InnoDB: using the same InnoDB data or log files.\n");
}
close(fd);
return(-1);
}
return(0);
}
#endif /* USE_FILE_LOCK */

View File

@ -1573,7 +1573,6 @@ srv_printf_innodb_monitor(
srv_last_monitor_time = time(NULL);
rewind(file);
fputs("\n=====================================\n", file);
ut_print_timestamp(file);

View File

@ -78,7 +78,9 @@ const char *client_errors[]=
"Invalid connection handle",
"Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)",
"Row retrieval was canceled by mysql_stmt_close() call",
"Attempt to read column without prior row fetch"
"Attempt to read column without prior row fetch",
"Prepared statement contains no metadata",
""
};
/* Start of code added by Roberto M. Serqueira - martinsc@uol.com.br - 05.24.2001 */
@ -137,7 +139,9 @@ const char *client_errors[]=
"Invalid connection handle",
"Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)",
"Row retrieval was canceled by mysql_stmt_close() call",
"Attempt to read column without prior row fetch"
"Attempt to read column without prior row fetch",
"Prepared statement contains no metadata",
""
};
#else /* ENGLISH */
@ -194,7 +198,9 @@ const char *client_errors[]=
"Invalid connection handle",
"Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)",
"Row retrieval was canceled by mysql_stmt_close() call",
"Attempt to read column without prior row fetch"
"Attempt to read column without prior row fetch",
"Prepared statement contains no metadata",
""
};
#endif

View File

@ -158,7 +158,8 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
(void) signal(SIGPIPE, SIG_IGN);
#endif
#ifdef EMBEDDED_LIBRARY
result= init_embedded_server(argc, argv, groups);
if (argc > -1)
result= init_embedded_server(argc, argv, groups);
#endif
}
#ifdef THREAD
@ -2165,12 +2166,12 @@ static void update_stmt_fields(MYSQL_STMT *stmt)
DESCRIPTION
This function should be used after mysql_stmt_execute().
You can safely check that prepared statement has a result set by calling
mysql_stmt_num_fields(): if number of fields is not zero, you can call
mysql_stmt_field_count(): if number of fields is not zero, you can call
this function to get fields metadata.
Next steps you may want to make:
- find out number of columns in result set by calling
mysql_num_fields(res) (the same value is returned by
mysql_stmt_num_fields)
mysql_stmt_field_count())
- fetch metadata for any column with mysql_fetch_field,
mysql_fetch_field_direct, mysql_fetch_fields, mysql_field_seek.
- free returned MYSQL_RES structure with mysql_free_result.
@ -3875,8 +3876,8 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
case MYSQL_TYPE_INT24: /* mediumint is sent as 4 bytes int */
case MYSQL_TYPE_LONG:
{
long value= sint4korr(*row);
longlong data= field_is_unsigned ? (longlong) (unsigned long) value :
int32 value= sint4korr(*row);
longlong data= field_is_unsigned ? (longlong) (uint32) value :
(longlong) value;
fetch_long_with_conversion(param, field, data, 0);
*row+= 4;
@ -4334,11 +4335,10 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
if (!bind_count)
{
if ((int) stmt->state < (int) MYSQL_STMT_PREPARE_DONE)
{
set_stmt_error(stmt, CR_NO_PREPARE_STMT, unknown_sqlstate);
}
DBUG_RETURN(0);
int errorcode= (int) stmt->state < (int) MYSQL_STMT_PREPARE_DONE ?
CR_NO_PREPARE_STMT : CR_NO_STMT_METADATA;
set_stmt_error(stmt, errorcode, unknown_sqlstate);
DBUG_RETURN(1);
}
/*
@ -4623,7 +4623,7 @@ static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data)
row+= (stmt->field_count+9)/8; /* skip null bits */
bit= 4; /* first 2 bits are reserved */
/* Go throw all fields and calculate metadata */
/* Go through all fields and calculate metadata */
for (bind= stmt->bind, end= bind + stmt->field_count, field= stmt->fields ;
bind < end ;
bind++, field++)
@ -4758,6 +4758,12 @@ mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong row)
for (; tmp && row; --row, tmp= tmp->next)
;
stmt->data_cursor= tmp;
if (!row && tmp)
{
/* Rewind the counter */
stmt->read_row_func= stmt_read_row_buffered;
stmt->state= MYSQL_STMT_EXECUTE_DONE;
}
DBUG_VOID_RETURN;
}

View File

@ -591,6 +591,32 @@ err:
C_MODE_END
static char *dup_str_aux(MEM_ROOT *root, const char *from, uint length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
{
uint32 dummy32;
uint dummy_err;
char *result;
/* 'tocs' is set 0 when client issues SET character_set_results=NULL */
if (tocs && String::needs_conversion(0, fromcs, tocs, &dummy32))
{
uint new_len= (tocs->mbmaxlen * length) / fromcs->mbminlen + 1;
result= (char *)alloc_root(root, new_len);
length= copy_and_convert(result, new_len,
tocs, from, length, fromcs, &dummy_err);
}
else
{
result= (char *)alloc_root(root, length + 1);
memcpy(result, from, length);
}
result[length]= 0;
return result;
}
bool Protocol::send_fields(List<Item> *list, uint flags)
{
List_iterator_fast<Item> it(*list);
@ -598,6 +624,8 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
MYSQL_FIELD *client_field;
MYSQL *mysql= thd->mysql;
MEM_ROOT *field_alloc;
CHARSET_INFO *thd_cs= thd->variables.character_set_results;
CHARSET_INFO *cs= system_charset_info;
DBUG_ENTER("send_fields");
@ -616,12 +644,29 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
Send_field server_field;
item->make_field(&server_field);
client_field->db= strdup_root(field_alloc, server_field.db_name);
client_field->table= strdup_root(field_alloc, server_field.table_name);
client_field->name= strdup_root(field_alloc, server_field.col_name);
client_field->org_table= strdup_root(field_alloc, server_field.org_table_name);
client_field->org_name= strdup_root(field_alloc, server_field.org_col_name);
client_field->length= server_field.length;
client_field->db= dup_str_aux(field_alloc, server_field.db_name,
strlen(server_field.db_name), cs, thd_cs);
client_field->table= dup_str_aux(field_alloc, server_field.table_name,
strlen(server_field.table_name), cs, thd_cs);
client_field->name= dup_str_aux(field_alloc, server_field.col_name,
strlen(server_field.col_name), cs, thd_cs);
client_field->org_table= dup_str_aux(field_alloc, server_field.org_table_name,
strlen(server_field.org_table_name), cs, thd_cs);
client_field->org_name= dup_str_aux(field_alloc, server_field.org_col_name,
strlen(server_field.org_col_name), cs, thd_cs);
if (item->collation.collation == &my_charset_bin || thd_cs == NULL)
{
/* No conversion */
client_field->charsetnr= server_field.charsetnr;
client_field->length= server_field.length;
}
else
{
/* With conversion */
client_field->charsetnr= thd_cs->number;
uint char_len= server_field.length / item->collation.collation->mbmaxlen;
client_field->length= char_len * thd_cs->mbmaxlen;
}
client_field->type= server_field.type;
client_field->flags= server_field.flags;
client_field->decimals= server_field.decimals;
@ -630,9 +675,8 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
client_field->name_length= strlen(client_field->name);
client_field->org_name_length= strlen(client_field->org_name);
client_field->org_table_length= strlen(client_field->org_table);
client_field->charsetnr= server_field.charsetnr;
client_field->catalog= strdup_root(field_alloc, "def");
client_field->catalog= dup_str_aux(field_alloc, "def", 3, cs, thd_cs);
client_field->catalog_length= 3;
if (INTERNAL_NUM_FIELD(client_field))
@ -710,6 +754,7 @@ bool Protocol_prep::write()
}
cur->data= (MYSQL_ROW)(((char *)cur) + sizeof(MYSQL_ROWS));
memcpy(cur->data, packet->ptr()+1, packet->length()-1);
cur->length= packet->length(); /* To allow us to do sanity checks */
*data->prev_ptr= cur;
data->prev_ptr= &cur->next;
@ -804,21 +849,3 @@ bool Protocol::net_store_data(const char *from, uint length)
return false;
}
#if 0
/* The same as Protocol::net_store_data but does the converstion
*/
bool Protocol::convert_str(const char *from, uint length)
{
if (!(*next_field=alloc_root(alloc, length + 1)))
return true;
convert->store_dest(*next_field, from, length);
(*next_field)[length]= 0;
if (next_mysql_field->max_length < length)
next_mysql_field->max_length=length;
++next_field;
++next_mysql_field;
return false;
}
#endif

View File

@ -155,7 +155,7 @@ static void _ftb_parse_query(FTB *ftb, byte **start, byte *end,
ftbw=(FTB_WORD *)alloc_root(&ftb->mem_root,
sizeof(FTB_WORD) +
(param.trunc ? MI_MAX_KEY_BUFF :
w.len+extra));
w.len*ftb->charset->mbmaxlen+extra));
ftbw->len=w.len+1;
ftbw->flags=0;
ftbw->off=0;

View File

@ -26,6 +26,7 @@
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
#include "rt_index.h"
#ifndef USE_RAID
#define my_raid_create(A,B,C,D,E,F,G) my_create(A,B,C,G)
@ -1466,6 +1467,12 @@ static int writekeys(MI_CHECK *param, register MI_INFO *info, byte *buff,
if (_mi_ft_add(info,i,(char*) key,buff,filepos))
goto err;
}
else if (info->s->keyinfo[i].flag & HA_SPATIAL)
{
uint key_length=_mi_make_key(info,i,key,buff,filepos);
if (rtree_insert(info, i, key, key_length))
goto err;
}
else
{
uint key_length=_mi_make_key(info,i,key,buff,filepos);
@ -3988,7 +3995,8 @@ static my_bool mi_too_big_key_for_sort(MI_KEYDEF *key, ha_rows rows)
key->seg->charset->mbmaxlen;
key_maxlength+=ft_max_word_len_for_sort-HA_FT_MAXBYTELEN;
}
return (key->flag & (HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY | HA_FULLTEXT) &&
return (key->flag & HA_SPATIAL) ||
(key->flag & (HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY | HA_FULLTEXT) &&
((ulonglong) rows * key_maxlength >
(ulonglong) myisam_max_temp_length));
}

View File

@ -92,6 +92,10 @@ int mi_rnext_same(MI_INFO *info, byte *buf)
if (my_errno == HA_ERR_KEY_NOT_FOUND)
my_errno=HA_ERR_END_OF_FILE;
}
else if (!buf)
{
DBUG_RETURN(info->lastpos==HA_OFFSET_ERROR ? my_errno : 0);
}
else if (!(*info->read_record)(info,info->lastpos,buf))
{
info->update|= HA_STATE_AKTIV; /* Record is read */

View File

@ -124,8 +124,8 @@ int mi_write(MI_INFO *info, byte *record)
{
if (local_lock_tree)
rw_unlock(&share->key_root_lock[i]);
DBUG_PRINT("error",("Got error: %d on write",my_errno));
goto err;
DBUG_PRINT("error",("Got error: %d on write",my_errno));
goto err;
}
}
if (local_lock_tree)
@ -159,7 +159,8 @@ int mi_write(MI_INFO *info, byte *record)
err:
save_errno=my_errno;
if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL)
if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL ||
my_errno == HA_ERR_NULL_IN_SPATIAL)
{
if (info->bulk_insert)
{

View File

@ -710,7 +710,8 @@ err1:
int rtree_insert(MI_INFO *info, uint keynr, uchar *key, uint key_length)
{
return (rtree_insert_level(info, keynr, key, key_length, -1) == -1) ? -1 : 0;
return (!key_length ||
(rtree_insert_level(info, keynr, key, key_length, -1) == -1)) ? -1 : 0;
}

View File

@ -84,7 +84,9 @@ static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info,
IO_CACHE *to_file,
char* key, uint sort_length,
uint count);
inline int my_var_write(MI_SORT_PARAM *info,IO_CACHE *to_file, byte *bufs);
static inline int
my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, byte *bufs);
/*
Creates a index of sorted keys
@ -625,7 +627,8 @@ static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys,
} /* write_keys */
inline int my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, byte *bufs)
static inline int
my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, byte *bufs)
{
int err;
uint16 len = _mi_keylength(info->keyinfo, (uchar*) bufs);

View File

@ -50,6 +50,11 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
dlen = _mi_calc_blob_length(keyseg->bit_start, pos);
memcpy_fixed(&dptr, pos + keyseg->bit_start, sizeof(char*));
if (!dptr)
{
my_errno= HA_ERR_NULL_IN_SPATIAL;
return 0;
}
sp_mbr_from_wkb(dptr + 4, dlen - 4, SPDIMS, mbr); /* SRID */
for (i = 0, keyseg = keyinfo->seg; keyseg->type; keyseg++, i++)

View File

@ -16,25 +16,36 @@
#include "myrg_def.h"
int myrg_rnext_same(MYRG_INFO *info, byte *buf)
{
uint err;
int err;
MI_INFO *mi;
if (!info->current_table)
return (HA_ERR_KEY_NOT_FOUND);
err=mi_rnext_same(info->current_table->table,buf);
if (err == HA_ERR_END_OF_FILE)
/* at first, do rnext for the table found before */
if ((err=mi_rnext_same(info->current_table->table,NULL)))
{
queue_remove(&(info->by_key),0);
if (!info->by_key.elements)
return HA_ERR_END_OF_FILE;
mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;
mi->once_flags|= RRND_PRESERVE_LASTINX;
return mi_rrnd(mi,buf,mi->lastpos);
if (err == HA_ERR_END_OF_FILE)
{
queue_remove(&(info->by_key),0);
if (!info->by_key.elements)
return HA_ERR_END_OF_FILE;
}
else
return err;
}
return err;
else
{
/* Found here, adding to queue */
queue_top(&(info->by_key))=(byte *)(info->current_table);
queue_replaced(&(info->by_key));
}
/* now, mymerge's read_next is as simple as one queue_top */
mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;
return _myrg_mi_read_record(mi,buf);
}

View File

@ -39,7 +39,7 @@ CLEANFILES = $(test_SCRIPTS) $(test_DATA)
INCLUDES = -I$(srcdir)/../include -I../include -I..
EXTRA_PROGRAMS = mysql_test_run_new
noinst_HEADERS = my_manage.h
mysql_test_run_new_SOURCES= mysql_test_run_new.c my_manage.c
mysql_test_run_new_SOURCES= mysql_test_run_new.c my_manage.c my_create_tables.c
dist-hook:

View File

@ -25,6 +25,7 @@ USE d1;
CREATE TABLE t1 (c CHAR(10), KEY(c));
--enable_warnings
# check the column was created with the expected charset/collation
--replace_result select,insert,update,references ""
SHOW FULL COLUMNS FROM t1;
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
@ -37,6 +38,7 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
--enable_warnings
# check the column was created with the expected charset/collation
--replace_result select,insert,update,references ""
SHOW FULL COLUMNS FROM t1;
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
SELECT c1 as want3results from t1 where c1 like 'l%';

View File

@ -65,6 +65,9 @@ execute stmt1 using @1000, @duplicate, @5;
select a,b from t1 where a >= 1000 order by a ;
delete from t1 where a >= 1000 ;
set @1=1 ;
set @2=2 ;
set @100=100 ;
set @float=1.00;
set @five='five' ;
--disable_warnings

View File

@ -0,0 +1,646 @@
#include <stdio.h>
#include <errno.h>
#ifndef __WIN__
#include <dirent.h>
#endif
#include <string.h>
#ifdef __NETWARE__
#include <screen.h>
#include <proc.h>
#else
#include <sys/types.h>
#ifndef __WIN__
#include <sys/wait.h>
#include <unistd.h>
#else
#include <direct.h>
#include <stdlib.h>
#include <stdio.h>
#endif
#endif
#include <ctype.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <assert.h>
#include "my_manage.h"
/*
Synopsis:
This function testes a exist file
Arguments:
mdata: path to data
file_name: name of file
Output:
A zero value indicates that file is exist.
*/
bool test_sys_file(const char *mdata,const char *file_name)
{
struct stat file;
char path_file_name[PATH_MAX];
snprintf(path_file_name, PATH_MAX, "%s/%s", mdata, file_name);
return(stat(path_file_name,&file));
}
/*
Synopsis:
This function creates a file with sql requstes for creating
system data files.
Arguments:
mdata: path to data
output_file: file name for output file
test: to create system files with test data
Output:
A zero value indicates a success.
*/
bool create_system_files(const char *mdata,const char *output_file, bool test)
{
FILE *out;
out = fopen(output_file, "w+");
if (!out)
return 1;
if (test_sys_file(mdata,"mysql"))
{
fprintf(out,"CREATE DATABASE mysql;\n");
}
if (test && test_sys_file(mdata,"test"))
{
fprintf(out,"CREATE DATABASE test;\n");
}
fprintf(out,"USE mysql;\n");
if (test_sys_file(mdata,"mysql/db.frm"))
{
fprintf(out,
"CREATE TABLE db ("
"Host char(60) binary DEFAULT '' NOT NULL,"
"Db char(64) binary DEFAULT '' NOT NULL,"
"User char(16) binary DEFAULT '' NOT NULL,"
"Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"PRIMARY KEY Host (Host,Db,User),"
"KEY User (User))"
"comment='Database privileges';\n");
if (test)
{
fprintf(out,"INSERT INTO db VALUES ('%%','test','','Y','Y','Y','Y'"
",'Y','Y','N','Y','Y','Y','Y','Y');\n");
fprintf(out,"INSERT INTO db VALUES ('%%','test\\_%%','','Y','Y','Y'"
",'Y','Y','Y','N','Y','Y','Y','Y','Y');\n");
}
}
if (test_sys_file(mdata,"mysql/host.frm"))
{
fprintf(out,
"CREATE TABLE host ("
"Host char(60) binary DEFAULT '' NOT NULL,"
"Db char(64) binary DEFAULT '' NOT NULL,"
"Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"PRIMARY KEY Host (Host,Db))"
"comment='Host privileges;"
" Merged with database privileges';\n");
}
if (test_sys_file(mdata,"mysql/user.frm"))
{
#ifdef __WIN__
WSADATA wsa_data;
#endif
char hostname[FN_REFLEN];
#ifdef __WIN__
if (WSAStartup(MAKEWORD( 2, 2 ),&wsa_data))
return 1;
#endif
if (gethostname(hostname, FN_REFLEN))
return 1;
#ifdef __WIN__
WSACleanup( );
#endif
if (strchr(hostname, '.') == NULL)
strcat(hostname, "%");
fprintf(out,
"CREATE TABLE user ("
"Host char(60) binary DEFAULT '' NOT NULL,"
"User char(16) binary DEFAULT '' NOT NULL,"
"Password char(41) binary DEFAULT '' NOT NULL,"
"Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"File_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Super_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL,"
"ssl_cipher BLOB NOT NULL,"
"x509_issuer BLOB NOT NULL,"
"x509_subject BLOB NOT NULL,"
"max_questions int(11) unsigned DEFAULT 0 NOT NULL,"
"max_updates int(11) unsigned DEFAULT 0 NOT NULL,"
"max_connections int(11) unsigned DEFAULT 0 NOT NULL,"
"PRIMARY KEY Host (Host,User)"
") comment='Users and global privileges';\n");
if (test)
{
fprintf(out,
"INSERT INTO user VALUES ('localhost','root',''"
",'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'"
",'Y','Y','Y','Y','Y','','','','',0,0,0);\n");
fprintf(out,
"INSERT INTO user VALUES ('%s','root','','Y','Y',"
"'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y',"
"'Y','Y','Y','Y','','','','',0,0,0);\n",hostname);
fprintf(out,
"REPLACE INTO user VALUES ('127.0.0.1','root','',"
"'Y','Y','Y','Y','Y','Y',"
"'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'"
",'Y','','','','',0,0,0);\n");
fprintf(out,"INSERT INTO user (host,user) values ('localhost','');\n");
fprintf(out,"INSERT INTO user (host,user) values ('%s','');\n",hostname);
}
else
{
fprintf(out,
"INSERT INTO user VALUES ('localhost','root','',"
"'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y',"
"'Y','Y','Y','Y','','','','',0,0,0);\n");
#ifndef __WIN__
fprintf(out,
"INSERT INTO user VALUES ('%s','root','','Y','Y',"
"'Y','Y','Y','Y','Y','Y'"
"'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','',''"
",'','',0,0,0);\n",hostname);
fprintf(out,"INSERT INTO user (host,user) values ('%s','');\n",hostname);
fprintf(out,"INSERT INTO user (host,user) values ('localhost','');\n");
#else
fprintf(out,
"INSERT INTO user VALUES ('localhost','','','Y','Y','Y'"
",'Y','Y','Y','Y','Y','Y'"
",'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','',"
"'','',0,0,0);\n");
#endif
}
}
if (test_sys_file(mdata,"mysql/func.frm"))
{
fprintf(out,
"CREATE TABLE func ("
"name char(64) binary DEFAULT '' NOT NULL,"
"ret tinyint(1) DEFAULT '0' NOT NULL,"
"dl char(128) DEFAULT '' NOT NULL,"
"type enum ('function','aggregate') NOT NULL,"
"PRIMARY KEY (name)"
") comment='User defined functions';\n");
}
if (test_sys_file(mdata,"mysql/tables_priv.frm"))
{
fprintf(out,
"CREATE TABLE tables_priv ("
"Host char(60) binary DEFAULT '' NOT NULL,"
"Db char(64) binary DEFAULT '' NOT NULL,"
"User char(16) binary DEFAULT '' NOT NULL,"
"Table_name char(64) binary DEFAULT '' NOT NULL,"
"Grantor char(77) DEFAULT '' NOT NULL,"
"Timestamp timestamp(14),"
"Table_priv set('Select','Insert','Update','Delete',"
"'Create','Drop','Grant','References','Index','Alter')"
" DEFAULT '' NOT NULL,"
"Column_priv set('Select','Insert','Update','References')"
" DEFAULT '' NOT NULL,"
"PRIMARY KEY (Host,Db,User,Table_name),"
"KEY Grantor (Grantor)"
") comment='Table privileges';\n");
}
if (test_sys_file(mdata,"mysql/columns_priv.frm"))
{
fprintf(out,
"CREATE TABLE columns_priv ("
"Host char(60) binary DEFAULT '' NOT NULL,"
"Db char(64) binary DEFAULT '' NOT NULL,"
"User char(16) binary DEFAULT '' NOT NULL,"
"Table_name char(64) binary DEFAULT '' NOT NULL,"
"Column_name char(64) binary DEFAULT '' NOT NULL,"
"Timestamp timestamp(14),"
"Column_priv set('Select','Insert','Update','References')"
" DEFAULT '' NOT NULL,"
"PRIMARY KEY (Host,Db,User,Table_name,Column_name)"
") comment='Column privileges';\n");
}
if (test_sys_file(mdata,"mysql/help_topic.frm"))
{
fprintf(out,
"CREATE TABLE help_topic ("
"help_topic_id int unsigned not null,"
"name varchar(64) not null,"
"help_category_id smallint unsigned not null,"
"description text not null,"
"example text not null,"
"url varchar(128) not null,"
"primary key (help_topic_id),"
"unique index (name)"
") comment='help topics';\n");
}
if (test_sys_file(mdata,"mysql/help_category.frm"))
{
fprintf(out,
"CREATE TABLE help_category ("
"help_category_id smallint unsigned not null,"
"name varchar(64) not null,"
"parent_category_id smallint unsigned null,"
"url varchar(128) not null,"
"primary key (help_category_id),"
"unique index (name)"
") comment='help categories';\n");
}
if (test_sys_file(mdata,"mysql/help_keyword.frm"))
{
fprintf(out,
"CREATE TABLE help_keyword ("
"help_keyword_id int unsigned not null,"
"name varchar(64) not null,"
"primary key (help_keyword_id),"
"unique index (name)"
") comment='help keywords';\n");
}
if (test_sys_file(mdata,"mysql/help_relation.frm"))
{
fprintf(out,
"CREATE TABLE help_relation ("
"help_topic_id int unsigned not null references help_topic,"
"help_keyword_id int unsigned not null references help_keyword,"
"primary key (help_keyword_id, help_topic_id)"
") comment='keyword-topic relation';\n");
}
if (test_sys_file(mdata,"mysql/time_zone_name.frm"))
{
fprintf(out,
"CREATE TABLE time_zone_name ("
"Name char(64) NOT NULL,"
"Time_zone_id int unsigned NOT NULL,"
"PRIMARY KEY Name (Name)"
") DEFAULT CHARACTER SET latin1 "
"comment='Time zone names';\n");
if (test)
{
fprintf(out,
"INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES"
"('MET', 1), ('UTC', 2), ('Universal', 2), "
"('Europe/Moscow',3), ('leap/Europe/Moscow',4);\n");
}
}
if (test_sys_file(mdata,"mysql/time_zone.frm"))
{
fprintf(out,
"CREATE TABLE time_zone ("
"Time_zone_id int unsigned NOT NULL auto_increment,"
"Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,"
"PRIMARY KEY TzId (Time_zone_id)"
") DEFAULT CHARACTER SET latin1 "
"comment='Time zones';\n");
if (test)
{
fprintf(out,"INSERT INTO time_zone (Time_zone_id, Use_leap_seconds)"
"VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y');\n");
}
}
if (test_sys_file(mdata,"mysql/time_zone_transition.frm"))
{
fprintf(out,
"CREATE TABLE time_zone_transition ("
"Time_zone_id int unsigned NOT NULL,"
"Transition_time bigint signed NOT NULL,"
"Transition_type_id int unsigned NOT NULL,"
"PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)"
") DEFAULT CHARACTER SET latin1 "
"comment='Time zone transitions';\n");
if (test)
{
fprintf(out,
"INSERT INTO time_zone_transition"
"(Time_zone_id, Transition_time, Transition_type_id)"
"VALUES"
" (1, -1693706400, 0) ,(1, -1680483600, 1)"
",(1, -1663455600, 2) ,(1, -1650150000, 3)"
",(1, -1632006000, 2) ,(1, -1618700400, 3)"
",(1, -938905200, 2) ,(1, -857257200, 3)"
",(1, -844556400, 2) ,(1, -828226800, 3)"
",(1, -812502000, 2) ,(1, -796777200, 3)"
",(1, 228877200, 2) ,(1, 243997200, 3)"
",(1, 260326800, 2) ,(1, 276051600, 3)"
",(1, 291776400, 2) ,(1, 307501200, 3)"
",(1, 323830800, 2) ,(1, 338950800, 3)"
",(1, 354675600, 2) ,(1, 370400400, 3)"
",(1, 386125200, 2) ,(1, 401850000, 3)"
",(1, 417574800, 2) ,(1, 433299600, 3)"
",(1, 449024400, 2) ,(1, 465354000, 3)"
",(1, 481078800, 2) ,(1, 496803600, 3)"
",(1, 512528400, 2) ,(1, 528253200, 3)"
",(1, 543978000, 2) ,(1, 559702800, 3)"
",(1, 575427600, 2) ,(1, 591152400, 3)"
",(1, 606877200, 2) ,(1, 622602000, 3)"
",(1, 638326800, 2) ,(1, 654656400, 3)"
",(1, 670381200, 2) ,(1, 686106000, 3)"
",(1, 701830800, 2) ,(1, 717555600, 3)"
",(1, 733280400, 2) ,(1, 749005200, 3)"
",(1, 764730000, 2) ,(1, 780454800, 3)"
",(1, 796179600, 2) ,(1, 811904400, 3)"
",(1, 828234000, 2) ,(1, 846378000, 3)"
",(1, 859683600, 2) ,(1, 877827600, 3)"
",(1, 891133200, 2) ,(1, 909277200, 3)"
",(1, 922582800, 2) ,(1, 941331600, 3)"
",(1, 954032400, 2) ,(1, 972781200, 3)"
",(1, 985482000, 2) ,(1, 1004230800, 3)"
",(1, 1017536400, 2) ,(1, 1035680400, 3)"
",(1, 1048986000, 2) ,(1, 1067130000, 3)"
",(1, 1080435600, 2) ,(1, 1099184400, 3)"
",(1, 1111885200, 2) ,(1, 1130634000, 3)"
",(1, 1143334800, 2) ,(1, 1162083600, 3)"
",(1, 1174784400, 2) ,(1, 1193533200, 3)"
",(1, 1206838800, 2) ,(1, 1224982800, 3)"
",(1, 1238288400, 2) ,(1, 1256432400, 3)"
",(1, 1269738000, 2) ,(1, 1288486800, 3)"
",(1, 1301187600, 2) ,(1, 1319936400, 3)"
",(1, 1332637200, 2) ,(1, 1351386000, 3)"
",(1, 1364691600, 2) ,(1, 1382835600, 3)"
",(1, 1396141200, 2) ,(1, 1414285200, 3)"
",(1, 1427590800, 2) ,(1, 1445734800, 3)"
",(1, 1459040400, 2) ,(1, 1477789200, 3)"
",(1, 1490490000, 2) ,(1, 1509238800, 3)"
",(1, 1521939600, 2) ,(1, 1540688400, 3)"
",(1, 1553994000, 2) ,(1, 1572138000, 3)"
",(1, 1585443600, 2) ,(1, 1603587600, 3)"
",(1, 1616893200, 2) ,(1, 1635642000, 3)"
",(1, 1648342800, 2) ,(1, 1667091600, 3)"
",(1, 1679792400, 2) ,(1, 1698541200, 3)"
",(1, 1711846800, 2) ,(1, 1729990800, 3)"
",(1, 1743296400, 2) ,(1, 1761440400, 3)"
",(1, 1774746000, 2) ,(1, 1792890000, 3)"
",(1, 1806195600, 2) ,(1, 1824944400, 3)"
",(1, 1837645200, 2) ,(1, 1856394000, 3)"
",(1, 1869094800, 2) ,(1, 1887843600, 3)"
",(1, 1901149200, 2) ,(1, 1919293200, 3)"
",(1, 1932598800, 2) ,(1, 1950742800, 3)"
",(1, 1964048400, 2) ,(1, 1982797200, 3)"
",(1, 1995498000, 2) ,(1, 2014246800, 3)"
",(1, 2026947600, 2) ,(1, 2045696400, 3)"
",(1, 2058397200, 2) ,(1, 2077146000, 3)"
",(1, 2090451600, 2) ,(1, 2108595600, 3)"
",(1, 2121901200, 2) ,(1, 2140045200, 3)"
",(3, -1688265000, 2) ,(3, -1656819048, 1)"
",(3, -1641353448, 2) ,(3, -1627965048, 3)"
",(3, -1618716648, 1) ,(3, -1596429048, 3)"
",(3, -1593829848, 5) ,(3, -1589860800, 4)"
",(3, -1542427200, 5) ,(3, -1539493200, 6)"
",(3, -1525323600, 5) ,(3, -1522728000, 4)"
",(3, -1491188400, 7) ,(3, -1247536800, 4)"
",(3, 354920400, 5) ,(3, 370728000, 4)"
",(3, 386456400, 5) ,(3, 402264000, 4)"
",(3, 417992400, 5) ,(3, 433800000, 4)"
",(3, 449614800, 5) ,(3, 465346800, 8)"
",(3, 481071600, 9) ,(3, 496796400, 8)"
",(3, 512521200, 9) ,(3, 528246000, 8)"
",(3, 543970800, 9) ,(3, 559695600, 8)"
",(3, 575420400, 9) ,(3, 591145200, 8)"
",(3, 606870000, 9) ,(3, 622594800, 8)"
",(3, 638319600, 9) ,(3, 654649200, 8)"
",(3, 670374000, 10) ,(3, 686102400, 11)"
",(3, 695779200, 8) ,(3, 701812800, 5)"
",(3, 717534000, 4) ,(3, 733273200, 9)"
",(3, 748998000, 8) ,(3, 764722800, 9)"
",(3, 780447600, 8) ,(3, 796172400, 9)"
",(3, 811897200, 8) ,(3, 828226800, 9)"
",(3, 846370800, 8) ,(3, 859676400, 9)"
",(3, 877820400, 8) ,(3, 891126000, 9)"
",(3, 909270000, 8) ,(3, 922575600, 9)"
",(3, 941324400, 8) ,(3, 954025200, 9)"
",(3, 972774000, 8) ,(3, 985474800, 9)"
",(3, 1004223600, 8) ,(3, 1017529200, 9)"
",(3, 1035673200, 8) ,(3, 1048978800, 9)"
",(3, 1067122800, 8) ,(3, 1080428400, 9)"
",(3, 1099177200, 8) ,(3, 1111878000, 9)"
",(3, 1130626800, 8) ,(3, 1143327600, 9)"
",(3, 1162076400, 8) ,(3, 1174777200, 9)"
",(3, 1193526000, 8) ,(3, 1206831600, 9)"
",(3, 1224975600, 8) ,(3, 1238281200, 9)"
",(3, 1256425200, 8) ,(3, 1269730800, 9)"
",(3, 1288479600, 8) ,(3, 1301180400, 9)"
",(3, 1319929200, 8) ,(3, 1332630000, 9)"
",(3, 1351378800, 8) ,(3, 1364684400, 9)"
",(3, 1382828400, 8) ,(3, 1396134000, 9)"
",(3, 1414278000, 8) ,(3, 1427583600, 9)"
",(3, 1445727600, 8) ,(3, 1459033200, 9)"
",(3, 1477782000, 8) ,(3, 1490482800, 9)"
",(3, 1509231600, 8) ,(3, 1521932400, 9)"
",(3, 1540681200, 8) ,(3, 1553986800, 9)"
",(3, 1572130800, 8) ,(3, 1585436400, 9)"
",(3, 1603580400, 8) ,(3, 1616886000, 9)"
",(3, 1635634800, 8) ,(3, 1648335600, 9)"
",(3, 1667084400, 8) ,(3, 1679785200, 9)"
",(3, 1698534000, 8) ,(3, 1711839600, 9)"
",(3, 1729983600, 8) ,(3, 1743289200, 9)"
",(3, 1761433200, 8) ,(3, 1774738800, 9)"
",(3, 1792882800, 8) ,(3, 1806188400, 9)"
",(3, 1824937200, 8) ,(3, 1837638000, 9)"
",(3, 1856386800, 8) ,(3, 1869087600, 9)"
",(3, 1887836400, 8) ,(3, 1901142000, 9)"
",(3, 1919286000, 8) ,(3, 1932591600, 9)"
",(3, 1950735600, 8) ,(3, 1964041200, 9)"
",(3, 1982790000, 8) ,(3, 1995490800, 9)"
",(3, 2014239600, 8) ,(3, 2026940400, 9)"
",(3, 2045689200, 8) ,(3, 2058390000, 9)"
",(3, 2077138800, 8) ,(3, 2090444400, 9)"
",(3, 2108588400, 8) ,(3, 2121894000, 9)"
",(3, 2140038000, 8)"
",(4, -1688265000, 2) ,(4, -1656819048, 1)"
",(4, -1641353448, 2) ,(4, -1627965048, 3)"
",(4, -1618716648, 1) ,(4, -1596429048, 3)"
",(4, -1593829848, 5) ,(4, -1589860800, 4)"
",(4, -1542427200, 5) ,(4, -1539493200, 6)"
",(4, -1525323600, 5) ,(4, -1522728000, 4)"
",(4, -1491188400, 7) ,(4, -1247536800, 4)"
",(4, 354920409, 5) ,(4, 370728010, 4)"
",(4, 386456410, 5) ,(4, 402264011, 4)"
",(4, 417992411, 5) ,(4, 433800012, 4)"
",(4, 449614812, 5) ,(4, 465346812, 8)"
",(4, 481071612, 9) ,(4, 496796413, 8)"
",(4, 512521213, 9) ,(4, 528246013, 8)"
",(4, 543970813, 9) ,(4, 559695613, 8)"
",(4, 575420414, 9) ,(4, 591145214, 8)"
",(4, 606870014, 9) ,(4, 622594814, 8)"
",(4, 638319615, 9) ,(4, 654649215, 8)"
",(4, 670374016, 10) ,(4, 686102416, 11)"
",(4, 695779216, 8) ,(4, 701812816, 5)"
",(4, 717534017, 4) ,(4, 733273217, 9)"
",(4, 748998018, 8) ,(4, 764722818, 9)"
",(4, 780447619, 8) ,(4, 796172419, 9)"
",(4, 811897219, 8) ,(4, 828226820, 9)"
",(4, 846370820, 8) ,(4, 859676420, 9)"
",(4, 877820421, 8) ,(4, 891126021, 9)"
",(4, 909270021, 8) ,(4, 922575622, 9)"
",(4, 941324422, 8) ,(4, 954025222, 9)"
",(4, 972774022, 8) ,(4, 985474822, 9)"
",(4, 1004223622, 8) ,(4, 1017529222, 9)"
",(4, 1035673222, 8) ,(4, 1048978822, 9)"
",(4, 1067122822, 8) ,(4, 1080428422, 9)"
",(4, 1099177222, 8) ,(4, 1111878022, 9)"
",(4, 1130626822, 8) ,(4, 1143327622, 9)"
",(4, 1162076422, 8) ,(4, 1174777222, 9)"
",(4, 1193526022, 8) ,(4, 1206831622, 9)"
",(4, 1224975622, 8) ,(4, 1238281222, 9)"
",(4, 1256425222, 8) ,(4, 1269730822, 9)"
",(4, 1288479622, 8) ,(4, 1301180422, 9)"
",(4, 1319929222, 8) ,(4, 1332630022, 9)"
",(4, 1351378822, 8) ,(4, 1364684422, 9)"
",(4, 1382828422, 8) ,(4, 1396134022, 9)"
",(4, 1414278022, 8) ,(4, 1427583622, 9)"
",(4, 1445727622, 8) ,(4, 1459033222, 9)"
",(4, 1477782022, 8) ,(4, 1490482822, 9)"
",(4, 1509231622, 8) ,(4, 1521932422, 9)"
",(4, 1540681222, 8) ,(4, 1553986822, 9)"
",(4, 1572130822, 8) ,(4, 1585436422, 9)"
",(4, 1603580422, 8) ,(4, 1616886022, 9)"
",(4, 1635634822, 8) ,(4, 1648335622, 9)"
",(4, 1667084422, 8) ,(4, 1679785222, 9)"
",(4, 1698534022, 8) ,(4, 1711839622, 9)"
",(4, 1729983622, 8) ,(4, 1743289222, 9)"
",(4, 1761433222, 8) ,(4, 1774738822, 9)"
",(4, 1792882822, 8) ,(4, 1806188422, 9)"
",(4, 1824937222, 8) ,(4, 1837638022, 9)"
",(4, 1856386822, 8) ,(4, 1869087622, 9)"
",(4, 1887836422, 8) ,(4, 1901142022, 9)"
",(4, 1919286022, 8) ,(4, 1932591622, 9)"
",(4, 1950735622, 8) ,(4, 1964041222, 9)"
",(4, 1982790022, 8) ,(4, 1995490822, 9)"
",(4, 2014239622, 8) ,(4, 2026940422, 9)"
",(4, 2045689222, 8) ,(4, 2058390022, 9)"
",(4, 2077138822, 8) ,(4, 2090444422, 9)"
",(4, 2108588422, 8) ,(4, 2121894022, 9)"
",(4, 2140038022, 8);\n");
}
}
if (test_sys_file(mdata,"mysql/time_zone_transition_type.frm"))
{
fprintf(out,
"CREATE TABLE time_zone_transition_type ("
"Time_zone_id int unsigned NOT NULL,"
"Transition_type_id int unsigned NOT NULL,"
"Offset int signed DEFAULT 0 NOT NULL,"
"Is_DST tinyint unsigned DEFAULT 0 NOT NULL,"
"Abbreviation char(8) DEFAULT '' NOT NULL,"
"PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)"
") DEFAULT CHARACTER SET latin1 "
"comment='Time zone transition types';\n");
if (test)
{
fprintf(out,
"INSERT INTO time_zone_transition_type (Time_zone_id,"
"Transition_type_id, Offset, Is_DST, Abbreviation) VALUES"
"(1, 0, 7200, 1, 'MEST') ,(1, 1, 3600, 0, 'MET')"
",(1, 2, 7200, 1, 'MEST') ,(1, 3, 3600, 0, 'MET')"
",(2, 0, 0, 0, 'UTC')"
",(3, 0, 9000, 0, 'MMT') ,(3, 1, 12648, 1, 'MST')"
",(3, 2, 9048, 0, 'MMT') ,(3, 3, 16248, 1, 'MDST')"
",(3, 4, 10800, 0, 'MSK') ,(3, 5, 14400, 1, 'MSD')"
",(3, 6, 18000, 1, 'MSD') ,(3, 7, 7200, 0, 'EET')"
",(3, 8, 10800, 0, 'MSK') ,(3, 9, 14400, 1, 'MSD')"
",(3, 10, 10800, 1, 'EEST') ,(3, 11, 7200, 0, 'EET')"
",(4, 0, 9000, 0, 'MMT') ,(4, 1, 12648, 1, 'MST')"
",(4, 2, 9048, 0, 'MMT') ,(4, 3, 16248, 1, 'MDST')"
",(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD')"
",(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET')"
",(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD')"
",(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET');\n");
}
}
if (test_sys_file(mdata,"mysql/time_zone_leap_second.frm"))
{
fprintf(out,
"CREATE TABLE time_zone_leap_second ("
"Transition_time bigint signed NOT NULL,"
"Correction int signed NOT NULL,"
"PRIMARY KEY TranTime (Transition_time)"
") DEFAULT CHARACTER SET latin1 "
"comment='Leap seconds information for time zones';\n");
if (test)
{
fprintf(out,
"INSERT INTO time_zone_leap_second "
"(Transition_time, Correction) VALUES "
"(78796800, 1) ,(94694401, 2) ,(126230402, 3)"
",(157766403, 4) ,(189302404, 5) ,(220924805, 6)"
",(252460806, 7) ,(283996807, 8) ,(315532808, 9)"
",(362793609, 10) ,(394329610, 11) ,(425865611, 12)"
",(489024012, 13) ,(567993613, 14) ,(631152014, 15)"
",(662688015, 16) ,(709948816, 17) ,(741484817, 18)"
",(773020818, 19) ,(820454419, 20) ,(867715220, 21)"
",(915148821, 22);\n");
}
}
return fclose(out);
}

View File

@ -333,7 +333,6 @@ int spawn(char *path, arg_list_t *al, int join, char *input,
PROCESS_INFORMATION process_information;
DWORD exit_code;
char win_args[1024]= "";
char command_line[1024]= "";
/* Skip the first parameter */
for (i= 1; i < al->argc; i++)
@ -724,7 +723,7 @@ int removef(const char *format, ...)
va_end(ap);
return remove(path);
#eldef __WIN__
#elif __WIN__
{
va_list ap;
char path[FN_REFLEN];

View File

@ -52,6 +52,8 @@ int my_vsnprintf_(char *to, size_t n, const char* value, ...);
#define TRY_MAX 5
#ifdef __WIN__
#define PATH_MAX _MAX_PATH
#define NAME_MAX _MAX_FNAME
#define kill(A,B) TerminateProcess((HANDLE)A,0)
#define NOT_NEED_PID 0
#define MASTER_PID 1
@ -130,4 +132,6 @@ int removef(const char *, ...);
void get_basedir(char *, char *);
void remove_empty_file(const char *file_name);
bool create_system_files(const char *mdata,const char *output_file, bool test);
#endif /* _MY_MANAGE */

View File

@ -4,6 +4,7 @@
# Slightly updated by Monty
# Cleaned up again by Matt
# Fixed by Sergei
# List of failed cases (--force) backported from 4.1 by Joerg
# :-)
#++
@ -490,6 +491,7 @@ if [ x$SOURCE_DIST = x1 ] ; then
echo "Fatal error: Cannot find embedded server 'mysqltest'" 1>&2
exit 1
fi
TESTS_BINDIR="$BASEDIR/libmysqld/examples"
else
MYSQLD="$VALGRIND $BASEDIR/sql/mysqld"
if [ -f "$BASEDIR/client/.libs/lt-mysqltest" ] ; then
@ -499,6 +501,7 @@ if [ x$SOURCE_DIST = x1 ] ; then
else
MYSQL_TEST="$BASEDIR/client/mysqltest"
fi
TESTS_BINDIR="$BASEDIR/tests"
fi
if [ -f "$BASEDIR/client/.libs/mysqldump" ] ; then
MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump"
@ -515,7 +518,6 @@ if [ x$SOURCE_DIST = x1 ] ; then
fi
CLIENT_BINDIR="$BASEDIR/client"
TESTS_BINDIR="$BASEDIR/tests"
MYSQLADMIN="$CLIENT_BINDIR/mysqladmin"
WAIT_PID="$BASEDIR/extra/mysql_waitpid"
MYSQL_MANAGER_CLIENT="$CLIENT_BINDIR/mysqlmanagerc"
@ -948,7 +950,7 @@ start_ndbcluster()
else
NDBCLUSTER_EXTRA_OPTS="--small"
fi
./ndb/ndbcluster $NDBCLUSTER_OPTS $NDBCLUSTER_EXTRA_OPTS --diskless --initial || exit 1
./ndb/ndbcluster $NDBCLUSTER_OPTS $NDBCLUSTER_EXTRA_OPTS --initial || exit 1
NDB_CONNECTSTRING="host=localhost:$NDBCLUSTER_PORT"
else
NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
@ -1352,7 +1354,7 @@ run_testcase ()
result_file="$result_file$RESULT_EXT"
fi
if [ "$USE_MANAGER" = 1 ] ; then
many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)`
many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)`
fi
if $EXPR "$tname" '<' "$START_FROM" > /dev/null ; then
#skip_test $tname

View File

@ -267,6 +267,8 @@ void install_db(char *datadir)
snprintf(output, FN_REFLEN, "%s/install.out", datadir);
snprintf(error, FN_REFLEN, "%s/install.err", datadir);
if (create_system_files(datadir,input, TRUE))
die("Unable to create init_db.sql.");
/* args */
init_args(&al);
add_arg(&al, mysqld_file);
@ -307,9 +309,6 @@ void mysql_install_db()
/* var directory */
snprintf(temp, FN_REFLEN, "%s/var", mysql_test_dir);
/* clean up old direcotry */
del_tree(temp);
/* create var directory */
#ifndef __WIN__
mkdir(temp, S_IRWXU);
@ -1435,6 +1434,17 @@ void setup(char *file __attribute__((unused)))
}
/*
Compare names of testes for right order
*/
#ifdef __WIN__
int compare( const void *arg1, const void *arg2 )
{
return _stricmp( * ( char** ) arg1, * ( char** ) arg2 );
}
#endif
/******************************************************************************
main()

View File

@ -0,0 +1,69 @@
-- NDB Cluster -- Management Client --
---------------------------------------------------------------------------
NDB Cluster -- Management Client -- Help
---------------------------------------------------------------------------
HELP Print help text
HELP SHOW Help for SHOW command
HELP DEBUG Help for debug compiled version
SHOW Print information about cluster
START BACKUP [NOWAIT | WAIT STARTED | WAIT COMPLETED]
Start backup (default WAIT COMPLETED)
ABORT BACKUP <backup id> Abort backup
SHUTDOWN Shutdown all processes in cluster
CLUSTERLOG ON [<severity>] ... Enable Cluster logging
CLUSTERLOG OFF [<severity>] ... Disable Cluster logging
CLUSTERLOG TOGGLE [<severity>] ... Toggle severity filter on/off
CLUSTERLOG INFO Print cluster log information
<id> START Start DB node (started with -n)
<id> RESTART [-n] [-i] Restart DB node
<id> STOP Stop DB node
ENTER SINGLE USER MODE <api-node> Enter single user mode
EXIT SINGLE USER MODE Exit single user mode
<id> STATUS Print status
<id> CLUSTERLOG {<category>=<level>}+ Set log level for cluster log
PURGE STALE SESSIONS Reset reserved nodeid's in the mgmt server
CONNECT [<connectstring>] Connect to management server (reconnect if already connected)
QUIT Quit management client
<severity> = ALERT | CRITICAL | ERROR | WARNING | INFO | DEBUG
<category> = STARTUP | SHUTDOWN | STATISTICS | CHECKPOINT | NODERESTART | CONNECTION | INFO | ERROR | GREP | DEBUG | BACKUP
<level> = 0 - 15
<id> = ALL | Any database node id
Connected to Management Server at: localhost:1186
Node 1: started (Version 4.1.8)
Node 2: started (Version 4.1.8)
Node 1: started (Version 4.1.8)
Node 2: started (Version 4.1.8)
Executing CLUSTERLOG on node 1 OK!
Executing CLUSTERLOG on node 2 OK!
Executing CLUSTERLOG on node 1 OK!
Executing CLUSTERLOG on node 2 OK!
Executing CLUSTERLOG on node 1 OK!
Executing CLUSTERLOG on node 2 OK!
Executing CLUSTERLOG on node 1 OK!
Executing CLUSTERLOG on node 2 OK!
Executing CLUSTERLOG on node 1 OK!
Executing CLUSTERLOG on node 2 OK!
Executing CLUSTERLOG on node 1 OK!
Executing CLUSTERLOG on node 2 OK!
Executing CLUSTERLOG on node 1 OK!
Executing CLUSTERLOG on node 2 OK!
Executing CLUSTERLOG on node 1 OK!
Executing CLUSTERLOG on node 2 OK!
Cluster logging is disabled
Cluster logging is enabled.
Cluster logging is disabled
ALL disabled
ALL enabled

17
mysql-test/ndb/basic.test Normal file
View File

@ -0,0 +1,17 @@
help
all status
1 status
2 status
all clusterlog connection=8
all clusterlog startup=7
all clusterlog checkpoint=7
all clusterlog noderestart=15
all clusterlog statistics=7
all clusterlog error=7
all clusterlog info=7
all clusterlog backup=15
clusterlog off
clusterlog toggle
clusterlog off
clusterlog off all
clusterlog on all

View File

View File

@ -47,6 +47,7 @@ fi
pidfile=ndbcluster.pid
cfgfile=Ndb.cfg
test_ndb=
stop_ndb=
initial_ndb=
status_ndb=
@ -59,6 +60,9 @@ ndb_imem=24M
while test $# -gt 0; do
case "$1" in
--test)
test_ndb=1
;;
--stop)
stop_ndb=1
;;
@ -67,8 +71,7 @@ while test $# -gt 0; do
initial_ndb=1
;;
--debug*)
f=`echo "$1" | sed -e "s;--debug=;;"`
flags_ndb="$flags_ndb $f"
flags_ndb="$flags_ndb $1"
;;
--status)
status_ndb=1
@ -232,7 +235,7 @@ status_ndbcluster
status_ndbcluster() {
# Start management client
echo "show" | $exec_mgmtclient
$exec_mgmtclient -e show
}
stop_default_ndbcluster() {
@ -241,7 +244,7 @@ stop_default_ndbcluster() {
exec_mgmtclient="$exec_mgmtclient --try-reconnect=1"
echo "shutdown" | $exec_mgmtclient 2>&1 | cat > /dev/null
$exec_mgmtclient -e shutdown 2>&1 | cat > /dev/null
if [ -f "$fs_ndb/$pidfile" ] ; then
kill_pids=`cat "$fs_ndb/$pidfile"`
@ -276,6 +279,44 @@ if [ -f "$fs_ndb/$pidfile" ] ; then
fi
}
initialize_ndb_test ()
{
fs_result=$fs_ndb/r
rm -rf $fs_result
mkdir $fs_result
echo ------------------
echo starting ndb tests
echo ------------------
}
do_ndb_test ()
{
test_name=$1
clusterlog=$fs_ndb/ndb_3_cluster.log
test_log_result=$fs_result/${test_name}_log.result
test_log_reject=$fs_result/${test_name}_log.reject
test_result=$fs_result/${test_name}.result
test_reject=$fs_result/${test_name}.reject
clean_log='s/.*\[MgmSrvr\]//'
cat $clusterlog ndb/${test_name}_log.result | sed -e $clean_log > $test_log_result
cp ndb/${test_name}.result $test_result
cat ndb/${test_name}.test | $exec_mgmtclient > $test_reject
cat $clusterlog | sed -e $clean_log > $test_log_reject
t="pass"
diff -C 5 $test_result $test_reject || t="fail"
printf "ndb_mgm output %20s [%s]\n" $test_name $t
t="pass"
diff -C 5 $test_log_result $test_log_reject || t="fail"
printf "clusterlog output %20s [%s]\n" $test_name $t
}
if [ $status_ndb ] ; then
status_ndbcluster
exit 0
@ -287,4 +328,15 @@ else
start_default_ndbcluster
fi
if [ $test_ndb ] ; then
initialize_ndb_test
all_tests=`ls ndb/*.test | sed "s#ndb/##" | sed "s#.test##"`
for a in $all_tests ; do
do_ndb_test $a
done
echo ------------------
echo shutting down cluster
stop_default_ndbcluster
fi
exit 0

View File

@ -0,0 +1,16 @@
-- NDB Cluster -- Management Client --
Connected to Management Server at: localhost:1186
ALL disabled
Cluster logging is enabled.
ALERT enabled
Executing CLUSTERLOG on node 1 OK!
Executing CLUSTERLOG on node 2 OK!
Node 1 is being restarted.
Executing CLUSTERLOG on node 1 OK!
Executing CLUSTERLOG on node 2 OK!
Node 1 is being restarted.
ALL enabled

View File

@ -0,0 +1,12 @@
clusterlog off all
clusterlog on
clusterlog on alert
all clusterlog connection=0
sleep 1
1 restart
sleep 5
all clusterlog connection=8
sleep 1
1 restart
sleep 5
clusterlog on all

View File

@ -0,0 +1,20 @@
ALERT -- Node 2: Network partitioning - arbitration required
ALERT -- Node 2: Arbitration won - positive reply from node 3
ALERT -- Node 2: Node 1 has failed. The Node state at failure was 0
ALERT -- Node 2: Node failure of 1 DBLQH completed
ALERT -- Node 2: Node failure of 1 DBDICT completed
ALERT -- Node 2: Node failure of 1 DBDIH completed
ALERT -- Node 2: Node failure of 1 DBTC completed
ALERT -- Node 2: Node 2 completed failure of Node 1
ALERT -- Node 2: All nodes completed failure of Node 1
ALERT -- Node 3: Node 1 Disconnected
ALERT -- Node 2: Node 1 Disconnected
ALERT -- Node 2: Network partitioning - arbitration required
ALERT -- Node 2: Arbitration won - positive reply from node 3
ALERT -- Node 2: Node 1 has failed. The Node state at failure was 0
ALERT -- Node 2: Node failure of 1 DBLQH completed
ALERT -- Node 2: Node failure of 1 DBDICT completed
ALERT -- Node 2: Node failure of 1 DBDIH completed
ALERT -- Node 2: Node failure of 1 DBTC completed
ALERT -- Node 2: Node 2 completed failure of Node 1
ALERT -- Node 2: All nodes completed failure of Node 1

View File

@ -10,7 +10,7 @@ USE d1;
CREATE TABLE t1 (c CHAR(10), KEY(c));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c char(10) big5_chinese_ci YES MUL NULL select,insert,update,references
c char(10) big5_chinese_ci YES MUL NULL
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
want3results
@ -21,7 +21,7 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c1 varchar(15) big5_chinese_ci YES MUL NULL select,insert,update,references
c1 varchar(15) big5_chinese_ci YES MUL NULL
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
SELECT c1 as want3results from t1 where c1 like 'l%';
want3results

View File

@ -1,58 +0,0 @@
drop table if exists t1;
SET @test_character_set= 'big5';
SET @test_collation= 'big5_chinese_ci';
SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server;
SET character_set_server= @test_character_set;
SET collation_server= @test_collation;
CREATE DATABASE d1;
USE d1;
CREATE TABLE t1 (c CHAR(10), KEY(c));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c char(10) big5_chinese_ci YES MUL NULL
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
want3results
aaa
aaaa
aaaaa
DROP TABLE t1;
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c1 varchar(15) big5_chinese_ci YES MUL NULL
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
SELECT c1 as want3results from t1 where c1 like 'l%';
want3results
location
loberge
lotre
SELECT c1 as want3results from t1 where c1 like 'lo%';
want3results
location
loberge
lotre
SELECT c1 as want1result from t1 where c1 like 'loc%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'loca%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locat%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locati%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locatio%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'location%';
want1result
location
DROP TABLE t1;
DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;

View File

@ -63,3 +63,12 @@ ERROR HY000: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET
create database d1 default character set latin1 collate latin2_bin;
ERROR 42000: COLLATION 'latin2_bin' is not valid for CHARACTER SET 'latin1'
DROP DATABASE mysqltest1;
CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET latin7;
use mysqltest2;
ALTER DATABASE DEFAULT CHARACTER SET latin2;
show create database mysqltest2;
Database Create Database
mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */
drop database mysqltest2;
ALTER DATABASE DEFAULT CHARACTER SET latin2;
ERROR 3D000: No database selected

View File

@ -1,242 +0,0 @@
SET CHARACTER SET koi8r;
DROP TABLE IF EXISTS ÔÁÂÌÉÃÁ, t1, t2;
SET CHARACTER SET koi8r;
CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp1251) SELECT _koi8r'ÐÒÏÂÁ' AS a;
CREATE TABLE t2 (a CHAR(10) CHARACTER SET utf8);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(10) character set cp1251 default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT a FROM t1;
a
ÐÒÏÂÁ
SELECT HEX(a) FROM t1;
HEX(a)
EFF0EEE1E0
INSERT t2 SELECT * FROM t1;
SELECT HEX(a) FROM t2;
HEX(a)
D0BFD180D0BED0B1D0B0
DROP TABLE t1, t2;
CREATE TABLE t1 (description text character set cp1250 NOT NULL);
INSERT INTO t1 (description) VALUES (_latin2'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddde');
SELECT description FROM t1;
description
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddde
DROP TABLE t1;
CREATE TABLE t1 (a TEXT CHARACTER SET cp1251) SELECT _koi8r'ÐÒÏÂÁ' AS a;
CREATE TABLE t2 (a TEXT CHARACTER SET utf8);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` text character set cp1251
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(a) FROM t1;
HEX(a)
EFF0EEE1E0
INSERT t2 SELECT * FROM t1;
SELECT HEX(a) FROM t2;
HEX(a)
D0BFD180D0BED0B1D0B0
DROP TABLE t1, t2;
CREATE TABLE `ÔÁÂÌÉÃÁ`
(
ÐÏÌÅ CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT "ËÏÍÍÅÎÔÁÒÉÊ ÐÏÌÑ"
) COMMENT "ËÏÍÍÅÎÔÁÒÉÊ ÔÁÂÌÉÃÙ";
SHOW TABLES;
Tables_in_test
ÔÁÂÌÉÃÁ
SHOW CREATE TABLE ÔÁÂÌÉÃÁ;
Table Create Table
ÔÁÂÌÉÃÁ CREATE TABLE `ÔÁÂÌÉÃÁ` (
`ÐÏÌÅ` char(32) character set koi8r NOT NULL default '' COMMENT 'ËÏÍÍÅÎÔÁÒÉÊ ÐÏÌÑ'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='ËÏÍÍÅÎÔÁÒÉÊ ÔÁÂÌÉÃÙ'
SHOW FIELDS FROM ÔÁÂÌÉÃÁ;
Field Type Null Key Default Extra
ÐÏÌÅ char(32)
SET CHARACTER SET cp1251;
SHOW TABLES;
Tables_in_test
òàáëèöà
SHOW CREATE TABLE òàáëèöà;
Table Create Table
òàáëèöà CREATE TABLE `òàáëèöà` (
`ïîëå` char(32) character set koi8r NOT NULL default '' COMMENT 'êîììåíòàðèé ïîëÿ'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='êîììåíòàðèé òàáëèöû'
SHOW FIELDS FROM òàáëèöà;
Field Type Null Key Default Extra
ïîëå char(32)
SET CHARACTER SET utf8;
SHOW TABLES;
Tables_in_test
ÑаблиÑа
SHOW CREATE TABLE ÑаблиÑа;
Table Create Table
ÑаблиÑа CREATE TABLE `ÑаблиÑа` (
`поле` char(32) character set koi8r NOT NULL default '' COMMENT 'комменÑаÑий полÑ<EFBFBD>'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='комментарий таблицы'
SHOW FIELDS FROM ÑаблиÑа;
Field Type Null Key Default Extra
поле char(32)
SET CHARACTER SET koi8r;
DROP TABLE ÔÁÂÌÉÃÁ;
SET CHARACTER SET default;
SET NAMES UTF8;
CREATE TABLE t1 (t text) DEFAULT CHARSET UTF8;
INSERT INTO t1 (t) VALUES ('x');
SELECT 1 FROM t1 WHERE CONCAT(_latin1'x') = t;
1
1
DROP TABLE t1;
SET CHARACTER SET koi8r;
CREATE DATABASE ÔÅÓÔ;
USE ÔÅÓÔ;
SHOW TABLES;
Tables_in_ÑеÑ<EFBFBD>Ñ
SHOW TABLES IN ÔÅÓÔ;
Tables_in_ÑеÑ<EFBFBD>Ñ
SET CHARACTER SET cp1251;
SHOW TABLES;
Tables_in_ÑеÑ<EFBFBD>Ñ
SHOW TABLES IN òåñò;
Tables_in_ÑеÑ<EFBFBD>Ñ
SET CHARACTER SET koi8r;
DROP DATABASE ÔÅÓÔ;
SET NAMES koi8r;
SELECT hex('ÔÅÓÔ');
hex(еÑ<C2B5>Ñ')
D4C5D3D4
SET character_set_connection=cp1251;
SELECT hex('ÔÅÓÔ');
hex(еÑ<C2B5>Ñ')
F2E5F1F2
USE test;
SET NAMES binary;
CREATE TABLE `ÑеÑ<EFBFBD>Ñ` (`ÑеÑ<EFBFBD>Ñ` int);
SHOW CREATE TABLE `ÑеÑ<EFBFBD>Ñ`;
Table Create Table
ÑеÑ<EFBFBD>Ñ CREATE TABLE `ÑеÑ<EFBFBD>Ñ` (
`ÑеÑ<EFBFBD>Ñ` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SET NAMES utf8;
SHOW CREATE TABLE `ÑеÑ<EFBFBD>Ñ`;
Table Create Table
ÑеÑ<EFBFBD>Ñ CREATE TABLE `ÑеÑ<EFBFBD>Ñ` (
`ÑеÑ<EFBFBD>Ñ` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE `ÑеÑ<EFBFBD>Ñ`;
SET NAMES binary;
SET character_set_connection=utf8;
SELECT еÑ<C2B5>Ñ' as s;
s
ÑеÑ<EFBFBD>Ñ
SET NAMES utf8;
SET character_set_connection=binary;
SELECT еÑ<C2B5>Ñ' as s;
s
ÑеÑ<EFBFBD>Ñ
SET NAMES latin1;
CREATE TABLE t1 (`ä` CHAR(128) DEFAULT 'ä', `ä1` ENUM('ä1','ä2') DEFAULT 'ä2');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`ä` char(128) default 'ä',
`ä1` enum('ä1','ä2') default 'ä2'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
ä char(128) YES ä
ä1 enum('ä1','ä2') YES ä2
SET NAMES binary;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`ä` char(128) default 'ä',
`ä1` enum('ä1','ä2') default 'ä2'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
ä char(128) YES ä
ä1 enum('ä1','ä2') YES ä2
DROP TABLE t1;
SET NAMES binary;
CREATE TABLE `goodÐÌÏÈÏ` (a int);
ERROR HY000: Invalid utf8 character string: 'ÐÌÏÈÏ'
SET NAMES utf8;
CREATE TABLE `goodÐÌÏÈÏ` (a int);
ERROR HY000: Invalid utf8 character string: 'ÐÌÏÈÏ` (a int)'
set names latin1;
create table t1 (a char(10) character set koi8r, b text character set koi8r);
insert into t1 values ('test','test');
insert into t1 values ('ÊÃÕË','ÊÃÕË');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'b' at row 1
drop table t1;
set names koi8r;
create table t1 (a char(10) character set cp1251);
insert into t1 values (_koi8r'×ÁÓÑ');
select * from t1 where a=_koi8r'×ÁÓÑ';
a
×ÁÓÑ
select * from t1 where a=concat(_koi8r'×ÁÓÑ');
ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (koi8r_general_ci,COERCIBLE) for operation '='
select * from t1 where a=_latin1'×ÁÓÑ';
ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '='
drop table t1;
set names latin1;
set names koi8r;
create table t1 (c1 char(10) character set cp1251);
insert into t1 values ('ß');
select c1 from t1 where c1 between 'ß' and 'ß';
c1
ß
select ifnull(c1,'ß'), ifnull(null,c1) from t1;
ifnull(c1,'ÑŠ') ifnull(null,c1)
ß ß
select if(1,c1,'ö'), if(0,c1,'ö') from t1;
if(1,c1,'Ж') if(0,c1,'Ж')
ß ö
select coalesce('ö',c1), coalesce(null,c1) from t1;
coalesce('Ж',c1) coalesce(null,c1)
ö ß
select least(c1,'ö'), greatest(c1,'ö') from t1;
least(c1,'Ж') greatest(c1,'Ж')
ö ß
select locate(c1,'ß'), locate('ß',c1) from t1;
locate(c1,'ÑŠ') locate('ÑŠ',c1)
1 1
select field(c1,'ß'),field('ß',c1) from t1;
field(c1,'ÑŠ') field('ÑŠ',c1)
1 1
select concat(c1,'ö'), concat('ö',c1) from t1;
concat(c1,'Ж') concat('Ж',c1)
ßö öß
select concat_ws(c1,'ö','ß'), concat_ws('ö',c1,'ß') from t1;
concat_ws(c1,'Ж','ъ') concat_ws('Ж',c1,'ъ')
ößß ßöß
select replace(c1,'ß','ö'), replace('ß',c1,'ö') from t1;
replace(c1,'ъ','Ж') replace('ъ',c1,'Ж')
ö ö
select substring_index(c1,'öößß',2) from t1;
substring_index(c1,'ЖЖъъ',2)
ß
select elt(1,c1,'ö'),elt(1,'ö',c1) from t1;
elt(1,c1,'Ж') elt(1,'Ж',c1)
ß ö
select make_set(3,c1,'ö'), make_set(3,'ö',c1) from t1;
make_set(3,c1,'Ж') make_set(3,'Ж',c1)
ß,ö ö,ß
select insert(c1,1,2,'ö'),insert('ö',1,2,c1) from t1;
insert(c1,1,2,'Ж') insert('Ж',1,2,c1)
ö ß
select trim(c1 from 'ß'),trim('ß' from c1) from t1;
trim(c1 from 'ÑŠ') trim('ÑŠ' from c1)
select lpad(c1,3,'ö'), lpad('ö',3,c1) from t1;
lpad(c1,3,'Ж') lpad('Ж',3,c1)
ööß ßßö
select rpad(c1,3,'ö'), rpad('ö',3,c1) from t1;
rpad(c1,3,'Ж') rpad('Ж',3,c1)
ßöö ößß

View File

@ -2329,7 +2329,7 @@ USE d1;
CREATE TABLE t1 (c CHAR(10), KEY(c));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c char(10) utf8_swedish_ci YES MUL NULL select,insert,update,references
c char(10) utf8_swedish_ci YES MUL NULL
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
want3results
@ -2340,7 +2340,7 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c1 varchar(15) utf8_swedish_ci YES MUL NULL select,insert,update,references
c1 varchar(15) utf8_swedish_ci YES MUL NULL
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
SELECT c1 as want3results from t1 where c1 like 'l%';
want3results
@ -2375,3 +2375,14 @@ DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
create table t1 (a varchar(1)) character set utf8 collate utf8_estonian_ci;
insert into t1 values ('A'),('B'),('C'),('a'),('b'),('c');
select a, a regexp '[a]' from t1 order by binary a;
a a regexp '[a]'
A 1
B 0
C 0
a 1
b 0
c 0
drop table t1;

File diff suppressed because it is too large Load Diff

View File

@ -535,3 +535,59 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0;
insert into t2 values (@v);
drop table t2;
set names latin1;
create table t1 (a enum('x','y','z') character set ucs2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('x','y','z') character set ucs2 default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ('x');
insert into t1 values ('y');
insert into t1 values ('z');
select a, hex(a) from t1 order by a;
a hex(a)
x 0078
y 0079
z 007A
alter table t1 change a a enum('x','y','z','d','e','ä','ö','ü') character set ucs2;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('x','y','z','d','e','ä','ö','ü') character set ucs2 default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ('D');
insert into t1 values ('E ');
insert into t1 values ('Ä');
insert into t1 values ('Ö');
insert into t1 values ('Ü');
select a, hex(a) from t1 order by a;
a hex(a)
x 0078
y 0079
z 007A
d 0064
e 0065
ä 00E4
ö 00F6
ü 00FC
drop table t1;
create table t1 (a set ('x','y','z','ä','ö','ü') character set ucs2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` set('x','y','z','ä','ö','ü') character set ucs2 default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ('x');
insert into t1 values ('y');
insert into t1 values ('z');
insert into t1 values ('x,y');
insert into t1 values ('x,y,z,Ä,Ö,Ü');
select a, hex(a) from t1 order by a;
a hex(a)
x 0078
y 0079
x,y 0078002C0079
z 007A
x,y,z,ä,ö,ü 0078002C0079002C007A002C00E4002C00F6002C00FC
drop table t1;

File diff suppressed because it is too large Load Diff

View File

@ -28,4 +28,12 @@ commit;
unlock tables;
flush tables with read lock;
unlock tables;
begin;
select * from t1;
a
1
10
show create database test;
Database Create Database
test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */
drop table t1;

View File

@ -32,3 +32,39 @@ select * from t1 where concat(A,C,B,D) = 'AAAA2003-03-011051';
a b c d
AAAA 105 2003-03-01 1
drop table t1;
select 'a' union select concat('a', -4);
a
a
a-4
select 'a' union select concat('a', -4.5);
a
a
a-4.5
select 'a' union select concat('a', -(4 + 1));
a
a
a-5
select 'a' union select concat('a', 4 - 5);
a
a
a-1
select 'a' union select concat('a', -'3');
a
a
a-3
select 'a' union select concat('a', -concat('3',4));
a
a
a-34
select 'a' union select concat('a', -0);
a
a
a0
select 'a' union select concat('a', -0.0);
a
a
a-0.0
select 'a' union select concat('a', -0.0000);
a
a
a-0.0000

View File

@ -685,3 +685,9 @@ drop table t1;
select left(1234, 3) + 0;
left(1234, 3) + 0
123
create table t1 (a int not null primary key, b varchar(40), c datetime);
insert into t1 (a,b,c) values (1,'Tom','2004-12-10 12:13:14'),(2,'ball games','2004-12-10 12:13:14'), (3,'Basil','2004-12-10 12:13:14'), (4,'Dean','2004-12-10 12:13:14'),(5,'Ellis','2004-12-10 12:13:14'), (6,'Serg','2004-12-10 12:13:14'), (7,'Sergei','2004-12-10 12:13:14'),(8,'Georg','2004-12-10 12:13:14'),(9,'Salle','2004-12-10 12:13:14'),(10,'Sinisa','2004-12-10 12:13:14');
select count(*) as total, left(c,10) as reg from t1 group by reg order by reg desc limit 0,12;
total reg
10 2004-12-10
drop table t1;

View File

@ -1,185 +0,0 @@
drop table if exists t1,t2;
select 0=0,1>0,1>=1,1<0,1<=0,1!=0,strcmp("abc","abcd"),strcmp("b","a"),strcmp("a","a") ;
0=0 1>0 1>=1 1<0 1<=0 1!=0 strcmp("abc","abcd") strcmp("b","a") strcmp("a","a")
1 1 1 0 0 1 -1 1 0
select "a"<"b","a"<="b","b">="a","b">"a","a"="A","a"<>"b";
"a"<"b" "a"<="b" "b">="a" "b">"a" "a"="A" "a"<>"b"
1 1 1 1 1 1
select "a "="A", "A "="a", "a " <= "A b";
"a "="A" "A "="a" "a " <= "A b"
1 1 1
select "abc" like "a%", "abc" not like "%d%", "a%" like "a\%","abc%" like "a%\%","abcd" like "a%b_%d", "a" like "%%a","abcde" like "a%_e","abc" like "abc%";
"abc" like "a%" "abc" not like "%d%" "a%" like "a\%" "abc%" like "a%\%" "abcd" like "a%b_%d" "a" like "%%a" "abcde" like "a%_e" "abc" like "abc%"
1 1 1 1 1 1 1 1
select "a" like "%%b","a" like "%%ab","ab" like "a\%", "ab" like "_", "ab" like "ab_", "abc" like "%_d", "abc" like "abc%d";
"a" like "%%b" "a" like "%%ab" "ab" like "a\%" "ab" like "_" "ab" like "ab_" "abc" like "%_d" "abc" like "abc%d"
0 0 0 0 0 0 0
select '?' like '|%', '?' like '|%' ESCAPE '|', '%' like '|%', '%' like '|%' ESCAPE '|', '%' like '%';
'?' like '|%' '?' like '|%' ESCAPE '|' '%' like '|%' '%' like '|%' ESCAPE '|' '%' like '%'
0 0 0 1 1
select 'abc' like '%c','abcabc' like '%c', "ab" like "", "ab" like "a", "ab" like "ab";
'abc' like '%c' 'abcabc' like '%c' "ab" like "" "ab" like "a" "ab" like "ab"
1 1 0 0 1
select "Det här är svenska" regexp "h[[:alpha:]]+r", "aba" regexp "^(a|b)*$";
"Det här är svenska" regexp "h[[:alpha:]]+r" "aba" regexp "^(a|b)*$"
1 1
select "aba" regexp concat("^","a");
"aba" regexp concat("^","a")
1
select !0,NOT 0=1,!(0=0),1 AND 1,1 && 0,0 OR 1,1 || NULL, 1=1 or 1=1 and 1=0;
!0 NOT 0=1 !(0=0) 1 AND 1 1 && 0 0 OR 1 1 || NULL 1=1 or 1=1 and 1=0
1 1 0 1 0 1 1 1
select 2 between 1 and 3, "monty" between "max" and "my",2=2 and "monty" between "max" and "my" and 3=3;
2 between 1 and 3 "monty" between "max" and "my" 2=2 and "monty" between "max" and "my" and 3=3
1 1 1
select 'b' between 'a' and 'c', 'B' between 'a' and 'c';
'b' between 'a' and 'c' 'B' between 'a' and 'c'
1 1
select 2 in (3,2,5,9,5,1),"monty" in ("david","monty","allan"), 1.2 in (1.4,1.2,1.0);
2 in (3,2,5,9,5,1) "monty" in ("david","monty","allan") 1.2 in (1.4,1.2,1.0)
1 1 1
select -1.49 or -1.49,0.6 or 0.6;
-1.49 or -1.49 0.6 or 0.6
1 1
select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
3 ^ 11 1 ^ 1 1 ^ 0 1 ^ NULL NULL ^ 1
8 0 1 NULL NULL
explain extended select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select (3 ^ 11) AS `3 ^ 11`,(1 ^ 1) AS `1 ^ 1`,(1 ^ 0) AS `1 ^ 0`,(1 ^ NULL) AS `1 ^ NULL`,(NULL ^ 1) AS `NULL ^ 1`
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
1 XOR 1 1 XOR 0 0 XOR 1 0 XOR 0 NULL XOR 1 1 XOR NULL 0 XOR NULL
0 1 1 0 NULL NULL NULL
select 1 like 2 xor 2 like 1;
1 like 2 xor 2 like 1
0
select 10 % 7, 10 mod 7, 10 div 3;
10 % 7 10 mod 7 10 div 3
3 3 3
explain extended select 10 % 7, 10 mod 7, 10 div 3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select (10 % 7) AS `10 % 7`,(10 % 7) AS `10 mod 7`,(10 DIV 3) AS `10 div 3`
select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
(1 << 64)-1 ((1 << 64)-1) DIV 1 ((1 << 64)-1) DIV 2
18446744073709551615 18446744073709551615 9223372036854775807
explain extended select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select ((1 << 64) - 1) AS `(1 << 64)-1`,(((1 << 64) - 1) DIV 1) AS `((1 << 64)-1) DIV 1`,(((1 << 64) - 1) DIV 2) AS `((1 << 64)-1) DIV 2`
create table t1 (a int);
insert t1 values (1);
select * from t1 where 1 xor 1;
a
explain extended select * from t1 where 1 xor 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Note 1003 select test.t1.a AS `a` from test.t1 where (1 xor 1)
select - a from t1;
- a
-1
explain extended select - a from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
Warnings:
Note 1003 select -(test.t1.a) AS `- a` from test.t1
drop table t1;
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
0 1
select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1;
1 and 2 between 2 and 10 2 between 2 and 10 and 1
1 1
select 1 and 0 or 2, 2 or 1 and 0;
1 and 0 or 2 2 or 1 and 0
1 1
select _koi8r'a' = _koi8r'A';
_koi8r'a' = _koi8r'A'
1
select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci
1
explain extended select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select (_koi8r'a' = (_koi8r'A' collate _latin1'koi8r_general_ci')) AS `_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci`
select _koi8r'a' = _koi8r'A' COLLATE koi8r_bin;
_koi8r'a' = _koi8r'A' COLLATE koi8r_bin
0
select _koi8r'a' COLLATE koi8r_general_ci = _koi8r'A';
_koi8r'a' COLLATE koi8r_general_ci = _koi8r'A'
1
select _koi8r'a' COLLATE koi8r_bin = _koi8r'A';
_koi8r'a' COLLATE koi8r_bin = _koi8r'A'
0
select _koi8r'a' COLLATE koi8r_bin = _koi8r'A' COLLATE koi8r_general_ci;
ERROR HY000: Illegal mix of collations (koi8r_bin,EXPLICIT) and (koi8r_general_ci,EXPLICIT) for operation '='
select _koi8r'a' = _latin1'A';
ERROR HY000: Illegal mix of collations (koi8r_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation '='
select strcmp(_koi8r'a', _koi8r'A');
strcmp(_koi8r'a', _koi8r'A')
0
select strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_general_ci);
strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_general_ci)
0
select strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_bin);
strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_bin)
1
select strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A');
strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A')
0
select strcmp(_koi8r'a' COLLATE koi8r_bin, _koi8r'A');
strcmp(_koi8r'a' COLLATE koi8r_bin, _koi8r'A')
1
select strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A' COLLATE koi8r_bin);
ERROR HY000: Illegal mix of collations (koi8r_general_ci,EXPLICIT) and (koi8r_bin,EXPLICIT) for operation 'strcmp'
select strcmp(_koi8r'a', _latin1'A');
ERROR HY000: Illegal mix of collations (koi8r_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation 'strcmp'
select _koi8r'a' LIKE _koi8r'A';
_koi8r'a' LIKE _koi8r'A'
1
select _koi8r'a' LIKE _koi8r'A' COLLATE koi8r_general_ci;
_koi8r'a' LIKE _koi8r'A' COLLATE koi8r_general_ci
1
select _koi8r'a' LIKE _koi8r'A' COLLATE koi8r_bin;
_koi8r'a' LIKE _koi8r'A' COLLATE koi8r_bin
0
select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A';
_koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A'
1
select _koi8r'a' COLLATE koi8r_bin LIKE _koi8r'A';
_koi8r'a' COLLATE koi8r_bin LIKE _koi8r'A'
0
select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A' COLLATE koi8r_bin;
ERROR HY000: Illegal mix of collations (koi8r_general_ci,EXPLICIT) and (koi8r_bin,EXPLICIT) for operation 'like'
select _koi8r'a' LIKE _latin1'A';
ERROR HY000: Illegal mix of collations (koi8r_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation 'like'
CREATE TABLE t1 ( faq_group_id int(11) NOT NULL default '0', faq_id int(11) NOT NULL default '0', title varchar(240) default NULL, keywords text, description longblob, solution longblob, status tinyint(4) NOT NULL default '0', access_id smallint(6) default NULL, lang_id smallint(6) NOT NULL default '0', created datetime NOT NULL default '0000-00-00 00:00:00', updated datetime default NULL, last_access datetime default NULL, last_notify datetime default NULL, solved_count int(11) NOT NULL default '0', static_solved int(11) default NULL, solved_1 int(11) default NULL, solved_2 int(11) default NULL, solved_3 int(11) default NULL, solved_4 int(11) default NULL, solved_5 int(11) default NULL, expires datetime default NULL, notes text, assigned_to smallint(6) default NULL, assigned_group smallint(6) default NULL, last_edited_by smallint(6) default NULL, orig_ref_no varchar(15) binary default NULL, c$fundstate smallint(6) default NULL, c$contributor smallint(6) default NULL, UNIQUE KEY t1$faq_id (faq_id), KEY t1$group_id$faq_id (faq_group_id,faq_id), KEY t1$c$fundstate (c$fundstate) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (82,82,'How to use the DynaVox Usage Counts Feature','usages count, number, corner, white, box, button','<as-html>\r\n<table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\"> </td>\r\n <td width=\"97%\">\r\n <h3><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000000\">How \r\n To</font><!-- #BeginEditable \"CS_troubleshoot_question\" --><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000099\"><font color=\"#000000\">: \r\n Display or Hide the Usage Counts to find out how many times each button is being selected. </font></font><!-- #EndEditable --></h3>\r\n </td>\r\n </tr>\r\n</table>','<as-html>\r\n <table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\"> </td>\r\n \r\n<td width=\"97%\"><!-- #BeginEditable \"CS_troubleshoot_answer\" --> \r\n \r\n<p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">1. Select \r\n the <i>On/Setup</i> button to access the DynaVox Setup Menu.<br>\r\n 2. Select <b>Button Features.</b><br>\r\n 3. Below the <b>OK</b> button is the <b>Usage Counts</b> button.<br>\r\n a. If it says \"Hidden\" then the Usage Counts will not be displayed.<br>\r\n b. If it says \"Displayed\" then the Usage Counts will be shown.<br>\r\n c. Select the <b>Usage Counts</b> Option Ring once and it will toggle \r\n to the alternative option.<br>\r\n 4. Once the correct setting has been chosen, select <b>OK</b> to leave the <i>Button \r\n Features</i> menu.<br>\r\n 5. Select <b>OK</b> out of the <i>Setup</i> menu and return to the communication \r\n page.</font></p>\r\n <p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">For \r\n further information on <i>Usage Counts,</i> see the <i>Button Features \r\n Menu Entry</i> in the DynaVox/DynaMyte Reference Manual.</font></p>\r\n<!-- #EndEditable --></td>\r\n </tr>\r\n</table>',4,1,1,'2001-11-16 16:43:34','2002-11-25 12:09:43','2003-07-24 01:04:48',NULL,11,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,11,NULL,NULL,NULL);
CREATE TABLE t2 ( access_id smallint(6) NOT NULL default '0', name varchar(20) binary default NULL, rank smallint(6) NOT NULL default '0', KEY t2$access_id (access_id) ) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,'Everyone',2),(2,'Help',3),(3,'Customer Support',1);
SELECT f_acc.rank, a1.rank, a2.rank FROM t1 LEFT JOIN t1 f1 ON (f1.access_id=1 AND f1.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a1 ON (a1.access_id = f1.access_id) LEFT JOIN t1 f2 ON (f2.access_id=3 AND f2.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a2 ON (a2.access_id = f2.access_id), t2 f_acc WHERE LEAST(a1.rank,a2.rank) = f_acc.rank;
rank rank rank
2 2 NULL
DROP TABLE t1,t2;
CREATE TABLE t1 (d varchar(6), k int);
INSERT INTO t1 VALUES (NULL, 2);
SELECT GREATEST(d,d) FROM t1 WHERE k=2;
GREATEST(d,d)
NULL
DROP TABLE t1;
select 1197.90 mod 50;
1197.90 mod 50
47.90
select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3;
5.1 mod 3 5.1 mod -3 -5.1 mod 3 -5.1 mod -3
2.1 2.1 -2.1 -2.1
select 5 mod 3, 5 mod -3, -5 mod 3, -5 mod -3;
5 mod 3 5 mod -3 -5 mod 3 -5 mod -3
2 2 -2 -2

View File

@ -757,3 +757,50 @@ SPATIAL KEY(g)
) ENGINE=MyISAM;
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText('LineString(1 2, 2 4)'));
drop table t1;
CREATE TABLE t1 (
geoobjid INT NOT NULL,
line LINESTRING NOT NULL,
kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
name VARCHAR(32),
SPATIAL KEY (line)
) engine=myisam;
ALTER TABLE t1 DISABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES
("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")),
("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")),
("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")),
("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")),
("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")),
("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")),
("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")),
("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")),
("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")),
("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")),
("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")),
("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")),
("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")),
("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")),
("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")),
("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")),
("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")),
("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")),
("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")),
("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")),
("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")),
("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")),
("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")),
("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")),
("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")),
("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")),
("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)"));
ALTER TABLE t1 ENABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)'));
drop table t1;
CREATE TABLE t1 (st varchar(100));
INSERT INTO t1 VALUES ("Fake string");
CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom));
INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
ERROR HY000: Unknown error
drop table t1, t2;

View File

@ -344,6 +344,70 @@ select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
Host Db User Table_name Column_name Column_priv
drop user grant_user@localhost;
drop table t1;
create database mysqltest_1;
create database mysqltest_2;
create table mysqltest_1.t1 select 1 a, 2 q;
create table mysqltest_1.t2 select 1 b, 2 r;
create table mysqltest_2.t1 select 1 c, 2 s;
create table mysqltest_2.t2 select 1 d, 2 t;
grant update (a) on mysqltest_1.t1 to mysqltest_3@localhost;
grant select (b) on mysqltest_1.t2 to mysqltest_3@localhost;
grant select (c) on mysqltest_2.t1 to mysqltest_3@localhost;
grant update (d) on mysqltest_2.t2 to mysqltest_3@localhost;
show grants for mysqltest_3@localhost;
Grants for mysqltest_3@localhost
GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
GRANT SELECT (b) ON `mysqltest_1`.`t2` TO 'mysqltest_3'@'localhost'
GRANT SELECT (c) ON `mysqltest_2`.`t1` TO 'mysqltest_3'@'localhost'
GRANT UPDATE (a) ON `mysqltest_1`.`t1` TO 'mysqltest_3'@'localhost'
GRANT UPDATE (d) ON `mysqltest_2`.`t2` TO 'mysqltest_3'@'localhost'
update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1;
ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'q' in table 't1'
update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1;
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'd' in table 't2'
update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1;
ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2;
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 's' in table 't1'
update mysqltest_1.t1, mysqltest_2.t2 set a=10,d=10;
update mysqltest_1.t1, mysqltest_2.t1 set a=20 where c=20;
select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2;
a q b r
10 2 1 2
select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2;
c s d t
1 2 10 2
revoke all on mysqltest_1.t1 from mysqltest_3@localhost;
revoke all on mysqltest_1.t2 from mysqltest_3@localhost;
revoke all on mysqltest_2.t1 from mysqltest_3@localhost;
revoke all on mysqltest_2.t2 from mysqltest_3@localhost;
grant all on mysqltest_2.* to mysqltest_3@localhost;
grant select on *.* to mysqltest_3@localhost;
flush privileges;
use mysqltest_1;
update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600;
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'a' in table 't1'
use mysqltest_2;
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1'
update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200;
ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1'
update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200;
ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1'
select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2;
a q b r
10 2 1 2
select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2;
c s d t
500 2 600 2
delete from mysql.user where user='mysqltest_3';
delete from mysql.db where user="mysqltest_3";
delete from mysql.tables_priv where user="mysqltest_3";
delete from mysql.columns_priv where user="mysqltest_3";
flush privileges;
drop database mysqltest_1;
drop database mysqltest_2;
SHOW PRIVILEGES;
Privilege Context Comment
Alter Tables To alter the table

View File

@ -638,3 +638,15 @@ alias
1,2
1
drop table t1;
create table t1 (a int);
insert into t1 values(null);
select min(a) is null from t1;
min(a) is null
1
select min(a) is null or null from t1;
min(a) is null or null
1
select 1 and min(a) is null from t1;
1 and min(a) is null
1
drop table t1;

View File

@ -1,2 +1,2 @@
Variable_name Value
have_exampledb YES
have_example_engine YES

View File

@ -78,6 +78,13 @@ a
1
2
drop table t1, t2;
create table t1(a int);
insert into t1 values(1),(1);
reset master;
create table t2(unique(a)) select a from t1;
ERROR 23000: Duplicate entry '1' for key 1
show binlog events;
drop table t1;
create table t1 (a int not null);
create table t2 (a int not null);
insert into t1 values (1);

View File

@ -105,3 +105,65 @@ a b
8 28
9 29
drop table t1;
CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE (A), UNIQUE(B));
INSERT t1 VALUES (1,2,10), (3,4,20);
INSERT t1 SELECT 5,6,30 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100;
SELECT * FROM t1;
a b c
1 2 10
3 4 20
5 6 30
INSERT t1 SELECT 5,7,40 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100;
SELECT * FROM t1;
a b c
1 2 10
3 4 20
5 6 130
INSERT t1 SELECT 8,4,50 FROM DUAL ON DUPLICATE KEY UPDATE c=c+1000;
SELECT * FROM t1;
a b c
1 2 10
3 4 1020
5 6 130
INSERT t1 SELECT 1,4,60 FROM DUAL ON DUPLICATE KEY UPDATE c=c+10000;
SELECT * FROM t1;
a b c
1 2 10010
3 4 1020
5 6 130
INSERT t1 SELECT 1,9,70 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100000, b=4;
ERROR 23000: Duplicate entry '4' for key 2
SELECT * FROM t1;
a b c
1 2 10010
3 4 1020
5 6 130
TRUNCATE TABLE t1;
INSERT t1 VALUES (1,2,10), (3,4,20);
CREATE TABLE t2 (x INT, y INT, z INT, d INT);
INSERT t2 VALUES (5,6,30,1), (7,4,40,1), (8,9,60,1);
INSERT t2 VALUES (2,1,11,2), (7,4,40,2);
INSERT t1 SELECT x,y,z FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=c+100;
SELECT * FROM t1;
a b c
1 2 10
3 4 120
5 6 30
8 9 60
INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0;
SELECT * FROM t1;
a b c
1 2 10
3 4 120
5 0 30
8 9 60
INSERT t1 SELECT x,y,z FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
SELECT *, VALUES(a) FROM t1;
a b c VALUES(a)
1 2 10 NULL
3 4 127 NULL
5 0 30 NULL
8 9 60 NULL
2 1 11 NULL
DROP TABLE t1;
DROP TABLE t2;

View File

@ -653,3 +653,28 @@ ERROR HY000: You can't specify target table 't2' for update in FROM clause
create table t3 engine=merge union=(t1, t2) select (select max(a) from t2);
ERROR HY000: You can't specify target table 't2' for update in FROM clause
drop table t1, t2;
create table t1 (a int,b int,c int, index (a,b,c));
create table t2 (a int,b int,c int, index (a,b,c));
create table t3 (a int,b int,c int, index (a,b,c))
engine=merge union=(t1 ,t2);
insert into t1 (a,b,c) values (1,1,0),(1,2,0);
insert into t2 (a,b,c) values (1,1,1),(1,2,1);
explain select a,b,c from t3 force index (a) where a=1 order by a,b,c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 ref a a 5 const 2 Using where; Using index
select a,b,c from t3 force index (a) where a=1 order by a,b,c;
a b c
1 1 0
1 1 1
1 2 0
1 2 1
explain select a,b,c from t3 force index (a) where a=1 order by a desc, b desc, c desc;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 ref a a 5 const 2 Using where; Using index
select a,b,c from t3 force index (a) where a=1 order by a desc, b desc, c desc;
a b c
1 2 1
1 2 0
1 1 1
1 1 0
drop table t1, t2, t3;

View File

@ -3,7 +3,7 @@ select 1, 1.0, -1, "hello", NULL;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def 1 8 1 1 N 32769 0 8
def 1.0 5 3 3 N 32769 1 8
def -1 8 1 2 N 32769 0 8
def -1 8 2 2 N 32769 0 8
def hello 253 5 5 N 1 31 8
def NULL 6 0 0 Y 32896 0 63
1 1.0 -1 hello NULL

View File

@ -464,6 +464,17 @@ ERROR HY000: You can't specify target table 't1' for update in FROM clause
delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1;
ERROR HY000: You can't specify target table 't1' for update in FROM clause
drop table t1,t2;
create table t1 (
aclid bigint not null primary key,
status tinyint(1) not null
) engine = innodb;
create table t2 (
refid bigint not null primary key,
aclid bigint, index idx_acl(aclid)
) engine = innodb;
insert into t2 values(1,null);
delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1';
drop table t1, t2;
set @ttype_save=@@storage_engine;
set @@storage_engine=innodb;
create table t1 ( c char(8) not null );

View File

@ -1,4 +1,5 @@
DROP TABLE IF EXISTS t1;
drop database if exists mysqltest;
CREATE TABLE t1 (
a INT NOT NULL,
b INT NOT NULL
@ -9,6 +10,21 @@ SELECT * FROM t1;
a b c
9410 9412 0
DROP TABLE t1;
CREATE DATABASE mysqltest;
USE mysqltest;
CREATE TABLE t1 (
a INT NOT NULL,
b INT NOT NULL
) ENGINE=ndbcluster;
RENAME TABLE t1 TO test.t1;
SHOW TABLES;
Tables_in_mysqltest
DROP DATABASE mysqltest;
USE test;
SHOW TABLES;
Tables_in_test
t1
DROP TABLE t1;
create table t1 (
col1 int not null auto_increment primary key,
col2 varchar(30) not null,

View File

@ -0,0 +1,13 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
b INT NOT NULL,
c INT NOT NULL
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (0, 0, 1),(1,1,2),(2,2,3);
UPDATE t1 set b = c;
select * from t1 order by pk1;
pk1 b c
0 1 1
1 2 2
2 3 3

View File

@ -471,6 +471,17 @@ select @var is null, @var is not null, @var;
execute stmt using @var, @var, @var;
? is null ? is not null ?
1 0 NULL
create table t1 (pnum char(3));
create table t2 (pnum char(3));
prepare stmt from "select pnum from t2 having pnum in (select 'p1' from t1)";
execute stmt;
pnum
execute stmt;
pnum
execute stmt;
pnum
deallocate prepare stmt;
drop table t1, t2;
create table t1 (a varchar(20));
insert into t1 values ('foo');
prepare stmt FROM 'SELECT char_length (a) FROM t1';

View File

@ -1687,6 +1687,9 @@ a b
1003 duplicate three
1004 duplicate four
delete from t1 where a >= 1000 ;
set @1=1 ;
set @2=2 ;
set @100=100 ;
set @float=1.00;
set @five='five' ;
drop table if exists t2;

File diff suppressed because it is too large Load Diff

View File

@ -1670,6 +1670,9 @@ a b
1003 duplicate three
1004 duplicate four
delete from t1 where a >= 1000 ;
set @1=1 ;
set @2=2 ;
set @100=100 ;
set @float=1.00;
set @five='five' ;
drop table if exists t2;

File diff suppressed because it is too large Load Diff

View File

@ -1671,6 +1671,9 @@ a b
1003 duplicate three
1004 duplicate four
delete from t1 where a >= 1000 ;
set @1=1 ;
set @2=2 ;
set @100=100 ;
set @float=1.00;
set @five='five' ;
drop table if exists t2;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1670,6 +1670,9 @@ a b
1003 duplicate three
1004 duplicate four
delete from t1 where a >= 1000 ;
set @1=1 ;
set @2=2 ;
set @100=100 ;
set @float=1.00;
set @five='five' ;
drop table if exists t2;

File diff suppressed because it is too large Load Diff

View File

@ -1670,6 +1670,9 @@ a b
1003 duplicate three
1004 duplicate four
delete from t1 where a >= 1000 ;
set @1=1 ;
set @2=2 ;
set @100=100 ;
set @float=1.00;
set @five='five' ;
drop table if exists t2;

View File

@ -808,7 +808,7 @@ SET NAMES koi8r;
CREATE TABLE t1 (a char(1) character set koi8r);
INSERT INTO t1 VALUES (_koi8r'á'),(_koi8r'Á');
SELECT a,'Â','â'='Â' FROM t1;
a б 'Б'='б'
a В 'в'='В'
á Â 1
Á Â 1
show status like "Qcache_hits";
@ -819,7 +819,7 @@ Variable_name Value
Qcache_queries_in_cache 1
set collation_connection=koi8r_bin;
SELECT a,'Â','â'='Â' FROM t1;
a б 'Б'='б'
a В 'в'='В'
á Â 0
Á Â 0
show status like "Qcache_hits";
@ -830,7 +830,7 @@ Variable_name Value
Qcache_queries_in_cache 2
set character_set_client=cp1251;
SELECT a,'Â','â'='Â' FROM t1;
a В 'в'='В'
a ч 'Ч'='
á ÷ 0
Á ÷ 0
show status like "Qcache_hits";
@ -841,7 +841,7 @@ Variable_name Value
Qcache_queries_in_cache 3
set character_set_results=cp1251;
SELECT a,'Â','â'='Â' FROM t1;
a В 'в'='В'
a В 'в'='В'
À Â 0
à Â 0
show status like "Qcache_hits";

View File

@ -0,0 +1,70 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned,
unique (b)
) ENGINE=innodb;
CREATE TABLE t2 (
a int unsigned, # to force INSERT SELECT to have a certain order
b int unsigned
) ENGINE=innodb;
INSERT INTO t1 VALUES (NULL, 1);
INSERT INTO t1 VALUES (NULL, 2);
INSERT INTO t1 VALUES (NULL, 3);
INSERT INTO t1 VALUES (NULL, 4);
INSERT INTO t2 VALUES (1, 1);
INSERT INTO t2 VALUES (2, 2);
INSERT INTO t2 VALUES (3, 5);
INSERT INTO t2 VALUES (4, 3);
INSERT INTO t2 VALUES (5, 4);
INSERT INTO t2 VALUES (6, 6);
INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
drop table t1;
CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned,
unique (b)
) ENGINE=myisam;
INSERT INTO t1 VALUES (1, 1);
INSERT INTO t1 VALUES (2, 2);
INSERT INTO t1 VALUES (3, 3);
INSERT INTO t1 VALUES (4, 4);
INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
drop table t1, t2;

View File

@ -269,7 +269,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3
Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where (`test`.`t3`.`a` >= (select min(`test`.`t2`.`b`) from `test`.`t2`))
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= (select min(`test`.`t2`.`b`) from `test`.`t2`)))
select * from t3 where a >= all (select b from t2);
a
7
@ -1495,7 +1495,65 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < (select max(`test`.`t2`.`b`) from `test`.`t2`)))
select * from t3 where a >= some (select b from t2);
a
explain extended select * from t3 where a >= some (select b from t2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
Warnings:
Note 1003 select test.t3.a AS `a` from test.t3 where <nop>((test.t3.a >= (select min(test.t2.b) from test.t2)))
select * from t3 where a >= all (select b from t2 group by 1);
a
6
7
3
explain extended select * from t3 where a >= all (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
Warnings:
Note 1003 select test.t3.a AS `a` from test.t3 where <not>((test.t3.a < <max>(select test.t2.b AS `b` from test.t2 group by test.t2.b)))
select * from t3 where a >= some (select b from t2 group by 1);
a
explain extended select * from t3 where a >= some (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
Warnings:
Note 1003 select test.t3.a AS `a` from test.t3 where <nop>((test.t3.a >= <min>(select test.t2.b AS `b` from test.t2 group by test.t2.b)))
select * from t3 where NULL >= any (select b from t2);
a
explain extended select * from t3 where NULL >= any (select b from t2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
Warnings:
Note 1003 select test.t3.a AS `a` from test.t3
select * from t3 where NULL >= any (select b from t2 group by 1);
a
explain extended select * from t3 where NULL >= any (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
Warnings:
Note 1003 select test.t3.a AS `a` from test.t3
select * from t3 where NULL >= some (select b from t2);
a
explain extended select * from t3 where NULL >= some (select b from t2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
Warnings:
Note 1003 select test.t3.a AS `a` from test.t3
select * from t3 where NULL >= some (select b from t2 group by 1);
a
explain extended select * from t3 where NULL >= some (select b from t2 group by 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
Warnings:
Note 1003 select test.t3.a AS `a` from test.t3
insert into t2 values (2,2), (2,1), (3,3), (3,1);
select * from t3 where a > all (select max(b) from t2 group by a);
a
@ -2039,3 +2097,38 @@ insert into t1 values (20,15);
select * from t1 where (('a',null) <=> (select 'a',s2 from t1 where s1 = 0));
s1 s2
drop table t1;
create table t1 (s1 int);
insert into t1 values (1),(null);
select * from t1 where s1 < all (select s1 from t1);
s1
select s1, s1 < all (select s1 from t1) from t1;
s1 s1 < all (select s1 from t1)
1 0
NULL NULL
drop table t1;
CREATE TABLE t1 (
Code char(3) NOT NULL default '',
Name char(52) NOT NULL default '',
Continent enum('Asia','Europe','North America','Africa','Oceania','Antarctica','South America') NOT NULL default 'Asia',
Region char(26) NOT NULL default '',
SurfaceArea float(10,2) NOT NULL default '0.00',
IndepYear smallint(6) default NULL,
Population int(11) NOT NULL default '0',
LifeExpectancy float(3,1) default NULL,
GNP float(10,2) default NULL,
GNPOld float(10,2) default NULL,
LocalName char(45) NOT NULL default '',
GovernmentForm char(45) NOT NULL default '',
HeadOfState char(60) default NULL,
Capital int(11) default NULL,
Code2 char(2) NOT NULL default ''
) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('XXX','Xxxxx','Oceania','Xxxxxx',26.00,0,0,0,0,0,'Xxxxx','Xxxxx','Xxxxx',NULL,'XX');
INSERT INTO t1 VALUES ('ASM','American Samoa','Oceania','Polynesia',199.00,0,68000,75.1,334.00,NULL,'Amerika Samoa','US Territory','George W. Bush',54,'AS');
INSERT INTO t1 VALUES ('ATF','French Southern territories','Antarctica','Antarctica',7780.00,0,0,NULL,0.00,NULL,'Terres australes françaises','Nonmetropolitan Territory of France','Jacques Chirac',NULL,'TF');
INSERT INTO t1 VALUES ('UMI','United States Minor Outlying Islands','Oceania','Micronesia/Caribbean',16.00,0,0,NULL,0.00,NULL,'United States Minor Outlying Islands','Dependent Territory of the US','George W. Bush',NULL,'UM');
/*!40000 ALTER TABLE t1 ENABLE KEYS */;
SELECT DISTINCT Continent AS c FROM t1 WHERE Code <> SOME ( SELECT Code FROM t1 WHERE Continent = c AND Population < 200);
c
Oceania
drop table t1;

View File

@ -1,4 +1,4 @@
drop table if exists t1;
drop table if exists t1, t2;
create table t1 (ts timestamp);
set time_zone='+00:00';
select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp());
@ -256,18 +256,50 @@ delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
grant usage on mysqltest.* to mysqltest_1@localhost;
create table t1 (a int, b datetime);
create table t2 (c int, d datetime);
grant all privileges on test.* to mysqltest_1@localhost;
show grants for current_user();
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'localhost'
set time_zone= '+00:00';
set time_zone= 'Europe/Moscow';
select convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC');
convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
2004-10-21 15:00:00
select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
convert_tz(b, 'Europe/Moscow', 'UTC')
update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
where t1.a = t2.c and t2.d = (select max(d) from t2);
select * from mysql.time_zone_name;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql'
select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql'
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
flush privileges;
grant all privileges on test.t1 to mysqltest_1@localhost;
grant all privileges on test.t2 to mysqltest_1@localhost;
show grants for current_user();
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT ALL PRIVILEGES ON `test`.`t2` TO 'mysqltest_1'@'localhost'
GRANT ALL PRIVILEGES ON `test`.`t1` TO 'mysqltest_1'@'localhost'
set time_zone= '+00:00';
set time_zone= 'Europe/Moscow';
select convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC');
convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC')
2004-12-01 09:00:00
select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
convert_tz(b, 'Europe/Moscow', 'UTC')
update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC')
where t1.a = t2.c and t2.d = (select max(d) from t2);
select * from mysql.time_zone_name;
ERROR 42000: select command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
ERROR 42000: select command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
flush privileges;
drop table t1, t2;

View File

@ -1731,9 +1731,17 @@ alter table t1 add b set ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
alter table t1 add c enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
select * from t1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 a a 254 3 1 Y 384 0 8
def test t1 t1 b b 254 9 0 Y 2176 0 8
def test t1 t1 c c 254 3 0 Y 384 0 8
def test t1 t1 a a 254 1 1 Y 384 0 8
def test t1 t1 b b 254 3 0 Y 2176 0 8
def test t1 t1 c c 254 1 0 Y 384 0 8
a b c
Y NULL NULL
drop table t1;
create table t1 (a enum('x','y') default 'x');
alter table t1 alter a set default 'z';
ERROR 42000: Invalid default value for 'a'
drop table t1;
create table t1 (a set('x','y') default 'x');
alter table t1 alter a set default 'z';
ERROR 42000: Invalid default value for 'a'
drop table t1;

View File

@ -206,3 +206,9 @@ colC colA colD colE colF
3 4433 10005 492 500
DROP TABLE t1;
DROP TABLE t2;
create table t1 (c1 int, c2 char(6), c3 int);
create table t2 (c1 int, c2 char(6));
insert into t1 values (1, "t1c2-1", 10), (2, "t1c2-2", 20);
update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1";
update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1" where t1.c3 = 10;
drop table t1, t2;

View File

@ -502,3 +502,7 @@ t1 CREATE TABLE `t1` (
`c3` longtext
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
SET GLOBAL MYISAM_DATA_POINTER_SIZE= 8;
SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
Variable_name Value
myisam_data_pointer_size 8

View File

@ -86,3 +86,15 @@ create database d1 default character set latin1 collate latin2_bin;
#
#
DROP DATABASE mysqltest1;
#
# Synatx: 'ALTER DATABASE' without db_name
#
CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET latin7;
use mysqltest2;
ALTER DATABASE DEFAULT CHARACTER SET latin2;
show create database mysqltest2;
drop database mysqltest2;
--error 1046
ALTER DATABASE DEFAULT CHARACTER SET latin2;

View File

@ -444,3 +444,11 @@ DROP TABLE t1;
SET @test_character_set= 'utf8';
SET @test_collation= 'utf8_swedish_ci';
-- source include/ctype_common.inc
#
# Bug 7111 server crashes when regexp is used
#
create table t1 (a varchar(1)) character set utf8 collate utf8_estonian_ci;
insert into t1 values ('A'),('B'),('C'),('a'),('b'),('c');
select a, a regexp '[a]' from t1 order by binary a;
drop table t1;

View File

@ -345,3 +345,34 @@ show binlog events from 95;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
drop table t2;
#
# Check that ucs2 works with ENUM and SET type
#
set names latin1;
create table t1 (a enum('x','y','z') character set ucs2);
show create table t1;
insert into t1 values ('x');
insert into t1 values ('y');
insert into t1 values ('z');
select a, hex(a) from t1 order by a;
alter table t1 change a a enum('x','y','z','d','e','ä','ö','ü') character set ucs2;
show create table t1;
insert into t1 values ('D');
insert into t1 values ('E ');
insert into t1 values ('Ä');
insert into t1 values ('Ö');
insert into t1 values ('Ü');
select a, hex(a) from t1 order by a;
drop table t1;
create table t1 (a set ('x','y','z','ä','ö','ü') character set ucs2);
show create table t1;
insert into t1 values ('x');
insert into t1 values ('y');
insert into t1 values ('z');
insert into t1 values ('x,y');
insert into t1 values ('x,y,z,Ä,Ö,Ü');
select a, hex(a) from t1 order by a;
drop table t1;

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@ insert delayed into t1 set a = 4;
insert delayed into t1 set a = 5, tmsp = 19711006010203;
insert delayed into t1 (a, tmsp) values (6, 19711006010203);
insert delayed into t1 (a, tmsp) values (7, NULL);
--sleep 1
--sleep 2
insert into t1 set a = 8,tmsp=19711006010203;
select * from t1 where tmsp=0;
select * from t1 where tmsp=19711006010203;

View File

@ -1,6 +1,7 @@
# Let's see if FLUSH TABLES WITH READ LOCK blocks COMMIT of existing
# transactions.
# We verify that we did not introduce a deadlock.
# This is intended to mimick how mysqldump and innobackup work.
-- source include/have_innodb.inc
@ -63,4 +64,11 @@ unlock tables;
connection con2;
flush tables with read lock; # bug caused hang here
unlock tables;
# BUG#7358 SHOW CREATE DATABASE fails if open transaction
begin;
select * from t1;
show create database test;
drop table t1;

View File

@ -34,3 +34,19 @@ create table t1 (a char(4), b double, c date, d tinyint(4));
insert into t1 values ('AAAA', 105, '2003-03-01', 1);
select * from t1 where concat(A,C,B,D) = 'AAAA2003-03-011051';
drop table t1;
# BUG#6825
select 'a' union select concat('a', -4);
select 'a' union select concat('a', -4.5);
select 'a' union select concat('a', -(4 + 1));
select 'a' union select concat('a', 4 - 5);
select 'a' union select concat('a', -'3');
select 'a' union select concat('a', -concat('3',4));
select 'a' union select concat('a', -0);
select 'a' union select concat('a', -0.0);
select 'a' union select concat('a', -0.0000);

View File

@ -421,3 +421,11 @@ drop table t1;
#
select left(1234, 3) + 0;
#
# Bug #7101: bug with LEFT() when used as a field in GROUP BY aggregation
#
create table t1 (a int not null primary key, b varchar(40), c datetime);
insert into t1 (a,b,c) values (1,'Tom','2004-12-10 12:13:14'),(2,'ball games','2004-12-10 12:13:14'), (3,'Basil','2004-12-10 12:13:14'), (4,'Dean','2004-12-10 12:13:14'),(5,'Ellis','2004-12-10 12:13:14'), (6,'Serg','2004-12-10 12:13:14'), (7,'Sergei','2004-12-10 12:13:14'),(8,'Georg','2004-12-10 12:13:14'),(9,'Salle','2004-12-10 12:13:14'),(10,'Sinisa','2004-12-10 12:13:14');
select count(*) as total, left(c,10) as reg from t1 group by reg order by reg desc limit 0,12;
drop table t1;

View File

@ -118,3 +118,57 @@ CREATE TABLE t1 (
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText('LineString(1 2, 2 4)'));
#select * from t1 where g<GeomFromText('LineString(1 2, 2 3)');
drop table t1;
CREATE TABLE t1 (
geoobjid INT NOT NULL,
line LINESTRING NOT NULL,
kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
name VARCHAR(32),
SPATIAL KEY (line)
) engine=myisam;
ALTER TABLE t1 DISABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES
("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")),
("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")),
("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")),
("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")),
("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")),
("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")),
("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")),
("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")),
("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")),
("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")),
("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")),
("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")),
("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")),
("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")),
("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")),
("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")),
("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")),
("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")),
("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")),
("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")),
("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")),
("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")),
("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")),
("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")),
("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")),
("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")),
("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)"));
ALTER TABLE t1 ENABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)'));
drop table t1;
CREATE TABLE t1 (st varchar(100));
INSERT INTO t1 VALUES ("Fake string");
CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom));
--error 1105
INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
drop table t1, t2;

View File

@ -5,6 +5,8 @@
drop table if exists t1;
--enable_warnings
connect (master,localhost,root,,);
connection master;
SET NAMES binary;
#
@ -286,6 +288,76 @@ select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
drop user grant_user@localhost;
drop table t1;
#
# Bug#7391: Cross-database multi-table UPDATE security problem
#
create database mysqltest_1;
create database mysqltest_2;
create table mysqltest_1.t1 select 1 a, 2 q;
create table mysqltest_1.t2 select 1 b, 2 r;
create table mysqltest_2.t1 select 1 c, 2 s;
create table mysqltest_2.t2 select 1 d, 2 t;
#test the column privileges
grant update (a) on mysqltest_1.t1 to mysqltest_3@localhost;
grant select (b) on mysqltest_1.t2 to mysqltest_3@localhost;
grant select (c) on mysqltest_2.t1 to mysqltest_3@localhost;
grant update (d) on mysqltest_2.t2 to mysqltest_3@localhost;
connect (conn1,localhost,mysqltest_3,,);
connection conn1;
show grants for mysqltest_3@localhost;
--error 1143
update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1;
--error 1143
update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1;
--error 1143
update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1;
--error 1143
update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2;
#the following two should work
update mysqltest_1.t1, mysqltest_2.t2 set a=10,d=10;
update mysqltest_1.t1, mysqltest_2.t1 set a=20 where c=20;
connection master;
select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2;
select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2;
revoke all on mysqltest_1.t1 from mysqltest_3@localhost;
revoke all on mysqltest_1.t2 from mysqltest_3@localhost;
revoke all on mysqltest_2.t1 from mysqltest_3@localhost;
revoke all on mysqltest_2.t2 from mysqltest_3@localhost;
#test the db/table level privileges
grant all on mysqltest_2.* to mysqltest_3@localhost;
grant select on *.* to mysqltest_3@localhost;
flush privileges;
disconnect conn1;
connect (conn2,localhost,mysqltest_3,,);
connection conn2;
use mysqltest_1;
update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600;
# the following failed before, should fail now.
--error 1143
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
use mysqltest_2;
#the following used to succeed, it must fail now.
--error 1044
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
--error 1044
update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200;
--error 1044
update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200;
#lets see the result
connection master;
select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2;
select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2;
delete from mysql.user where user='mysqltest_3';
delete from mysql.db where user="mysqltest_3";
delete from mysql.tables_priv where user="mysqltest_3";
delete from mysql.columns_priv where user="mysqltest_3";
flush privileges;
drop database mysqltest_1;
drop database mysqltest_2;
#
# just SHOW PRIVILEGES test
#

View File

@ -465,3 +465,12 @@ select group_concat( distinct col1 ) as alias from t1
drop table t1;
#Test for BUG#6976: Aggregate functions have incorrect NULL-ness
create table t1 (a int);
insert into t1 values(null);
select min(a) is null from t1;
select min(a) is null or null from t1;
select 1 and min(a) is null from t1;
drop table t1;

View File

@ -48,3 +48,34 @@ disable_info;
select * from t1;
drop table t1;
# WorkLog #2274 - enable INSERT .. SELECT .. UPDATE syntax
# Same tests as beginning of this test except that insert source
# is a result from a select statement
#
CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE (A), UNIQUE(B));
INSERT t1 VALUES (1,2,10), (3,4,20);
INSERT t1 SELECT 5,6,30 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100;
SELECT * FROM t1;
INSERT t1 SELECT 5,7,40 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100;
SELECT * FROM t1;
INSERT t1 SELECT 8,4,50 FROM DUAL ON DUPLICATE KEY UPDATE c=c+1000;
SELECT * FROM t1;
INSERT t1 SELECT 1,4,60 FROM DUAL ON DUPLICATE KEY UPDATE c=c+10000;
SELECT * FROM t1;
-- error 1062
INSERT t1 SELECT 1,9,70 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100000, b=4;
SELECT * FROM t1;
TRUNCATE TABLE t1;
INSERT t1 VALUES (1,2,10), (3,4,20);
CREATE TABLE t2 (x INT, y INT, z INT, d INT);
INSERT t2 VALUES (5,6,30,1), (7,4,40,1), (8,9,60,1);
INSERT t2 VALUES (2,1,11,2), (7,4,40,2);
INSERT t1 SELECT x,y,z FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=c+100;
SELECT * FROM t1;
INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0;
SELECT * FROM t1;
INSERT t1 SELECT x,y,z FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
SELECT *, VALUES(a) FROM t1;
DROP TABLE t1;
DROP TABLE t2;

View File

@ -71,7 +71,7 @@ show status like 'key_blocks_used';
# Following results differs on 64 and 32 bit systems because of different
# pointer sizes, which takes up different amount of space in key cache
--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED 1674 KEY_BLOCKS_UNUSED 1818 KEY_BLOCKS_UNUSED
--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED 1674 KEY_BLOCKS_UNUSED 1818 KEY_BLOCKS_UNUSED 1824 KEY_BLOCKS_UNUSED
show status like 'key_blocks_unused';
insert into t1 values (1, 'qqqq'), (11, 'yyyy');
@ -84,7 +84,7 @@ update t1 set p=2 where p=1;
update t2 set i=2 where i=1;
show status like 'key_blocks_used';
--replace_result 1808 KEY_BLOCKS_UNUSED 1789 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED 1814 KEY_BLOCKS_UNUSED
--replace_result 1808 KEY_BLOCKS_UNUSED 1789 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED 1814 KEY_BLOCKS_UNUSED 1820 KEY_BLOCKS_UNUSED
show status like 'key_blocks_unused';
cache index t1 key (`primary`) in keycache1;
@ -146,7 +146,7 @@ cache index t1,t2 in default;
drop table t1,t2,t3;
show status like 'key_blocks_used';
--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED 1674 KEY_BLOCKS_UNUSED 1818 KEY_BLOCKS_UNUSED
--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED 1674 KEY_BLOCKS_UNUSED 1818 KEY_BLOCKS_UNUSED 1824 KEY_BLOCKS_UNUSED
show status like 'key_blocks_unused';
# Cleanup

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