diff options
author | unknown <monty@mysql.com> | 2004-12-06 11:38:56 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-12-06 11:38:56 +0200 |
commit | 796bd7de96a1d1ec422708b90df5328388201c10 (patch) | |
tree | a7bb331b7dac7ac2b3cda915e99bb8c1333f4fec | |
parent | 289d3b2ee0f912dd4f128e1c61685d7bb170eb90 (diff) | |
parent | f8cdf570979c550ef04c53f691118ed2b1296a7c (diff) | |
download | mariadb-git-796bd7de96a1d1ec422708b90df5328388201c10.tar.gz |
Merge with 4.1
BitKeeper/etc/ignore:
auto-union
BitKeeper/etc/logging_ok:
auto-union
BUILD/SETUP.sh:
Auto merged
Build-tools/Do-compile:
Auto merged
client/mysqladmin.cc:
Auto merged
configure.in:
Auto merged
innobase/include/lock0lock.h:
Auto merged
innobase/os/os0file.c:
Auto merged
libmysqld/Makefile.am:
Auto merged
mysql-test/mysql-test-run.sh:
Auto merged
mysql-test/r/ctype_ucs.result:
Auto merged
mysql-test/r/heap.result:
Auto merged
mysql-test/r/insert_select.result:
Auto merged
mysql-test/r/lowercase_table3.result:
Auto merged
mysql-test/r/rpl_start_stop_slave.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/t/ctype_ucs.test:
Auto merged
mysql-test/t/rpl_until.test:
Auto merged
mysql-test/t/subselect.test:
Auto merged
ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
Auto merged
sql/field.cc:
Auto merged
sql/field.h:
Auto merged
sql/ha_myisam.h:
Auto merged
sql/handler.cc:
Auto merged
sql/handler.h:
Auto merged
sql/item.h:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/lock.cc:
Auto merged
sql/log_event.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/slave.cc:
Auto merged
sql/slave.h:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_db.cc:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_prepare.cc:
Auto merged
sql/sql_rename.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/log_event.cc:
Merge with 4.1
Trivial cleanup
107 files changed, 24789 insertions, 336 deletions
diff --git a/.bzrignore b/.bzrignore index 2893e947cf8..f675b1a9e5a 100644 --- a/.bzrignore +++ b/.bzrignore @@ -387,7 +387,9 @@ libmysqld/field_conv.cc libmysqld/filesort.cc libmysqld/get_password.c libmysqld/gstream.cc +libmysqld/ha_archive.cc libmysqld/ha_berkeley.cc +libmysqld/ha_example.cc libmysqld/ha_heap.cc libmysqld/ha_innobase.cc libmysqld/ha_innodb.cc @@ -395,6 +397,7 @@ libmysqld/ha_isam.cc libmysqld/ha_isammrg.cc libmysqld/ha_myisam.cc libmysqld/ha_myisammrg.cc +libmysqld/ha_tina.cc libmysqld/handler.cc libmysqld/hash_filo.cc libmysqld/hostname.cc diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index c1f9028b6dd..8fa70aecb6a 100644 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -45,6 +45,7 @@ cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wcto alpha_cflags="-mcpu=ev6 -Wa,-mev6" # Not used yet pentium_cflags="-mcpu=pentiumpro" +ppc_cflags="-mpowerpc -mcpu=powerpc" sparc_cflags="" # be as fast as we can be without losing our ability to backtrace diff --git a/BUILD/compile-ppc b/BUILD/compile-ppc new file mode 100755 index 00000000000..d248ecf2677 --- /dev/null +++ b/BUILD/compile-ppc @@ -0,0 +1,10 @@ +#! /bin/sh + +path=`dirname $0` +. "$path/SETUP.sh" + +extra_flags="$ppc_cflags $fast_cflags" +extra_configs="$static_link" +strip=yes + +. "$path/FINISH.sh" diff --git a/BUILD/compile-ppc-debug b/BUILD/compile-ppc-debug new file mode 100755 index 00000000000..2be11eaaf22 --- /dev/null +++ b/BUILD/compile-ppc-debug @@ -0,0 +1,13 @@ +#! /bin/sh + +path=`dirname $0` +. "$path/SETUP.sh" + +extra_flags="$ppc_cflags $debug_cflags" +c_warnings="$c_warnings $debug_extra_warnings" +cxx_warnings="$cxx_warnings $debug_extra_warnings" +extra_configs="$debug_configs " + +extra_configs="$extra_configs" + +. "$path/FINISH.sh" diff --git a/BUILD/compile-ppc-debug-max b/BUILD/compile-ppc-debug-max new file mode 100755 index 00000000000..9d67b46601a --- /dev/null +++ b/BUILD/compile-ppc-debug-max @@ -0,0 +1,13 @@ +#! /bin/sh + +path=`dirname $0` +. "$path/SETUP.sh" + +extra_flags="$ppc_cflags $debug_cflags" +c_warnings="$c_warnings $debug_extra_warnings" +cxx_warnings="$cxx_warnings $debug_extra_warnings" +extra_configs="$debug_configs" + +extra_configs="$extra_configs --with-berkeley-db --with-innodb --without-isam --with-embedded-server --with-openssl --with-raid --with-vio --with-ndbcluster" + +. "$path/FINISH.sh" diff --git a/BUILD/compile-ppc-max b/BUILD/compile-ppc-max new file mode 100755 index 00000000000..f7193eb8aca --- /dev/null +++ b/BUILD/compile-ppc-max @@ -0,0 +1,13 @@ +#! /bin/sh + +path=`dirname $0` +. "$path/SETUP.sh" + +extra_flags="$ppc_cflags $fast_cflags -g" +#strip=yes + +extra_configs="$extra_configs --with-innodb --with-berkeley-db \ + --with-embedded-server --enable-thread-safe-client \ + --with-openssl --with-vio --with-raid --with-ndbcluster" + +. "$path/FINISH.sh" diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index fe5a271830a..11a49cee843 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -90,6 +90,7 @@ jcole@mugatu.jcole.us jcole@mugatu.spaceapes.com jcole@sarvik.tfr.cafe.ee jcole@tetra.spaceapes.com +jimw@mysql.com joerg@mysql.com joreland@mysql.com jorge@linux.jorge.mysql.com diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index e98c3d84937..f8e91efd70d 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -10,7 +10,7 @@ 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_cluster=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=$opt_without_embedded=$opt_readline=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_debug=$opt_no_benchmark=$opt_no_mysqltest=$opt_without_embedded=$opt_readline=0; $opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=$opt_clearlogs=0; GetOptions( @@ -53,6 +53,7 @@ GetOptions( "use-old-distribution", "user=s", "version-suffix=s", + "with-archive", "with-cluster", "with-debug", "with-low-memory", @@ -273,6 +274,7 @@ if ($opt_stage <= 1) $opt_config_options.= " --with-libedit"; } $opt_config_options.= " --with-embedded-server" unless ($opt_without_embedded); + $opt_config_options.= " --with-archive-storage-engine" if ($opt_with_archive); $opt_config_options.= " --with-ndbcluster" if ($opt_with_cluster); # Only enable InnoDB when requested (required to be able to @@ -609,6 +611,9 @@ If user is empty then no mail is sent. --version-suffix=suffix Set name suffix (e.g. 'com' or '-max') for a distribution +--with archive +Enable the Archive storage Engine + --with cluster Compile and test with NDB Cluster enabled diff --git a/VC++Files/client/mysqltest.dsp b/VC++Files/client/mysqltest.dsp new file mode 100644 index 00000000000..badd61a70b9 --- /dev/null +++ b/VC++Files/client/mysqltest.dsp @@ -0,0 +1,125 @@ +# Microsoft Developer Studio Project File - Name="mysqltest" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=mysqltest - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "mysqltest.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "mysqltest.mak" CFG="mysqltest - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "mysqltest - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "mysqltest - Win32 classic" (based on "Win32 (x86) Console Application")
+!MESSAGE "mysqltest - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "mysqltest - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# 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 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 MTL /nologo /tlb".\debug\mysqltest.tlb" /win32
+# ADD MTL /nologo /tlb".\debug\mysqltest.tlb" /win32
+# ADD BASE RSC /l 1033 /d "_DEBUG"
+# ADD RSC /l 1033 /d "_DEBUG"
+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
+
+!ELSEIF "$(CFG)" == "mysqltest - Win32 classic"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir ".\classic"
+# PROP BASE Intermediate_Dir ".\classic"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ".\classic"
+# PROP Intermediate_Dir ".\classic"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /I "../include" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX
+# ADD CPP /nologo /MT /I "../include" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX
+# ADD BASE MTL /nologo /tlb".\classic\mysqltest.tlb" /win32
+# ADD MTL /nologo /tlb".\classic\mysqltest.tlb" /win32
+# ADD BASE RSC /l 1033 /d "NDEBUG"
+# ADD RSC /l 1033 /d "NDEBUG"
+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
+
+!ELSEIF "$(CFG)" == "mysqltest - 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 Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ".\release"
+# PROP Intermediate_Dir ".\release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX
+# ADD CPP /nologo /MT /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX
+# ADD BASE MTL /nologo /tlb".\release\mysqltest.tlb" /win32
+# ADD MTL /nologo /tlb".\release\mysqltest.tlb" /win32
+# ADD BASE RSC /l 1033 /d "NDEBUG"
+# ADD RSC /l 1033 /d "NDEBUG"
+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
+
+!ENDIF
+
+# Begin Target
+
+# Name "mysqltest - Win32 Debug"
+# Name "mysqltest - Win32 classic"
+# Name "mysqltest - Win32 Release"
+# Begin Source File
+
+SOURCE=..\libmysql\manager.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mysqltest.c
+# End Source File
+# End Target
+# End Project
+
diff --git a/VC++Files/mysql-test/mysql_test_run_new.dsp b/VC++Files/mysql-test/mysql_test_run_new.dsp new file mode 100644 index 00000000000..bbdabb98a37 --- /dev/null +++ b/VC++Files/mysql-test/mysql_test_run_new.dsp @@ -0,0 +1,106 @@ +# Microsoft Developer Studio Project File - Name="mysql_test_run_new" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Application" 0x0101
+
+CFG=mysql_test_run_new - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "mysql_test_run_new.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "mysql_test_run_new.mak" 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
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "mysql_test_run_new - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# 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 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 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
+
+!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 Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# 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 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
+
+!ENDIF
+
+# Begin Target
+
+# Name "mysql_test_run_new - Win32 Debug"
+# Name "mysql_test_run_new - Win32 Release"
+# Begin Source File
+
+SOURCE=my_create_tables.c
+# End Source File
+# Begin Source File
+
+SOURCE=my_manage.c
+# End Source File
+# Begin Source File
+
+SOURCE=my_manage.h
+# End Source File
+# Begin Source File
+
+SOURCE=mysql_test_run_new.c
+# End Source File
+# End Target
+# End Project
+
diff --git a/VC++Files/mysql.dsw b/VC++Files/mysql.dsw index 61a466174b6..222b09c3d80 100644 --- a/VC++Files/mysql.dsw +++ b/VC++Files/mysql.dsw @@ -816,6 +816,30 @@ Package=<4> ############################################################################### +Project: "mysqltest"=.\client\mysqltest.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "mysql_test_run_new"=.\mysql-test\mysql_test_run_new.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Global: Package=<5> diff --git a/client/client_priv.h b/client/client_priv.h index 184eed241ed..e86a56f58c1 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -45,7 +45,7 @@ enum options_client OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH, OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS, OPT_START_POSITION, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME, - OPT_SIGINT_IGNORE, OPT_HEXBLOB + OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY #ifdef HAVE_NDBCLUSTER_DB ,OPT_NDBCLUSTER,OPT_NDB_CONNECTSTRING #endif diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 37c4971497a..924af3a9977 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -825,10 +825,17 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) } if (argv[1][0]) { + char *pw= argv[1]; +#ifdef __WIN__ + uint pw_len= strlen(pw); + if (pw_len > 1 && pw[0] == '\'' && pw[pw_len-1] == '\'') + printf("Warning: single quotes were not trimmed from the password by" + " your command\nline client, as you might have expected.\n"); +#endif if (find_type(argv[0], &command_typelib, 2) == ADMIN_OLD_PASSWORD) - make_scrambled_password_323(crypted_pw, argv[1]); + make_scrambled_password_323(crypted_pw, pw); else - make_scrambled_password(crypted_pw, argv[1]); + make_scrambled_password(crypted_pw, pw); } else crypted_pw[0]=0; /* No password */ diff --git a/client/mysqldump.c b/client/mysqldump.c index 0d0e67454f8..472dfa4c6dc 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -75,20 +75,20 @@ static ulong find_set(TYPELIB *lib, const char *x, uint length, static char *field_escape(char *to,const char *from,uint length); static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick= 1, extended_insert= 1, - lock_tables=1,ignore_errors=0,flush_logs=0,replace=0, - ignore=0,opt_drop=1,opt_keywords=0,opt_lock=1,opt_compress=0, + lock_tables=1,ignore_errors=0,flush_logs=0, + opt_drop=1,opt_keywords=0,opt_lock=1,opt_compress=0, opt_delayed=0,create_options=1,opt_quoted=0,opt_databases=0, opt_alldbs=0,opt_create_db=0,opt_lock_all_tables=0,opt_set_charset, opt_autocommit=0,opt_disable_keys=1,opt_xml=0, opt_delete_master_logs=0, tty_password=0, opt_single_transaction=0, opt_comments= 0, opt_compact= 0, - opt_hex_blob=0; + opt_hex_blob=0, opt_order_by_primary=0; static ulong opt_max_allowed_packet, opt_net_buffer_length; static MYSQL mysql_connection,*sock=0; static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, *current_host=0,*path=0,*fields_terminated=0, *lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0, - *where=0, + *where=0, *order_by=0, *opt_compatible_mode_str= 0, *err_ptr= 0; static char compatible_mode_normal_str[255]; @@ -334,6 +334,9 @@ static struct my_option my_long_options[] = {"socket", 'S', "Socket file to use for connection.", (gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"order-by-primary", OPT_ORDER_BY_PRIMARY, + "Sorts each table's rows by primary key, or first unique key, if such a key exists. Useful when dumping a MyISAM table to be loaded into an InnoDB table, but will make the dump itself take considerably longer.", + (gptr*) &opt_order_by_primary, (gptr*) &opt_order_by_primary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #include <sslopt-longopts.h> {"tab",'T', "Creates tab separated textfile for each table to given path. (creates .sql and .txt files). NOTE: This only works if mysqldump is run on the same machine as the mysqld daemon.", @@ -370,6 +373,7 @@ static int dump_databases(char **); static int dump_all_databases(); static char *quote_name(const char *name, char *buff, my_bool force); static const char *check_if_ignore_table(const char *table_name); +static char *primary_key_fields(const char *table_name); static my_bool getViewStructure(char *table, char* db); static my_bool dump_all_views_in_db(char *database); @@ -673,11 +677,6 @@ static int get_options(int *argc, char ***argv) fprintf(stderr, "%s: You can't use ..enclosed.. and ..optionally-enclosed.. at the same time.\n", my_progname); return(1); } - if (replace && ignore) - { - fprintf(stderr, "%s: You can't use --ignore (-i) and --replace (-r) at the same time.\n",my_progname); - return(1); - } if ((opt_databases || opt_alldbs) && path) { fprintf(stderr, @@ -758,7 +757,6 @@ static void safe_exit(int error) /* ** dbConnect -- connects to the host and selects DB. -** Also checks whether the tablename is a valid table name. */ static int dbConnect(char *host, char *user,char *passwd) { @@ -896,7 +894,7 @@ static char *quote_for_like(const char *name, char *buff) len - its length DESCRIPTION - Quote '<' '>' '&' '\"' singns and print a string to the xml_file. + Quote '<' '>' '&' '\"' chars and print a string to the xml_file. */ static void print_quoted_xml(FILE *xml_file, const char *str, ulong len) @@ -1037,6 +1035,10 @@ static uint getTableStructure(char *table, char* db) result_table= quote_name(table, table_buff, 1); opt_quoted_table= quote_name(table, table_buff2, 0); + + if (opt_order_by_primary) + order_by = primary_key_fields(opt_quoted_table); + if (!opt_xml && !mysql_query_with_error_report(sock, 0, insert_pat)) { /* using SHOW CREATE statement */ @@ -1471,10 +1473,6 @@ static void dumpTable(uint numFields, char *table) sprintf(query, "SELECT /*!40001 SQL_NO_CACHE */ * INTO OUTFILE '%s'", filename); end= strend(query); - if (replace) - end= strmov(end, " REPLACE"); - if (ignore) - end= strmov(end, " IGNORE"); if (fields_terminated || enclosed || opt_enclosed || escaped) end= strmov(end, " FIELDS"); @@ -1487,10 +1485,17 @@ static void dumpTable(uint numFields, char *table) sprintf(buff," FROM %s", result_table); end= strmov(end,buff); - if (where) + if (where || order_by) { - query= alloc_query_str((ulong) (strlen(where) + (end - query) + 10)); - end= strxmov(query, query_buf, " WHERE ", where, NullS); + query = alloc_query_str((ulong) ((end - query) + 1 + + (where ? strlen(where) + 7 : 0) + + (order_by ? strlen(order_by) + 10 : 0))); + end = strmov(query, query_buf); + + if (where) + end = strxmov(end, " WHERE ", where, NullS); + if (order_by) + end = strxmov(end, " ORDER BY ", order_by, NullS); } if (mysql_real_query(sock, query, (uint) (end - query))) { @@ -1508,15 +1513,31 @@ static void dumpTable(uint numFields, char *table) } sprintf(query, "SELECT /*!40001 SQL_NO_CACHE */ * FROM %s", result_table); - if (where) + if (where || order_by) { - if (!opt_xml && opt_comments) + query = alloc_query_str((ulong) (strlen(query) + 1 + + (where ? strlen(where) + 7 : 0) + + (order_by ? strlen(order_by) + 10 : 0))); + end = strmov(query, query_buf); + + if (where) { - fprintf(md_result_file,"-- WHERE: %s\n",where); - check_io(md_result_file); + if (!opt_xml && opt_comments) + { + fprintf(md_result_file, "-- WHERE: %s\n", where); + check_io(md_result_file); + } + end = strxmov(end, " WHERE ", where, NullS); + } + if (order_by) + { + if (!opt_xml && opt_comments) + { + fprintf(md_result_file, "-- ORDER BY: %s\n", order_by); + check_io(md_result_file); + } + end = strxmov(end, " ORDER BY ", order_by, NullS); } - query= alloc_query_str((ulong) (strlen(where) + strlen(query) + 10)); - strxmov(query, query_buf, " WHERE ", where, NullS); } if (!opt_xml && !opt_compact) { @@ -1826,6 +1847,8 @@ 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 */ @@ -2323,6 +2346,80 @@ static const char *check_if_ignore_table(const char *table_name) return result; } +/* + Get string of comma-separated primary key field names + + SYNOPSIS + char *primary_key_fields(const char *table_name) + RETURNS pointer to allocated buffer (must be freed by caller) + table_name quoted table name + + DESCRIPTION + Use SHOW KEYS FROM table_name, allocate a buffer to hold the + field names, and then build that string and return the pointer + to that buffer. + + Returns NULL if there is no PRIMARY or UNIQUE key on the table, + or if there is some failure. It is better to continue to dump + the table unsorted, rather than exit without dumping the data. +*/ +static char *primary_key_fields(const char *table_name) +{ + MYSQL_RES *res = NULL; + MYSQL_ROW row; + /* SHOW KEYS FROM + table name * 2 (escaped) + 2 quotes + \0 */ + char show_keys_buff[15 + 64 * 2 + 3]; + uint result_length = 0; + char *result = 0; + + sprintf(show_keys_buff, "SHOW KEYS FROM %s", table_name); + if (mysql_query(sock, show_keys_buff) || + !(res = mysql_store_result(sock))) + { + fprintf(stderr, "Warning: Couldn't read keys from table %s;" + " records are NOT sorted (%s)\n", + table_name, mysql_error(sock)); + /* Don't exit, because it's better to print out unsorted records */ + goto cleanup; + } + + /* + * Figure out the length of the ORDER BY clause result. + * Note that SHOW KEYS is ordered: a PRIMARY key is always the first + * row, and UNIQUE keys come before others. So we only need to check + * the first key, not all keys. + */ + if ((row = mysql_fetch_row(res)) && atoi(row[1]) == 0) + { + /* Key is unique */ + do + result_length += strlen(row[4]) + 1; /* + 1 for ',' or \0 */ + while ((row = mysql_fetch_row(res)) && atoi(row[3]) > 1); + } + + /* Build the ORDER BY clause result */ + if (result_length) { + char *end; + /* result (terminating \0 is already in result_length) */ + result = my_malloc(result_length + 10, MYF(MY_WME)); + if (!result) { + fprintf(stderr, "Error: Not enough memory to store ORDER BY clause\n"); + goto cleanup; + } + mysql_data_seek(res, 0); + row = mysql_fetch_row(res); + end = strmov(result, row[4]); + while ((row = mysql_fetch_row(res)) && atoi(row[3]) > 1) + end = strxmov(end, ",", row[4], NullS); + } + +cleanup: + if (res) + mysql_free_result(res); + + return result; +} + /* Getting VIEW structure diff --git a/configure.in b/configure.in index cb9b43498d7..025d7d306b1 100644 --- a/configure.in +++ b/configure.in @@ -2435,7 +2435,7 @@ thread_dirs= dnl This probably should be cleaned up more - for now the threaded dnl client is just using plain-old libs. -sql_client_dirs="libmysql strings regex client" +sql_client_dirs="libmysql client" linked_client_targets="linked_libmysql_sources" CLIENT_LIBS=$NON_THREADED_CLIENT_LIBS if test "$THREAD_SAFE_CLIENT" != "no" diff --git a/heap/hp_create.c b/heap/hp_create.c index d1783118c0d..fdfe78a1e09 100644 --- a/heap/hp_create.c +++ b/heap/hp_create.c @@ -41,6 +41,13 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef, { HP_KEYDEF *keyinfo; DBUG_PRINT("info",("Initializing new table")); + + /* + We have to store sometimes byte* del_link in records, + so the record length should be at least sizeof(byte*) + */ + set_if_bigger(reclength, sizeof (byte*)); + for (i= key_segs= max_length= 0, keyinfo= keydef; i < keys; i++, keyinfo++) { bzero((char*) &keyinfo->block,sizeof(keyinfo->block)); diff --git a/innobase/configure.in b/innobase/configure.in index d83da9fdc5c..baf11272ab9 100644 --- a/innobase/configure.in +++ b/innobase/configure.in @@ -41,7 +41,9 @@ AC_CHECK_SIZEOF(long, 4) AC_CHECK_SIZEOF(void*, 4) AC_CHECK_FUNCS(sched_yield) AC_CHECK_FUNCS(fdatasync) -#AC_CHECK_FUNCS(localtime_r) # Already checked by MySQL +AC_CHECK_FUNCS(localtime_r) +#AC_CHECK_FUNCS(readdir_r) MySQL checks that it has also the right args. +# Some versions of Unix only take 2 arguments. #AC_C_INLINE Already checked in MySQL AC_C_BIGENDIAN diff --git a/innobase/include/lock0lock.h b/innobase/include/lock0lock.h index d642fe46fef..b99359fe998 100644 --- a/innobase/include/lock0lock.h +++ b/innobase/include/lock0lock.h @@ -490,7 +490,7 @@ on the table. */ ibool lock_is_table_exclusive( -/*=================*/ +/*====================*/ /* out: TRUE if table is only locked by trx, with LOCK_IX, and possibly LOCK_AUTO_INC */ dict_table_t* table, /* in: table */ diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index 7aed4a4ab0e..1e3eeb0de02 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -715,13 +715,41 @@ http://www.mysql.com/doc/en/Windows_symbolic_links.html */ char* full_path; int ret; struct stat statinfo; +#ifdef HAVE_READDIR_R + char dirent_buf[sizeof(struct dirent) + _POSIX_PATH_MAX + + 100]; + /* In /mysys/my_lib.c, _POSIX_PATH_MAX + 1 is used as + the max file name len; but in most standards, the + length is NAME_MAX; we add 100 to be even safer */ +#endif + next_file: - ent = readdir(dir); + +#ifdef HAVE_READDIR_R + ret = readdir_r(dir, (struct dirent*)dirent_buf, &ent); + + if (ret != 0) { + fprintf(stderr, +"InnoDB: cannot read directory %s, error %lu\n", dirname, (ulong)ret); + + return(-1); + } if (ent == NULL) { + /* End of directory */ + return(1); } + ut_a(strlen(ent->d_name) < _POSIX_PATH_MAX + 100 - 1); +#else + ent = readdir(dir); + + if (ent == NULL) { + + return(1); + } +#endif ut_a(strlen(ent->d_name) < OS_FILE_MAX_PATH); if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) { diff --git a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c index b67be77b29e..732380bcb1f 100644 --- a/innobase/ut/ut0ut.c +++ b/innobase/ut/ut0ut.c @@ -235,13 +235,18 @@ ut_get_year_month_day( *month = (ulint)cal_tm.wMonth; *day = (ulint)cal_tm.wDay; #else + struct tm cal_tm; struct tm* cal_tm_ptr; time_t tm; time(&tm); +#ifdef HAVE_LOCALTIME_R + localtime_r(&tm, &cal_tm); + cal_tm_ptr = &cal_tm; +#else cal_tm_ptr = localtime(&tm); - +#endif *year = (ulint)cal_tm_ptr->tm_year + 1900; *month = (ulint)cal_tm_ptr->tm_mon + 1; *day = (ulint)cal_tm_ptr->tm_mday; diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index 56762f5771e..ff2feea4474 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -26,7 +26,7 @@ DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \ -DDATADIR="\"$(MYSQLDATAdir)\"" \ -DSHAREDIR="\"$(MYSQLSHAREdir)\"" INCLUDES= @MT_INCLUDES@ @bdb_includes@ -I$(top_srcdir)/include \ - -I$(top_srcdir)/sql -I$(top_srcdir)/regex \ + -I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples -I$(top_srcdir)/regex \ $(openssl_includes) @ZLIB_INCLUDES@ noinst_LIBRARIES = libmysqld_int.a @@ -35,6 +35,7 @@ SUBDIRS = . examples libmysqld_sources= libmysqld.c lib_sql.cc emb_qcache.cc libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \ my_time.c +sqlexamplessources = ha_example.cc ha_archive.cc ha_tina.cc noinst_HEADERS = embedded_priv.h emb_qcache.h @@ -61,7 +62,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \ sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \ parse_file.cc sql_view.cc sql_trigger.cc -libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) +libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources) libmysqld_a_SOURCES= # automake misses these @@ -125,12 +126,16 @@ link_sources: rm -f $(srcdir)/$$f; \ @LN_CP_F@ $(srcdir)/../libmysql/$$f $(srcdir)/$$f; \ done; \ + for f in $(sqlexamplessources); do \ + rm -f $(srcdir)/$$f; \ + @LN_CP_F@ $(srcdir)/../sql/examples/$$f $(srcdir)/$$f; \ + done; \ rm -f $(srcdir)/client_settings.h; \ @LN_CP_F@ $(srcdir)/../libmysql/client_settings.h $(srcdir)/client_settings.h; clean-local: - rm -f `echo $(sqlsources) $(libmysqlsources) | sed "s;\.lo;.c;g"` \ + rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) | sed "s;\.lo;.c;g"` \ $(top_srcdir)/linked_libmysqld_sources; \ rm -f client_settings.h diff --git a/myisam/mi_packrec.c b/myisam/mi_packrec.c index 94eb2de17e2..a277c2ca9d1 100644 --- a/myisam/mi_packrec.c +++ b/myisam/mi_packrec.c @@ -42,8 +42,9 @@ { bits-=(bit+1); break; } \ pos+= *pos +#define OFFSET_TABLE_SIZE 512 -static void read_huff_table(MI_BIT_BUFF *bit_buff,MI_DECODE_TREE *decode_tree, +static uint read_huff_table(MI_BIT_BUFF *bit_buff,MI_DECODE_TREE *decode_tree, uint16 **decode_table,byte **intervall_buff, uint16 *tmp_buff); static void make_quick_table(uint16 *to_table,uint16 *decode_table, @@ -53,7 +54,7 @@ static void fill_quick_table(uint16 *table,uint bits, uint max_bits, uint value); static uint copy_decode_table(uint16 *to_pos,uint offset, uint16 *decode_table); -static uint find_longest_bitstream(uint16 *table); +static uint find_longest_bitstream(uint16 *table, uint16 *end); static void (*get_unpack_function(MI_COLUMNDEF *rec))(MI_COLUMNDEF *field, MI_BIT_BUFF *buff, uchar *to, @@ -146,12 +147,12 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) { if (!my_errno) my_errno=HA_ERR_END_OF_FILE; - DBUG_RETURN(1); + goto err0; } if (memcmp((byte*) header,(byte*) myisam_pack_file_magic,4)) { my_errno=HA_ERR_WRONG_IN_RECORD; - DBUG_RETURN(1); + goto err0; } share->pack.header_length= uint4korr(header+4); share->min_pack_length=(uint) uint4korr(header+8); @@ -173,20 +174,20 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) my_malloc((uint) (trees*sizeof(MI_DECODE_TREE)+ intervall_length*sizeof(byte)), MYF(MY_WME)))) - DBUG_RETURN(1); + goto err0; intervall_buff=(byte*) (share->decode_trees+trees); length=(uint) (elements*2+trees*(1 << myisam_quick_table_bits)); if (!(share->decode_tables=(uint16*) - my_malloc((length+512)*sizeof(uint16)+ + my_malloc((length+OFFSET_TABLE_SIZE)*sizeof(uint16)+ (uint) (share->pack.header_length+7), MYF(MY_WME | MY_ZEROFILL)))) { my_free((gptr) share->decode_trees,MYF(0)); - DBUG_RETURN(1); + goto err1; } tmp_buff=share->decode_tables+length; - disk_cache=(byte*) (tmp_buff+512); + disk_cache=(byte*) (tmp_buff+OFFSET_TABLE_SIZE); if (my_read(file,disk_cache, (uint) (share->pack.header_length-sizeof(header)), @@ -194,7 +195,7 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) { my_free((gptr) share->decode_trees,MYF(0)); my_free((gptr) share->decode_tables,MYF(0)); - DBUG_RETURN(1); + goto err2; } huff_tree_bits=max_bit(trees ? trees-1 : 0); @@ -213,8 +214,9 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) skip_to_next_byte(&bit_buff); decode_table=share->decode_tables; for (i=0 ; i < trees ; i++) - read_huff_table(&bit_buff,share->decode_trees+i,&decode_table, - &intervall_buff,tmp_buff); + if (read_huff_table(&bit_buff,share->decode_trees+i,&decode_table, + &intervall_buff,tmp_buff)) + goto err3; decode_table=(uint16*) my_realloc((gptr) share->decode_tables, (uint) ((byte*) decode_table - (byte*) share->decode_tables), @@ -224,8 +226,7 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) share->decode_tables=decode_table; for (i=0 ; i < trees ; i++) share->decode_trees[i].table=ADD_TO_PTR(share->decode_trees[i].table, - diff, - uint16*); + diff, uint16*); } /* Fix record-ref-length for keys */ @@ -242,19 +243,24 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) } if (bit_buff.error || bit_buff.pos < bit_buff.end) - { /* info_length was wrong */ - my_errno=HA_ERR_WRONG_IN_RECORD; - my_free((gptr) share->decode_trees,MYF(0)); - my_free((gptr) share->decode_tables,MYF(0)); - DBUG_RETURN(1); - } + goto err3; + DBUG_RETURN(0); + +err3: + my_errno=HA_ERR_WRONG_IN_RECORD; +err2: + my_free((gptr) share->decode_tables,MYF(0)); +err1: + my_free((gptr) share->decode_trees,MYF(0)); +err0: + DBUG_RETURN(1); } /* Read on huff-code-table from datafile */ -static void read_huff_table(MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree, +static uint read_huff_table(MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree, uint16 **decode_table, byte **intervall_buff, uint16 *tmp_buff) { @@ -297,7 +303,9 @@ static void read_huff_table(MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree, decode_tree->intervalls= *intervall_buff; if (! intervall_length) { - table_bits=find_longest_bitstream(tmp_buff); + table_bits=find_longest_bitstream(tmp_buff, tmp_buff+OFFSET_TABLE_SIZE); + if (table_bits == (uint) ~0) + return 1; if (table_bits > myisam_quick_table_bits) table_bits=myisam_quick_table_bits; next_free_offset= (1 << table_bits); @@ -315,7 +323,7 @@ static void read_huff_table(MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree, bit_buff->pos+=intervall_length; bit_buff->bits=0; } - return; + return 0; } @@ -390,15 +398,23 @@ static uint copy_decode_table(uint16 *to_pos, uint offset, } -static uint find_longest_bitstream(uint16 *table) +static uint find_longest_bitstream(uint16 *table, uint16 *end) { uint length=1,length2; if (!(*table & IS_CHAR)) - length=find_longest_bitstream(table+ *table)+1; + { + uint16 *next= table + *table; + if (next > end || next == table) + return ~0; + length=find_longest_bitstream(next, end)+1; + } table++; if (!(*table & IS_CHAR)) { - length2=find_longest_bitstream(table+ *table)+1; + uint16 *next= table + *table; + if (next > end || next == table) + return ~0; + length2=find_longest_bitstream(table+ *table, end)+1; length=max(length,length2); } return length; diff --git a/mysql-test/include/endspace.inc b/mysql-test/include/endspace.inc new file mode 100644 index 00000000000..1692a258bde --- /dev/null +++ b/mysql-test/include/endspace.inc @@ -0,0 +1,7 @@ +select 'a' = 'a', 'a' = 'a ', 'a ' = 'a'; +select 'a\0' = 'a', 'a\0' < 'a', 'a\0' > 'a'; +select 'a' = 'a\0', 'a' < 'a\0', 'a' > 'a\0'; +select 'a\0' = 'a ', 'a\0' < 'a ', 'a\0' > 'a '; +select 'a ' = 'a\0', 'a ' < 'a\0', 'a ' > 'a\0'; +select 'a a' > 'a', 'a \0' < 'a'; +select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a'; diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index d273775725d..707f18d064e 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -1392,13 +1392,18 @@ run_testcase () # script soon anyway so it is not worth it spending the time if [ "x$USE_EMBEDDED_SERVER" = "x1" -a -z "$DO_TEST" ] ; then for t in \ + "alter_table" \ "bdb-deadlock" \ "connect" \ + "ctype_latin1_de" \ + "ctype_ucs" \ "flush_block_commit" \ "grant2" \ "grant_cache" \ "grant" \ "init_connect" \ + "init_file" \ + "innodb" \ "innodb-deadlock" \ "innodb-lock" \ "mix_innodb_myisam_binlog" \ @@ -1406,10 +1411,12 @@ run_testcase () "mysqlbinlog" \ "mysqldump" \ "mysql_protocols" \ + "packet" \ "ps_1general" \ "rename" \ "show_check" \ "system_mysql_db_fix" \ + "timezone2" \ "user_var" \ "variables" do diff --git a/mysql-test/r/ctype_big5.result.es b/mysql-test/r/ctype_big5.result.es new file mode 100644 index 00000000000..9b9fcbccbe0 --- /dev/null +++ b/mysql-test/r/ctype_big5.result.es @@ -0,0 +1,58 @@ +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; diff --git a/mysql-test/r/ctype_recoding.result.es b/mysql-test/r/ctype_recoding.result.es new file mode 100644 index 00000000000..27425a69872 --- /dev/null +++ b/mysql-test/r/ctype_recoding.result.es @@ -0,0 +1,242 @@ +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 'комментарий полÑ' +) 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_теÑÑ‚ +SHOW TABLES IN ÔÅÓÔ; +Tables_in_теÑÑ‚ +SET CHARACTER SET cp1251; +SHOW TABLES; +Tables_in_теÑÑ‚ +SHOW TABLES IN òåñò; +Tables_in_теÑÑ‚ +SET CHARACTER SET koi8r; +DROP DATABASE ÔÅÓÔ; +SET NAMES koi8r; +SELECT hex('ÔÅÓÔ'); +hex('теÑÑ‚') +D4C5D3D4 +SET character_set_connection=cp1251; +SELECT hex('ÔÅÓÔ'); +hex('теÑÑ‚') +F2E5F1F2 +USE test; +SET NAMES binary; +CREATE TABLE `теÑÑ‚` (`теÑÑ‚` int); +SHOW CREATE TABLE `теÑÑ‚`; +Table Create Table +теÑÑ‚ CREATE TABLE `теÑÑ‚` ( + `теÑÑ‚` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SET NAMES utf8; +SHOW CREATE TABLE `теÑÑ‚`; +Table Create Table +теÑÑ‚ CREATE TABLE `теÑÑ‚` ( + `теÑÑ‚` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE `теÑÑ‚`; +SET NAMES binary; +SET character_set_connection=utf8; +SELECT 'теÑÑ‚' as s; +s +теÑÑ‚ +SET NAMES utf8; +SET character_set_connection=binary; +SELECT 'теÑÑ‚' as s; +s +теÑÑ‚ +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) +ßöö ößß diff --git a/mysql-test/r/ctype_uca.result.es b/mysql-test/r/ctype_uca.result.es new file mode 100644 index 00000000000..1f86376def6 --- /dev/null +++ b/mysql-test/r/ctype_uca.result.es @@ -0,0 +1,2377 @@ +DROP TABLE IF EXISTS t1; +set names utf8; +set collation_connection=utf8_unicode_ci; +select 'a' = 'a', 'a' = 'a ', 'a ' = 'a'; +'a' = 'a' 'a' = 'a ' 'a ' = 'a' +1 1 1 +select 'a\t' = 'a' , 'a\t' < 'a' , 'a\t' > 'a'; +'a\t' = 'a' 'a\t' < 'a' 'a\t' > 'a' +0 1 0 +select 'a\t' = 'a ', 'a\t' < 'a ', 'a\t' > 'a '; +'a\t' = 'a ' 'a\t' < 'a ' 'a\t' > 'a ' +0 1 0 +select 'a' = 'a\t', 'a' < 'a\t', 'a' > 'a\t'; +'a' = 'a\t' 'a' < 'a\t' 'a' > 'a\t' +0 0 1 +select 'a ' = 'a\t', 'a ' < 'a\t', 'a ' > 'a\t'; +'a ' = 'a\t' 'a ' < 'a\t' 'a ' > 'a\t' +0 0 1 +select 'a a' > 'a', 'a \t' < 'a'; +'a a' > 'a' 'a \t' < 'a' +1 1 +select 'c' like '\_' as want0; +want0 +0 +CREATE TABLE t ( +c char(20) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +INSERT INTO t VALUES ('a'),('ab'),('aba'); +ALTER TABLE t ADD INDEX (c); +SELECT c FROM t WHERE c LIKE 'a%'; +c +a +ab +aba +DROP TABLE t; +create table t1 (c1 char(10) character set utf8 collate utf8_bin); +insert into t1 values ('A'),('a'); +insert into t1 values ('B'),('b'); +insert into t1 values ('C'),('c'); +insert into t1 values ('D'),('d'); +insert into t1 values ('E'),('e'); +insert into t1 values ('F'),('f'); +insert into t1 values ('G'),('g'); +insert into t1 values ('H'),('h'); +insert into t1 values ('I'),('i'); +insert into t1 values ('J'),('j'); +insert into t1 values ('K'),('k'); +insert into t1 values ('L'),('l'); +insert into t1 values ('M'),('m'); +insert into t1 values ('N'),('n'); +insert into t1 values ('O'),('o'); +insert into t1 values ('P'),('p'); +insert into t1 values ('Q'),('q'); +insert into t1 values ('R'),('r'); +insert into t1 values ('S'),('s'); +insert into t1 values ('T'),('t'); +insert into t1 values ('U'),('u'); +insert into t1 values ('V'),('v'); +insert into t1 values ('W'),('w'); +insert into t1 values ('X'),('x'); +insert into t1 values ('Y'),('y'); +insert into t1 values ('Z'),('z'); +insert into t1 values (_ucs2 0x00e0),(_ucs2 0x00c0); +insert into t1 values (_ucs2 0x00e1),(_ucs2 0x00c1); +insert into t1 values (_ucs2 0x00e2),(_ucs2 0x00c2); +insert into t1 values (_ucs2 0x00e3),(_ucs2 0x00c3); +insert into t1 values (_ucs2 0x00e4),(_ucs2 0x00c4); +insert into t1 values (_ucs2 0x00e5),(_ucs2 0x00c5); +insert into t1 values (_ucs2 0x00e6),(_ucs2 0x00c6); +insert into t1 values (_ucs2 0x00e7),(_ucs2 0x00c7); +insert into t1 values (_ucs2 0x00e8),(_ucs2 0x00c8); +insert into t1 values (_ucs2 0x00e9),(_ucs2 0x00c9); +insert into t1 values (_ucs2 0x00ea),(_ucs2 0x00ca); +insert into t1 values (_ucs2 0x00eb),(_ucs2 0x00cb); +insert into t1 values (_ucs2 0x00ec),(_ucs2 0x00cc); +insert into t1 values (_ucs2 0x00ed),(_ucs2 0x00cd); +insert into t1 values (_ucs2 0x00ee),(_ucs2 0x00ce); +insert into t1 values (_ucs2 0x00ef),(_ucs2 0x00cf); +insert into t1 values (_ucs2 0x00f0),(_ucs2 0x00d0); +insert into t1 values (_ucs2 0x00f1),(_ucs2 0x00d1); +insert into t1 values (_ucs2 0x00f2),(_ucs2 0x00d2); +insert into t1 values (_ucs2 0x00f3),(_ucs2 0x00d3); +insert into t1 values (_ucs2 0x00f4),(_ucs2 0x00d4); +insert into t1 values (_ucs2 0x00f5),(_ucs2 0x00d5); +insert into t1 values (_ucs2 0x00f6),(_ucs2 0x00d6); +insert into t1 values (_ucs2 0x00f7),(_ucs2 0x00d7); +insert into t1 values (_ucs2 0x00f8),(_ucs2 0x00d8); +insert into t1 values (_ucs2 0x00f9),(_ucs2 0x00d9); +insert into t1 values (_ucs2 0x00fa),(_ucs2 0x00da); +insert into t1 values (_ucs2 0x00fb),(_ucs2 0x00db); +insert into t1 values (_ucs2 0x00fc),(_ucs2 0x00dc); +insert into t1 values (_ucs2 0x00fd),(_ucs2 0x00dd); +insert into t1 values (_ucs2 0x00fe),(_ucs2 0x00de); +insert into t1 values (_ucs2 0x00ff),(_ucs2 0x00df); +insert into t1 values (_ucs2 0x0100),(_ucs2 0x0101),(_ucs2 0x0102),(_ucs2 0x0103); +insert into t1 values (_ucs2 0x0104),(_ucs2 0x0105),(_ucs2 0x0106),(_ucs2 0x0107); +insert into t1 values (_ucs2 0x0108),(_ucs2 0x0109),(_ucs2 0x010a),(_ucs2 0x010b); +insert into t1 values (_ucs2 0x010c),(_ucs2 0x010d),(_ucs2 0x010e),(_ucs2 0x010f); +insert into t1 values (_ucs2 0x0110),(_ucs2 0x0111),(_ucs2 0x0112),(_ucs2 0x0113); +insert into t1 values (_ucs2 0x0114),(_ucs2 0x0115),(_ucs2 0x0116),(_ucs2 0x0117); +insert into t1 values (_ucs2 0x0118),(_ucs2 0x0119),(_ucs2 0x011a),(_ucs2 0x011b); +insert into t1 values (_ucs2 0x011c),(_ucs2 0x011d),(_ucs2 0x011e),(_ucs2 0x011f); +insert into t1 values (_ucs2 0x0120),(_ucs2 0x0121),(_ucs2 0x0122),(_ucs2 0x0123); +insert into t1 values (_ucs2 0x0124),(_ucs2 0x0125),(_ucs2 0x0126),(_ucs2 0x0127); +insert into t1 values (_ucs2 0x0128),(_ucs2 0x0129),(_ucs2 0x012a),(_ucs2 0x012b); +insert into t1 values (_ucs2 0x012c),(_ucs2 0x012d),(_ucs2 0x012e),(_ucs2 0x012f); +insert into t1 values (_ucs2 0x0130),(_ucs2 0x0131),(_ucs2 0x0132),(_ucs2 0x0133); +insert into t1 values (_ucs2 0x0134),(_ucs2 0x0135),(_ucs2 0x0136),(_ucs2 0x0137); +insert into t1 values (_ucs2 0x0138),(_ucs2 0x0139),(_ucs2 0x013a),(_ucs2 0x013b); +insert into t1 values (_ucs2 0x013c),(_ucs2 0x013d),(_ucs2 0x013e),(_ucs2 0x013f); +insert into t1 values (_ucs2 0x0140),(_ucs2 0x0141),(_ucs2 0x0142),(_ucs2 0x0143); +insert into t1 values (_ucs2 0x0144),(_ucs2 0x0145),(_ucs2 0x0146),(_ucs2 0x0147); +insert into t1 values (_ucs2 0x0148),(_ucs2 0x0149),(_ucs2 0x014a),(_ucs2 0x014b); +insert into t1 values (_ucs2 0x014c),(_ucs2 0x014d),(_ucs2 0x014e),(_ucs2 0x014f); +insert into t1 values (_ucs2 0x0150),(_ucs2 0x0151),(_ucs2 0x0152),(_ucs2 0x0153); +insert into t1 values (_ucs2 0x0154),(_ucs2 0x0155),(_ucs2 0x0156),(_ucs2 0x0157); +insert into t1 values (_ucs2 0x0158),(_ucs2 0x0159),(_ucs2 0x015a),(_ucs2 0x015b); +insert into t1 values (_ucs2 0x015c),(_ucs2 0x015d),(_ucs2 0x015e),(_ucs2 0x015f); +insert into t1 values (_ucs2 0x0160),(_ucs2 0x0161),(_ucs2 0x0162),(_ucs2 0x0163); +insert into t1 values (_ucs2 0x0164),(_ucs2 0x0165),(_ucs2 0x0166),(_ucs2 0x0167); +insert into t1 values (_ucs2 0x0168),(_ucs2 0x0169),(_ucs2 0x016a),(_ucs2 0x016b); +insert into t1 values (_ucs2 0x016c),(_ucs2 0x016d),(_ucs2 0x016e),(_ucs2 0x016f); +insert into t1 values (_ucs2 0x0170),(_ucs2 0x0171),(_ucs2 0x0172),(_ucs2 0x0173); +insert into t1 values (_ucs2 0x0174),(_ucs2 0x0175),(_ucs2 0x0176),(_ucs2 0x0177); +insert into t1 values (_ucs2 0x0178),(_ucs2 0x0179),(_ucs2 0x017a),(_ucs2 0x017b); +insert into t1 values (_ucs2 0x017c),(_ucs2 0x017d),(_ucs2 0x017e),(_ucs2 0x017f); +insert into t1 values (_ucs2 0x0180),(_ucs2 0x0181),(_ucs2 0x0182),(_ucs2 0x0183); +insert into t1 values (_ucs2 0x0184),(_ucs2 0x0185),(_ucs2 0x0186),(_ucs2 0x0187); +insert into t1 values (_ucs2 0x0188),(_ucs2 0x0189),(_ucs2 0x018a),(_ucs2 0x018b); +insert into t1 values (_ucs2 0x018c),(_ucs2 0x018d),(_ucs2 0x018e),(_ucs2 0x018f); +insert into t1 values (_ucs2 0x0190),(_ucs2 0x0191),(_ucs2 0x0192),(_ucs2 0x0193); +insert into t1 values (_ucs2 0x0194),(_ucs2 0x0195),(_ucs2 0x0196),(_ucs2 0x0197); +insert into t1 values (_ucs2 0x0198),(_ucs2 0x0199),(_ucs2 0x019a),(_ucs2 0x019b); +insert into t1 values (_ucs2 0x019c),(_ucs2 0x019d),(_ucs2 0x019e),(_ucs2 0x019f); +insert into t1 values (_ucs2 0x01a0),(_ucs2 0x01a1),(_ucs2 0x01a2),(_ucs2 0x01a3); +insert into t1 values (_ucs2 0x01a4),(_ucs2 0x01a5),(_ucs2 0x01a6),(_ucs2 0x01a7); +insert into t1 values (_ucs2 0x01a8),(_ucs2 0x01a9),(_ucs2 0x01aa),(_ucs2 0x01ab); +insert into t1 values (_ucs2 0x01ac),(_ucs2 0x01ad),(_ucs2 0x01ae),(_ucs2 0x01af); +insert into t1 values (_ucs2 0x01b0),(_ucs2 0x01b1),(_ucs2 0x01b2),(_ucs2 0x01b3); +insert into t1 values (_ucs2 0x01b4),(_ucs2 0x01b5),(_ucs2 0x01b6),(_ucs2 0x01b7); +insert into t1 values (_ucs2 0x01b8),(_ucs2 0x01b9),(_ucs2 0x01ba),(_ucs2 0x01bb); +insert into t1 values (_ucs2 0x01bc),(_ucs2 0x01bd),(_ucs2 0x01be),(_ucs2 0x01bf); +insert into t1 values (_ucs2 0x01c0),(_ucs2 0x01c1),(_ucs2 0x01c2),(_ucs2 0x01c3); +insert into t1 values (_ucs2 0x01c4),(_ucs2 0x01c5),(_ucs2 0x01c6),(_ucs2 0x01c7); +insert into t1 values (_ucs2 0x01c8),(_ucs2 0x01c9),(_ucs2 0x01ca),(_ucs2 0x01cb); +insert into t1 values (_ucs2 0x01cc),(_ucs2 0x01cd),(_ucs2 0x01ce),(_ucs2 0x01cf); +insert into t1 values (_ucs2 0x01d0),(_ucs2 0x01d1),(_ucs2 0x01d2),(_ucs2 0x01d3); +insert into t1 values (_ucs2 0x01d4),(_ucs2 0x01d5),(_ucs2 0x01d6),(_ucs2 0x01d7); +insert into t1 values (_ucs2 0x01d8),(_ucs2 0x01d9),(_ucs2 0x01da),(_ucs2 0x01db); +insert into t1 values (_ucs2 0x01dc),(_ucs2 0x01dd),(_ucs2 0x01de),(_ucs2 0x01df); +insert into t1 values (_ucs2 0x01e0),(_ucs2 0x01e1),(_ucs2 0x01e2),(_ucs2 0x01e3); +insert into t1 values (_ucs2 0x01e4),(_ucs2 0x01e5),(_ucs2 0x01e6),(_ucs2 0x01e7); +insert into t1 values (_ucs2 0x01e8),(_ucs2 0x01e9),(_ucs2 0x01ea),(_ucs2 0x01eb); +insert into t1 values (_ucs2 0x01ec),(_ucs2 0x01ed),(_ucs2 0x01ee),(_ucs2 0x01ef); +insert into t1 values (_ucs2 0x01f0),(_ucs2 0x01f1),(_ucs2 0x01f2),(_ucs2 0x01f3); +insert into t1 values (_ucs2 0x01f4),(_ucs2 0x01f5),(_ucs2 0x01f6),(_ucs2 0x01f7); +insert into t1 values (_ucs2 0x01f8),(_ucs2 0x01f9),(_ucs2 0x01fa),(_ucs2 0x01fb); +insert into t1 values (_ucs2 0x01fc),(_ucs2 0x01fd),(_ucs2 0x01fe),(_ucs2 0x01ff); +insert into t1 values ('AA'),('Aa'),('aa'),('aA'); +insert into t1 values ('CH'),('Ch'),('ch'),('cH'); +insert into t1 values ('DZ'),('Dz'),('dz'),('dZ'); +insert into t1 values ('IJ'),('Ij'),('ij'),('iJ'); +insert into t1 values ('LJ'),('Lj'),('lj'),('lJ'); +insert into t1 values ('LL'),('Ll'),('ll'),('lL'); +insert into t1 values ('NJ'),('Nj'),('nj'),('nJ'); +insert into t1 values ('OE'),('Oe'),('oe'),('oE'); +insert into t1 values ('SS'),('Ss'),('ss'),('sS'); +insert into t1 values ('RR'),('Rr'),('rr'),('rR'); +select group_concat(c1 order by c1) from t1 group by c1 collate utf8_unicode_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Ã,Â,Ã,Ä,Ã…,à ,á,â,ã,ä,Ã¥,Ä€,Ä,Ä‚,ă,Ä„,Ä…,Ç,ÇŽ,Çž,ÇŸ,Ç ,Ç¡,Ǻ,Ç» +AA,Aa,aA,aa +Æ,æ,Ç¢,Ç£,Ǽ,ǽ +B,b +Æ€ +Æ +Æ‚,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,ÄŠ,Ä‹,ÄŒ,Ä +CH,Ch,cH,ch +Ƈ,ƈ +D,d,ÄŽ,Ä +DZ,Dz,dZ,dz,Ç„,Ç…,dž,DZ,Dz,dz +Ä,Ä‘ +Ɖ +ÆŠ +Æ‹,ÆŒ +Ã,ð +E,e,È,É,Ê,Ë,è,é,ê,ë,Ä’,Ä“,Ä”,Ä•,Ä–,Ä—,Ę,Ä™,Äš,Ä› +ÆŽ,Ç +Æ +Æ +F,f +Æ‘,Æ’ +G,g,Äœ,Ä,Äž,ÄŸ,Ä ,Ä¡,Ä¢,Ä£,Ǧ,ǧ,Ç´,ǵ +Ǥ,Ç¥ +Æ“ +Æ” +Æ¢,Æ£ +H,h,Ĥ,Ä¥ +Æ•,Ƕ +Ħ,ħ +I,i,ÃŒ,Ã,ÃŽ,Ã,ì,Ã,î,ï,Ĩ,Ä©,Ī,Ä«,Ĭ,Ä,Ä®,į,Ä°,Ç,Ç +IJ,Ij,iJ,ij,IJ,ij +ı +Æ— +Æ– +J,j,Ä´,ĵ,Ç° +K,k,Ķ,Ä·,Ǩ,Ç© +Ƙ,Æ™ +L,l,Ĺ,ĺ,Ä»,ļ,Ľ,ľ +Ä¿,Å€ +LJ,Lj,lJ,lj,LJ,Lj,lj +LL,Ll,lL,ll +Å,Å‚ +Æš +Æ› +M,m +N,n,Ñ,ñ,Ń,Å„,Å…,ņ,Ň,ň,Ǹ,ǹ +NJ,Nj,nJ,nj,ÇŠ,Ç‹,ÇŒ +Æ +Æž +ÅŠ,Å‹ +O,o,Ã’,Ó,Ô,Õ,Ö,ò,ó,ô,õ,ö,ÅŒ,Å,ÅŽ,Å,Å,Å‘,Æ ,Æ¡,Ç‘,Ç’,Ǫ,Ç«,Ǭ,Ç +OE,Oe,oE,oe,Å’,Å“ +Ø,ø,Ǿ,Ç¿ +Ɔ +ÆŸ +P,p +Ƥ,Æ¥ +Q,q +ĸ +R,r,Å”,Å•,Å–,Å—,Ř,Å™ +RR,Rr,rR,rr +Ʀ +S,s,Åš,Å›,Åœ,Å,Åž,ÅŸ,Å ,Å¡,Å¿ +SS,Ss,sS,ss,ß +Æ© +ƪ +T,t,Å¢,Å£,Ť,Å¥ +ƾ +Ŧ,ŧ +Æ« +Ƭ,Æ +Æ® +U,u,Ù,Ú,Û,Ãœ,ù,ú,û,ü,Ũ,Å©,Ū,Å«,Ŭ,Å,Å®,ů,Å°,ű,Ų,ų,Ư,Æ°,Ç“,Ç”,Ç•,Ç–,Ç—,ǘ,Ç™,Çš,Ç›,Çœ +Æœ +Ʊ +V,v +Ʋ +W,w,Å´,ŵ +X,x +Y,y,Ã,ý,ÿ,Ŷ,Å·,Ÿ +Ƴ,Æ´ +Z,z,Ź,ź,Å»,ż,Ž,ž +Æ +Ƶ,ƶ +Æ·,Ç®,ǯ +Ƹ,ƹ +ƺ +Þ,þ +Æ¿,Ç· +Æ» +Ƨ,ƨ +Ƽ,ƽ +Æ„,Æ… +ʼn +Ç€ +Ç +Ç‚ +ǃ +select group_concat(c1 order by c1) from t1 group by c1 collate utf8_icelandic_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Â,Ã,à ,â,ã,Ä€,Ä,Ä‚,ă,Ä„,Ä…,Ç,ÇŽ,Çž,ÇŸ,Ç ,Ç¡,Ǻ,Ç» +AA,Aa,aA,aa +Ã,á +Ç¢,Ç£,Ǽ,ǽ +B,b +Æ€ +Æ +Æ‚,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,ÄŠ,Ä‹,ÄŒ,Ä +CH,Ch,cH,ch +Ƈ,ƈ +D,d,ÄŽ,Ä +DZ,Dz,dZ,dz,Ç„,Ç…,dž,DZ,Dz,dz +Ã,ð +Ä,Ä‘ +Ɖ +ÆŠ +Æ‹,ÆŒ +E,e,È,Ê,Ë,è,ê,ë,Ä’,Ä“,Ä”,Ä•,Ä–,Ä—,Ę,Ä™,Äš,Ä› +É,é +ÆŽ,Ç +Æ +Æ +F,f +Æ‘,Æ’ +G,g,Äœ,Ä,Äž,ÄŸ,Ä ,Ä¡,Ä¢,Ä£,Ǧ,ǧ,Ç´,ǵ +Ǥ,Ç¥ +Æ“ +Æ” +Æ¢,Æ£ +H,h,Ĥ,Ä¥ +Æ•,Ƕ +Ħ,ħ +I,i,ÃŒ,ÃŽ,Ã,ì,î,ï,Ĩ,Ä©,Ī,Ä«,Ĭ,Ä,Ä®,į,Ä°,Ç,Ç +IJ,Ij,iJ,ij,IJ,ij +Ã,à +ı +Æ— +Æ– +J,j,Ä´,ĵ,Ç° +K,k,Ķ,Ä·,Ǩ,Ç© +Ƙ,Æ™ +L,l,Ĺ,ĺ,Ä»,ļ,Ľ,ľ +Ä¿,Å€ +LJ,Lj,lJ,lj,LJ,Lj,lj +LL,Ll,lL,ll +Å,Å‚ +Æš +Æ› +M,m +N,n,Ñ,ñ,Ń,Å„,Å…,ņ,Ň,ň,Ǹ,ǹ +NJ,Nj,nJ,nj,ÇŠ,Ç‹,ÇŒ +Æ +Æž +ÅŠ,Å‹ +O,o,Ã’,Ô,Õ,ò,ô,õ,ÅŒ,Å,ÅŽ,Å,Å,Å‘,Æ ,Æ¡,Ç‘,Ç’,Ǫ,Ç«,Ǭ,Ç +OE,Oe,oE,oe,Å’,Å“ +Ó,ó +Ǿ,Ç¿ +Ɔ +ÆŸ +P,p +Ƥ,Æ¥ +Q,q +ĸ +R,r,Å”,Å•,Å–,Å—,Ř,Å™ +RR,Rr,rR,rr +Ʀ +S,s,Åš,Å›,Åœ,Å,Åž,ÅŸ,Å ,Å¡,Å¿ +SS,Ss,sS,ss,ß +Æ© +ƪ +T,t,Å¢,Å£,Ť,Å¥ +ƾ +Ŧ,ŧ +Æ« +Ƭ,Æ +Æ® +U,u,Ù,Û,Ãœ,ù,û,ü,Ũ,Å©,Ū,Å«,Ŭ,Å,Å®,ů,Å°,ű,Ų,ų,Ư,Æ°,Ç“,Ç”,Ç•,Ç–,Ç—,ǘ,Ç™,Çš,Ç›,Çœ +Ú,ú +Æœ +Ʊ +V,v +Ʋ +W,w,Å´,ŵ +X,x +Y,y,ÿ,Ŷ,Å·,Ÿ +Ã,ý +Ƴ,Æ´ +Z,z,Ź,ź,Å»,ż,Ž,ž +Æ +Þ,þ +Ä,Æ,ä,æ +Ö,Ø,ö,ø +Ã…,Ã¥ +Ƶ,ƶ +Æ·,Ç®,ǯ +Ƹ,ƹ +ƺ +Æ¿,Ç· +Æ» +Ƨ,ƨ +Ƽ,ƽ +Æ„,Æ… +ʼn +Ç€ +Ç +Ç‚ +ǃ +select group_concat(c1 order by c1) from t1 group by c1 collate utf8_latvian_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Ã,Â,Ã,Ä,Ã…,à ,á,â,ã,ä,Ã¥,Ä€,Ä,Ä‚,ă,Ä„,Ä…,Ç,ÇŽ,Çž,ÇŸ,Ç ,Ç¡,Ǻ,Ç» +AA,Aa,aA,aa +Æ,æ,Ç¢,Ç£,Ǽ,ǽ +B,b +Æ€ +Æ +Æ‚,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,ÄŠ,Ä‹ +CH,Ch,cH,ch +ÄŒ,Ä +Ƈ,ƈ +D,d,ÄŽ,Ä +DZ,Dz,dZ,dz,Ç„,Ç…,dž,DZ,Dz,dz +Ä,Ä‘ +Ɖ +ÆŠ +Æ‹,ÆŒ +Ã,ð +E,e,È,É,Ê,Ë,è,é,ê,ë,Ä’,Ä“,Ä”,Ä•,Ä–,Ä—,Ę,Ä™,Äš,Ä› +ÆŽ,Ç +Æ +Æ +F,f +Æ‘,Æ’ +G,g,Äœ,Ä,Äž,ÄŸ,Ä ,Ä¡,Ǧ,ǧ,Ç´,ǵ +Ä¢,Ä£ +Ǥ,Ç¥ +Æ“ +Æ” +Æ¢,Æ£ +H,h,Ĥ,Ä¥ +Æ•,Ƕ +Ħ,ħ +I,i,ÃŒ,Ã,ÃŽ,Ã,ì,Ã,î,ï,Ĩ,Ä©,Ī,Ä«,Ĭ,Ä,Ä®,į,Ä°,Ç,Ç +IJ,Ij,iJ,ij,IJ,ij +Y,y +ı +Æ— +Æ– +J,j,Ä´,ĵ,Ç° +K,k,Ǩ,Ç© +Ķ,Ä· +Ƙ,Æ™ +L,l,Ĺ,ĺ,Ľ,ľ +Ä¿,Å€ +LJ,Lj,lJ,lj,LJ,Lj,lj +LL,Ll,lL,ll +Ä»,ļ +Å,Å‚ +Æš +Æ› +M,m +N,n,Ñ,ñ,Ń,Å„,Ň,ň,Ǹ,ǹ +NJ,Nj,nJ,nj,ÇŠ,Ç‹,ÇŒ +Å…,ņ +Æ +Æž +ÅŠ,Å‹ +O,o,Ã’,Ó,Ô,Õ,Ö,ò,ó,ô,õ,ö,ÅŒ,Å,ÅŽ,Å,Å,Å‘,Æ ,Æ¡,Ç‘,Ç’,Ǫ,Ç«,Ǭ,Ç +OE,Oe,oE,oe,Å’,Å“ +Ø,ø,Ǿ,Ç¿ +Ɔ +ÆŸ +P,p +Ƥ,Æ¥ +Q,q +ĸ +R,r,Å”,Å•,Ř,Å™ +RR,Rr,rR,rr +Å–,Å— +Ʀ +S,s,Åš,Å›,Åœ,Å,Åž,ÅŸ,Å¿ +SS,Ss,sS,ss,ß +Å ,Å¡ +Æ© +ƪ +T,t,Å¢,Å£,Ť,Å¥ +ƾ +Ŧ,ŧ +Æ« +Ƭ,Æ +Æ® +U,u,Ù,Ú,Û,Ãœ,ù,ú,û,ü,Ũ,Å©,Ū,Å«,Ŭ,Å,Å®,ů,Å°,ű,Ų,ų,Ư,Æ°,Ç“,Ç”,Ç•,Ç–,Ç—,ǘ,Ç™,Çš,Ç›,Çœ +Æœ +Ʊ +V,v +Ʋ +W,w,Å´,ŵ +X,x +Ã,ý,ÿ,Ŷ,Å·,Ÿ +Ƴ,Æ´ +Z,z,Ź,ź,Å»,ż +Æ +Ž,ž +Ƶ,ƶ +Æ·,Ç®,ǯ +Ƹ,ƹ +ƺ +Þ,þ +Æ¿,Ç· +Æ» +Ƨ,ƨ +Ƽ,ƽ +Æ„,Æ… +ʼn +Ç€ +Ç +Ç‚ +ǃ +select group_concat(c1 order by c1) from t1 group by c1 collate utf8_romanian_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Ã,Ã,Ä,Ã…,à ,á,ã,ä,Ã¥,Ä€,Ä,Ä„,Ä…,Ç,ÇŽ,Çž,ÇŸ,Ç ,Ç¡,Ǻ,Ç» +AA,Aa,aA,aa +Ä‚,ă +Â,â +Æ,æ,Ç¢,Ç£,Ǽ,ǽ +B,b +Æ€ +Æ +Æ‚,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,ÄŠ,Ä‹,ÄŒ,Ä +CH,Ch,cH,ch +Ƈ,ƈ +D,d,ÄŽ,Ä +DZ,Dz,dZ,dz,Ç„,Ç…,dž,DZ,Dz,dz +Ä,Ä‘ +Ɖ +ÆŠ +Æ‹,ÆŒ +Ã,ð +E,e,È,É,Ê,Ë,è,é,ê,ë,Ä’,Ä“,Ä”,Ä•,Ä–,Ä—,Ę,Ä™,Äš,Ä› +ÆŽ,Ç +Æ +Æ +F,f +Æ‘,Æ’ +G,g,Äœ,Ä,Äž,ÄŸ,Ä ,Ä¡,Ä¢,Ä£,Ǧ,ǧ,Ç´,ǵ +Ǥ,Ç¥ +Æ“ +Æ” +Æ¢,Æ£ +H,h,Ĥ,Ä¥ +Æ•,Ƕ +Ħ,ħ +I,i,ÃŒ,Ã,Ã,ì,Ã,ï,Ĩ,Ä©,Ī,Ä«,Ĭ,Ä,Ä®,į,Ä°,Ç,Ç +IJ,Ij,iJ,ij,IJ,ij +ÃŽ,î +ı +Æ— +Æ– +J,j,Ä´,ĵ,Ç° +K,k,Ķ,Ä·,Ǩ,Ç© +Ƙ,Æ™ +L,l,Ĺ,ĺ,Ä»,ļ,Ľ,ľ +Ä¿,Å€ +LJ,Lj,lJ,lj,LJ,Lj,lj +LL,Ll,lL,ll +Å,Å‚ +Æš +Æ› +M,m +N,n,Ñ,ñ,Ń,Å„,Å…,ņ,Ň,ň,Ǹ,ǹ +NJ,Nj,nJ,nj,ÇŠ,Ç‹,ÇŒ +Æ +Æž +ÅŠ,Å‹ +O,o,Ã’,Ó,Ô,Õ,Ö,ò,ó,ô,õ,ö,ÅŒ,Å,ÅŽ,Å,Å,Å‘,Æ ,Æ¡,Ç‘,Ç’,Ǫ,Ç«,Ǭ,Ç +OE,Oe,oE,oe,Å’,Å“ +Ø,ø,Ǿ,Ç¿ +Ɔ +ÆŸ +P,p +Ƥ,Æ¥ +Q,q +ĸ +R,r,Å”,Å•,Å–,Å—,Ř,Å™ +RR,Rr,rR,rr +Ʀ +S,s,Åš,Å›,Åœ,Å,Å ,Å¡,Å¿ +SS,Ss,sS,ss,ß +Åž,ÅŸ +Æ© +ƪ +T,t,Ť,Å¥ +ƾ +Å¢,Å£ +Ŧ,ŧ +Æ« +Ƭ,Æ +Æ® +U,u,Ù,Ú,Û,Ãœ,ù,ú,û,ü,Ũ,Å©,Ū,Å«,Ŭ,Å,Å®,ů,Å°,ű,Ų,ų,Ư,Æ°,Ç“,Ç”,Ç•,Ç–,Ç—,ǘ,Ç™,Çš,Ç›,Çœ +Æœ +Ʊ +V,v +Ʋ +W,w,Å´,ŵ +X,x +Y,y,Ã,ý,ÿ,Ŷ,Å·,Ÿ +Ƴ,Æ´ +Z,z,Ź,ź,Å»,ż,Ž,ž +Æ +Ƶ,ƶ +Æ·,Ç®,ǯ +Ƹ,ƹ +ƺ +Þ,þ +Æ¿,Ç· +Æ» +Ƨ,ƨ +Ƽ,ƽ +Æ„,Æ… +ʼn +Ç€ +Ç +Ç‚ +ǃ +select group_concat(c1 order by c1) from t1 group by c1 collate utf8_slovenian_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Ã,Â,Ã,Ä,Ã…,à ,á,â,ã,ä,Ã¥,Ä€,Ä,Ä‚,ă,Ä„,Ä…,Ç,ÇŽ,Çž,ÇŸ,Ç ,Ç¡,Ǻ,Ç» +AA,Aa,aA,aa +Æ,æ,Ç¢,Ç£,Ǽ,ǽ +B,b +Æ€ +Æ +Æ‚,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,ÄŠ,Ä‹ +CH,Ch,cH,ch +ÄŒ,Ä +Ƈ,ƈ +D,d,ÄŽ,Ä +DZ,Dz,dZ,dz,Ç„,Ç…,dž,DZ,Dz,dz +Ä,Ä‘ +Ɖ +ÆŠ +Æ‹,ÆŒ +Ã,ð +E,e,È,É,Ê,Ë,è,é,ê,ë,Ä’,Ä“,Ä”,Ä•,Ä–,Ä—,Ę,Ä™,Äš,Ä› +ÆŽ,Ç +Æ +Æ +F,f +Æ‘,Æ’ +G,g,Äœ,Ä,Äž,ÄŸ,Ä ,Ä¡,Ä¢,Ä£,Ǧ,ǧ,Ç´,ǵ +Ǥ,Ç¥ +Æ“ +Æ” +Æ¢,Æ£ +H,h,Ĥ,Ä¥ +Æ•,Ƕ +Ħ,ħ +I,i,ÃŒ,Ã,ÃŽ,Ã,ì,Ã,î,ï,Ĩ,Ä©,Ī,Ä«,Ĭ,Ä,Ä®,į,Ä°,Ç,Ç +IJ,Ij,iJ,ij,IJ,ij +ı +Æ— +Æ– +J,j,Ä´,ĵ,Ç° +K,k,Ķ,Ä·,Ǩ,Ç© +Ƙ,Æ™ +L,l,Ĺ,ĺ,Ä»,ļ,Ľ,ľ +Ä¿,Å€ +LJ,Lj,lJ,lj,LJ,Lj,lj +LL,Ll,lL,ll +Å,Å‚ +Æš +Æ› +M,m +N,n,Ñ,ñ,Ń,Å„,Å…,ņ,Ň,ň,Ǹ,ǹ +NJ,Nj,nJ,nj,ÇŠ,Ç‹,ÇŒ +Æ +Æž +ÅŠ,Å‹ +O,o,Ã’,Ó,Ô,Õ,Ö,ò,ó,ô,õ,ö,ÅŒ,Å,ÅŽ,Å,Å,Å‘,Æ ,Æ¡,Ç‘,Ç’,Ǫ,Ç«,Ǭ,Ç +OE,Oe,oE,oe,Å’,Å“ +Ø,ø,Ǿ,Ç¿ +Ɔ +ÆŸ +P,p +Ƥ,Æ¥ +Q,q +ĸ +R,r,Å”,Å•,Å–,Å—,Ř,Å™ +RR,Rr,rR,rr +Ʀ +S,s,Åš,Å›,Åœ,Å,Åž,ÅŸ,Å¿ +SS,Ss,sS,ss,ß +Å ,Å¡ +Æ© +ƪ +T,t,Å¢,Å£,Ť,Å¥ +ƾ +Ŧ,ŧ +Æ« +Ƭ,Æ +Æ® +U,u,Ù,Ú,Û,Ãœ,ù,ú,û,ü,Ũ,Å©,Ū,Å«,Ŭ,Å,Å®,ů,Å°,ű,Ų,ų,Ư,Æ°,Ç“,Ç”,Ç•,Ç–,Ç—,ǘ,Ç™,Çš,Ç›,Çœ +Æœ +Ʊ +V,v +Ʋ +W,w,Å´,ŵ +X,x +Y,y,Ã,ý,ÿ,Ŷ,Å·,Ÿ +Ƴ,Æ´ +Z,z,Ź,ź,Å»,ż +Æ +Ž,ž +Ƶ,ƶ +Æ·,Ç®,ǯ +Ƹ,ƹ +ƺ +Þ,þ +Æ¿,Ç· +Æ» +Ƨ,ƨ +Ƽ,ƽ +Æ„,Æ… +ʼn +Ç€ +Ç +Ç‚ +ǃ +select group_concat(c1 order by c1) from t1 group by c1 collate utf8_polish_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Ã,Â,Ã,Ä,Ã…,à ,á,â,ã,ä,Ã¥,Ä€,Ä,Ä‚,ă,Ç,ÇŽ,Çž,ÇŸ,Ç ,Ç¡,Ǻ,Ç» +AA,Aa,aA,aa +Ä„,Ä… +Æ,æ,Ç¢,Ç£,Ǽ,ǽ +B,b +Æ€ +Æ +Æ‚,ƃ +C,c,Ç,ç,Ĉ,ĉ,ÄŠ,Ä‹,ÄŒ,Ä +CH,Ch,cH,ch +Ć,ć +Ƈ,ƈ +D,d,ÄŽ,Ä +DZ,Dz,dZ,dz,Ç„,Ç…,dž,DZ,Dz,dz +Ä,Ä‘ +Ɖ +ÆŠ +Æ‹,ÆŒ +Ã,ð +E,e,È,É,Ê,Ë,è,é,ê,ë,Ä’,Ä“,Ä”,Ä•,Ä–,Ä—,Äš,Ä› +Ę,Ä™ +ÆŽ,Ç +Æ +Æ +F,f +Æ‘,Æ’ +G,g,Äœ,Ä,Äž,ÄŸ,Ä ,Ä¡,Ä¢,Ä£,Ǧ,ǧ,Ç´,ǵ +Ǥ,Ç¥ +Æ“ +Æ” +Æ¢,Æ£ +H,h,Ĥ,Ä¥ +Æ•,Ƕ +Ħ,ħ +I,i,ÃŒ,Ã,ÃŽ,Ã,ì,Ã,î,ï,Ĩ,Ä©,Ī,Ä«,Ĭ,Ä,Ä®,į,Ä°,Ç,Ç +IJ,Ij,iJ,ij,IJ,ij +ı +Æ— +Æ– +J,j,Ä´,ĵ,Ç° +K,k,Ķ,Ä·,Ǩ,Ç© +Ƙ,Æ™ +L,l,Ĺ,ĺ,Ä»,ļ,Ľ,ľ +Ä¿,Å€ +LJ,Lj,lJ,lj,LJ,Lj,lj +LL,Ll,lL,ll +Å,Å‚ +Æš +Æ› +M,m +N,n,Ñ,ñ,Å…,ņ,Ň,ň,Ǹ,ǹ +NJ,Nj,nJ,nj,ÇŠ,Ç‹,ÇŒ +Ń,Å„ +Æ +Æž +ÅŠ,Å‹ +O,o,Ã’,Ô,Õ,Ö,ò,ô,õ,ö,ÅŒ,Å,ÅŽ,Å,Å,Å‘,Æ ,Æ¡,Ç‘,Ç’,Ǫ,Ç«,Ǭ,Ç +OE,Oe,oE,oe,Å’,Å“ +Ó,ó +Ø,ø,Ǿ,Ç¿ +Ɔ +ÆŸ +P,p +Ƥ,Æ¥ +Q,q +ĸ +R,r,Å”,Å•,Å–,Å—,Ř,Å™ +RR,Rr,rR,rr +Ʀ +S,s,Åœ,Å,Åž,ÅŸ,Å ,Å¡,Å¿ +SS,Ss,sS,ss,ß +Åš,Å› +Æ© +ƪ +T,t,Å¢,Å£,Ť,Å¥ +ƾ +Ŧ,ŧ +Æ« +Ƭ,Æ +Æ® +U,u,Ù,Ú,Û,Ãœ,ù,ú,û,ü,Ũ,Å©,Ū,Å«,Ŭ,Å,Å®,ů,Å°,ű,Ų,ų,Ư,Æ°,Ç“,Ç”,Ç•,Ç–,Ç—,ǘ,Ç™,Çš,Ç›,Çœ +Æœ +Ʊ +V,v +Ʋ +W,w,Å´,ŵ +X,x +Y,y,Ã,ý,ÿ,Ŷ,Å·,Ÿ +Ƴ,Æ´ +Z,z,Ž,ž +Æ +Ź,ź +Å»,ż +Ƶ,ƶ +Æ·,Ç®,ǯ +Ƹ,ƹ +ƺ +Þ,þ +Æ¿,Ç· +Æ» +Ƨ,ƨ +Ƽ,ƽ +Æ„,Æ… +ʼn +Ç€ +Ç +Ç‚ +ǃ +select group_concat(c1 order by c1) from t1 group by c1 collate utf8_estonian_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Ã,Â,Ã,Ã…,à ,á,â,ã,Ã¥,Ä€,Ä,Ä‚,ă,Ä„,Ä…,Ç,ÇŽ,Çž,ÇŸ,Ç ,Ç¡,Ǻ,Ç» +AA,Aa,aA,aa +Æ,æ,Ç¢,Ç£,Ǽ,ǽ +B,b +Æ€ +Æ +Æ‚,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,ÄŠ,Ä‹,ÄŒ,Ä +CH,Ch,cH,ch +Ƈ,ƈ +D,d,ÄŽ,Ä +DZ,Dz,dZ,dz +Ç„,Ç…,dž,DZ,Dz,dz +Ä,Ä‘ +Ɖ +ÆŠ +Æ‹,ÆŒ +Ã,ð +E,e,È,É,Ê,Ë,è,é,ê,ë,Ä’,Ä“,Ä”,Ä•,Ä–,Ä—,Ę,Ä™,Äš,Ä› +ÆŽ,Ç +Æ +Æ +F,f +Æ‘,Æ’ +G,g,Äœ,Ä,Äž,ÄŸ,Ä ,Ä¡,Ä¢,Ä£,Ǧ,ǧ,Ç´,ǵ +Ǥ,Ç¥ +Æ“ +Æ” +Æ¢,Æ£ +H,h,Ĥ,Ä¥ +Æ•,Ƕ +Ħ,ħ +I,i,ÃŒ,Ã,ÃŽ,Ã,ì,Ã,î,ï,Ĩ,Ä©,Ī,Ä«,Ĭ,Ä,Ä®,į,Ä°,Ç,Ç +IJ,Ij,iJ,ij,IJ,ij +ı +Æ— +Æ– +J,j,Ä´,ĵ,Ç° +K,k,Ķ,Ä·,Ǩ,Ç© +Ƙ,Æ™ +L,l,Ĺ,ĺ,Ä»,ļ,Ľ,ľ +Ä¿,Å€ +LJ,Lj,lJ,lj,LJ,Lj,lj +LL,Ll,lL,ll +Å,Å‚ +Æš +Æ› +M,m +N,n,Ñ,ñ,Ń,Å„,Å…,ņ,Ň,ň,Ǹ,ǹ +NJ,Nj,nJ,nj,ÇŠ,Ç‹,ÇŒ +Æ +Æž +ÅŠ,Å‹ +O,o,Ã’,Ó,Ô,ò,ó,ô,ÅŒ,Å,ÅŽ,Å,Å,Å‘,Æ ,Æ¡,Ç‘,Ç’,Ǫ,Ç«,Ǭ,Ç +OE,Oe,oE,oe,Å’,Å“ +Ø,ø,Ǿ,Ç¿ +Ɔ +ÆŸ +P,p +Ƥ,Æ¥ +Q,q +ĸ +R,r,Å”,Å•,Å–,Å—,Ř,Å™ +RR,Rr,rR,rr +Ʀ +S,s,Åš,Å›,Åœ,Å,Åž,ÅŸ,Å¿ +SS,Ss,sS,ss,ß +Å ,Å¡ +Z,z +Ž,ž +Æ© +ƪ +T,t,Å¢,Å£,Ť,Å¥ +ƾ +Ŧ,ŧ +Æ« +Ƭ,Æ +Æ® +U,u,Ù,Ú,Û,ù,ú,û,Ũ,Å©,Ū,Å«,Ŭ,Å,Å®,ů,Å°,ű,Ų,ų,Ư,Æ°,Ç“,Ç”,Ç•,Ç–,Ç—,ǘ,Ç™,Çš,Ç›,Çœ +Æœ +Ʊ +V,v +Ʋ +W,w,Å´,ŵ +Õ,õ +Ä,ä +Ö,ö +Ãœ,ü +X,x +Y,y,Ã,ý,ÿ,Ŷ,Å·,Ÿ +Ƴ,Æ´ +Ź,ź,Å»,ż +Æ +Ƶ,ƶ +Æ·,Ç®,ǯ +Ƹ,ƹ +ƺ +Þ,þ +Æ¿,Ç· +Æ» +Ƨ,ƨ +Ƽ,ƽ +Æ„,Æ… +ʼn +Ç€ +Ç +Ç‚ +ǃ +select group_concat(c1 order by c1) from t1 group by c1 collate utf8_spanish_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Ã,Â,Ã,Ä,Ã…,à ,á,â,ã,ä,Ã¥,Ä€,Ä,Ä‚,ă,Ä„,Ä…,Ç,ÇŽ,Çž,ÇŸ,Ç ,Ç¡,Ǻ,Ç» +AA,Aa,aA,aa +Æ,æ,Ç¢,Ç£,Ǽ,ǽ +B,b +Æ€ +Æ +Æ‚,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,ÄŠ,Ä‹,ÄŒ,Ä +CH,Ch,cH,ch +Ƈ,ƈ +D,d,ÄŽ,Ä +DZ,Dz,dZ,dz,Ç„,Ç…,dž,DZ,Dz,dz +Ä,Ä‘ +Ɖ +ÆŠ +Æ‹,ÆŒ +Ã,ð +E,e,È,É,Ê,Ë,è,é,ê,ë,Ä’,Ä“,Ä”,Ä•,Ä–,Ä—,Ę,Ä™,Äš,Ä› +ÆŽ,Ç +Æ +Æ +F,f +Æ‘,Æ’ +G,g,Äœ,Ä,Äž,ÄŸ,Ä ,Ä¡,Ä¢,Ä£,Ǧ,ǧ,Ç´,ǵ +Ǥ,Ç¥ +Æ“ +Æ” +Æ¢,Æ£ +H,h,Ĥ,Ä¥ +Æ•,Ƕ +Ħ,ħ +I,i,ÃŒ,Ã,ÃŽ,Ã,ì,Ã,î,ï,Ĩ,Ä©,Ī,Ä«,Ĭ,Ä,Ä®,į,Ä°,Ç,Ç +IJ,Ij,iJ,ij,IJ,ij +ı +Æ— +Æ– +J,j,Ä´,ĵ,Ç° +K,k,Ķ,Ä·,Ǩ,Ç© +Ƙ,Æ™ +L,l,Ĺ,ĺ,Ä»,ļ,Ľ,ľ +Ä¿,Å€ +LJ,Lj,lJ,lj,LJ,Lj,lj +LL,Ll,lL,ll +Å,Å‚ +Æš +Æ› +M,m +N,n,Ń,Å„,Å…,ņ,Ň,ň,Ǹ,ǹ +NJ,Nj,nJ,nj,ÇŠ,Ç‹,ÇŒ +Ñ,ñ +Æ +Æž +ÅŠ,Å‹ +O,o,Ã’,Ó,Ô,Õ,Ö,ò,ó,ô,õ,ö,ÅŒ,Å,ÅŽ,Å,Å,Å‘,Æ ,Æ¡,Ç‘,Ç’,Ǫ,Ç«,Ǭ,Ç +OE,Oe,oE,oe,Å’,Å“ +Ø,ø,Ǿ,Ç¿ +Ɔ +ÆŸ +P,p +Ƥ,Æ¥ +Q,q +ĸ +R,r,Å”,Å•,Å–,Å—,Ř,Å™ +RR,Rr,rR,rr +Ʀ +S,s,Åš,Å›,Åœ,Å,Åž,ÅŸ,Å ,Å¡,Å¿ +SS,Ss,sS,ss,ß +Æ© +ƪ +T,t,Å¢,Å£,Ť,Å¥ +ƾ +Ŧ,ŧ +Æ« +Ƭ,Æ +Æ® +U,u,Ù,Ú,Û,Ãœ,ù,ú,û,ü,Ũ,Å©,Ū,Å«,Ŭ,Å,Å®,ů,Å°,ű,Ų,ų,Ư,Æ°,Ç“,Ç”,Ç•,Ç–,Ç—,ǘ,Ç™,Çš,Ç›,Çœ +Æœ +Ʊ +V,v +Ʋ +W,w,Å´,ŵ +X,x +Y,y,Ã,ý,ÿ,Ŷ,Å·,Ÿ +Ƴ,Æ´ +Z,z,Ź,ź,Å»,ż,Ž,ž +Æ +Ƶ,ƶ +Æ·,Ç®,ǯ +Ƹ,ƹ +ƺ +Þ,þ +Æ¿,Ç· +Æ» +Ƨ,ƨ +Ƽ,ƽ +Æ„,Æ… +ʼn +Ç€ +Ç +Ç‚ +ǃ +select group_concat(c1 order by c1) from t1 group by c1 collate utf8_swedish_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Ã,Â,Ã,à ,á,â,ã,Ä€,Ä,Ä‚,ă,Ä„,Ä…,Ç,ÇŽ,Çž,ÇŸ,Ç ,Ç¡,Ǻ,Ç» +AA,Aa,aA,aa +Ç¢,Ç£,Ǽ,ǽ +B,b +Æ€ +Æ +Æ‚,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,ÄŠ,Ä‹,ÄŒ,Ä +CH,Ch,cH,ch +Ƈ,ƈ +D,d,ÄŽ,Ä +DZ,Dz,dZ,dz,Ç„,Ç…,dž,DZ,Dz,dz +Ä,Ä‘ +Ɖ +ÆŠ +Æ‹,ÆŒ +Ã,ð +E,e,È,É,Ê,Ë,è,é,ê,ë,Ä’,Ä“,Ä”,Ä•,Ä–,Ä—,Ę,Ä™,Äš,Ä› +ÆŽ,Ç +Æ +Æ +F,f +Æ‘,Æ’ +G,g,Äœ,Ä,Äž,ÄŸ,Ä ,Ä¡,Ä¢,Ä£,Ǧ,ǧ,Ç´,ǵ +Ǥ,Ç¥ +Æ“ +Æ” +Æ¢,Æ£ +H,h,Ĥ,Ä¥ +Æ•,Ƕ +Ħ,ħ +I,i,ÃŒ,Ã,ÃŽ,Ã,ì,Ã,î,ï,Ĩ,Ä©,Ī,Ä«,Ĭ,Ä,Ä®,į,Ä°,Ç,Ç +IJ,Ij,iJ,ij,IJ,ij +ı +Æ— +Æ– +J,j,Ä´,ĵ,Ç° +K,k,Ķ,Ä·,Ǩ,Ç© +Ƙ,Æ™ +L,l,Ĺ,ĺ,Ä»,ļ,Ľ,ľ +Ä¿,Å€ +LJ,Lj,lJ,lj,LJ,Lj,lj +LL,Ll,lL,ll +Å,Å‚ +Æš +Æ› +M,m +N,n,Ñ,ñ,Ń,Å„,Å…,ņ,Ň,ň,Ǹ,ǹ +NJ,Nj,nJ,nj,ÇŠ,Ç‹,ÇŒ +Æ +Æž +ÅŠ,Å‹ +O,o,Ã’,Ó,Ô,Õ,ò,ó,ô,õ,ÅŒ,Å,ÅŽ,Å,Å,Å‘,Æ ,Æ¡,Ç‘,Ç’,Ǫ,Ç«,Ǭ,Ç +OE,Oe,oE,oe,Å’,Å“ +Ǿ,Ç¿ +Ɔ +ÆŸ +P,p +Ƥ,Æ¥ +Q,q +ĸ +R,r,Å”,Å•,Å–,Å—,Ř,Å™ +RR,Rr,rR,rr +Ʀ +S,s,Åš,Å›,Åœ,Å,Åž,ÅŸ,Å ,Å¡,Å¿ +SS,Ss,sS,ss,ß +Æ© +ƪ +T,t,Å¢,Å£,Ť,Å¥ +ƾ +Ŧ,ŧ +Æ« +Ƭ,Æ +Æ® +U,u,Ù,Ú,Û,ù,ú,û,Ũ,Å©,Ū,Å«,Ŭ,Å,Å®,ů,Å°,ű,Ų,ų,Ư,Æ°,Ç“,Ç”,Ç•,Ç–,Ç—,ǘ,Ç™,Çš,Ç›,Çœ +Æœ +Ʊ +V,v +Ʋ +W,w,Å´,ŵ +X,x +Y,y,Ãœ,Ã,ü,ý,ÿ,Ŷ,Å·,Ÿ +Ƴ,Æ´ +Z,z,Ź,ź,Å»,ż,Ž,ž +Æ +Ã…,Ã¥ +Ä,Æ,ä,æ +Ö,Ø,ö,ø +Ƶ,ƶ +Æ·,Ç®,ǯ +Ƹ,ƹ +ƺ +Þ,þ +Æ¿,Ç· +Æ» +Ƨ,ƨ +Ƽ,ƽ +Æ„,Æ… +ʼn +Ç€ +Ç +Ç‚ +ǃ +select group_concat(c1 order by c1) from t1 group by c1 collate utf8_turkish_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Ã,Â,Ã,Ä,Ã…,à ,á,â,ã,ä,Ã¥,Ä€,Ä,Ä‚,ă,Ä„,Ä…,Ç,ÇŽ,Çž,ÇŸ,Ç ,Ç¡,Ǻ,Ç» +AA,Aa,aA,aa +Æ,æ,Ç¢,Ç£,Ǽ,ǽ +B,b +Æ€ +Æ +Æ‚,ƃ +C,c,Ć,ć,Ĉ,ĉ,ÄŠ,Ä‹,ÄŒ,Ä +CH,Ch,cH,ch +Ç,ç +Ƈ,ƈ +D,d,ÄŽ,Ä +DZ,Dz,dZ,dz,Ç„,Ç…,dž,DZ,Dz,dz +Ä,Ä‘ +Ɖ +ÆŠ +Æ‹,ÆŒ +Ã,ð +E,e,È,É,Ê,Ë,è,é,ê,ë,Ä’,Ä“,Ä”,Ä•,Ä–,Ä—,Ę,Ä™,Äš,Ä› +ÆŽ,Ç +Æ +Æ +F,f +Æ‘,Æ’ +G,g,Äœ,Ä,Ä ,Ä¡,Ä¢,Ä£,Ǧ,ǧ,Ç´,ǵ +Äž,ÄŸ +Ǥ,Ç¥ +Æ“ +Æ” +Æ¢,Æ£ +H,h,Ĥ,Ä¥ +I,ı +IJ,Ij +Æ•,Ƕ +Ħ,ħ +i,ÃŒ,Ã,ÃŽ,Ã,ì,Ã,î,ï,Ĩ,Ä©,Ī,Ä«,Ĭ,Ä,Ä®,į,Ä°,Ç,Ç +iJ,ij,IJ,ij +Æ— +Æ– +J,j,Ä´,ĵ,Ç° +K,k,Ķ,Ä·,Ǩ,Ç© +Ƙ,Æ™ +L,l,Ĺ,ĺ,Ä»,ļ,Ľ,ľ +Ä¿,Å€ +LJ,Lj,lJ,lj,LJ,Lj,lj +LL,Ll,lL,ll +Å,Å‚ +Æš +Æ› +M,m +N,n,Ñ,ñ,Ń,Å„,Å…,ņ,Ň,ň,Ǹ,ǹ +NJ,Nj,nJ,nj,ÇŠ,Ç‹,ÇŒ +Æ +Æž +ÅŠ,Å‹ +O,o,Ã’,Ó,Ô,Õ,ò,ó,ô,õ,ÅŒ,Å,ÅŽ,Å,Å,Å‘,Æ ,Æ¡,Ç‘,Ç’,Ǫ,Ç«,Ǭ,Ç +OE,Oe,oE,oe,Å’,Å“ +Ö,ö +Ø,ø,Ǿ,Ç¿ +Ɔ +ÆŸ +P,p +Ƥ,Æ¥ +Q,q +ĸ +R,r,Å”,Å•,Å–,Å—,Ř,Å™ +RR,Rr,rR,rr +Ʀ +S,s,Åš,Å›,Åœ,Å,Å ,Å¡,Å¿ +SS,Ss,sS,ss,ß +Åž,ÅŸ +Æ© +ƪ +T,t,Å¢,Å£,Ť,Å¥ +ƾ +Ŧ,ŧ +Æ« +Ƭ,Æ +Æ® +U,u,Ù,Ú,Û,ù,ú,û,Ũ,Å©,Ū,Å«,Ŭ,Å,Å®,ů,Å°,ű,Ų,ų,Ư,Æ°,Ç“,Ç”,Ç•,Ç–,Ç—,ǘ,Ç™,Çš,Ç›,Çœ +Ãœ,ü +Æœ +Ʊ +V,v +Ʋ +W,w,Å´,ŵ +X,x +Y,y,Ã,ý,ÿ,Ŷ,Å·,Ÿ +Ƴ,Æ´ +Z,z,Ź,ź,Å»,ż,Ž,ž +Æ +Ƶ,ƶ +Æ·,Ç®,ǯ +Ƹ,ƹ +ƺ +Þ,þ +Æ¿,Ç· +Æ» +Ƨ,ƨ +Ƽ,ƽ +Æ„,Æ… +ʼn +Ç€ +Ç +Ç‚ +ǃ +select group_concat(c1 order by c1) from t1 group by c1 collate utf8_czech_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Ã,Â,Ã,Ä,Ã…,à ,á,â,ã,ä,Ã¥,Ä€,Ä,Ä‚,ă,Ä„,Ä…,Ç,ÇŽ,Çž,ÇŸ,Ç ,Ç¡,Ǻ,Ç» +AA,Aa,aA,aa +Æ,æ,Ç¢,Ç£,Ǽ,ǽ +B,b +Æ€ +Æ +Æ‚,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,ÄŠ,Ä‹ +cH +ÄŒ,Ä +Ƈ,ƈ +D,d,ÄŽ,Ä +DZ,Dz,dZ,dz,Ç„,Ç…,dž,DZ,Dz,dz +Ä,Ä‘ +Ɖ +ÆŠ +Æ‹,ÆŒ +Ã,ð +E,e,È,É,Ê,Ë,è,é,ê,ë,Ä’,Ä“,Ä”,Ä•,Ä–,Ä—,Ę,Ä™,Äš,Ä› +ÆŽ,Ç +Æ +Æ +F,f +Æ‘,Æ’ +G,g,Äœ,Ä,Äž,ÄŸ,Ä ,Ä¡,Ä¢,Ä£,Ǧ,ǧ,Ç´,ǵ +Ǥ,Ç¥ +Æ“ +Æ” +Æ¢,Æ£ +H,h,Ĥ,Ä¥ +CH,Ch,ch +Æ•,Ƕ +Ħ,ħ +I,i,ÃŒ,Ã,ÃŽ,Ã,ì,Ã,î,ï,Ĩ,Ä©,Ī,Ä«,Ĭ,Ä,Ä®,į,Ä°,Ç,Ç +IJ,Ij,iJ,ij,IJ,ij +ı +Æ— +Æ– +J,j,Ä´,ĵ,Ç° +K,k,Ķ,Ä·,Ǩ,Ç© +Ƙ,Æ™ +L,l,Ĺ,ĺ,Ä»,ļ,Ľ,ľ +Ä¿,Å€ +LJ,Lj,lJ,lj,LJ,Lj,lj +LL,Ll,lL,ll +Å,Å‚ +Æš +Æ› +M,m +N,n,Ñ,ñ,Ń,Å„,Å…,ņ,Ň,ň,Ǹ,ǹ +NJ,Nj,nJ,nj,ÇŠ,Ç‹,ÇŒ +Æ +Æž +ÅŠ,Å‹ +O,o,Ã’,Ó,Ô,Õ,Ö,ò,ó,ô,õ,ö,ÅŒ,Å,ÅŽ,Å,Å,Å‘,Æ ,Æ¡,Ç‘,Ç’,Ǫ,Ç«,Ǭ,Ç +OE,Oe,oE,oe,Å’,Å“ +Ø,ø,Ǿ,Ç¿ +Ɔ +ÆŸ +P,p +Ƥ,Æ¥ +Q,q +ĸ +R,r,Å”,Å•,Å–,Å— +RR,Rr,rR,rr +Ř,Å™ +Ʀ +S,s,Åš,Å›,Åœ,Å,Åž,ÅŸ,Å¿ +SS,Ss,sS,ss,ß +Å ,Å¡ +Æ© +ƪ +T,t,Å¢,Å£,Ť,Å¥ +ƾ +Ŧ,ŧ +Æ« +Ƭ,Æ +Æ® +U,u,Ù,Ú,Û,Ãœ,ù,ú,û,ü,Ũ,Å©,Ū,Å«,Ŭ,Å,Å®,ů,Å°,ű,Ų,ų,Ư,Æ°,Ç“,Ç”,Ç•,Ç–,Ç—,ǘ,Ç™,Çš,Ç›,Çœ +Æœ +Ʊ +V,v +Ʋ +W,w,Å´,ŵ +X,x +Y,y,Ã,ý,ÿ,Ŷ,Å·,Ÿ +Ƴ,Æ´ +Z,z,Ź,ź,Å»,ż +Æ +Ž,ž +Ƶ,ƶ +Æ·,Ç®,ǯ +Ƹ,ƹ +ƺ +Þ,þ +Æ¿,Ç· +Æ» +Ƨ,ƨ +Ƽ,ƽ +Æ„,Æ… +ʼn +Ç€ +Ç +Ç‚ +ǃ +select group_concat(c1 order by c1) from t1 group by c1 collate utf8_danish_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Ã,Â,Ã,à ,á,â,ã,Ä€,Ä,Ä‚,ă,Ä„,Ä…,Ç,ÇŽ,Çž,ÇŸ,Ç ,Ç¡,Ǻ,Ç» +aA +Ç¢,Ç£,Ǽ,ǽ +B,b +Æ€ +Æ +Æ‚,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,ÄŠ,Ä‹,ÄŒ,Ä +CH,Ch,cH,ch +Ƈ,ƈ +D,d,ÄŽ,Ä +DZ,Dz,dZ,dz,Ç„,Ç…,dž,DZ,Dz,dz +Ä,Ä‘ +Ɖ +ÆŠ +Æ‹,ÆŒ +Ã,ð +E,e,È,É,Ê,Ë,è,é,ê,ë,Ä’,Ä“,Ä”,Ä•,Ä–,Ä—,Ę,Ä™,Äš,Ä› +ÆŽ,Ç +Æ +Æ +F,f +Æ‘,Æ’ +G,g,Äœ,Ä,Äž,ÄŸ,Ä ,Ä¡,Ä¢,Ä£,Ǧ,ǧ,Ç´,ǵ +Ǥ,Ç¥ +Æ“ +Æ” +Æ¢,Æ£ +H,h,Ĥ,Ä¥ +Æ•,Ƕ +Ħ,ħ +I,i,ÃŒ,Ã,ÃŽ,Ã,ì,Ã,î,ï,Ĩ,Ä©,Ī,Ä«,Ĭ,Ä,Ä®,į,Ä°,Ç,Ç +IJ,Ij,iJ,ij,IJ,ij +ı +Æ— +Æ– +J,j,Ä´,ĵ,Ç° +K,k,Ķ,Ä·,Ǩ,Ç© +Ƙ,Æ™ +L,l,Ĺ,ĺ,Ä»,ļ,Ľ,ľ +Ä¿,Å€ +LJ,Lj,lJ,lj,LJ,Lj,lj +LL,Ll,lL,ll +Å,Å‚ +Æš +Æ› +M,m +N,n,Ñ,ñ,Ń,Å„,Å…,ņ,Ň,ň,Ǹ,ǹ +NJ,Nj,nJ,nj,ÇŠ,Ç‹,ÇŒ +Æ +Æž +ÅŠ,Å‹ +O,o,Ã’,Ó,Ô,Õ,ò,ó,ô,õ,ÅŒ,Å,ÅŽ,Å,Æ ,Æ¡,Ç‘,Ç’,Ǫ,Ç«,Ǭ,Ç +OE,Oe,oE,oe,Å’,Å“ +Ǿ,Ç¿ +Ɔ +ÆŸ +P,p +Ƥ,Æ¥ +Q,q +ĸ +R,r,Å”,Å•,Å–,Å—,Ř,Å™ +RR,Rr,rR,rr +Ʀ +S,s,Åš,Å›,Åœ,Å,Åž,ÅŸ,Å ,Å¡,Å¿ +SS,Ss,sS,ss,ß +Æ© +ƪ +T,t,Å¢,Å£,Ť,Å¥ +ƾ +Ŧ,ŧ +Æ« +Ƭ,Æ +Æ® +U,u,Ù,Ú,Û,ù,ú,û,Ũ,Å©,Ū,Å«,Ŭ,Å,Å®,ů,Ų,ų,Ư,Æ°,Ç“,Ç”,Ç•,Ç–,Ç—,ǘ,Ç™,Çš,Ç›,Çœ +Æœ +Ʊ +V,v +Ʋ +W,w,Å´,ŵ +X,x +Y,y,Ãœ,Ã,ü,ý,ÿ,Å°,ű,Ŷ,Å·,Ÿ +Ƴ,Æ´ +Z,z,Ź,ź,Å»,ż,Ž,ž +Æ +Ä,Æ,ä,æ +Ö,Ø,ö,ø,Å,Å‘ +AA,Aa,aa,Ã…,Ã¥ +Ƶ,ƶ +Æ·,Ç®,ǯ +Ƹ,ƹ +ƺ +Þ,þ +Æ¿,Ç· +Æ» +Ƨ,ƨ +Ƽ,ƽ +Æ„,Æ… +ʼn +Ç€ +Ç +Ç‚ +ǃ +select group_concat(c1 order by c1) from t1 group by c1 collate utf8_lithuanian_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Ã,Â,Ã,Ä,Ã…,à ,á,â,ã,ä,Ã¥,Ä€,Ä,Ä‚,ă,Ä„,Ä…,Ç,ÇŽ,Çž,ÇŸ,Ç ,Ç¡,Ǻ,Ç» +AA,Aa,aA,aa +Æ,æ,Ç¢,Ç£,Ǽ,ǽ +B,b +Æ€ +Æ +Æ‚,ƃ +C,CH,Ch,c,ch,Ç,ç,Ć,ć,Ĉ,ĉ,ÄŠ,Ä‹ +cH +ÄŒ,Ä +Ƈ,ƈ +D,d,ÄŽ,Ä +DZ,Dz,dZ,dz,Ç„,Ç…,dž,DZ,Dz,dz +Ä,Ä‘ +Ɖ +ÆŠ +Æ‹,ÆŒ +Ã,ð +E,e,È,É,Ê,Ë,è,é,ê,ë,Ä’,Ä“,Ä”,Ä•,Ä–,Ä—,Ę,Ä™,Äš,Ä› +ÆŽ,Ç +Æ +Æ +F,f +Æ‘,Æ’ +G,g,Äœ,Ä,Äž,ÄŸ,Ä ,Ä¡,Ä¢,Ä£,Ǧ,ǧ,Ç´,ǵ +Ǥ,Ç¥ +Æ“ +Æ” +Æ¢,Æ£ +H,h,Ĥ,Ä¥ +Æ•,Ƕ +Ħ,ħ +I,Y,i,y,ÃŒ,Ã,ÃŽ,Ã,ì,Ã,î,ï,Ĩ,Ä©,Ī,Ä«,Ĭ,Ä,Ä®,į,Ä°,Ç,Ç +IJ,Ij,iJ,ij,IJ,ij +ı +Æ— +Æ– +J,j,Ä´,ĵ,Ç° +K,k,Ķ,Ä·,Ǩ,Ç© +Ƙ,Æ™ +L,l,Ĺ,ĺ,Ä»,ļ,Ľ,ľ +Ä¿,Å€ +LJ,Lj,lJ,lj,LJ,Lj,lj +LL,Ll,lL,ll +Å,Å‚ +Æš +Æ› +M,m +N,n,Ñ,ñ,Ń,Å„,Å…,ņ,Ň,ň,Ǹ,ǹ +NJ,Nj,nJ,nj,ÇŠ,Ç‹,ÇŒ +Æ +Æž +ÅŠ,Å‹ +O,o,Ã’,Ó,Ô,Õ,Ö,ò,ó,ô,õ,ö,ÅŒ,Å,ÅŽ,Å,Å,Å‘,Æ ,Æ¡,Ç‘,Ç’,Ǫ,Ç«,Ǭ,Ç +OE,Oe,oE,oe,Å’,Å“ +Ø,ø,Ǿ,Ç¿ +Ɔ +ÆŸ +P,p +Ƥ,Æ¥ +Q,q +ĸ +R,r,Å”,Å•,Å–,Å—,Ř,Å™ +RR,Rr,rR,rr +Ʀ +S,s,Åš,Å›,Åœ,Å,Åž,ÅŸ,Å¿ +SS,Ss,sS,ss,ß +Å ,Å¡ +Æ© +ƪ +T,t,Å¢,Å£,Ť,Å¥ +ƾ +Ŧ,ŧ +Æ« +Ƭ,Æ +Æ® +U,u,Ù,Ú,Û,Ãœ,ù,ú,û,ü,Ũ,Å©,Ū,Å«,Ŭ,Å,Å®,ů,Å°,ű,Ų,ų,Ư,Æ°,Ç“,Ç”,Ç•,Ç–,Ç—,ǘ,Ç™,Çš,Ç›,Çœ +Æœ +Ʊ +V,v +Ʋ +W,w,Å´,ŵ +X,x +Ã,ý,ÿ,Ŷ,Å·,Ÿ +Ƴ,Æ´ +Z,z,Ź,ź,Å»,ż +Æ +Ž,ž +Ƶ,ƶ +Æ·,Ç®,ǯ +Ƹ,ƹ +ƺ +Þ,þ +Æ¿,Ç· +Æ» +Ƨ,ƨ +Ƽ,ƽ +Æ„,Æ… +ʼn +Ç€ +Ç +Ç‚ +ǃ +select group_concat(c1 order by c1) from t1 group by c1 collate utf8_slovak_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Ã,Â,Ã,Ã…,à ,á,â,ã,Ã¥,Ä€,Ä,Ä‚,ă,Ä„,Ä…,Ç,ÇŽ,Çž,ÇŸ,Ç ,Ç¡,Ǻ,Ç» +AA,Aa,aA,aa +Ä,ä +Æ,æ,Ç¢,Ç£,Ǽ,ǽ +B,b +Æ€ +Æ +Æ‚,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,ÄŠ,Ä‹ +cH +ÄŒ,Ä +Ƈ,ƈ +D,d,ÄŽ,Ä +DZ,Dz,dZ,dz,Ç„,Ç…,dž,DZ,Dz,dz +Ä,Ä‘ +Ɖ +ÆŠ +Æ‹,ÆŒ +Ã,ð +E,e,È,É,Ê,Ë,è,é,ê,ë,Ä’,Ä“,Ä”,Ä•,Ä–,Ä—,Ę,Ä™,Äš,Ä› +ÆŽ,Ç +Æ +Æ +F,f +Æ‘,Æ’ +G,g,Äœ,Ä,Äž,ÄŸ,Ä ,Ä¡,Ä¢,Ä£,Ǧ,ǧ,Ç´,ǵ +Ǥ,Ç¥ +Æ“ +Æ” +Æ¢,Æ£ +H,h,Ĥ,Ä¥ +CH,Ch,ch +Æ•,Ƕ +Ħ,ħ +I,i,ÃŒ,Ã,ÃŽ,Ã,ì,Ã,î,ï,Ĩ,Ä©,Ī,Ä«,Ĭ,Ä,Ä®,į,Ä°,Ç,Ç +IJ,Ij,iJ,ij,IJ,ij +ı +Æ— +Æ– +J,j,Ä´,ĵ,Ç° +K,k,Ķ,Ä·,Ǩ,Ç© +Ƙ,Æ™ +L,l,Ĺ,ĺ,Ä»,ļ,Ľ,ľ +Ä¿,Å€ +LJ,Lj,lJ,lj,LJ,Lj,lj +LL,Ll,lL,ll +Å,Å‚ +Æš +Æ› +M,m +N,n,Ñ,ñ,Ń,Å„,Å…,ņ,Ň,ň,Ǹ,ǹ +NJ,Nj,nJ,nj,ÇŠ,Ç‹,ÇŒ +Æ +Æž +ÅŠ,Å‹ +O,o,Ã’,Ó,Õ,Ö,ò,ó,õ,ö,ÅŒ,Å,ÅŽ,Å,Å,Å‘,Æ ,Æ¡,Ç‘,Ç’,Ǫ,Ç«,Ǭ,Ç +OE,Oe,oE,oe,Å’,Å“ +Ô,ô +Ø,ø,Ǿ,Ç¿ +Ɔ +ÆŸ +P,p +Ƥ,Æ¥ +Q,q +ĸ +R,r,Å”,Å•,Å–,Å—,Ř,Å™ +RR,Rr,rR,rr +Ʀ +S,s,Åš,Å›,Åœ,Å,Åž,ÅŸ,Å¿ +SS,Ss,sS,ss,ß +Å ,Å¡ +Æ© +ƪ +T,t,Å¢,Å£,Ť,Å¥ +ƾ +Ŧ,ŧ +Æ« +Ƭ,Æ +Æ® +U,u,Ù,Ú,Û,Ãœ,ù,ú,û,ü,Ũ,Å©,Ū,Å«,Ŭ,Å,Å®,ů,Å°,ű,Ų,ų,Ư,Æ°,Ç“,Ç”,Ç•,Ç–,Ç—,ǘ,Ç™,Çš,Ç›,Çœ +Æœ +Ʊ +V,v +Ʋ +W,w,Å´,ŵ +X,x +Y,y,Ã,ý,ÿ,Ŷ,Å·,Ÿ +Ƴ,Æ´ +Z,z,Ź,ź,Å»,ż +Æ +Ž,ž +Ƶ,ƶ +Æ·,Ç®,ǯ +Ƹ,ƹ +ƺ +Þ,þ +Æ¿,Ç· +Æ» +Ƨ,ƨ +Ƽ,ƽ +Æ„,Æ… +ʼn +Ç€ +Ç +Ç‚ +ǃ +select group_concat(c1 order by c1) from t1 group by c1 collate utf8_spanish2_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Ã,Â,Ã,Ä,Ã…,à ,á,â,ã,ä,Ã¥,Ä€,Ä,Ä‚,ă,Ä„,Ä…,Ç,ÇŽ,Çž,ÇŸ,Ç ,Ç¡,Ǻ,Ç» +AA,Aa,aA,aa +Æ,æ,Ç¢,Ç£,Ǽ,ǽ +B,b +Æ€ +Æ +Æ‚,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,ÄŠ,Ä‹,ÄŒ,Ä +cH +CH,Ch,ch +Ƈ,ƈ +D,d,ÄŽ,Ä +DZ,Dz,dZ,dz,Ç„,Ç…,dž,DZ,Dz,dz +Ä,Ä‘ +Ɖ +ÆŠ +Æ‹,ÆŒ +Ã,ð +E,e,È,É,Ê,Ë,è,é,ê,ë,Ä’,Ä“,Ä”,Ä•,Ä–,Ä—,Ę,Ä™,Äš,Ä› +ÆŽ,Ç +Æ +Æ +F,f +Æ‘,Æ’ +G,g,Äœ,Ä,Äž,ÄŸ,Ä ,Ä¡,Ä¢,Ä£,Ǧ,ǧ,Ç´,ǵ +Ǥ,Ç¥ +Æ“ +Æ” +Æ¢,Æ£ +H,h,Ĥ,Ä¥ +Æ•,Ƕ +Ħ,ħ +I,i,ÃŒ,Ã,ÃŽ,Ã,ì,Ã,î,ï,Ĩ,Ä©,Ī,Ä«,Ĭ,Ä,Ä®,į,Ä°,Ç,Ç +IJ,Ij,iJ,ij,IJ,ij +ı +Æ— +Æ– +J,j,Ä´,ĵ,Ç° +K,k,Ķ,Ä·,Ǩ,Ç© +Ƙ,Æ™ +L,l,Ĺ,ĺ,Ä»,ļ,Ľ,ľ +Ä¿,Å€ +LJ,Lj,lJ,lj,LJ,Lj,lj +lL +LL,Ll,ll +Å,Å‚ +Æš +Æ› +M,m +N,n,Ń,Å„,Å…,ņ,Ň,ň,Ǹ,ǹ +NJ,Nj,nJ,nj,ÇŠ,Ç‹,ÇŒ +Ñ,ñ +Æ +Æž +ÅŠ,Å‹ +O,o,Ã’,Ó,Ô,Õ,Ö,ò,ó,ô,õ,ö,ÅŒ,Å,ÅŽ,Å,Å,Å‘,Æ ,Æ¡,Ç‘,Ç’,Ǫ,Ç«,Ǭ,Ç +OE,Oe,oE,oe,Å’,Å“ +Ø,ø,Ǿ,Ç¿ +Ɔ +ÆŸ +P,p +Ƥ,Æ¥ +Q,q +ĸ +R,RR,Rr,r,rr,Å”,Å•,Å–,Å—,Ř,Å™ +rR +Ʀ +S,s,Åš,Å›,Åœ,Å,Åž,ÅŸ,Å ,Å¡,Å¿ +SS,Ss,sS,ss,ß +Æ© +ƪ +T,t,Å¢,Å£,Ť,Å¥ +ƾ +Ŧ,ŧ +Æ« +Ƭ,Æ +Æ® +U,u,Ù,Ú,Û,Ãœ,ù,ú,û,ü,Ũ,Å©,Ū,Å«,Ŭ,Å,Å®,ů,Å°,ű,Ų,ų,Ư,Æ°,Ç“,Ç”,Ç•,Ç–,Ç—,ǘ,Ç™,Çš,Ç›,Çœ +Æœ +Ʊ +V,v +Ʋ +W,w,Å´,ŵ +X,x +Y,y,Ã,ý,ÿ,Ŷ,Å·,Ÿ +Ƴ,Æ´ +Z,z,Ź,ź,Å»,ż,Ž,ž +Æ +Ƶ,ƶ +Æ·,Ç®,ǯ +Ƹ,ƹ +ƺ +Þ,þ +Æ¿,Ç· +Æ» +Ƨ,ƨ +Ƽ,ƽ +Æ„,Æ… +ʼn +Ç€ +Ç +Ç‚ +ǃ +select group_concat(c1 order by c1) from t1 group by c1 collate utf8_roman_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Ã,Â,Ã,Ä,Ã…,à ,á,â,ã,ä,Ã¥,Ä€,Ä,Ä‚,ă,Ä„,Ä…,Ç,ÇŽ,Çž,ÇŸ,Ç ,Ç¡,Ǻ,Ç» +AA,Aa,aA,aa +Æ,æ,Ç¢,Ç£,Ǽ,ǽ +B,b +Æ€ +Æ +Æ‚,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,ÄŠ,Ä‹,ÄŒ,Ä +CH,Ch,cH,ch +Ƈ,ƈ +D,d,ÄŽ,Ä +DZ,Dz,dZ,dz,Ç„,Ç…,dž,DZ,Dz,dz +Ä,Ä‘ +Ɖ +ÆŠ +Æ‹,ÆŒ +Ã,ð +E,e,È,É,Ê,Ë,è,é,ê,ë,Ä’,Ä“,Ä”,Ä•,Ä–,Ä—,Ę,Ä™,Äš,Ä› +ÆŽ,Ç +Æ +Æ +F,f +Æ‘,Æ’ +G,g,Äœ,Ä,Äž,ÄŸ,Ä ,Ä¡,Ä¢,Ä£,Ǧ,ǧ,Ç´,ǵ +Ǥ,Ç¥ +Æ“ +Æ” +Æ¢,Æ£ +H,h,Ĥ,Ä¥ +Æ•,Ƕ +Ħ,ħ +I,J,i,j,ÃŒ,Ã,ÃŽ,Ã,ì,Ã,î,ï,Ĩ,Ä©,Ī,Ä«,Ĭ,Ä,Ä®,į,Ä°,Ç,Ç +IJ,Ij,iJ,ij +IJ,ij +ı +Æ— +Æ– +Ä´,ĵ,Ç° +K,k,Ķ,Ä·,Ǩ,Ç© +Ƙ,Æ™ +L,l,Ĺ,ĺ,Ä»,ļ,Ľ,ľ +Ä¿,Å€ +LJ,Lj,lJ,lj +LJ,Lj,lj +LL,Ll,lL,ll +Å,Å‚ +Æš +Æ› +M,m +N,n,Ñ,ñ,Ń,Å„,Å…,ņ,Ň,ň,Ǹ,ǹ +NJ,Nj,nJ,nj +ÇŠ,Ç‹,ÇŒ +Æ +Æž +ÅŠ,Å‹ +O,o,Ã’,Ó,Ô,Õ,Ö,ò,ó,ô,õ,ö,ÅŒ,Å,ÅŽ,Å,Å,Å‘,Æ ,Æ¡,Ç‘,Ç’,Ǫ,Ç«,Ǭ,Ç +OE,Oe,oE,oe,Å’,Å“ +Ø,ø,Ǿ,Ç¿ +Ɔ +ÆŸ +P,p +Ƥ,Æ¥ +Q,q +ĸ +R,r,Å”,Å•,Å–,Å—,Ř,Å™ +RR,Rr,rR,rr +Ʀ +S,s,Åš,Å›,Åœ,Å,Åž,ÅŸ,Å ,Å¡,Å¿ +SS,Ss,sS,ss,ß +Æ© +ƪ +T,t,Å¢,Å£,Ť,Å¥ +ƾ +Ŧ,ŧ +Æ« +Ƭ,Æ +Æ® +Ù,Ú,Û,Ãœ,ù,ú,û,ü,Ũ,Å©,Ū,Å«,Ŭ,Å,Å®,ů,Å°,ű,Ų,ų,Ư,Æ°,Ç“,Ç”,Ç•,Ç–,Ç—,ǘ,Ç™,Çš,Ç›,Çœ +Æœ +Ʊ +U,V,u,v +Ʋ +W,w,Å´,ŵ +X,x +Y,y,Ã,ý,ÿ,Ŷ,Å·,Ÿ +Ƴ,Æ´ +Z,z,Ź,ź,Å»,ż,Ž,ž +Æ +Ƶ,ƶ +Æ·,Ç®,ǯ +Ƹ,ƹ +ƺ +Þ,þ +Æ¿,Ç· +Æ» +Ƨ,ƨ +Ƽ,ƽ +Æ„,Æ… +ʼn +Ç€ +Ç +Ç‚ +ǃ +drop table t1; +SET NAMES utf8; +CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE utf8_general_ci, INDEX (c)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B403B11F770308 USING utf8)); +SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8) +COLLATE utf8_general_ci; +c +Μωδαί̈ +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8)); +SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8) +COLLATE utf8_general_ci ORDER BY c; +c +Μωδ +Μωδαί̈ +DROP TABLE t1; +CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE ucs2_unicode_ci, INDEX (c)); +INSERT INTO t1 VALUES (_ucs2 0x039C03C903B403B11F770308); +SELECT * FROM t1 WHERE c LIKE _ucs2 0x039C0025 COLLATE ucs2_unicode_ci; +c +Μωδαί̈ +INSERT INTO t1 VALUES (_ucs2 0x039C03C903B4); +SELECT * FROM t1 WHERE c LIKE _ucs2 0x039C0025 +COLLATE ucs2_unicode_ci ORDER BY c; +c +Μωδ +Μωδαί̈ +DROP TABLE t1; +CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE utf8_unicode_ci, INDEX (c)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B403B11F770308 USING utf8)); +SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8) COLLATE utf8_unicode_ci; +c +Μωδαί̈ +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8)); +SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8) +COLLATE utf8_unicode_ci ORDER BY c; +c +Μωδ +Μωδαί̈ +DROP TABLE t1; +CREATE TABLE t1 ( +col1 CHAR(32) CHARACTER SET utf8 NOT NULL +); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410627 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410628 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410648 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0633064A0651062F USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D06330646 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0642064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06320627062F0647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062806310627064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064706450647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F062706460634062C0648064A06270646064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A06270631064A062E USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062706460642064406270628 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A0631062706460650 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627062F064806270631062F USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280631062706480646200C06310627 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062E064806270646062F0647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A062D062A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0623062B064A0631 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220646 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0642063106270631 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06AF06310641062A0647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270646062F USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0634062E0635064A0651062A064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628062706310632 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270633062A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906A90633 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270648060C USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0631 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D062F0648062F USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628064A0633062A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648067E0646062C USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06330627064406AF064A060C USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063306270644 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606450627064A0646062F0647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A06280631064A0632 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062C06440633 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F060C USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628064A0646 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06350641062D0627062A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A0646 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A9062A06270628 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x068606340645 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062E06480631062F USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0686064706310647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06420648064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450635064506510645 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06310627 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0646063406270646 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645064A200C062F0647062F060C USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647063106860646062F USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06390645064400BB USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A9064806340634 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064706500646064A064606AF USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627062D063306270646 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A062706310634062706370631 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450646062A06340631 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0634062F0647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0633062A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064806270646 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064506270646 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064806510644 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0634062E064A0635 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0627062F USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280627 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064106270648062A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D06270644062A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064106A906510631 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063A064406280647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06270631062F USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A06A9064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270632 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063106470628063106270646 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606470636062A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506340631064806370647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A063106270646 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0646064A0632 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A06A9 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062D064206510642 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0637063106270632 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064106310647064606AF USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0645062F06510646 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A063106270646064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90627063106470627064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270648 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0639063106350647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064506480631 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0633064A06270633064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A063106270646060C USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D064806320647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906440645 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F062706460634 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450642062706440627062A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064A06AF0631 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648064A06980647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0646062706450647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506480631062F USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628062D062B USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628063106310633064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606480634062A0647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450646 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064606470627 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0622064606860647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064806310647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064206270645062A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E0631062F062706320645 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0698062706460648064A0647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06390648062A0650 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063306500631 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0646064A0633064F0646 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063106270633 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064A0626062A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0639064406480645200C063406310642064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280639062F0627064B USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062F063106330647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062206410631064A06420627064A064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06270646063406AF06270647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06440646062F0646 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E064A06480633062A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064606AF06270645064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E0633 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0622063A06270632 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062C064606AF USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062C064706270646 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064806510645 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063406470631 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A9064506280631064A062C USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450646062A06420644 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90631062F0646062F USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06470645 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06310641062A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220646062C0627 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506270646062F USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0627 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062706A9062A06280631 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606380631 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06480644062A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06480628062706310647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606330628062A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645063306270639062F USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0634062F USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06480632064A0631 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062E062A06270631 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06330641064A0631 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064606AF0644064A0633 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0642064A200C06320627062F0647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280627063206AF0634062A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064506330631 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220644064506270646064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270634 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220645062F0647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A906270631064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E0631062F0627062E062A0647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906440645064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627062F0628064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D062F0651 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606280648062F060C USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06480644064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906480636060C USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06340627064A062F USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506470645 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0631 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220646060C USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06470645063306310634 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90627064606480646 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062E0627064606480627062F06AF064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06AF06310645064A USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062C0648062F USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062206480631062F USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0648 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90627064506440627064B USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A06A9062F064A06AF0631 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06AF USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064406280633062A0647 USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F0646062F USING utf8)); +INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450647064506270646 USING utf8)); +SELECT HEX(CONVERT(col1 USING ucs2)) FROM t1 ORDER BY col1 COLLATE utf8_persian_ci, col1 COLLATE utf8_bin; +HEX(CONVERT(col1 USING ucs2)) +0041004100410627 +0041004100410628 +0041004100410648 +0041004100410647 +0622063A06270632 +062206410631064A06420627064A064A +06220644064506270646064A +06220645062F0647 +06220646 +06220646060C +06220646062C0627 +0622064606860647 +062206480631062F +0627062D063306270646 +0627062F0628064A +0627062F064806270631062F +06270632 +06270633062A +06270634 +0627064206270645062A +062706A9062A06280631 +0627064506480631 +06270646062F +062706460642064406270628 +0627064606AF0644064A0633 +06270648 +06270648060C +0627064806510644 +0627064A +0627064A063106270646 +0627064A063106270646060C +0627064A0631062706460650 +0627064A063106270646064A +0627064A0646 +0628 +06280627 +0628062706310632 +06280627063206AF0634062A +0628062D062B +06280631062706480646200C06310627 +062806310627064A +0628063106310633064A +06280639062F0627064B +06280648062C0648062F +06280648062F +06280648062F060C +06280648062F0646062F +06280647 +0628064A0633062A +0628064A0646 +067E0631062F0627062E062A0647 +067E0631062F062706320645 +067E0633 +067E064A06480633062A +062A0627 +062A06270631064A062E +062A0623062B064A0631 +062A06280631064A0632 +062A062D062A +062A0631 +062A0634062E064A0635 +062A064106270648062A +062A064106A906510631 +062A0642064A +062A0642064A200C06320627062F0647 +062A0645062F06510646 +062A064606470627 +062A064806270646 +062C064606AF +062C064706270646 +068606340645 +0686064706310647 +062D06270644062A +062D062F0651 +062D062F0648062F +062D06330646 +062D064806320647 +062E0627064606480627062F06AF064A +062E064806270646062F0647 +062E06480631062F +062F0627062F +062F06270631062F +062F062706460634 +062F062706460634062C0648064A06270646064A +062F06270646063406AF06270647 +062F0631 +062F0633062A +062F06390648062A0650 +062F064406280633062A0647 +062F0646064A0633064F0646 +062F0648 +062F06480628062706310647 +062F064806310647 +062F06480644062A +062F064806510645 +062F064A06AF0631 +06310627 +063106270633 +06310641062A +063106470628063106270646 +06320627062F0647 +0698062706460648064A0647 +063306500631 +063306270644 +06330627064406AF064A060C +06330641064A0631 +0633064A06270633064A +0633064A0651062F +06340627064A062F +0634062E0635064A0651062A064A +0634062F +0634062F0647 +063406470631 +06350641062D0627062A +0637063106270632 +0639063106350647 +063906A90633 +063906440645 +063906440645064A +0639064406480645200C063406310642064A +06390645064400BB +063906480636060C +063A064406280647 +064106310647064606AF +0642063106270631 +06420648064A +06A90627063106470627064A +06A906270631064A +06A90627064506440627064B +06A90627064606480646 +06A9062A06270628 +06A90631062F0646062F +06A9064506280631064A062C +06A9064806340634 +06A90647 +06AF +06AF06310641062A0647 +06AF06310645064A +06440646062F0646 +064506270646062F +0645062C06440633 +0645062D064206510642 +0645062E062A06270631 +0645062F063106330647 +0645063306270639062F +064506340631064806370647 +06450635064506510645 +06450642062706440627062A +06450646 +06450646062A06340631 +06450646062A06420644 +064506480631062F +064506470645 +06450647064506270646 +0645064A +0645064A200C062F0647062F060C +0646062706450647 +064606280648062F060C +064606330628062A +0646063406270646 +064606380631 +064606450627064A0646062F0647 +064606480634062A0647 +064606470636062A +0646064A0632 +0648 +0648067E0646062C +06480632064A0631 +06480644064A +0648064A +0648064A06980647 +064706500646064A064606AF +0647063106860646062F +06470645 +0647064506270646 +0647064506330631 +06470645063306310634 +064706450647 +0647064606AF06270645064A +0647064A0626062A +064A062706310634062706370631 +064A06A9 +064A06A9062F064A06AF0631 +064A06A9064A +DROP TABLE t1; +SET @test_character_set= 'utf8'; +SET @test_collation= 'utf8_swedish_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) utf8_swedish_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) 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 +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; diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 6a10dec4fcd..aedb1738b19 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -1,4 +1,27 @@ DROP TABLE IF EXISTS t1; +SET NAMES latin1; +SET character_set_connection=ucs2; +select 'a' = 'a', 'a' = 'a ', 'a ' = 'a'; +'a' = 'a' 'a' = 'a ' 'a ' = 'a' +1 1 1 +select 'a\0' = 'a', 'a\0' < 'a', 'a\0' > 'a'; +'a\0' = 'a' 'a\0' < 'a' 'a\0' > 'a' +0 1 0 +select 'a' = 'a\0', 'a' < 'a\0', 'a' > 'a\0'; +'a' = 'a\0' 'a' < 'a\0' 'a' > 'a\0' +0 0 1 +select 'a\0' = 'a ', 'a\0' < 'a ', 'a\0' > 'a '; +'a\0' = 'a ' 'a\0' < 'a ' 'a\0' > 'a ' +0 1 0 +select 'a ' = 'a\0', 'a ' < 'a\0', 'a ' > 'a\0'; +'a ' = 'a\0' 'a ' < 'a\0' 'a ' > 'a\0' +0 0 1 +select 'a a' > 'a', 'a \0' < 'a'; +'a a' > 'a' 'a \0' < 'a' +1 1 +select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a'; +binary 'a a' > 'a' binary 'a \0' > 'a' binary 'a\0' > 'a' +1 1 1 SET CHARACTER SET koi8r; CREATE TABLE t1 (word VARCHAR(64) CHARACTER SET ucs2); INSERT INTO t1 VALUES (_koi8r'ò'), (X'2004'); diff --git a/mysql-test/r/flush_block_commit.result b/mysql-test/r/flush_block_commit.result index 17991f15382..4a7575d8f7a 100644 --- a/mysql-test/r/flush_block_commit.result +++ b/mysql-test/r/flush_block_commit.result @@ -20,4 +20,12 @@ commit; a 1 unlock tables; +commit; +begin; +insert into t1 values(10); +flush tables with read lock; +commit; +unlock tables; +flush tables with read lock; +unlock tables; drop table t1; diff --git a/mysql-test/r/func_test.result.es b/mysql-test/r/func_test.result.es new file mode 100644 index 00000000000..380f96835d0 --- /dev/null +++ b/mysql-test/r/func_test.result.es @@ -0,0 +1,185 @@ +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 diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 31903a5dfd2..33ca38a3bad 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -324,6 +324,26 @@ DROP DATABASE testdb7; DROP DATABASE testdb8; DROP DATABASE testdb9; DROP DATABASE testdb10; +create table t1(a int, b int, c int, d int); +grant insert(b), insert(c), insert(d), insert(a) on t1 to grant_user@localhost; +show grants for grant_user@localhost; +Grants for grant_user@localhost +GRANT USAGE ON *.* TO 'grant_user'@'localhost' +GRANT INSERT (a, d, c, b) ON `test`.`t1` TO 'grant_user'@'localhost' +select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv; +Host Db User Table_name Column_name Column_priv +localhost test grant_user t1 c Insert +localhost test grant_user t1 b Insert +localhost test grant_user t1 a Insert +localhost test grant_user t1 d Insert +revoke ALL PRIVILEGES on t1 from grant_user@localhost; +show grants for grant_user@localhost; +Grants for grant_user@localhost +GRANT USAGE ON *.* TO 'grant_user'@'localhost' +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; SHOW PRIVILEGES; Privilege Context Comment Alter Tables To alter the table diff --git a/mysql-test/r/have_openssl_1.require b/mysql-test/r/have_openssl_1.require index 032b60d544a..b33a1d2854f 100644 --- a/mysql-test/r/have_openssl_1.require +++ b/mysql-test/r/have_openssl_1.require @@ -1,2 +1,2 @@ Variable_name Value -Ssl_cipher EDH-RSA-DES-CBC3-SHA +Ssl_cipher DHE-RSA-AES256-SHA diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result index e741a6859c7..6756be84bb0 100644 --- a/mysql-test/r/heap.result +++ b/mysql-test/r/heap.result @@ -240,3 +240,12 @@ SELECT * FROM t1; pseudo date ZoomZip 1101106546 DROP TABLE t1; +create table t1(a char(2)) engine=memory; +insert into t1 values (NULL), (NULL); +delete from t1 where a is null; +insert into t1 values ('2'), ('3'); +select * from t1; +a +3 +2 +drop table t1; diff --git a/mysql-test/r/innodb.result.es b/mysql-test/r/innodb.result.es new file mode 100644 index 00000000000..602a034bc16 --- /dev/null +++ b/mysql-test/r/innodb.result.es @@ -0,0 +1,1653 @@ +drop table if exists t1,t2,t3,t4; +drop database if exists mysqltest; +create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb; +insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); +select id, code, name from t1 order by id; +id code name +1 1 Tim +2 1 Monty +3 2 David +4 2 Erik +5 3 Sasha +6 3 Jeremy +7 4 Matt +update ignore t1 set id = 8, name = 'Sinisa' where id < 3; +select id, code, name from t1 order by id; +id code name +2 1 Monty +3 2 David +4 2 Erik +5 3 Sasha +6 3 Jeremy +7 4 Matt +8 1 Sinisa +update ignore t1 set id = id + 10, name = 'Ralph' where id < 4; +select id, code, name from t1 order by id; +id code name +3 2 David +4 2 Erik +5 3 Sasha +6 3 Jeremy +7 4 Matt +8 1 Sinisa +12 1 Ralph +drop table t1; +CREATE TABLE t1 ( +id int(11) NOT NULL auto_increment, +parent_id int(11) DEFAULT '0' NOT NULL, +level tinyint(4) DEFAULT '0' NOT NULL, +PRIMARY KEY (id), +KEY parent_id (parent_id), +KEY level (level) +) engine=innodb; +INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2); +update t1 set parent_id=parent_id+100; +select * from t1 where parent_id=102; +id parent_id level +8 102 2 +9 102 2 +15 102 2 +update t1 set id=id+1000; +update t1 set id=1024 where id=1009; +Got one of the listed errors +select * from t1; +id parent_id level +1001 100 0 +1002 101 1 +1003 101 1 +1004 101 1 +1005 101 1 +1006 101 1 +1007 101 1 +1008 102 2 +1009 102 2 +1015 102 2 +1016 103 2 +1017 103 2 +1018 103 2 +1019 103 2 +1020 103 2 +1021 104 2 +1022 104 2 +1024 104 2 +1025 105 2 +1026 105 2 +1027 105 2 +1028 105 2 +1029 105 2 +1030 105 2 +1031 106 2 +1032 106 2 +1033 106 2 +1034 106 2 +1035 106 2 +1036 107 2 +1037 107 2 +1038 107 2 +1040 107 2 +1157 100 0 +1179 105 2 +1183 104 2 +1193 105 2 +1202 107 2 +1203 107 2 +update ignore t1 set id=id+1; +select * from t1; +id parent_id level +1001 100 0 +1002 101 1 +1003 101 1 +1004 101 1 +1005 101 1 +1006 101 1 +1007 101 1 +1008 102 2 +1010 102 2 +1015 102 2 +1016 103 2 +1017 103 2 +1018 103 2 +1019 103 2 +1020 103 2 +1021 104 2 +1023 104 2 +1024 104 2 +1025 105 2 +1026 105 2 +1027 105 2 +1028 105 2 +1029 105 2 +1030 105 2 +1031 106 2 +1032 106 2 +1033 106 2 +1034 106 2 +1035 106 2 +1036 107 2 +1037 107 2 +1039 107 2 +1041 107 2 +1158 100 0 +1180 105 2 +1184 104 2 +1194 105 2 +1202 107 2 +1204 107 2 +update ignore t1 set id=1023 where id=1010; +select * from t1 where parent_id=102; +id parent_id level +1008 102 2 +1010 102 2 +1015 102 2 +explain select level from t1 where level=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref level level 1 const # Using where; Using index +explain select level,id from t1 where level=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref level level 1 const # Using where; Using index +explain select level,id,parent_id from t1 where level=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref level level 1 const # Using where +select level,id from t1 where level=1; +level id +1 1002 +1 1003 +1 1004 +1 1005 +1 1006 +1 1007 +select level,id,parent_id from t1 where level=1; +level id parent_id +1 1002 101 +1 1003 101 +1 1004 101 +1 1005 101 +1 1006 101 +1 1007 101 +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +show keys from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 PRIMARY 1 id A # NULL NULL BTREE +t1 1 parent_id 1 parent_id A # NULL NULL BTREE +t1 1 level 1 level A # NULL NULL BTREE +drop table t1; +CREATE TABLE t1 ( +gesuchnr int(11) DEFAULT '0' NOT NULL, +benutzer_id int(11) DEFAULT '0' NOT NULL, +PRIMARY KEY (gesuchnr,benutzer_id) +) engine=innodb; +replace into t1 (gesuchnr,benutzer_id) values (2,1); +replace into t1 (gesuchnr,benutzer_id) values (1,1); +replace into t1 (gesuchnr,benutzer_id) values (1,1); +select * from t1; +gesuchnr benutzer_id +1 1 +2 1 +drop table t1; +create table t1 (a int) engine=innodb; +insert into t1 values (1), (2); +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +delete from t1 where a = 1; +select * from t1; +a +2 +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +create table t1 (a int,b varchar(20)) engine=innodb; +insert into t1 values (1,""), (2,"testing"); +delete from t1 where a = 1; +select * from t1; +a b +2 testing +create index skr on t1 (a); +insert into t1 values (3,""), (4,"testing"); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +show keys from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 skr 1 a A # NULL NULL YES BTREE +drop table t1; +create table t1 (a int,b varchar(20),key(a)) engine=innodb; +insert into t1 values (1,""), (2,"testing"); +select * from t1 where a = 1; +a b +1 +drop table t1; +create table t1 (n int not null primary key) engine=innodb; +set autocommit=0; +insert into t1 values (4); +rollback; +select n, "after rollback" from t1; +n after rollback +insert into t1 values (4); +commit; +select n, "after commit" from t1; +n after commit +4 after commit +commit; +insert into t1 values (5); +insert into t1 values (4); +ERROR 23000: Duplicate entry '4' for key 1 +commit; +select n, "after commit" from t1; +n after commit +4 after commit +5 after commit +set autocommit=1; +insert into t1 values (6); +insert into t1 values (4); +ERROR 23000: Duplicate entry '4' for key 1 +select n from t1; +n +4 +5 +6 +rollback; +drop table t1; +create table t1 (n int not null primary key) engine=innodb; +start transaction; +insert into t1 values (4); +flush tables with read lock; +commit; +unlock tables; +commit; +select * from t1; +n +4 +drop table t1; +create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=innodb; +begin; +insert into t1 values(1,'hamdouni'); +select id as afterbegin_id,nom as afterbegin_nom from t1; +afterbegin_id afterbegin_nom +1 hamdouni +rollback; +select id as afterrollback_id,nom as afterrollback_nom from t1; +afterrollback_id afterrollback_nom +set autocommit=0; +insert into t1 values(2,'mysql'); +select id as afterautocommit0_id,nom as afterautocommit0_nom from t1; +afterautocommit0_id afterautocommit0_nom +2 mysql +rollback; +select id as afterrollback_id,nom as afterrollback_nom from t1; +afterrollback_id afterrollback_nom +set autocommit=1; +drop table t1; +CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=innodb; +insert into t1 values ('pippo', 12); +insert into t1 values ('pippo', 12); +ERROR 23000: Duplicate entry 'pippo' for key 1 +delete from t1; +delete from t1 where id = 'pippo'; +select * from t1; +id val +insert into t1 values ('pippo', 12); +set autocommit=0; +delete from t1; +rollback; +select * from t1; +id val +pippo 12 +delete from t1; +commit; +select * from t1; +id val +drop table t1; +create table t1 (a integer) engine=innodb; +start transaction; +rename table t1 to t2; +create table t1 (b integer) engine=innodb; +insert into t1 values (1); +rollback; +drop table t1; +rename table t2 to t1; +drop table t1; +set autocommit=1; +CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=innodb; +INSERT INTO t1 VALUES (1, 'Jochen'); +select * from t1; +ID NAME +1 Jochen +drop table t1; +CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=innodb; +set autocommit=0; +INSERT INTO t1 SET _userid='marc@anyware.co.uk'; +COMMIT; +SELECT * FROM t1; +_userid +marc@anyware.co.uk +SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk'; +_userid +marc@anyware.co.uk +drop table t1; +set autocommit=1; +CREATE TABLE t1 ( +user_id int(10) DEFAULT '0' NOT NULL, +name varchar(100), +phone varchar(100), +ref_email varchar(100) DEFAULT '' NOT NULL, +detail varchar(200), +PRIMARY KEY (user_id,ref_email) +)engine=innodb; +INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar'); +select * from t1 where user_id=10292; +user_id name phone ref_email detail +10292 sanjeev 29153373 sansh777@hotmail.com xxx +10292 shirish 2333604 shirish@yahoo.com ddsds +10292 sonali 323232 sonali@bolly.com filmstar +INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds'); +select * from t1 where user_id=10292; +user_id name phone ref_email detail +10292 sanjeev 29153373 sansh777@hotmail.com xxx +10292 shirish 2333604 shirish@yahoo.com ddsds +10292 sonali 323232 sonali@bolly.com filmstar +select * from t1 where user_id>=10292; +user_id name phone ref_email detail +10292 sanjeev 29153373 sansh777@hotmail.com xxx +10292 shirish 2333604 shirish@yahoo.com ddsds +10292 sonali 323232 sonali@bolly.com filmstar +10293 shirish 2333604 shirish@yahoo.com ddsds +select * from t1 where user_id>10292; +user_id name phone ref_email detail +10293 shirish 2333604 shirish@yahoo.com ddsds +select * from t1 where user_id<10292; +user_id name phone ref_email detail +10291 sanjeev 29153373 sansh777@hotmail.com xxx +drop table t1; +CREATE TABLE t1 (a int not null, b int not null,c int not null, +key(a),primary key(a,b), unique(c),key(a),unique(b)); +show index from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 PRIMARY 1 a A # NULL NULL BTREE +t1 0 PRIMARY 2 b A # NULL NULL BTREE +t1 0 c 1 c A # NULL NULL BTREE +t1 0 b 1 b A # NULL NULL BTREE +t1 1 a 1 a A # NULL NULL BTREE +t1 1 a_2 1 a A # NULL NULL BTREE +drop table t1; +create table t1 (col1 int not null, col2 char(4) not null, primary key(col1)); +alter table t1 engine=innodb; +insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4'); +select * from t1; +col1 col2 +1 1 +2 3 +3 4 +4 4 +5 2 +update t1 set col2='7' where col1='4'; +select * from t1; +col1 col2 +1 1 +2 3 +3 4 +4 7 +5 2 +alter table t1 add co3 int not null; +select * from t1; +col1 col2 co3 +1 1 0 +2 3 0 +3 4 0 +4 7 0 +5 2 0 +update t1 set col2='9' where col1='2'; +select * from t1; +col1 col2 co3 +1 1 0 +2 9 0 +3 4 0 +4 7 0 +5 2 0 +drop table t1; +create table t1 (a int not null , b int, primary key (a)) engine = innodb; +create table t2 (a int not null , b int, primary key (a)) engine = myisam; +insert into t1 VALUES (1,3) , (2,3), (3,3); +select * from t1; +a b +1 3 +2 3 +3 3 +insert into t2 select * from t1; +select * from t2; +a b +1 3 +2 3 +3 3 +delete from t1 where b = 3; +select * from t1; +a b +insert into t1 select * from t2; +select * from t1; +a b +1 3 +2 3 +3 3 +select * from t2; +a b +1 3 +2 3 +3 3 +drop table t1,t2; +CREATE TABLE t1 ( +id int(11) NOT NULL auto_increment, +ggid varchar(32) binary DEFAULT '' NOT NULL, +email varchar(64) DEFAULT '' NOT NULL, +passwd varchar(32) binary DEFAULT '' NOT NULL, +PRIMARY KEY (id), +UNIQUE ggid (ggid) +) ENGINE=innodb; +insert into t1 (ggid,passwd) values ('test1','xxx'); +insert into t1 (ggid,passwd) values ('test2','yyy'); +insert into t1 (ggid,passwd) values ('test2','this will fail'); +ERROR 23000: Duplicate entry 'test2' for key 2 +insert into t1 (ggid,id) values ('this will fail',1); +ERROR 23000: Duplicate entry '1' for key 1 +select * from t1 where ggid='test1'; +id ggid email passwd +1 test1 xxx +select * from t1 where passwd='xxx'; +id ggid email passwd +1 test1 xxx +select * from t1 where id=2; +id ggid email passwd +2 test2 yyy +replace into t1 (ggid,id) values ('this will work',1); +replace into t1 (ggid,passwd) values ('test2','this will work'); +update t1 set id=100,ggid='test2' where id=1; +ERROR 23000: Duplicate entry 'test2' for key 2 +select * from t1; +id ggid email passwd +1 this will work +3 test2 this will work +select * from t1 where id=1; +id ggid email passwd +1 this will work +select * from t1 where id=999; +id ggid email passwd +drop table t1; +CREATE TABLE t1 ( +user_name varchar(12), +password text, +subscribed char(1), +user_id int(11) DEFAULT '0' NOT NULL, +quota bigint(20), +weight double, +access_date date, +access_time time, +approved datetime, +dummy_primary_key int(11) NOT NULL auto_increment, +PRIMARY KEY (dummy_primary_key) +) ENGINE=innodb; +INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1); +INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2); +INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3); +INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','23:06:59','2000-09-07 23:06:59',4); +INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','23:06:59','2000-09-07 23:06:59',5); +select user_name, password , subscribed, user_id, quota, weight, access_date, access_time, approved, dummy_primary_key from t1 order by user_name; +user_name password subscribed user_id quota weight access_date access_time approved dummy_primary_key +user_0 somepassword N 0 0 0 2000-09-07 23:06:59 2000-09-07 23:06:59 1 +user_1 somepassword Y 1 1 1 2000-09-07 23:06:59 2000-09-07 23:06:59 2 +user_2 somepassword N 2 2 1.4142135623731 2000-09-07 23:06:59 2000-09-07 23:06:59 3 +user_3 somepassword Y 3 3 1.7320508075689 2000-09-07 23:06:59 2000-09-07 23:06:59 4 +user_4 somepassword N 4 4 2 2000-09-07 23:06:59 2000-09-07 23:06:59 5 +drop table t1; +CREATE TABLE t1 ( +id int(11) NOT NULL auto_increment, +parent_id int(11) DEFAULT '0' NOT NULL, +level tinyint(4) DEFAULT '0' NOT NULL, +KEY (id), +KEY parent_id (parent_id), +KEY level (level) +) engine=innodb; +INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1); +INSERT INTO t1 values (179,5,2); +update t1 set parent_id=parent_id+100; +select * from t1 where parent_id=102; +id parent_id level +8 102 2 +9 102 2 +15 102 2 +update t1 set id=id+1000; +update t1 set id=1024 where id=1009; +select * from t1; +id parent_id level +1001 100 0 +1003 101 1 +1004 101 1 +1008 102 2 +1024 102 2 +1017 103 2 +1022 104 2 +1024 104 2 +1028 105 2 +1029 105 2 +1030 105 2 +1031 106 2 +1032 106 2 +1033 106 2 +1203 107 2 +1202 107 2 +1020 103 2 +1157 100 0 +1193 105 2 +1040 107 2 +1002 101 1 +1015 102 2 +1006 101 1 +1034 106 2 +1035 106 2 +1016 103 2 +1007 101 1 +1036 107 2 +1018 103 2 +1026 105 2 +1027 105 2 +1183 104 2 +1038 107 2 +1025 105 2 +1037 107 2 +1021 104 2 +1019 103 2 +1005 101 1 +1179 105 2 +update ignore t1 set id=id+1; +select * from t1; +id parent_id level +1002 100 0 +1004 101 1 +1005 101 1 +1009 102 2 +1025 102 2 +1018 103 2 +1023 104 2 +1025 104 2 +1029 105 2 +1030 105 2 +1031 105 2 +1032 106 2 +1033 106 2 +1034 106 2 +1204 107 2 +1203 107 2 +1021 103 2 +1158 100 0 +1194 105 2 +1041 107 2 +1003 101 1 +1016 102 2 +1007 101 1 +1035 106 2 +1036 106 2 +1017 103 2 +1008 101 1 +1037 107 2 +1019 103 2 +1027 105 2 +1028 105 2 +1184 104 2 +1039 107 2 +1026 105 2 +1038 107 2 +1022 104 2 +1020 103 2 +1006 101 1 +1180 105 2 +update ignore t1 set id=1023 where id=1010; +select * from t1 where parent_id=102; +id parent_id level +1009 102 2 +1025 102 2 +1016 102 2 +explain select level from t1 where level=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref level level 1 const # Using where; Using index +select level,id from t1 where level=1; +level id +1 1004 +1 1005 +1 1003 +1 1007 +1 1008 +1 1006 +select level,id,parent_id from t1 where level=1; +level id parent_id +1 1004 101 +1 1005 101 +1 1003 101 +1 1007 101 +1 1008 101 +1 1006 101 +select level,id from t1 where level=1 order by id; +level id +1 1003 +1 1004 +1 1005 +1 1006 +1 1007 +1 1008 +delete from t1 where level=1; +select * from t1; +id parent_id level +1002 100 0 +1009 102 2 +1025 102 2 +1018 103 2 +1023 104 2 +1025 104 2 +1029 105 2 +1030 105 2 +1031 105 2 +1032 106 2 +1033 106 2 +1034 106 2 +1204 107 2 +1203 107 2 +1021 103 2 +1158 100 0 +1194 105 2 +1041 107 2 +1016 102 2 +1035 106 2 +1036 106 2 +1017 103 2 +1037 107 2 +1019 103 2 +1027 105 2 +1028 105 2 +1184 104 2 +1039 107 2 +1026 105 2 +1038 107 2 +1022 104 2 +1020 103 2 +1180 105 2 +drop table t1; +CREATE TABLE t1 ( +sca_code char(6) NOT NULL, +cat_code char(6) NOT NULL, +sca_desc varchar(50), +lan_code char(2) NOT NULL, +sca_pic varchar(100), +sca_sdesc varchar(50), +sca_sch_desc varchar(16), +PRIMARY KEY (sca_code, cat_code, lan_code), +INDEX sca_pic (sca_pic) +) engine = innodb ; +INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING'); +select count(*) from t1 where sca_code = 'PD'; +count(*) +1 +select count(*) from t1 where sca_code <= 'PD'; +count(*) +1 +select count(*) from t1 where sca_pic is null; +count(*) +2 +alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic); +select count(*) from t1 where sca_code='PD' and sca_pic is null; +count(*) +1 +select count(*) from t1 where cat_code='E'; +count(*) +0 +alter table t1 drop index sca_pic, add index (sca_pic, cat_code); +select count(*) from t1 where sca_code='PD' and sca_pic is null; +count(*) +1 +select count(*) from t1 where sca_pic >= 'n'; +count(*) +1 +select sca_pic from t1 where sca_pic is null; +sca_pic +NULL +NULL +update t1 set sca_pic="test" where sca_pic is null; +delete from t1 where sca_code='pd'; +drop table t1; +set @a:=now(); +CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=innodb; +insert into t1 (a) values(1),(2),(3); +select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a; +a +1 +2 +3 +update t1 set a=5 where a=1; +select a from t1; +a +2 +3 +5 +drop table t1; +create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=innodb; +insert into t1 values("hello",1),("world",2); +select * from t1 order by b desc; +a b +world 2 +hello 1 +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +show keys from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 PRIMARY 1 a A # NULL NULL BTREE +drop table t1; +create table t1 (i int, j int ) ENGINE=innodb; +insert into t1 values (1,2); +select * from t1 where i=1 and j=2; +i j +1 2 +create index ax1 on t1 (i,j); +select * from t1 where i=1 and j=2; +i j +1 2 +drop table t1; +CREATE TABLE t1 ( +a int3 unsigned NOT NULL, +b int1 unsigned NOT NULL, +UNIQUE (a, b) +) ENGINE = innodb; +INSERT INTO t1 VALUES (1, 1); +SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1; +MIN(B) MAX(b) +1 1 +drop table t1; +CREATE TABLE t1 (a int unsigned NOT NULL) engine=innodb; +INSERT INTO t1 VALUES (1); +SELECT * FROM t1; +a +1 +DROP TABLE t1; +create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = innodb; +insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1); +explain select * from t1 where a > 0 and a < 50; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL # Using where +drop table t1; +create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb; +insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); +LOCK TABLES t1 WRITE; +insert into t1 values (99,1,2,'D'),(1,1,2,'D'); +ERROR 23000: Duplicate entry '1-1' for key 1 +select id from t1; +id +0 +1 +2 +select id from t1; +id +0 +1 +2 +UNLOCK TABLES; +DROP TABLE t1; +create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb; +insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); +LOCK TABLES t1 WRITE; +begin; +insert into t1 values (99,1,2,'D'),(1,1,2,'D'); +ERROR 23000: Duplicate entry '1-1' for key 1 +select id from t1; +id +0 +1 +2 +insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D'); +commit; +select id,id3 from t1; +id id3 +0 0 +1 1 +2 2 +100 2 +UNLOCK TABLES; +DROP TABLE t1; +create table t1 (a char(20), unique (a(5))) engine=innodb; +drop table t1; +create table t1 (a char(20), index (a(5))) engine=innodb; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(20) default NULL, + KEY `a` (`a`(5)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1; +create temporary table t1 (a int not null auto_increment, primary key(a)) engine=innodb; +insert into t1 values (NULL),(NULL),(NULL); +delete from t1 where a=3; +insert into t1 values (NULL); +select * from t1; +a +1 +2 +4 +alter table t1 add b int; +select * from t1; +a b +1 NULL +2 NULL +4 NULL +drop table t1; +create table t1 +( +id int auto_increment primary key, +name varchar(32) not null, +value text not null, +uid int not null, +unique key(name,uid) +) engine=innodb; +insert into t1 values (1,'one','one value',101), +(2,'two','two value',102),(3,'three','three value',103); +set insert_id=5; +replace into t1 (value,name,uid) values ('other value','two',102); +delete from t1 where uid=102; +set insert_id=5; +replace into t1 (value,name,uid) values ('other value','two',102); +set insert_id=6; +replace into t1 (value,name,uid) values ('other value','two',102); +select * from t1; +id name value uid +1 one one value 101 +3 three three value 103 +6 two other value 102 +drop table t1; +create database mysqltest; +create table mysqltest.t1 (a int not null) engine= innodb; +insert into mysqltest.t1 values(1); +create table mysqltest.t2 (a int not null) engine= myisam; +insert into mysqltest.t2 values(1); +create table mysqltest.t3 (a int not null) engine= heap; +insert into mysqltest.t3 values(1); +commit; +drop database mysqltest; +show tables from mysqltest; +Got one of the listed errors +set autocommit=0; +create table t1 (a int not null) engine= innodb; +insert into t1 values(1),(2); +truncate table t1; +ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction +commit; +truncate table t1; +select * from t1; +a +insert into t1 values(1),(2); +delete from t1; +select * from t1; +a +commit; +drop table t1; +set autocommit=1; +create table t1 (a int not null) engine= innodb; +insert into t1 values(1),(2); +truncate table t1; +insert into t1 values(1),(2); +select * from t1; +a +1 +2 +truncate table t1; +insert into t1 values(1),(2); +delete from t1; +select * from t1; +a +drop table t1; +create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=innodb; +insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4); +explain select * from t1 order by a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL # +explain select * from t1 order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 4 NULL # +explain select * from t1 order by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort +explain select a from t1 order by a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL # Using index +explain select b from t1 order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 4 NULL # Using index +explain select a,b from t1 order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 4 NULL # Using index +explain select a,b from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 4 NULL # Using index +explain select a,b,c from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL # +drop table t1; +create table t1 (t int not null default 1, key (t)) engine=innodb; +desc t1; +Field Type Null Key Default Extra +t int(11) MUL 1 +drop table t1; +CREATE TABLE t1 ( +number bigint(20) NOT NULL default '0', +cname char(15) NOT NULL default '', +carrier_id smallint(6) NOT NULL default '0', +privacy tinyint(4) NOT NULL default '0', +last_mod_date timestamp(14) NOT NULL, +last_mod_id smallint(6) NOT NULL default '0', +last_app_date timestamp(14) NOT NULL, +last_app_id smallint(6) default '-1', +version smallint(6) NOT NULL default '0', +assigned_scps int(11) default '0', +status tinyint(4) default '0' +) ENGINE=InnoDB; +INSERT INTO t1 VALUES (4077711111,'SeanWheeler',90,2,20020111112846,500,00000000000000,-1,2,3,1); +INSERT INTO t1 VALUES (9197722223,'berry',90,3,20020111112809,500,20020102114532,501,4,10,0); +INSERT INTO t1 VALUES (650,'San Francisco',0,0,20011227111336,342,00000000000000,-1,1,24,1); +INSERT INTO t1 VALUES (302467,'Sue\'s Subshop',90,3,20020109113241,500,20020102115111,501,7,24,0); +INSERT INTO t1 VALUES (6014911113,'SudzCarwash',520,1,20020102115234,500,20020102115259,501,33,32768,0); +INSERT INTO t1 VALUES (333,'tubs',99,2,20020109113440,501,20020109113440,500,3,10,0); +CREATE TABLE t2 ( +number bigint(20) NOT NULL default '0', +cname char(15) NOT NULL default '', +carrier_id smallint(6) NOT NULL default '0', +privacy tinyint(4) NOT NULL default '0', +last_mod_date timestamp(14) NOT NULL, +last_mod_id smallint(6) NOT NULL default '0', +last_app_date timestamp(14) NOT NULL, +last_app_id smallint(6) default '-1', +version smallint(6) NOT NULL default '0', +assigned_scps int(11) default '0', +status tinyint(4) default '0' +) ENGINE=InnoDB; +INSERT INTO t2 VALUES (4077711111,'SeanWheeler',0,2,20020111112853,500,00000000000000,-1,2,3,1); +INSERT INTO t2 VALUES (9197722223,'berry',90,3,20020111112818,500,20020102114532,501,4,10,0); +INSERT INTO t2 VALUES (650,'San Francisco',90,0,20020109113158,342,00000000000000,-1,1,24,1); +INSERT INTO t2 VALUES (333,'tubs',99,2,20020109113453,501,20020109113453,500,3,10,0); +select * from t1; +number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status +4077711111 SeanWheeler 90 2 2002-01-11 11:28:46 500 0000-00-00 00:00:00 -1 2 3 1 +9197722223 berry 90 3 2002-01-11 11:28:09 500 2002-01-02 11:45:32 501 4 10 0 +650 San Francisco 0 0 2001-12-27 11:13:36 342 0000-00-00 00:00:00 -1 1 24 1 +302467 Sue's Subshop 90 3 2002-01-09 11:32:41 500 2002-01-02 11:51:11 501 7 24 0 +6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0 +333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0 +select * from t2; +number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status +4077711111 SeanWheeler 0 2 2002-01-11 11:28:53 500 0000-00-00 00:00:00 -1 2 3 1 +9197722223 berry 90 3 2002-01-11 11:28:18 500 2002-01-02 11:45:32 501 4 10 0 +650 San Francisco 90 0 2002-01-09 11:31:58 342 0000-00-00 00:00:00 -1 1 24 1 +333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0 +delete t1, t2 from t1 left join t2 on t1.number=t2.number where (t1.carrier_id=90 and t1.number=t2.number) or (t2.carrier_id=90 and t1.number=t2.number) or (t1.carrier_id=90 and t2.number is null); +select * from t1; +number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status +6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0 +333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0 +select * from t2; +number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status +333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0 +select * from t2; +number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status +333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0 +drop table t1,t2; +create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb; +BEGIN; +SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; +SELECT @@tx_isolation,@@global.tx_isolation; +@@tx_isolation @@global.tx_isolation +SERIALIZABLE REPEATABLE-READ +insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'); +select id, code, name from t1 order by id; +id code name +1 1 Tim +2 1 Monty +3 2 David +COMMIT; +BEGIN; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +insert into t1 (code, name) values (2, 'Erik'), (3, 'Sasha'); +select id, code, name from t1 order by id; +id code name +1 1 Tim +2 1 Monty +3 2 David +4 2 Erik +5 3 Sasha +COMMIT; +BEGIN; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt'); +select id, code, name from t1 order by id; +id code name +1 1 Tim +2 1 Monty +3 2 David +4 2 Erik +5 3 Sasha +6 3 Jeremy +7 4 Matt +COMMIT; +DROP TABLE t1; +create table t1 (n int(10), d int(10)) engine=innodb; +create table t2 (n int(10), d int(10)) engine=innodb; +insert into t1 values(1,1),(1,2); +insert into t2 values(1,10),(2,20); +UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; +select * from t1; +n d +1 10 +1 10 +select * from t2; +n d +1 30 +2 20 +drop table t1,t2; +create table t1 (a int, b int) engine=innodb; +insert into t1 values(20,null); +select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on +t2.b=t3.a; +b ifnull(t2.b,"this is null") +NULL this is null +select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on +t2.b=t3.a order by 1; +b ifnull(t2.b,"this is null") +NULL this is null +insert into t1 values(10,null); +select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on +t2.b=t3.a order by 1; +b ifnull(t2.b,"this is null") +NULL this is null +NULL this is null +drop table t1; +create table t1 (a varchar(10) not null) engine=myisam; +create table t2 (b varchar(10) not null unique) engine=innodb; +select t1.a from t1,t2 where t1.a=t2.b; +a +drop table t1,t2; +create table t1 (a int not null, b int, primary key (a)) engine = innodb; +create table t2 (a int not null, b int, primary key (a)) engine = innodb; +insert into t1 values (10, 20); +insert into t2 values (10, 20); +update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10; +drop table t1,t2; +CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; +CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) ENGINE=INNODB; +insert into t1 set id=1; +insert into t2 set id=1, t1_id=1; +delete t1,t2 from t1,t2 where t1.id=t2.t1_id; +select * from t1; +id +select * from t2; +id t1_id +drop table t2,t1; +CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; +CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) ENGINE=INNODB; +INSERT INTO t1 VALUES(1); +INSERT INTO t2 VALUES(1, 1); +SELECT * from t1; +id +1 +UPDATE t1,t2 SET t1.id=t1.id+1, t2.t1_id=t1.id+1; +SELECT * from t1; +id +2 +UPDATE t1,t2 SET t1.id=t1.id+1 where t1.id!=t2.id; +SELECT * from t1; +id +3 +DROP TABLE t1,t2; +set autocommit=0; +CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; +CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; +CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) ENGINE=InnoDB; +INSERT INTO t3 VALUES("my-test-1", "my-test-2"); +COMMIT; +INSERT INTO t1 VALUES("this-key", "will disappear"); +INSERT INTO t2 VALUES("this-key", "will also disappear"); +DELETE FROM t3 WHERE id1="my-test-1"; +SELECT * FROM t1; +id value +this-key will disappear +SELECT * FROM t2; +id value +this-key will also disappear +SELECT * FROM t3; +id1 id2 +ROLLBACK; +SELECT * FROM t1; +id value +SELECT * FROM t2; +id value +SELECT * FROM t3; +id1 id2 +my-test-1 my-test-2 +SELECT * FROM t3 WHERE id1="my-test-1" LOCK IN SHARE MODE; +id1 id2 +my-test-1 my-test-2 +COMMIT; +set autocommit=1; +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) engine=innodb; +INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000; +SELECT * from t1; +a b +1 1 +102 2 +103 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +drop table t1; +CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb; +CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb; +INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12); +INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +update t1,t2 set t1.a=t1.a+100; +select * from t1; +a b +101 1 +102 2 +103 3 +104 4 +105 5 +106 6 +107 7 +108 8 +109 9 +110 10 +111 11 +112 12 +update t1,t2 set t1.a=t1.a+100 where t1.a=101; +select * from t1; +a b +201 1 +102 2 +103 3 +104 4 +105 5 +106 6 +107 7 +108 8 +109 9 +110 10 +111 11 +112 12 +update t1,t2 set t1.b=t1.b+10 where t1.b=2; +select * from t1; +a b +201 1 +103 3 +104 4 +105 5 +106 6 +107 7 +108 8 +109 9 +110 10 +111 11 +102 12 +112 12 +update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100; +select * from t1; +a b +201 1 +103 5 +104 6 +106 6 +105 7 +107 7 +108 8 +109 9 +110 10 +111 11 +102 12 +112 12 +select * from t2; +a b +1 1 +2 2 +6 6 +7 7 +8 8 +9 9 +3 13 +4 14 +5 15 +drop table t1,t2; +CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; +SET AUTOCOMMIT=0; +INSERT INTO t1 ( B_ID ) VALUES ( 1 ); +INSERT INTO t2 ( NEXT_T ) VALUES ( 1 ); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +SELECT * FROM t1; +B_ID +drop table t1,t2; +create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) engine = innodb; +insert into t1 values (1,0,4), (2,1,3), (3,2,1), (4,1,2); +select distinct parent,child from t1 order by parent; +parent child +0 4 +1 2 +1 3 +2 1 +drop table t1; +create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=innodb; +create table t2 (a int not null auto_increment primary key, b int); +insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null); +insert into t2 (a) select b from t1; +insert into t1 (b) select b from t2; +insert into t2 (a) select b from t1; +insert into t1 (a) select b from t2; +insert into t2 (a) select b from t1; +insert into t1 (a) select b from t2; +insert into t2 (a) select b from t1; +insert into t1 (a) select b from t2; +insert into t2 (a) select b from t1; +insert into t1 (a) select b from t2; +insert into t2 (a) select b from t1; +insert into t1 (a) select b from t2; +insert into t2 (a) select b from t1; +insert into t1 (a) select b from t2; +insert into t2 (a) select b from t1; +insert into t1 (a) select b from t2; +insert into t2 (a) select b from t1; +insert into t1 (a) select b from t2; +select count(*) from t1; +count(*) +29267 +explain select * from t1 where c between 1 and 10000; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range c c 5 NULL # Using where +update t1 set c=a; +explain select * from t1 where c between 1 and 10000; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL c NULL NULL NULL # Using where +drop table t1,t2; +create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb; +insert into t1 (id) values (null),(null),(null),(null),(null); +update t1 set fk=69 where fk is null order by id limit 1; +SELECT * from t1; +id fk +2 NULL +3 NULL +4 NULL +5 NULL +1 69 +drop table t1; +create table t1 (a int not null, b int not null, key (a)); +insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3); +SET @tmp=0; +update t1 set b=(@tmp:=@tmp+1) order by a; +update t1 set b=99 where a=1 order by b asc limit 1; +update t1 set b=100 where a=1 order by b desc limit 2; +update t1 set a=a+10+b where a=1 order by b; +select * from t1 order by a,b; +a b +2 4 +2 5 +2 6 +3 7 +3 8 +3 9 +3 10 +3 11 +3 12 +13 2 +111 100 +111 100 +drop table t1; +create table t1 ( c char(8) not null ) engine=innodb; +insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); +insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F'); +alter table t1 add b char(8) not null; +alter table t1 add a char(8) not null; +alter table t1 add primary key (a,b,c); +update t1 set a=c, b=c; +create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=innodb; +insert into t2 select * from t1; +delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b; +drop table t1,t2; +SET AUTOCOMMIT=1; +create table t1 (a integer auto_increment primary key) engine=innodb; +insert into t1 (a) values (NULL),(NULL); +truncate table t1; +insert into t1 (a) values (NULL),(NULL); +SELECT * from t1; +a +3 +4 +drop table t1; +CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) ENGINE=INNODB; +CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) ENGINE=INNODB; +drop table t2,t1; +create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) engine = innodb; +insert into `t1`values ( 1 ) ; +create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) engine = innodb; +insert into `t2`values ( 1 ) ; +create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb; +insert into `t3`values ( 1 ) ; +delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails +update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails +update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; +ERROR 42S02: Unknown table 't1' in where clause +drop table t3,t2,t1; +create table t1( +id int primary key, +pid int, +index(pid), +foreign key(pid) references t1(id) on delete cascade) engine=innodb; +insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6), +(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14); +delete from t1 where id=0; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails +delete from t1 where id=15; +delete from t1 where id=0; +drop table t1; +CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB; +CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx +(stamp))ENGINE=InnoDB; +insert into t1 values (1),(2),(3); +insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000); +Warnings: +Warning 1265 Data truncated for column 'stamp' at row 3 +SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp < +'20020204120000' GROUP BY col1; +col1 +1 +2 +3 +4 +drop table t1,t2; +CREATE TABLE t1 ( +`id` int(10) unsigned NOT NULL auto_increment, +`id_object` int(10) unsigned default '0', +`id_version` int(10) unsigned NOT NULL default '1', +label varchar(100) NOT NULL default '', +`description` text, +PRIMARY KEY (`id`), +KEY `id_object` (`id_object`), +KEY `id_version` (`id_version`) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL); +CREATE TABLE t2 ( +`id` int(10) unsigned NOT NULL auto_increment, +`id_version` int(10) unsigned NOT NULL default '1', +PRIMARY KEY (`id`), +KEY `id_version` (`id_version`) +) ENGINE=InnoDB; +INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9"); +SELECT t2.id, t1.label FROM t2 INNER JOIN +(SELECT t1.id_object as id_object FROM t1 WHERE t1.label LIKE '%test%') AS lbl +ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object); +id label +3382 Test +102 Le Pekin (Test) +1794 Test de resto +1822 Test 3 +3524 Societe Test +3525 Fournisseur Test +drop table t1,t2; +create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb; +select * from t1; +c1 c2 stamp +replace delayed into t1 (c1, c2) values ( "text1","11"),( "text2","12"); +select * from t1; +c1 c2 stamp +text1 11 2004-12-01 13:23:14 +text2 12 2004-12-01 13:23:14 +replace delayed into t1 (c1, c2) values ( "text1","12"),( "text2","13"),( "text3","14", "a" ),( "text4","15", "b" ); +ERROR 21S01: Column count doesn't match value count at row 3 +select * from t1; +c1 c2 stamp +text1 11 2004-12-01 13:23:14 +text2 12 2004-12-01 13:23:14 +drop table t1; +create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=myisam; +create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=innodb; +create table t3 (a int, b varchar(200), c text not null) checksum=1 engine=innodb; +insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, ""); +insert t2 select * from t1; +insert t3 select * from t1; +checksum table t1, t2, t3, t4 quick; +Table Checksum +test.t1 968604391 +test.t2 NULL +test.t3 NULL +test.t4 NULL +checksum table t1, t2, t3, t4; +Table Checksum +test.t1 968604391 +test.t2 968604391 +test.t3 968604391 +test.t4 NULL +checksum table t1, t2, t3, t4 extended; +Table Checksum +test.t1 968604391 +test.t2 968604391 +test.t3 968604391 +test.t4 NULL +drop table t1,t2,t3; +create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb; +insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt'); +select name2 from t1 union all select name from t1 union all select id from t1; +name2 +fff +sss +ttt +first +second +third +1 +2 +3 +drop table t1; +create table t1 (a int) engine=innodb; +create table t2 like t1; +drop table t1,t2; +create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb; +create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL default '0', + `id2` int(11) NOT NULL default '0', + UNIQUE KEY `id` (`id`,`id2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + KEY `t1_id_fk` (`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +create index id on t2 (id); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + KEY `id` (`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +create index id2 on t2 (id); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + KEY `id` (`id`), + KEY `id2` (`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop index id2 on t2; +drop index id on t2; +Got one of the listed errors +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + KEY `id` (`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t2; +create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + `id2` int(11) NOT NULL default '0', + KEY `t1_id_fk` (`id`,`id2`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +create unique index id on t2 (id,id2); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + `id2` int(11) NOT NULL default '0', + UNIQUE KEY `id` (`id`,`id2`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t2; +create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + `id2` int(11) NOT NULL default '0', + UNIQUE KEY `id` (`id`,`id2`), + KEY `t1_id_fk` (`id2`,`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t2; +create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + `id2` int(11) NOT NULL default '0', + UNIQUE KEY `id` (`id`,`id2`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t2; +create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + `id2` int(11) NOT NULL default '0', + UNIQUE KEY `id` (`id`,`id2`), + KEY `t1_id_fk` (`id2`,`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t2; +create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL auto_increment, + `id2` int(11) NOT NULL default '0', + PRIMARY KEY (`id`), + KEY `id` (`id`,`id2`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t2; +create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL auto_increment, + `id2` int(11) NOT NULL default '0', + KEY `t1_id_fk` (`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +alter table t2 add index id_test (id), add index id_test2 (id,id2); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL auto_increment, + `id2` int(11) NOT NULL default '0', + KEY `id_test` (`id`), + KEY `id_test2` (`id`,`id2`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t2; +create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb; +ERROR HY000: Can't create table '/home/hf/work/mysql-4.1.clean/mysql-test/var/master-data/test/t2.frm' (errno: 150) +create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) NOT NULL auto_increment, + `b` int(11) default NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `b_2` (`b`), + KEY `b` (`b`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t2; +create table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) NOT NULL auto_increment, + `b` int(11) default NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `b` (`b`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`), + CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t2, t1; +show status like "binlog_cache_use"; +Variable_name Value +Binlog_cache_use 24 +show status like "binlog_cache_disk_use"; +Variable_name Value +Binlog_cache_disk_use 0 +create table t1 (a int) engine=innodb; +show status like "binlog_cache_use"; +Variable_name Value +Binlog_cache_use 25 +show status like "binlog_cache_disk_use"; +Variable_name Value +Binlog_cache_disk_use 1 +begin; +delete from t1; +commit; +show status like "binlog_cache_use"; +Variable_name Value +Binlog_cache_use 26 +show status like "binlog_cache_disk_use"; +Variable_name Value +Binlog_cache_disk_use 1 +drop table t1; +create table t1 (c char(10), index (c,c)) engine=innodb; +ERROR 42S21: Duplicate column name 'c' +create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb; +ERROR 42S21: Duplicate column name 'c1' +create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb; +ERROR 42S21: Duplicate column name 'c1' +create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb; +ERROR 42S21: Duplicate column name 'c1' +create table t1 (c1 char(10), c2 char(10)) engine=innodb; +alter table t1 add key (c1,c1); +ERROR 42S21: Duplicate column name 'c1' +alter table t1 add key (c2,c1,c1); +ERROR 42S21: Duplicate column name 'c1' +alter table t1 add key (c1,c2,c1); +ERROR 42S21: Duplicate column name 'c1' +alter table t1 add key (c1,c1,c2); +ERROR 42S21: Duplicate column name 'c1' +drop table t1; diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index 323302128da..bb7d520dcab 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -81,6 +81,15 @@ 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; +Log_name Pos Event_type Server_id Orig_log_pos Info +master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3 +drop table t1; create table t1 (a int not null); create table t2 (a int not null); insert into t1 values (1); diff --git a/mysql-test/r/myisam-blob.result.es b/mysql-test/r/myisam-blob.result.es new file mode 100644 index 00000000000..4031b9cfd1c --- /dev/null +++ b/mysql-test/r/myisam-blob.result.es @@ -0,0 +1,59 @@ +drop table if exists t1; +CREATE TABLE t1 (data LONGBLOB) ENGINE=myisam; +INSERT INTO t1 (data) VALUES (NULL); +UPDATE t1 set data=repeat('a',18*1024*1024); +Warnings: +Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated +select length(data) from t1; +length(data) +NULL +delete from t1 where left(data,1)='a'; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +truncate table t1; +INSERT INTO t1 (data) VALUES (repeat('a',1*1024*1024)); +Warnings: +Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated +INSERT INTO t1 (data) VALUES (repeat('b',16*1024*1024-1024)); +Warnings: +Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated +delete from t1 where left(data,1)='b'; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +UPDATE t1 set data=repeat('c',17*1024*1024); +Warnings: +Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated +Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +delete from t1 where left(data,1)='c'; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 set data=repeat('a',18*1024*1024); +Warnings: +Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated +select length(data) from t1; +length(data) +NULL +NULL +NULL +alter table t1 modify data blob; +select length(data) from t1; +length(data) +NULL +NULL +NULL +drop table t1; +CREATE TABLE t1 (data BLOB) ENGINE=myisam; +INSERT INTO t1 (data) VALUES (NULL); +UPDATE t1 set data=repeat('a',18*1024*1024); +Warnings: +Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated +select length(data) from t1; +length(data) +NULL +drop table t1; diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result index a87d0c33559..f7cb17a1a74 100644 --- a/mysql-test/r/openssl_1.result +++ b/mysql-test/r/openssl_1.result @@ -2,9 +2,9 @@ drop table if exists t1; create table t1(f1 int); insert into t1 values (5); grant select on test.* to ssl_user1@localhost require SSL; -grant select on test.* to ssl_user2@localhost require cipher "EDH-RSA-DES-CBC3-SHA"; -grant select on test.* to ssl_user3@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com"; -grant select on test.* to ssl_user4@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com"; +grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA"; +grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com"; +grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com"; flush privileges; select * from t1; f1 diff --git a/mysql-test/r/ps_2myisam.result.es b/mysql-test/r/ps_2myisam.result.es new file mode 100644 index 00000000000..3f17b4cdcd0 --- /dev/null +++ b/mysql-test/r/ps_2myisam.result.es @@ -0,0 +1,3130 @@ +use test; +drop table if exists t1, t9 ; +create table t1 +( +a int, b varchar(30), +primary key(a) +) engine = 'MYISAM' ; +create table t9 +( +c1 tinyint, c2 smallint, c3 mediumint, c4 int, +c5 integer, c6 bigint, c7 float, c8 double, +c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), +c13 date, c14 datetime, c15 timestamp(14), c16 time, +c17 year, c18 bit, c19 bool, c20 char, +c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, +c25 blob, c26 text, c27 mediumblob, c28 mediumtext, +c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'), +c32 set('monday', 'tuesday', 'wednesday'), +primary key(c1) +) engine = 'MYISAM' ; +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +test_sequence +------ simple select tests ------ +prepare stmt1 from ' select * from t9 order by c1 ' ; +execute stmt1; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def test t9 t9 c1 c1 1 4 1 N 49155 0 63 +def test t9 t9 c2 c2 2 6 1 Y 32768 0 63 +def test t9 t9 c3 c3 9 9 1 Y 32768 0 63 +def test t9 t9 c4 c4 3 11 1 Y 32768 0 63 +def test t9 t9 c5 c5 3 11 1 Y 32768 0 63 +def test t9 t9 c6 c6 8 20 1 Y 32768 0 63 +def test t9 t9 c7 c7 4 12 1 Y 32768 31 63 +def test t9 t9 c8 c8 5 22 1 Y 32768 31 63 +def test t9 t9 c9 c9 5 22 1 Y 32768 31 63 +def test t9 t9 c10 c10 5 22 1 Y 32768 31 63 +def test t9 t9 c11 c11 0 9 6 Y 32768 4 63 +def test t9 t9 c12 c12 0 10 6 Y 32768 4 63 +def test t9 t9 c13 c13 10 10 10 Y 128 0 63 +def test t9 t9 c14 c14 12 19 19 Y 128 0 63 +def test t9 t9 c15 c15 7 19 19 N 1249 0 63 +def test t9 t9 c16 c16 11 8 8 Y 128 0 63 +def test t9 t9 c17 c17 13 4 4 Y 32864 0 63 +def test t9 t9 c18 c18 1 1 1 Y 32768 0 63 +def test t9 t9 c19 c19 1 1 1 Y 32768 0 63 +def test t9 t9 c20 c20 254 1 1 Y 0 0 8 +def test t9 t9 c21 c21 253 10 10 Y 0 0 8 +def test t9 t9 c22 c22 253 30 30 Y 0 0 8 +def test t9 t9 c23 c23 252 255 8 Y 144 0 63 +def test t9 t9 c24 c24 252 255 8 Y 16 0 8 +def test t9 t9 c25 c25 252 65535 4 Y 144 0 63 +def test t9 t9 c26 c26 252 65535 4 Y 16 0 8 +def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63 +def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8 +def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63 +def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8 +def test t9 t9 c31 c31 254 5 3 Y 256 0 8 +def test t9 t9 c32 c32 254 24 7 Y 2048 0 8 +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday +set @arg00='SELECT' ; +prepare stmt1 from ' ? a from t1 where a=1 '; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1 +set @arg00=1 ; +select @arg00, b from t1 where a=1 ; +@arg00 b +1 one +prepare stmt1 from ' select ?, b from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +? b +1 one +set @arg00='lion' ; +select @arg00, b from t1 where a=1 ; +@arg00 b +lion one +prepare stmt1 from ' select ?, b from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +? b +lion one +set @arg00=NULL ; +select @arg00, b from t1 where a=1 ; +@arg00 b +NULL one +prepare stmt1 from ' select ?, b from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +? b +NULL one +set @arg00=1 ; +select b, a - @arg00 from t1 where a=1 ; +b a - @arg00 +one 0 +prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +b a - ? +one 0 +set @arg00=null ; +select @arg00 as my_col ; +my_col +NULL +prepare stmt1 from ' select ? as my_col'; +execute stmt1 using @arg00 ; +my_col +NULL +select @arg00 + 1 as my_col ; +my_col +NULL +prepare stmt1 from ' select ? + 1 as my_col'; +execute stmt1 using @arg00 ; +my_col +NULL +select 1 + @arg00 as my_col ; +my_col +NULL +prepare stmt1 from ' select 1 + ? as my_col'; +execute stmt1 using @arg00 ; +my_col +NULL +set @arg00='MySQL' ; +select substr(@arg00,1,2) from t1 where a=1 ; +substr(@arg00,1,2) +My +prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +substr(?,1,2) +My +set @arg00=3 ; +select substr('MySQL',@arg00,5) from t1 where a=1 ; +substr('MySQL',@arg00,5) +SQL +prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +substr('MySQL',?,5) +SQL +select substr('MySQL',1,@arg00) from t1 where a=1 ; +substr('MySQL',1,@arg00) +MyS +prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +substr('MySQL',1,?) +MyS +set @arg00='MySQL' ; +select a , concat(@arg00,b) from t1 order by a; +a concat(@arg00,b) +1 MySQLone +2 MySQLtwo +3 MySQLthree +4 MySQLfour +prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ; +execute stmt1 using @arg00; +a concat(?,b) +1 MySQLone +2 MySQLtwo +3 MySQLthree +4 MySQLfour +select a , concat(b,@arg00) from t1 order by a ; +a concat(b,@arg00) +1 oneMySQL +2 twoMySQL +3 threeMySQL +4 fourMySQL +prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ; +execute stmt1 using @arg00; +a concat(b,?) +1 oneMySQL +2 twoMySQL +3 threeMySQL +4 fourMySQL +set @arg00='MySQL' ; +select group_concat(@arg00,b order by a) from t1 +group by 'a' ; +group_concat(@arg00,b order by a) +MySQLone,MySQLtwo,MySQLthree,MySQLfour +prepare stmt1 from ' select group_concat(?,b order by a) from t1 +group by ''a'' ' ; +execute stmt1 using @arg00; +group_concat(?,b order by a) +MySQLone,MySQLtwo,MySQLthree,MySQLfour +select group_concat(b,@arg00 order by a) from t1 +group by 'a' ; +group_concat(b,@arg00 order by a) +oneMySQL,twoMySQL,threeMySQL,fourMySQL +prepare stmt1 from ' select group_concat(b,? order by a) from t1 +group by ''a'' ' ; +execute stmt1 using @arg00; +group_concat(b,? order by a) +oneMySQL,twoMySQL,threeMySQL,fourMySQL +set @arg00='first' ; +set @arg01='second' ; +set @arg02=NULL; +select @arg00, @arg01 from t1 where a=1 ; +@arg00 @arg01 +first second +prepare stmt1 from ' select ?, ? from t1 where a=1 ' ; +execute stmt1 using @arg00, @arg01 ; +? ? +first second +execute stmt1 using @arg02, @arg01 ; +? ? +NULL second +execute stmt1 using @arg00, @arg02 ; +? ? +first NULL +execute stmt1 using @arg02, @arg02 ; +? ? +NULL NULL +drop table if exists t5 ; +create table t5 (id1 int(11) not null default '0', +value2 varchar(100), value1 varchar(100)) ; +insert into t5 values (1,'hh','hh'),(2,'hh','hh'), +(1,'ii','ii'),(2,'ii','ii') ; +prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ; +set @arg00=1 ; +set @arg01='hh' ; +execute stmt1 using @arg00, @arg01 ; +id1 value1 +1 hh +1 ii +2 hh +drop table t5 ; +drop table if exists t5 ; +create table t5(session_id char(9) not null) ; +insert into t5 values ('abc') ; +prepare stmt1 from ' select * from t5 +where ?=''1111'' and session_id = ''abc'' ' ; +set @arg00='abc' ; +execute stmt1 using @arg00 ; +session_id +set @arg00='1111' ; +execute stmt1 using @arg00 ; +session_id +abc +set @arg00='abc' ; +execute stmt1 using @arg00 ; +session_id +drop table t5 ; +set @arg00='FROM' ; +select a @arg00 t1 where a=1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 t1 where a=1' at line 1 +prepare stmt1 from ' select a ? t1 where a=1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? t1 where a=1' at line 1 +set @arg00='t1' ; +select a from @arg00 where a=1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 where a=1' at line 1 +prepare stmt1 from ' select a from ? where a=1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? where a=1' at line 1 +set @arg00='WHERE' ; +select a from t1 @arg00 a=1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a=1' at line 1 +prepare stmt1 from ' select a from t1 ? a=1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a=1' at line 1 +set @arg00=1 ; +select a FROM t1 where a=@arg00 ; +a +1 +prepare stmt1 from ' select a FROM t1 where a=? ' ; +execute stmt1 using @arg00 ; +a +1 +set @arg00=1000 ; +execute stmt1 using @arg00 ; +a +set @arg00=NULL ; +select a FROM t1 where a=@arg00 ; +a +prepare stmt1 from ' select a FROM t1 where a=? ' ; +execute stmt1 using @arg00 ; +a +set @arg00=4 ; +select a FROM t1 where a=sqrt(@arg00) ; +a +2 +prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ; +execute stmt1 using @arg00 ; +a +2 +set @arg00=NULL ; +select a FROM t1 where a=sqrt(@arg00) ; +a +prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ; +execute stmt1 using @arg00 ; +a +set @arg00=2 ; +set @arg01=3 ; +select a FROM t1 where a in (@arg00,@arg01) order by a; +a +2 +3 +prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a '; +execute stmt1 using @arg00, @arg01; +a +2 +3 +set @arg00= 'one' ; +set @arg01= 'two' ; +set @arg02= 'five' ; +prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ; +execute stmt1 using @arg00, @arg01, @arg02 ; +b +one +two +prepare stmt1 from ' select b FROM t1 where b like ? '; +set @arg00='two' ; +execute stmt1 using @arg00 ; +b +two +set @arg00='tw%' ; +execute stmt1 using @arg00 ; +b +two +set @arg00='%wo' ; +execute stmt1 using @arg00 ; +b +two +set @arg00=null ; +insert into t9 set c1= 0, c5 = NULL ; +select c5 from t9 where c5 > NULL ; +c5 +prepare stmt1 from ' select c5 from t9 where c5 > ? '; +execute stmt1 using @arg00 ; +c5 +select c5 from t9 where c5 < NULL ; +c5 +prepare stmt1 from ' select c5 from t9 where c5 < ? '; +execute stmt1 using @arg00 ; +c5 +select c5 from t9 where c5 = NULL ; +c5 +prepare stmt1 from ' select c5 from t9 where c5 = ? '; +execute stmt1 using @arg00 ; +c5 +select c5 from t9 where c5 <=> NULL ; +c5 +NULL +prepare stmt1 from ' select c5 from t9 where c5 <=> ? '; +execute stmt1 using @arg00 ; +c5 +NULL +delete from t9 where c1= 0 ; +set @arg00='>' ; +select a FROM t1 where a @arg00 1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 1' at line 1 +prepare stmt1 from ' select a FROM t1 where a ? 1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? 1' at line 1 +set @arg00=1 ; +select a,b FROM t1 where a is not NULL +AND b is not NULL group by a - @arg00 ; +a b +1 one +2 two +3 three +4 four +prepare stmt1 from ' select a,b FROM t1 where a is not NULL +AND b is not NULL group by a - ? ' ; +execute stmt1 using @arg00 ; +a b +1 one +2 two +3 three +4 four +set @arg00='two' ; +select a,b FROM t1 where a is not NULL +AND b is not NULL having b <> @arg00 order by a ; +a b +1 one +3 three +4 four +prepare stmt1 from ' select a,b FROM t1 where a is not NULL +AND b is not NULL having b <> ? order by a ' ; +execute stmt1 using @arg00 ; +a b +1 one +3 three +4 four +set @arg00=1 ; +select a,b FROM t1 where a is not NULL +AND b is not NULL order by a - @arg00 ; +a b +1 one +2 two +3 three +4 four +prepare stmt1 from ' select a,b FROM t1 where a is not NULL +AND b is not NULL order by a - ? ' ; +execute stmt1 using @arg00 ; +a b +1 one +2 two +3 three +4 four +set @arg00=2 ; +select a,b from t1 order by 2 ; +a b +4 four +1 one +3 three +2 two +prepare stmt1 from ' select a,b from t1 +order by ? '; +execute stmt1 using @arg00; +a b +4 four +1 one +3 three +2 two +set @arg00=1 ; +execute stmt1 using @arg00; +a b +1 one +2 two +3 three +4 four +set @arg00=0 ; +execute stmt1 using @arg00; +ERROR 42S22: Unknown column '?' in 'order clause' +set @arg00=1; +prepare stmt1 from ' select a,b from t1 order by a +limit 1 '; +execute stmt1 ; +a b +1 one +prepare stmt1 from ' select a,b from t1 +limit ? '; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2 +set @arg00='b' ; +set @arg01=0 ; +set @arg02=2 ; +set @arg03=2 ; +select sum(a), @arg00 from t1 where a > @arg01 +and b is not null group by substr(b,@arg02) +having sum(a) <> @arg03 ; +sum(a) @arg00 +3 b +1 b +4 b +prepare stmt1 from ' select sum(a), ? from t1 where a > ? +and b is not null group by substr(b,?) +having sum(a) <> ? '; +execute stmt1 using @arg00, @arg01, @arg02, @arg03; +sum(a) ? +3 b +1 b +4 b +test_sequence +------ join tests ------ +select first.a as a1, second.a as a2 +from t1 first, t1 second +where first.a = second.a order by a1 ; +a1 a2 +1 1 +2 2 +3 3 +4 4 +prepare stmt1 from ' select first.a as a1, second.a as a2 + from t1 first, t1 second + where first.a = second.a order by a1 '; +execute stmt1 ; +a1 a2 +1 1 +2 2 +3 3 +4 4 +set @arg00='ABC'; +set @arg01='two'; +set @arg02='one'; +select first.a, @arg00, second.a FROM t1 first, t1 second +where @arg01 = first.b or first.a = second.a or second.b = @arg02 +order by second.a, first.a; +a @arg00 a +1 ABC 1 +2 ABC 1 +3 ABC 1 +4 ABC 1 +2 ABC 2 +2 ABC 3 +3 ABC 3 +2 ABC 4 +4 ABC 4 +prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second + where ? = first.b or first.a = second.a or second.b = ? + order by second.a, first.a'; +execute stmt1 using @arg00, @arg01, @arg02; +a ? a +1 ABC 1 +2 ABC 1 +3 ABC 1 +4 ABC 1 +2 ABC 2 +2 ABC 3 +3 ABC 3 +2 ABC 4 +4 ABC 4 +drop table if exists t2 ; +create table t2 as select * from t1 ; +set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ; +set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ; +set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ; +set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ; +set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ; +set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ; +set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ; +set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ; +set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ; +the join statement is: +SELECT * FROM t2 right join t1 using(a) order by t2.a +prepare stmt1 from @query9 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 natural right join t1 order by t2.a +prepare stmt1 from @query8 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a +prepare stmt1 from @query7 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 left join t1 using(a) order by t2.a +prepare stmt1 from @query6 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 natural left join t1 order by t2.a +prepare stmt1 from @query5 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a +prepare stmt1 from @query4 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 join t1 using(a) order by t2.a +prepare stmt1 from @query3 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 natural join t1 order by t2.a +prepare stmt1 from @query2 ; +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +the join statement is: +SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a +prepare stmt1 from @query1 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +drop table t2 ; +test_sequence +------ subquery tests ------ +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = ''two'') '; +execute stmt1 ; +a b +2 two +set @arg00='two' ; +select a, b FROM t1 outer_table where +a = (select a from t1 where b = 'two' ) and b=@arg00 ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = ''two'') and b=? '; +execute stmt1 using @arg00; +a b +2 two +set @arg00='two' ; +select a, b FROM t1 outer_table where +a = (select a from t1 where b = @arg00 ) and b='two' ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = ? ) and b=''two'' ' ; +execute stmt1 using @arg00; +a b +2 two +set @arg00=3 ; +set @arg01='three' ; +select a,b FROM t1 where (a,b) in (select 3, 'three'); +a b +3 three +select a FROM t1 where (a,b) in (select @arg00,@arg01); +a +3 +prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) '; +execute stmt1 using @arg00, @arg01; +a +3 +set @arg00=1 ; +set @arg01='two' ; +set @arg02=2 ; +set @arg03='two' ; +select a, @arg00, b FROM t1 outer_table where +b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ; +a @arg00 b +2 1 two +prepare stmt1 from ' select a, ?, b FROM t1 outer_table where + b=? and a = (select ? from t1 where b = ? ) ' ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; +a ? b +2 1 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = outer_table.b ) order by a '; +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +prepare stmt1 from ' SELECT a as ccc from t1 where a+1= + (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; +execute stmt1 ; +ccc +1 +deallocate prepare stmt1 ; +prepare stmt1 from ' SELECT a as ccc from t1 where a+1= + (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; +execute stmt1 ; +ccc +1 +deallocate prepare stmt1 ; +prepare stmt1 from ' SELECT a as ccc from t1 where a+1= + (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; +execute stmt1 ; +ccc +1 +deallocate prepare stmt1 ; +set @arg00='two' ; +select a, b FROM t1 outer_table where +a = (select a from t1 where b = outer_table.b ) and b=@arg00 ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = outer_table.b) and b=? '; +execute stmt1 using @arg00; +a b +2 two +set @arg00=2 ; +select a, b FROM t1 outer_table where +a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ; +execute stmt1 using @arg00; +a b +2 two +set @arg00=2 ; +select a, b FROM t1 outer_table where +a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ; +execute stmt1 using @arg00; +a b +2 two +set @arg00=1 ; +set @arg01='two' ; +set @arg02=2 ; +set @arg03='two' ; +select a, @arg00, b FROM t1 outer_table where +b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03 +and outer_table.a=a ) ; +a @arg00 b +2 1 two +prepare stmt1 from ' select a, ?, b FROM t1 outer_table where + b=? and a = (select ? from t1 where outer_table.b = ? + and outer_table.a=a ) ' ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; +a ? b +2 1 two +set @arg00=1 ; +set @arg01=0 ; +select a, @arg00 +from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2 +where a=@arg01; +a @arg00 +0 1 +prepare stmt1 from ' select a, ? + from ( select a - ? as a from t1 where a=? ) as t2 + where a=? '; +execute stmt1 using @arg00, @arg00, @arg00, @arg01 ; +a ? +0 1 +drop table if exists t2 ; +create table t2 as select * from t1; +prepare stmt1 from ' select a in (select a from t2) from t1 ' ; +execute stmt1 ; +a in (select a from t2) +1 +1 +1 +1 +drop table if exists t5, t6, t7 ; +create table t5 (a int , b int) ; +create table t6 like t5 ; +create table t7 like t5 ; +insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7), +(2, -1), (3, 10) ; +insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ; +insert into t7 values (3, 3), (2, 2), (1, 1) ; +prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) from t7 ' ; +execute stmt1 ; +a (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) +3 1 +2 2 +1 2 +execute stmt1 ; +a (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) +3 1 +2 2 +1 2 +execute stmt1 ; +a (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) +3 1 +2 2 +1 2 +drop table t5, t6, t7 ; +drop table if exists t2 ; +create table t2 as select * from t9; +set @stmt= ' SELECT + (SELECT SUM(c1 + c12 + 0.0) FROM t2 + where (t9.c2 - 0e-3) = t2.c2 + GROUP BY t9.c15 LIMIT 1) as scalar_s, + exists (select 1.0e+0 from t2 + where t2.c3 * 9.0000000000 = t9.c4) as exists_s, + c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, + (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s +FROM t9, +(select c25 x, c32 y from t2) tt WHERE x = c25 ' ; +prepare stmt1 from @stmt ; +execute stmt1 ; +execute stmt1 ; +set @stmt= concat('explain ',@stmt); +prepare stmt1 from @stmt ; +execute stmt1 ; +execute stmt1 ; +set @stmt= ' SELECT + (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2 + GROUP BY t9.c15 LIMIT 1) as scalar_s, + exists (select ? from t2 + where t2.c3*?=t9.c4) as exists_s, + c5*? in (select c6+? from t2) as in_s, + (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s +FROM t9, +(select c25 x, c32 y from t2) tt WHERE x =c25 ' ; +set @arg00= 0.0 ; +set @arg01= 0e-3 ; +set @arg02= 1.0e+0 ; +set @arg03= 9.0000000000 ; +set @arg04= 4 ; +set @arg05= 0.3e+1 ; +set @arg06= 4 ; +set @arg07= 4 ; +set @arg08= 4.0 ; +set @arg09= 40e-1 ; +prepare stmt1 from @stmt ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +set @stmt= concat('explain ',@stmt); +prepare stmt1 from @stmt ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +drop table t2 ; +select 1 < (select a from t1) ; +ERROR 21000: Subquery returns more than 1 row +prepare stmt1 from ' select 1 < (select a from t1) ' ; +execute stmt1 ; +ERROR 21000: Subquery returns more than 1 row +select 1 as my_col ; +my_col +1 +test_sequence +------ union tests ------ +prepare stmt1 from ' select a FROM t1 where a=1 + union distinct + select a FROM t1 where a=1 '; +execute stmt1 ; +a +1 +execute stmt1 ; +a +1 +prepare stmt1 from ' select a FROM t1 where a=1 + union all + select a FROM t1 where a=1 '; +execute stmt1 ; +a +1 +1 +prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +set @arg00=1 ; +select @arg00 FROM t1 where a=1 +union distinct +select 1 FROM t1 where a=1; +@arg00 +1 +prepare stmt1 from ' select ? FROM t1 where a=1 + union distinct + select 1 FROM t1 where a=1 ' ; +execute stmt1 using @arg00; +? +1 +set @arg00=1 ; +select 1 FROM t1 where a=1 +union distinct +select @arg00 FROM t1 where a=1; +1 +1 +prepare stmt1 from ' select 1 FROM t1 where a=1 + union distinct + select ? FROM t1 where a=1 ' ; +execute stmt1 using @arg00; +1 +1 +set @arg00='a' ; +select @arg00 FROM t1 where a=1 +union distinct +select @arg00 FROM t1 where a=1; +@arg00 +a +prepare stmt1 from ' select ? FROM t1 where a=1 + union distinct + select ? FROM t1 where a=1 '; +execute stmt1 using @arg00, @arg00; +? +a +prepare stmt1 from ' select ? + union distinct + select ? '; +execute stmt1 using @arg00, @arg00; +? +a +set @arg00='a' ; +set @arg01=1 ; +set @arg02='a' ; +set @arg03=2 ; +select @arg00 FROM t1 where a=@arg01 +union distinct +select @arg02 FROM t1 where a=@arg03; +@arg00 +a +prepare stmt1 from ' select ? FROM t1 where a=? + union distinct + select ? FROM t1 where a=? ' ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03; +? +a +set @arg00=1 ; +prepare stmt1 from ' select sum(a) + 200, ? from t1 +union distinct +select sum(a) + 200, 1 from t1 +group by b ' ; +execute stmt1 using @arg00; +sum(a) + 200 ? +210 1 +204 1 +201 1 +203 1 +202 1 +set @Oporto='Oporto' ; +set @Lisboa='Lisboa' ; +set @0=0 ; +set @1=1 ; +set @2=2 ; +set @3=3 ; +set @4=4 ; +select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ; +@Oporto @Lisboa @0 @1 @2 @3 @4 +Oporto Lisboa 0 1 2 3 4 +select sum(a) + 200 as the_sum, @Oporto as the_town from t1 +group by b +union distinct +select sum(a) + 200, @Lisboa from t1 +group by b ; +the_sum the_town +204 Oporto +201 Oporto +203 Oporto +202 Oporto +204 Lisboa +201 Lisboa +203 Lisboa +202 Lisboa +prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 + group by b + union distinct + select sum(a) + 200, ? from t1 + group by b ' ; +execute stmt1 using @Oporto, @Lisboa; +the_sum the_town +204 Oporto +201 Oporto +203 Oporto +202 Oporto +204 Lisboa +201 Lisboa +203 Lisboa +202 Lisboa +select sum(a) + 200 as the_sum, @Oporto as the_town from t1 +where a > @1 +group by b +union distinct +select sum(a) + 200, @Lisboa from t1 +where a > @2 +group by b ; +the_sum the_town +204 Oporto +203 Oporto +202 Oporto +204 Lisboa +203 Lisboa +prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 + where a > ? + group by b + union distinct + select sum(a) + 200, ? from t1 + where a > ? + group by b ' ; +execute stmt1 using @Oporto, @1, @Lisboa, @2; +the_sum the_town +204 Oporto +203 Oporto +202 Oporto +204 Lisboa +203 Lisboa +select sum(a) + 200 as the_sum, @Oporto as the_town from t1 +where a > @1 +group by b +having avg(a) > @2 +union distinct +select sum(a) + 200, @Lisboa from t1 +where a > @2 +group by b +having avg(a) > @3; +the_sum the_town +204 Oporto +203 Oporto +204 Lisboa +prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 + where a > ? + group by b + having avg(a) > ? + union distinct + select sum(a) + 200, ? from t1 + where a > ? + group by b + having avg(a) > ? '; +execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3; +the_sum the_town +204 Oporto +203 Oporto +204 Lisboa +test_sequence +------ explain select tests ------ +prepare stmt1 from ' explain select * from t9 ' ; +execute stmt1; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def id 8 3 1 N 32801 0 8 +def select_type 253 19 6 N 1 31 33 +def table 253 64 2 N 1 31 33 +def type 253 10 3 N 1 31 33 +def possible_keys 253 4096 0 Y 0 31 33 +def key 253 64 0 Y 0 31 33 +def key_len 8 3 0 Y 32800 0 8 +def ref 253 1024 0 Y 0 31 33 +def rows 8 10 1 N 32801 0 8 +def Extra 253 255 0 N 1 31 33 +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t9 ALL NULL NULL NULL NULL 2 +drop table if exists t2 ; +create table t2 (s varchar(25), fulltext(s)) +ENGINE = 'MYISAM' ; +insert into t2 values ('Gravedigger'), ('Greed'),('Hollow Dogs') ; +commit ; +prepare stmt1 from ' select s from t2 where match (s) against (?) ' ; +set @arg00='Dogs' ; +execute stmt1 using @arg00 ; +s +Hollow Dogs +prepare stmt1 from ' SELECT s FROM t2 +where match (s) against (concat(?,''digger'')) '; +set @arg00='Grave' ; +execute stmt1 using @arg00 ; +s +Gravedigger +drop table t2 ; +test_sequence +------ delete tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +prepare stmt1 from 'delete from t1 where a=2' ; +execute stmt1; +select a,b from t1 where a=2; +a b +execute stmt1; +insert into t1 values(0,NULL); +set @arg00=NULL; +prepare stmt1 from 'delete from t1 where b=?' ; +execute stmt1 using @arg00; +select a,b from t1 where b is NULL ; +a b +0 NULL +set @arg00='one'; +execute stmt1 using @arg00; +select a,b from t1 where b=@arg00; +a b +prepare stmt1 from 'truncate table t1' ; +ERROR HY000: This command is not supported in the prepared statement protocol yet +test_sequence +------ update tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ; +execute stmt1; +select a,b from t1 where a=2; +a b +2 a=two +execute stmt1; +select a,b from t1 where a=2; +a b +2 a=two +set @arg00=NULL; +prepare stmt1 from 'update t1 set b=? where a=2' ; +execute stmt1 using @arg00; +select a,b from t1 where a=2; +a b +2 NULL +set @arg00='two'; +execute stmt1 using @arg00; +select a,b from t1 where a=2; +a b +2 two +set @arg00=2; +prepare stmt1 from 'update t1 set b=NULL where a=?' ; +execute stmt1 using @arg00; +select a,b from t1 where a=@arg00; +a b +2 NULL +update t1 set b='two' where a=@arg00; +set @arg00=2000; +execute stmt1 using @arg00; +select a,b from t1 where a=@arg00; +a b +set @arg00=2; +set @arg01=22; +prepare stmt1 from 'update t1 set a=? where a=?' ; +execute stmt1 using @arg00, @arg00; +select a,b from t1 where a=@arg00; +a b +2 two +execute stmt1 using @arg01, @arg00; +select a,b from t1 where a=@arg01; +a b +22 two +execute stmt1 using @arg00, @arg01; +select a,b from t1 where a=@arg00; +a b +2 two +set @arg00=NULL; +set @arg01=2; +execute stmt1 using @arg00, @arg01; +Warnings: +Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1 +select a,b from t1 order by a; +a b +0 two +1 one +3 three +4 four +set @arg00=0; +execute stmt1 using @arg01, @arg00; +select a,b from t1 order by a; +a b +1 one +2 two +3 three +4 four +set @arg00=23; +set @arg01='two'; +set @arg02=2; +set @arg03='two'; +set @arg04=2; +drop table if exists t2; +create table t2 as select a,b from t1 ; +prepare stmt1 from 'update t1 set a=? where b=? + and a in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 where a = @arg00 ; +a b +23 two +prepare stmt1 from 'update t1 set a=? where b=? + and a not in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 order by a ; +a b +1 one +2 two +3 three +4 four +drop table t2 ; +create table t2 +( +a int, b varchar(30), +primary key(a) +) engine = 'MYISAM' ; +insert into t2(a,b) select a, b from t1 ; +prepare stmt1 from 'update t1 set a=? where b=? + and a in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 where a = @arg00 ; +a b +23 two +prepare stmt1 from 'update t1 set a=? where b=? + and a not in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 order by a ; +a b +1 one +2 two +3 three +4 four +drop table t2 ; +set @arg00=1; +prepare stmt1 from 'update t1 set b=''bla'' +where a=2 +limit 1'; +execute stmt1 ; +select a,b from t1 where b = 'bla' ; +a b +2 bla +prepare stmt1 from 'update t1 set b=''bla'' +where a=2 +limit ?'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3 +test_sequence +------ insert tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +prepare stmt1 from 'insert into t1 values(5, ''five'' )'; +execute stmt1; +select a,b from t1 where a = 5; +a b +5 five +set @arg00='six' ; +prepare stmt1 from 'insert into t1 values(6, ? )'; +execute stmt1 using @arg00; +select a,b from t1 where b = @arg00; +a b +6 six +execute stmt1 using @arg00; +ERROR 23000: Duplicate entry '6' for key 1 +set @arg00=NULL ; +prepare stmt1 from 'insert into t1 values(0, ? )'; +execute stmt1 using @arg00; +select a,b from t1 where b is NULL; +a b +0 NULL +set @arg00=8 ; +set @arg01='eight' ; +prepare stmt1 from 'insert into t1 values(?, ? )'; +execute stmt1 using @arg00, @arg01 ; +select a,b from t1 where b = @arg01; +a b +8 eight +set @NULL= null ; +set @arg00= 'abc' ; +execute stmt1 using @NULL, @NULL ; +ERROR 23000: Column 'a' cannot be null +execute stmt1 using @NULL, @NULL ; +ERROR 23000: Column 'a' cannot be null +execute stmt1 using @NULL, @arg00 ; +ERROR 23000: Column 'a' cannot be null +execute stmt1 using @NULL, @arg00 ; +ERROR 23000: Column 'a' cannot be null +set @arg01= 10000 + 2 ; +execute stmt1 using @arg01, @arg00 ; +set @arg01= 10000 + 1 ; +execute stmt1 using @arg01, @arg00 ; +select * from t1 where a > 10000 order by a ; +a b +10001 abc +10002 abc +delete from t1 where a > 10000 ; +set @arg01= 10000 + 2 ; +execute stmt1 using @arg01, @NULL ; +set @arg01= 10000 + 1 ; +execute stmt1 using @arg01, @NULL ; +select * from t1 where a > 10000 order by a ; +a b +10001 NULL +10002 NULL +delete from t1 where a > 10000 ; +set @arg01= 10000 + 10 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 9 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 8 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 7 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 6 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 5 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 4 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 3 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 2 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 1 ; +execute stmt1 using @arg01, @arg01 ; +select * from t1 where a > 10000 order by a ; +a b +10001 10001 +10002 10002 +10003 10003 +10004 10004 +10005 10005 +10006 10006 +10007 10007 +10008 10008 +10009 10009 +10010 10010 +delete from t1 where a > 10000 ; +set @arg00=81 ; +set @arg01='8-1' ; +set @arg02=82 ; +set @arg03='8-2' ; +prepare stmt1 from 'insert into t1 values(?,?),(?,?)'; +execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; +select a,b from t1 where a in (@arg00,@arg02) ; +a b +81 8-1 +82 8-2 +set @arg00=9 ; +set @arg01='nine' ; +prepare stmt1 from 'insert into t1 set a=?, b=? '; +execute stmt1 using @arg00, @arg01 ; +select a,b from t1 where a = @arg00 ; +a b +9 nine +set @arg00=6 ; +set @arg01=1 ; +prepare stmt1 from 'insert into t1 set a=?, b=''sechs'' + on duplicate key update a=a + ?, b=concat(b,''modified'') '; +execute stmt1 using @arg00, @arg01; +select * from t1 order by a; +a b +0 NULL +1 one +2 two +3 three +4 four +5 five +7 sixmodified +8 eight +9 nine +81 8-1 +82 8-2 +set @arg00=81 ; +set @arg01=1 ; +execute stmt1 using @arg00, @arg01; +ERROR 23000: Duplicate entry '82' for key 1 +drop table if exists t2 ; +create table t2 (id int auto_increment primary key) +ENGINE= 'MYISAM' ; +prepare stmt1 from ' select last_insert_id() ' ; +insert into t2 values (NULL) ; +execute stmt1 ; +last_insert_id() +1 +insert into t2 values (NULL) ; +execute stmt1 ; +last_insert_id() +2 +drop table t2 ; +set @1000=1000 ; +set @x1000_2="x1000_2" ; +set @x1000_3="x1000_3" ; +set @x1000="x1000" ; +set @1100=1100 ; +set @x1100="x1100" ; +set @100=100 ; +set @updated="updated" ; +insert into t1 values(1000,'x1000_1') ; +insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3) +on duplicate key update a = a + @100, b = concat(b,@updated) ; +select a,b from t1 where a >= 1000 order by a ; +a b +1000 x1000_3 +1100 x1000_1updated +delete from t1 where a >= 1000 ; +insert into t1 values(1000,'x1000_1') ; +prepare stmt1 from ' insert into t1 values(?,?),(?,?) + on duplicate key update a = a + ?, b = concat(b,?) '; +execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ; +select a,b from t1 where a >= 1000 order by a ; +a b +1000 x1000_3 +1100 x1000_1updated +delete from t1 where a >= 1000 ; +insert into t1 values(1000,'x1000_1') ; +execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ; +select a,b from t1 where a >= 1000 order by a ; +a b +1200 x1000_1updatedupdated +delete from t1 where a >= 1000 ; +prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' '; +execute stmt1; +execute stmt1; +execute stmt1; +test_sequence +------ multi table tests ------ +delete from t1 ; +delete from t9 ; +insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ; +insert into t9 (c1,c21) +values (1, 'one'), (2, 'two'), (3, 'three') ; +prepare stmt_delete from " delete t1, t9 + from t1, t9 where t1.a=t9.c1 and t1.b='updated' "; +prepare stmt_update from " update t1, t9 + set t1.b='updated', t9.c21='updated' + where t1.a=t9.c1 and t1.a=? "; +prepare stmt_select1 from " select a, b from t1 order by a" ; +prepare stmt_select2 from " select c1, c21 from t9 order by c1" ; +set @arg00= 1 ; +execute stmt_update using @arg00 ; +execute stmt_delete ; +execute stmt_select1 ; +a b +2 two +3 three +execute stmt_select2 ; +c1 c21 +2 two +3 three +set @arg00= @arg00 + 1 ; +execute stmt_update using @arg00 ; +execute stmt_delete ; +execute stmt_select1 ; +a b +3 three +execute stmt_select2 ; +c1 c21 +3 three +set @arg00= @arg00 + 1 ; +execute stmt_update using @arg00 ; +execute stmt_delete ; +execute stmt_select1 ; +a b +execute stmt_select2 ; +c1 c21 +set @arg00= @arg00 + 1 ; +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +insert into t1 values(0,NULL) ; +set @duplicate='duplicate ' ; +set @1000=1000 ; +set @5=5 ; +select a,b from t1 where a < 5 order by a ; +a b +0 NULL +1 one +2 two +3 three +4 four +insert into t1 select a + @1000, concat(@duplicate,b) from t1 +where a < @5 ; +affected rows: 5 +info: Records: 5 Duplicates: 0 Warnings: 0 +select a,b from t1 where a >= 1000 order by a ; +a b +1000 NULL +1001 duplicate one +1002 duplicate two +1003 duplicate three +1004 duplicate four +delete from t1 where a >= 1000 ; +prepare stmt1 from ' insert into t1 select a + ?, concat(?,b) from t1 +where a < ? ' ; +execute stmt1 using @1000, @duplicate, @5; +affected rows: 5 +info: Records: 5 Duplicates: 0 Warnings: 0 +select a,b from t1 where a >= 1000 order by a ; +a b +1000 NULL +1001 duplicate one +1002 duplicate two +1003 duplicate three +1004 duplicate four +delete from t1 where a >= 1000 ; +set @float=1.00; +set @five='five' ; +drop table if exists t2; +create table t2 like t1 ; +insert into t2 (b,a) +select @duplicate, sum(first.a) from t1 first, t1 second +where first.a <> @5 and second.b = first.b +and second.b <> @five +group by second.b +having sum(second.a) > @2 +union +select b, a + @100 from t1 +where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b +from t1); +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 +select a,b from t2 order by a ; +a b +3 duplicate +4 duplicate +103 three +delete from t2 ; +prepare stmt1 from ' insert into t2 (b,a) +select ?, sum(first.a) + from t1 first, t1 second + where first.a <> ? and second.b = first.b and second.b <> ? + group by second.b + having sum(second.a) > ? +union +select b, a + ? from t1 + where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b + from t1 ) ' ; +execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ; +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 +select a,b from t2 order by a ; +a b +3 duplicate +4 duplicate +103 three +drop table t2; +drop table if exists t5 ; +set @arg01= 8; +set @arg02= 8.0; +set @arg03= 80.00000000000e-1; +set @arg04= 'abc' ; +set @arg05= CAST('abc' as binary) ; +set @arg06= '1991-08-05' ; +set @arg07= CAST('1991-08-05' as date); +set @arg08= '1991-08-05 01:01:01' ; +set @arg09= CAST('1991-08-05 01:01:01' as datetime) ; +set @arg10= unix_timestamp('1991-01-01 01:01:01'); +set @arg11= YEAR('1991-01-01 01:01:01'); +set @arg12= 8 ; +set @arg12= NULL ; +set @arg13= 8.0 ; +set @arg13= NULL ; +set @arg14= 'abc'; +set @arg14= NULL ; +set @arg15= CAST('abc' as binary) ; +set @arg15= NULL ; +create table t5 as select +8 as const01, @arg01 as param01, +8.0 as const02, @arg02 as param02, +80.00000000000e-1 as const03, @arg03 as param03, +'abc' as const04, @arg04 as param04, +CAST('abc' as binary) as const05, @arg05 as param05, +'1991-08-05' as const06, @arg06 as param06, +CAST('1991-08-05' as date) as const07, @arg07 as param07, +'1991-08-05 01:01:01' as const08, @arg08 as param08, +CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09, +unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10, +YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11, +NULL as const12, @arg12 as param12, +@arg13 as param13, +@arg14 as param14, +@arg15 as param15; +show create table t5 ; +Table Create Table +t5 CREATE TABLE `t5` ( + `const01` bigint(1) NOT NULL default '0', + `param01` bigint(20) default NULL, + `const02` double(3,1) NOT NULL default '0.0', + `param02` double default NULL, + `const03` double NOT NULL default '0', + `param03` double default NULL, + `const04` char(3) NOT NULL default '', + `param04` longtext, + `const05` binary(3) NOT NULL default '', + `param05` longblob, + `const06` varchar(10) NOT NULL default '', + `param06` longtext, + `const07` date default NULL, + `param07` longblob, + `const08` varchar(19) NOT NULL default '', + `param08` longtext, + `const09` datetime default NULL, + `param09` longblob, + `const10` int(10) NOT NULL default '0', + `param10` bigint(20) default NULL, + `const11` int(4) default NULL, + `param11` bigint(20) default NULL, + `const12` binary(0) default NULL, + `param12` bigint(20) default NULL, + `param13` double default NULL, + `param14` longtext, + `param15` longblob +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t5 ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def test t5 t5 const01 const01 8 1 1 N 32769 0 63 +def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 +def test t5 t5 const02 const02 5 3 3 N 32769 1 63 +def test t5 t5 param02 param02 5 20 1 Y 32768 31 63 +def test t5 t5 const03 const03 5 23 1 N 32769 31 63 +def test t5 t5 param03 param03 5 20 1 Y 32768 31 63 +def test t5 t5 const04 const04 254 3 3 N 1 0 8 +def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8 +def test t5 t5 const05 const05 254 3 3 N 129 0 63 +def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63 +def test t5 t5 const06 const06 253 10 10 N 1 0 8 +def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8 +def test t5 t5 const07 const07 10 10 10 Y 128 0 63 +def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63 +def test t5 t5 const08 const08 253 19 19 N 1 0 8 +def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8 +def test t5 t5 const09 const09 12 19 19 Y 128 0 63 +def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63 +def test t5 t5 const10 const10 3 10 9 N 32769 0 63 +def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 +def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 +def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 +def test t5 t5 const12 const12 254 0 0 Y 128 0 63 +def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 +def test t5 t5 param13 param13 5 20 0 Y 32768 31 63 +def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8 +def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63 +const01 8 +param01 8 +const02 8.0 +param02 8 +const03 8 +param03 8 +const04 abc +param04 abc +const05 abc +param05 abc +const06 1991-08-05 +param06 1991-08-05 +const07 1991-08-05 +param07 1991-08-05 +const08 1991-08-05 01:01:01 +param08 1991-08-05 01:01:01 +const09 1991-08-05 01:01:01 +param09 1991-08-05 01:01:01 +const10 662680861 +param10 662680861 +const11 1991 +param11 1991 +const12 NULL +param12 NULL +param13 NULL +param14 NULL +param15 NULL +drop table t5 ; +test_sequence +------ data type conversion tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ; +select * from t9 order by c1 ; +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday +test_sequence +------ select @parameter:= column ------ +prepare full_info from "select @arg01, @arg02, @arg03, @arg04, + @arg05, @arg06, @arg07, @arg08, + @arg09, @arg10, @arg11, @arg12, + @arg13, @arg14, @arg15, @arg16, + @arg17, @arg18, @arg19, @arg20, + @arg21, @arg22, @arg23, @arg24, + @arg25, @arg26, @arg27, @arg28, + @arg29, @arg30, @arg31, @arg32" ; +select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, +@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, +@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, +@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, +@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, +@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, +@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, +@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 +from t9 where c1= 1 ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, +@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, +@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, +@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, +@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, +@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, +@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, +@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 +from t9 where c1= 0 ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select + @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, + @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, + @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, + @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, + @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, + @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, + @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, + @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 +from t9 where c1= ?" ; +set @my_key= 1 ; +execute stmt1 using @my_key ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +set @my_key= 0 ; +execute stmt1 using @my_key ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':= c1 from t9 where c1= 1' at line 1 +test_sequence +------ select column, .. into @parm,.. ------ +select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, +c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, +c25, c26, c27, c28, c29, c30, c31, c32 +into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, +@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, +@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, +@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 +from t9 where c1= 1 ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, +c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, +c25, c26, c27, c28, c29, c30, c31, c32 +into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, +@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, +@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, +@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 +from t9 where c1= 0 ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, + c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, + c25, c26, c27, c28, c29, c30, c31, c32 +into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, + @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, + @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, + @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 +from t9 where c1= ?" ; +set @my_key= 1 ; +execute stmt1 using @my_key ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +set @my_key= 0 ; +execute stmt1 using @my_key ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t9 where c1= 1' at line 1 +test_sequence +-- insert into numeric columns -- +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ; +set @arg00= 21 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ; +execute stmt1 ; +set @arg00= 23; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, +30.0, 30.0, 30.0 ) ; +set @arg00= 31.0 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, + 32.0, 32.0, 32.0 )" ; +execute stmt1 ; +set @arg00= 33.0; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( '40', '40', '40', '40', '40', '40', '40', '40', +'40', '40', '40' ) ; +set @arg00= '41' ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( '42', '42', '42', '42', '42', '42', '42', '42', + '42', '42', '42' )" ; +execute stmt1 ; +set @arg00= '43'; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( CAST('50' as binary), CAST('50' as binary), +CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), +CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), +CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ; +set @arg00= CAST('51' as binary) ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( CAST('52' as binary), CAST('52' as binary), + CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), + CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), + CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ; +execute stmt1 ; +set @arg00= CAST('53' as binary) ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 2 ; +set @arg00= NULL ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +NULL, NULL, NULL ) ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 61, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL )" ; +execute stmt1 ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8.0 ; +set @arg00= NULL ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 71, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 'abc' ; +set @arg00= NULL ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 81, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 +from t9 where c1 >= 20 +order by c1 ; +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12 +20 20 20 20 20 20 20 20 20 20 20.0000 +21 21 21 21 21 21 21 21 21 21 21.0000 +22 22 22 22 22 22 22 22 22 22 22.0000 +23 23 23 23 23 23 23 23 23 23 23.0000 +30 30 30 30 30 30 30 30 30 30 30.0000 +31 31 31 31 31 31 31 31 31 31 31.0000 +32 32 32 32 32 32 32 32 32 32 32.0000 +33 33 33 33 33 33 33 33 33 33 33.0000 +40 40 40 40 40 40 40 40 40 40 40.0000 +41 41 41 41 41 41 41 41 41 41 41.0000 +42 42 42 42 42 42 42 42 42 42 42.0000 +43 43 43 43 43 43 43 43 43 43 43.0000 +50 50 50 50 50 50 50 50 50 50 50.0000 +51 51 51 51 51 51 51 51 51 51 51.0000 +52 52 52 52 52 52 52 52 52 52 52.0000 +53 53 53 53 53 53 53 53 53 53 53.0000 +60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +test_sequence +-- select .. where numeric column = .. -- +set @arg00= 20; +select 'true' as found from t9 +where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20 +and c8= 20 and c9= 20 and c10= 20 and c12= 20; +found +true +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20 + and c8= 20 and c9= 20 and c10= 20 and c12= 20 "; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 20.0; +select 'true' as found from t9 +where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0 +and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0; +found +true +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0 + and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 "; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +select 'true' as found from t9 +where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20' + and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20'; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20' + and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' "; +execute stmt1 ; +found +true +set @arg00= '20'; +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +select 'true' as found from t9 +where c1= CAST('20' as binary) and c2= CAST('20' as binary) and +c3= CAST('20' as binary) and c4= CAST('20' as binary) and +c5= CAST('20' as binary) and c6= CAST('20' as binary) and +c7= CAST('20' as binary) and c8= CAST('20' as binary) and +c9= CAST('20' as binary) and c10= CAST('20' as binary) and +c12= CAST('20' as binary); +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= CAST('20' as binary) and c2= CAST('20' as binary) and + c3= CAST('20' as binary) and c4= CAST('20' as binary) and + c5= CAST('20' as binary) and c6= CAST('20' as binary) and + c7= CAST('20' as binary) and c8= CAST('20' as binary) and + c9= CAST('20' as binary) and c10= CAST('20' as binary) and + c12= CAST('20' as binary) "; +execute stmt1 ; +found +true +set @arg00= CAST('20' as binary) ; +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +delete from t9 ; +test_sequence +-- some numeric overflow experiments -- +prepare my_insert from "insert into t9 + ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 +from t9 where c21 = 'O' "; +prepare my_delete from "delete from t9 where c21 = 'O' "; +set @arg00= 9223372036854775807 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 127 +c2 32767 +c3 8388607 +c4 2147483647 +c5 2147483647 +c6 9223372036854775807 +c7 9.22337e+18 +c8 9.22337203685478e+18 +c9 9.22337203685478e+18 +c10 9.22337203685478e+18 +c12 99999.9999 +execute my_delete ; +set @arg00= '9223372036854775807' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 127 +c2 32767 +c3 8388607 +c4 2147483647 +c5 2147483647 +c6 9223372036854775807 +c7 9.22337e+18 +c8 9.22337203685478e+18 +c9 9.22337203685478e+18 +c10 9.22337203685478e+18 +c12 99999.9999 +execute my_delete ; +set @arg00= -9223372036854775808 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -128 +c2 -32768 +c3 -8388608 +c4 -2147483648 +c5 -2147483648 +c6 -9223372036854775808 +c7 -9.22337e+18 +c8 -9.22337203685478e+18 +c9 -9.22337203685478e+18 +c10 -9.22337203685478e+18 +c12 -9999.9999 +execute my_delete ; +set @arg00= '-9223372036854775808' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -128 +c2 -32768 +c3 -8388608 +c4 -2147483648 +c5 -2147483648 +c6 -9223372036854775808 +c7 -9.22337e+18 +c8 -9.22337203685478e+18 +c9 -9.22337203685478e+18 +c10 -9.22337203685478e+18 +c12 -9999.9999 +execute my_delete ; +set @arg00= 1.11111111111111111111e+50 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 127 +c2 32767 +c3 8388607 +c4 2147483647 +c5 2147483647 +c6 9223372036854775807 +c7 3.40282e+38 +c8 1.11111111111111e+50 +c9 1.11111111111111e+50 +c10 1.11111111111111e+50 +c12 99999.9999 +execute my_delete ; +set @arg00= '1.11111111111111111111e+50' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Warning 1265 Data truncated for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1265 Data truncated for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 1 +c2 1 +c3 1 +c4 1 +c5 1 +c6 1 +c7 3.40282e+38 +c8 1.11111111111111e+50 +c9 1.11111111111111e+50 +c10 1.11111111111111e+50 +c12 99999.9999 +execute my_delete ; +set @arg00= -1.11111111111111111111e+50 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -128 +c2 -32768 +c3 -8388608 +c4 -2147483648 +c5 -2147483648 +c6 -9223372036854775808 +c7 -3.40282e+38 +c8 -1.11111111111111e+50 +c9 -1.11111111111111e+50 +c10 -1.11111111111111e+50 +c12 -9999.9999 +execute my_delete ; +set @arg00= '-1.11111111111111111111e+50' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Warning 1265 Data truncated for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1265 Data truncated for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -1 +c2 -1 +c3 -1 +c4 -1 +c5 -1 +c6 -1 +c7 -3.40282e+38 +c8 -1.11111111111111e+50 +c9 -1.11111111111111e+50 +c10 -1.11111111111111e+50 +c12 -9999.9999 +execute my_delete ; +test_sequence +-- insert into string columns -- +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 +from t9 where c1 >= 20 +order by c1 ; +c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 +20 2 20 20 20 20 20 20 20 20 20 20 +21 2 21 21 21 21 21 21 21 21 21 21 +22 2 22 22 22 22 22 22 22 22 22 22 +23 2 23 23 23 23 23 23 23 23 23 23 +30 3 30 30 30 30 30 30 30 30 30 30 +31 3 31 31 31 31 31 31 31 31 31 31 +32 3 32 32 32 32 32 32 32 32 32 32 +33 3 33 33 33 33 33 33 33 33 33 33 +40 4 40 40 40 40 40 40 40 40 40 40 +41 4 41 41 41 41 41 41 41 41 41 41 +42 4 42 42 42 42 42 42 42 42 42 42 +43 4 43 43 43 43 43 43 43 43 43 43 +50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00 +51 5 51 51 51 51 51 51 51 51 51 51 +52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00 +53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00 +54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00 +55 5 55 55 55 55 55 55 55 55 55 55 +56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00 +57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00 +60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +test_sequence +-- select .. where string column = .. -- +set @arg00= '20'; +select 'true' as found from t9 +where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and +c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and +c27= '20' and c28= '20' and c29= '20' and c30= '20' ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and + c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and + c27= '20' and c28= '20' and c29= '20' and c30= '20'" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and + c21= ? and c22= ? and c23= ? and c25= ? and + c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= CAST('20' as binary); +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20))) += CAST('20' as binary) and c21= CAST('20' as binary) +and c22= CAST('20' as binary) and c23= CAST('20' as binary) and +c24= CAST('20' as binary) and c25= CAST('20' as binary) and +c26= CAST('20' as binary) and c27= CAST('20' as binary) and +c28= CAST('20' as binary) and c29= CAST('20' as binary) and +c30= CAST('20' as binary) ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and +c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20))) + = CAST('20' as binary) and c21= CAST('20' as binary) + and c22= CAST('20' as binary) and c23= CAST('20' as binary) and + c24= CAST('20' as binary) and c25= CAST('20' as binary) and + c26= CAST('20' as binary) and c27= CAST('20' as binary) and + c28= CAST('20' as binary) and c29= CAST('20' as binary) and + c30= CAST('20' as binary)" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and + c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and + c29= ? and c30= ?"; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 20; +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and +c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and +c27= 20 and c28= 20 and c29= 20 and c30= 20 ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and + c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and + c27= 20 and c28= 20 and c29= 20 and c30= 20" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and + c21= ? and c22= ? and c23= ? and c25= ? and + c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 20.0; +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and +c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and +c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and + c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and + c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and + c21= ? and c22= ? and c23= ? and c25= ? and + c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +delete from t9 ; +test_sequence +-- insert into date/time columns -- +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; +c1 c13 c14 c15 c16 c17 +20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +60 NULL NULL 1991-01-01 01:01:01 NULL NULL +61 NULL NULL 1991-01-01 01:01:01 NULL NULL +62 NULL NULL 1991-01-01 01:01:01 NULL NULL +63 NULL NULL 1991-01-01 01:01:01 NULL NULL +71 NULL NULL 1991-01-01 01:01:01 NULL NULL +73 NULL NULL 1991-01-01 01:01:01 NULL NULL +81 NULL NULL 1991-01-01 01:01:01 NULL NULL +83 NULL NULL 1991-01-01 01:01:01 NULL NULL +test_sequence +-- select .. where date/time column = .. -- +set @arg00= '1991-01-01 01:01:01' ; +select 'true' as found from t9 +where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and +c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and +c17= '1991-01-01 01:01:01' ; +found +true +select 'true' as found from t9 +where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00 +and c17= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and + c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and + c17= '1991-01-01 01:01:01'" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; +select 'true' as found from t9 +where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and +c14= CAST('1991-01-01 01:01:01' as datetime) and +c15= CAST('1991-01-01 01:01:01' as datetime) and +c16= CAST('1991-01-01 01:01:01' as datetime) and +c17= CAST('1991-01-01 01:01:01' as datetime) ; +found +true +select 'true' as found from t9 +where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00 +and c17= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and + c14= CAST('1991-01-01 01:01:01' as datetime) and + c15= CAST('1991-01-01 01:01:01' as datetime) and + c16= CAST('1991-01-01 01:01:01' as datetime) and + c17= CAST('1991-01-01 01:01:01' as datetime)" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 1991 ; +select 'true' as found from t9 +where c1= 20 and c17= 1991 ; +found +true +select 'true' as found from t9 +where c1= 20 and c17= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c17= 1991" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c17= ?" ; +execute stmt1 using @arg00 ; +found +true +set @arg00= 1.991e+3 ; +select 'true' as found from t9 +where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ; +found +true +select 'true' as found from t9 +where c1= 20 and abs(c17 - @arg00) < 0.01 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and abs(c17 - ?) < 0.01" ; +execute stmt1 using @arg00 ; +found +true +drop table t1, t9; diff --git a/mysql-test/r/ps_3innodb.result.es b/mysql-test/r/ps_3innodb.result.es new file mode 100644 index 00000000000..9386f18a4df --- /dev/null +++ b/mysql-test/r/ps_3innodb.result.es @@ -0,0 +1,3113 @@ +use test; +drop table if exists t1, t9 ; +create table t1 +( +a int, b varchar(30), +primary key(a) +) engine = 'InnoDB' ; +create table t9 +( +c1 tinyint, c2 smallint, c3 mediumint, c4 int, +c5 integer, c6 bigint, c7 float, c8 double, +c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), +c13 date, c14 datetime, c15 timestamp(14), c16 time, +c17 year, c18 bit, c19 bool, c20 char, +c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, +c25 blob, c26 text, c27 mediumblob, c28 mediumtext, +c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'), +c32 set('monday', 'tuesday', 'wednesday'), +primary key(c1) +) engine = 'InnoDB' ; +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +test_sequence +------ simple select tests ------ +prepare stmt1 from ' select * from t9 order by c1 ' ; +execute stmt1; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def test t9 t9 c1 c1 1 4 1 N 49155 0 63 +def test t9 t9 c2 c2 2 6 1 Y 32768 0 63 +def test t9 t9 c3 c3 9 9 1 Y 32768 0 63 +def test t9 t9 c4 c4 3 11 1 Y 32768 0 63 +def test t9 t9 c5 c5 3 11 1 Y 32768 0 63 +def test t9 t9 c6 c6 8 20 1 Y 32768 0 63 +def test t9 t9 c7 c7 4 12 1 Y 32768 31 63 +def test t9 t9 c8 c8 5 22 1 Y 32768 31 63 +def test t9 t9 c9 c9 5 22 1 Y 32768 31 63 +def test t9 t9 c10 c10 5 22 1 Y 32768 31 63 +def test t9 t9 c11 c11 0 9 6 Y 32768 4 63 +def test t9 t9 c12 c12 0 10 6 Y 32768 4 63 +def test t9 t9 c13 c13 10 10 10 Y 128 0 63 +def test t9 t9 c14 c14 12 19 19 Y 128 0 63 +def test t9 t9 c15 c15 7 19 19 N 1249 0 63 +def test t9 t9 c16 c16 11 8 8 Y 128 0 63 +def test t9 t9 c17 c17 13 4 4 Y 32864 0 63 +def test t9 t9 c18 c18 1 1 1 Y 32768 0 63 +def test t9 t9 c19 c19 1 1 1 Y 32768 0 63 +def test t9 t9 c20 c20 254 1 1 Y 0 0 8 +def test t9 t9 c21 c21 253 10 10 Y 0 0 8 +def test t9 t9 c22 c22 253 30 30 Y 0 0 8 +def test t9 t9 c23 c23 252 255 8 Y 144 0 63 +def test t9 t9 c24 c24 252 255 8 Y 16 0 8 +def test t9 t9 c25 c25 252 65535 4 Y 144 0 63 +def test t9 t9 c26 c26 252 65535 4 Y 16 0 8 +def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63 +def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8 +def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63 +def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8 +def test t9 t9 c31 c31 254 5 3 Y 256 0 8 +def test t9 t9 c32 c32 254 24 7 Y 2048 0 8 +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday +set @arg00='SELECT' ; +prepare stmt1 from ' ? a from t1 where a=1 '; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1 +set @arg00=1 ; +select @arg00, b from t1 where a=1 ; +@arg00 b +1 one +prepare stmt1 from ' select ?, b from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +? b +1 one +set @arg00='lion' ; +select @arg00, b from t1 where a=1 ; +@arg00 b +lion one +prepare stmt1 from ' select ?, b from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +? b +lion one +set @arg00=NULL ; +select @arg00, b from t1 where a=1 ; +@arg00 b +NULL one +prepare stmt1 from ' select ?, b from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +? b +NULL one +set @arg00=1 ; +select b, a - @arg00 from t1 where a=1 ; +b a - @arg00 +one 0 +prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +b a - ? +one 0 +set @arg00=null ; +select @arg00 as my_col ; +my_col +NULL +prepare stmt1 from ' select ? as my_col'; +execute stmt1 using @arg00 ; +my_col +NULL +select @arg00 + 1 as my_col ; +my_col +NULL +prepare stmt1 from ' select ? + 1 as my_col'; +execute stmt1 using @arg00 ; +my_col +NULL +select 1 + @arg00 as my_col ; +my_col +NULL +prepare stmt1 from ' select 1 + ? as my_col'; +execute stmt1 using @arg00 ; +my_col +NULL +set @arg00='MySQL' ; +select substr(@arg00,1,2) from t1 where a=1 ; +substr(@arg00,1,2) +My +prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +substr(?,1,2) +My +set @arg00=3 ; +select substr('MySQL',@arg00,5) from t1 where a=1 ; +substr('MySQL',@arg00,5) +SQL +prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +substr('MySQL',?,5) +SQL +select substr('MySQL',1,@arg00) from t1 where a=1 ; +substr('MySQL',1,@arg00) +MyS +prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +substr('MySQL',1,?) +MyS +set @arg00='MySQL' ; +select a , concat(@arg00,b) from t1 order by a; +a concat(@arg00,b) +1 MySQLone +2 MySQLtwo +3 MySQLthree +4 MySQLfour +prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ; +execute stmt1 using @arg00; +a concat(?,b) +1 MySQLone +2 MySQLtwo +3 MySQLthree +4 MySQLfour +select a , concat(b,@arg00) from t1 order by a ; +a concat(b,@arg00) +1 oneMySQL +2 twoMySQL +3 threeMySQL +4 fourMySQL +prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ; +execute stmt1 using @arg00; +a concat(b,?) +1 oneMySQL +2 twoMySQL +3 threeMySQL +4 fourMySQL +set @arg00='MySQL' ; +select group_concat(@arg00,b order by a) from t1 +group by 'a' ; +group_concat(@arg00,b order by a) +MySQLone,MySQLtwo,MySQLthree,MySQLfour +prepare stmt1 from ' select group_concat(?,b order by a) from t1 +group by ''a'' ' ; +execute stmt1 using @arg00; +group_concat(?,b order by a) +MySQLone,MySQLtwo,MySQLthree,MySQLfour +select group_concat(b,@arg00 order by a) from t1 +group by 'a' ; +group_concat(b,@arg00 order by a) +oneMySQL,twoMySQL,threeMySQL,fourMySQL +prepare stmt1 from ' select group_concat(b,? order by a) from t1 +group by ''a'' ' ; +execute stmt1 using @arg00; +group_concat(b,? order by a) +oneMySQL,twoMySQL,threeMySQL,fourMySQL +set @arg00='first' ; +set @arg01='second' ; +set @arg02=NULL; +select @arg00, @arg01 from t1 where a=1 ; +@arg00 @arg01 +first second +prepare stmt1 from ' select ?, ? from t1 where a=1 ' ; +execute stmt1 using @arg00, @arg01 ; +? ? +first second +execute stmt1 using @arg02, @arg01 ; +? ? +NULL second +execute stmt1 using @arg00, @arg02 ; +? ? +first NULL +execute stmt1 using @arg02, @arg02 ; +? ? +NULL NULL +drop table if exists t5 ; +create table t5 (id1 int(11) not null default '0', +value2 varchar(100), value1 varchar(100)) ; +insert into t5 values (1,'hh','hh'),(2,'hh','hh'), +(1,'ii','ii'),(2,'ii','ii') ; +prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ; +set @arg00=1 ; +set @arg01='hh' ; +execute stmt1 using @arg00, @arg01 ; +id1 value1 +1 hh +1 ii +2 hh +drop table t5 ; +drop table if exists t5 ; +create table t5(session_id char(9) not null) ; +insert into t5 values ('abc') ; +prepare stmt1 from ' select * from t5 +where ?=''1111'' and session_id = ''abc'' ' ; +set @arg00='abc' ; +execute stmt1 using @arg00 ; +session_id +set @arg00='1111' ; +execute stmt1 using @arg00 ; +session_id +abc +set @arg00='abc' ; +execute stmt1 using @arg00 ; +session_id +drop table t5 ; +set @arg00='FROM' ; +select a @arg00 t1 where a=1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 t1 where a=1' at line 1 +prepare stmt1 from ' select a ? t1 where a=1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? t1 where a=1' at line 1 +set @arg00='t1' ; +select a from @arg00 where a=1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 where a=1' at line 1 +prepare stmt1 from ' select a from ? where a=1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? where a=1' at line 1 +set @arg00='WHERE' ; +select a from t1 @arg00 a=1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a=1' at line 1 +prepare stmt1 from ' select a from t1 ? a=1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a=1' at line 1 +set @arg00=1 ; +select a FROM t1 where a=@arg00 ; +a +1 +prepare stmt1 from ' select a FROM t1 where a=? ' ; +execute stmt1 using @arg00 ; +a +1 +set @arg00=1000 ; +execute stmt1 using @arg00 ; +a +set @arg00=NULL ; +select a FROM t1 where a=@arg00 ; +a +prepare stmt1 from ' select a FROM t1 where a=? ' ; +execute stmt1 using @arg00 ; +a +set @arg00=4 ; +select a FROM t1 where a=sqrt(@arg00) ; +a +2 +prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ; +execute stmt1 using @arg00 ; +a +2 +set @arg00=NULL ; +select a FROM t1 where a=sqrt(@arg00) ; +a +prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ; +execute stmt1 using @arg00 ; +a +set @arg00=2 ; +set @arg01=3 ; +select a FROM t1 where a in (@arg00,@arg01) order by a; +a +2 +3 +prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a '; +execute stmt1 using @arg00, @arg01; +a +2 +3 +set @arg00= 'one' ; +set @arg01= 'two' ; +set @arg02= 'five' ; +prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ; +execute stmt1 using @arg00, @arg01, @arg02 ; +b +one +two +prepare stmt1 from ' select b FROM t1 where b like ? '; +set @arg00='two' ; +execute stmt1 using @arg00 ; +b +two +set @arg00='tw%' ; +execute stmt1 using @arg00 ; +b +two +set @arg00='%wo' ; +execute stmt1 using @arg00 ; +b +two +set @arg00=null ; +insert into t9 set c1= 0, c5 = NULL ; +select c5 from t9 where c5 > NULL ; +c5 +prepare stmt1 from ' select c5 from t9 where c5 > ? '; +execute stmt1 using @arg00 ; +c5 +select c5 from t9 where c5 < NULL ; +c5 +prepare stmt1 from ' select c5 from t9 where c5 < ? '; +execute stmt1 using @arg00 ; +c5 +select c5 from t9 where c5 = NULL ; +c5 +prepare stmt1 from ' select c5 from t9 where c5 = ? '; +execute stmt1 using @arg00 ; +c5 +select c5 from t9 where c5 <=> NULL ; +c5 +NULL +prepare stmt1 from ' select c5 from t9 where c5 <=> ? '; +execute stmt1 using @arg00 ; +c5 +NULL +delete from t9 where c1= 0 ; +set @arg00='>' ; +select a FROM t1 where a @arg00 1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 1' at line 1 +prepare stmt1 from ' select a FROM t1 where a ? 1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? 1' at line 1 +set @arg00=1 ; +select a,b FROM t1 where a is not NULL +AND b is not NULL group by a - @arg00 ; +a b +1 one +2 two +3 three +4 four +prepare stmt1 from ' select a,b FROM t1 where a is not NULL +AND b is not NULL group by a - ? ' ; +execute stmt1 using @arg00 ; +a b +1 one +2 two +3 three +4 four +set @arg00='two' ; +select a,b FROM t1 where a is not NULL +AND b is not NULL having b <> @arg00 order by a ; +a b +1 one +3 three +4 four +prepare stmt1 from ' select a,b FROM t1 where a is not NULL +AND b is not NULL having b <> ? order by a ' ; +execute stmt1 using @arg00 ; +a b +1 one +3 three +4 four +set @arg00=1 ; +select a,b FROM t1 where a is not NULL +AND b is not NULL order by a - @arg00 ; +a b +1 one +2 two +3 three +4 four +prepare stmt1 from ' select a,b FROM t1 where a is not NULL +AND b is not NULL order by a - ? ' ; +execute stmt1 using @arg00 ; +a b +1 one +2 two +3 three +4 four +set @arg00=2 ; +select a,b from t1 order by 2 ; +a b +4 four +1 one +3 three +2 two +prepare stmt1 from ' select a,b from t1 +order by ? '; +execute stmt1 using @arg00; +a b +4 four +1 one +3 three +2 two +set @arg00=1 ; +execute stmt1 using @arg00; +a b +1 one +2 two +3 three +4 four +set @arg00=0 ; +execute stmt1 using @arg00; +ERROR 42S22: Unknown column '?' in 'order clause' +set @arg00=1; +prepare stmt1 from ' select a,b from t1 order by a +limit 1 '; +execute stmt1 ; +a b +1 one +prepare stmt1 from ' select a,b from t1 +limit ? '; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2 +set @arg00='b' ; +set @arg01=0 ; +set @arg02=2 ; +set @arg03=2 ; +select sum(a), @arg00 from t1 where a > @arg01 +and b is not null group by substr(b,@arg02) +having sum(a) <> @arg03 ; +sum(a) @arg00 +3 b +1 b +4 b +prepare stmt1 from ' select sum(a), ? from t1 where a > ? +and b is not null group by substr(b,?) +having sum(a) <> ? '; +execute stmt1 using @arg00, @arg01, @arg02, @arg03; +sum(a) ? +3 b +1 b +4 b +test_sequence +------ join tests ------ +select first.a as a1, second.a as a2 +from t1 first, t1 second +where first.a = second.a order by a1 ; +a1 a2 +1 1 +2 2 +3 3 +4 4 +prepare stmt1 from ' select first.a as a1, second.a as a2 + from t1 first, t1 second + where first.a = second.a order by a1 '; +execute stmt1 ; +a1 a2 +1 1 +2 2 +3 3 +4 4 +set @arg00='ABC'; +set @arg01='two'; +set @arg02='one'; +select first.a, @arg00, second.a FROM t1 first, t1 second +where @arg01 = first.b or first.a = second.a or second.b = @arg02 +order by second.a, first.a; +a @arg00 a +1 ABC 1 +2 ABC 1 +3 ABC 1 +4 ABC 1 +2 ABC 2 +2 ABC 3 +3 ABC 3 +2 ABC 4 +4 ABC 4 +prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second + where ? = first.b or first.a = second.a or second.b = ? + order by second.a, first.a'; +execute stmt1 using @arg00, @arg01, @arg02; +a ? a +1 ABC 1 +2 ABC 1 +3 ABC 1 +4 ABC 1 +2 ABC 2 +2 ABC 3 +3 ABC 3 +2 ABC 4 +4 ABC 4 +drop table if exists t2 ; +create table t2 as select * from t1 ; +set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ; +set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ; +set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ; +set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ; +set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ; +set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ; +set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ; +set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ; +set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ; +the join statement is: +SELECT * FROM t2 right join t1 using(a) order by t2.a +prepare stmt1 from @query9 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 natural right join t1 order by t2.a +prepare stmt1 from @query8 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a +prepare stmt1 from @query7 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 left join t1 using(a) order by t2.a +prepare stmt1 from @query6 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 natural left join t1 order by t2.a +prepare stmt1 from @query5 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a +prepare stmt1 from @query4 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 join t1 using(a) order by t2.a +prepare stmt1 from @query3 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 natural join t1 order by t2.a +prepare stmt1 from @query2 ; +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +the join statement is: +SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a +prepare stmt1 from @query1 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +drop table t2 ; +test_sequence +------ subquery tests ------ +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = ''two'') '; +execute stmt1 ; +a b +2 two +set @arg00='two' ; +select a, b FROM t1 outer_table where +a = (select a from t1 where b = 'two' ) and b=@arg00 ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = ''two'') and b=? '; +execute stmt1 using @arg00; +a b +2 two +set @arg00='two' ; +select a, b FROM t1 outer_table where +a = (select a from t1 where b = @arg00 ) and b='two' ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = ? ) and b=''two'' ' ; +execute stmt1 using @arg00; +a b +2 two +set @arg00=3 ; +set @arg01='three' ; +select a,b FROM t1 where (a,b) in (select 3, 'three'); +a b +3 three +select a FROM t1 where (a,b) in (select @arg00,@arg01); +a +3 +prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) '; +execute stmt1 using @arg00, @arg01; +a +3 +set @arg00=1 ; +set @arg01='two' ; +set @arg02=2 ; +set @arg03='two' ; +select a, @arg00, b FROM t1 outer_table where +b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ; +a @arg00 b +2 1 two +prepare stmt1 from ' select a, ?, b FROM t1 outer_table where + b=? and a = (select ? from t1 where b = ? ) ' ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; +a ? b +2 1 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = outer_table.b ) order by a '; +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +prepare stmt1 from ' SELECT a as ccc from t1 where a+1= + (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; +execute stmt1 ; +ccc +1 +deallocate prepare stmt1 ; +prepare stmt1 from ' SELECT a as ccc from t1 where a+1= + (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; +execute stmt1 ; +ccc +1 +deallocate prepare stmt1 ; +prepare stmt1 from ' SELECT a as ccc from t1 where a+1= + (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; +execute stmt1 ; +ccc +1 +deallocate prepare stmt1 ; +set @arg00='two' ; +select a, b FROM t1 outer_table where +a = (select a from t1 where b = outer_table.b ) and b=@arg00 ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = outer_table.b) and b=? '; +execute stmt1 using @arg00; +a b +2 two +set @arg00=2 ; +select a, b FROM t1 outer_table where +a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ; +execute stmt1 using @arg00; +a b +2 two +set @arg00=2 ; +select a, b FROM t1 outer_table where +a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ; +execute stmt1 using @arg00; +a b +2 two +set @arg00=1 ; +set @arg01='two' ; +set @arg02=2 ; +set @arg03='two' ; +select a, @arg00, b FROM t1 outer_table where +b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03 +and outer_table.a=a ) ; +a @arg00 b +2 1 two +prepare stmt1 from ' select a, ?, b FROM t1 outer_table where + b=? and a = (select ? from t1 where outer_table.b = ? + and outer_table.a=a ) ' ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; +a ? b +2 1 two +set @arg00=1 ; +set @arg01=0 ; +select a, @arg00 +from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2 +where a=@arg01; +a @arg00 +0 1 +prepare stmt1 from ' select a, ? + from ( select a - ? as a from t1 where a=? ) as t2 + where a=? '; +execute stmt1 using @arg00, @arg00, @arg00, @arg01 ; +a ? +0 1 +drop table if exists t2 ; +create table t2 as select * from t1; +prepare stmt1 from ' select a in (select a from t2) from t1 ' ; +execute stmt1 ; +a in (select a from t2) +1 +1 +1 +1 +drop table if exists t5, t6, t7 ; +create table t5 (a int , b int) ; +create table t6 like t5 ; +create table t7 like t5 ; +insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7), +(2, -1), (3, 10) ; +insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ; +insert into t7 values (3, 3), (2, 2), (1, 1) ; +prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) from t7 ' ; +execute stmt1 ; +a (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) +3 1 +2 2 +1 2 +execute stmt1 ; +a (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) +3 1 +2 2 +1 2 +execute stmt1 ; +a (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) +3 1 +2 2 +1 2 +drop table t5, t6, t7 ; +drop table if exists t2 ; +create table t2 as select * from t9; +set @stmt= ' SELECT + (SELECT SUM(c1 + c12 + 0.0) FROM t2 + where (t9.c2 - 0e-3) = t2.c2 + GROUP BY t9.c15 LIMIT 1) as scalar_s, + exists (select 1.0e+0 from t2 + where t2.c3 * 9.0000000000 = t9.c4) as exists_s, + c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, + (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s +FROM t9, +(select c25 x, c32 y from t2) tt WHERE x = c25 ' ; +prepare stmt1 from @stmt ; +execute stmt1 ; +execute stmt1 ; +set @stmt= concat('explain ',@stmt); +prepare stmt1 from @stmt ; +execute stmt1 ; +execute stmt1 ; +set @stmt= ' SELECT + (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2 + GROUP BY t9.c15 LIMIT 1) as scalar_s, + exists (select ? from t2 + where t2.c3*?=t9.c4) as exists_s, + c5*? in (select c6+? from t2) as in_s, + (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s +FROM t9, +(select c25 x, c32 y from t2) tt WHERE x =c25 ' ; +set @arg00= 0.0 ; +set @arg01= 0e-3 ; +set @arg02= 1.0e+0 ; +set @arg03= 9.0000000000 ; +set @arg04= 4 ; +set @arg05= 0.3e+1 ; +set @arg06= 4 ; +set @arg07= 4 ; +set @arg08= 4.0 ; +set @arg09= 40e-1 ; +prepare stmt1 from @stmt ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +set @stmt= concat('explain ',@stmt); +prepare stmt1 from @stmt ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +drop table t2 ; +select 1 < (select a from t1) ; +ERROR 21000: Subquery returns more than 1 row +prepare stmt1 from ' select 1 < (select a from t1) ' ; +execute stmt1 ; +ERROR 21000: Subquery returns more than 1 row +select 1 as my_col ; +my_col +1 +test_sequence +------ union tests ------ +prepare stmt1 from ' select a FROM t1 where a=1 + union distinct + select a FROM t1 where a=1 '; +execute stmt1 ; +a +1 +execute stmt1 ; +a +1 +prepare stmt1 from ' select a FROM t1 where a=1 + union all + select a FROM t1 where a=1 '; +execute stmt1 ; +a +1 +1 +prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +set @arg00=1 ; +select @arg00 FROM t1 where a=1 +union distinct +select 1 FROM t1 where a=1; +@arg00 +1 +prepare stmt1 from ' select ? FROM t1 where a=1 + union distinct + select 1 FROM t1 where a=1 ' ; +execute stmt1 using @arg00; +? +1 +set @arg00=1 ; +select 1 FROM t1 where a=1 +union distinct +select @arg00 FROM t1 where a=1; +1 +1 +prepare stmt1 from ' select 1 FROM t1 where a=1 + union distinct + select ? FROM t1 where a=1 ' ; +execute stmt1 using @arg00; +1 +1 +set @arg00='a' ; +select @arg00 FROM t1 where a=1 +union distinct +select @arg00 FROM t1 where a=1; +@arg00 +a +prepare stmt1 from ' select ? FROM t1 where a=1 + union distinct + select ? FROM t1 where a=1 '; +execute stmt1 using @arg00, @arg00; +? +a +prepare stmt1 from ' select ? + union distinct + select ? '; +execute stmt1 using @arg00, @arg00; +? +a +set @arg00='a' ; +set @arg01=1 ; +set @arg02='a' ; +set @arg03=2 ; +select @arg00 FROM t1 where a=@arg01 +union distinct +select @arg02 FROM t1 where a=@arg03; +@arg00 +a +prepare stmt1 from ' select ? FROM t1 where a=? + union distinct + select ? FROM t1 where a=? ' ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03; +? +a +set @arg00=1 ; +prepare stmt1 from ' select sum(a) + 200, ? from t1 +union distinct +select sum(a) + 200, 1 from t1 +group by b ' ; +execute stmt1 using @arg00; +sum(a) + 200 ? +210 1 +204 1 +201 1 +203 1 +202 1 +set @Oporto='Oporto' ; +set @Lisboa='Lisboa' ; +set @0=0 ; +set @1=1 ; +set @2=2 ; +set @3=3 ; +set @4=4 ; +select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ; +@Oporto @Lisboa @0 @1 @2 @3 @4 +Oporto Lisboa 0 1 2 3 4 +select sum(a) + 200 as the_sum, @Oporto as the_town from t1 +group by b +union distinct +select sum(a) + 200, @Lisboa from t1 +group by b ; +the_sum the_town +204 Oporto +201 Oporto +203 Oporto +202 Oporto +204 Lisboa +201 Lisboa +203 Lisboa +202 Lisboa +prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 + group by b + union distinct + select sum(a) + 200, ? from t1 + group by b ' ; +execute stmt1 using @Oporto, @Lisboa; +the_sum the_town +204 Oporto +201 Oporto +203 Oporto +202 Oporto +204 Lisboa +201 Lisboa +203 Lisboa +202 Lisboa +select sum(a) + 200 as the_sum, @Oporto as the_town from t1 +where a > @1 +group by b +union distinct +select sum(a) + 200, @Lisboa from t1 +where a > @2 +group by b ; +the_sum the_town +204 Oporto +203 Oporto +202 Oporto +204 Lisboa +203 Lisboa +prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 + where a > ? + group by b + union distinct + select sum(a) + 200, ? from t1 + where a > ? + group by b ' ; +execute stmt1 using @Oporto, @1, @Lisboa, @2; +the_sum the_town +204 Oporto +203 Oporto +202 Oporto +204 Lisboa +203 Lisboa +select sum(a) + 200 as the_sum, @Oporto as the_town from t1 +where a > @1 +group by b +having avg(a) > @2 +union distinct +select sum(a) + 200, @Lisboa from t1 +where a > @2 +group by b +having avg(a) > @3; +the_sum the_town +204 Oporto +203 Oporto +204 Lisboa +prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 + where a > ? + group by b + having avg(a) > ? + union distinct + select sum(a) + 200, ? from t1 + where a > ? + group by b + having avg(a) > ? '; +execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3; +the_sum the_town +204 Oporto +203 Oporto +204 Lisboa +test_sequence +------ explain select tests ------ +prepare stmt1 from ' explain select * from t9 ' ; +execute stmt1; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def id 8 3 1 N 32801 0 8 +def select_type 253 19 6 N 1 31 33 +def table 253 64 2 N 1 31 33 +def type 253 10 3 N 1 31 33 +def possible_keys 253 4096 0 Y 0 31 33 +def key 253 64 0 Y 0 31 33 +def key_len 8 3 0 Y 32800 0 8 +def ref 253 1024 0 Y 0 31 33 +def rows 8 10 1 N 32801 0 8 +def Extra 253 255 0 N 1 31 33 +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t9 ALL NULL NULL NULL NULL 2 +test_sequence +------ delete tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +prepare stmt1 from 'delete from t1 where a=2' ; +execute stmt1; +select a,b from t1 where a=2; +a b +execute stmt1; +insert into t1 values(0,NULL); +set @arg00=NULL; +prepare stmt1 from 'delete from t1 where b=?' ; +execute stmt1 using @arg00; +select a,b from t1 where b is NULL ; +a b +0 NULL +set @arg00='one'; +execute stmt1 using @arg00; +select a,b from t1 where b=@arg00; +a b +prepare stmt1 from 'truncate table t1' ; +ERROR HY000: This command is not supported in the prepared statement protocol yet +test_sequence +------ update tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ; +execute stmt1; +select a,b from t1 where a=2; +a b +2 a=two +execute stmt1; +select a,b from t1 where a=2; +a b +2 a=two +set @arg00=NULL; +prepare stmt1 from 'update t1 set b=? where a=2' ; +execute stmt1 using @arg00; +select a,b from t1 where a=2; +a b +2 NULL +set @arg00='two'; +execute stmt1 using @arg00; +select a,b from t1 where a=2; +a b +2 two +set @arg00=2; +prepare stmt1 from 'update t1 set b=NULL where a=?' ; +execute stmt1 using @arg00; +select a,b from t1 where a=@arg00; +a b +2 NULL +update t1 set b='two' where a=@arg00; +set @arg00=2000; +execute stmt1 using @arg00; +select a,b from t1 where a=@arg00; +a b +set @arg00=2; +set @arg01=22; +prepare stmt1 from 'update t1 set a=? where a=?' ; +execute stmt1 using @arg00, @arg00; +select a,b from t1 where a=@arg00; +a b +2 two +execute stmt1 using @arg01, @arg00; +select a,b from t1 where a=@arg01; +a b +22 two +execute stmt1 using @arg00, @arg01; +select a,b from t1 where a=@arg00; +a b +2 two +set @arg00=NULL; +set @arg01=2; +execute stmt1 using @arg00, @arg01; +Warnings: +Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1 +select a,b from t1 order by a; +a b +0 two +1 one +3 three +4 four +set @arg00=0; +execute stmt1 using @arg01, @arg00; +select a,b from t1 order by a; +a b +1 one +2 two +3 three +4 four +set @arg00=23; +set @arg01='two'; +set @arg02=2; +set @arg03='two'; +set @arg04=2; +drop table if exists t2; +create table t2 as select a,b from t1 ; +prepare stmt1 from 'update t1 set a=? where b=? + and a in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 where a = @arg00 ; +a b +23 two +prepare stmt1 from 'update t1 set a=? where b=? + and a not in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 order by a ; +a b +1 one +2 two +3 three +4 four +drop table t2 ; +create table t2 +( +a int, b varchar(30), +primary key(a) +) engine = 'InnoDB' ; +insert into t2(a,b) select a, b from t1 ; +prepare stmt1 from 'update t1 set a=? where b=? + and a in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 where a = @arg00 ; +a b +23 two +prepare stmt1 from 'update t1 set a=? where b=? + and a not in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 order by a ; +a b +1 one +2 two +3 three +4 four +drop table t2 ; +set @arg00=1; +prepare stmt1 from 'update t1 set b=''bla'' +where a=2 +limit 1'; +execute stmt1 ; +select a,b from t1 where b = 'bla' ; +a b +2 bla +prepare stmt1 from 'update t1 set b=''bla'' +where a=2 +limit ?'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3 +test_sequence +------ insert tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +prepare stmt1 from 'insert into t1 values(5, ''five'' )'; +execute stmt1; +select a,b from t1 where a = 5; +a b +5 five +set @arg00='six' ; +prepare stmt1 from 'insert into t1 values(6, ? )'; +execute stmt1 using @arg00; +select a,b from t1 where b = @arg00; +a b +6 six +execute stmt1 using @arg00; +ERROR 23000: Duplicate entry '6' for key 1 +set @arg00=NULL ; +prepare stmt1 from 'insert into t1 values(0, ? )'; +execute stmt1 using @arg00; +select a,b from t1 where b is NULL; +a b +0 NULL +set @arg00=8 ; +set @arg01='eight' ; +prepare stmt1 from 'insert into t1 values(?, ? )'; +execute stmt1 using @arg00, @arg01 ; +select a,b from t1 where b = @arg01; +a b +8 eight +set @NULL= null ; +set @arg00= 'abc' ; +execute stmt1 using @NULL, @NULL ; +ERROR 23000: Column 'a' cannot be null +execute stmt1 using @NULL, @NULL ; +ERROR 23000: Column 'a' cannot be null +execute stmt1 using @NULL, @arg00 ; +ERROR 23000: Column 'a' cannot be null +execute stmt1 using @NULL, @arg00 ; +ERROR 23000: Column 'a' cannot be null +set @arg01= 10000 + 2 ; +execute stmt1 using @arg01, @arg00 ; +set @arg01= 10000 + 1 ; +execute stmt1 using @arg01, @arg00 ; +select * from t1 where a > 10000 order by a ; +a b +10001 abc +10002 abc +delete from t1 where a > 10000 ; +set @arg01= 10000 + 2 ; +execute stmt1 using @arg01, @NULL ; +set @arg01= 10000 + 1 ; +execute stmt1 using @arg01, @NULL ; +select * from t1 where a > 10000 order by a ; +a b +10001 NULL +10002 NULL +delete from t1 where a > 10000 ; +set @arg01= 10000 + 10 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 9 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 8 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 7 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 6 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 5 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 4 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 3 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 2 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 1 ; +execute stmt1 using @arg01, @arg01 ; +select * from t1 where a > 10000 order by a ; +a b +10001 10001 +10002 10002 +10003 10003 +10004 10004 +10005 10005 +10006 10006 +10007 10007 +10008 10008 +10009 10009 +10010 10010 +delete from t1 where a > 10000 ; +set @arg00=81 ; +set @arg01='8-1' ; +set @arg02=82 ; +set @arg03='8-2' ; +prepare stmt1 from 'insert into t1 values(?,?),(?,?)'; +execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; +select a,b from t1 where a in (@arg00,@arg02) ; +a b +81 8-1 +82 8-2 +set @arg00=9 ; +set @arg01='nine' ; +prepare stmt1 from 'insert into t1 set a=?, b=? '; +execute stmt1 using @arg00, @arg01 ; +select a,b from t1 where a = @arg00 ; +a b +9 nine +set @arg00=6 ; +set @arg01=1 ; +prepare stmt1 from 'insert into t1 set a=?, b=''sechs'' + on duplicate key update a=a + ?, b=concat(b,''modified'') '; +execute stmt1 using @arg00, @arg01; +select * from t1 order by a; +a b +0 NULL +1 one +2 two +3 three +4 four +5 five +7 sixmodified +8 eight +9 nine +81 8-1 +82 8-2 +set @arg00=81 ; +set @arg01=1 ; +execute stmt1 using @arg00, @arg01; +ERROR 23000: Duplicate entry '82' for key 1 +drop table if exists t2 ; +create table t2 (id int auto_increment primary key) +ENGINE= 'InnoDB' ; +prepare stmt1 from ' select last_insert_id() ' ; +insert into t2 values (NULL) ; +execute stmt1 ; +last_insert_id() +1 +insert into t2 values (NULL) ; +execute stmt1 ; +last_insert_id() +2 +drop table t2 ; +set @1000=1000 ; +set @x1000_2="x1000_2" ; +set @x1000_3="x1000_3" ; +set @x1000="x1000" ; +set @1100=1100 ; +set @x1100="x1100" ; +set @100=100 ; +set @updated="updated" ; +insert into t1 values(1000,'x1000_1') ; +insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3) +on duplicate key update a = a + @100, b = concat(b,@updated) ; +select a,b from t1 where a >= 1000 order by a ; +a b +1000 x1000_3 +1100 x1000_1updated +delete from t1 where a >= 1000 ; +insert into t1 values(1000,'x1000_1') ; +prepare stmt1 from ' insert into t1 values(?,?),(?,?) + on duplicate key update a = a + ?, b = concat(b,?) '; +execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ; +select a,b from t1 where a >= 1000 order by a ; +a b +1000 x1000_3 +1100 x1000_1updated +delete from t1 where a >= 1000 ; +insert into t1 values(1000,'x1000_1') ; +execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ; +select a,b from t1 where a >= 1000 order by a ; +a b +1200 x1000_1updatedupdated +delete from t1 where a >= 1000 ; +prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' '; +execute stmt1; +execute stmt1; +execute stmt1; +test_sequence +------ multi table tests ------ +delete from t1 ; +delete from t9 ; +insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ; +insert into t9 (c1,c21) +values (1, 'one'), (2, 'two'), (3, 'three') ; +prepare stmt_delete from " delete t1, t9 + from t1, t9 where t1.a=t9.c1 and t1.b='updated' "; +prepare stmt_update from " update t1, t9 + set t1.b='updated', t9.c21='updated' + where t1.a=t9.c1 and t1.a=? "; +prepare stmt_select1 from " select a, b from t1 order by a" ; +prepare stmt_select2 from " select c1, c21 from t9 order by c1" ; +set @arg00= 1 ; +execute stmt_update using @arg00 ; +execute stmt_delete ; +execute stmt_select1 ; +a b +2 two +3 three +execute stmt_select2 ; +c1 c21 +2 two +3 three +set @arg00= @arg00 + 1 ; +execute stmt_update using @arg00 ; +execute stmt_delete ; +execute stmt_select1 ; +a b +3 three +execute stmt_select2 ; +c1 c21 +3 three +set @arg00= @arg00 + 1 ; +execute stmt_update using @arg00 ; +execute stmt_delete ; +execute stmt_select1 ; +a b +execute stmt_select2 ; +c1 c21 +set @arg00= @arg00 + 1 ; +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +insert into t1 values(0,NULL) ; +set @duplicate='duplicate ' ; +set @1000=1000 ; +set @5=5 ; +select a,b from t1 where a < 5 order by a ; +a b +0 NULL +1 one +2 two +3 three +4 four +insert into t1 select a + @1000, concat(@duplicate,b) from t1 +where a < @5 ; +affected rows: 5 +info: Records: 5 Duplicates: 0 Warnings: 0 +select a,b from t1 where a >= 1000 order by a ; +a b +1000 NULL +1001 duplicate one +1002 duplicate two +1003 duplicate three +1004 duplicate four +delete from t1 where a >= 1000 ; +prepare stmt1 from ' insert into t1 select a + ?, concat(?,b) from t1 +where a < ? ' ; +execute stmt1 using @1000, @duplicate, @5; +affected rows: 5 +info: Records: 5 Duplicates: 0 Warnings: 0 +select a,b from t1 where a >= 1000 order by a ; +a b +1000 NULL +1001 duplicate one +1002 duplicate two +1003 duplicate three +1004 duplicate four +delete from t1 where a >= 1000 ; +set @float=1.00; +set @five='five' ; +drop table if exists t2; +create table t2 like t1 ; +insert into t2 (b,a) +select @duplicate, sum(first.a) from t1 first, t1 second +where first.a <> @5 and second.b = first.b +and second.b <> @five +group by second.b +having sum(second.a) > @2 +union +select b, a + @100 from t1 +where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b +from t1); +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 +select a,b from t2 order by a ; +a b +3 duplicate +4 duplicate +103 three +delete from t2 ; +prepare stmt1 from ' insert into t2 (b,a) +select ?, sum(first.a) + from t1 first, t1 second + where first.a <> ? and second.b = first.b and second.b <> ? + group by second.b + having sum(second.a) > ? +union +select b, a + ? from t1 + where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b + from t1 ) ' ; +execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ; +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 +select a,b from t2 order by a ; +a b +3 duplicate +4 duplicate +103 three +drop table t2; +drop table if exists t5 ; +set @arg01= 8; +set @arg02= 8.0; +set @arg03= 80.00000000000e-1; +set @arg04= 'abc' ; +set @arg05= CAST('abc' as binary) ; +set @arg06= '1991-08-05' ; +set @arg07= CAST('1991-08-05' as date); +set @arg08= '1991-08-05 01:01:01' ; +set @arg09= CAST('1991-08-05 01:01:01' as datetime) ; +set @arg10= unix_timestamp('1991-01-01 01:01:01'); +set @arg11= YEAR('1991-01-01 01:01:01'); +set @arg12= 8 ; +set @arg12= NULL ; +set @arg13= 8.0 ; +set @arg13= NULL ; +set @arg14= 'abc'; +set @arg14= NULL ; +set @arg15= CAST('abc' as binary) ; +set @arg15= NULL ; +create table t5 as select +8 as const01, @arg01 as param01, +8.0 as const02, @arg02 as param02, +80.00000000000e-1 as const03, @arg03 as param03, +'abc' as const04, @arg04 as param04, +CAST('abc' as binary) as const05, @arg05 as param05, +'1991-08-05' as const06, @arg06 as param06, +CAST('1991-08-05' as date) as const07, @arg07 as param07, +'1991-08-05 01:01:01' as const08, @arg08 as param08, +CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09, +unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10, +YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11, +NULL as const12, @arg12 as param12, +@arg13 as param13, +@arg14 as param14, +@arg15 as param15; +show create table t5 ; +Table Create Table +t5 CREATE TABLE `t5` ( + `const01` bigint(1) NOT NULL default '0', + `param01` bigint(20) default NULL, + `const02` double(3,1) NOT NULL default '0.0', + `param02` double default NULL, + `const03` double NOT NULL default '0', + `param03` double default NULL, + `const04` char(3) NOT NULL default '', + `param04` longtext, + `const05` binary(3) NOT NULL default '', + `param05` longblob, + `const06` varchar(10) NOT NULL default '', + `param06` longtext, + `const07` date default NULL, + `param07` longblob, + `const08` varchar(19) NOT NULL default '', + `param08` longtext, + `const09` datetime default NULL, + `param09` longblob, + `const10` int(10) NOT NULL default '0', + `param10` bigint(20) default NULL, + `const11` int(4) default NULL, + `param11` bigint(20) default NULL, + `const12` binary(0) default NULL, + `param12` bigint(20) default NULL, + `param13` double default NULL, + `param14` longtext, + `param15` longblob +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t5 ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def test t5 t5 const01 const01 8 1 1 N 32769 0 63 +def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 +def test t5 t5 const02 const02 5 3 3 N 32769 1 63 +def test t5 t5 param02 param02 5 20 1 Y 32768 31 63 +def test t5 t5 const03 const03 5 23 1 N 32769 31 63 +def test t5 t5 param03 param03 5 20 1 Y 32768 31 63 +def test t5 t5 const04 const04 254 3 3 N 1 0 8 +def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8 +def test t5 t5 const05 const05 254 3 3 N 129 0 63 +def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63 +def test t5 t5 const06 const06 253 10 10 N 1 0 8 +def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8 +def test t5 t5 const07 const07 10 10 10 Y 128 0 63 +def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63 +def test t5 t5 const08 const08 253 19 19 N 1 0 8 +def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8 +def test t5 t5 const09 const09 12 19 19 Y 128 0 63 +def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63 +def test t5 t5 const10 const10 3 10 9 N 32769 0 63 +def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 +def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 +def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 +def test t5 t5 const12 const12 254 0 0 Y 128 0 63 +def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 +def test t5 t5 param13 param13 5 20 0 Y 32768 31 63 +def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8 +def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63 +const01 8 +param01 8 +const02 8.0 +param02 8 +const03 8 +param03 8 +const04 abc +param04 abc +const05 abc +param05 abc +const06 1991-08-05 +param06 1991-08-05 +const07 1991-08-05 +param07 1991-08-05 +const08 1991-08-05 01:01:01 +param08 1991-08-05 01:01:01 +const09 1991-08-05 01:01:01 +param09 1991-08-05 01:01:01 +const10 662680861 +param10 662680861 +const11 1991 +param11 1991 +const12 NULL +param12 NULL +param13 NULL +param14 NULL +param15 NULL +drop table t5 ; +test_sequence +------ data type conversion tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ; +select * from t9 order by c1 ; +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday +test_sequence +------ select @parameter:= column ------ +prepare full_info from "select @arg01, @arg02, @arg03, @arg04, + @arg05, @arg06, @arg07, @arg08, + @arg09, @arg10, @arg11, @arg12, + @arg13, @arg14, @arg15, @arg16, + @arg17, @arg18, @arg19, @arg20, + @arg21, @arg22, @arg23, @arg24, + @arg25, @arg26, @arg27, @arg28, + @arg29, @arg30, @arg31, @arg32" ; +select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, +@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, +@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, +@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, +@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, +@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, +@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, +@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 +from t9 where c1= 1 ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, +@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, +@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, +@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, +@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, +@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, +@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, +@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 +from t9 where c1= 0 ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select + @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, + @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, + @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, + @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, + @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, + @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, + @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, + @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 +from t9 where c1= ?" ; +set @my_key= 1 ; +execute stmt1 using @my_key ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +set @my_key= 0 ; +execute stmt1 using @my_key ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':= c1 from t9 where c1= 1' at line 1 +test_sequence +------ select column, .. into @parm,.. ------ +select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, +c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, +c25, c26, c27, c28, c29, c30, c31, c32 +into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, +@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, +@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, +@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 +from t9 where c1= 1 ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, +c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, +c25, c26, c27, c28, c29, c30, c31, c32 +into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, +@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, +@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, +@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 +from t9 where c1= 0 ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, + c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, + c25, c26, c27, c28, c29, c30, c31, c32 +into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, + @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, + @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, + @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 +from t9 where c1= ?" ; +set @my_key= 1 ; +execute stmt1 using @my_key ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +set @my_key= 0 ; +execute stmt1 using @my_key ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t9 where c1= 1' at line 1 +test_sequence +-- insert into numeric columns -- +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ; +set @arg00= 21 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ; +execute stmt1 ; +set @arg00= 23; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, +30.0, 30.0, 30.0 ) ; +set @arg00= 31.0 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, + 32.0, 32.0, 32.0 )" ; +execute stmt1 ; +set @arg00= 33.0; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( '40', '40', '40', '40', '40', '40', '40', '40', +'40', '40', '40' ) ; +set @arg00= '41' ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( '42', '42', '42', '42', '42', '42', '42', '42', + '42', '42', '42' )" ; +execute stmt1 ; +set @arg00= '43'; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( CAST('50' as binary), CAST('50' as binary), +CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), +CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), +CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ; +set @arg00= CAST('51' as binary) ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( CAST('52' as binary), CAST('52' as binary), + CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), + CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), + CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ; +execute stmt1 ; +set @arg00= CAST('53' as binary) ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 2 ; +set @arg00= NULL ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +NULL, NULL, NULL ) ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 61, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL )" ; +execute stmt1 ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8.0 ; +set @arg00= NULL ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 71, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 'abc' ; +set @arg00= NULL ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 81, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 +from t9 where c1 >= 20 +order by c1 ; +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12 +20 20 20 20 20 20 20 20 20 20 20.0000 +21 21 21 21 21 21 21 21 21 21 21.0000 +22 22 22 22 22 22 22 22 22 22 22.0000 +23 23 23 23 23 23 23 23 23 23 23.0000 +30 30 30 30 30 30 30 30 30 30 30.0000 +31 31 31 31 31 31 31 31 31 31 31.0000 +32 32 32 32 32 32 32 32 32 32 32.0000 +33 33 33 33 33 33 33 33 33 33 33.0000 +40 40 40 40 40 40 40 40 40 40 40.0000 +41 41 41 41 41 41 41 41 41 41 41.0000 +42 42 42 42 42 42 42 42 42 42 42.0000 +43 43 43 43 43 43 43 43 43 43 43.0000 +50 50 50 50 50 50 50 50 50 50 50.0000 +51 51 51 51 51 51 51 51 51 51 51.0000 +52 52 52 52 52 52 52 52 52 52 52.0000 +53 53 53 53 53 53 53 53 53 53 53.0000 +60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +test_sequence +-- select .. where numeric column = .. -- +set @arg00= 20; +select 'true' as found from t9 +where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20 +and c8= 20 and c9= 20 and c10= 20 and c12= 20; +found +true +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20 + and c8= 20 and c9= 20 and c10= 20 and c12= 20 "; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 20.0; +select 'true' as found from t9 +where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0 +and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0; +found +true +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0 + and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 "; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +select 'true' as found from t9 +where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20' + and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20'; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20' + and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' "; +execute stmt1 ; +found +true +set @arg00= '20'; +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +select 'true' as found from t9 +where c1= CAST('20' as binary) and c2= CAST('20' as binary) and +c3= CAST('20' as binary) and c4= CAST('20' as binary) and +c5= CAST('20' as binary) and c6= CAST('20' as binary) and +c7= CAST('20' as binary) and c8= CAST('20' as binary) and +c9= CAST('20' as binary) and c10= CAST('20' as binary) and +c12= CAST('20' as binary); +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= CAST('20' as binary) and c2= CAST('20' as binary) and + c3= CAST('20' as binary) and c4= CAST('20' as binary) and + c5= CAST('20' as binary) and c6= CAST('20' as binary) and + c7= CAST('20' as binary) and c8= CAST('20' as binary) and + c9= CAST('20' as binary) and c10= CAST('20' as binary) and + c12= CAST('20' as binary) "; +execute stmt1 ; +found +true +set @arg00= CAST('20' as binary) ; +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +delete from t9 ; +test_sequence +-- some numeric overflow experiments -- +prepare my_insert from "insert into t9 + ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 +from t9 where c21 = 'O' "; +prepare my_delete from "delete from t9 where c21 = 'O' "; +set @arg00= 9223372036854775807 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 127 +c2 32767 +c3 8388607 +c4 2147483647 +c5 2147483647 +c6 9223372036854775807 +c7 9.22337e+18 +c8 9.22337203685478e+18 +c9 9.22337203685478e+18 +c10 9.22337203685478e+18 +c12 99999.9999 +execute my_delete ; +set @arg00= '9223372036854775807' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 127 +c2 32767 +c3 8388607 +c4 2147483647 +c5 2147483647 +c6 9223372036854775807 +c7 9.22337e+18 +c8 9.22337203685478e+18 +c9 9.22337203685478e+18 +c10 9.22337203685478e+18 +c12 99999.9999 +execute my_delete ; +set @arg00= -9223372036854775808 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -128 +c2 -32768 +c3 -8388608 +c4 -2147483648 +c5 -2147483648 +c6 -9223372036854775808 +c7 -9.22337e+18 +c8 -9.22337203685478e+18 +c9 -9.22337203685478e+18 +c10 -9.22337203685478e+18 +c12 -9999.9999 +execute my_delete ; +set @arg00= '-9223372036854775808' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -128 +c2 -32768 +c3 -8388608 +c4 -2147483648 +c5 -2147483648 +c6 -9223372036854775808 +c7 -9.22337e+18 +c8 -9.22337203685478e+18 +c9 -9.22337203685478e+18 +c10 -9.22337203685478e+18 +c12 -9999.9999 +execute my_delete ; +set @arg00= 1.11111111111111111111e+50 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 127 +c2 32767 +c3 8388607 +c4 2147483647 +c5 2147483647 +c6 9223372036854775807 +c7 3.40282e+38 +c8 1.11111111111111e+50 +c9 1.11111111111111e+50 +c10 1.11111111111111e+50 +c12 99999.9999 +execute my_delete ; +set @arg00= '1.11111111111111111111e+50' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Warning 1265 Data truncated for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1265 Data truncated for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 1 +c2 1 +c3 1 +c4 1 +c5 1 +c6 1 +c7 3.40282e+38 +c8 1.11111111111111e+50 +c9 1.11111111111111e+50 +c10 1.11111111111111e+50 +c12 99999.9999 +execute my_delete ; +set @arg00= -1.11111111111111111111e+50 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -128 +c2 -32768 +c3 -8388608 +c4 -2147483648 +c5 -2147483648 +c6 -9223372036854775808 +c7 -3.40282e+38 +c8 -1.11111111111111e+50 +c9 -1.11111111111111e+50 +c10 -1.11111111111111e+50 +c12 -9999.9999 +execute my_delete ; +set @arg00= '-1.11111111111111111111e+50' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Warning 1265 Data truncated for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1265 Data truncated for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -1 +c2 -1 +c3 -1 +c4 -1 +c5 -1 +c6 -1 +c7 -3.40282e+38 +c8 -1.11111111111111e+50 +c9 -1.11111111111111e+50 +c10 -1.11111111111111e+50 +c12 -9999.9999 +execute my_delete ; +test_sequence +-- insert into string columns -- +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 +from t9 where c1 >= 20 +order by c1 ; +c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 +20 2 20 20 20 20 20 20 20 20 20 20 +21 2 21 21 21 21 21 21 21 21 21 21 +22 2 22 22 22 22 22 22 22 22 22 22 +23 2 23 23 23 23 23 23 23 23 23 23 +30 3 30 30 30 30 30 30 30 30 30 30 +31 3 31 31 31 31 31 31 31 31 31 31 +32 3 32 32 32 32 32 32 32 32 32 32 +33 3 33 33 33 33 33 33 33 33 33 33 +40 4 40 40 40 40 40 40 40 40 40 40 +41 4 41 41 41 41 41 41 41 41 41 41 +42 4 42 42 42 42 42 42 42 42 42 42 +43 4 43 43 43 43 43 43 43 43 43 43 +50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00 +51 5 51 51 51 51 51 51 51 51 51 51 +52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00 +53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00 +54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00 +55 5 55 55 55 55 55 55 55 55 55 55 +56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00 +57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00 +60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +test_sequence +-- select .. where string column = .. -- +set @arg00= '20'; +select 'true' as found from t9 +where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and +c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and +c27= '20' and c28= '20' and c29= '20' and c30= '20' ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and + c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and + c27= '20' and c28= '20' and c29= '20' and c30= '20'" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and + c21= ? and c22= ? and c23= ? and c25= ? and + c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= CAST('20' as binary); +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20))) += CAST('20' as binary) and c21= CAST('20' as binary) +and c22= CAST('20' as binary) and c23= CAST('20' as binary) and +c24= CAST('20' as binary) and c25= CAST('20' as binary) and +c26= CAST('20' as binary) and c27= CAST('20' as binary) and +c28= CAST('20' as binary) and c29= CAST('20' as binary) and +c30= CAST('20' as binary) ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and +c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20))) + = CAST('20' as binary) and c21= CAST('20' as binary) + and c22= CAST('20' as binary) and c23= CAST('20' as binary) and + c24= CAST('20' as binary) and c25= CAST('20' as binary) and + c26= CAST('20' as binary) and c27= CAST('20' as binary) and + c28= CAST('20' as binary) and c29= CAST('20' as binary) and + c30= CAST('20' as binary)" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and + c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and + c29= ? and c30= ?"; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 20; +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and +c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and +c27= 20 and c28= 20 and c29= 20 and c30= 20 ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and + c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and + c27= 20 and c28= 20 and c29= 20 and c30= 20" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and + c21= ? and c22= ? and c23= ? and c25= ? and + c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 20.0; +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and +c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and +c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and + c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and + c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and + c21= ? and c22= ? and c23= ? and c25= ? and + c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +delete from t9 ; +test_sequence +-- insert into date/time columns -- +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; +c1 c13 c14 c15 c16 c17 +20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +60 NULL NULL 1991-01-01 01:01:01 NULL NULL +61 NULL NULL 1991-01-01 01:01:01 NULL NULL +62 NULL NULL 1991-01-01 01:01:01 NULL NULL +63 NULL NULL 1991-01-01 01:01:01 NULL NULL +71 NULL NULL 1991-01-01 01:01:01 NULL NULL +73 NULL NULL 1991-01-01 01:01:01 NULL NULL +81 NULL NULL 1991-01-01 01:01:01 NULL NULL +83 NULL NULL 1991-01-01 01:01:01 NULL NULL +test_sequence +-- select .. where date/time column = .. -- +set @arg00= '1991-01-01 01:01:01' ; +select 'true' as found from t9 +where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and +c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and +c17= '1991-01-01 01:01:01' ; +found +true +select 'true' as found from t9 +where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00 +and c17= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and + c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and + c17= '1991-01-01 01:01:01'" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; +select 'true' as found from t9 +where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and +c14= CAST('1991-01-01 01:01:01' as datetime) and +c15= CAST('1991-01-01 01:01:01' as datetime) and +c16= CAST('1991-01-01 01:01:01' as datetime) and +c17= CAST('1991-01-01 01:01:01' as datetime) ; +found +true +select 'true' as found from t9 +where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00 +and c17= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and + c14= CAST('1991-01-01 01:01:01' as datetime) and + c15= CAST('1991-01-01 01:01:01' as datetime) and + c16= CAST('1991-01-01 01:01:01' as datetime) and + c17= CAST('1991-01-01 01:01:01' as datetime)" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 1991 ; +select 'true' as found from t9 +where c1= 20 and c17= 1991 ; +found +true +select 'true' as found from t9 +where c1= 20 and c17= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c17= 1991" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c17= ?" ; +execute stmt1 using @arg00 ; +found +true +set @arg00= 1.991e+3 ; +select 'true' as found from t9 +where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ; +found +true +select 'true' as found from t9 +where c1= 20 and abs(c17 - @arg00) < 0.01 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and abs(c17 - ?) < 0.01" ; +execute stmt1 using @arg00 ; +found +true +drop table t1, t9; diff --git a/mysql-test/r/ps_4heap.result.es b/mysql-test/r/ps_4heap.result.es new file mode 100644 index 00000000000..fcd9c52b4f9 --- /dev/null +++ b/mysql-test/r/ps_4heap.result.es @@ -0,0 +1,3114 @@ +use test; +drop table if exists t1, t9 ; +create table t1 +( +a int, b varchar(30), +primary key(a) +) engine = 'HEAP' ; +drop table if exists t9; +create table t9 +( +c1 tinyint, c2 smallint, c3 mediumint, c4 int, +c5 integer, c6 bigint, c7 float, c8 double, +c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), +c13 date, c14 datetime, c15 timestamp(14), c16 time, +c17 year, c18 bit, c19 bool, c20 char, +c21 char(10), c22 varchar(30), c23 char(100), c24 char(100), +c25 char(100), c26 char(100), c27 char(100), c28 char(100), +c29 char(100), c30 char(100), c31 enum('one', 'two', 'three'), +c32 set('monday', 'tuesday', 'wednesday'), +primary key(c1) +) engine = 'HEAP' ; +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +test_sequence +------ simple select tests ------ +prepare stmt1 from ' select * from t9 order by c1 ' ; +execute stmt1; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def test t9 t9 c1 c1 1 4 1 N 49155 0 63 +def test t9 t9 c2 c2 2 6 1 Y 32768 0 63 +def test t9 t9 c3 c3 9 9 1 Y 32768 0 63 +def test t9 t9 c4 c4 3 11 1 Y 32768 0 63 +def test t9 t9 c5 c5 3 11 1 Y 32768 0 63 +def test t9 t9 c6 c6 8 20 1 Y 32768 0 63 +def test t9 t9 c7 c7 4 12 1 Y 32768 31 63 +def test t9 t9 c8 c8 5 22 1 Y 32768 31 63 +def test t9 t9 c9 c9 5 22 1 Y 32768 31 63 +def test t9 t9 c10 c10 5 22 1 Y 32768 31 63 +def test t9 t9 c11 c11 0 9 6 Y 32768 4 63 +def test t9 t9 c12 c12 0 10 6 Y 32768 4 63 +def test t9 t9 c13 c13 10 10 10 Y 128 0 63 +def test t9 t9 c14 c14 12 19 19 Y 128 0 63 +def test t9 t9 c15 c15 7 19 19 N 1249 0 63 +def test t9 t9 c16 c16 11 8 8 Y 128 0 63 +def test t9 t9 c17 c17 13 4 4 Y 32864 0 63 +def test t9 t9 c18 c18 1 1 1 Y 32768 0 63 +def test t9 t9 c19 c19 1 1 1 Y 32768 0 63 +def test t9 t9 c20 c20 254 1 1 Y 0 0 8 +def test t9 t9 c21 c21 253 10 10 Y 0 0 8 +def test t9 t9 c22 c22 253 30 30 Y 0 0 8 +def test t9 t9 c23 c23 253 100 8 Y 0 0 8 +def test t9 t9 c24 c24 253 100 8 Y 0 0 8 +def test t9 t9 c25 c25 253 100 4 Y 0 0 8 +def test t9 t9 c26 c26 253 100 4 Y 0 0 8 +def test t9 t9 c27 c27 253 100 10 Y 0 0 8 +def test t9 t9 c28 c28 253 100 10 Y 0 0 8 +def test t9 t9 c29 c29 253 100 8 Y 0 0 8 +def test t9 t9 c30 c30 253 100 8 Y 0 0 8 +def test t9 t9 c31 c31 254 5 3 Y 256 0 8 +def test t9 t9 c32 c32 254 24 7 Y 2048 0 8 +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday +set @arg00='SELECT' ; +prepare stmt1 from ' ? a from t1 where a=1 '; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1 +set @arg00=1 ; +select @arg00, b from t1 where a=1 ; +@arg00 b +1 one +prepare stmt1 from ' select ?, b from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +? b +1 one +set @arg00='lion' ; +select @arg00, b from t1 where a=1 ; +@arg00 b +lion one +prepare stmt1 from ' select ?, b from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +? b +lion one +set @arg00=NULL ; +select @arg00, b from t1 where a=1 ; +@arg00 b +NULL one +prepare stmt1 from ' select ?, b from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +? b +NULL one +set @arg00=1 ; +select b, a - @arg00 from t1 where a=1 ; +b a - @arg00 +one 0 +prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +b a - ? +one 0 +set @arg00=null ; +select @arg00 as my_col ; +my_col +NULL +prepare stmt1 from ' select ? as my_col'; +execute stmt1 using @arg00 ; +my_col +NULL +select @arg00 + 1 as my_col ; +my_col +NULL +prepare stmt1 from ' select ? + 1 as my_col'; +execute stmt1 using @arg00 ; +my_col +NULL +select 1 + @arg00 as my_col ; +my_col +NULL +prepare stmt1 from ' select 1 + ? as my_col'; +execute stmt1 using @arg00 ; +my_col +NULL +set @arg00='MySQL' ; +select substr(@arg00,1,2) from t1 where a=1 ; +substr(@arg00,1,2) +My +prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +substr(?,1,2) +My +set @arg00=3 ; +select substr('MySQL',@arg00,5) from t1 where a=1 ; +substr('MySQL',@arg00,5) +SQL +prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +substr('MySQL',?,5) +SQL +select substr('MySQL',1,@arg00) from t1 where a=1 ; +substr('MySQL',1,@arg00) +MyS +prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +substr('MySQL',1,?) +MyS +set @arg00='MySQL' ; +select a , concat(@arg00,b) from t1 order by a; +a concat(@arg00,b) +1 MySQLone +2 MySQLtwo +3 MySQLthree +4 MySQLfour +prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ; +execute stmt1 using @arg00; +a concat(?,b) +1 MySQLone +2 MySQLtwo +3 MySQLthree +4 MySQLfour +select a , concat(b,@arg00) from t1 order by a ; +a concat(b,@arg00) +1 oneMySQL +2 twoMySQL +3 threeMySQL +4 fourMySQL +prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ; +execute stmt1 using @arg00; +a concat(b,?) +1 oneMySQL +2 twoMySQL +3 threeMySQL +4 fourMySQL +set @arg00='MySQL' ; +select group_concat(@arg00,b order by a) from t1 +group by 'a' ; +group_concat(@arg00,b order by a) +MySQLone,MySQLtwo,MySQLthree,MySQLfour +prepare stmt1 from ' select group_concat(?,b order by a) from t1 +group by ''a'' ' ; +execute stmt1 using @arg00; +group_concat(?,b order by a) +MySQLone,MySQLtwo,MySQLthree,MySQLfour +select group_concat(b,@arg00 order by a) from t1 +group by 'a' ; +group_concat(b,@arg00 order by a) +oneMySQL,twoMySQL,threeMySQL,fourMySQL +prepare stmt1 from ' select group_concat(b,? order by a) from t1 +group by ''a'' ' ; +execute stmt1 using @arg00; +group_concat(b,? order by a) +oneMySQL,twoMySQL,threeMySQL,fourMySQL +set @arg00='first' ; +set @arg01='second' ; +set @arg02=NULL; +select @arg00, @arg01 from t1 where a=1 ; +@arg00 @arg01 +first second +prepare stmt1 from ' select ?, ? from t1 where a=1 ' ; +execute stmt1 using @arg00, @arg01 ; +? ? +first second +execute stmt1 using @arg02, @arg01 ; +? ? +NULL second +execute stmt1 using @arg00, @arg02 ; +? ? +first NULL +execute stmt1 using @arg02, @arg02 ; +? ? +NULL NULL +drop table if exists t5 ; +create table t5 (id1 int(11) not null default '0', +value2 varchar(100), value1 varchar(100)) ; +insert into t5 values (1,'hh','hh'),(2,'hh','hh'), +(1,'ii','ii'),(2,'ii','ii') ; +prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ; +set @arg00=1 ; +set @arg01='hh' ; +execute stmt1 using @arg00, @arg01 ; +id1 value1 +1 hh +1 ii +2 hh +drop table t5 ; +drop table if exists t5 ; +create table t5(session_id char(9) not null) ; +insert into t5 values ('abc') ; +prepare stmt1 from ' select * from t5 +where ?=''1111'' and session_id = ''abc'' ' ; +set @arg00='abc' ; +execute stmt1 using @arg00 ; +session_id +set @arg00='1111' ; +execute stmt1 using @arg00 ; +session_id +abc +set @arg00='abc' ; +execute stmt1 using @arg00 ; +session_id +drop table t5 ; +set @arg00='FROM' ; +select a @arg00 t1 where a=1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 t1 where a=1' at line 1 +prepare stmt1 from ' select a ? t1 where a=1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? t1 where a=1' at line 1 +set @arg00='t1' ; +select a from @arg00 where a=1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 where a=1' at line 1 +prepare stmt1 from ' select a from ? where a=1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? where a=1' at line 1 +set @arg00='WHERE' ; +select a from t1 @arg00 a=1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a=1' at line 1 +prepare stmt1 from ' select a from t1 ? a=1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a=1' at line 1 +set @arg00=1 ; +select a FROM t1 where a=@arg00 ; +a +1 +prepare stmt1 from ' select a FROM t1 where a=? ' ; +execute stmt1 using @arg00 ; +a +1 +set @arg00=1000 ; +execute stmt1 using @arg00 ; +a +set @arg00=NULL ; +select a FROM t1 where a=@arg00 ; +a +prepare stmt1 from ' select a FROM t1 where a=? ' ; +execute stmt1 using @arg00 ; +a +set @arg00=4 ; +select a FROM t1 where a=sqrt(@arg00) ; +a +2 +prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ; +execute stmt1 using @arg00 ; +a +2 +set @arg00=NULL ; +select a FROM t1 where a=sqrt(@arg00) ; +a +prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ; +execute stmt1 using @arg00 ; +a +set @arg00=2 ; +set @arg01=3 ; +select a FROM t1 where a in (@arg00,@arg01) order by a; +a +2 +3 +prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a '; +execute stmt1 using @arg00, @arg01; +a +2 +3 +set @arg00= 'one' ; +set @arg01= 'two' ; +set @arg02= 'five' ; +prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ; +execute stmt1 using @arg00, @arg01, @arg02 ; +b +one +two +prepare stmt1 from ' select b FROM t1 where b like ? '; +set @arg00='two' ; +execute stmt1 using @arg00 ; +b +two +set @arg00='tw%' ; +execute stmt1 using @arg00 ; +b +two +set @arg00='%wo' ; +execute stmt1 using @arg00 ; +b +two +set @arg00=null ; +insert into t9 set c1= 0, c5 = NULL ; +select c5 from t9 where c5 > NULL ; +c5 +prepare stmt1 from ' select c5 from t9 where c5 > ? '; +execute stmt1 using @arg00 ; +c5 +select c5 from t9 where c5 < NULL ; +c5 +prepare stmt1 from ' select c5 from t9 where c5 < ? '; +execute stmt1 using @arg00 ; +c5 +select c5 from t9 where c5 = NULL ; +c5 +prepare stmt1 from ' select c5 from t9 where c5 = ? '; +execute stmt1 using @arg00 ; +c5 +select c5 from t9 where c5 <=> NULL ; +c5 +NULL +prepare stmt1 from ' select c5 from t9 where c5 <=> ? '; +execute stmt1 using @arg00 ; +c5 +NULL +delete from t9 where c1= 0 ; +set @arg00='>' ; +select a FROM t1 where a @arg00 1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 1' at line 1 +prepare stmt1 from ' select a FROM t1 where a ? 1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? 1' at line 1 +set @arg00=1 ; +select a,b FROM t1 where a is not NULL +AND b is not NULL group by a - @arg00 ; +a b +1 one +2 two +3 three +4 four +prepare stmt1 from ' select a,b FROM t1 where a is not NULL +AND b is not NULL group by a - ? ' ; +execute stmt1 using @arg00 ; +a b +1 one +2 two +3 three +4 four +set @arg00='two' ; +select a,b FROM t1 where a is not NULL +AND b is not NULL having b <> @arg00 order by a ; +a b +1 one +3 three +4 four +prepare stmt1 from ' select a,b FROM t1 where a is not NULL +AND b is not NULL having b <> ? order by a ' ; +execute stmt1 using @arg00 ; +a b +1 one +3 three +4 four +set @arg00=1 ; +select a,b FROM t1 where a is not NULL +AND b is not NULL order by a - @arg00 ; +a b +1 one +2 two +3 three +4 four +prepare stmt1 from ' select a,b FROM t1 where a is not NULL +AND b is not NULL order by a - ? ' ; +execute stmt1 using @arg00 ; +a b +1 one +2 two +3 three +4 four +set @arg00=2 ; +select a,b from t1 order by 2 ; +a b +4 four +1 one +3 three +2 two +prepare stmt1 from ' select a,b from t1 +order by ? '; +execute stmt1 using @arg00; +a b +4 four +1 one +3 three +2 two +set @arg00=1 ; +execute stmt1 using @arg00; +a b +1 one +2 two +3 three +4 four +set @arg00=0 ; +execute stmt1 using @arg00; +ERROR 42S22: Unknown column '?' in 'order clause' +set @arg00=1; +prepare stmt1 from ' select a,b from t1 order by a +limit 1 '; +execute stmt1 ; +a b +1 one +prepare stmt1 from ' select a,b from t1 +limit ? '; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2 +set @arg00='b' ; +set @arg01=0 ; +set @arg02=2 ; +set @arg03=2 ; +select sum(a), @arg00 from t1 where a > @arg01 +and b is not null group by substr(b,@arg02) +having sum(a) <> @arg03 ; +sum(a) @arg00 +3 b +1 b +4 b +prepare stmt1 from ' select sum(a), ? from t1 where a > ? +and b is not null group by substr(b,?) +having sum(a) <> ? '; +execute stmt1 using @arg00, @arg01, @arg02, @arg03; +sum(a) ? +3 b +1 b +4 b +test_sequence +------ join tests ------ +select first.a as a1, second.a as a2 +from t1 first, t1 second +where first.a = second.a order by a1 ; +a1 a2 +1 1 +2 2 +3 3 +4 4 +prepare stmt1 from ' select first.a as a1, second.a as a2 + from t1 first, t1 second + where first.a = second.a order by a1 '; +execute stmt1 ; +a1 a2 +1 1 +2 2 +3 3 +4 4 +set @arg00='ABC'; +set @arg01='two'; +set @arg02='one'; +select first.a, @arg00, second.a FROM t1 first, t1 second +where @arg01 = first.b or first.a = second.a or second.b = @arg02 +order by second.a, first.a; +a @arg00 a +1 ABC 1 +2 ABC 1 +3 ABC 1 +4 ABC 1 +2 ABC 2 +2 ABC 3 +3 ABC 3 +2 ABC 4 +4 ABC 4 +prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second + where ? = first.b or first.a = second.a or second.b = ? + order by second.a, first.a'; +execute stmt1 using @arg00, @arg01, @arg02; +a ? a +1 ABC 1 +2 ABC 1 +3 ABC 1 +4 ABC 1 +2 ABC 2 +2 ABC 3 +3 ABC 3 +2 ABC 4 +4 ABC 4 +drop table if exists t2 ; +create table t2 as select * from t1 ; +set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ; +set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ; +set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ; +set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ; +set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ; +set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ; +set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ; +set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ; +set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ; +the join statement is: +SELECT * FROM t2 right join t1 using(a) order by t2.a +prepare stmt1 from @query9 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 natural right join t1 order by t2.a +prepare stmt1 from @query8 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a +prepare stmt1 from @query7 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 left join t1 using(a) order by t2.a +prepare stmt1 from @query6 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 natural left join t1 order by t2.a +prepare stmt1 from @query5 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a +prepare stmt1 from @query4 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 join t1 using(a) order by t2.a +prepare stmt1 from @query3 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 natural join t1 order by t2.a +prepare stmt1 from @query2 ; +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +the join statement is: +SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a +prepare stmt1 from @query1 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +drop table t2 ; +test_sequence +------ subquery tests ------ +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = ''two'') '; +execute stmt1 ; +a b +2 two +set @arg00='two' ; +select a, b FROM t1 outer_table where +a = (select a from t1 where b = 'two' ) and b=@arg00 ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = ''two'') and b=? '; +execute stmt1 using @arg00; +a b +2 two +set @arg00='two' ; +select a, b FROM t1 outer_table where +a = (select a from t1 where b = @arg00 ) and b='two' ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = ? ) and b=''two'' ' ; +execute stmt1 using @arg00; +a b +2 two +set @arg00=3 ; +set @arg01='three' ; +select a,b FROM t1 where (a,b) in (select 3, 'three'); +a b +3 three +select a FROM t1 where (a,b) in (select @arg00,@arg01); +a +3 +prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) '; +execute stmt1 using @arg00, @arg01; +a +3 +set @arg00=1 ; +set @arg01='two' ; +set @arg02=2 ; +set @arg03='two' ; +select a, @arg00, b FROM t1 outer_table where +b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ; +a @arg00 b +2 1 two +prepare stmt1 from ' select a, ?, b FROM t1 outer_table where + b=? and a = (select ? from t1 where b = ? ) ' ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; +a ? b +2 1 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = outer_table.b ) order by a '; +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +prepare stmt1 from ' SELECT a as ccc from t1 where a+1= + (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; +execute stmt1 ; +ccc +1 +deallocate prepare stmt1 ; +prepare stmt1 from ' SELECT a as ccc from t1 where a+1= + (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; +execute stmt1 ; +ccc +1 +deallocate prepare stmt1 ; +prepare stmt1 from ' SELECT a as ccc from t1 where a+1= + (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; +execute stmt1 ; +ccc +1 +deallocate prepare stmt1 ; +set @arg00='two' ; +select a, b FROM t1 outer_table where +a = (select a from t1 where b = outer_table.b ) and b=@arg00 ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = outer_table.b) and b=? '; +execute stmt1 using @arg00; +a b +2 two +set @arg00=2 ; +select a, b FROM t1 outer_table where +a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ; +execute stmt1 using @arg00; +a b +2 two +set @arg00=2 ; +select a, b FROM t1 outer_table where +a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ; +execute stmt1 using @arg00; +a b +2 two +set @arg00=1 ; +set @arg01='two' ; +set @arg02=2 ; +set @arg03='two' ; +select a, @arg00, b FROM t1 outer_table where +b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03 +and outer_table.a=a ) ; +a @arg00 b +2 1 two +prepare stmt1 from ' select a, ?, b FROM t1 outer_table where + b=? and a = (select ? from t1 where outer_table.b = ? + and outer_table.a=a ) ' ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; +a ? b +2 1 two +set @arg00=1 ; +set @arg01=0 ; +select a, @arg00 +from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2 +where a=@arg01; +a @arg00 +0 1 +prepare stmt1 from ' select a, ? + from ( select a - ? as a from t1 where a=? ) as t2 + where a=? '; +execute stmt1 using @arg00, @arg00, @arg00, @arg01 ; +a ? +0 1 +drop table if exists t2 ; +create table t2 as select * from t1; +prepare stmt1 from ' select a in (select a from t2) from t1 ' ; +execute stmt1 ; +a in (select a from t2) +1 +1 +1 +1 +drop table if exists t5, t6, t7 ; +create table t5 (a int , b int) ; +create table t6 like t5 ; +create table t7 like t5 ; +insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7), +(2, -1), (3, 10) ; +insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ; +insert into t7 values (3, 3), (2, 2), (1, 1) ; +prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) from t7 ' ; +execute stmt1 ; +a (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) +3 1 +2 2 +1 2 +execute stmt1 ; +a (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) +3 1 +2 2 +1 2 +execute stmt1 ; +a (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) +3 1 +2 2 +1 2 +drop table t5, t6, t7 ; +drop table if exists t2 ; +create table t2 as select * from t9; +set @stmt= ' SELECT + (SELECT SUM(c1 + c12 + 0.0) FROM t2 + where (t9.c2 - 0e-3) = t2.c2 + GROUP BY t9.c15 LIMIT 1) as scalar_s, + exists (select 1.0e+0 from t2 + where t2.c3 * 9.0000000000 = t9.c4) as exists_s, + c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, + (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s +FROM t9, +(select c25 x, c32 y from t2) tt WHERE x = c25 ' ; +prepare stmt1 from @stmt ; +execute stmt1 ; +execute stmt1 ; +set @stmt= concat('explain ',@stmt); +prepare stmt1 from @stmt ; +execute stmt1 ; +execute stmt1 ; +set @stmt= ' SELECT + (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2 + GROUP BY t9.c15 LIMIT 1) as scalar_s, + exists (select ? from t2 + where t2.c3*?=t9.c4) as exists_s, + c5*? in (select c6+? from t2) as in_s, + (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s +FROM t9, +(select c25 x, c32 y from t2) tt WHERE x =c25 ' ; +set @arg00= 0.0 ; +set @arg01= 0e-3 ; +set @arg02= 1.0e+0 ; +set @arg03= 9.0000000000 ; +set @arg04= 4 ; +set @arg05= 0.3e+1 ; +set @arg06= 4 ; +set @arg07= 4 ; +set @arg08= 4.0 ; +set @arg09= 40e-1 ; +prepare stmt1 from @stmt ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +set @stmt= concat('explain ',@stmt); +prepare stmt1 from @stmt ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +drop table t2 ; +select 1 < (select a from t1) ; +ERROR 21000: Subquery returns more than 1 row +prepare stmt1 from ' select 1 < (select a from t1) ' ; +execute stmt1 ; +ERROR 21000: Subquery returns more than 1 row +select 1 as my_col ; +my_col +1 +test_sequence +------ union tests ------ +prepare stmt1 from ' select a FROM t1 where a=1 + union distinct + select a FROM t1 where a=1 '; +execute stmt1 ; +a +1 +execute stmt1 ; +a +1 +prepare stmt1 from ' select a FROM t1 where a=1 + union all + select a FROM t1 where a=1 '; +execute stmt1 ; +a +1 +1 +prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +set @arg00=1 ; +select @arg00 FROM t1 where a=1 +union distinct +select 1 FROM t1 where a=1; +@arg00 +1 +prepare stmt1 from ' select ? FROM t1 where a=1 + union distinct + select 1 FROM t1 where a=1 ' ; +execute stmt1 using @arg00; +? +1 +set @arg00=1 ; +select 1 FROM t1 where a=1 +union distinct +select @arg00 FROM t1 where a=1; +1 +1 +prepare stmt1 from ' select 1 FROM t1 where a=1 + union distinct + select ? FROM t1 where a=1 ' ; +execute stmt1 using @arg00; +1 +1 +set @arg00='a' ; +select @arg00 FROM t1 where a=1 +union distinct +select @arg00 FROM t1 where a=1; +@arg00 +a +prepare stmt1 from ' select ? FROM t1 where a=1 + union distinct + select ? FROM t1 where a=1 '; +execute stmt1 using @arg00, @arg00; +? +a +prepare stmt1 from ' select ? + union distinct + select ? '; +execute stmt1 using @arg00, @arg00; +? +a +set @arg00='a' ; +set @arg01=1 ; +set @arg02='a' ; +set @arg03=2 ; +select @arg00 FROM t1 where a=@arg01 +union distinct +select @arg02 FROM t1 where a=@arg03; +@arg00 +a +prepare stmt1 from ' select ? FROM t1 where a=? + union distinct + select ? FROM t1 where a=? ' ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03; +? +a +set @arg00=1 ; +prepare stmt1 from ' select sum(a) + 200, ? from t1 +union distinct +select sum(a) + 200, 1 from t1 +group by b ' ; +execute stmt1 using @arg00; +sum(a) + 200 ? +210 1 +204 1 +201 1 +203 1 +202 1 +set @Oporto='Oporto' ; +set @Lisboa='Lisboa' ; +set @0=0 ; +set @1=1 ; +set @2=2 ; +set @3=3 ; +set @4=4 ; +select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ; +@Oporto @Lisboa @0 @1 @2 @3 @4 +Oporto Lisboa 0 1 2 3 4 +select sum(a) + 200 as the_sum, @Oporto as the_town from t1 +group by b +union distinct +select sum(a) + 200, @Lisboa from t1 +group by b ; +the_sum the_town +204 Oporto +201 Oporto +203 Oporto +202 Oporto +204 Lisboa +201 Lisboa +203 Lisboa +202 Lisboa +prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 + group by b + union distinct + select sum(a) + 200, ? from t1 + group by b ' ; +execute stmt1 using @Oporto, @Lisboa; +the_sum the_town +204 Oporto +201 Oporto +203 Oporto +202 Oporto +204 Lisboa +201 Lisboa +203 Lisboa +202 Lisboa +select sum(a) + 200 as the_sum, @Oporto as the_town from t1 +where a > @1 +group by b +union distinct +select sum(a) + 200, @Lisboa from t1 +where a > @2 +group by b ; +the_sum the_town +204 Oporto +203 Oporto +202 Oporto +204 Lisboa +203 Lisboa +prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 + where a > ? + group by b + union distinct + select sum(a) + 200, ? from t1 + where a > ? + group by b ' ; +execute stmt1 using @Oporto, @1, @Lisboa, @2; +the_sum the_town +204 Oporto +203 Oporto +202 Oporto +204 Lisboa +203 Lisboa +select sum(a) + 200 as the_sum, @Oporto as the_town from t1 +where a > @1 +group by b +having avg(a) > @2 +union distinct +select sum(a) + 200, @Lisboa from t1 +where a > @2 +group by b +having avg(a) > @3; +the_sum the_town +204 Oporto +203 Oporto +204 Lisboa +prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 + where a > ? + group by b + having avg(a) > ? + union distinct + select sum(a) + 200, ? from t1 + where a > ? + group by b + having avg(a) > ? '; +execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3; +the_sum the_town +204 Oporto +203 Oporto +204 Lisboa +test_sequence +------ explain select tests ------ +prepare stmt1 from ' explain select * from t9 ' ; +execute stmt1; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def id 8 3 1 N 32801 0 8 +def select_type 253 19 6 N 1 31 33 +def table 253 64 2 N 1 31 33 +def type 253 10 3 N 1 31 33 +def possible_keys 253 4096 0 Y 0 31 33 +def key 253 64 0 Y 0 31 33 +def key_len 8 3 0 Y 32800 0 8 +def ref 253 1024 0 Y 0 31 33 +def rows 8 10 1 N 32801 0 8 +def Extra 253 255 0 N 1 31 33 +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t9 ALL NULL NULL NULL NULL 2 +test_sequence +------ delete tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +prepare stmt1 from 'delete from t1 where a=2' ; +execute stmt1; +select a,b from t1 where a=2; +a b +execute stmt1; +insert into t1 values(0,NULL); +set @arg00=NULL; +prepare stmt1 from 'delete from t1 where b=?' ; +execute stmt1 using @arg00; +select a,b from t1 where b is NULL ; +a b +0 NULL +set @arg00='one'; +execute stmt1 using @arg00; +select a,b from t1 where b=@arg00; +a b +prepare stmt1 from 'truncate table t1' ; +ERROR HY000: This command is not supported in the prepared statement protocol yet +test_sequence +------ update tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ; +execute stmt1; +select a,b from t1 where a=2; +a b +2 a=two +execute stmt1; +select a,b from t1 where a=2; +a b +2 a=two +set @arg00=NULL; +prepare stmt1 from 'update t1 set b=? where a=2' ; +execute stmt1 using @arg00; +select a,b from t1 where a=2; +a b +2 NULL +set @arg00='two'; +execute stmt1 using @arg00; +select a,b from t1 where a=2; +a b +2 two +set @arg00=2; +prepare stmt1 from 'update t1 set b=NULL where a=?' ; +execute stmt1 using @arg00; +select a,b from t1 where a=@arg00; +a b +2 NULL +update t1 set b='two' where a=@arg00; +set @arg00=2000; +execute stmt1 using @arg00; +select a,b from t1 where a=@arg00; +a b +set @arg00=2; +set @arg01=22; +prepare stmt1 from 'update t1 set a=? where a=?' ; +execute stmt1 using @arg00, @arg00; +select a,b from t1 where a=@arg00; +a b +2 two +execute stmt1 using @arg01, @arg00; +select a,b from t1 where a=@arg01; +a b +22 two +execute stmt1 using @arg00, @arg01; +select a,b from t1 where a=@arg00; +a b +2 two +set @arg00=NULL; +set @arg01=2; +execute stmt1 using @arg00, @arg01; +Warnings: +Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1 +select a,b from t1 order by a; +a b +0 two +1 one +3 three +4 four +set @arg00=0; +execute stmt1 using @arg01, @arg00; +select a,b from t1 order by a; +a b +1 one +2 two +3 three +4 four +set @arg00=23; +set @arg01='two'; +set @arg02=2; +set @arg03='two'; +set @arg04=2; +drop table if exists t2; +create table t2 as select a,b from t1 ; +prepare stmt1 from 'update t1 set a=? where b=? + and a in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 where a = @arg00 ; +a b +23 two +prepare stmt1 from 'update t1 set a=? where b=? + and a not in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 order by a ; +a b +1 one +2 two +3 three +4 four +drop table t2 ; +create table t2 +( +a int, b varchar(30), +primary key(a) +) engine = 'HEAP' ; +insert into t2(a,b) select a, b from t1 ; +prepare stmt1 from 'update t1 set a=? where b=? + and a in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 where a = @arg00 ; +a b +23 two +prepare stmt1 from 'update t1 set a=? where b=? + and a not in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 order by a ; +a b +1 one +2 two +3 three +4 four +drop table t2 ; +set @arg00=1; +prepare stmt1 from 'update t1 set b=''bla'' +where a=2 +limit 1'; +execute stmt1 ; +select a,b from t1 where b = 'bla' ; +a b +2 bla +prepare stmt1 from 'update t1 set b=''bla'' +where a=2 +limit ?'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3 +test_sequence +------ insert tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +prepare stmt1 from 'insert into t1 values(5, ''five'' )'; +execute stmt1; +select a,b from t1 where a = 5; +a b +5 five +set @arg00='six' ; +prepare stmt1 from 'insert into t1 values(6, ? )'; +execute stmt1 using @arg00; +select a,b from t1 where b = @arg00; +a b +6 six +execute stmt1 using @arg00; +ERROR 23000: Duplicate entry '6' for key 1 +set @arg00=NULL ; +prepare stmt1 from 'insert into t1 values(0, ? )'; +execute stmt1 using @arg00; +select a,b from t1 where b is NULL; +a b +0 NULL +set @arg00=8 ; +set @arg01='eight' ; +prepare stmt1 from 'insert into t1 values(?, ? )'; +execute stmt1 using @arg00, @arg01 ; +select a,b from t1 where b = @arg01; +a b +8 eight +set @NULL= null ; +set @arg00= 'abc' ; +execute stmt1 using @NULL, @NULL ; +ERROR 23000: Column 'a' cannot be null +execute stmt1 using @NULL, @NULL ; +ERROR 23000: Column 'a' cannot be null +execute stmt1 using @NULL, @arg00 ; +ERROR 23000: Column 'a' cannot be null +execute stmt1 using @NULL, @arg00 ; +ERROR 23000: Column 'a' cannot be null +set @arg01= 10000 + 2 ; +execute stmt1 using @arg01, @arg00 ; +set @arg01= 10000 + 1 ; +execute stmt1 using @arg01, @arg00 ; +select * from t1 where a > 10000 order by a ; +a b +10001 abc +10002 abc +delete from t1 where a > 10000 ; +set @arg01= 10000 + 2 ; +execute stmt1 using @arg01, @NULL ; +set @arg01= 10000 + 1 ; +execute stmt1 using @arg01, @NULL ; +select * from t1 where a > 10000 order by a ; +a b +10001 NULL +10002 NULL +delete from t1 where a > 10000 ; +set @arg01= 10000 + 10 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 9 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 8 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 7 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 6 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 5 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 4 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 3 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 2 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 1 ; +execute stmt1 using @arg01, @arg01 ; +select * from t1 where a > 10000 order by a ; +a b +10001 10001 +10002 10002 +10003 10003 +10004 10004 +10005 10005 +10006 10006 +10007 10007 +10008 10008 +10009 10009 +10010 10010 +delete from t1 where a > 10000 ; +set @arg00=81 ; +set @arg01='8-1' ; +set @arg02=82 ; +set @arg03='8-2' ; +prepare stmt1 from 'insert into t1 values(?,?),(?,?)'; +execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; +select a,b from t1 where a in (@arg00,@arg02) ; +a b +81 8-1 +82 8-2 +set @arg00=9 ; +set @arg01='nine' ; +prepare stmt1 from 'insert into t1 set a=?, b=? '; +execute stmt1 using @arg00, @arg01 ; +select a,b from t1 where a = @arg00 ; +a b +9 nine +set @arg00=6 ; +set @arg01=1 ; +prepare stmt1 from 'insert into t1 set a=?, b=''sechs'' + on duplicate key update a=a + ?, b=concat(b,''modified'') '; +execute stmt1 using @arg00, @arg01; +select * from t1 order by a; +a b +0 NULL +1 one +2 two +3 three +4 four +5 five +7 sixmodified +8 eight +9 nine +81 8-1 +82 8-2 +set @arg00=81 ; +set @arg01=1 ; +execute stmt1 using @arg00, @arg01; +ERROR 23000: Duplicate entry '82' for key 1 +drop table if exists t2 ; +create table t2 (id int auto_increment primary key) +ENGINE= 'HEAP' ; +prepare stmt1 from ' select last_insert_id() ' ; +insert into t2 values (NULL) ; +execute stmt1 ; +last_insert_id() +1 +insert into t2 values (NULL) ; +execute stmt1 ; +last_insert_id() +2 +drop table t2 ; +set @1000=1000 ; +set @x1000_2="x1000_2" ; +set @x1000_3="x1000_3" ; +set @x1000="x1000" ; +set @1100=1100 ; +set @x1100="x1100" ; +set @100=100 ; +set @updated="updated" ; +insert into t1 values(1000,'x1000_1') ; +insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3) +on duplicate key update a = a + @100, b = concat(b,@updated) ; +select a,b from t1 where a >= 1000 order by a ; +a b +1000 x1000_3 +1100 x1000_1updated +delete from t1 where a >= 1000 ; +insert into t1 values(1000,'x1000_1') ; +prepare stmt1 from ' insert into t1 values(?,?),(?,?) + on duplicate key update a = a + ?, b = concat(b,?) '; +execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ; +select a,b from t1 where a >= 1000 order by a ; +a b +1000 x1000_3 +1100 x1000_1updated +delete from t1 where a >= 1000 ; +insert into t1 values(1000,'x1000_1') ; +execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ; +select a,b from t1 where a >= 1000 order by a ; +a b +1200 x1000_1updatedupdated +delete from t1 where a >= 1000 ; +prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' '; +execute stmt1; +execute stmt1; +execute stmt1; +test_sequence +------ multi table tests ------ +delete from t1 ; +delete from t9 ; +insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ; +insert into t9 (c1,c21) +values (1, 'one'), (2, 'two'), (3, 'three') ; +prepare stmt_delete from " delete t1, t9 + from t1, t9 where t1.a=t9.c1 and t1.b='updated' "; +prepare stmt_update from " update t1, t9 + set t1.b='updated', t9.c21='updated' + where t1.a=t9.c1 and t1.a=? "; +prepare stmt_select1 from " select a, b from t1 order by a" ; +prepare stmt_select2 from " select c1, c21 from t9 order by c1" ; +set @arg00= 1 ; +execute stmt_update using @arg00 ; +execute stmt_delete ; +execute stmt_select1 ; +a b +2 two +3 three +execute stmt_select2 ; +c1 c21 +2 two +3 three +set @arg00= @arg00 + 1 ; +execute stmt_update using @arg00 ; +execute stmt_delete ; +execute stmt_select1 ; +a b +3 three +execute stmt_select2 ; +c1 c21 +3 three +set @arg00= @arg00 + 1 ; +execute stmt_update using @arg00 ; +execute stmt_delete ; +execute stmt_select1 ; +a b +execute stmt_select2 ; +c1 c21 +set @arg00= @arg00 + 1 ; +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +insert into t1 values(0,NULL) ; +set @duplicate='duplicate ' ; +set @1000=1000 ; +set @5=5 ; +select a,b from t1 where a < 5 order by a ; +a b +0 NULL +1 one +2 two +3 three +4 four +insert into t1 select a + @1000, concat(@duplicate,b) from t1 +where a < @5 ; +affected rows: 5 +info: Records: 5 Duplicates: 0 Warnings: 0 +select a,b from t1 where a >= 1000 order by a ; +a b +1000 NULL +1001 duplicate one +1002 duplicate two +1003 duplicate three +1004 duplicate four +delete from t1 where a >= 1000 ; +prepare stmt1 from ' insert into t1 select a + ?, concat(?,b) from t1 +where a < ? ' ; +execute stmt1 using @1000, @duplicate, @5; +affected rows: 5 +info: Records: 5 Duplicates: 0 Warnings: 0 +select a,b from t1 where a >= 1000 order by a ; +a b +1000 NULL +1001 duplicate one +1002 duplicate two +1003 duplicate three +1004 duplicate four +delete from t1 where a >= 1000 ; +set @float=1.00; +set @five='five' ; +drop table if exists t2; +create table t2 like t1 ; +insert into t2 (b,a) +select @duplicate, sum(first.a) from t1 first, t1 second +where first.a <> @5 and second.b = first.b +and second.b <> @five +group by second.b +having sum(second.a) > @2 +union +select b, a + @100 from t1 +where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b +from t1); +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 +select a,b from t2 order by a ; +a b +3 duplicate +4 duplicate +103 three +delete from t2 ; +prepare stmt1 from ' insert into t2 (b,a) +select ?, sum(first.a) + from t1 first, t1 second + where first.a <> ? and second.b = first.b and second.b <> ? + group by second.b + having sum(second.a) > ? +union +select b, a + ? from t1 + where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b + from t1 ) ' ; +execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ; +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 +select a,b from t2 order by a ; +a b +3 duplicate +4 duplicate +103 three +drop table t2; +drop table if exists t5 ; +set @arg01= 8; +set @arg02= 8.0; +set @arg03= 80.00000000000e-1; +set @arg04= 'abc' ; +set @arg05= CAST('abc' as binary) ; +set @arg06= '1991-08-05' ; +set @arg07= CAST('1991-08-05' as date); +set @arg08= '1991-08-05 01:01:01' ; +set @arg09= CAST('1991-08-05 01:01:01' as datetime) ; +set @arg10= unix_timestamp('1991-01-01 01:01:01'); +set @arg11= YEAR('1991-01-01 01:01:01'); +set @arg12= 8 ; +set @arg12= NULL ; +set @arg13= 8.0 ; +set @arg13= NULL ; +set @arg14= 'abc'; +set @arg14= NULL ; +set @arg15= CAST('abc' as binary) ; +set @arg15= NULL ; +create table t5 as select +8 as const01, @arg01 as param01, +8.0 as const02, @arg02 as param02, +80.00000000000e-1 as const03, @arg03 as param03, +'abc' as const04, @arg04 as param04, +CAST('abc' as binary) as const05, @arg05 as param05, +'1991-08-05' as const06, @arg06 as param06, +CAST('1991-08-05' as date) as const07, @arg07 as param07, +'1991-08-05 01:01:01' as const08, @arg08 as param08, +CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09, +unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10, +YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11, +NULL as const12, @arg12 as param12, +@arg13 as param13, +@arg14 as param14, +@arg15 as param15; +show create table t5 ; +Table Create Table +t5 CREATE TABLE `t5` ( + `const01` bigint(1) NOT NULL default '0', + `param01` bigint(20) default NULL, + `const02` double(3,1) NOT NULL default '0.0', + `param02` double default NULL, + `const03` double NOT NULL default '0', + `param03` double default NULL, + `const04` char(3) NOT NULL default '', + `param04` longtext, + `const05` binary(3) NOT NULL default '', + `param05` longblob, + `const06` varchar(10) NOT NULL default '', + `param06` longtext, + `const07` date default NULL, + `param07` longblob, + `const08` varchar(19) NOT NULL default '', + `param08` longtext, + `const09` datetime default NULL, + `param09` longblob, + `const10` int(10) NOT NULL default '0', + `param10` bigint(20) default NULL, + `const11` int(4) default NULL, + `param11` bigint(20) default NULL, + `const12` binary(0) default NULL, + `param12` bigint(20) default NULL, + `param13` double default NULL, + `param14` longtext, + `param15` longblob +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t5 ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def test t5 t5 const01 const01 8 1 1 N 32769 0 63 +def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 +def test t5 t5 const02 const02 5 3 3 N 32769 1 63 +def test t5 t5 param02 param02 5 20 1 Y 32768 31 63 +def test t5 t5 const03 const03 5 23 1 N 32769 31 63 +def test t5 t5 param03 param03 5 20 1 Y 32768 31 63 +def test t5 t5 const04 const04 254 3 3 N 1 0 8 +def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8 +def test t5 t5 const05 const05 254 3 3 N 129 0 63 +def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63 +def test t5 t5 const06 const06 253 10 10 N 1 0 8 +def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8 +def test t5 t5 const07 const07 10 10 10 Y 128 0 63 +def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63 +def test t5 t5 const08 const08 253 19 19 N 1 0 8 +def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8 +def test t5 t5 const09 const09 12 19 19 Y 128 0 63 +def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63 +def test t5 t5 const10 const10 3 10 9 N 32769 0 63 +def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 +def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 +def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 +def test t5 t5 const12 const12 254 0 0 Y 128 0 63 +def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 +def test t5 t5 param13 param13 5 20 0 Y 32768 31 63 +def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8 +def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63 +const01 8 +param01 8 +const02 8.0 +param02 8 +const03 8 +param03 8 +const04 abc +param04 abc +const05 abc +param05 abc +const06 1991-08-05 +param06 1991-08-05 +const07 1991-08-05 +param07 1991-08-05 +const08 1991-08-05 01:01:01 +param08 1991-08-05 01:01:01 +const09 1991-08-05 01:01:01 +param09 1991-08-05 01:01:01 +const10 662680861 +param10 662680861 +const11 1991 +param11 1991 +const12 NULL +param12 NULL +param13 NULL +param14 NULL +param15 NULL +drop table t5 ; +test_sequence +------ data type conversion tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ; +select * from t9 order by c1 ; +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday +test_sequence +------ select @parameter:= column ------ +prepare full_info from "select @arg01, @arg02, @arg03, @arg04, + @arg05, @arg06, @arg07, @arg08, + @arg09, @arg10, @arg11, @arg12, + @arg13, @arg14, @arg15, @arg16, + @arg17, @arg18, @arg19, @arg20, + @arg21, @arg22, @arg23, @arg24, + @arg25, @arg26, @arg27, @arg28, + @arg29, @arg30, @arg31, @arg32" ; +select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, +@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, +@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, +@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, +@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, +@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, +@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, +@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 +from t9 where c1= 1 ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 0 31 8 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 0 31 8 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 0 31 8 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 0 31 8 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, +@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, +@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, +@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, +@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, +@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, +@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, +@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 +from t9 where c1= 0 ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 0 31 8 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 0 31 8 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 0 31 8 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 0 31 8 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select + @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, + @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, + @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, + @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, + @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, + @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, + @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, + @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 +from t9 where c1= ?" ; +set @my_key= 1 ; +execute stmt1 using @my_key ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 0 31 8 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 0 31 8 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 0 31 8 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 0 31 8 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +set @my_key= 0 ; +execute stmt1 using @my_key ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 0 31 8 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 0 31 8 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 0 31 8 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 0 31 8 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':= c1 from t9 where c1= 1' at line 1 +test_sequence +------ select column, .. into @parm,.. ------ +select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, +c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, +c25, c26, c27, c28, c29, c30, c31, c32 +into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, +@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, +@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, +@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 +from t9 where c1= 1 ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 0 31 8 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 0 31 8 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 0 31 8 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 0 31 8 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, +c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, +c25, c26, c27, c28, c29, c30, c31, c32 +into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, +@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, +@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, +@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 +from t9 where c1= 0 ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 0 31 8 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 0 31 8 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 0 31 8 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 0 31 8 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, + c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, + c25, c26, c27, c28, c29, c30, c31, c32 +into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, + @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, + @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, + @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 +from t9 where c1= ?" ; +set @my_key= 1 ; +execute stmt1 using @my_key ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 0 31 8 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 0 31 8 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 0 31 8 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 0 31 8 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +set @my_key= 0 ; +execute stmt1 using @my_key ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 0 31 8 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 0 31 8 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 0 31 8 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 0 31 8 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t9 where c1= 1' at line 1 +test_sequence +-- insert into numeric columns -- +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ; +set @arg00= 21 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ; +execute stmt1 ; +set @arg00= 23; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, +30.0, 30.0, 30.0 ) ; +set @arg00= 31.0 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, + 32.0, 32.0, 32.0 )" ; +execute stmt1 ; +set @arg00= 33.0; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( '40', '40', '40', '40', '40', '40', '40', '40', +'40', '40', '40' ) ; +set @arg00= '41' ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( '42', '42', '42', '42', '42', '42', '42', '42', + '42', '42', '42' )" ; +execute stmt1 ; +set @arg00= '43'; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( CAST('50' as binary), CAST('50' as binary), +CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), +CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), +CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ; +set @arg00= CAST('51' as binary) ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( CAST('52' as binary), CAST('52' as binary), + CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), + CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), + CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ; +execute stmt1 ; +set @arg00= CAST('53' as binary) ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 2 ; +set @arg00= NULL ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +NULL, NULL, NULL ) ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 61, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL )" ; +execute stmt1 ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8.0 ; +set @arg00= NULL ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 71, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 'abc' ; +set @arg00= NULL ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 81, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 +from t9 where c1 >= 20 +order by c1 ; +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12 +20 20 20 20 20 20 20 20 20 20 20.0000 +21 21 21 21 21 21 21 21 21 21 21.0000 +22 22 22 22 22 22 22 22 22 22 22.0000 +23 23 23 23 23 23 23 23 23 23 23.0000 +30 30 30 30 30 30 30 30 30 30 30.0000 +31 31 31 31 31 31 31 31 31 31 31.0000 +32 32 32 32 32 32 32 32 32 32 32.0000 +33 33 33 33 33 33 33 33 33 33 33.0000 +40 40 40 40 40 40 40 40 40 40 40.0000 +41 41 41 41 41 41 41 41 41 41 41.0000 +42 42 42 42 42 42 42 42 42 42 42.0000 +43 43 43 43 43 43 43 43 43 43 43.0000 +50 50 50 50 50 50 50 50 50 50 50.0000 +51 51 51 51 51 51 51 51 51 51 51.0000 +52 52 52 52 52 52 52 52 52 52 52.0000 +53 53 53 53 53 53 53 53 53 53 53.0000 +60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +test_sequence +-- select .. where numeric column = .. -- +set @arg00= 20; +select 'true' as found from t9 +where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20 +and c8= 20 and c9= 20 and c10= 20 and c12= 20; +found +true +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20 + and c8= 20 and c9= 20 and c10= 20 and c12= 20 "; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 20.0; +select 'true' as found from t9 +where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0 +and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0; +found +true +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0 + and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 "; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +select 'true' as found from t9 +where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20' + and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20'; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20' + and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' "; +execute stmt1 ; +found +true +set @arg00= '20'; +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +select 'true' as found from t9 +where c1= CAST('20' as binary) and c2= CAST('20' as binary) and +c3= CAST('20' as binary) and c4= CAST('20' as binary) and +c5= CAST('20' as binary) and c6= CAST('20' as binary) and +c7= CAST('20' as binary) and c8= CAST('20' as binary) and +c9= CAST('20' as binary) and c10= CAST('20' as binary) and +c12= CAST('20' as binary); +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= CAST('20' as binary) and c2= CAST('20' as binary) and + c3= CAST('20' as binary) and c4= CAST('20' as binary) and + c5= CAST('20' as binary) and c6= CAST('20' as binary) and + c7= CAST('20' as binary) and c8= CAST('20' as binary) and + c9= CAST('20' as binary) and c10= CAST('20' as binary) and + c12= CAST('20' as binary) "; +execute stmt1 ; +found +true +set @arg00= CAST('20' as binary) ; +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +delete from t9 ; +test_sequence +-- some numeric overflow experiments -- +prepare my_insert from "insert into t9 + ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 +from t9 where c21 = 'O' "; +prepare my_delete from "delete from t9 where c21 = 'O' "; +set @arg00= 9223372036854775807 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 127 +c2 32767 +c3 8388607 +c4 2147483647 +c5 2147483647 +c6 9223372036854775807 +c7 9.22337e+18 +c8 9.22337203685478e+18 +c9 9.22337203685478e+18 +c10 9.22337203685478e+18 +c12 99999.9999 +execute my_delete ; +set @arg00= '9223372036854775807' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 127 +c2 32767 +c3 8388607 +c4 2147483647 +c5 2147483647 +c6 9223372036854775807 +c7 9.22337e+18 +c8 9.22337203685478e+18 +c9 9.22337203685478e+18 +c10 9.22337203685478e+18 +c12 99999.9999 +execute my_delete ; +set @arg00= -9223372036854775808 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -128 +c2 -32768 +c3 -8388608 +c4 -2147483648 +c5 -2147483648 +c6 -9223372036854775808 +c7 -9.22337e+18 +c8 -9.22337203685478e+18 +c9 -9.22337203685478e+18 +c10 -9.22337203685478e+18 +c12 -9999.9999 +execute my_delete ; +set @arg00= '-9223372036854775808' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -128 +c2 -32768 +c3 -8388608 +c4 -2147483648 +c5 -2147483648 +c6 -9223372036854775808 +c7 -9.22337e+18 +c8 -9.22337203685478e+18 +c9 -9.22337203685478e+18 +c10 -9.22337203685478e+18 +c12 -9999.9999 +execute my_delete ; +set @arg00= 1.11111111111111111111e+50 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 127 +c2 32767 +c3 8388607 +c4 2147483647 +c5 2147483647 +c6 9223372036854775807 +c7 3.40282e+38 +c8 1.11111111111111e+50 +c9 1.11111111111111e+50 +c10 1.11111111111111e+50 +c12 99999.9999 +execute my_delete ; +set @arg00= '1.11111111111111111111e+50' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Warning 1265 Data truncated for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1265 Data truncated for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 1 +c2 1 +c3 1 +c4 1 +c5 1 +c6 1 +c7 3.40282e+38 +c8 1.11111111111111e+50 +c9 1.11111111111111e+50 +c10 1.11111111111111e+50 +c12 99999.9999 +execute my_delete ; +set @arg00= -1.11111111111111111111e+50 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -128 +c2 -32768 +c3 -8388608 +c4 -2147483648 +c5 -2147483648 +c6 -9223372036854775808 +c7 -3.40282e+38 +c8 -1.11111111111111e+50 +c9 -1.11111111111111e+50 +c10 -1.11111111111111e+50 +c12 -9999.9999 +execute my_delete ; +set @arg00= '-1.11111111111111111111e+50' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Warning 1265 Data truncated for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1265 Data truncated for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -1 +c2 -1 +c3 -1 +c4 -1 +c5 -1 +c6 -1 +c7 -3.40282e+38 +c8 -1.11111111111111e+50 +c9 -1.11111111111111e+50 +c10 -1.11111111111111e+50 +c12 -9999.9999 +execute my_delete ; +test_sequence +-- insert into string columns -- +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 +from t9 where c1 >= 20 +order by c1 ; +c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 +20 2 20 20 20 20 20 20 20 20 20 20 +21 2 21 21 21 21 21 21 21 21 21 21 +22 2 22 22 22 22 22 22 22 22 22 22 +23 2 23 23 23 23 23 23 23 23 23 23 +30 3 30 30 30 30 30 30 30 30 30 30 +31 3 31 31 31 31 31 31 31 31 31 31 +32 3 32 32 32 32 32 32 32 32 32 32 +33 3 33 33 33 33 33 33 33 33 33 33 +40 4 40 40 40 40 40 40 40 40 40 40 +41 4 41 41 41 41 41 41 41 41 41 41 +42 4 42 42 42 42 42 42 42 42 42 42 +43 4 43 43 43 43 43 43 43 43 43 43 +50 5 50 50 50 50 50 50 50 50 50 50 +51 5 51 51 51 51 51 51 51 51 51 51 +52 5 52 52 52 52 52 52 52 52 52 52 +53 5 53 53 53 53 53 53 53 53 53 53 +54 5 54 54 54 54 54 54 54 54 54 54 +55 5 55 55 55 55 55 55 55 55 55 55 +56 6 56 56 56 56 56 56 56 56 56 56 +57 6 57 57 57 57 57 57 57 57 57 57 +60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +test_sequence +-- select .. where string column = .. -- +set @arg00= '20'; +select 'true' as found from t9 +where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and +c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and +c27= '20' and c28= '20' and c29= '20' and c30= '20' ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and + c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and + c27= '20' and c28= '20' and c29= '20' and c30= '20'" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and + c21= ? and c22= ? and c23= ? and c25= ? and + c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= CAST('20' as binary); +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20))) += CAST('20' as binary) and c21= CAST('20' as binary) +and c22= CAST('20' as binary) and c23= CAST('20' as binary) and +c24= CAST('20' as binary) and c25= CAST('20' as binary) and +c26= CAST('20' as binary) and c27= CAST('20' as binary) and +c28= CAST('20' as binary) and c29= CAST('20' as binary) and +c30= CAST('20' as binary) ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and +c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20))) + = CAST('20' as binary) and c21= CAST('20' as binary) + and c22= CAST('20' as binary) and c23= CAST('20' as binary) and + c24= CAST('20' as binary) and c25= CAST('20' as binary) and + c26= CAST('20' as binary) and c27= CAST('20' as binary) and + c28= CAST('20' as binary) and c29= CAST('20' as binary) and + c30= CAST('20' as binary)" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and + c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and + c29= ? and c30= ?"; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 20; +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and +c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and +c27= 20 and c28= 20 and c29= 20 and c30= 20 ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and + c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and + c27= 20 and c28= 20 and c29= 20 and c30= 20" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and + c21= ? and c22= ? and c23= ? and c25= ? and + c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 20.0; +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and +c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and +c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and + c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and + c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and + c21= ? and c22= ? and c23= ? and c25= ? and + c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +delete from t9 ; +test_sequence +-- insert into date/time columns -- +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; +c1 c13 c14 c15 c16 c17 +20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +60 NULL NULL 1991-01-01 01:01:01 NULL NULL +61 NULL NULL 1991-01-01 01:01:01 NULL NULL +62 NULL NULL 1991-01-01 01:01:01 NULL NULL +63 NULL NULL 1991-01-01 01:01:01 NULL NULL +71 NULL NULL 1991-01-01 01:01:01 NULL NULL +73 NULL NULL 1991-01-01 01:01:01 NULL NULL +81 NULL NULL 1991-01-01 01:01:01 NULL NULL +83 NULL NULL 1991-01-01 01:01:01 NULL NULL +test_sequence +-- select .. where date/time column = .. -- +set @arg00= '1991-01-01 01:01:01' ; +select 'true' as found from t9 +where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and +c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and +c17= '1991-01-01 01:01:01' ; +found +true +select 'true' as found from t9 +where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00 +and c17= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and + c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and + c17= '1991-01-01 01:01:01'" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; +select 'true' as found from t9 +where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and +c14= CAST('1991-01-01 01:01:01' as datetime) and +c15= CAST('1991-01-01 01:01:01' as datetime) and +c16= CAST('1991-01-01 01:01:01' as datetime) and +c17= CAST('1991-01-01 01:01:01' as datetime) ; +found +true +select 'true' as found from t9 +where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00 +and c17= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and + c14= CAST('1991-01-01 01:01:01' as datetime) and + c15= CAST('1991-01-01 01:01:01' as datetime) and + c16= CAST('1991-01-01 01:01:01' as datetime) and + c17= CAST('1991-01-01 01:01:01' as datetime)" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 1991 ; +select 'true' as found from t9 +where c1= 20 and c17= 1991 ; +found +true +select 'true' as found from t9 +where c1= 20 and c17= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c17= 1991" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c17= ?" ; +execute stmt1 using @arg00 ; +found +true +set @arg00= 1.991e+3 ; +select 'true' as found from t9 +where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ; +found +true +select 'true' as found from t9 +where c1= 20 and abs(c17 - @arg00) < 0.01 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and abs(c17 - ?) < 0.01" ; +execute stmt1 using @arg00 ; +found +true +drop table t1, t9; diff --git a/mysql-test/r/ps_5merge.result.es b/mysql-test/r/ps_5merge.result.es new file mode 100644 index 00000000000..4f05be1b4d9 --- /dev/null +++ b/mysql-test/r/ps_5merge.result.es @@ -0,0 +1,6064 @@ +use test; +drop table if exists t1, t1_1, t1_2, +t9, t9_1, t9_2; +drop table if exists t1, t9 ; +create table t1 +( +a int, b varchar(30), +primary key(a) +) engine = 'MYISAM' ; +create table t9 +( +c1 tinyint, c2 smallint, c3 mediumint, c4 int, +c5 integer, c6 bigint, c7 float, c8 double, +c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), +c13 date, c14 datetime, c15 timestamp(14), c16 time, +c17 year, c18 bit, c19 bool, c20 char, +c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, +c25 blob, c26 text, c27 mediumblob, c28 mediumtext, +c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'), +c32 set('monday', 'tuesday', 'wednesday'), +primary key(c1) +) engine = 'MYISAM' ; +rename table t1 to t1_1, t9 to t9_1 ; +drop table if exists t1, t9 ; +create table t1 +( +a int, b varchar(30), +primary key(a) +) engine = 'MYISAM' ; +create table t9 +( +c1 tinyint, c2 smallint, c3 mediumint, c4 int, +c5 integer, c6 bigint, c7 float, c8 double, +c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), +c13 date, c14 datetime, c15 timestamp(14), c16 time, +c17 year, c18 bit, c19 bool, c20 char, +c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, +c25 blob, c26 text, c27 mediumblob, c28 mediumtext, +c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'), +c32 set('monday', 'tuesday', 'wednesday'), +primary key(c1) +) engine = 'MYISAM' ; +rename table t1 to t1_2, t9 to t9_2 ; +create table t1 +( +a int, b varchar(30), +primary key(a) +) ENGINE = MERGE UNION=(t1_1,t1_2) +INSERT_METHOD=FIRST; +create table t9 +( +c1 tinyint, c2 smallint, c3 mediumint, c4 int, +c5 integer, c6 bigint, c7 float, c8 double, +c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), +c13 date, c14 datetime, c15 timestamp(14), c16 time, +c17 year, c18 bit, c19 bool, c20 char, +c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, +c25 blob, c26 text, c27 mediumblob, c28 mediumtext, +c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'), +c32 set('monday', 'tuesday', 'wednesday'), +primary key(c1) +) ENGINE = MERGE UNION=(t9_1,t9_2) +INSERT_METHOD=FIRST; +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +test_sequence +------ simple select tests ------ +prepare stmt1 from ' select * from t9 order by c1 ' ; +execute stmt1; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def test t9 t9 c1 c1 1 4 1 N 49155 0 63 +def test t9 t9 c2 c2 2 6 1 Y 32768 0 63 +def test t9 t9 c3 c3 9 9 1 Y 32768 0 63 +def test t9 t9 c4 c4 3 11 1 Y 32768 0 63 +def test t9 t9 c5 c5 3 11 1 Y 32768 0 63 +def test t9 t9 c6 c6 8 20 1 Y 32768 0 63 +def test t9 t9 c7 c7 4 12 1 Y 32768 31 63 +def test t9 t9 c8 c8 5 22 1 Y 32768 31 63 +def test t9 t9 c9 c9 5 22 1 Y 32768 31 63 +def test t9 t9 c10 c10 5 22 1 Y 32768 31 63 +def test t9 t9 c11 c11 0 9 6 Y 32768 4 63 +def test t9 t9 c12 c12 0 10 6 Y 32768 4 63 +def test t9 t9 c13 c13 10 10 10 Y 128 0 63 +def test t9 t9 c14 c14 12 19 19 Y 128 0 63 +def test t9 t9 c15 c15 7 19 19 N 1249 0 63 +def test t9 t9 c16 c16 11 8 8 Y 128 0 63 +def test t9 t9 c17 c17 13 4 4 Y 32864 0 63 +def test t9 t9 c18 c18 1 1 1 Y 32768 0 63 +def test t9 t9 c19 c19 1 1 1 Y 32768 0 63 +def test t9 t9 c20 c20 254 1 1 Y 0 0 8 +def test t9 t9 c21 c21 253 10 10 Y 0 0 8 +def test t9 t9 c22 c22 253 30 30 Y 0 0 8 +def test t9 t9 c23 c23 252 255 8 Y 144 0 63 +def test t9 t9 c24 c24 252 255 8 Y 16 0 8 +def test t9 t9 c25 c25 252 65535 4 Y 144 0 63 +def test t9 t9 c26 c26 252 65535 4 Y 16 0 8 +def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63 +def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8 +def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63 +def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8 +def test t9 t9 c31 c31 254 5 3 Y 256 0 8 +def test t9 t9 c32 c32 254 24 7 Y 2048 0 8 +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday +set @arg00='SELECT' ; +prepare stmt1 from ' ? a from t1 where a=1 '; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1 +set @arg00=1 ; +select @arg00, b from t1 where a=1 ; +@arg00 b +1 one +prepare stmt1 from ' select ?, b from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +? b +1 one +set @arg00='lion' ; +select @arg00, b from t1 where a=1 ; +@arg00 b +lion one +prepare stmt1 from ' select ?, b from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +? b +lion one +set @arg00=NULL ; +select @arg00, b from t1 where a=1 ; +@arg00 b +NULL one +prepare stmt1 from ' select ?, b from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +? b +NULL one +set @arg00=1 ; +select b, a - @arg00 from t1 where a=1 ; +b a - @arg00 +one 0 +prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +b a - ? +one 0 +set @arg00=null ; +select @arg00 as my_col ; +my_col +NULL +prepare stmt1 from ' select ? as my_col'; +execute stmt1 using @arg00 ; +my_col +NULL +select @arg00 + 1 as my_col ; +my_col +NULL +prepare stmt1 from ' select ? + 1 as my_col'; +execute stmt1 using @arg00 ; +my_col +NULL +select 1 + @arg00 as my_col ; +my_col +NULL +prepare stmt1 from ' select 1 + ? as my_col'; +execute stmt1 using @arg00 ; +my_col +NULL +set @arg00='MySQL' ; +select substr(@arg00,1,2) from t1 where a=1 ; +substr(@arg00,1,2) +My +prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +substr(?,1,2) +My +set @arg00=3 ; +select substr('MySQL',@arg00,5) from t1 where a=1 ; +substr('MySQL',@arg00,5) +SQL +prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +substr('MySQL',?,5) +SQL +select substr('MySQL',1,@arg00) from t1 where a=1 ; +substr('MySQL',1,@arg00) +MyS +prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +substr('MySQL',1,?) +MyS +set @arg00='MySQL' ; +select a , concat(@arg00,b) from t1 order by a; +a concat(@arg00,b) +1 MySQLone +2 MySQLtwo +3 MySQLthree +4 MySQLfour +prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ; +execute stmt1 using @arg00; +a concat(?,b) +1 MySQLone +2 MySQLtwo +3 MySQLthree +4 MySQLfour +select a , concat(b,@arg00) from t1 order by a ; +a concat(b,@arg00) +1 oneMySQL +2 twoMySQL +3 threeMySQL +4 fourMySQL +prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ; +execute stmt1 using @arg00; +a concat(b,?) +1 oneMySQL +2 twoMySQL +3 threeMySQL +4 fourMySQL +set @arg00='MySQL' ; +select group_concat(@arg00,b order by a) from t1 +group by 'a' ; +group_concat(@arg00,b order by a) +MySQLone,MySQLtwo,MySQLthree,MySQLfour +prepare stmt1 from ' select group_concat(?,b order by a) from t1 +group by ''a'' ' ; +execute stmt1 using @arg00; +group_concat(?,b order by a) +MySQLone,MySQLtwo,MySQLthree,MySQLfour +select group_concat(b,@arg00 order by a) from t1 +group by 'a' ; +group_concat(b,@arg00 order by a) +oneMySQL,twoMySQL,threeMySQL,fourMySQL +prepare stmt1 from ' select group_concat(b,? order by a) from t1 +group by ''a'' ' ; +execute stmt1 using @arg00; +group_concat(b,? order by a) +oneMySQL,twoMySQL,threeMySQL,fourMySQL +set @arg00='first' ; +set @arg01='second' ; +set @arg02=NULL; +select @arg00, @arg01 from t1 where a=1 ; +@arg00 @arg01 +first second +prepare stmt1 from ' select ?, ? from t1 where a=1 ' ; +execute stmt1 using @arg00, @arg01 ; +? ? +first second +execute stmt1 using @arg02, @arg01 ; +? ? +NULL second +execute stmt1 using @arg00, @arg02 ; +? ? +first NULL +execute stmt1 using @arg02, @arg02 ; +? ? +NULL NULL +drop table if exists t5 ; +create table t5 (id1 int(11) not null default '0', +value2 varchar(100), value1 varchar(100)) ; +insert into t5 values (1,'hh','hh'),(2,'hh','hh'), +(1,'ii','ii'),(2,'ii','ii') ; +prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ; +set @arg00=1 ; +set @arg01='hh' ; +execute stmt1 using @arg00, @arg01 ; +id1 value1 +1 hh +1 ii +2 hh +drop table t5 ; +drop table if exists t5 ; +create table t5(session_id char(9) not null) ; +insert into t5 values ('abc') ; +prepare stmt1 from ' select * from t5 +where ?=''1111'' and session_id = ''abc'' ' ; +set @arg00='abc' ; +execute stmt1 using @arg00 ; +session_id +set @arg00='1111' ; +execute stmt1 using @arg00 ; +session_id +abc +set @arg00='abc' ; +execute stmt1 using @arg00 ; +session_id +drop table t5 ; +set @arg00='FROM' ; +select a @arg00 t1 where a=1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 t1 where a=1' at line 1 +prepare stmt1 from ' select a ? t1 where a=1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? t1 where a=1' at line 1 +set @arg00='t1' ; +select a from @arg00 where a=1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 where a=1' at line 1 +prepare stmt1 from ' select a from ? where a=1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? where a=1' at line 1 +set @arg00='WHERE' ; +select a from t1 @arg00 a=1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a=1' at line 1 +prepare stmt1 from ' select a from t1 ? a=1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a=1' at line 1 +set @arg00=1 ; +select a FROM t1 where a=@arg00 ; +a +1 +prepare stmt1 from ' select a FROM t1 where a=? ' ; +execute stmt1 using @arg00 ; +a +1 +set @arg00=1000 ; +execute stmt1 using @arg00 ; +a +set @arg00=NULL ; +select a FROM t1 where a=@arg00 ; +a +prepare stmt1 from ' select a FROM t1 where a=? ' ; +execute stmt1 using @arg00 ; +a +set @arg00=4 ; +select a FROM t1 where a=sqrt(@arg00) ; +a +2 +prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ; +execute stmt1 using @arg00 ; +a +2 +set @arg00=NULL ; +select a FROM t1 where a=sqrt(@arg00) ; +a +prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ; +execute stmt1 using @arg00 ; +a +set @arg00=2 ; +set @arg01=3 ; +select a FROM t1 where a in (@arg00,@arg01) order by a; +a +2 +3 +prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a '; +execute stmt1 using @arg00, @arg01; +a +2 +3 +set @arg00= 'one' ; +set @arg01= 'two' ; +set @arg02= 'five' ; +prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ; +execute stmt1 using @arg00, @arg01, @arg02 ; +b +one +two +prepare stmt1 from ' select b FROM t1 where b like ? '; +set @arg00='two' ; +execute stmt1 using @arg00 ; +b +two +set @arg00='tw%' ; +execute stmt1 using @arg00 ; +b +two +set @arg00='%wo' ; +execute stmt1 using @arg00 ; +b +two +set @arg00=null ; +insert into t9 set c1= 0, c5 = NULL ; +select c5 from t9 where c5 > NULL ; +c5 +prepare stmt1 from ' select c5 from t9 where c5 > ? '; +execute stmt1 using @arg00 ; +c5 +select c5 from t9 where c5 < NULL ; +c5 +prepare stmt1 from ' select c5 from t9 where c5 < ? '; +execute stmt1 using @arg00 ; +c5 +select c5 from t9 where c5 = NULL ; +c5 +prepare stmt1 from ' select c5 from t9 where c5 = ? '; +execute stmt1 using @arg00 ; +c5 +select c5 from t9 where c5 <=> NULL ; +c5 +NULL +prepare stmt1 from ' select c5 from t9 where c5 <=> ? '; +execute stmt1 using @arg00 ; +c5 +NULL +delete from t9 where c1= 0 ; +set @arg00='>' ; +select a FROM t1 where a @arg00 1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 1' at line 1 +prepare stmt1 from ' select a FROM t1 where a ? 1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? 1' at line 1 +set @arg00=1 ; +select a,b FROM t1 where a is not NULL +AND b is not NULL group by a - @arg00 ; +a b +1 one +2 two +3 three +4 four +prepare stmt1 from ' select a,b FROM t1 where a is not NULL +AND b is not NULL group by a - ? ' ; +execute stmt1 using @arg00 ; +a b +1 one +2 two +3 three +4 four +set @arg00='two' ; +select a,b FROM t1 where a is not NULL +AND b is not NULL having b <> @arg00 order by a ; +a b +1 one +3 three +4 four +prepare stmt1 from ' select a,b FROM t1 where a is not NULL +AND b is not NULL having b <> ? order by a ' ; +execute stmt1 using @arg00 ; +a b +1 one +3 three +4 four +set @arg00=1 ; +select a,b FROM t1 where a is not NULL +AND b is not NULL order by a - @arg00 ; +a b +1 one +2 two +3 three +4 four +prepare stmt1 from ' select a,b FROM t1 where a is not NULL +AND b is not NULL order by a - ? ' ; +execute stmt1 using @arg00 ; +a b +1 one +2 two +3 three +4 four +set @arg00=2 ; +select a,b from t1 order by 2 ; +a b +4 four +1 one +3 three +2 two +prepare stmt1 from ' select a,b from t1 +order by ? '; +execute stmt1 using @arg00; +a b +4 four +1 one +3 three +2 two +set @arg00=1 ; +execute stmt1 using @arg00; +a b +1 one +2 two +3 three +4 four +set @arg00=0 ; +execute stmt1 using @arg00; +ERROR 42S22: Unknown column '?' in 'order clause' +set @arg00=1; +prepare stmt1 from ' select a,b from t1 order by a +limit 1 '; +execute stmt1 ; +a b +1 one +prepare stmt1 from ' select a,b from t1 +limit ? '; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2 +set @arg00='b' ; +set @arg01=0 ; +set @arg02=2 ; +set @arg03=2 ; +select sum(a), @arg00 from t1 where a > @arg01 +and b is not null group by substr(b,@arg02) +having sum(a) <> @arg03 ; +sum(a) @arg00 +3 b +1 b +4 b +prepare stmt1 from ' select sum(a), ? from t1 where a > ? +and b is not null group by substr(b,?) +having sum(a) <> ? '; +execute stmt1 using @arg00, @arg01, @arg02, @arg03; +sum(a) ? +3 b +1 b +4 b +test_sequence +------ join tests ------ +select first.a as a1, second.a as a2 +from t1 first, t1 second +where first.a = second.a order by a1 ; +a1 a2 +1 1 +2 2 +3 3 +4 4 +prepare stmt1 from ' select first.a as a1, second.a as a2 + from t1 first, t1 second + where first.a = second.a order by a1 '; +execute stmt1 ; +a1 a2 +1 1 +2 2 +3 3 +4 4 +set @arg00='ABC'; +set @arg01='two'; +set @arg02='one'; +select first.a, @arg00, second.a FROM t1 first, t1 second +where @arg01 = first.b or first.a = second.a or second.b = @arg02 +order by second.a, first.a; +a @arg00 a +1 ABC 1 +2 ABC 1 +3 ABC 1 +4 ABC 1 +2 ABC 2 +2 ABC 3 +3 ABC 3 +2 ABC 4 +4 ABC 4 +prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second + where ? = first.b or first.a = second.a or second.b = ? + order by second.a, first.a'; +execute stmt1 using @arg00, @arg01, @arg02; +a ? a +1 ABC 1 +2 ABC 1 +3 ABC 1 +4 ABC 1 +2 ABC 2 +2 ABC 3 +3 ABC 3 +2 ABC 4 +4 ABC 4 +drop table if exists t2 ; +create table t2 as select * from t1 ; +set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ; +set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ; +set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ; +set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ; +set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ; +set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ; +set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ; +set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ; +set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ; +the join statement is: +SELECT * FROM t2 right join t1 using(a) order by t2.a +prepare stmt1 from @query9 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 natural right join t1 order by t2.a +prepare stmt1 from @query8 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a +prepare stmt1 from @query7 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 left join t1 using(a) order by t2.a +prepare stmt1 from @query6 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 natural left join t1 order by t2.a +prepare stmt1 from @query5 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a +prepare stmt1 from @query4 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 join t1 using(a) order by t2.a +prepare stmt1 from @query3 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 natural join t1 order by t2.a +prepare stmt1 from @query2 ; +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +the join statement is: +SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a +prepare stmt1 from @query1 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +drop table t2 ; +test_sequence +------ subquery tests ------ +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = ''two'') '; +execute stmt1 ; +a b +2 two +set @arg00='two' ; +select a, b FROM t1 outer_table where +a = (select a from t1 where b = 'two' ) and b=@arg00 ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = ''two'') and b=? '; +execute stmt1 using @arg00; +a b +2 two +set @arg00='two' ; +select a, b FROM t1 outer_table where +a = (select a from t1 where b = @arg00 ) and b='two' ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = ? ) and b=''two'' ' ; +execute stmt1 using @arg00; +a b +2 two +set @arg00=3 ; +set @arg01='three' ; +select a,b FROM t1 where (a,b) in (select 3, 'three'); +a b +3 three +select a FROM t1 where (a,b) in (select @arg00,@arg01); +a +3 +prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) '; +execute stmt1 using @arg00, @arg01; +a +3 +set @arg00=1 ; +set @arg01='two' ; +set @arg02=2 ; +set @arg03='two' ; +select a, @arg00, b FROM t1 outer_table where +b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ; +a @arg00 b +2 1 two +prepare stmt1 from ' select a, ?, b FROM t1 outer_table where + b=? and a = (select ? from t1 where b = ? ) ' ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; +a ? b +2 1 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = outer_table.b ) order by a '; +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +prepare stmt1 from ' SELECT a as ccc from t1 where a+1= + (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; +execute stmt1 ; +ccc +1 +deallocate prepare stmt1 ; +prepare stmt1 from ' SELECT a as ccc from t1 where a+1= + (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; +execute stmt1 ; +ccc +1 +deallocate prepare stmt1 ; +prepare stmt1 from ' SELECT a as ccc from t1 where a+1= + (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; +execute stmt1 ; +ccc +1 +deallocate prepare stmt1 ; +set @arg00='two' ; +select a, b FROM t1 outer_table where +a = (select a from t1 where b = outer_table.b ) and b=@arg00 ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = outer_table.b) and b=? '; +execute stmt1 using @arg00; +a b +2 two +set @arg00=2 ; +select a, b FROM t1 outer_table where +a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ; +execute stmt1 using @arg00; +a b +2 two +set @arg00=2 ; +select a, b FROM t1 outer_table where +a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ; +execute stmt1 using @arg00; +a b +2 two +set @arg00=1 ; +set @arg01='two' ; +set @arg02=2 ; +set @arg03='two' ; +select a, @arg00, b FROM t1 outer_table where +b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03 +and outer_table.a=a ) ; +a @arg00 b +2 1 two +prepare stmt1 from ' select a, ?, b FROM t1 outer_table where + b=? and a = (select ? from t1 where outer_table.b = ? + and outer_table.a=a ) ' ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; +a ? b +2 1 two +set @arg00=1 ; +set @arg01=0 ; +select a, @arg00 +from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2 +where a=@arg01; +a @arg00 +0 1 +prepare stmt1 from ' select a, ? + from ( select a - ? as a from t1 where a=? ) as t2 + where a=? '; +execute stmt1 using @arg00, @arg00, @arg00, @arg01 ; +a ? +0 1 +drop table if exists t2 ; +create table t2 as select * from t1; +prepare stmt1 from ' select a in (select a from t2) from t1 ' ; +execute stmt1 ; +a in (select a from t2) +1 +1 +1 +1 +drop table if exists t5, t6, t7 ; +create table t5 (a int , b int) ; +create table t6 like t5 ; +create table t7 like t5 ; +insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7), +(2, -1), (3, 10) ; +insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ; +insert into t7 values (3, 3), (2, 2), (1, 1) ; +prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) from t7 ' ; +execute stmt1 ; +a (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) +3 1 +2 2 +1 2 +execute stmt1 ; +a (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) +3 1 +2 2 +1 2 +execute stmt1 ; +a (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) +3 1 +2 2 +1 2 +drop table t5, t6, t7 ; +drop table if exists t2 ; +create table t2 as select * from t9; +set @stmt= ' SELECT + (SELECT SUM(c1 + c12 + 0.0) FROM t2 + where (t9.c2 - 0e-3) = t2.c2 + GROUP BY t9.c15 LIMIT 1) as scalar_s, + exists (select 1.0e+0 from t2 + where t2.c3 * 9.0000000000 = t9.c4) as exists_s, + c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, + (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s +FROM t9, +(select c25 x, c32 y from t2) tt WHERE x = c25 ' ; +prepare stmt1 from @stmt ; +execute stmt1 ; +execute stmt1 ; +set @stmt= concat('explain ',@stmt); +prepare stmt1 from @stmt ; +execute stmt1 ; +execute stmt1 ; +set @stmt= ' SELECT + (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2 + GROUP BY t9.c15 LIMIT 1) as scalar_s, + exists (select ? from t2 + where t2.c3*?=t9.c4) as exists_s, + c5*? in (select c6+? from t2) as in_s, + (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s +FROM t9, +(select c25 x, c32 y from t2) tt WHERE x =c25 ' ; +set @arg00= 0.0 ; +set @arg01= 0e-3 ; +set @arg02= 1.0e+0 ; +set @arg03= 9.0000000000 ; +set @arg04= 4 ; +set @arg05= 0.3e+1 ; +set @arg06= 4 ; +set @arg07= 4 ; +set @arg08= 4.0 ; +set @arg09= 40e-1 ; +prepare stmt1 from @stmt ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +set @stmt= concat('explain ',@stmt); +prepare stmt1 from @stmt ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +drop table t2 ; +select 1 < (select a from t1) ; +ERROR 21000: Subquery returns more than 1 row +prepare stmt1 from ' select 1 < (select a from t1) ' ; +execute stmt1 ; +ERROR 21000: Subquery returns more than 1 row +select 1 as my_col ; +my_col +1 +test_sequence +------ union tests ------ +prepare stmt1 from ' select a FROM t1 where a=1 + union distinct + select a FROM t1 where a=1 '; +execute stmt1 ; +a +1 +execute stmt1 ; +a +1 +prepare stmt1 from ' select a FROM t1 where a=1 + union all + select a FROM t1 where a=1 '; +execute stmt1 ; +a +1 +1 +prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +set @arg00=1 ; +select @arg00 FROM t1 where a=1 +union distinct +select 1 FROM t1 where a=1; +@arg00 +1 +prepare stmt1 from ' select ? FROM t1 where a=1 + union distinct + select 1 FROM t1 where a=1 ' ; +execute stmt1 using @arg00; +? +1 +set @arg00=1 ; +select 1 FROM t1 where a=1 +union distinct +select @arg00 FROM t1 where a=1; +1 +1 +prepare stmt1 from ' select 1 FROM t1 where a=1 + union distinct + select ? FROM t1 where a=1 ' ; +execute stmt1 using @arg00; +1 +1 +set @arg00='a' ; +select @arg00 FROM t1 where a=1 +union distinct +select @arg00 FROM t1 where a=1; +@arg00 +a +prepare stmt1 from ' select ? FROM t1 where a=1 + union distinct + select ? FROM t1 where a=1 '; +execute stmt1 using @arg00, @arg00; +? +a +prepare stmt1 from ' select ? + union distinct + select ? '; +execute stmt1 using @arg00, @arg00; +? +a +set @arg00='a' ; +set @arg01=1 ; +set @arg02='a' ; +set @arg03=2 ; +select @arg00 FROM t1 where a=@arg01 +union distinct +select @arg02 FROM t1 where a=@arg03; +@arg00 +a +prepare stmt1 from ' select ? FROM t1 where a=? + union distinct + select ? FROM t1 where a=? ' ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03; +? +a +set @arg00=1 ; +prepare stmt1 from ' select sum(a) + 200, ? from t1 +union distinct +select sum(a) + 200, 1 from t1 +group by b ' ; +execute stmt1 using @arg00; +sum(a) + 200 ? +210 1 +204 1 +201 1 +203 1 +202 1 +set @Oporto='Oporto' ; +set @Lisboa='Lisboa' ; +set @0=0 ; +set @1=1 ; +set @2=2 ; +set @3=3 ; +set @4=4 ; +select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ; +@Oporto @Lisboa @0 @1 @2 @3 @4 +Oporto Lisboa 0 1 2 3 4 +select sum(a) + 200 as the_sum, @Oporto as the_town from t1 +group by b +union distinct +select sum(a) + 200, @Lisboa from t1 +group by b ; +the_sum the_town +204 Oporto +201 Oporto +203 Oporto +202 Oporto +204 Lisboa +201 Lisboa +203 Lisboa +202 Lisboa +prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 + group by b + union distinct + select sum(a) + 200, ? from t1 + group by b ' ; +execute stmt1 using @Oporto, @Lisboa; +the_sum the_town +204 Oporto +201 Oporto +203 Oporto +202 Oporto +204 Lisboa +201 Lisboa +203 Lisboa +202 Lisboa +select sum(a) + 200 as the_sum, @Oporto as the_town from t1 +where a > @1 +group by b +union distinct +select sum(a) + 200, @Lisboa from t1 +where a > @2 +group by b ; +the_sum the_town +204 Oporto +203 Oporto +202 Oporto +204 Lisboa +203 Lisboa +prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 + where a > ? + group by b + union distinct + select sum(a) + 200, ? from t1 + where a > ? + group by b ' ; +execute stmt1 using @Oporto, @1, @Lisboa, @2; +the_sum the_town +204 Oporto +203 Oporto +202 Oporto +204 Lisboa +203 Lisboa +select sum(a) + 200 as the_sum, @Oporto as the_town from t1 +where a > @1 +group by b +having avg(a) > @2 +union distinct +select sum(a) + 200, @Lisboa from t1 +where a > @2 +group by b +having avg(a) > @3; +the_sum the_town +204 Oporto +203 Oporto +204 Lisboa +prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 + where a > ? + group by b + having avg(a) > ? + union distinct + select sum(a) + 200, ? from t1 + where a > ? + group by b + having avg(a) > ? '; +execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3; +the_sum the_town +204 Oporto +203 Oporto +204 Lisboa +test_sequence +------ explain select tests ------ +prepare stmt1 from ' explain select * from t9 ' ; +execute stmt1; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def id 8 3 1 N 32801 0 8 +def select_type 253 19 6 N 1 31 33 +def table 253 64 2 N 1 31 33 +def type 253 10 3 N 1 31 33 +def possible_keys 253 4096 0 Y 0 31 33 +def key 253 64 0 Y 0 31 33 +def key_len 8 3 0 Y 32800 0 8 +def ref 253 1024 0 Y 0 31 33 +def rows 8 10 1 N 32801 0 8 +def Extra 253 255 0 N 1 31 33 +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t9 ALL NULL NULL NULL NULL 2 +test_sequence +------ delete tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +prepare stmt1 from 'delete from t1 where a=2' ; +execute stmt1; +select a,b from t1 where a=2; +a b +execute stmt1; +insert into t1 values(0,NULL); +set @arg00=NULL; +prepare stmt1 from 'delete from t1 where b=?' ; +execute stmt1 using @arg00; +select a,b from t1 where b is NULL ; +a b +0 NULL +set @arg00='one'; +execute stmt1 using @arg00; +select a,b from t1 where b=@arg00; +a b +prepare stmt1 from 'truncate table t1' ; +ERROR HY000: This command is not supported in the prepared statement protocol yet +test_sequence +------ update tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ; +execute stmt1; +select a,b from t1 where a=2; +a b +2 a=two +execute stmt1; +select a,b from t1 where a=2; +a b +2 a=two +set @arg00=NULL; +prepare stmt1 from 'update t1 set b=? where a=2' ; +execute stmt1 using @arg00; +select a,b from t1 where a=2; +a b +2 NULL +set @arg00='two'; +execute stmt1 using @arg00; +select a,b from t1 where a=2; +a b +2 two +set @arg00=2; +prepare stmt1 from 'update t1 set b=NULL where a=?' ; +execute stmt1 using @arg00; +select a,b from t1 where a=@arg00; +a b +2 NULL +update t1 set b='two' where a=@arg00; +set @arg00=2000; +execute stmt1 using @arg00; +select a,b from t1 where a=@arg00; +a b +set @arg00=2; +set @arg01=22; +prepare stmt1 from 'update t1 set a=? where a=?' ; +execute stmt1 using @arg00, @arg00; +select a,b from t1 where a=@arg00; +a b +2 two +execute stmt1 using @arg01, @arg00; +select a,b from t1 where a=@arg01; +a b +22 two +execute stmt1 using @arg00, @arg01; +select a,b from t1 where a=@arg00; +a b +2 two +set @arg00=NULL; +set @arg01=2; +execute stmt1 using @arg00, @arg01; +Warnings: +Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1 +select a,b from t1 order by a; +a b +0 two +1 one +3 three +4 four +set @arg00=0; +execute stmt1 using @arg01, @arg00; +select a,b from t1 order by a; +a b +1 one +2 two +3 three +4 four +set @arg00=23; +set @arg01='two'; +set @arg02=2; +set @arg03='two'; +set @arg04=2; +drop table if exists t2; +create table t2 as select a,b from t1 ; +prepare stmt1 from 'update t1 set a=? where b=? + and a in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 where a = @arg00 ; +a b +23 two +prepare stmt1 from 'update t1 set a=? where b=? + and a not in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 order by a ; +a b +1 one +2 two +3 three +4 four +drop table t2 ; +create table t2 +( +a int, b varchar(30), +primary key(a) +) engine = 'MYISAM' ; +insert into t2(a,b) select a, b from t1 ; +prepare stmt1 from 'update t1 set a=? where b=? + and a in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 where a = @arg00 ; +a b +23 two +prepare stmt1 from 'update t1 set a=? where b=? + and a not in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 order by a ; +a b +1 one +2 two +3 three +4 four +drop table t2 ; +set @arg00=1; +prepare stmt1 from 'update t1 set b=''bla'' +where a=2 +limit 1'; +execute stmt1 ; +select a,b from t1 where b = 'bla' ; +a b +2 bla +prepare stmt1 from 'update t1 set b=''bla'' +where a=2 +limit ?'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3 +test_sequence +------ insert tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +prepare stmt1 from 'insert into t1 values(5, ''five'' )'; +execute stmt1; +select a,b from t1 where a = 5; +a b +5 five +set @arg00='six' ; +prepare stmt1 from 'insert into t1 values(6, ? )'; +execute stmt1 using @arg00; +select a,b from t1 where b = @arg00; +a b +6 six +execute stmt1 using @arg00; +ERROR 23000: Duplicate entry '6' for key 1 +set @arg00=NULL ; +prepare stmt1 from 'insert into t1 values(0, ? )'; +execute stmt1 using @arg00; +select a,b from t1 where b is NULL; +a b +0 NULL +set @arg00=8 ; +set @arg01='eight' ; +prepare stmt1 from 'insert into t1 values(?, ? )'; +execute stmt1 using @arg00, @arg01 ; +select a,b from t1 where b = @arg01; +a b +8 eight +set @NULL= null ; +set @arg00= 'abc' ; +execute stmt1 using @NULL, @NULL ; +ERROR 23000: Column 'a' cannot be null +execute stmt1 using @NULL, @NULL ; +ERROR 23000: Column 'a' cannot be null +execute stmt1 using @NULL, @arg00 ; +ERROR 23000: Column 'a' cannot be null +execute stmt1 using @NULL, @arg00 ; +ERROR 23000: Column 'a' cannot be null +set @arg01= 10000 + 2 ; +execute stmt1 using @arg01, @arg00 ; +set @arg01= 10000 + 1 ; +execute stmt1 using @arg01, @arg00 ; +select * from t1 where a > 10000 order by a ; +a b +10001 abc +10002 abc +delete from t1 where a > 10000 ; +set @arg01= 10000 + 2 ; +execute stmt1 using @arg01, @NULL ; +set @arg01= 10000 + 1 ; +execute stmt1 using @arg01, @NULL ; +select * from t1 where a > 10000 order by a ; +a b +10001 NULL +10002 NULL +delete from t1 where a > 10000 ; +set @arg01= 10000 + 10 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 9 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 8 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 7 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 6 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 5 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 4 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 3 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 2 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 1 ; +execute stmt1 using @arg01, @arg01 ; +select * from t1 where a > 10000 order by a ; +a b +10001 10001 +10002 10002 +10003 10003 +10004 10004 +10005 10005 +10006 10006 +10007 10007 +10008 10008 +10009 10009 +10010 10010 +delete from t1 where a > 10000 ; +set @arg00=81 ; +set @arg01='8-1' ; +set @arg02=82 ; +set @arg03='8-2' ; +prepare stmt1 from 'insert into t1 values(?,?),(?,?)'; +execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; +select a,b from t1 where a in (@arg00,@arg02) ; +a b +81 8-1 +82 8-2 +set @arg00=9 ; +set @arg01='nine' ; +prepare stmt1 from 'insert into t1 set a=?, b=? '; +execute stmt1 using @arg00, @arg01 ; +select a,b from t1 where a = @arg00 ; +a b +9 nine +set @arg00=6 ; +set @arg01=1 ; +prepare stmt1 from 'insert into t1 set a=?, b=''sechs'' + on duplicate key update a=a + ?, b=concat(b,''modified'') '; +execute stmt1 using @arg00, @arg01; +select * from t1 order by a; +a b +0 NULL +1 one +2 two +3 three +4 four +5 five +7 sixmodified +8 eight +9 nine +81 8-1 +82 8-2 +set @arg00=81 ; +set @arg01=1 ; +execute stmt1 using @arg00, @arg01; +ERROR 23000: Duplicate entry '82' for key 1 +drop table if exists t2 ; +create table t2 (id int auto_increment primary key) +ENGINE= 'MYISAM' ; +prepare stmt1 from ' select last_insert_id() ' ; +insert into t2 values (NULL) ; +execute stmt1 ; +last_insert_id() +1 +insert into t2 values (NULL) ; +execute stmt1 ; +last_insert_id() +2 +drop table t2 ; +set @1000=1000 ; +set @x1000_2="x1000_2" ; +set @x1000_3="x1000_3" ; +set @x1000="x1000" ; +set @1100=1100 ; +set @x1100="x1100" ; +set @100=100 ; +set @updated="updated" ; +insert into t1 values(1000,'x1000_1') ; +insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3) +on duplicate key update a = a + @100, b = concat(b,@updated) ; +select a,b from t1 where a >= 1000 order by a ; +a b +1000 x1000_3 +1100 x1000_1updated +delete from t1 where a >= 1000 ; +insert into t1 values(1000,'x1000_1') ; +prepare stmt1 from ' insert into t1 values(?,?),(?,?) + on duplicate key update a = a + ?, b = concat(b,?) '; +execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ; +select a,b from t1 where a >= 1000 order by a ; +a b +1000 x1000_3 +1100 x1000_1updated +delete from t1 where a >= 1000 ; +insert into t1 values(1000,'x1000_1') ; +execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ; +select a,b from t1 where a >= 1000 order by a ; +a b +1200 x1000_1updatedupdated +delete from t1 where a >= 1000 ; +prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' '; +execute stmt1; +execute stmt1; +execute stmt1; +test_sequence +------ multi table tests ------ +delete from t1 ; +delete from t9 ; +insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ; +insert into t9 (c1,c21) +values (1, 'one'), (2, 'two'), (3, 'three') ; +prepare stmt_delete from " delete t1, t9 + from t1, t9 where t1.a=t9.c1 and t1.b='updated' "; +prepare stmt_update from " update t1, t9 + set t1.b='updated', t9.c21='updated' + where t1.a=t9.c1 and t1.a=? "; +prepare stmt_select1 from " select a, b from t1 order by a" ; +prepare stmt_select2 from " select c1, c21 from t9 order by c1" ; +set @arg00= 1 ; +execute stmt_update using @arg00 ; +execute stmt_delete ; +execute stmt_select1 ; +a b +2 two +3 three +execute stmt_select2 ; +c1 c21 +2 two +3 three +set @arg00= @arg00 + 1 ; +execute stmt_update using @arg00 ; +execute stmt_delete ; +execute stmt_select1 ; +a b +3 three +execute stmt_select2 ; +c1 c21 +3 three +set @arg00= @arg00 + 1 ; +execute stmt_update using @arg00 ; +execute stmt_delete ; +execute stmt_select1 ; +a b +execute stmt_select2 ; +c1 c21 +set @arg00= @arg00 + 1 ; +drop table if exists t5 ; +set @arg01= 8; +set @arg02= 8.0; +set @arg03= 80.00000000000e-1; +set @arg04= 'abc' ; +set @arg05= CAST('abc' as binary) ; +set @arg06= '1991-08-05' ; +set @arg07= CAST('1991-08-05' as date); +set @arg08= '1991-08-05 01:01:01' ; +set @arg09= CAST('1991-08-05 01:01:01' as datetime) ; +set @arg10= unix_timestamp('1991-01-01 01:01:01'); +set @arg11= YEAR('1991-01-01 01:01:01'); +set @arg12= 8 ; +set @arg12= NULL ; +set @arg13= 8.0 ; +set @arg13= NULL ; +set @arg14= 'abc'; +set @arg14= NULL ; +set @arg15= CAST('abc' as binary) ; +set @arg15= NULL ; +create table t5 as select +8 as const01, @arg01 as param01, +8.0 as const02, @arg02 as param02, +80.00000000000e-1 as const03, @arg03 as param03, +'abc' as const04, @arg04 as param04, +CAST('abc' as binary) as const05, @arg05 as param05, +'1991-08-05' as const06, @arg06 as param06, +CAST('1991-08-05' as date) as const07, @arg07 as param07, +'1991-08-05 01:01:01' as const08, @arg08 as param08, +CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09, +unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10, +YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11, +NULL as const12, @arg12 as param12, +@arg13 as param13, +@arg14 as param14, +@arg15 as param15; +show create table t5 ; +Table Create Table +t5 CREATE TABLE `t5` ( + `const01` bigint(1) NOT NULL default '0', + `param01` bigint(20) default NULL, + `const02` double(3,1) NOT NULL default '0.0', + `param02` double default NULL, + `const03` double NOT NULL default '0', + `param03` double default NULL, + `const04` char(3) NOT NULL default '', + `param04` longtext, + `const05` binary(3) NOT NULL default '', + `param05` longblob, + `const06` varchar(10) NOT NULL default '', + `param06` longtext, + `const07` date default NULL, + `param07` longblob, + `const08` varchar(19) NOT NULL default '', + `param08` longtext, + `const09` datetime default NULL, + `param09` longblob, + `const10` int(10) NOT NULL default '0', + `param10` bigint(20) default NULL, + `const11` int(4) default NULL, + `param11` bigint(20) default NULL, + `const12` binary(0) default NULL, + `param12` bigint(20) default NULL, + `param13` double default NULL, + `param14` longtext, + `param15` longblob +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t5 ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def test t5 t5 const01 const01 8 1 1 N 32769 0 63 +def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 +def test t5 t5 const02 const02 5 3 3 N 32769 1 63 +def test t5 t5 param02 param02 5 20 1 Y 32768 31 63 +def test t5 t5 const03 const03 5 23 1 N 32769 31 63 +def test t5 t5 param03 param03 5 20 1 Y 32768 31 63 +def test t5 t5 const04 const04 254 3 3 N 1 0 8 +def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8 +def test t5 t5 const05 const05 254 3 3 N 129 0 63 +def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63 +def test t5 t5 const06 const06 253 10 10 N 1 0 8 +def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8 +def test t5 t5 const07 const07 10 10 10 Y 128 0 63 +def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63 +def test t5 t5 const08 const08 253 19 19 N 1 0 8 +def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8 +def test t5 t5 const09 const09 12 19 19 Y 128 0 63 +def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63 +def test t5 t5 const10 const10 3 10 9 N 32769 0 63 +def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 +def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 +def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 +def test t5 t5 const12 const12 254 0 0 Y 128 0 63 +def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 +def test t5 t5 param13 param13 5 20 0 Y 32768 31 63 +def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8 +def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63 +const01 8 +param01 8 +const02 8.0 +param02 8 +const03 8 +param03 8 +const04 abc +param04 abc +const05 abc +param05 abc +const06 1991-08-05 +param06 1991-08-05 +const07 1991-08-05 +param07 1991-08-05 +const08 1991-08-05 01:01:01 +param08 1991-08-05 01:01:01 +const09 1991-08-05 01:01:01 +param09 1991-08-05 01:01:01 +const10 662680861 +param10 662680861 +const11 1991 +param11 1991 +const12 NULL +param12 NULL +param13 NULL +param14 NULL +param15 NULL +drop table t5 ; +test_sequence +------ data type conversion tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ; +select * from t9 order by c1 ; +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday +test_sequence +------ select @parameter:= column ------ +prepare full_info from "select @arg01, @arg02, @arg03, @arg04, + @arg05, @arg06, @arg07, @arg08, + @arg09, @arg10, @arg11, @arg12, + @arg13, @arg14, @arg15, @arg16, + @arg17, @arg18, @arg19, @arg20, + @arg21, @arg22, @arg23, @arg24, + @arg25, @arg26, @arg27, @arg28, + @arg29, @arg30, @arg31, @arg32" ; +select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, +@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, +@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, +@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, +@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, +@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, +@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, +@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 +from t9 where c1= 1 ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, +@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, +@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, +@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, +@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, +@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, +@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, +@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 +from t9 where c1= 0 ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select + @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, + @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, + @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, + @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, + @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, + @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, + @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, + @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 +from t9 where c1= ?" ; +set @my_key= 1 ; +execute stmt1 using @my_key ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +set @my_key= 0 ; +execute stmt1 using @my_key ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':= c1 from t9 where c1= 1' at line 1 +test_sequence +------ select column, .. into @parm,.. ------ +select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, +c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, +c25, c26, c27, c28, c29, c30, c31, c32 +into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, +@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, +@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, +@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 +from t9 where c1= 1 ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, +c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, +c25, c26, c27, c28, c29, c30, c31, c32 +into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, +@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, +@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, +@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 +from t9 where c1= 0 ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, + c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, + c25, c26, c27, c28, c29, c30, c31, c32 +into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, + @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, + @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, + @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 +from t9 where c1= ?" ; +set @my_key= 1 ; +execute stmt1 using @my_key ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +set @my_key= 0 ; +execute stmt1 using @my_key ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t9 where c1= 1' at line 1 +test_sequence +-- insert into numeric columns -- +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ; +set @arg00= 21 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ; +execute stmt1 ; +set @arg00= 23; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, +30.0, 30.0, 30.0 ) ; +set @arg00= 31.0 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, + 32.0, 32.0, 32.0 )" ; +execute stmt1 ; +set @arg00= 33.0; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( '40', '40', '40', '40', '40', '40', '40', '40', +'40', '40', '40' ) ; +set @arg00= '41' ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( '42', '42', '42', '42', '42', '42', '42', '42', + '42', '42', '42' )" ; +execute stmt1 ; +set @arg00= '43'; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( CAST('50' as binary), CAST('50' as binary), +CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), +CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), +CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ; +set @arg00= CAST('51' as binary) ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( CAST('52' as binary), CAST('52' as binary), + CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), + CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), + CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ; +execute stmt1 ; +set @arg00= CAST('53' as binary) ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 2 ; +set @arg00= NULL ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +NULL, NULL, NULL ) ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 61, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL )" ; +execute stmt1 ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8.0 ; +set @arg00= NULL ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 71, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 'abc' ; +set @arg00= NULL ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 81, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 +from t9 where c1 >= 20 +order by c1 ; +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12 +20 20 20 20 20 20 20 20 20 20 20.0000 +21 21 21 21 21 21 21 21 21 21 21.0000 +22 22 22 22 22 22 22 22 22 22 22.0000 +23 23 23 23 23 23 23 23 23 23 23.0000 +30 30 30 30 30 30 30 30 30 30 30.0000 +31 31 31 31 31 31 31 31 31 31 31.0000 +32 32 32 32 32 32 32 32 32 32 32.0000 +33 33 33 33 33 33 33 33 33 33 33.0000 +40 40 40 40 40 40 40 40 40 40 40.0000 +41 41 41 41 41 41 41 41 41 41 41.0000 +42 42 42 42 42 42 42 42 42 42 42.0000 +43 43 43 43 43 43 43 43 43 43 43.0000 +50 50 50 50 50 50 50 50 50 50 50.0000 +51 51 51 51 51 51 51 51 51 51 51.0000 +52 52 52 52 52 52 52 52 52 52 52.0000 +53 53 53 53 53 53 53 53 53 53 53.0000 +60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +test_sequence +-- select .. where numeric column = .. -- +set @arg00= 20; +select 'true' as found from t9 +where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20 +and c8= 20 and c9= 20 and c10= 20 and c12= 20; +found +true +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20 + and c8= 20 and c9= 20 and c10= 20 and c12= 20 "; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 20.0; +select 'true' as found from t9 +where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0 +and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0; +found +true +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0 + and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 "; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +select 'true' as found from t9 +where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20' + and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20'; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20' + and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' "; +execute stmt1 ; +found +true +set @arg00= '20'; +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +select 'true' as found from t9 +where c1= CAST('20' as binary) and c2= CAST('20' as binary) and +c3= CAST('20' as binary) and c4= CAST('20' as binary) and +c5= CAST('20' as binary) and c6= CAST('20' as binary) and +c7= CAST('20' as binary) and c8= CAST('20' as binary) and +c9= CAST('20' as binary) and c10= CAST('20' as binary) and +c12= CAST('20' as binary); +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= CAST('20' as binary) and c2= CAST('20' as binary) and + c3= CAST('20' as binary) and c4= CAST('20' as binary) and + c5= CAST('20' as binary) and c6= CAST('20' as binary) and + c7= CAST('20' as binary) and c8= CAST('20' as binary) and + c9= CAST('20' as binary) and c10= CAST('20' as binary) and + c12= CAST('20' as binary) "; +execute stmt1 ; +found +true +set @arg00= CAST('20' as binary) ; +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +delete from t9 ; +test_sequence +-- some numeric overflow experiments -- +prepare my_insert from "insert into t9 + ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 +from t9 where c21 = 'O' "; +prepare my_delete from "delete from t9 where c21 = 'O' "; +set @arg00= 9223372036854775807 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 127 +c2 32767 +c3 8388607 +c4 2147483647 +c5 2147483647 +c6 9223372036854775807 +c7 9.22337e+18 +c8 9.22337203685478e+18 +c9 9.22337203685478e+18 +c10 9.22337203685478e+18 +c12 99999.9999 +execute my_delete ; +set @arg00= '9223372036854775807' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 127 +c2 32767 +c3 8388607 +c4 2147483647 +c5 2147483647 +c6 9223372036854775807 +c7 9.22337e+18 +c8 9.22337203685478e+18 +c9 9.22337203685478e+18 +c10 9.22337203685478e+18 +c12 99999.9999 +execute my_delete ; +set @arg00= -9223372036854775808 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -128 +c2 -32768 +c3 -8388608 +c4 -2147483648 +c5 -2147483648 +c6 -9223372036854775808 +c7 -9.22337e+18 +c8 -9.22337203685478e+18 +c9 -9.22337203685478e+18 +c10 -9.22337203685478e+18 +c12 -9999.9999 +execute my_delete ; +set @arg00= '-9223372036854775808' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -128 +c2 -32768 +c3 -8388608 +c4 -2147483648 +c5 -2147483648 +c6 -9223372036854775808 +c7 -9.22337e+18 +c8 -9.22337203685478e+18 +c9 -9.22337203685478e+18 +c10 -9.22337203685478e+18 +c12 -9999.9999 +execute my_delete ; +set @arg00= 1.11111111111111111111e+50 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 127 +c2 32767 +c3 8388607 +c4 2147483647 +c5 2147483647 +c6 9223372036854775807 +c7 3.40282e+38 +c8 1.11111111111111e+50 +c9 1.11111111111111e+50 +c10 1.11111111111111e+50 +c12 99999.9999 +execute my_delete ; +set @arg00= '1.11111111111111111111e+50' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Warning 1265 Data truncated for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1265 Data truncated for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 1 +c2 1 +c3 1 +c4 1 +c5 1 +c6 1 +c7 3.40282e+38 +c8 1.11111111111111e+50 +c9 1.11111111111111e+50 +c10 1.11111111111111e+50 +c12 99999.9999 +execute my_delete ; +set @arg00= -1.11111111111111111111e+50 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -128 +c2 -32768 +c3 -8388608 +c4 -2147483648 +c5 -2147483648 +c6 -9223372036854775808 +c7 -3.40282e+38 +c8 -1.11111111111111e+50 +c9 -1.11111111111111e+50 +c10 -1.11111111111111e+50 +c12 -9999.9999 +execute my_delete ; +set @arg00= '-1.11111111111111111111e+50' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Warning 1265 Data truncated for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1265 Data truncated for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -1 +c2 -1 +c3 -1 +c4 -1 +c5 -1 +c6 -1 +c7 -3.40282e+38 +c8 -1.11111111111111e+50 +c9 -1.11111111111111e+50 +c10 -1.11111111111111e+50 +c12 -9999.9999 +execute my_delete ; +test_sequence +-- insert into string columns -- +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 +from t9 where c1 >= 20 +order by c1 ; +c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 +20 2 20 20 20 20 20 20 20 20 20 20 +21 2 21 21 21 21 21 21 21 21 21 21 +22 2 22 22 22 22 22 22 22 22 22 22 +23 2 23 23 23 23 23 23 23 23 23 23 +30 3 30 30 30 30 30 30 30 30 30 30 +31 3 31 31 31 31 31 31 31 31 31 31 +32 3 32 32 32 32 32 32 32 32 32 32 +33 3 33 33 33 33 33 33 33 33 33 33 +40 4 40 40 40 40 40 40 40 40 40 40 +41 4 41 41 41 41 41 41 41 41 41 41 +42 4 42 42 42 42 42 42 42 42 42 42 +43 4 43 43 43 43 43 43 43 43 43 43 +50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00 +51 5 51 51 51 51 51 51 51 51 51 51 +52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00 +53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00 +54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00 +55 5 55 55 55 55 55 55 55 55 55 55 +56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00 +57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00 +60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +test_sequence +-- select .. where string column = .. -- +set @arg00= '20'; +select 'true' as found from t9 +where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and +c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and +c27= '20' and c28= '20' and c29= '20' and c30= '20' ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and + c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and + c27= '20' and c28= '20' and c29= '20' and c30= '20'" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and + c21= ? and c22= ? and c23= ? and c25= ? and + c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= CAST('20' as binary); +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20))) += CAST('20' as binary) and c21= CAST('20' as binary) +and c22= CAST('20' as binary) and c23= CAST('20' as binary) and +c24= CAST('20' as binary) and c25= CAST('20' as binary) and +c26= CAST('20' as binary) and c27= CAST('20' as binary) and +c28= CAST('20' as binary) and c29= CAST('20' as binary) and +c30= CAST('20' as binary) ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and +c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20))) + = CAST('20' as binary) and c21= CAST('20' as binary) + and c22= CAST('20' as binary) and c23= CAST('20' as binary) and + c24= CAST('20' as binary) and c25= CAST('20' as binary) and + c26= CAST('20' as binary) and c27= CAST('20' as binary) and + c28= CAST('20' as binary) and c29= CAST('20' as binary) and + c30= CAST('20' as binary)" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and + c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and + c29= ? and c30= ?"; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 20; +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and +c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and +c27= 20 and c28= 20 and c29= 20 and c30= 20 ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and + c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and + c27= 20 and c28= 20 and c29= 20 and c30= 20" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and + c21= ? and c22= ? and c23= ? and c25= ? and + c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 20.0; +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and +c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and +c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and + c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and + c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and + c21= ? and c22= ? and c23= ? and c25= ? and + c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +delete from t9 ; +test_sequence +-- insert into date/time columns -- +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; +c1 c13 c14 c15 c16 c17 +20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +60 NULL NULL 1991-01-01 01:01:01 NULL NULL +61 NULL NULL 1991-01-01 01:01:01 NULL NULL +62 NULL NULL 1991-01-01 01:01:01 NULL NULL +63 NULL NULL 1991-01-01 01:01:01 NULL NULL +71 NULL NULL 1991-01-01 01:01:01 NULL NULL +73 NULL NULL 1991-01-01 01:01:01 NULL NULL +81 NULL NULL 1991-01-01 01:01:01 NULL NULL +83 NULL NULL 1991-01-01 01:01:01 NULL NULL +test_sequence +-- select .. where date/time column = .. -- +set @arg00= '1991-01-01 01:01:01' ; +select 'true' as found from t9 +where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and +c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and +c17= '1991-01-01 01:01:01' ; +found +true +select 'true' as found from t9 +where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00 +and c17= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and + c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and + c17= '1991-01-01 01:01:01'" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; +select 'true' as found from t9 +where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and +c14= CAST('1991-01-01 01:01:01' as datetime) and +c15= CAST('1991-01-01 01:01:01' as datetime) and +c16= CAST('1991-01-01 01:01:01' as datetime) and +c17= CAST('1991-01-01 01:01:01' as datetime) ; +found +true +select 'true' as found from t9 +where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00 +and c17= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and + c14= CAST('1991-01-01 01:01:01' as datetime) and + c15= CAST('1991-01-01 01:01:01' as datetime) and + c16= CAST('1991-01-01 01:01:01' as datetime) and + c17= CAST('1991-01-01 01:01:01' as datetime)" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 1991 ; +select 'true' as found from t9 +where c1= 20 and c17= 1991 ; +found +true +select 'true' as found from t9 +where c1= 20 and c17= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c17= 1991" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c17= ?" ; +execute stmt1 using @arg00 ; +found +true +set @arg00= 1.991e+3 ; +select 'true' as found from t9 +where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ; +found +true +select 'true' as found from t9 +where c1= 20 and abs(c17 - @arg00) < 0.01 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and abs(c17 - ?) < 0.01" ; +execute stmt1 using @arg00 ; +found +true +drop table t1, t9 ; +create table t1 +( +a int, b varchar(30), +primary key(a) +) ENGINE = MERGE UNION=(t1_1,t1_2) +INSERT_METHOD=LAST; +create table t9 +( +c1 tinyint, c2 smallint, c3 mediumint, c4 int, +c5 integer, c6 bigint, c7 float, c8 double, +c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), +c13 date, c14 datetime, c15 timestamp(14), c16 time, +c17 year, c18 bit, c19 bool, c20 char, +c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, +c25 blob, c26 text, c27 mediumblob, c28 mediumtext, +c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'), +c32 set('monday', 'tuesday', 'wednesday'), +primary key(c1) +) ENGINE = MERGE UNION=(t9_1,t9_2) +INSERT_METHOD=LAST; +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +test_sequence +------ simple select tests ------ +prepare stmt1 from ' select * from t9 order by c1 ' ; +execute stmt1; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def test t9 t9 c1 c1 1 4 1 N 49155 0 63 +def test t9 t9 c2 c2 2 6 1 Y 32768 0 63 +def test t9 t9 c3 c3 9 9 1 Y 32768 0 63 +def test t9 t9 c4 c4 3 11 1 Y 32768 0 63 +def test t9 t9 c5 c5 3 11 1 Y 32768 0 63 +def test t9 t9 c6 c6 8 20 1 Y 32768 0 63 +def test t9 t9 c7 c7 4 12 1 Y 32768 31 63 +def test t9 t9 c8 c8 5 22 1 Y 32768 31 63 +def test t9 t9 c9 c9 5 22 1 Y 32768 31 63 +def test t9 t9 c10 c10 5 22 1 Y 32768 31 63 +def test t9 t9 c11 c11 0 9 6 Y 32768 4 63 +def test t9 t9 c12 c12 0 10 6 Y 32768 4 63 +def test t9 t9 c13 c13 10 10 10 Y 128 0 63 +def test t9 t9 c14 c14 12 19 19 Y 128 0 63 +def test t9 t9 c15 c15 7 19 19 N 1249 0 63 +def test t9 t9 c16 c16 11 8 8 Y 128 0 63 +def test t9 t9 c17 c17 13 4 4 Y 32864 0 63 +def test t9 t9 c18 c18 1 1 1 Y 32768 0 63 +def test t9 t9 c19 c19 1 1 1 Y 32768 0 63 +def test t9 t9 c20 c20 254 1 1 Y 0 0 8 +def test t9 t9 c21 c21 253 10 10 Y 0 0 8 +def test t9 t9 c22 c22 253 30 30 Y 0 0 8 +def test t9 t9 c23 c23 252 255 8 Y 144 0 63 +def test t9 t9 c24 c24 252 255 8 Y 16 0 8 +def test t9 t9 c25 c25 252 65535 4 Y 144 0 63 +def test t9 t9 c26 c26 252 65535 4 Y 16 0 8 +def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63 +def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8 +def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63 +def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8 +def test t9 t9 c31 c31 254 5 3 Y 256 0 8 +def test t9 t9 c32 c32 254 24 7 Y 2048 0 8 +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday +set @arg00='SELECT' ; +prepare stmt1 from ' ? a from t1 where a=1 '; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1 +set @arg00=1 ; +select @arg00, b from t1 where a=1 ; +@arg00 b +1 one +prepare stmt1 from ' select ?, b from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +? b +1 one +set @arg00='lion' ; +select @arg00, b from t1 where a=1 ; +@arg00 b +lion one +prepare stmt1 from ' select ?, b from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +? b +lion one +set @arg00=NULL ; +select @arg00, b from t1 where a=1 ; +@arg00 b +NULL one +prepare stmt1 from ' select ?, b from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +? b +NULL one +set @arg00=1 ; +select b, a - @arg00 from t1 where a=1 ; +b a - @arg00 +one 0 +prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +b a - ? +one 0 +set @arg00=null ; +select @arg00 as my_col ; +my_col +NULL +prepare stmt1 from ' select ? as my_col'; +execute stmt1 using @arg00 ; +my_col +NULL +select @arg00 + 1 as my_col ; +my_col +NULL +prepare stmt1 from ' select ? + 1 as my_col'; +execute stmt1 using @arg00 ; +my_col +NULL +select 1 + @arg00 as my_col ; +my_col +NULL +prepare stmt1 from ' select 1 + ? as my_col'; +execute stmt1 using @arg00 ; +my_col +NULL +set @arg00='MySQL' ; +select substr(@arg00,1,2) from t1 where a=1 ; +substr(@arg00,1,2) +My +prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +substr(?,1,2) +My +set @arg00=3 ; +select substr('MySQL',@arg00,5) from t1 where a=1 ; +substr('MySQL',@arg00,5) +SQL +prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +substr('MySQL',?,5) +SQL +select substr('MySQL',1,@arg00) from t1 where a=1 ; +substr('MySQL',1,@arg00) +MyS +prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +substr('MySQL',1,?) +MyS +set @arg00='MySQL' ; +select a , concat(@arg00,b) from t1 order by a; +a concat(@arg00,b) +1 MySQLone +2 MySQLtwo +3 MySQLthree +4 MySQLfour +prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ; +execute stmt1 using @arg00; +a concat(?,b) +1 MySQLone +2 MySQLtwo +3 MySQLthree +4 MySQLfour +select a , concat(b,@arg00) from t1 order by a ; +a concat(b,@arg00) +1 oneMySQL +2 twoMySQL +3 threeMySQL +4 fourMySQL +prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ; +execute stmt1 using @arg00; +a concat(b,?) +1 oneMySQL +2 twoMySQL +3 threeMySQL +4 fourMySQL +set @arg00='MySQL' ; +select group_concat(@arg00,b order by a) from t1 +group by 'a' ; +group_concat(@arg00,b order by a) +MySQLone,MySQLtwo,MySQLthree,MySQLfour +prepare stmt1 from ' select group_concat(?,b order by a) from t1 +group by ''a'' ' ; +execute stmt1 using @arg00; +group_concat(?,b order by a) +MySQLone,MySQLtwo,MySQLthree,MySQLfour +select group_concat(b,@arg00 order by a) from t1 +group by 'a' ; +group_concat(b,@arg00 order by a) +oneMySQL,twoMySQL,threeMySQL,fourMySQL +prepare stmt1 from ' select group_concat(b,? order by a) from t1 +group by ''a'' ' ; +execute stmt1 using @arg00; +group_concat(b,? order by a) +oneMySQL,twoMySQL,threeMySQL,fourMySQL +set @arg00='first' ; +set @arg01='second' ; +set @arg02=NULL; +select @arg00, @arg01 from t1 where a=1 ; +@arg00 @arg01 +first second +prepare stmt1 from ' select ?, ? from t1 where a=1 ' ; +execute stmt1 using @arg00, @arg01 ; +? ? +first second +execute stmt1 using @arg02, @arg01 ; +? ? +NULL second +execute stmt1 using @arg00, @arg02 ; +? ? +first NULL +execute stmt1 using @arg02, @arg02 ; +? ? +NULL NULL +drop table if exists t5 ; +create table t5 (id1 int(11) not null default '0', +value2 varchar(100), value1 varchar(100)) ; +insert into t5 values (1,'hh','hh'),(2,'hh','hh'), +(1,'ii','ii'),(2,'ii','ii') ; +prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ; +set @arg00=1 ; +set @arg01='hh' ; +execute stmt1 using @arg00, @arg01 ; +id1 value1 +1 hh +1 ii +2 hh +drop table t5 ; +drop table if exists t5 ; +create table t5(session_id char(9) not null) ; +insert into t5 values ('abc') ; +prepare stmt1 from ' select * from t5 +where ?=''1111'' and session_id = ''abc'' ' ; +set @arg00='abc' ; +execute stmt1 using @arg00 ; +session_id +set @arg00='1111' ; +execute stmt1 using @arg00 ; +session_id +abc +set @arg00='abc' ; +execute stmt1 using @arg00 ; +session_id +drop table t5 ; +set @arg00='FROM' ; +select a @arg00 t1 where a=1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 t1 where a=1' at line 1 +prepare stmt1 from ' select a ? t1 where a=1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? t1 where a=1' at line 1 +set @arg00='t1' ; +select a from @arg00 where a=1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 where a=1' at line 1 +prepare stmt1 from ' select a from ? where a=1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? where a=1' at line 1 +set @arg00='WHERE' ; +select a from t1 @arg00 a=1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a=1' at line 1 +prepare stmt1 from ' select a from t1 ? a=1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a=1' at line 1 +set @arg00=1 ; +select a FROM t1 where a=@arg00 ; +a +1 +prepare stmt1 from ' select a FROM t1 where a=? ' ; +execute stmt1 using @arg00 ; +a +1 +set @arg00=1000 ; +execute stmt1 using @arg00 ; +a +set @arg00=NULL ; +select a FROM t1 where a=@arg00 ; +a +prepare stmt1 from ' select a FROM t1 where a=? ' ; +execute stmt1 using @arg00 ; +a +set @arg00=4 ; +select a FROM t1 where a=sqrt(@arg00) ; +a +2 +prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ; +execute stmt1 using @arg00 ; +a +2 +set @arg00=NULL ; +select a FROM t1 where a=sqrt(@arg00) ; +a +prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ; +execute stmt1 using @arg00 ; +a +set @arg00=2 ; +set @arg01=3 ; +select a FROM t1 where a in (@arg00,@arg01) order by a; +a +2 +3 +prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a '; +execute stmt1 using @arg00, @arg01; +a +2 +3 +set @arg00= 'one' ; +set @arg01= 'two' ; +set @arg02= 'five' ; +prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ; +execute stmt1 using @arg00, @arg01, @arg02 ; +b +one +two +prepare stmt1 from ' select b FROM t1 where b like ? '; +set @arg00='two' ; +execute stmt1 using @arg00 ; +b +two +set @arg00='tw%' ; +execute stmt1 using @arg00 ; +b +two +set @arg00='%wo' ; +execute stmt1 using @arg00 ; +b +two +set @arg00=null ; +insert into t9 set c1= 0, c5 = NULL ; +select c5 from t9 where c5 > NULL ; +c5 +prepare stmt1 from ' select c5 from t9 where c5 > ? '; +execute stmt1 using @arg00 ; +c5 +select c5 from t9 where c5 < NULL ; +c5 +prepare stmt1 from ' select c5 from t9 where c5 < ? '; +execute stmt1 using @arg00 ; +c5 +select c5 from t9 where c5 = NULL ; +c5 +prepare stmt1 from ' select c5 from t9 where c5 = ? '; +execute stmt1 using @arg00 ; +c5 +select c5 from t9 where c5 <=> NULL ; +c5 +NULL +prepare stmt1 from ' select c5 from t9 where c5 <=> ? '; +execute stmt1 using @arg00 ; +c5 +NULL +delete from t9 where c1= 0 ; +set @arg00='>' ; +select a FROM t1 where a @arg00 1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 1' at line 1 +prepare stmt1 from ' select a FROM t1 where a ? 1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? 1' at line 1 +set @arg00=1 ; +select a,b FROM t1 where a is not NULL +AND b is not NULL group by a - @arg00 ; +a b +1 one +2 two +3 three +4 four +prepare stmt1 from ' select a,b FROM t1 where a is not NULL +AND b is not NULL group by a - ? ' ; +execute stmt1 using @arg00 ; +a b +1 one +2 two +3 three +4 four +set @arg00='two' ; +select a,b FROM t1 where a is not NULL +AND b is not NULL having b <> @arg00 order by a ; +a b +1 one +3 three +4 four +prepare stmt1 from ' select a,b FROM t1 where a is not NULL +AND b is not NULL having b <> ? order by a ' ; +execute stmt1 using @arg00 ; +a b +1 one +3 three +4 four +set @arg00=1 ; +select a,b FROM t1 where a is not NULL +AND b is not NULL order by a - @arg00 ; +a b +1 one +2 two +3 three +4 four +prepare stmt1 from ' select a,b FROM t1 where a is not NULL +AND b is not NULL order by a - ? ' ; +execute stmt1 using @arg00 ; +a b +1 one +2 two +3 three +4 four +set @arg00=2 ; +select a,b from t1 order by 2 ; +a b +4 four +1 one +3 three +2 two +prepare stmt1 from ' select a,b from t1 +order by ? '; +execute stmt1 using @arg00; +a b +4 four +1 one +3 three +2 two +set @arg00=1 ; +execute stmt1 using @arg00; +a b +1 one +2 two +3 three +4 four +set @arg00=0 ; +execute stmt1 using @arg00; +ERROR 42S22: Unknown column '?' in 'order clause' +set @arg00=1; +prepare stmt1 from ' select a,b from t1 order by a +limit 1 '; +execute stmt1 ; +a b +1 one +prepare stmt1 from ' select a,b from t1 +limit ? '; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2 +set @arg00='b' ; +set @arg01=0 ; +set @arg02=2 ; +set @arg03=2 ; +select sum(a), @arg00 from t1 where a > @arg01 +and b is not null group by substr(b,@arg02) +having sum(a) <> @arg03 ; +sum(a) @arg00 +3 b +1 b +4 b +prepare stmt1 from ' select sum(a), ? from t1 where a > ? +and b is not null group by substr(b,?) +having sum(a) <> ? '; +execute stmt1 using @arg00, @arg01, @arg02, @arg03; +sum(a) ? +3 b +1 b +4 b +test_sequence +------ join tests ------ +select first.a as a1, second.a as a2 +from t1 first, t1 second +where first.a = second.a order by a1 ; +a1 a2 +1 1 +2 2 +3 3 +4 4 +prepare stmt1 from ' select first.a as a1, second.a as a2 + from t1 first, t1 second + where first.a = second.a order by a1 '; +execute stmt1 ; +a1 a2 +1 1 +2 2 +3 3 +4 4 +set @arg00='ABC'; +set @arg01='two'; +set @arg02='one'; +select first.a, @arg00, second.a FROM t1 first, t1 second +where @arg01 = first.b or first.a = second.a or second.b = @arg02 +order by second.a, first.a; +a @arg00 a +1 ABC 1 +2 ABC 1 +3 ABC 1 +4 ABC 1 +2 ABC 2 +2 ABC 3 +3 ABC 3 +2 ABC 4 +4 ABC 4 +prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second + where ? = first.b or first.a = second.a or second.b = ? + order by second.a, first.a'; +execute stmt1 using @arg00, @arg01, @arg02; +a ? a +1 ABC 1 +2 ABC 1 +3 ABC 1 +4 ABC 1 +2 ABC 2 +2 ABC 3 +3 ABC 3 +2 ABC 4 +4 ABC 4 +drop table if exists t2 ; +create table t2 as select * from t1 ; +set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ; +set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ; +set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ; +set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ; +set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ; +set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ; +set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ; +set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ; +set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ; +the join statement is: +SELECT * FROM t2 right join t1 using(a) order by t2.a +prepare stmt1 from @query9 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 natural right join t1 order by t2.a +prepare stmt1 from @query8 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a +prepare stmt1 from @query7 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 left join t1 using(a) order by t2.a +prepare stmt1 from @query6 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 natural left join t1 order by t2.a +prepare stmt1 from @query5 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a +prepare stmt1 from @query4 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 join t1 using(a) order by t2.a +prepare stmt1 from @query3 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 natural join t1 order by t2.a +prepare stmt1 from @query2 ; +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +the join statement is: +SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a +prepare stmt1 from @query1 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +drop table t2 ; +test_sequence +------ subquery tests ------ +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = ''two'') '; +execute stmt1 ; +a b +2 two +set @arg00='two' ; +select a, b FROM t1 outer_table where +a = (select a from t1 where b = 'two' ) and b=@arg00 ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = ''two'') and b=? '; +execute stmt1 using @arg00; +a b +2 two +set @arg00='two' ; +select a, b FROM t1 outer_table where +a = (select a from t1 where b = @arg00 ) and b='two' ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = ? ) and b=''two'' ' ; +execute stmt1 using @arg00; +a b +2 two +set @arg00=3 ; +set @arg01='three' ; +select a,b FROM t1 where (a,b) in (select 3, 'three'); +a b +3 three +select a FROM t1 where (a,b) in (select @arg00,@arg01); +a +3 +prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) '; +execute stmt1 using @arg00, @arg01; +a +3 +set @arg00=1 ; +set @arg01='two' ; +set @arg02=2 ; +set @arg03='two' ; +select a, @arg00, b FROM t1 outer_table where +b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ; +a @arg00 b +2 1 two +prepare stmt1 from ' select a, ?, b FROM t1 outer_table where + b=? and a = (select ? from t1 where b = ? ) ' ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; +a ? b +2 1 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = outer_table.b ) order by a '; +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +prepare stmt1 from ' SELECT a as ccc from t1 where a+1= + (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; +execute stmt1 ; +ccc +1 +deallocate prepare stmt1 ; +prepare stmt1 from ' SELECT a as ccc from t1 where a+1= + (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; +execute stmt1 ; +ccc +1 +deallocate prepare stmt1 ; +prepare stmt1 from ' SELECT a as ccc from t1 where a+1= + (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; +execute stmt1 ; +ccc +1 +deallocate prepare stmt1 ; +set @arg00='two' ; +select a, b FROM t1 outer_table where +a = (select a from t1 where b = outer_table.b ) and b=@arg00 ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = outer_table.b) and b=? '; +execute stmt1 using @arg00; +a b +2 two +set @arg00=2 ; +select a, b FROM t1 outer_table where +a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ; +execute stmt1 using @arg00; +a b +2 two +set @arg00=2 ; +select a, b FROM t1 outer_table where +a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ; +execute stmt1 using @arg00; +a b +2 two +set @arg00=1 ; +set @arg01='two' ; +set @arg02=2 ; +set @arg03='two' ; +select a, @arg00, b FROM t1 outer_table where +b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03 +and outer_table.a=a ) ; +a @arg00 b +2 1 two +prepare stmt1 from ' select a, ?, b FROM t1 outer_table where + b=? and a = (select ? from t1 where outer_table.b = ? + and outer_table.a=a ) ' ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; +a ? b +2 1 two +set @arg00=1 ; +set @arg01=0 ; +select a, @arg00 +from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2 +where a=@arg01; +a @arg00 +0 1 +prepare stmt1 from ' select a, ? + from ( select a - ? as a from t1 where a=? ) as t2 + where a=? '; +execute stmt1 using @arg00, @arg00, @arg00, @arg01 ; +a ? +0 1 +drop table if exists t2 ; +create table t2 as select * from t1; +prepare stmt1 from ' select a in (select a from t2) from t1 ' ; +execute stmt1 ; +a in (select a from t2) +1 +1 +1 +1 +drop table if exists t5, t6, t7 ; +create table t5 (a int , b int) ; +create table t6 like t5 ; +create table t7 like t5 ; +insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7), +(2, -1), (3, 10) ; +insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ; +insert into t7 values (3, 3), (2, 2), (1, 1) ; +prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) from t7 ' ; +execute stmt1 ; +a (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) +3 1 +2 2 +1 2 +execute stmt1 ; +a (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) +3 1 +2 2 +1 2 +execute stmt1 ; +a (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) +3 1 +2 2 +1 2 +drop table t5, t6, t7 ; +drop table if exists t2 ; +create table t2 as select * from t9; +set @stmt= ' SELECT + (SELECT SUM(c1 + c12 + 0.0) FROM t2 + where (t9.c2 - 0e-3) = t2.c2 + GROUP BY t9.c15 LIMIT 1) as scalar_s, + exists (select 1.0e+0 from t2 + where t2.c3 * 9.0000000000 = t9.c4) as exists_s, + c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, + (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s +FROM t9, +(select c25 x, c32 y from t2) tt WHERE x = c25 ' ; +prepare stmt1 from @stmt ; +execute stmt1 ; +execute stmt1 ; +set @stmt= concat('explain ',@stmt); +prepare stmt1 from @stmt ; +execute stmt1 ; +execute stmt1 ; +set @stmt= ' SELECT + (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2 + GROUP BY t9.c15 LIMIT 1) as scalar_s, + exists (select ? from t2 + where t2.c3*?=t9.c4) as exists_s, + c5*? in (select c6+? from t2) as in_s, + (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s +FROM t9, +(select c25 x, c32 y from t2) tt WHERE x =c25 ' ; +set @arg00= 0.0 ; +set @arg01= 0e-3 ; +set @arg02= 1.0e+0 ; +set @arg03= 9.0000000000 ; +set @arg04= 4 ; +set @arg05= 0.3e+1 ; +set @arg06= 4 ; +set @arg07= 4 ; +set @arg08= 4.0 ; +set @arg09= 40e-1 ; +prepare stmt1 from @stmt ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +set @stmt= concat('explain ',@stmt); +prepare stmt1 from @stmt ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +drop table t2 ; +select 1 < (select a from t1) ; +ERROR 21000: Subquery returns more than 1 row +prepare stmt1 from ' select 1 < (select a from t1) ' ; +execute stmt1 ; +ERROR 21000: Subquery returns more than 1 row +select 1 as my_col ; +my_col +1 +test_sequence +------ union tests ------ +prepare stmt1 from ' select a FROM t1 where a=1 + union distinct + select a FROM t1 where a=1 '; +execute stmt1 ; +a +1 +execute stmt1 ; +a +1 +prepare stmt1 from ' select a FROM t1 where a=1 + union all + select a FROM t1 where a=1 '; +execute stmt1 ; +a +1 +1 +prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +set @arg00=1 ; +select @arg00 FROM t1 where a=1 +union distinct +select 1 FROM t1 where a=1; +@arg00 +1 +prepare stmt1 from ' select ? FROM t1 where a=1 + union distinct + select 1 FROM t1 where a=1 ' ; +execute stmt1 using @arg00; +? +1 +set @arg00=1 ; +select 1 FROM t1 where a=1 +union distinct +select @arg00 FROM t1 where a=1; +1 +1 +prepare stmt1 from ' select 1 FROM t1 where a=1 + union distinct + select ? FROM t1 where a=1 ' ; +execute stmt1 using @arg00; +1 +1 +set @arg00='a' ; +select @arg00 FROM t1 where a=1 +union distinct +select @arg00 FROM t1 where a=1; +@arg00 +a +prepare stmt1 from ' select ? FROM t1 where a=1 + union distinct + select ? FROM t1 where a=1 '; +execute stmt1 using @arg00, @arg00; +? +a +prepare stmt1 from ' select ? + union distinct + select ? '; +execute stmt1 using @arg00, @arg00; +? +a +set @arg00='a' ; +set @arg01=1 ; +set @arg02='a' ; +set @arg03=2 ; +select @arg00 FROM t1 where a=@arg01 +union distinct +select @arg02 FROM t1 where a=@arg03; +@arg00 +a +prepare stmt1 from ' select ? FROM t1 where a=? + union distinct + select ? FROM t1 where a=? ' ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03; +? +a +set @arg00=1 ; +prepare stmt1 from ' select sum(a) + 200, ? from t1 +union distinct +select sum(a) + 200, 1 from t1 +group by b ' ; +execute stmt1 using @arg00; +sum(a) + 200 ? +210 1 +204 1 +201 1 +203 1 +202 1 +set @Oporto='Oporto' ; +set @Lisboa='Lisboa' ; +set @0=0 ; +set @1=1 ; +set @2=2 ; +set @3=3 ; +set @4=4 ; +select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ; +@Oporto @Lisboa @0 @1 @2 @3 @4 +Oporto Lisboa 0 1 2 3 4 +select sum(a) + 200 as the_sum, @Oporto as the_town from t1 +group by b +union distinct +select sum(a) + 200, @Lisboa from t1 +group by b ; +the_sum the_town +204 Oporto +201 Oporto +203 Oporto +202 Oporto +204 Lisboa +201 Lisboa +203 Lisboa +202 Lisboa +prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 + group by b + union distinct + select sum(a) + 200, ? from t1 + group by b ' ; +execute stmt1 using @Oporto, @Lisboa; +the_sum the_town +204 Oporto +201 Oporto +203 Oporto +202 Oporto +204 Lisboa +201 Lisboa +203 Lisboa +202 Lisboa +select sum(a) + 200 as the_sum, @Oporto as the_town from t1 +where a > @1 +group by b +union distinct +select sum(a) + 200, @Lisboa from t1 +where a > @2 +group by b ; +the_sum the_town +204 Oporto +203 Oporto +202 Oporto +204 Lisboa +203 Lisboa +prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 + where a > ? + group by b + union distinct + select sum(a) + 200, ? from t1 + where a > ? + group by b ' ; +execute stmt1 using @Oporto, @1, @Lisboa, @2; +the_sum the_town +204 Oporto +203 Oporto +202 Oporto +204 Lisboa +203 Lisboa +select sum(a) + 200 as the_sum, @Oporto as the_town from t1 +where a > @1 +group by b +having avg(a) > @2 +union distinct +select sum(a) + 200, @Lisboa from t1 +where a > @2 +group by b +having avg(a) > @3; +the_sum the_town +204 Oporto +203 Oporto +204 Lisboa +prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 + where a > ? + group by b + having avg(a) > ? + union distinct + select sum(a) + 200, ? from t1 + where a > ? + group by b + having avg(a) > ? '; +execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3; +the_sum the_town +204 Oporto +203 Oporto +204 Lisboa +test_sequence +------ explain select tests ------ +prepare stmt1 from ' explain select * from t9 ' ; +execute stmt1; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def id 8 3 1 N 32801 0 8 +def select_type 253 19 6 N 1 31 33 +def table 253 64 2 N 1 31 33 +def type 253 10 3 N 1 31 33 +def possible_keys 253 4096 0 Y 0 31 33 +def key 253 64 0 Y 0 31 33 +def key_len 8 3 0 Y 32800 0 8 +def ref 253 1024 0 Y 0 31 33 +def rows 8 10 1 N 32801 0 8 +def Extra 253 255 0 N 1 31 33 +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t9 ALL NULL NULL NULL NULL 2 +test_sequence +------ delete tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +prepare stmt1 from 'delete from t1 where a=2' ; +execute stmt1; +select a,b from t1 where a=2; +a b +execute stmt1; +insert into t1 values(0,NULL); +set @arg00=NULL; +prepare stmt1 from 'delete from t1 where b=?' ; +execute stmt1 using @arg00; +select a,b from t1 where b is NULL ; +a b +0 NULL +set @arg00='one'; +execute stmt1 using @arg00; +select a,b from t1 where b=@arg00; +a b +prepare stmt1 from 'truncate table t1' ; +ERROR HY000: This command is not supported in the prepared statement protocol yet +test_sequence +------ update tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ; +execute stmt1; +select a,b from t1 where a=2; +a b +2 a=two +execute stmt1; +select a,b from t1 where a=2; +a b +2 a=two +set @arg00=NULL; +prepare stmt1 from 'update t1 set b=? where a=2' ; +execute stmt1 using @arg00; +select a,b from t1 where a=2; +a b +2 NULL +set @arg00='two'; +execute stmt1 using @arg00; +select a,b from t1 where a=2; +a b +2 two +set @arg00=2; +prepare stmt1 from 'update t1 set b=NULL where a=?' ; +execute stmt1 using @arg00; +select a,b from t1 where a=@arg00; +a b +2 NULL +update t1 set b='two' where a=@arg00; +set @arg00=2000; +execute stmt1 using @arg00; +select a,b from t1 where a=@arg00; +a b +set @arg00=2; +set @arg01=22; +prepare stmt1 from 'update t1 set a=? where a=?' ; +execute stmt1 using @arg00, @arg00; +select a,b from t1 where a=@arg00; +a b +2 two +execute stmt1 using @arg01, @arg00; +select a,b from t1 where a=@arg01; +a b +22 two +execute stmt1 using @arg00, @arg01; +select a,b from t1 where a=@arg00; +a b +2 two +set @arg00=NULL; +set @arg01=2; +execute stmt1 using @arg00, @arg01; +Warnings: +Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1 +select a,b from t1 order by a; +a b +0 two +1 one +3 three +4 four +set @arg00=0; +execute stmt1 using @arg01, @arg00; +select a,b from t1 order by a; +a b +1 one +2 two +3 three +4 four +set @arg00=23; +set @arg01='two'; +set @arg02=2; +set @arg03='two'; +set @arg04=2; +drop table if exists t2; +create table t2 as select a,b from t1 ; +prepare stmt1 from 'update t1 set a=? where b=? + and a in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 where a = @arg00 ; +a b +23 two +prepare stmt1 from 'update t1 set a=? where b=? + and a not in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 order by a ; +a b +1 one +2 two +3 three +4 four +drop table t2 ; +create table t2 +( +a int, b varchar(30), +primary key(a) +) engine = 'MYISAM' ; +insert into t2(a,b) select a, b from t1 ; +prepare stmt1 from 'update t1 set a=? where b=? + and a in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 where a = @arg00 ; +a b +23 two +prepare stmt1 from 'update t1 set a=? where b=? + and a not in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 order by a ; +a b +1 one +2 two +3 three +4 four +drop table t2 ; +set @arg00=1; +prepare stmt1 from 'update t1 set b=''bla'' +where a=2 +limit 1'; +execute stmt1 ; +select a,b from t1 where b = 'bla' ; +a b +2 bla +prepare stmt1 from 'update t1 set b=''bla'' +where a=2 +limit ?'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3 +test_sequence +------ insert tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +prepare stmt1 from 'insert into t1 values(5, ''five'' )'; +execute stmt1; +select a,b from t1 where a = 5; +a b +5 five +set @arg00='six' ; +prepare stmt1 from 'insert into t1 values(6, ? )'; +execute stmt1 using @arg00; +select a,b from t1 where b = @arg00; +a b +6 six +execute stmt1 using @arg00; +ERROR 23000: Duplicate entry '6' for key 1 +set @arg00=NULL ; +prepare stmt1 from 'insert into t1 values(0, ? )'; +execute stmt1 using @arg00; +select a,b from t1 where b is NULL; +a b +0 NULL +set @arg00=8 ; +set @arg01='eight' ; +prepare stmt1 from 'insert into t1 values(?, ? )'; +execute stmt1 using @arg00, @arg01 ; +select a,b from t1 where b = @arg01; +a b +8 eight +set @NULL= null ; +set @arg00= 'abc' ; +execute stmt1 using @NULL, @NULL ; +ERROR 23000: Column 'a' cannot be null +execute stmt1 using @NULL, @NULL ; +ERROR 23000: Column 'a' cannot be null +execute stmt1 using @NULL, @arg00 ; +ERROR 23000: Column 'a' cannot be null +execute stmt1 using @NULL, @arg00 ; +ERROR 23000: Column 'a' cannot be null +set @arg01= 10000 + 2 ; +execute stmt1 using @arg01, @arg00 ; +set @arg01= 10000 + 1 ; +execute stmt1 using @arg01, @arg00 ; +select * from t1 where a > 10000 order by a ; +a b +10001 abc +10002 abc +delete from t1 where a > 10000 ; +set @arg01= 10000 + 2 ; +execute stmt1 using @arg01, @NULL ; +set @arg01= 10000 + 1 ; +execute stmt1 using @arg01, @NULL ; +select * from t1 where a > 10000 order by a ; +a b +10001 NULL +10002 NULL +delete from t1 where a > 10000 ; +set @arg01= 10000 + 10 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 9 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 8 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 7 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 6 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 5 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 4 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 3 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 2 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 1 ; +execute stmt1 using @arg01, @arg01 ; +select * from t1 where a > 10000 order by a ; +a b +10001 10001 +10002 10002 +10003 10003 +10004 10004 +10005 10005 +10006 10006 +10007 10007 +10008 10008 +10009 10009 +10010 10010 +delete from t1 where a > 10000 ; +set @arg00=81 ; +set @arg01='8-1' ; +set @arg02=82 ; +set @arg03='8-2' ; +prepare stmt1 from 'insert into t1 values(?,?),(?,?)'; +execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; +select a,b from t1 where a in (@arg00,@arg02) ; +a b +81 8-1 +82 8-2 +set @arg00=9 ; +set @arg01='nine' ; +prepare stmt1 from 'insert into t1 set a=?, b=? '; +execute stmt1 using @arg00, @arg01 ; +select a,b from t1 where a = @arg00 ; +a b +9 nine +set @arg00=6 ; +set @arg01=1 ; +prepare stmt1 from 'insert into t1 set a=?, b=''sechs'' + on duplicate key update a=a + ?, b=concat(b,''modified'') '; +execute stmt1 using @arg00, @arg01; +select * from t1 order by a; +a b +0 NULL +1 one +2 two +3 three +4 four +5 five +7 sixmodified +8 eight +9 nine +81 8-1 +82 8-2 +set @arg00=81 ; +set @arg01=1 ; +execute stmt1 using @arg00, @arg01; +ERROR 23000: Duplicate entry '82' for key 1 +drop table if exists t2 ; +create table t2 (id int auto_increment primary key) +ENGINE= 'MYISAM' ; +prepare stmt1 from ' select last_insert_id() ' ; +insert into t2 values (NULL) ; +execute stmt1 ; +last_insert_id() +1 +insert into t2 values (NULL) ; +execute stmt1 ; +last_insert_id() +2 +drop table t2 ; +set @1000=1000 ; +set @x1000_2="x1000_2" ; +set @x1000_3="x1000_3" ; +set @x1000="x1000" ; +set @1100=1100 ; +set @x1100="x1100" ; +set @100=100 ; +set @updated="updated" ; +insert into t1 values(1000,'x1000_1') ; +insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3) +on duplicate key update a = a + @100, b = concat(b,@updated) ; +select a,b from t1 where a >= 1000 order by a ; +a b +1000 x1000_3 +1100 x1000_1updated +delete from t1 where a >= 1000 ; +insert into t1 values(1000,'x1000_1') ; +prepare stmt1 from ' insert into t1 values(?,?),(?,?) + on duplicate key update a = a + ?, b = concat(b,?) '; +execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ; +select a,b from t1 where a >= 1000 order by a ; +a b +1000 x1000_3 +1100 x1000_1updated +delete from t1 where a >= 1000 ; +insert into t1 values(1000,'x1000_1') ; +execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ; +select a,b from t1 where a >= 1000 order by a ; +a b +1200 x1000_1updatedupdated +delete from t1 where a >= 1000 ; +prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' '; +execute stmt1; +execute stmt1; +execute stmt1; +test_sequence +------ multi table tests ------ +delete from t1 ; +delete from t9 ; +insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ; +insert into t9 (c1,c21) +values (1, 'one'), (2, 'two'), (3, 'three') ; +prepare stmt_delete from " delete t1, t9 + from t1, t9 where t1.a=t9.c1 and t1.b='updated' "; +prepare stmt_update from " update t1, t9 + set t1.b='updated', t9.c21='updated' + where t1.a=t9.c1 and t1.a=? "; +prepare stmt_select1 from " select a, b from t1 order by a" ; +prepare stmt_select2 from " select c1, c21 from t9 order by c1" ; +set @arg00= 1 ; +execute stmt_update using @arg00 ; +execute stmt_delete ; +execute stmt_select1 ; +a b +2 two +3 three +execute stmt_select2 ; +c1 c21 +2 two +3 three +set @arg00= @arg00 + 1 ; +execute stmt_update using @arg00 ; +execute stmt_delete ; +execute stmt_select1 ; +a b +3 three +execute stmt_select2 ; +c1 c21 +3 three +set @arg00= @arg00 + 1 ; +execute stmt_update using @arg00 ; +execute stmt_delete ; +execute stmt_select1 ; +a b +execute stmt_select2 ; +c1 c21 +set @arg00= @arg00 + 1 ; +drop table if exists t5 ; +set @arg01= 8; +set @arg02= 8.0; +set @arg03= 80.00000000000e-1; +set @arg04= 'abc' ; +set @arg05= CAST('abc' as binary) ; +set @arg06= '1991-08-05' ; +set @arg07= CAST('1991-08-05' as date); +set @arg08= '1991-08-05 01:01:01' ; +set @arg09= CAST('1991-08-05 01:01:01' as datetime) ; +set @arg10= unix_timestamp('1991-01-01 01:01:01'); +set @arg11= YEAR('1991-01-01 01:01:01'); +set @arg12= 8 ; +set @arg12= NULL ; +set @arg13= 8.0 ; +set @arg13= NULL ; +set @arg14= 'abc'; +set @arg14= NULL ; +set @arg15= CAST('abc' as binary) ; +set @arg15= NULL ; +create table t5 as select +8 as const01, @arg01 as param01, +8.0 as const02, @arg02 as param02, +80.00000000000e-1 as const03, @arg03 as param03, +'abc' as const04, @arg04 as param04, +CAST('abc' as binary) as const05, @arg05 as param05, +'1991-08-05' as const06, @arg06 as param06, +CAST('1991-08-05' as date) as const07, @arg07 as param07, +'1991-08-05 01:01:01' as const08, @arg08 as param08, +CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09, +unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10, +YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11, +NULL as const12, @arg12 as param12, +@arg13 as param13, +@arg14 as param14, +@arg15 as param15; +show create table t5 ; +Table Create Table +t5 CREATE TABLE `t5` ( + `const01` bigint(1) NOT NULL default '0', + `param01` bigint(20) default NULL, + `const02` double(3,1) NOT NULL default '0.0', + `param02` double default NULL, + `const03` double NOT NULL default '0', + `param03` double default NULL, + `const04` char(3) NOT NULL default '', + `param04` longtext, + `const05` binary(3) NOT NULL default '', + `param05` longblob, + `const06` varchar(10) NOT NULL default '', + `param06` longtext, + `const07` date default NULL, + `param07` longblob, + `const08` varchar(19) NOT NULL default '', + `param08` longtext, + `const09` datetime default NULL, + `param09` longblob, + `const10` int(10) NOT NULL default '0', + `param10` bigint(20) default NULL, + `const11` int(4) default NULL, + `param11` bigint(20) default NULL, + `const12` binary(0) default NULL, + `param12` bigint(20) default NULL, + `param13` double default NULL, + `param14` longtext, + `param15` longblob +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t5 ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def test t5 t5 const01 const01 8 1 1 N 32769 0 63 +def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 +def test t5 t5 const02 const02 5 3 3 N 32769 1 63 +def test t5 t5 param02 param02 5 20 1 Y 32768 31 63 +def test t5 t5 const03 const03 5 23 1 N 32769 31 63 +def test t5 t5 param03 param03 5 20 1 Y 32768 31 63 +def test t5 t5 const04 const04 254 3 3 N 1 0 8 +def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8 +def test t5 t5 const05 const05 254 3 3 N 129 0 63 +def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63 +def test t5 t5 const06 const06 253 10 10 N 1 0 8 +def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8 +def test t5 t5 const07 const07 10 10 10 Y 128 0 63 +def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63 +def test t5 t5 const08 const08 253 19 19 N 1 0 8 +def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8 +def test t5 t5 const09 const09 12 19 19 Y 128 0 63 +def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63 +def test t5 t5 const10 const10 3 10 9 N 32769 0 63 +def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 +def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 +def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 +def test t5 t5 const12 const12 254 0 0 Y 128 0 63 +def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 +def test t5 t5 param13 param13 5 20 0 Y 32768 31 63 +def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8 +def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63 +const01 8 +param01 8 +const02 8.0 +param02 8 +const03 8 +param03 8 +const04 abc +param04 abc +const05 abc +param05 abc +const06 1991-08-05 +param06 1991-08-05 +const07 1991-08-05 +param07 1991-08-05 +const08 1991-08-05 01:01:01 +param08 1991-08-05 01:01:01 +const09 1991-08-05 01:01:01 +param09 1991-08-05 01:01:01 +const10 662680861 +param10 662680861 +const11 1991 +param11 1991 +const12 NULL +param12 NULL +param13 NULL +param14 NULL +param15 NULL +drop table t5 ; +test_sequence +------ data type conversion tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ; +select * from t9 order by c1 ; +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday +test_sequence +------ select @parameter:= column ------ +prepare full_info from "select @arg01, @arg02, @arg03, @arg04, + @arg05, @arg06, @arg07, @arg08, + @arg09, @arg10, @arg11, @arg12, + @arg13, @arg14, @arg15, @arg16, + @arg17, @arg18, @arg19, @arg20, + @arg21, @arg22, @arg23, @arg24, + @arg25, @arg26, @arg27, @arg28, + @arg29, @arg30, @arg31, @arg32" ; +select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, +@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, +@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, +@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, +@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, +@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, +@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, +@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 +from t9 where c1= 1 ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, +@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, +@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, +@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, +@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, +@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, +@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, +@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 +from t9 where c1= 0 ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select + @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, + @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, + @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, + @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, + @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, + @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, + @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, + @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 +from t9 where c1= ?" ; +set @my_key= 1 ; +execute stmt1 using @my_key ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +set @my_key= 0 ; +execute stmt1 using @my_key ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':= c1 from t9 where c1= 1' at line 1 +test_sequence +------ select column, .. into @parm,.. ------ +select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, +c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, +c25, c26, c27, c28, c29, c30, c31, c32 +into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, +@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, +@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, +@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 +from t9 where c1= 1 ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, +c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, +c25, c26, c27, c28, c29, c30, c31, c32 +into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, +@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, +@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, +@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 +from t9 where c1= 0 ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, + c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, + c25, c26, c27, c28, c29, c30, c31, c32 +into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, + @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, + @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, + @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 +from t9 where c1= ?" ; +set @my_key= 1 ; +execute stmt1 using @my_key ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +set @my_key= 0 ; +execute stmt1 using @my_key ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t9 where c1= 1' at line 1 +test_sequence +-- insert into numeric columns -- +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ; +set @arg00= 21 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ; +execute stmt1 ; +set @arg00= 23; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, +30.0, 30.0, 30.0 ) ; +set @arg00= 31.0 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, + 32.0, 32.0, 32.0 )" ; +execute stmt1 ; +set @arg00= 33.0; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( '40', '40', '40', '40', '40', '40', '40', '40', +'40', '40', '40' ) ; +set @arg00= '41' ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( '42', '42', '42', '42', '42', '42', '42', '42', + '42', '42', '42' )" ; +execute stmt1 ; +set @arg00= '43'; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( CAST('50' as binary), CAST('50' as binary), +CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), +CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), +CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ; +set @arg00= CAST('51' as binary) ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( CAST('52' as binary), CAST('52' as binary), + CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), + CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), + CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ; +execute stmt1 ; +set @arg00= CAST('53' as binary) ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 2 ; +set @arg00= NULL ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +NULL, NULL, NULL ) ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 61, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL )" ; +execute stmt1 ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8.0 ; +set @arg00= NULL ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 71, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 'abc' ; +set @arg00= NULL ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 81, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 +from t9 where c1 >= 20 +order by c1 ; +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12 +20 20 20 20 20 20 20 20 20 20 20.0000 +21 21 21 21 21 21 21 21 21 21 21.0000 +22 22 22 22 22 22 22 22 22 22 22.0000 +23 23 23 23 23 23 23 23 23 23 23.0000 +30 30 30 30 30 30 30 30 30 30 30.0000 +31 31 31 31 31 31 31 31 31 31 31.0000 +32 32 32 32 32 32 32 32 32 32 32.0000 +33 33 33 33 33 33 33 33 33 33 33.0000 +40 40 40 40 40 40 40 40 40 40 40.0000 +41 41 41 41 41 41 41 41 41 41 41.0000 +42 42 42 42 42 42 42 42 42 42 42.0000 +43 43 43 43 43 43 43 43 43 43 43.0000 +50 50 50 50 50 50 50 50 50 50 50.0000 +51 51 51 51 51 51 51 51 51 51 51.0000 +52 52 52 52 52 52 52 52 52 52 52.0000 +53 53 53 53 53 53 53 53 53 53 53.0000 +60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +test_sequence +-- select .. where numeric column = .. -- +set @arg00= 20; +select 'true' as found from t9 +where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20 +and c8= 20 and c9= 20 and c10= 20 and c12= 20; +found +true +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20 + and c8= 20 and c9= 20 and c10= 20 and c12= 20 "; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 20.0; +select 'true' as found from t9 +where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0 +and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0; +found +true +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0 + and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 "; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +select 'true' as found from t9 +where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20' + and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20'; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20' + and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' "; +execute stmt1 ; +found +true +set @arg00= '20'; +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +select 'true' as found from t9 +where c1= CAST('20' as binary) and c2= CAST('20' as binary) and +c3= CAST('20' as binary) and c4= CAST('20' as binary) and +c5= CAST('20' as binary) and c6= CAST('20' as binary) and +c7= CAST('20' as binary) and c8= CAST('20' as binary) and +c9= CAST('20' as binary) and c10= CAST('20' as binary) and +c12= CAST('20' as binary); +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= CAST('20' as binary) and c2= CAST('20' as binary) and + c3= CAST('20' as binary) and c4= CAST('20' as binary) and + c5= CAST('20' as binary) and c6= CAST('20' as binary) and + c7= CAST('20' as binary) and c8= CAST('20' as binary) and + c9= CAST('20' as binary) and c10= CAST('20' as binary) and + c12= CAST('20' as binary) "; +execute stmt1 ; +found +true +set @arg00= CAST('20' as binary) ; +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +delete from t9 ; +test_sequence +-- some numeric overflow experiments -- +prepare my_insert from "insert into t9 + ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 +from t9 where c21 = 'O' "; +prepare my_delete from "delete from t9 where c21 = 'O' "; +set @arg00= 9223372036854775807 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 127 +c2 32767 +c3 8388607 +c4 2147483647 +c5 2147483647 +c6 9223372036854775807 +c7 9.22337e+18 +c8 9.22337203685478e+18 +c9 9.22337203685478e+18 +c10 9.22337203685478e+18 +c12 99999.9999 +execute my_delete ; +set @arg00= '9223372036854775807' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 127 +c2 32767 +c3 8388607 +c4 2147483647 +c5 2147483647 +c6 9223372036854775807 +c7 9.22337e+18 +c8 9.22337203685478e+18 +c9 9.22337203685478e+18 +c10 9.22337203685478e+18 +c12 99999.9999 +execute my_delete ; +set @arg00= -9223372036854775808 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -128 +c2 -32768 +c3 -8388608 +c4 -2147483648 +c5 -2147483648 +c6 -9223372036854775808 +c7 -9.22337e+18 +c8 -9.22337203685478e+18 +c9 -9.22337203685478e+18 +c10 -9.22337203685478e+18 +c12 -9999.9999 +execute my_delete ; +set @arg00= '-9223372036854775808' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -128 +c2 -32768 +c3 -8388608 +c4 -2147483648 +c5 -2147483648 +c6 -9223372036854775808 +c7 -9.22337e+18 +c8 -9.22337203685478e+18 +c9 -9.22337203685478e+18 +c10 -9.22337203685478e+18 +c12 -9999.9999 +execute my_delete ; +set @arg00= 1.11111111111111111111e+50 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 127 +c2 32767 +c3 8388607 +c4 2147483647 +c5 2147483647 +c6 9223372036854775807 +c7 3.40282e+38 +c8 1.11111111111111e+50 +c9 1.11111111111111e+50 +c10 1.11111111111111e+50 +c12 99999.9999 +execute my_delete ; +set @arg00= '1.11111111111111111111e+50' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Warning 1265 Data truncated for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1265 Data truncated for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 1 +c2 1 +c3 1 +c4 1 +c5 1 +c6 1 +c7 3.40282e+38 +c8 1.11111111111111e+50 +c9 1.11111111111111e+50 +c10 1.11111111111111e+50 +c12 99999.9999 +execute my_delete ; +set @arg00= -1.11111111111111111111e+50 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -128 +c2 -32768 +c3 -8388608 +c4 -2147483648 +c5 -2147483648 +c6 -9223372036854775808 +c7 -3.40282e+38 +c8 -1.11111111111111e+50 +c9 -1.11111111111111e+50 +c10 -1.11111111111111e+50 +c12 -9999.9999 +execute my_delete ; +set @arg00= '-1.11111111111111111111e+50' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Warning 1265 Data truncated for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1265 Data truncated for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -1 +c2 -1 +c3 -1 +c4 -1 +c5 -1 +c6 -1 +c7 -3.40282e+38 +c8 -1.11111111111111e+50 +c9 -1.11111111111111e+50 +c10 -1.11111111111111e+50 +c12 -9999.9999 +execute my_delete ; +test_sequence +-- insert into string columns -- +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 +from t9 where c1 >= 20 +order by c1 ; +c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 +20 2 20 20 20 20 20 20 20 20 20 20 +21 2 21 21 21 21 21 21 21 21 21 21 +22 2 22 22 22 22 22 22 22 22 22 22 +23 2 23 23 23 23 23 23 23 23 23 23 +30 3 30 30 30 30 30 30 30 30 30 30 +31 3 31 31 31 31 31 31 31 31 31 31 +32 3 32 32 32 32 32 32 32 32 32 32 +33 3 33 33 33 33 33 33 33 33 33 33 +40 4 40 40 40 40 40 40 40 40 40 40 +41 4 41 41 41 41 41 41 41 41 41 41 +42 4 42 42 42 42 42 42 42 42 42 42 +43 4 43 43 43 43 43 43 43 43 43 43 +50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00 +51 5 51 51 51 51 51 51 51 51 51 51 +52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00 +53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00 +54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00 +55 5 55 55 55 55 55 55 55 55 55 55 +56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00 +57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00 +60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +test_sequence +-- select .. where string column = .. -- +set @arg00= '20'; +select 'true' as found from t9 +where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and +c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and +c27= '20' and c28= '20' and c29= '20' and c30= '20' ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and + c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and + c27= '20' and c28= '20' and c29= '20' and c30= '20'" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and + c21= ? and c22= ? and c23= ? and c25= ? and + c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= CAST('20' as binary); +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20))) += CAST('20' as binary) and c21= CAST('20' as binary) +and c22= CAST('20' as binary) and c23= CAST('20' as binary) and +c24= CAST('20' as binary) and c25= CAST('20' as binary) and +c26= CAST('20' as binary) and c27= CAST('20' as binary) and +c28= CAST('20' as binary) and c29= CAST('20' as binary) and +c30= CAST('20' as binary) ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and +c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20))) + = CAST('20' as binary) and c21= CAST('20' as binary) + and c22= CAST('20' as binary) and c23= CAST('20' as binary) and + c24= CAST('20' as binary) and c25= CAST('20' as binary) and + c26= CAST('20' as binary) and c27= CAST('20' as binary) and + c28= CAST('20' as binary) and c29= CAST('20' as binary) and + c30= CAST('20' as binary)" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and + c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and + c29= ? and c30= ?"; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 20; +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and +c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and +c27= 20 and c28= 20 and c29= 20 and c30= 20 ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and + c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and + c27= 20 and c28= 20 and c29= 20 and c30= 20" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and + c21= ? and c22= ? and c23= ? and c25= ? and + c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 20.0; +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and +c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and +c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and + c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and + c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and + c21= ? and c22= ? and c23= ? and c25= ? and + c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +delete from t9 ; +test_sequence +-- insert into date/time columns -- +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; +c1 c13 c14 c15 c16 c17 +20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +60 NULL NULL 1991-01-01 01:01:01 NULL NULL +61 NULL NULL 1991-01-01 01:01:01 NULL NULL +62 NULL NULL 1991-01-01 01:01:01 NULL NULL +63 NULL NULL 1991-01-01 01:01:01 NULL NULL +71 NULL NULL 1991-01-01 01:01:01 NULL NULL +73 NULL NULL 1991-01-01 01:01:01 NULL NULL +81 NULL NULL 1991-01-01 01:01:01 NULL NULL +83 NULL NULL 1991-01-01 01:01:01 NULL NULL +test_sequence +-- select .. where date/time column = .. -- +set @arg00= '1991-01-01 01:01:01' ; +select 'true' as found from t9 +where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and +c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and +c17= '1991-01-01 01:01:01' ; +found +true +select 'true' as found from t9 +where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00 +and c17= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and + c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and + c17= '1991-01-01 01:01:01'" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; +select 'true' as found from t9 +where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and +c14= CAST('1991-01-01 01:01:01' as datetime) and +c15= CAST('1991-01-01 01:01:01' as datetime) and +c16= CAST('1991-01-01 01:01:01' as datetime) and +c17= CAST('1991-01-01 01:01:01' as datetime) ; +found +true +select 'true' as found from t9 +where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00 +and c17= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and + c14= CAST('1991-01-01 01:01:01' as datetime) and + c15= CAST('1991-01-01 01:01:01' as datetime) and + c16= CAST('1991-01-01 01:01:01' as datetime) and + c17= CAST('1991-01-01 01:01:01' as datetime)" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 1991 ; +select 'true' as found from t9 +where c1= 20 and c17= 1991 ; +found +true +select 'true' as found from t9 +where c1= 20 and c17= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c17= 1991" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c17= ?" ; +execute stmt1 using @arg00 ; +found +true +set @arg00= 1.991e+3 ; +select 'true' as found from t9 +where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ; +found +true +select 'true' as found from t9 +where c1= 20 and abs(c17 - @arg00) < 0.01 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and abs(c17 - ?) < 0.01" ; +execute stmt1 using @arg00 ; +found +true +drop table t1, t1_1, t1_2, +t9_1, t9_2, t9; diff --git a/mysql-test/r/ps_6bdb.result.es b/mysql-test/r/ps_6bdb.result.es new file mode 100644 index 00000000000..7b7f7e23bbf --- /dev/null +++ b/mysql-test/r/ps_6bdb.result.es @@ -0,0 +1,3113 @@ +use test; +drop table if exists t1, t9 ; +create table t1 +( +a int, b varchar(30), +primary key(a) +) engine = 'BDB' ; +create table t9 +( +c1 tinyint, c2 smallint, c3 mediumint, c4 int, +c5 integer, c6 bigint, c7 float, c8 double, +c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), +c13 date, c14 datetime, c15 timestamp(14), c16 time, +c17 year, c18 bit, c19 bool, c20 char, +c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, +c25 blob, c26 text, c27 mediumblob, c28 mediumtext, +c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'), +c32 set('monday', 'tuesday', 'wednesday'), +primary key(c1) +) engine = 'BDB' ; +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +test_sequence +------ simple select tests ------ +prepare stmt1 from ' select * from t9 order by c1 ' ; +execute stmt1; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def test t9 t9 c1 c1 1 4 1 N 49155 0 63 +def test t9 t9 c2 c2 2 6 1 Y 32768 0 63 +def test t9 t9 c3 c3 9 9 1 Y 32768 0 63 +def test t9 t9 c4 c4 3 11 1 Y 32768 0 63 +def test t9 t9 c5 c5 3 11 1 Y 32768 0 63 +def test t9 t9 c6 c6 8 20 1 Y 32768 0 63 +def test t9 t9 c7 c7 4 12 1 Y 32768 31 63 +def test t9 t9 c8 c8 5 22 1 Y 32768 31 63 +def test t9 t9 c9 c9 5 22 1 Y 32768 31 63 +def test t9 t9 c10 c10 5 22 1 Y 32768 31 63 +def test t9 t9 c11 c11 0 9 6 Y 32768 4 63 +def test t9 t9 c12 c12 0 10 6 Y 32768 4 63 +def test t9 t9 c13 c13 10 10 10 Y 128 0 63 +def test t9 t9 c14 c14 12 19 19 Y 128 0 63 +def test t9 t9 c15 c15 7 19 19 N 1249 0 63 +def test t9 t9 c16 c16 11 8 8 Y 128 0 63 +def test t9 t9 c17 c17 13 4 4 Y 32864 0 63 +def test t9 t9 c18 c18 1 1 1 Y 32768 0 63 +def test t9 t9 c19 c19 1 1 1 Y 32768 0 63 +def test t9 t9 c20 c20 254 1 1 Y 0 0 8 +def test t9 t9 c21 c21 253 10 10 Y 0 0 8 +def test t9 t9 c22 c22 253 30 30 Y 0 0 8 +def test t9 t9 c23 c23 252 255 8 Y 144 0 63 +def test t9 t9 c24 c24 252 255 8 Y 16 0 8 +def test t9 t9 c25 c25 252 65535 4 Y 144 0 63 +def test t9 t9 c26 c26 252 65535 4 Y 16 0 8 +def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63 +def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8 +def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63 +def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8 +def test t9 t9 c31 c31 254 5 3 Y 256 0 8 +def test t9 t9 c32 c32 254 24 7 Y 2048 0 8 +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday +set @arg00='SELECT' ; +prepare stmt1 from ' ? a from t1 where a=1 '; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1 +set @arg00=1 ; +select @arg00, b from t1 where a=1 ; +@arg00 b +1 one +prepare stmt1 from ' select ?, b from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +? b +1 one +set @arg00='lion' ; +select @arg00, b from t1 where a=1 ; +@arg00 b +lion one +prepare stmt1 from ' select ?, b from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +? b +lion one +set @arg00=NULL ; +select @arg00, b from t1 where a=1 ; +@arg00 b +NULL one +prepare stmt1 from ' select ?, b from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +? b +NULL one +set @arg00=1 ; +select b, a - @arg00 from t1 where a=1 ; +b a - @arg00 +one 0 +prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +b a - ? +one 0 +set @arg00=null ; +select @arg00 as my_col ; +my_col +NULL +prepare stmt1 from ' select ? as my_col'; +execute stmt1 using @arg00 ; +my_col +NULL +select @arg00 + 1 as my_col ; +my_col +NULL +prepare stmt1 from ' select ? + 1 as my_col'; +execute stmt1 using @arg00 ; +my_col +NULL +select 1 + @arg00 as my_col ; +my_col +NULL +prepare stmt1 from ' select 1 + ? as my_col'; +execute stmt1 using @arg00 ; +my_col +NULL +set @arg00='MySQL' ; +select substr(@arg00,1,2) from t1 where a=1 ; +substr(@arg00,1,2) +My +prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +substr(?,1,2) +My +set @arg00=3 ; +select substr('MySQL',@arg00,5) from t1 where a=1 ; +substr('MySQL',@arg00,5) +SQL +prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +substr('MySQL',?,5) +SQL +select substr('MySQL',1,@arg00) from t1 where a=1 ; +substr('MySQL',1,@arg00) +MyS +prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ; +execute stmt1 using @arg00 ; +substr('MySQL',1,?) +MyS +set @arg00='MySQL' ; +select a , concat(@arg00,b) from t1 order by a; +a concat(@arg00,b) +1 MySQLone +2 MySQLtwo +3 MySQLthree +4 MySQLfour +prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ; +execute stmt1 using @arg00; +a concat(?,b) +1 MySQLone +2 MySQLtwo +3 MySQLthree +4 MySQLfour +select a , concat(b,@arg00) from t1 order by a ; +a concat(b,@arg00) +1 oneMySQL +2 twoMySQL +3 threeMySQL +4 fourMySQL +prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ; +execute stmt1 using @arg00; +a concat(b,?) +1 oneMySQL +2 twoMySQL +3 threeMySQL +4 fourMySQL +set @arg00='MySQL' ; +select group_concat(@arg00,b order by a) from t1 +group by 'a' ; +group_concat(@arg00,b order by a) +MySQLone,MySQLtwo,MySQLthree,MySQLfour +prepare stmt1 from ' select group_concat(?,b order by a) from t1 +group by ''a'' ' ; +execute stmt1 using @arg00; +group_concat(?,b order by a) +MySQLone,MySQLtwo,MySQLthree,MySQLfour +select group_concat(b,@arg00 order by a) from t1 +group by 'a' ; +group_concat(b,@arg00 order by a) +oneMySQL,twoMySQL,threeMySQL,fourMySQL +prepare stmt1 from ' select group_concat(b,? order by a) from t1 +group by ''a'' ' ; +execute stmt1 using @arg00; +group_concat(b,? order by a) +oneMySQL,twoMySQL,threeMySQL,fourMySQL +set @arg00='first' ; +set @arg01='second' ; +set @arg02=NULL; +select @arg00, @arg01 from t1 where a=1 ; +@arg00 @arg01 +first second +prepare stmt1 from ' select ?, ? from t1 where a=1 ' ; +execute stmt1 using @arg00, @arg01 ; +? ? +first second +execute stmt1 using @arg02, @arg01 ; +? ? +NULL second +execute stmt1 using @arg00, @arg02 ; +? ? +first NULL +execute stmt1 using @arg02, @arg02 ; +? ? +NULL NULL +drop table if exists t5 ; +create table t5 (id1 int(11) not null default '0', +value2 varchar(100), value1 varchar(100)) ; +insert into t5 values (1,'hh','hh'),(2,'hh','hh'), +(1,'ii','ii'),(2,'ii','ii') ; +prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ; +set @arg00=1 ; +set @arg01='hh' ; +execute stmt1 using @arg00, @arg01 ; +id1 value1 +1 hh +1 ii +2 hh +drop table t5 ; +drop table if exists t5 ; +create table t5(session_id char(9) not null) ; +insert into t5 values ('abc') ; +prepare stmt1 from ' select * from t5 +where ?=''1111'' and session_id = ''abc'' ' ; +set @arg00='abc' ; +execute stmt1 using @arg00 ; +session_id +set @arg00='1111' ; +execute stmt1 using @arg00 ; +session_id +abc +set @arg00='abc' ; +execute stmt1 using @arg00 ; +session_id +drop table t5 ; +set @arg00='FROM' ; +select a @arg00 t1 where a=1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 t1 where a=1' at line 1 +prepare stmt1 from ' select a ? t1 where a=1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? t1 where a=1' at line 1 +set @arg00='t1' ; +select a from @arg00 where a=1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 where a=1' at line 1 +prepare stmt1 from ' select a from ? where a=1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? where a=1' at line 1 +set @arg00='WHERE' ; +select a from t1 @arg00 a=1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a=1' at line 1 +prepare stmt1 from ' select a from t1 ? a=1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a=1' at line 1 +set @arg00=1 ; +select a FROM t1 where a=@arg00 ; +a +1 +prepare stmt1 from ' select a FROM t1 where a=? ' ; +execute stmt1 using @arg00 ; +a +1 +set @arg00=1000 ; +execute stmt1 using @arg00 ; +a +set @arg00=NULL ; +select a FROM t1 where a=@arg00 ; +a +prepare stmt1 from ' select a FROM t1 where a=? ' ; +execute stmt1 using @arg00 ; +a +set @arg00=4 ; +select a FROM t1 where a=sqrt(@arg00) ; +a +2 +prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ; +execute stmt1 using @arg00 ; +a +2 +set @arg00=NULL ; +select a FROM t1 where a=sqrt(@arg00) ; +a +prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ; +execute stmt1 using @arg00 ; +a +set @arg00=2 ; +set @arg01=3 ; +select a FROM t1 where a in (@arg00,@arg01) order by a; +a +2 +3 +prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a '; +execute stmt1 using @arg00, @arg01; +a +2 +3 +set @arg00= 'one' ; +set @arg01= 'two' ; +set @arg02= 'five' ; +prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ; +execute stmt1 using @arg00, @arg01, @arg02 ; +b +one +two +prepare stmt1 from ' select b FROM t1 where b like ? '; +set @arg00='two' ; +execute stmt1 using @arg00 ; +b +two +set @arg00='tw%' ; +execute stmt1 using @arg00 ; +b +two +set @arg00='%wo' ; +execute stmt1 using @arg00 ; +b +two +set @arg00=null ; +insert into t9 set c1= 0, c5 = NULL ; +select c5 from t9 where c5 > NULL ; +c5 +prepare stmt1 from ' select c5 from t9 where c5 > ? '; +execute stmt1 using @arg00 ; +c5 +select c5 from t9 where c5 < NULL ; +c5 +prepare stmt1 from ' select c5 from t9 where c5 < ? '; +execute stmt1 using @arg00 ; +c5 +select c5 from t9 where c5 = NULL ; +c5 +prepare stmt1 from ' select c5 from t9 where c5 = ? '; +execute stmt1 using @arg00 ; +c5 +select c5 from t9 where c5 <=> NULL ; +c5 +NULL +prepare stmt1 from ' select c5 from t9 where c5 <=> ? '; +execute stmt1 using @arg00 ; +c5 +NULL +delete from t9 where c1= 0 ; +set @arg00='>' ; +select a FROM t1 where a @arg00 1 ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 1' at line 1 +prepare stmt1 from ' select a FROM t1 where a ? 1 ' ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? 1' at line 1 +set @arg00=1 ; +select a,b FROM t1 where a is not NULL +AND b is not NULL group by a - @arg00 ; +a b +1 one +2 two +3 three +4 four +prepare stmt1 from ' select a,b FROM t1 where a is not NULL +AND b is not NULL group by a - ? ' ; +execute stmt1 using @arg00 ; +a b +1 one +2 two +3 three +4 four +set @arg00='two' ; +select a,b FROM t1 where a is not NULL +AND b is not NULL having b <> @arg00 order by a ; +a b +1 one +3 three +4 four +prepare stmt1 from ' select a,b FROM t1 where a is not NULL +AND b is not NULL having b <> ? order by a ' ; +execute stmt1 using @arg00 ; +a b +1 one +3 three +4 four +set @arg00=1 ; +select a,b FROM t1 where a is not NULL +AND b is not NULL order by a - @arg00 ; +a b +1 one +2 two +3 three +4 four +prepare stmt1 from ' select a,b FROM t1 where a is not NULL +AND b is not NULL order by a - ? ' ; +execute stmt1 using @arg00 ; +a b +1 one +2 two +3 three +4 four +set @arg00=2 ; +select a,b from t1 order by 2 ; +a b +4 four +1 one +3 three +2 two +prepare stmt1 from ' select a,b from t1 +order by ? '; +execute stmt1 using @arg00; +a b +4 four +1 one +3 three +2 two +set @arg00=1 ; +execute stmt1 using @arg00; +a b +1 one +2 two +3 three +4 four +set @arg00=0 ; +execute stmt1 using @arg00; +ERROR 42S22: Unknown column '?' in 'order clause' +set @arg00=1; +prepare stmt1 from ' select a,b from t1 order by a +limit 1 '; +execute stmt1 ; +a b +1 one +prepare stmt1 from ' select a,b from t1 +limit ? '; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2 +set @arg00='b' ; +set @arg01=0 ; +set @arg02=2 ; +set @arg03=2 ; +select sum(a), @arg00 from t1 where a > @arg01 +and b is not null group by substr(b,@arg02) +having sum(a) <> @arg03 ; +sum(a) @arg00 +3 b +1 b +4 b +prepare stmt1 from ' select sum(a), ? from t1 where a > ? +and b is not null group by substr(b,?) +having sum(a) <> ? '; +execute stmt1 using @arg00, @arg01, @arg02, @arg03; +sum(a) ? +3 b +1 b +4 b +test_sequence +------ join tests ------ +select first.a as a1, second.a as a2 +from t1 first, t1 second +where first.a = second.a order by a1 ; +a1 a2 +1 1 +2 2 +3 3 +4 4 +prepare stmt1 from ' select first.a as a1, second.a as a2 + from t1 first, t1 second + where first.a = second.a order by a1 '; +execute stmt1 ; +a1 a2 +1 1 +2 2 +3 3 +4 4 +set @arg00='ABC'; +set @arg01='two'; +set @arg02='one'; +select first.a, @arg00, second.a FROM t1 first, t1 second +where @arg01 = first.b or first.a = second.a or second.b = @arg02 +order by second.a, first.a; +a @arg00 a +1 ABC 1 +2 ABC 1 +3 ABC 1 +4 ABC 1 +2 ABC 2 +2 ABC 3 +3 ABC 3 +2 ABC 4 +4 ABC 4 +prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second + where ? = first.b or first.a = second.a or second.b = ? + order by second.a, first.a'; +execute stmt1 using @arg00, @arg01, @arg02; +a ? a +1 ABC 1 +2 ABC 1 +3 ABC 1 +4 ABC 1 +2 ABC 2 +2 ABC 3 +3 ABC 3 +2 ABC 4 +4 ABC 4 +drop table if exists t2 ; +create table t2 as select * from t1 ; +set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ; +set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ; +set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ; +set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ; +set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ; +set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ; +set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ; +set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ; +set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ; +the join statement is: +SELECT * FROM t2 right join t1 using(a) order by t2.a +prepare stmt1 from @query9 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 natural right join t1 order by t2.a +prepare stmt1 from @query8 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a +prepare stmt1 from @query7 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 left join t1 using(a) order by t2.a +prepare stmt1 from @query6 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 natural left join t1 order by t2.a +prepare stmt1 from @query5 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a +prepare stmt1 from @query4 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 join t1 using(a) order by t2.a +prepare stmt1 from @query3 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +the join statement is: +SELECT * FROM t2 natural join t1 order by t2.a +prepare stmt1 from @query2 ; +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +the join statement is: +SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a +prepare stmt1 from @query1 ; +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +execute stmt1 ; +a b a b +1 one 1 one +2 two 2 two +3 three 3 three +4 four 4 four +drop table t2 ; +test_sequence +------ subquery tests ------ +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = ''two'') '; +execute stmt1 ; +a b +2 two +set @arg00='two' ; +select a, b FROM t1 outer_table where +a = (select a from t1 where b = 'two' ) and b=@arg00 ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = ''two'') and b=? '; +execute stmt1 using @arg00; +a b +2 two +set @arg00='two' ; +select a, b FROM t1 outer_table where +a = (select a from t1 where b = @arg00 ) and b='two' ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = ? ) and b=''two'' ' ; +execute stmt1 using @arg00; +a b +2 two +set @arg00=3 ; +set @arg01='three' ; +select a,b FROM t1 where (a,b) in (select 3, 'three'); +a b +3 three +select a FROM t1 where (a,b) in (select @arg00,@arg01); +a +3 +prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) '; +execute stmt1 using @arg00, @arg01; +a +3 +set @arg00=1 ; +set @arg01='two' ; +set @arg02=2 ; +set @arg03='two' ; +select a, @arg00, b FROM t1 outer_table where +b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ; +a @arg00 b +2 1 two +prepare stmt1 from ' select a, ?, b FROM t1 outer_table where + b=? and a = (select ? from t1 where b = ? ) ' ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; +a ? b +2 1 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = outer_table.b ) order by a '; +execute stmt1 ; +a b +1 one +2 two +3 three +4 four +prepare stmt1 from ' SELECT a as ccc from t1 where a+1= + (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; +execute stmt1 ; +ccc +1 +deallocate prepare stmt1 ; +prepare stmt1 from ' SELECT a as ccc from t1 where a+1= + (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; +execute stmt1 ; +ccc +1 +deallocate prepare stmt1 ; +prepare stmt1 from ' SELECT a as ccc from t1 where a+1= + (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; +execute stmt1 ; +ccc +1 +deallocate prepare stmt1 ; +set @arg00='two' ; +select a, b FROM t1 outer_table where +a = (select a from t1 where b = outer_table.b ) and b=@arg00 ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where b = outer_table.b) and b=? '; +execute stmt1 using @arg00; +a b +2 two +set @arg00=2 ; +select a, b FROM t1 outer_table where +a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ; +execute stmt1 using @arg00; +a b +2 two +set @arg00=2 ; +select a, b FROM t1 outer_table where +a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ; +a b +2 two +prepare stmt1 from ' select a, b FROM t1 outer_table where + a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ; +execute stmt1 using @arg00; +a b +2 two +set @arg00=1 ; +set @arg01='two' ; +set @arg02=2 ; +set @arg03='two' ; +select a, @arg00, b FROM t1 outer_table where +b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03 +and outer_table.a=a ) ; +a @arg00 b +2 1 two +prepare stmt1 from ' select a, ?, b FROM t1 outer_table where + b=? and a = (select ? from t1 where outer_table.b = ? + and outer_table.a=a ) ' ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; +a ? b +2 1 two +set @arg00=1 ; +set @arg01=0 ; +select a, @arg00 +from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2 +where a=@arg01; +a @arg00 +0 1 +prepare stmt1 from ' select a, ? + from ( select a - ? as a from t1 where a=? ) as t2 + where a=? '; +execute stmt1 using @arg00, @arg00, @arg00, @arg01 ; +a ? +0 1 +drop table if exists t2 ; +create table t2 as select * from t1; +prepare stmt1 from ' select a in (select a from t2) from t1 ' ; +execute stmt1 ; +a in (select a from t2) +1 +1 +1 +1 +drop table if exists t5, t6, t7 ; +create table t5 (a int , b int) ; +create table t6 like t5 ; +create table t7 like t5 ; +insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7), +(2, -1), (3, 10) ; +insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ; +insert into t7 values (3, 3), (2, 2), (1, 1) ; +prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) from t7 ' ; +execute stmt1 ; +a (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) +3 1 +2 2 +1 2 +execute stmt1 ; +a (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) +3 1 +2 2 +1 2 +execute stmt1 ; +a (select count(distinct t5.b) as sum from t5, t6 + where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b + group by t5.a order by sum limit 1) +3 1 +2 2 +1 2 +drop table t5, t6, t7 ; +drop table if exists t2 ; +create table t2 as select * from t9; +set @stmt= ' SELECT + (SELECT SUM(c1 + c12 + 0.0) FROM t2 + where (t9.c2 - 0e-3) = t2.c2 + GROUP BY t9.c15 LIMIT 1) as scalar_s, + exists (select 1.0e+0 from t2 + where t2.c3 * 9.0000000000 = t9.c4) as exists_s, + c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, + (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s +FROM t9, +(select c25 x, c32 y from t2) tt WHERE x = c25 ' ; +prepare stmt1 from @stmt ; +execute stmt1 ; +execute stmt1 ; +set @stmt= concat('explain ',@stmt); +prepare stmt1 from @stmt ; +execute stmt1 ; +execute stmt1 ; +set @stmt= ' SELECT + (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2 + GROUP BY t9.c15 LIMIT 1) as scalar_s, + exists (select ? from t2 + where t2.c3*?=t9.c4) as exists_s, + c5*? in (select c6+? from t2) as in_s, + (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s +FROM t9, +(select c25 x, c32 y from t2) tt WHERE x =c25 ' ; +set @arg00= 0.0 ; +set @arg01= 0e-3 ; +set @arg02= 1.0e+0 ; +set @arg03= 9.0000000000 ; +set @arg04= 4 ; +set @arg05= 0.3e+1 ; +set @arg06= 4 ; +set @arg07= 4 ; +set @arg08= 4.0 ; +set @arg09= 40e-1 ; +prepare stmt1 from @stmt ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +set @stmt= concat('explain ',@stmt); +prepare stmt1 from @stmt ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, +@arg07, @arg08, @arg09 ; +drop table t2 ; +select 1 < (select a from t1) ; +ERROR 21000: Subquery returns more than 1 row +prepare stmt1 from ' select 1 < (select a from t1) ' ; +execute stmt1 ; +ERROR 21000: Subquery returns more than 1 row +select 1 as my_col ; +my_col +1 +test_sequence +------ union tests ------ +prepare stmt1 from ' select a FROM t1 where a=1 + union distinct + select a FROM t1 where a=1 '; +execute stmt1 ; +a +1 +execute stmt1 ; +a +1 +prepare stmt1 from ' select a FROM t1 where a=1 + union all + select a FROM t1 where a=1 '; +execute stmt1 ; +a +1 +1 +prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ; +ERROR 21000: The used SELECT statements have a different number of columns +set @arg00=1 ; +select @arg00 FROM t1 where a=1 +union distinct +select 1 FROM t1 where a=1; +@arg00 +1 +prepare stmt1 from ' select ? FROM t1 where a=1 + union distinct + select 1 FROM t1 where a=1 ' ; +execute stmt1 using @arg00; +? +1 +set @arg00=1 ; +select 1 FROM t1 where a=1 +union distinct +select @arg00 FROM t1 where a=1; +1 +1 +prepare stmt1 from ' select 1 FROM t1 where a=1 + union distinct + select ? FROM t1 where a=1 ' ; +execute stmt1 using @arg00; +1 +1 +set @arg00='a' ; +select @arg00 FROM t1 where a=1 +union distinct +select @arg00 FROM t1 where a=1; +@arg00 +a +prepare stmt1 from ' select ? FROM t1 where a=1 + union distinct + select ? FROM t1 where a=1 '; +execute stmt1 using @arg00, @arg00; +? +a +prepare stmt1 from ' select ? + union distinct + select ? '; +execute stmt1 using @arg00, @arg00; +? +a +set @arg00='a' ; +set @arg01=1 ; +set @arg02='a' ; +set @arg03=2 ; +select @arg00 FROM t1 where a=@arg01 +union distinct +select @arg02 FROM t1 where a=@arg03; +@arg00 +a +prepare stmt1 from ' select ? FROM t1 where a=? + union distinct + select ? FROM t1 where a=? ' ; +execute stmt1 using @arg00, @arg01, @arg02, @arg03; +? +a +set @arg00=1 ; +prepare stmt1 from ' select sum(a) + 200, ? from t1 +union distinct +select sum(a) + 200, 1 from t1 +group by b ' ; +execute stmt1 using @arg00; +sum(a) + 200 ? +210 1 +204 1 +201 1 +203 1 +202 1 +set @Oporto='Oporto' ; +set @Lisboa='Lisboa' ; +set @0=0 ; +set @1=1 ; +set @2=2 ; +set @3=3 ; +set @4=4 ; +select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ; +@Oporto @Lisboa @0 @1 @2 @3 @4 +Oporto Lisboa 0 1 2 3 4 +select sum(a) + 200 as the_sum, @Oporto as the_town from t1 +group by b +union distinct +select sum(a) + 200, @Lisboa from t1 +group by b ; +the_sum the_town +204 Oporto +201 Oporto +203 Oporto +202 Oporto +204 Lisboa +201 Lisboa +203 Lisboa +202 Lisboa +prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 + group by b + union distinct + select sum(a) + 200, ? from t1 + group by b ' ; +execute stmt1 using @Oporto, @Lisboa; +the_sum the_town +204 Oporto +201 Oporto +203 Oporto +202 Oporto +204 Lisboa +201 Lisboa +203 Lisboa +202 Lisboa +select sum(a) + 200 as the_sum, @Oporto as the_town from t1 +where a > @1 +group by b +union distinct +select sum(a) + 200, @Lisboa from t1 +where a > @2 +group by b ; +the_sum the_town +204 Oporto +203 Oporto +202 Oporto +204 Lisboa +203 Lisboa +prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 + where a > ? + group by b + union distinct + select sum(a) + 200, ? from t1 + where a > ? + group by b ' ; +execute stmt1 using @Oporto, @1, @Lisboa, @2; +the_sum the_town +204 Oporto +203 Oporto +202 Oporto +204 Lisboa +203 Lisboa +select sum(a) + 200 as the_sum, @Oporto as the_town from t1 +where a > @1 +group by b +having avg(a) > @2 +union distinct +select sum(a) + 200, @Lisboa from t1 +where a > @2 +group by b +having avg(a) > @3; +the_sum the_town +204 Oporto +203 Oporto +204 Lisboa +prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 + where a > ? + group by b + having avg(a) > ? + union distinct + select sum(a) + 200, ? from t1 + where a > ? + group by b + having avg(a) > ? '; +execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3; +the_sum the_town +204 Oporto +203 Oporto +204 Lisboa +test_sequence +------ explain select tests ------ +prepare stmt1 from ' explain select * from t9 ' ; +execute stmt1; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def id 8 3 1 N 32801 0 8 +def select_type 253 19 6 N 1 31 33 +def table 253 64 2 N 1 31 33 +def type 253 10 3 N 1 31 33 +def possible_keys 253 4096 0 Y 0 31 33 +def key 253 64 0 Y 0 31 33 +def key_len 8 3 0 Y 32800 0 8 +def ref 253 1024 0 Y 0 31 33 +def rows 8 10 1 N 32801 0 8 +def Extra 253 255 0 N 1 31 33 +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t9 ALL NULL NULL NULL NULL 3 +test_sequence +------ delete tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +prepare stmt1 from 'delete from t1 where a=2' ; +execute stmt1; +select a,b from t1 where a=2; +a b +execute stmt1; +insert into t1 values(0,NULL); +set @arg00=NULL; +prepare stmt1 from 'delete from t1 where b=?' ; +execute stmt1 using @arg00; +select a,b from t1 where b is NULL ; +a b +0 NULL +set @arg00='one'; +execute stmt1 using @arg00; +select a,b from t1 where b=@arg00; +a b +prepare stmt1 from 'truncate table t1' ; +ERROR HY000: This command is not supported in the prepared statement protocol yet +test_sequence +------ update tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ; +execute stmt1; +select a,b from t1 where a=2; +a b +2 a=two +execute stmt1; +select a,b from t1 where a=2; +a b +2 a=two +set @arg00=NULL; +prepare stmt1 from 'update t1 set b=? where a=2' ; +execute stmt1 using @arg00; +select a,b from t1 where a=2; +a b +2 NULL +set @arg00='two'; +execute stmt1 using @arg00; +select a,b from t1 where a=2; +a b +2 two +set @arg00=2; +prepare stmt1 from 'update t1 set b=NULL where a=?' ; +execute stmt1 using @arg00; +select a,b from t1 where a=@arg00; +a b +2 NULL +update t1 set b='two' where a=@arg00; +set @arg00=2000; +execute stmt1 using @arg00; +select a,b from t1 where a=@arg00; +a b +set @arg00=2; +set @arg01=22; +prepare stmt1 from 'update t1 set a=? where a=?' ; +execute stmt1 using @arg00, @arg00; +select a,b from t1 where a=@arg00; +a b +2 two +execute stmt1 using @arg01, @arg00; +select a,b from t1 where a=@arg01; +a b +22 two +execute stmt1 using @arg00, @arg01; +select a,b from t1 where a=@arg00; +a b +2 two +set @arg00=NULL; +set @arg01=2; +execute stmt1 using @arg00, @arg01; +Warnings: +Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1 +select a,b from t1 order by a; +a b +0 two +1 one +3 three +4 four +set @arg00=0; +execute stmt1 using @arg01, @arg00; +select a,b from t1 order by a; +a b +1 one +2 two +3 three +4 four +set @arg00=23; +set @arg01='two'; +set @arg02=2; +set @arg03='two'; +set @arg04=2; +drop table if exists t2; +create table t2 as select a,b from t1 ; +prepare stmt1 from 'update t1 set a=? where b=? + and a in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 where a = @arg00 ; +a b +23 two +prepare stmt1 from 'update t1 set a=? where b=? + and a not in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 order by a ; +a b +1 one +2 two +3 three +4 four +drop table t2 ; +create table t2 +( +a int, b varchar(30), +primary key(a) +) engine = 'BDB' ; +insert into t2(a,b) select a, b from t1 ; +prepare stmt1 from 'update t1 set a=? where b=? + and a in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 where a = @arg00 ; +a b +23 two +prepare stmt1 from 'update t1 set a=? where b=? + and a not in (select ? from t2 + where b = ? or a = ?)'; +execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select a,b from t1 order by a ; +a b +1 one +2 two +3 three +4 four +drop table t2 ; +set @arg00=1; +prepare stmt1 from 'update t1 set b=''bla'' +where a=2 +limit 1'; +execute stmt1 ; +select a,b from t1 where b = 'bla' ; +a b +2 bla +prepare stmt1 from 'update t1 set b=''bla'' +where a=2 +limit ?'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3 +test_sequence +------ insert tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +prepare stmt1 from 'insert into t1 values(5, ''five'' )'; +execute stmt1; +select a,b from t1 where a = 5; +a b +5 five +set @arg00='six' ; +prepare stmt1 from 'insert into t1 values(6, ? )'; +execute stmt1 using @arg00; +select a,b from t1 where b = @arg00; +a b +6 six +execute stmt1 using @arg00; +ERROR 23000: Duplicate entry '6' for key 1 +set @arg00=NULL ; +prepare stmt1 from 'insert into t1 values(0, ? )'; +execute stmt1 using @arg00; +select a,b from t1 where b is NULL; +a b +0 NULL +set @arg00=8 ; +set @arg01='eight' ; +prepare stmt1 from 'insert into t1 values(?, ? )'; +execute stmt1 using @arg00, @arg01 ; +select a,b from t1 where b = @arg01; +a b +8 eight +set @NULL= null ; +set @arg00= 'abc' ; +execute stmt1 using @NULL, @NULL ; +ERROR 23000: Column 'a' cannot be null +execute stmt1 using @NULL, @NULL ; +ERROR 23000: Column 'a' cannot be null +execute stmt1 using @NULL, @arg00 ; +ERROR 23000: Column 'a' cannot be null +execute stmt1 using @NULL, @arg00 ; +ERROR 23000: Column 'a' cannot be null +set @arg01= 10000 + 2 ; +execute stmt1 using @arg01, @arg00 ; +set @arg01= 10000 + 1 ; +execute stmt1 using @arg01, @arg00 ; +select * from t1 where a > 10000 order by a ; +a b +10001 abc +10002 abc +delete from t1 where a > 10000 ; +set @arg01= 10000 + 2 ; +execute stmt1 using @arg01, @NULL ; +set @arg01= 10000 + 1 ; +execute stmt1 using @arg01, @NULL ; +select * from t1 where a > 10000 order by a ; +a b +10001 NULL +10002 NULL +delete from t1 where a > 10000 ; +set @arg01= 10000 + 10 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 9 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 8 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 7 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 6 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 5 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 4 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 3 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 2 ; +execute stmt1 using @arg01, @arg01 ; +set @arg01= 10000 + 1 ; +execute stmt1 using @arg01, @arg01 ; +select * from t1 where a > 10000 order by a ; +a b +10001 10001 +10002 10002 +10003 10003 +10004 10004 +10005 10005 +10006 10006 +10007 10007 +10008 10008 +10009 10009 +10010 10010 +delete from t1 where a > 10000 ; +set @arg00=81 ; +set @arg01='8-1' ; +set @arg02=82 ; +set @arg03='8-2' ; +prepare stmt1 from 'insert into t1 values(?,?),(?,?)'; +execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; +select a,b from t1 where a in (@arg00,@arg02) ; +a b +81 8-1 +82 8-2 +set @arg00=9 ; +set @arg01='nine' ; +prepare stmt1 from 'insert into t1 set a=?, b=? '; +execute stmt1 using @arg00, @arg01 ; +select a,b from t1 where a = @arg00 ; +a b +9 nine +set @arg00=6 ; +set @arg01=1 ; +prepare stmt1 from 'insert into t1 set a=?, b=''sechs'' + on duplicate key update a=a + ?, b=concat(b,''modified'') '; +execute stmt1 using @arg00, @arg01; +select * from t1 order by a; +a b +0 NULL +1 one +2 two +3 three +4 four +5 five +7 sixmodified +8 eight +9 nine +81 8-1 +82 8-2 +set @arg00=81 ; +set @arg01=1 ; +execute stmt1 using @arg00, @arg01; +ERROR 23000: Duplicate entry '82' for key 1 +drop table if exists t2 ; +create table t2 (id int auto_increment primary key) +ENGINE= 'BDB' ; +prepare stmt1 from ' select last_insert_id() ' ; +insert into t2 values (NULL) ; +execute stmt1 ; +last_insert_id() +1 +insert into t2 values (NULL) ; +execute stmt1 ; +last_insert_id() +2 +drop table t2 ; +set @1000=1000 ; +set @x1000_2="x1000_2" ; +set @x1000_3="x1000_3" ; +set @x1000="x1000" ; +set @1100=1100 ; +set @x1100="x1100" ; +set @100=100 ; +set @updated="updated" ; +insert into t1 values(1000,'x1000_1') ; +insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3) +on duplicate key update a = a + @100, b = concat(b,@updated) ; +select a,b from t1 where a >= 1000 order by a ; +a b +1000 x1000_3 +1100 x1000_1updated +delete from t1 where a >= 1000 ; +insert into t1 values(1000,'x1000_1') ; +prepare stmt1 from ' insert into t1 values(?,?),(?,?) + on duplicate key update a = a + ?, b = concat(b,?) '; +execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ; +select a,b from t1 where a >= 1000 order by a ; +a b +1000 x1000_3 +1100 x1000_1updated +delete from t1 where a >= 1000 ; +insert into t1 values(1000,'x1000_1') ; +execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ; +select a,b from t1 where a >= 1000 order by a ; +a b +1200 x1000_1updatedupdated +delete from t1 where a >= 1000 ; +prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' '; +execute stmt1; +execute stmt1; +execute stmt1; +test_sequence +------ multi table tests ------ +delete from t1 ; +delete from t9 ; +insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ; +insert into t9 (c1,c21) +values (1, 'one'), (2, 'two'), (3, 'three') ; +prepare stmt_delete from " delete t1, t9 + from t1, t9 where t1.a=t9.c1 and t1.b='updated' "; +prepare stmt_update from " update t1, t9 + set t1.b='updated', t9.c21='updated' + where t1.a=t9.c1 and t1.a=? "; +prepare stmt_select1 from " select a, b from t1 order by a" ; +prepare stmt_select2 from " select c1, c21 from t9 order by c1" ; +set @arg00= 1 ; +execute stmt_update using @arg00 ; +execute stmt_delete ; +execute stmt_select1 ; +a b +2 two +3 three +execute stmt_select2 ; +c1 c21 +2 two +3 three +set @arg00= @arg00 + 1 ; +execute stmt_update using @arg00 ; +execute stmt_delete ; +execute stmt_select1 ; +a b +3 three +execute stmt_select2 ; +c1 c21 +3 three +set @arg00= @arg00 + 1 ; +execute stmt_update using @arg00 ; +execute stmt_delete ; +execute stmt_select1 ; +a b +execute stmt_select2 ; +c1 c21 +set @arg00= @arg00 + 1 ; +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +insert into t1 values(0,NULL) ; +set @duplicate='duplicate ' ; +set @1000=1000 ; +set @5=5 ; +select a,b from t1 where a < 5 order by a ; +a b +0 NULL +1 one +2 two +3 three +4 four +insert into t1 select a + @1000, concat(@duplicate,b) from t1 +where a < @5 ; +affected rows: 5 +info: Records: 5 Duplicates: 0 Warnings: 0 +select a,b from t1 where a >= 1000 order by a ; +a b +1000 NULL +1001 duplicate one +1002 duplicate two +1003 duplicate three +1004 duplicate four +delete from t1 where a >= 1000 ; +prepare stmt1 from ' insert into t1 select a + ?, concat(?,b) from t1 +where a < ? ' ; +execute stmt1 using @1000, @duplicate, @5; +affected rows: 5 +info: Records: 5 Duplicates: 0 Warnings: 0 +select a,b from t1 where a >= 1000 order by a ; +a b +1000 NULL +1001 duplicate one +1002 duplicate two +1003 duplicate three +1004 duplicate four +delete from t1 where a >= 1000 ; +set @float=1.00; +set @five='five' ; +drop table if exists t2; +create table t2 like t1 ; +insert into t2 (b,a) +select @duplicate, sum(first.a) from t1 first, t1 second +where first.a <> @5 and second.b = first.b +and second.b <> @five +group by second.b +having sum(second.a) > @2 +union +select b, a + @100 from t1 +where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b +from t1); +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 +select a,b from t2 order by a ; +a b +3 duplicate +4 duplicate +103 three +delete from t2 ; +prepare stmt1 from ' insert into t2 (b,a) +select ?, sum(first.a) + from t1 first, t1 second + where first.a <> ? and second.b = first.b and second.b <> ? + group by second.b + having sum(second.a) > ? +union +select b, a + ? from t1 + where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b + from t1 ) ' ; +execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ; +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 +select a,b from t2 order by a ; +a b +3 duplicate +4 duplicate +103 three +drop table t2; +drop table if exists t5 ; +set @arg01= 8; +set @arg02= 8.0; +set @arg03= 80.00000000000e-1; +set @arg04= 'abc' ; +set @arg05= CAST('abc' as binary) ; +set @arg06= '1991-08-05' ; +set @arg07= CAST('1991-08-05' as date); +set @arg08= '1991-08-05 01:01:01' ; +set @arg09= CAST('1991-08-05 01:01:01' as datetime) ; +set @arg10= unix_timestamp('1991-01-01 01:01:01'); +set @arg11= YEAR('1991-01-01 01:01:01'); +set @arg12= 8 ; +set @arg12= NULL ; +set @arg13= 8.0 ; +set @arg13= NULL ; +set @arg14= 'abc'; +set @arg14= NULL ; +set @arg15= CAST('abc' as binary) ; +set @arg15= NULL ; +create table t5 as select +8 as const01, @arg01 as param01, +8.0 as const02, @arg02 as param02, +80.00000000000e-1 as const03, @arg03 as param03, +'abc' as const04, @arg04 as param04, +CAST('abc' as binary) as const05, @arg05 as param05, +'1991-08-05' as const06, @arg06 as param06, +CAST('1991-08-05' as date) as const07, @arg07 as param07, +'1991-08-05 01:01:01' as const08, @arg08 as param08, +CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09, +unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10, +YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11, +NULL as const12, @arg12 as param12, +@arg13 as param13, +@arg14 as param14, +@arg15 as param15; +show create table t5 ; +Table Create Table +t5 CREATE TABLE `t5` ( + `const01` bigint(1) NOT NULL default '0', + `param01` bigint(20) default NULL, + `const02` double(3,1) NOT NULL default '0.0', + `param02` double default NULL, + `const03` double NOT NULL default '0', + `param03` double default NULL, + `const04` char(3) NOT NULL default '', + `param04` longtext, + `const05` binary(3) NOT NULL default '', + `param05` longblob, + `const06` varchar(10) NOT NULL default '', + `param06` longtext, + `const07` date default NULL, + `param07` longblob, + `const08` varchar(19) NOT NULL default '', + `param08` longtext, + `const09` datetime default NULL, + `param09` longblob, + `const10` int(10) NOT NULL default '0', + `param10` bigint(20) default NULL, + `const11` int(4) default NULL, + `param11` bigint(20) default NULL, + `const12` binary(0) default NULL, + `param12` bigint(20) default NULL, + `param13` double default NULL, + `param14` longtext, + `param15` longblob +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t5 ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def test t5 t5 const01 const01 8 1 1 N 32769 0 63 +def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 +def test t5 t5 const02 const02 5 3 3 N 32769 1 63 +def test t5 t5 param02 param02 5 20 1 Y 32768 31 63 +def test t5 t5 const03 const03 5 23 1 N 32769 31 63 +def test t5 t5 param03 param03 5 20 1 Y 32768 31 63 +def test t5 t5 const04 const04 254 3 3 N 1 0 8 +def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8 +def test t5 t5 const05 const05 254 3 3 N 129 0 63 +def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63 +def test t5 t5 const06 const06 253 10 10 N 1 0 8 +def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8 +def test t5 t5 const07 const07 10 10 10 Y 128 0 63 +def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63 +def test t5 t5 const08 const08 253 19 19 N 1 0 8 +def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8 +def test t5 t5 const09 const09 12 19 19 Y 128 0 63 +def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63 +def test t5 t5 const10 const10 3 10 9 N 32769 0 63 +def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 +def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 +def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 +def test t5 t5 const12 const12 254 0 0 Y 128 0 63 +def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 +def test t5 t5 param13 param13 5 20 0 Y 32768 31 63 +def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8 +def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63 +const01 8 +param01 8 +const02 8.0 +param02 8 +const03 8 +param03 8 +const04 abc +param04 abc +const05 abc +param05 abc +const06 1991-08-05 +param06 1991-08-05 +const07 1991-08-05 +param07 1991-08-05 +const08 1991-08-05 01:01:01 +param08 1991-08-05 01:01:01 +const09 1991-08-05 01:01:01 +param09 1991-08-05 01:01:01 +const10 662680861 +param10 662680861 +const11 1991 +param11 1991 +const12 NULL +param12 NULL +param13 NULL +param14 NULL +param15 NULL +drop table t5 ; +test_sequence +------ data type conversion tests ------ +delete from t1 ; +insert into t1 values (1,'one'); +insert into t1 values (2,'two'); +insert into t1 values (3,'three'); +insert into t1 values (4,'four'); +commit ; +delete from t9 ; +insert into t9 +set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, +c10= 1, c11= 1, c12 = 1, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=true, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; +insert into t9 +set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, +c10= 9, c11= 9, c12 = 9, +c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', +c16= '11:11:11', c17= '2004', +c18= 1, c19=false, c20= 'a', c21= '123456789a', +c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', +c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', +c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; +commit ; +insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ; +select * from t9 order by c1 ; +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday +test_sequence +------ select @parameter:= column ------ +prepare full_info from "select @arg01, @arg02, @arg03, @arg04, + @arg05, @arg06, @arg07, @arg08, + @arg09, @arg10, @arg11, @arg12, + @arg13, @arg14, @arg15, @arg16, + @arg17, @arg18, @arg19, @arg20, + @arg21, @arg22, @arg23, @arg24, + @arg25, @arg26, @arg27, @arg28, + @arg29, @arg30, @arg31, @arg32" ; +select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, +@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, +@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, +@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, +@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, +@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, +@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, +@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 +from t9 where c1= 1 ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, +@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, +@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, +@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, +@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, +@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, +@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, +@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 +from t9 where c1= 0 ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select + @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, + @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, + @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, + @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, + @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, + @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, + @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, + @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 +from t9 where c1= ?" ; +set @my_key= 1 ; +execute stmt1 using @my_key ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +set @my_key= 0 ; +execute stmt1 using @my_key ; +@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':= c1 from t9 where c1= 1' at line 1 +test_sequence +------ select column, .. into @parm,.. ------ +select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, +c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, +c25, c26, c27, c28, c29, c30, c31, c32 +into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, +@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, +@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, +@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 +from t9 where c1= 1 ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, +c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, +c25, c26, c27, c28, c29, c30, c31, c32 +into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, +@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, +@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, +@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 +from t9 where c1= 0 ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, + c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, + c25, c26, c27, c28, c29, c30, c31, c32 +into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, + @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, + @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, + @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 +from t9 where c1= ?" ; +set @my_key= 1 ; +execute stmt1 using @my_key ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 1 Y 128 31 63 +def @arg03 254 20 1 Y 128 31 63 +def @arg04 254 20 1 Y 128 31 63 +def @arg05 254 20 1 Y 128 31 63 +def @arg06 254 20 1 Y 128 31 63 +def @arg07 254 20 1 Y 128 31 63 +def @arg08 254 20 1 Y 128 31 63 +def @arg09 254 20 1 Y 128 31 63 +def @arg10 254 20 1 Y 128 31 63 +def @arg11 254 20 1 Y 128 31 63 +def @arg12 254 20 1 Y 128 31 63 +def @arg13 254 8192 10 Y 128 31 63 +def @arg14 254 8192 19 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 8 Y 128 31 63 +def @arg17 254 20 4 Y 128 31 63 +def @arg18 254 20 1 Y 128 31 63 +def @arg19 254 20 1 Y 128 31 63 +def @arg20 254 8192 1 Y 0 31 8 +def @arg21 254 8192 10 Y 0 31 8 +def @arg22 254 8192 30 Y 0 31 8 +def @arg23 254 8192 8 Y 128 31 63 +def @arg24 254 8192 8 Y 0 31 8 +def @arg25 254 8192 4 Y 128 31 63 +def @arg26 254 8192 4 Y 0 31 8 +def @arg27 254 8192 10 Y 128 31 63 +def @arg28 254 8192 10 Y 0 31 8 +def @arg29 254 8192 8 Y 128 31 63 +def @arg30 254 8192 8 Y 0 31 8 +def @arg31 254 8192 3 Y 0 31 8 +def @arg32 254 8192 6 Y 128 31 63 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday +set @my_key= 0 ; +execute stmt1 using @my_key ; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 254 20 1 Y 128 31 63 +def @arg02 254 20 0 Y 128 31 63 +def @arg03 254 20 0 Y 128 31 63 +def @arg04 254 20 0 Y 128 31 63 +def @arg05 254 20 0 Y 128 31 63 +def @arg06 254 20 0 Y 128 31 63 +def @arg07 254 20 0 Y 128 31 63 +def @arg08 254 20 0 Y 128 31 63 +def @arg09 254 20 0 Y 128 31 63 +def @arg10 254 20 0 Y 128 31 63 +def @arg11 254 20 0 Y 128 31 63 +def @arg12 254 20 0 Y 128 31 63 +def @arg13 254 8192 0 Y 128 31 63 +def @arg14 254 8192 0 Y 128 31 63 +def @arg15 254 8192 19 Y 128 31 63 +def @arg16 254 8192 0 Y 128 31 63 +def @arg17 254 20 0 Y 128 31 63 +def @arg18 254 20 0 Y 128 31 63 +def @arg19 254 20 0 Y 128 31 63 +def @arg20 254 8192 0 Y 0 31 8 +def @arg21 254 8192 0 Y 0 31 8 +def @arg22 254 8192 0 Y 0 31 8 +def @arg23 254 8192 0 Y 128 31 63 +def @arg24 254 8192 0 Y 0 31 8 +def @arg25 254 8192 0 Y 128 31 63 +def @arg26 254 8192 0 Y 0 31 8 +def @arg27 254 8192 0 Y 128 31 63 +def @arg28 254 8192 0 Y 0 31 8 +def @arg29 254 8192 0 Y 128 31 63 +def @arg30 254 8192 0 Y 0 31 8 +def @arg31 254 8192 0 Y 0 31 8 +def @arg32 254 8192 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t9 where c1= 1' at line 1 +test_sequence +-- insert into numeric columns -- +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ; +set @arg00= 21 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ; +execute stmt1 ; +set @arg00= 23; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, +30.0, 30.0, 30.0 ) ; +set @arg00= 31.0 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, + 32.0, 32.0, 32.0 )" ; +execute stmt1 ; +set @arg00= 33.0; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( '40', '40', '40', '40', '40', '40', '40', '40', +'40', '40', '40' ) ; +set @arg00= '41' ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( '42', '42', '42', '42', '42', '42', '42', '42', + '42', '42', '42' )" ; +execute stmt1 ; +set @arg00= '43'; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( CAST('50' as binary), CAST('50' as binary), +CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), +CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), +CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ; +set @arg00= CAST('51' as binary) ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( CAST('52' as binary), CAST('52' as binary), + CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), + CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), + CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ; +execute stmt1 ; +set @arg00= CAST('53' as binary) ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 2 ; +set @arg00= NULL ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +NULL, NULL, NULL ) ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 61, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt1 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL )" ; +execute stmt1 ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 8.0 ; +set @arg00= NULL ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 71, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +set @arg00= 'abc' ; +set @arg00= NULL ; +insert into t9 +( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values +( 81, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ) ; +prepare stmt2 from "insert into t9 + ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 +from t9 where c1 >= 20 +order by c1 ; +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12 +20 20 20 20 20 20 20 20 20 20 20.0000 +21 21 21 21 21 21 21 21 21 21 21.0000 +22 22 22 22 22 22 22 22 22 22 22.0000 +23 23 23 23 23 23 23 23 23 23 23.0000 +30 30 30 30 30 30 30 30 30 30 30.0000 +31 31 31 31 31 31 31 31 31 31 31.0000 +32 32 32 32 32 32 32 32 32 32 32.0000 +33 33 33 33 33 33 33 33 33 33 33.0000 +40 40 40 40 40 40 40 40 40 40 40.0000 +41 41 41 41 41 41 41 41 41 41 41.0000 +42 42 42 42 42 42 42 42 42 42 42.0000 +43 43 43 43 43 43 43 43 43 43 43.0000 +50 50 50 50 50 50 50 50 50 50 50.0000 +51 51 51 51 51 51 51 51 51 51 51.0000 +52 52 52 52 52 52 52 52 52 52 52.0000 +53 53 53 53 53 53 53 53 53 53 53.0000 +60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +test_sequence +-- select .. where numeric column = .. -- +set @arg00= 20; +select 'true' as found from t9 +where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20 +and c8= 20 and c9= 20 and c10= 20 and c12= 20; +found +true +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20 + and c8= 20 and c9= 20 and c10= 20 and c12= 20 "; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 20.0; +select 'true' as found from t9 +where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0 +and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0; +found +true +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0 + and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 "; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +select 'true' as found from t9 +where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20' + and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20'; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20' + and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' "; +execute stmt1 ; +found +true +set @arg00= '20'; +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +select 'true' as found from t9 +where c1= CAST('20' as binary) and c2= CAST('20' as binary) and +c3= CAST('20' as binary) and c4= CAST('20' as binary) and +c5= CAST('20' as binary) and c6= CAST('20' as binary) and +c7= CAST('20' as binary) and c8= CAST('20' as binary) and +c9= CAST('20' as binary) and c10= CAST('20' as binary) and +c12= CAST('20' as binary); +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= CAST('20' as binary) and c2= CAST('20' as binary) and + c3= CAST('20' as binary) and c4= CAST('20' as binary) and + c5= CAST('20' as binary) and c6= CAST('20' as binary) and + c7= CAST('20' as binary) and c8= CAST('20' as binary) and + c9= CAST('20' as binary) and c10= CAST('20' as binary) and + c12= CAST('20' as binary) "; +execute stmt1 ; +found +true +set @arg00= CAST('20' as binary) ; +select 'true' as found from t9 +where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 +and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 +and c12= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? + and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? + and c12= ? "; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00 ; +found +true +delete from t9 ; +test_sequence +-- some numeric overflow experiments -- +prepare my_insert from "insert into t9 + ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) +values + ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; +prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 +from t9 where c21 = 'O' "; +prepare my_delete from "delete from t9 where c21 = 'O' "; +set @arg00= 9223372036854775807 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 127 +c2 32767 +c3 8388607 +c4 2147483647 +c5 2147483647 +c6 9223372036854775807 +c7 9.22337e+18 +c8 9.22337203685478e+18 +c9 9.22337203685478e+18 +c10 9.22337203685478e+18 +c12 99999.9999 +execute my_delete ; +set @arg00= '9223372036854775807' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 127 +c2 32767 +c3 8388607 +c4 2147483647 +c5 2147483647 +c6 9223372036854775807 +c7 9.22337e+18 +c8 9.22337203685478e+18 +c9 9.22337203685478e+18 +c10 9.22337203685478e+18 +c12 99999.9999 +execute my_delete ; +set @arg00= -9223372036854775808 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -128 +c2 -32768 +c3 -8388608 +c4 -2147483648 +c5 -2147483648 +c6 -9223372036854775808 +c7 -9.22337e+18 +c8 -9.22337203685478e+18 +c9 -9.22337203685478e+18 +c10 -9.22337203685478e+18 +c12 -9999.9999 +execute my_delete ; +set @arg00= '-9223372036854775808' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -128 +c2 -32768 +c3 -8388608 +c4 -2147483648 +c5 -2147483648 +c6 -9223372036854775808 +c7 -9.22337e+18 +c8 -9.22337203685478e+18 +c9 -9.22337203685478e+18 +c10 -9.22337203685478e+18 +c12 -9999.9999 +execute my_delete ; +set @arg00= 1.11111111111111111111e+50 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 127 +c2 32767 +c3 8388607 +c4 2147483647 +c5 2147483647 +c6 9223372036854775807 +c7 3.40282e+38 +c8 1.11111111111111e+50 +c9 1.11111111111111e+50 +c10 1.11111111111111e+50 +c12 99999.9999 +execute my_delete ; +set @arg00= '1.11111111111111111111e+50' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Warning 1265 Data truncated for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1265 Data truncated for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 1 +c2 1 +c3 1 +c4 1 +c5 1 +c6 1 +c7 3.40282e+38 +c8 1.11111111111111e+50 +c9 1.11111111111111e+50 +c10 1.11111111111111e+50 +c12 99999.9999 +execute my_delete ; +set @arg00= -1.11111111111111111111e+50 ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1264 Data truncated; out of range for column 'c1' at row 1 +Warning 1264 Data truncated; out of range for column 'c2' at row 1 +Warning 1264 Data truncated; out of range for column 'c3' at row 1 +Warning 1264 Data truncated; out of range for column 'c4' at row 1 +Warning 1264 Data truncated; out of range for column 'c5' at row 1 +Warning 1264 Data truncated; out of range for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -128 +c2 -32768 +c3 -8388608 +c4 -2147483648 +c5 -2147483648 +c6 -9223372036854775808 +c7 -3.40282e+38 +c8 -1.11111111111111e+50 +c9 -1.11111111111111e+50 +c10 -1.11111111111111e+50 +c12 -9999.9999 +execute my_delete ; +set @arg00= '-1.11111111111111111111e+50' ; +execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Warning 1265 Data truncated for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1265 Data truncated for column 'c6' at row 1 +Warning 1264 Data truncated; out of range for column 'c7' at row 1 +Warning 1264 Data truncated; out of range for column 'c12' at row 1 +execute my_select ; +c1 -1 +c2 -1 +c3 -1 +c4 -1 +c5 -1 +c6 -1 +c7 -3.40282e+38 +c8 -1.11111111111111e+50 +c9 -1.11111111111111e+50 +c10 -1.11111111111111e+50 +c12 -9999.9999 +execute my_delete ; +test_sequence +-- insert into string columns -- +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 +select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 +from t9 where c1 >= 20 +order by c1 ; +c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 +20 2 20 20 20 20 20 20 20 20 20 20 +21 2 21 21 21 21 21 21 21 21 21 21 +22 2 22 22 22 22 22 22 22 22 22 22 +23 2 23 23 23 23 23 23 23 23 23 23 +30 3 30 30 30 30 30 30 30 30 30 30 +31 3 31 31 31 31 31 31 31 31 31 31 +32 3 32 32 32 32 32 32 32 32 32 32 +33 3 33 33 33 33 33 33 33 33 33 33 +40 4 40 40 40 40 40 40 40 40 40 40 +41 4 41 41 41 41 41 41 41 41 41 41 +42 4 42 42 42 42 42 42 42 42 42 42 +43 4 43 43 43 43 43 43 43 43 43 43 +50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00 +51 5 51 51 51 51 51 51 51 51 51 51 +52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00 +53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00 +54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00 +55 5 55 55 55 55 55 55 55 55 55 55 +56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00 +57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00 +60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +test_sequence +-- select .. where string column = .. -- +set @arg00= '20'; +select 'true' as found from t9 +where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and +c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and +c27= '20' and c28= '20' and c29= '20' and c30= '20' ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and + c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and + c27= '20' and c28= '20' and c29= '20' and c30= '20'" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and + c21= ? and c22= ? and c23= ? and c25= ? and + c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= CAST('20' as binary); +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20))) += CAST('20' as binary) and c21= CAST('20' as binary) +and c22= CAST('20' as binary) and c23= CAST('20' as binary) and +c24= CAST('20' as binary) and c25= CAST('20' as binary) and +c26= CAST('20' as binary) and c27= CAST('20' as binary) and +c28= CAST('20' as binary) and c29= CAST('20' as binary) and +c30= CAST('20' as binary) ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and +c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20))) + = CAST('20' as binary) and c21= CAST('20' as binary) + and c22= CAST('20' as binary) and c23= CAST('20' as binary) and + c24= CAST('20' as binary) and c25= CAST('20' as binary) and + c26= CAST('20' as binary) and c27= CAST('20' as binary) and + c28= CAST('20' as binary) and c29= CAST('20' as binary) and + c30= CAST('20' as binary)" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and + c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and + c29= ? and c30= ?"; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 20; +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and +c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and +c27= 20 and c28= 20 and c29= 20 and c30= 20 ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and + c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and + c27= 20 and c28= 20 and c29= 20 and c30= 20" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and + c21= ? and c22= ? and c23= ? and c25= ? and + c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 20.0; +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and +c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and +c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ; +found +true +select 'true' as found from t9 +where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and +c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and +c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and + c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and + c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and + c21= ? and c22= ? and c23= ? and c25= ? and + c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, +@arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +delete from t9 ; +test_sequence +-- insert into date/time columns -- +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1264 Data truncated; out of range for column 'c13' at row 1 +Warning 1265 Data truncated for column 'c14' at row 1 +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +Warnings: +Warning 1265 Data truncated for column 'c15' at row 1 +Warning 1264 Data truncated; out of range for column 'c16' at row 1 +Warning 1264 Data truncated; out of range for column 'c17' at row 1 +select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; +c1 c13 c14 c15 c16 c17 +20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 +40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 +60 NULL NULL 1991-01-01 01:01:01 NULL NULL +61 NULL NULL 1991-01-01 01:01:01 NULL NULL +62 NULL NULL 1991-01-01 01:01:01 NULL NULL +63 NULL NULL 1991-01-01 01:01:01 NULL NULL +71 NULL NULL 1991-01-01 01:01:01 NULL NULL +73 NULL NULL 1991-01-01 01:01:01 NULL NULL +81 NULL NULL 1991-01-01 01:01:01 NULL NULL +83 NULL NULL 1991-01-01 01:01:01 NULL NULL +test_sequence +-- select .. where date/time column = .. -- +set @arg00= '1991-01-01 01:01:01' ; +select 'true' as found from t9 +where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and +c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and +c17= '1991-01-01 01:01:01' ; +found +true +select 'true' as found from t9 +where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00 +and c17= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and + c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and + c17= '1991-01-01 01:01:01'" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; +select 'true' as found from t9 +where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and +c14= CAST('1991-01-01 01:01:01' as datetime) and +c15= CAST('1991-01-01 01:01:01' as datetime) and +c16= CAST('1991-01-01 01:01:01' as datetime) and +c17= CAST('1991-01-01 01:01:01' as datetime) ; +found +true +select 'true' as found from t9 +where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00 +and c17= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and + c14= CAST('1991-01-01 01:01:01' as datetime) and + c15= CAST('1991-01-01 01:01:01' as datetime) and + c16= CAST('1991-01-01 01:01:01' as datetime) and + c17= CAST('1991-01-01 01:01:01' as datetime)" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ; +execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; +found +true +set @arg00= 1991 ; +select 'true' as found from t9 +where c1= 20 and c17= 1991 ; +found +true +select 'true' as found from t9 +where c1= 20 and c17= @arg00 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c17= 1991" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and c17= ?" ; +execute stmt1 using @arg00 ; +found +true +set @arg00= 1.991e+3 ; +select 'true' as found from t9 +where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ; +found +true +select 'true' as found from t9 +where c1= 20 and abs(c17 - @arg00) < 0.01 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ; +execute stmt1 ; +found +true +prepare stmt1 from "select 'true' as found from t9 +where c1= 20 and abs(c17 - ?) < 0.01" ; +execute stmt1 using @arg00 ; +found +true +drop table t1, t9; diff --git a/mysql-test/r/query_cache.result.es b/mysql-test/r/query_cache.result.es index 218e4e1ae2a..1e16354d87d 100644 --- a/mysql-test/r/query_cache.result.es +++ b/mysql-test/r/query_cache.result.es @@ -791,6 +791,19 @@ Qcache_queries_in_cache 1 unlock table; drop table t1,t2; set query_cache_wlock_invalidate=default; +CREATE TABLE t1 (id INT PRIMARY KEY); +insert into t1 values (1),(2),(3); +select * from t1; +id +1 +2 +3 +create temporary table t1 (a int not null auto_increment +primary key); +select * from t1; +a +drop table t1; +drop table t1; SET NAMES koi8r; CREATE TABLE t1 (a char(1) character set koi8r); INSERT INTO t1 VALUES (_koi8r'á'),(_koi8r'Á'); @@ -901,6 +914,8 @@ set group_concat_max_len=10; select group_concat(a) FROM t1 group by b; group_concat(a) 1234567890 +Warnings: +Warning 1260 1 line(s) were cut by GROUP_CONCAT() set group_concat_max_len=1024; select group_concat(a) FROM t1 group by b; group_concat(a) diff --git a/mysql-test/r/rpl_create_database.result b/mysql-test/r/rpl_create_database.result new file mode 100644 index 00000000000..2375e13bb5c --- /dev/null +++ b/mysql-test/r/rpl_create_database.result @@ -0,0 +1,83 @@ +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; +DROP DATABASE IF EXISTS mysqltest_prometheus; +DROP DATABASE IF EXISTS mysqltest_sisyfos; +DROP DATABASE IF EXISTS mysqltest_bob; +DROP DATABASE IF EXISTS mysqltest_bob; +CREATE DATABASE mysqltest_prometheus; +CREATE DATABASE mysqltest_sisyfos; +CREATE DATABASE mysqltest_bob; +USE mysqltest_sisyfos; +CREATE TABLE t1 (b int); +INSERT INTO t1 VALUES(1); +USE mysqltest_bob; +CREATE TABLE t2 (b int); +INSERT INTO t2 VALUES(2); +ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1; +USE mysqltest_sisyfos; +ALTER DATABASE mysqltest_bob CHARACTER SET latin1; +SHOW DATABASES; +Database +mysql +mysqltest_bob +mysqltest_prometheus +mysqltest_sisyfos +test +SHOW DATABASES; +Database +mysql +mysqltest_prometheus +mysqltest_sisyfos +test +DROP DATABASE IF EXISTS mysqltest_sisyfos; +USE mysqltest_prometheus; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1); +CREATE DATABASE mysqltest_sisyfos; +USE mysqltest_sisyfos; +CREATE TABLE t2 (a INT); +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id Orig_log_pos Info +master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3 +master-bin.000001 79 Query 1 79 DROP DATABASE IF EXISTS mysqltest_prometheus +master-bin.000001 174 Query 1 174 DROP DATABASE IF EXISTS mysqltest_sisyfos +master-bin.000001 263 Query 1 263 CREATE DATABASE mysqltest_prometheus +master-bin.000001 350 Query 1 350 CREATE DATABASE mysqltest_sisyfos +master-bin.000001 431 Query 1 431 use `mysqltest_sisyfos`; CREATE TABLE t1 (b int) +master-bin.000001 502 Query 1 502 use `mysqltest_sisyfos`; INSERT INTO t1 VALUES(1) +master-bin.000001 574 Query 1 574 ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1 +master-bin.000001 675 Query 1 675 DROP DATABASE IF EXISTS mysqltest_sisyfos +master-bin.000001 764 Query 1 764 use `mysqltest_prometheus`; CREATE TABLE t1 (a INT) +master-bin.000001 838 Query 1 838 use `mysqltest_prometheus`; INSERT INTO t1 VALUES (1) +master-bin.000001 914 Query 1 914 CREATE DATABASE mysqltest_sisyfos +master-bin.000001 995 Query 1 995 use `mysqltest_sisyfos`; CREATE TABLE t2 (a INT) +SHOW DATABASES; +Database +mysql +mysqltest_bob +mysqltest_prometheus +mysqltest_sisyfos +test +SHOW DATABASES; +Database +mysql +mysqltest_prometheus +mysqltest_sisyfos +test +SHOW CREATE TABLE mysqltest_prometheus.t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SHOW CREATE TABLE mysqltest_sisyfos.t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP DATABASE IF EXISTS mysqltest_prometheus; +DROP DATABASE IF EXISTS mysqltest_sisyfos; +DROP DATABASE IF EXISTS mysqltest_bob; diff --git a/mysql-test/r/rpl_loaddata_rule_m.result b/mysql-test/r/rpl_loaddata_rule_m.result index 1b7ea5661fb..d11ca31fc87 100644 --- a/mysql-test/r/rpl_loaddata_rule_m.result +++ b/mysql-test/r/rpl_loaddata_rule_m.result @@ -12,4 +12,6 @@ use mysqltest; load data infile '../../std_data/rpl_loaddata.dat' into table test.t1; show binlog events from 95; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 79 Query 1 79 drop database if exists mysqltest +master-bin.000001 152 Query 1 152 create database mysqltest drop database mysqltest; diff --git a/mysql-test/r/select.result.es b/mysql-test/r/select.result.es index 2ff58372d6d..da761ebb822 100644 --- a/mysql-test/r/select.result.es +++ b/mysql-test/r/select.result.es @@ -1,4 +1,5 @@ drop table if exists t1,t2,t3,t4; +drop table if exists t1_1,t1_2,t9_1,t9_2; CREATE TABLE t1 ( Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL @@ -2056,6 +2057,10 @@ t2 1 fld3 1 fld3 A NULL NULL NULL BTREE drop table t4, t3, t2, t1; DO 1; DO benchmark(100,1+1),1,1; +do default; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 +do foobar; +ERROR 42S22: Unknown column 'foobar' in 'field list' CREATE TABLE t1 ( id mediumint(8) unsigned NOT NULL auto_increment, pseudo varchar(35) NOT NULL default '', @@ -2348,6 +2353,27 @@ select * from t2,t3 where t2.s = t3.s; s s two two drop table t1, t2, t3; +create table t1 (a integer, b integer, index(a), index(b)); +create table t2 (c integer, d integer, index(c), index(d)); +insert into t1 values (1,2), (2,2), (3,2), (4,2); +insert into t2 values (1,3), (2,3), (3,4), (4,4); +explain select * from t1 left join t2 on a=c where d in (4); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref c,d d 5 const 2 Using where +1 SIMPLE t1 ALL a NULL NULL NULL 3 Using where +select * from t1 left join t2 on a=c where d in (4); +a b c d +3 2 3 4 +4 2 4 4 +explain select * from t1 left join t2 on a=c where d = 4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref c,d d 5 const 2 Using where +1 SIMPLE t1 ALL a NULL NULL NULL 3 Using where +select * from t1 left join t2 on a=c where d = 4; +a b c d +3 2 3 4 +4 2 4 4 +drop table t1, t2; CREATE TABLE t1 ( i int(11) NOT NULL default '0', c char(10) NOT NULL default '', @@ -2360,7 +2386,4 @@ INSERT INTO t1 VALUES (3,'c'); EXPLAIN SELECT i FROM t1 WHERE i=1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index -EXPLAIN SELECT i FROM t1 WHERE i=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index DROP TABLE t1; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 20ab3ac8f80..0e22608838b 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -2013,3 +2013,29 @@ explain select a from t1 where c=2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where drop table t1; +set @got_val= (SELECT 1 FROM (SELECT 'A' as my_col) as T1 ) ; +create table t1 (a int, b int); +create table t2 (a int, b int); +insert into t1 values (1,1),(1,2),(1,3),(2,4),(2,5); +insert into t2 values (1,3),(2,1); +select distinct a,b, (select max(b) from t2 where t1.b=t2.a) from t1 order by t1.b; +a b (select max(b) from t2 where t1.b=t2.a) +1 1 3 +1 2 1 +1 3 NULL +2 4 NULL +2 5 NULL +drop table t1, t2; +create table t1 (id int); +create table t2 (id int, body text, fulltext (body)); +insert into t1 values(1),(2),(3); +insert into t2 values (1,'test'), (2,'mysql'), (3,'test'), (4,'test'); +select count(distinct id) from t1 where id in (select id from t2 where match(body) against ('mysql' in boolean mode)); +count(distinct id) +1 +drop table t2,t1; +create table t1 (s1 int,s2 int); +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; diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result index e8f6426f51b..0b813a07a1d 100644 --- a/mysql-test/r/subselect_innodb.result +++ b/mysql-test/r/subselect_innodb.result @@ -114,3 +114,29 @@ SELECT R.unit, R.ingredient FROM t1 R WHERE R.ingredient IN (SELECT N.ingredient unit ingredient xx yy drop table t1, t2; +CREATE TABLE t1 ( +id INT NOT NULL auto_increment, +date1 DATE, coworkerid INT, +description VARCHAR(255), +sum_used DOUBLE, +sum_remaining DOUBLE, +comments VARCHAR(255), +PRIMARY KEY(id) +) engine=innodb; +insert into t1 values (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment'); +SELECT DISTINCT +(SELECT sum(sum_used) FROM t1 WHERE sum_used > 0 AND year(date1) <= '2004') as somallontvangsten, +(SELECT sum(sum_used) FROM t1 WHERE sum_used < 0 AND year(date1) <= '2004') as somalluitgaven +FROM t1; +somallontvangsten somalluitgaven +154 NULL +select * from t1; +id date1 coworkerid description sum_used sum_remaining comments +1 1999-01-01 1 test 22 33 comment +2 1999-01-01 1 test 22 33 comment +3 1999-01-01 1 test 22 33 comment +4 1998-01-01 1 test 22 33 comment +5 1998-01-01 1 test 22 33 comment +6 2004-01-01 1 test 22 33 comment +7 2004-01-01 1 test 22 33 comment +drop table t1; diff --git a/mysql-test/r/type_blob.result.es b/mysql-test/r/type_blob.result.es index 84d02b4a4b4..a510eee8f38 100644 --- a/mysql-test/r/type_blob.result.es +++ b/mysql-test/r/type_blob.result.es @@ -684,8 +684,8 @@ id txt 3 NULL 1 Chevy drop table t1; -CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, PRIMARY KEY (i), KEY (c(1),c(1))); -INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,''); +CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY (i), KEY (c(1),d)); +INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,''); select max(i) from t1 where c = ''; max(i) 4 diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result index da85ffe6495..2ccf32367fb 100644 --- a/mysql-test/r/type_enum.result +++ b/mysql-test/r/type_enum.result @@ -1693,3 +1693,47 @@ oe ue ss DROP TABLE t1; +CREATE TABLE t1 ( +a ENUM('ä','ö','ü') character set utf8 default 'ü' +); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` enum('ä','ö','ü') character set utf8 default 'ü' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('ä'), ('ö'), ('ü'); +select a from t1 order by a; +a +ä +ö +ü +drop table t1; +set names utf8; +CREATE TABLE t1 ( +a ENUM('ä','ö','ü') character set latin1 default 'ü' +); +insert into t1 values ('ä'),('ö'),('ü'); +set names latin1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` enum('ä','ö','ü') default 'ü' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select a from t1 order by a; +a +ä +ö +ü +drop table t1; +create table t1 (a enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin); +insert into t1 values ('Y'); +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 +a b c +Y NULL NULL +drop table t1; diff --git a/mysql-test/r/type_float.result.es b/mysql-test/r/type_float.result.es index 411817bbfef..4bfe644d7fb 100644 --- a/mysql-test/r/type_float.result.es +++ b/mysql-test/r/type_float.result.es @@ -22,14 +22,14 @@ select * from t1; f1 f2 10 10 100000 100000 -1.23457e+09 1234567890 +1.23457e+9 1234567890 1e+10 10000000000 1e+15 1e+15 1e+20 1e+20 3.40282e+38 1e+50 3.40282e+38 1e+150 -10 -10 -1e-05 1e-05 +1e-5 1e-5 1e-10 1e-10 1e-15 1e-15 1e-20 1e-20 @@ -137,6 +137,8 @@ t1 CREATE TABLE `t1` ( drop table t1; create table t1 (c20 char); insert into t1 values (5000.0); +Warnings: +Warning 1265 Data truncated for column 'c20' at row 1 drop table t1; create table t1 (f float(54)); ERROR 42000: Incorrect column specifier for column 'f' diff --git a/mysql-test/t/bdb-deadlock.tminus b/mysql-test/t/bdb-deadlock.tminus new file mode 100644 index 00000000000..d86403fcffc --- /dev/null +++ b/mysql-test/t/bdb-deadlock.tminus @@ -0,0 +1,57 @@ +# This test doesn't work with the embedded version as this code +# assumes that one query is running while we are doing queries on +# a second connection. +# This would work if mysqltest run would be threaded and handle each +# connection in a separate thread. +# + +#-- source include/not_embedded.inc +-- source include/have_bdb.inc + +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); + +--disable_warnings +drop table if exists t1,t2; +--enable_warnings +connection con1; +create table t1 (id integer, x integer) engine=BDB; +create table t2 (id integer, x integer) engine=BDB; +insert into t1 values(0, 0); +insert into t2 values(0, 0); +set autocommit=0; +update t1 set x = 1 where id = 0; + +connection con2; +set autocommit=0; +update t2 set x = 1 where id = 0; + +# The following query should hang because con1 is locking the page +--send +select x from t1 where id = 0; + +connection con1; +# This should generate a deadlock as we are trying to access a locked row +--send +select x from t2 where id = 0; + +connection con2; +--error 1213 +reap; +commit; + +connection con1; +reap; +commit; + +connection con2; +select * from t1; +select * from t2; +commit; + +connection con1; +select * from t1; +select * from t2; +commit; + +drop table t1,t2; diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index 6805e5e4557..271240c3993 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -4,6 +4,10 @@ DROP TABLE IF EXISTS t1; --enable_warnings +SET NAMES latin1; +SET character_set_connection=ucs2; +-- source include/endspace.inc + SET CHARACTER SET koi8r; # diff --git a/mysql-test/t/endspace.test b/mysql-test/t/endspace.test index 9ee5e32967a..462bc3083e1 100644 --- a/mysql-test/t/endspace.test +++ b/mysql-test/t/endspace.test @@ -7,13 +7,7 @@ drop table if exists t1; --enable_warnings -select 'a' = 'a', 'a' = 'a ', 'a ' = 'a'; -select 'a\0' = 'a', 'a\0' < 'a', 'a\0' > 'a'; -select 'a' = 'a\0', 'a' < 'a\0', 'a' > 'a\0'; -select 'a\0' = 'a ', 'a\0' < 'a ', 'a\0' > 'a '; -select 'a ' = 'a\0', 'a ' < 'a\0', 'a ' > 'a\0'; -select 'a a' > 'a', 'a \0' < 'a'; -select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a'; +-- source include/endspace.inc # # Test MyISAM tables. diff --git a/mysql-test/t/flush_block_commit.test b/mysql-test/t/flush_block_commit.test index 3d13086f517..ac14b7b98bc 100644 --- a/mysql-test/t/flush_block_commit.test +++ b/mysql-test/t/flush_block_commit.test @@ -48,5 +48,19 @@ reap; connection con3; reap; unlock tables; + +# BUG#6732 FLUSH TABLES WITH READ LOCK + COMMIT hangs later FLUSH TABLES +# WITH READ LOCK + +connection con2; +commit; # unlock InnoDB row locks to allow insertions connection con1; +begin; +insert into t1 values(10); +flush tables with read lock; +commit; +unlock tables; +connection con2; +flush tables with read lock; # bug caused hang here +unlock tables; drop table t1; diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index eda08ac0cdb..cc3d0b35ab3 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -272,6 +272,19 @@ DROP DATABASE testdb8; DROP DATABASE testdb9; DROP DATABASE testdb10; +# +# Bug #6932: a problem with 'revoke ALL PRIVILEGES' +# + +create table t1(a int, b int, c int, d int); +grant insert(b), insert(c), insert(d), insert(a) on t1 to grant_user@localhost; +show grants for grant_user@localhost; +select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv; +revoke ALL PRIVILEGES on t1 from grant_user@localhost; +show grants for grant_user@localhost; +select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv; +drop user grant_user@localhost; +drop table t1; # # just SHOW PRIVILEGES test diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test index 2eff36f3317..bc0b28370ec 100644 --- a/mysql-test/t/heap.test +++ b/mysql-test/t/heap.test @@ -185,3 +185,13 @@ DELETE FROM t1 WHERE date<1101106546; SELECT * FROM t1; DROP TABLE t1; +# +# Bug #6878: a problem with small length records +# + +create table t1(a char(2)) engine=memory; +insert into t1 values (NULL), (NULL); +delete from t1 where a is null; +insert into t1 values ('2'), ('3'); +select * from t1; +drop table t1; diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test index db5dc8d91da..e1459310bb9 100644 --- a/mysql-test/t/insert_select.test +++ b/mysql-test/t/insert_select.test @@ -89,6 +89,19 @@ show binlog events; select * from t1; drop table t1, t2; +# Verify that a partly-completed CREATE TABLE .. SELECT does not +# get into the binlog (Bug #6682) +create table t1(a int); +insert into t1 values(1),(1); +reset master; +--error 1062 +create table t2(unique(a)) select a from t1; +# The above should produce an error, *and* not appear in the binlog +let $VERSION=`select version()`; +--replace_result $VERSION VERSION +show binlog events; +drop table t1; + # # Test of insert ... select from same table # diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test index 39612f680f3..912c9fb9bec 100644 --- a/mysql-test/t/openssl_1.test +++ b/mysql-test/t/openssl_1.test @@ -9,9 +9,9 @@ create table t1(f1 int); insert into t1 values (5); grant select on test.* to ssl_user1@localhost require SSL; -grant select on test.* to ssl_user2@localhost require cipher "EDH-RSA-DES-CBC3-SHA"; -grant select on test.* to ssl_user3@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com"; -grant select on test.* to ssl_user4@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com"; +grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA"; +grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com"; +grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com"; flush privileges; connect (con1,localhost,ssl_user1,,); connect (con2,localhost,ssl_user2,,); diff --git a/mysql-test/t/rpl_charset.test b/mysql-test/t/rpl_charset.test index 1bd72d059ab..a6a3cbe9f1b 100644 --- a/mysql-test/t/rpl_charset.test +++ b/mysql-test/t/rpl_charset.test @@ -155,6 +155,9 @@ select hex(c1), hex(c2) from t1; stop slave; delete from t1; +change master to master_log_pos=5847; +start slave until master_log_file='master-bin.000001', master_log_pos=5983; +# Slave is supposed to stop _after_ the INSERT, even though 5983 is # Note that the following positions may change between MySQL versions! diff --git a/mysql-test/t/rpl_create_database-master.opt b/mysql-test/t/rpl_create_database-master.opt new file mode 100644 index 00000000000..85660a17140 --- /dev/null +++ b/mysql-test/t/rpl_create_database-master.opt @@ -0,0 +1 @@ +--binlog-do-db=mysqltest_sisyfos --binlog-do-db=mysqltest_prometheus diff --git a/mysql-test/t/rpl_create_database-slave.opt b/mysql-test/t/rpl_create_database-slave.opt new file mode 100644 index 00000000000..96d630c9229 --- /dev/null +++ b/mysql-test/t/rpl_create_database-slave.opt @@ -0,0 +1 @@ +--replicate-do-db=mysqltest_sisyfos --replicate-do-db=mysqltest_prometheus diff --git a/mysql-test/t/rpl_create_database.test b/mysql-test/t/rpl_create_database.test new file mode 100644 index 00000000000..7ed0d5dbdbb --- /dev/null +++ b/mysql-test/t/rpl_create_database.test @@ -0,0 +1,70 @@ +# +# Tests for replication of statements that manipulate databases. +# +# For this test file, we have a number of databases. All databases +# with "greek" names will be replicated on the slave, while other names +# (e.g., american) will not be replicated. +# + +source include/master-slave.inc; + +# Bug#6391 (binlog-do-db rules ignored) +# In this case, 'mysqltest_bob' should not be replicated to the slave. +--disable_warnings +DROP DATABASE IF EXISTS mysqltest_prometheus; +DROP DATABASE IF EXISTS mysqltest_sisyfos; +DROP DATABASE IF EXISTS mysqltest_bob; +sync_slave_with_master; +# This database is not replicated +DROP DATABASE IF EXISTS mysqltest_bob; +--enable_warnings + +connection master; +CREATE DATABASE mysqltest_prometheus; +CREATE DATABASE mysqltest_sisyfos; +CREATE DATABASE mysqltest_bob; + +USE mysqltest_sisyfos; +# These should be replicated +CREATE TABLE t1 (b int); +INSERT INTO t1 VALUES(1); + +USE mysqltest_bob; +# These should *not* be replicated +CREATE TABLE t2 (b int); +INSERT INTO t2 VALUES(2); + +# Current database is now 'mysqltest_bob' +# The following should be replicated +ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1; + +USE mysqltest_sisyfos; +# The following should *not* be replicated +ALTER DATABASE mysqltest_bob CHARACTER SET latin1; + +SHOW DATABASES; +sync_slave_with_master; +SHOW DATABASES; + +connection master; +DROP DATABASE IF EXISTS mysqltest_sisyfos; +USE mysqltest_prometheus; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1); +CREATE DATABASE mysqltest_sisyfos; +USE mysqltest_sisyfos; +CREATE TABLE t2 (a INT); +let $VERSION=`select version()`; +--replace_result $VERSION VERSION +SHOW BINLOG EVENTS; +SHOW DATABASES; +sync_slave_with_master; +SHOW DATABASES; +SHOW CREATE TABLE mysqltest_prometheus.t1; +SHOW CREATE TABLE mysqltest_sisyfos.t2; + +connection master; +DROP DATABASE IF EXISTS mysqltest_prometheus; +DROP DATABASE IF EXISTS mysqltest_sisyfos; +DROP DATABASE IF EXISTS mysqltest_bob; +sync_slave_with_master; diff --git a/mysql-test/t/rpl_until.test b/mysql-test/t/rpl_until.test index f7ca51ecabc..318cca600a3 100644 --- a/mysql-test/t/rpl_until.test +++ b/mysql-test/t/rpl_until.test @@ -43,7 +43,7 @@ show slave status; # try replicate all until second insert to t2; start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=710; -sleep 2; +sleep 4; select * from t2; --replace_result $MASTER_MYPORT MASTER_MYPORT --replace_column 1 # 9 # 23 # 33 # diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 9cf9f13cfea..daef4c3e281 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -1306,3 +1306,38 @@ explain select a from t1 where c=2; do @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=2; drop table t1; + +# +# Subselect in non-select command just after connection +# +connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); +connection root; +set @got_val= (SELECT 1 FROM (SELECT 'A' as my_col) as T1 ) ; + +# +# primary query with temporary table and subquery with groupping +# +create table t1 (a int, b int); +create table t2 (a int, b int); +insert into t1 values (1,1),(1,2),(1,3),(2,4),(2,5); +insert into t2 values (1,3),(2,1); +select distinct a,b, (select max(b) from t2 where t1.b=t2.a) from t1 order by t1.b; +drop table t1, t2; + +# +# subqueries with full text search +# +create table t1 (id int); +create table t2 (id int, body text, fulltext (body)); +insert into t1 values(1),(2),(3); +insert into t2 values (1,'test'), (2,'mysql'), (3,'test'), (4,'test'); +select count(distinct id) from t1 where id in (select id from t2 where match(body) against ('mysql' in boolean mode)); +drop table t2,t1; + +# +# Equal operation under row and empty subquery +# +create table t1 (s1 int,s2 int); +insert into t1 values (20,15); +select * from t1 where (('a',null) <=> (select 'a',s2 from t1 where s1 = 0)); +drop table t1; diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test index 5f4badb3624..aa7fe138876 100644 --- a/mysql-test/t/subselect_innodb.test +++ b/mysql-test/t/subselect_innodb.test @@ -125,3 +125,23 @@ INSERT INTO `t2` VALUES ('yy','xx'); SELECT R.unit, R.ingredient FROM t1 R WHERE R.ingredient IN (SELECT N.ingredient FROM t2 N WHERE N.unit = R.unit); drop table t1, t2; + +# +# possible early unlock +# +CREATE TABLE t1 ( + id INT NOT NULL auto_increment, + date1 DATE, coworkerid INT, + description VARCHAR(255), + sum_used DOUBLE, + sum_remaining DOUBLE, + comments VARCHAR(255), + PRIMARY KEY(id) +) engine=innodb; +insert into t1 values (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment'); +SELECT DISTINCT + (SELECT sum(sum_used) FROM t1 WHERE sum_used > 0 AND year(date1) <= '2004') as somallontvangsten, + (SELECT sum(sum_used) FROM t1 WHERE sum_used < 0 AND year(date1) <= '2004') as somalluitgaven + FROM t1; +select * from t1; +drop table t1; diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test index dc2e4d0f469..3a5b12b91e4 100644 --- a/mysql-test/t/type_enum.test +++ b/mysql-test/t/type_enum.test @@ -72,3 +72,44 @@ CREATE TABLE t1 (c enum('ae','oe','ue','ss') collate latin1_german2_ci); INSERT INTO t1 VALUES ('ä'),('ö'),('ü'),('ß'); SELECT * FROM t1; DROP TABLE t1; + +# +# Bug #6379: ENUM values are incorrectly converted +# +# Check latin1 -> utf8 conversion +# +CREATE TABLE t1 ( + a ENUM('ä','ö','ü') character set utf8 default 'ü' +); +show create table t1; +insert into t1 values ('ä'), ('ö'), ('ü'); +select a from t1 order by a; +drop table t1; + +# +# Now check utf8 -> latin1 conversion +# This test emulates loading a script generated with mysqldump +# +set names utf8; +CREATE TABLE t1 ( + a ENUM('ä','ö','ü') character set latin1 default 'ü' +); +insert into t1 values ('ä'),('ö'),('ü'); +# Now check what has been loaded +set names latin1; +show create table t1; +select a from t1 order by a; +drop table t1; + +# +# Test bug where enum fields where extended for each ALTER TABLE +# + +create table t1 (a enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin); +insert into t1 values ('Y'); +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; +--enable_metadata +select * from t1; +--disable metadata +drop table t1; diff --git a/ndb/src/common/util/NdbOut.cpp b/ndb/src/common/util/NdbOut.cpp index fa74cb364f3..e20119a7987 100644 --- a/ndb/src/common/util/NdbOut.cpp +++ b/ndb/src/common/util/NdbOut.cpp @@ -54,7 +54,7 @@ NdbOut& NdbOut::operator<<(unsigned long int v) { return *this << (Uint64) v; } NdbOut& -NdbOut::operator<<(const char* val){ m_out->print("%s", val); return * this; } +NdbOut::operator<<(const char* val){ m_out->print("%s", val ? val : "(null)"); return * this; } NdbOut& NdbOut::operator<<(const void* val){ m_out->print("%p", val); return * this; } NdbOut& diff --git a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp index cf4cc410cee..2b531ede3d1 100644 --- a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp +++ b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp @@ -7278,6 +7278,8 @@ void Dblqh::closeScanRequestLab(Signal* signal) scanptr.p->m_curr_batch_size_rows = 0; scanptr.p->m_curr_batch_size_bytes= 0; sendScanFragConf(signal, ZTRUE); + abort_scan(signal, scanptr.i, 0); + return; break; case TcConnectionrec::SCAN_TUPKEY: case TcConnectionrec::SCAN_FIRST_STOPPED: @@ -7667,14 +7669,18 @@ void Dblqh::abort_scan(Signal* signal, Uint32 scan_ptr_i, Uint32 errcode){ releaseScanrec(signal); tcConnectptr.p->transactionState = TcConnectionrec::IDLE; tcConnectptr.p->abortState = TcConnectionrec::ABORT_ACTIVE; - - ScanFragRef * ref = (ScanFragRef*)&signal->theData[0]; - ref->senderData = tcConnectptr.p->clientConnectrec; - ref->transId1 = tcConnectptr.p->transid[0]; - ref->transId2 = tcConnectptr.p->transid[1]; - ref->errorCode = errcode; - sendSignal(tcConnectptr.p->clientBlockref, GSN_SCAN_FRAGREF, signal, - ScanFragRef::SignalLength, JBB); + + if(errcode) + { + jam(); + ScanFragRef * ref = (ScanFragRef*)&signal->theData[0]; + ref->senderData = tcConnectptr.p->clientConnectrec; + ref->transId1 = tcConnectptr.p->transid[0]; + ref->transId2 = tcConnectptr.p->transid[1]; + ref->errorCode = errcode; + sendSignal(tcConnectptr.p->clientBlockref, GSN_SCAN_FRAGREF, signal, + ScanFragRef::SignalLength, JBB); + } deleteTransidHash(signal); releaseOprec(signal); releaseTcrec(signal, tcConnectptr); diff --git a/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp b/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp index 49de0d80bcd..8e3ca6528c2 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp @@ -1113,6 +1113,7 @@ Dbtup::updateStartLab(Signal* signal, regOperPtr->attrinbufLen); if (retValue == -1) { tupkeyErrorLab(signal); + return -1; }//if } else { jam(); diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp index 651a4a8a725..e22ceffe773 100644 --- a/ndb/src/mgmapi/mgmapi.cpp +++ b/ndb/src/mgmapi/mgmapi.cpp @@ -574,7 +574,9 @@ cmp_state(const void *_a, const void *_b) a = (struct ndb_mgm_node_state *)_a; b = (struct ndb_mgm_node_state *)_b; - return a->node_id > b->node_id; + if (a->node_id > b->node_id) + return 1; + return -1; } extern "C" diff --git a/ndb/test/src/NDBT_Test.cpp b/ndb/test/src/NDBT_Test.cpp index 1434617c988..bbbde008938 100644 --- a/ndb/test/src/NDBT_Test.cpp +++ b/ndb/test/src/NDBT_Test.cpp @@ -519,6 +519,7 @@ void NDBT_TestCaseImpl1::waitSteps(){ NdbThread_WaitFor(threads[i], &status); NdbThread_Destroy(&threads[i]); } + threads.clear(); } diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index da7e06f6c05..1f4d17f8885 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -141,12 +141,12 @@ fi args= SET_USER=2 -parse_arguments `$print_defaults --loose-verbose $defaults mysqld server` +parse_arguments `$print_defaults $defaults --loose-verbose mysqld server` if test $SET_USER -eq 2 then SET_USER=0 fi -parse_arguments `$print_defaults --loose-verbose $defaults mysqld_safe safe_mysqld` +parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld` parse_arguments PICK-ARGS-FROM-ARGV "$@" safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}} diff --git a/sql/field.cc b/sql/field.cc index 5e76c590aac..73caddf1d0b 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -5869,25 +5869,24 @@ bool Field_num::eq_def(Field *field) void create_field::create_length_to_internal_length(void) { - switch (sql_type) - { - case MYSQL_TYPE_TINY_BLOB: - case MYSQL_TYPE_MEDIUM_BLOB: - case MYSQL_TYPE_LONG_BLOB: - case MYSQL_TYPE_BLOB: - case MYSQL_TYPE_VAR_STRING: - case MYSQL_TYPE_STRING: - length*= charset->mbmaxlen; - pack_length= calc_pack_length(sql_type == FIELD_TYPE_VAR_STRING ? - FIELD_TYPE_STRING : sql_type, length); - break; - case MYSQL_TYPE_ENUM: - case MYSQL_TYPE_SET: - length*= charset->mbmaxlen; - break; - default: - /* do nothing */ - break; + switch (sql_type) { + case MYSQL_TYPE_TINY_BLOB: + case MYSQL_TYPE_MEDIUM_BLOB: + case MYSQL_TYPE_LONG_BLOB: + case MYSQL_TYPE_BLOB: + case MYSQL_TYPE_VAR_STRING: + case MYSQL_TYPE_STRING: + length*= charset->mbmaxlen; + pack_length= calc_pack_length(sql_type == FIELD_TYPE_VAR_STRING ? + FIELD_TYPE_STRING : sql_type, length); + break; + case MYSQL_TYPE_ENUM: + case MYSQL_TYPE_SET: + length*= charset->mbmaxlen; + break; + default: + /* do nothing */ + break; } } @@ -6112,6 +6111,8 @@ create_field::create_field(Field *old_field,Field *orig_field) } length=(length+charset->mbmaxlen-1)/charset->mbmaxlen; // QQ: Probably not needed break; + case MYSQL_TYPE_ENUM: + case MYSQL_TYPE_SET: case FIELD_TYPE_STRING: case FIELD_TYPE_VAR_STRING: length=(length+charset->mbmaxlen-1)/charset->mbmaxlen; diff --git a/sql/field.h b/sql/field.h index d1c2fa3b6fd..b4e8e61e3fb 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1196,6 +1196,7 @@ public: uint decimals,flags,pack_length; Field::utype unireg_check; TYPELIB *interval; // Which interval to use + List<String> interval_list; CHARSET_INFO *charset; Field::geometry_type geom_type; Field *field; // For alter table diff --git a/sql/handler.cc b/sql/handler.cc index b474e6290f2..edb4d5b488b 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -736,7 +736,7 @@ int ha_rollback_to_savepoint(THD *thd, char *savepoint_name) if (unlikely((thd->options & OPTION_STATUS_NO_TRANS_UPDATE) && my_b_tell(&thd->transaction.trans_log))) { - Query_log_event qinfo(thd, thd->query, thd->query_length, TRUE); + Query_log_event qinfo(thd, thd->query, thd->query_length, TRUE, FALSE); if (mysql_bin_log.write(&qinfo)) error= 1; } @@ -774,7 +774,7 @@ int ha_savepoint(THD *thd, char *savepoint_name) innobase_savepoint(thd,savepoint_name, my_b_tell(&thd->transaction.trans_log)); #endif - Query_log_event qinfo(thd, thd->query, thd->query_length, TRUE); + Query_log_event qinfo(thd, thd->query, thd->query_length, TRUE, FALSE); if (mysql_bin_log.write(&qinfo)) error= 1; } diff --git a/sql/item.h b/sql/item.h index 2c2978e841c..973039f9127 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1375,7 +1375,7 @@ class Item_cache_int: public Item_cache { longlong value; public: - Item_cache_int(): Item_cache() {} + Item_cache_int(): Item_cache(), value(0) {} void store(Item *item); double val_real() { DBUG_ASSERT(fixed == 1); return (double) value; } @@ -1393,7 +1393,7 @@ class Item_cache_real: public Item_cache { double value; public: - Item_cache_real(): Item_cache() {} + Item_cache_real(): Item_cache(), value(0) {} void store(Item *item); double val_real() { DBUG_ASSERT(fixed == 1); return value; } @@ -1415,7 +1415,7 @@ class Item_cache_str: public Item_cache char buffer[80]; String *value, value_buff; public: - Item_cache_str(): Item_cache() { } + Item_cache_str(): Item_cache(), value(0) { } void store(Item *item); double val_real(); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 389a614e3d5..7611b70c6a4 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2430,10 +2430,10 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) } int error; if ((error= regcomp(&preg,res->c_ptr(), - ((cmp_collation.collation->state & MY_CS_BINSORT) || - (cmp_collation.collation->state & MY_CS_CSSORT)) ? + ((cmp_collation.collation->state & + (MY_CS_BINSORT | MY_CS_CSSORT)) ? REG_EXTENDED | REG_NOSUB : - REG_EXTENDED | REG_NOSUB | REG_ICASE, + REG_EXTENDED | REG_NOSUB | REG_ICASE), cmp_collation.collation))) { (void) regerror(error,&preg,buff,sizeof(buff)); @@ -2482,10 +2482,10 @@ longlong Item_func_regex::val_int() regex_compiled=0; } if (regcomp(&preg,res2->c_ptr(), - ((cmp_collation.collation->state & MY_CS_BINSORT) || - (cmp_collation.collation->state & MY_CS_CSSORT)) ? + ((cmp_collation.collation->state & + (MY_CS_BINSORT | MY_CS_CSSORT)) ? REG_EXTENDED | REG_NOSUB : - REG_EXTENDED | REG_NOSUB | REG_ICASE, + REG_EXTENDED | REG_NOSUB | REG_ICASE), cmp_collation.collation)) { null_value=1; diff --git a/sql/item_func.cc b/sql/item_func.cc index eb3db156056..8fefb355efe 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2098,7 +2098,7 @@ void item_user_lock_release(User_level_lock *ull) tmp.copy(command, strlen(command), tmp.charset()); tmp.append(ull->key,ull->key_length); tmp.append("\")", 2); - Query_log_event qev(current_thd, tmp.ptr(), tmp.length(),1); + Query_log_event qev(current_thd, tmp.ptr(), tmp.length(),1, FALSE); qev.error_code=0; // this query is always safe to run on slave mysql_bin_log.write(&qev); } diff --git a/sql/lock.cc b/sql/lock.cc index 3367c6a2900..8a3619b57dd 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -707,15 +707,70 @@ static void print_lock_error(int error) /**************************************************************************** Handling of global read locks + Taking the global read lock is TWO steps (2nd step is optional; without + it, COMMIT of existing transactions will be allowed): + lock_global_read_lock() THEN make_global_read_lock_block_commit(). + The global locks are handled through the global variables: global_read_lock + count of threads which have the global read lock (i.e. have completed at + least the first step above) global_read_lock_blocks_commit - waiting_for_read_lock + count of threads which have the global read lock and block + commits (i.e. have completed the second step above) + waiting_for_read_lock + count of threads which want to take a global read lock but cannot protect_against_global_read_lock + count of threads which have set protection against global read lock. + + How blocking of threads by global read lock is achieved: that's + advisory. Any piece of code which should be blocked by global read lock must + be designed like this: + - call to wait_if_global_read_lock(). When this returns 0, no global read + lock is owned; if argument abort_on_refresh was 0, none can be obtained. + - job + - if abort_on_refresh was 0, call to start_waiting_global_read_lock() to + allow other threads to get the global read lock. I.e. removal of the + protection. + (Note: it's a bit like an implementation of rwlock). + + [ I am sorry to mention some SQL syntaxes below I know I shouldn't but found + no better descriptive way ] + + Why does FLUSH TABLES WITH READ LOCK need to block COMMIT: because it's used + to read a non-moving SHOW MASTER STATUS, and a COMMIT writes to the binary + log. + + Why getting the global read lock is two steps and not one. Because FLUSH + TABLES WITH READ LOCK needs to insert one other step between the two: + flushing tables. So the order is + 1) lock_global_read_lock() (prevents any new table write locks, i.e. stalls + all new updates) + 2) close_cached_tables() (the FLUSH TABLES), which will wait for tables + currently opened and being updated to close (so it's possible that there is + a moment where all new updates of server are stalled *and* FLUSH TABLES WITH + READ LOCK is, too). + 3) make_global_read_lock_block_commit(). + If we have merged 1) and 3) into 1), we would have had this deadlock: + imagine thread 1 and 2, in non-autocommit mode, thread 3, and an InnoDB + table t. + thd1: SELECT * FROM t FOR UPDATE; + thd2: UPDATE t SET a=1; # blocked by row-level locks of thd1 + thd3: FLUSH TABLES WITH READ LOCK; # blocked in close_cached_tables() by the + table instance of thd2 + thd1: COMMIT; # blocked by thd3. + thd1 blocks thd2 which blocks thd3 which blocks thd1: deadlock. + + Note that we need to support that one thread does + FLUSH TABLES WITH READ LOCK; and then COMMIT; + (that's what innobackup does, for some good reason). + So in this exceptional case the COMMIT should not be blocked by the FLUSH + TABLES WITH READ LOCK. + + TODO in MySQL 5.x: make_global_read_lock_block_commit() should be + killable. Normally CPU does not spend a long time in this function (COMMITs + are quite fast), but it would still be nice. - Taking the global read lock is TWO steps (2nd step is optional; without - it, COMMIT of existing transactions will be allowed): - lock_global_read_lock() THEN make_global_read_lock_block_commit(). ****************************************************************************/ volatile uint global_read_lock=0; @@ -831,6 +886,8 @@ void start_waiting_global_read_lock(THD *thd) { bool tmp; DBUG_ENTER("start_waiting_global_read_lock"); + if (unlikely(thd->global_read_lock)) + DBUG_VOID_RETURN; (void) pthread_mutex_lock(&LOCK_open); tmp= (!--protect_against_global_read_lock && waiting_for_read_lock); (void) pthread_mutex_unlock(&LOCK_open); diff --git a/sql/log.cc b/sql/log.cc index 75a1743febc..c659a3ede2e 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -383,8 +383,7 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg, master (it has binlog version of the master, event types of the master), so this is suitable to parse the next relay log's event. It has been produced by - Format_description_log_event::Format_description_log_event(char* - buf,). + Format_description_log_event::Format_description_log_event(char* buf,). Why don't we want to write the description_event_for_queue if this event is for format<4 (3.23 or 4.x): this is because in that case, the description_event_for_queue describes the data received from the @@ -1326,7 +1325,7 @@ bool MYSQL_LOG::write(Log_event* event_info) (local_db && !db_ok(local_db, binlog_do_db, binlog_ignore_db))) { VOID(pthread_mutex_unlock(&LOCK_log)); - DBUG_PRINT("error",("!db_ok")); + DBUG_PRINT("error",("!db_ok('%s')", local_db)); DBUG_RETURN(0); } #endif /* HAVE_REPLICATION */ @@ -1369,7 +1368,7 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u", (uint) thd->variables.collation_connection->number, (uint) thd->variables.collation_database->number, (uint) thd->variables.collation_server->number); - Query_log_event e(thd, buf, written, 0); + Query_log_event e(thd, buf, written, 0, FALSE); if (e.write(file)) goto err; } @@ -1384,7 +1383,7 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u", char *buf_end= strxmov(buf, "SET ONE_SHOT TIME_ZONE='", thd->variables.time_zone->get_name()->ptr(), "'", NullS); - Query_log_event e(thd, buf, buf_end - buf, 0); + Query_log_event e(thd, buf, buf_end - buf, 0, FALSE); if (e.write(file)) goto err; } @@ -1430,7 +1429,7 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u", char buf[256], *p; p= strmov(strmov(buf, "SET CHARACTER SET "), thd->variables.convert_set->name); - Query_log_event e(thd, buf, (ulong) (p - buf), 0); + Query_log_event e(thd, buf, (ulong) (p - buf), 0, FALSE); if (e.write(file)) goto err; } @@ -1611,7 +1610,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback) we will add the "COMMIT mark and write the buffer to the binlog. */ { - Query_log_event qinfo(thd, "BEGIN", 5, TRUE); + Query_log_event qinfo(thd, "BEGIN", 5, TRUE, FALSE); /* Imagine this is rollback due to net timeout, after all statements of the transaction succeeded. Then we want a zero-error code in BEGIN. @@ -1651,7 +1650,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback) Query_log_event qinfo(thd, commit_or_rollback ? "COMMIT" : "ROLLBACK", commit_or_rollback ? 6 : 8, - TRUE); + TRUE, FALSE); qinfo.error_code= 0; if (qinfo.write(&log_file) || flush_io_cache(&log_file) || sync_binlog(&log_file)) diff --git a/sql/log_event.cc b/sql/log_event.cc index 77769f0e7e8..760436592b9 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -921,7 +921,8 @@ void Query_log_event::pack_info(Protocol *protocol) if (!(buf= my_malloc(9 + db_len + q_len, MYF(MY_WME)))) return; pos= buf; - if (db && db_len) + if (!(flags & LOG_EVENT_SUPPRESS_USE_F) + && db && db_len) { pos= strmov(buf, "use `"); memcpy(pos, db, db_len); @@ -1077,9 +1078,12 @@ bool Query_log_event::write(IO_CACHE* file) #ifndef MYSQL_CLIENT Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, - ulong query_length, bool using_trans) - :Log_event(thd_arg, !thd_arg->tmp_table_used ? - 0 : LOG_EVENT_THREAD_SPECIFIC_F, using_trans), + ulong query_length, bool using_trans, + bool suppress_use) + :Log_event(thd_arg, + ((thd_arg->tmp_table_used ? LOG_EVENT_THREAD_SPECIFIC_F : 0) + | (suppress_use ? LOG_EVENT_SUPPRESS_USE_F : 0)), + using_trans), data_buf(0), query(query_arg), catalog(thd_arg->catalog), db(thd_arg->db), q_len((uint32) query_length), error_code((thd_arg->killed != THD::NOT_KILLED) ? @@ -1259,14 +1263,14 @@ void Query_log_event::print(FILE* file, bool short_form, (ulong) thread_id, (ulong) exec_time, error_code); } - if (db) + if (!(flags & LOG_EVENT_SUPPRESS_USE_F) && db) { - if ((different_db = memcmp(last_event_info->db, db, db_len + 1))) + if (different_db= memcmp(last_event_info->db, db, db_len + 1)) memcpy(last_event_info->db, db, db_len + 1); + if (db[0] && different_db) + fprintf(file, "use %s;\n", db); } - - if (db && db[0] && different_db) - fprintf(file, "use %s;\n", db); + end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10); *end++=';'; *end++='\n'; diff --git a/sql/log_event.h b/sql/log_event.h index 7f958749a98..390a8c8070d 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -329,6 +329,19 @@ struct sql_ex_info #define OPTIONS_WRITTEN_TO_BIN_LOG (OPTION_AUTO_IS_NULL | \ OPTION_NO_FOREIGN_KEY_CHECKS | OPTION_RELAXED_UNIQUE_CHECKS) +/* + Suppress the generation of 'USE' statements before the actual + statement. This flag should be set for any events that does not need + the current database set to function correctly. Most notable cases + are 'CREATE DATABASE' and 'DROP DATABASE'. + + This flags should only be used in exceptional circumstances, since + it introduce a significant change in behaviour regarding the + replication logic together with the flags --binlog-do-db and + --replicated-do-db. + */ +#define LOG_EVENT_SUPPRESS_USE_F 0x8 + enum Log_event_type { /* @@ -446,8 +459,9 @@ public: /* Some 16 flags. Only one is really used now; look above for - LOG_EVENT_TIME_F, LOG_EVENT_FORCED_ROTATE_F, LOG_EVENT_THREAD_SPECIFIC_F - for notes. + LOG_EVENT_TIME_F, LOG_EVENT_FORCED_ROTATE_F, + LOG_EVENT_THREAD_SPECIFIC_F, and LOG_EVENT_SUPPRESS_USE_F for + notes. */ uint16 flags; @@ -650,7 +664,7 @@ public: #ifndef MYSQL_CLIENT Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length, - bool using_trans); + bool using_trans, bool suppress_use); const char* get_db() { return db; } #ifdef HAVE_REPLICATION void pack_info(Protocol* protocol); diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 09bec0a9323..91d15dc1125 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -788,7 +788,8 @@ bool add_field_to_list(THD *thd, char *field_name, enum enum_field_types type, uint type_modifier, Item *default_value, Item *on_update_value, LEX_STRING *comment, - char *change, TYPELIB *interval,CHARSET_INFO *cs, + char *change, List<String> *interval_list, + CHARSET_INFO *cs, uint uint_geom_type); void store_position_for_column(const char *name); bool add_to_list(THD *thd, SQL_LIST &list,Item *group,bool asc=0); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 27248ebaec2..5e0cc47ecc5 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4910,7 +4910,7 @@ log and this option does nothing anymore.", "Data file autoextend increment in megabytes", (gptr*) &srv_auto_extend_increment, (gptr*) &srv_auto_extend_increment, - 0, GET_LONG, REQUIRED_ARG, 8L, 1L, ~0L, 0, 1L, 0}, + 0, GET_LONG, REQUIRED_ARG, 8L, 1L, 1000L, 0, 1L, 0}, {"innodb_buffer_pool_awe_mem_mb", OPT_INNODB_BUFFER_POOL_AWE_MEM_MB, "If Windows AWE is used, the size of InnoDB buffer pool allocated from the AWE memory.", (gptr*) &innobase_buffer_pool_awe_mem_mb, (gptr*) &innobase_buffer_pool_awe_mem_mb, 0, diff --git a/sql/set_var.cc b/sql/set_var.cc index 532547c2618..234ec6617c3 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -2773,24 +2773,23 @@ sys_var *find_sys_var(const char *str, uint length) int sql_set_variables(THD *thd, List<set_var_base> *var_list) { - int error= 0; + int error; List_iterator_fast<set_var_base> it(*var_list); DBUG_ENTER("sql_set_variables"); set_var_base *var; while ((var=it++)) { - if ((error=var->check(thd))) + if ((error= var->check(thd))) goto err; } - if (!thd->net.report_error) + if (!(error= test(thd->net.report_error))) { it.rewind(); while ((var= it++)) error|= var->update(thd); // Returns 0, -1 or 1 } - else - error= 1; + err: free_underlaid_joins(thd, &thd->lex->select_lex); DBUG_RETURN(error); diff --git a/sql/slave.cc b/sql/slave.cc index e67def552bd..1e38d92ebc5 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -877,7 +877,7 @@ static TABLE_RULE_ENT* find_wild(DYNAMIC_ARRAY *a, const char* key, int len) 1 should be logged/replicated */ -int tables_ok(THD* thd, TABLE_LIST* tables) +bool tables_ok(THD* thd, TABLE_LIST* tables) { bool some_tables_updating= 0; DBUG_ENTER("tables_ok"); diff --git a/sql/slave.h b/sql/slave.h index 1abe166c944..69d3dc38e78 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -494,7 +494,7 @@ bool show_master_info(THD* thd, MASTER_INFO* mi); bool show_binlog_info(THD* thd); /* See if the query uses any tables that should not be replicated */ -int tables_ok(THD* thd, TABLE_LIST* tables); +bool tables_ok(THD* thd, TABLE_LIST* tables); /* Check to see if the database is ok to operate on with respect to the diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 0c6b061aa0c..b69ee068407 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1313,7 +1313,7 @@ bool change_password(THD *thd, const char *host, const char *user, acl_user->host.hostname ? acl_user->host.hostname : "", new_password)); thd->clear_error(); - Query_log_event qinfo(thd, buff, query_length, 0); + Query_log_event qinfo(thd, buff, query_length, 0, FALSE); mysql_bin_log.write(&qinfo); DBUG_RETURN(0); } @@ -2153,7 +2153,7 @@ static int replace_column_table(GRANT_TABLE *g_t, { table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS); if (table->file->index_read(table->record[0], (byte*) table->field[0]->ptr, - table->key_info[0].key_length, + key_length, HA_READ_KEY_EXACT)) goto end; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 97e2a2cf0d0..3ead7163171 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -535,7 +535,7 @@ void close_temporary_tables(THD *thd) { /* The -1 is to remove last ',' */ thd->clear_error(); - Query_log_event qinfo(thd, query, (ulong)(end-query)-1, 0); + Query_log_event qinfo(thd, query, (ulong)(end-query)-1, 0, FALSE); /* Imagine the thread had created a temp table, then was doing a SELECT, and the SELECT was killed. Then it's not clever to mark the statement above as @@ -1587,7 +1587,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db, { end = strxmov(strmov(query, "DELETE FROM `"), db,"`.`",name,"`", NullS); - Query_log_event qinfo(thd, query, (ulong)(end-query), 0); + Query_log_event qinfo(thd, query, (ulong)(end-query), 0, FALSE); mysql_bin_log.write(&qinfo); my_free(query, MYF(0)); } diff --git a/sql/sql_class.h b/sql/sql_class.h index 083f90fc93e..6cec2c2c787 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1230,6 +1230,12 @@ public: void set_status_var_init(); }; +#define tmp_disable_binlog(A) \ + ulong save_options= (A)->options; \ + (A)->options&= ~OPTION_BIN_LOG; + +#define reenable_binlog(A) (A)->options= save_options; + /* Flags for the THD::system_thread (bitmap) variable */ #define SYSTEM_THREAD_DELAYED_INSERT 1 #define SYSTEM_THREAD_SLAVE_IO 2 @@ -1371,6 +1377,7 @@ class select_insert :public select_result_interceptor { ~select_insert(); int prepare(List<Item> &list, SELECT_LEX_UNIT *u); bool send_data(List<Item> &items); + virtual void store_values(List<Item> &values); void send_error(uint errcode,const char *err); bool send_eof(); /* not implemented: select_insert is never re-used in prepared statements */ @@ -1397,7 +1404,8 @@ public: lock(0) {} int prepare(List<Item> &list, SELECT_LEX_UNIT *u); - bool send_data(List<Item> &values); + void store_values(List<Item> &values); + void send_error(uint errcode,const char *err); bool send_eof(); void abort(); }; @@ -1447,7 +1455,7 @@ public: if (copy_field) /* Fix for Intel compiler */ { delete [] copy_field; - copy_field=0; + save_copy_field= copy_field= 0; } } }; diff --git a/sql/sql_db.cc b/sql/sql_db.cc index ad4887146d8..3e606029bec 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -468,7 +468,29 @@ bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, } if (mysql_bin_log.is_open()) { - Query_log_event qinfo(thd, query, query_length, 0); + Query_log_event qinfo(thd, query, query_length, 0, + /* suppress_use */ TRUE); + + /* + Write should use the database being created as the "current + database" and not the threads current database, which is the + default. If we do not change the "current database" to the + database being created, the CREATE statement will not be + replicated when using --binlog-do-db to select databases to be + replicated. + + An example (--binlog-do-db=sisyfos): + + CREATE DATABASE bob; # Not replicated + USE bob; # 'bob' is the current database + CREATE DATABASE sisyfos; # Not replicated since 'bob' is + # current database. + USE sisyfos; # Will give error on slave since + # database does not exist. + */ + qinfo.db = db; + qinfo.db_len = strlen(db); + mysql_bin_log.write(&qinfo); } send_ok(thd, result); @@ -517,7 +539,15 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info) if (mysql_bin_log.is_open()) { - Query_log_event qinfo(thd, thd->query, thd->query_length, 0); + Query_log_event qinfo(thd, thd->query, thd->query_length, 0, + /* suppress_use */ TRUE); + + // Write should use the database being created as the "current + // database" and not the threads current database, which is the + // default. + qinfo.db = db; + qinfo.db_len = strlen(db); + thd->clear_error(); mysql_bin_log.write(&qinfo); } @@ -623,7 +653,15 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) } if (mysql_bin_log.is_open()) { - Query_log_event qinfo(thd, query, query_length, 0); + Query_log_event qinfo(thd, query, query_length, 0, + /* suppress_use */ TRUE); + + // Write should use the database being created as the "current + // database" and not the threads current database, which is the + // default. + qinfo.db = db; + qinfo.db_len = strlen(db); + thd->clear_error(); mysql_bin_log.write(&qinfo); } diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 51cf085cfb5..f4c5b0f8b59 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -249,7 +249,7 @@ cleanup: if (error <= 0) thd->clear_error(); Query_log_event qinfo(thd, thd->query, thd->query_length, - log_delayed); + log_delayed, FALSE); if (mysql_bin_log.write(&qinfo) && transactional_table) error=1; } @@ -670,7 +670,7 @@ bool multi_delete::send_eof() if (error <= 0) thd->clear_error(); Query_log_event qinfo(thd, thd->query, thd->query_length, - log_delayed); + log_delayed, FALSE); if (mysql_bin_log.write(&qinfo) && !normal_tables) local_error=1; // Log write failed: roll back the SQL statement } @@ -779,7 +779,7 @@ end: { thd->clear_error(); Query_log_event qinfo(thd, thd->query, thd->query_length, - thd->tmp_table); + thd->tmp_table, FALSE); mysql_bin_log.write(&qinfo); } send_ok(thd); // This should return record count diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 673d7425c36..77a669e4c96 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -455,7 +455,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, if (error <= 0) thd->clear_error(); Query_log_event qinfo(thd, thd->query, thd->query_length, - log_delayed); + log_delayed, FALSE); if (mysql_bin_log.write(&qinfo) && transactional_table) error=1; } @@ -1614,7 +1614,7 @@ bool delayed_insert::handle_inserts(void) } if (row->query && row->log_query && using_bin_log) { - Query_log_event qinfo(&thd, row->query, row->query_length,0); + Query_log_event qinfo(&thd, row->query, row->query_length, 0, FALSE); mysql_bin_log.write(&qinfo); } if (table->blob_fields) @@ -1795,7 +1795,6 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u) restore_record(table,default_values); // Get empty record table->next_number_field=table->found_next_number_field; - thd->count_cuted_fields= CHECK_FIELD_WARN; // calc cuted fields thd->cuted_fields=0; if (info.handle_duplicates == DUP_IGNORE || info.handle_duplicates == DUP_REPLACE) @@ -1834,35 +1833,44 @@ select_insert::~select_insert() bool select_insert::send_data(List<Item> &values) { DBUG_ENTER("select_insert::send_data"); + bool error=0; if (unit->offset_limit_cnt) { // using limit offset,count unit->offset_limit_cnt--; DBUG_RETURN(0); } - if (fields->elements) - fill_record(thd, *fields, values, 1); - else - fill_record(thd, table->field, values, 1); + + thd->count_cuted_fields= CHECK_FIELD_WARN; // calc cuted fields + store_values(values); + thd->count_cuted_fields= CHECK_FIELD_IGNORE; + if (thd->net.report_error) + DBUG_RETURN(1); switch (table_list->view_check_option(thd, - thd->lex->duplicates == DUP_IGNORE)) - { + thd->lex->duplicates == DUP_IGNORE)) { case VIEW_CHECK_SKIP: DBUG_RETURN(0); case VIEW_CHECK_ERROR: DBUG_RETURN(1); } - if (thd->net.report_error || write_record(thd, table, &info)) - DBUG_RETURN(1); - if (table->next_number_field) // Clear for next record + if (!(error= write_record(table,&info)) && table->next_number_field) { + /* Clear for next record */ table->next_number_field->reset(); if (! last_insert_id && thd->insert_id_used) last_insert_id=thd->insert_id(); } - DBUG_RETURN(0); + DBUG_RETURN(error); } +void select_insert::store_values(List<Item> &values) +{ + if (fields->elements) + fill_record(*fields, values, 1); + else + fill_record(table->field, values, 1); +} + void select_insert::send_error(uint errcode,const char *err) { DBUG_ENTER("select_insert::send_error"); @@ -1892,7 +1900,7 @@ void select_insert::send_error(uint errcode,const char *err) if (mysql_bin_log.is_open()) { Query_log_event qinfo(thd, thd->query, thd->query_length, - table->file->has_transactions()); + table->file->has_transactions(), FALSE); mysql_bin_log.write(&qinfo); } if (!table->tmp_table) @@ -1935,7 +1943,7 @@ bool select_insert::send_eof() if (!error) thd->clear_error(); Query_log_event qinfo(thd, thd->query, thd->query_length, - table->file->has_transactions()); + table->file->has_transactions(), FALSE); mysql_bin_log.write(&qinfo); } if ((error2=ha_autocommit_or_rollback(thd,error)) && ! error) @@ -1988,8 +1996,6 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u) table->next_number_field=table->found_next_number_field; restore_record(table,default_values); // Get empty record - /* Count warnings. This is reset in ~select_insert() */ - thd->count_cuted_fields= CHECK_FIELD_WARN; thd->cuted_fields=0; if (info.handle_duplicates == DUP_IGNORE || info.handle_duplicates == DUP_REPLACE) @@ -2004,23 +2010,21 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u) } -bool select_create::send_data(List<Item> &values) +void select_create::store_values(List<Item> &values) { - if (unit->offset_limit_cnt) - { // using limit offset,count - unit->offset_limit_cnt--; - return 0; - } fill_record(thd, field, values, 1); - if (thd->net.report_error || write_record(thd, table, &info)) - return 1; - if (table->next_number_field) // Clear for next record - { - table->next_number_field->reset(); - if (! last_insert_id && thd->insert_id_used) - last_insert_id=thd->insert_id(); - } - return 0; +} + + +void select_create::send_error(uint errcode,const char *err) +{ + /* + Disable binlog, because we "roll back" partial inserts in ::abort + by removing the table, even for non-transactional tables. + */ + tmp_disable_binlog(thd); + select_insert::send_error(errcode, err); + reenable_binlog(thd); } @@ -2068,7 +2072,7 @@ void select_create::abort() enum db_type table_type=table->db_type; if (!table->tmp_table) { - ulong version= table->version; + ulong version= table->version; hash_delete(&open_cache,(byte*) table); if (!create_info->table_existed) quick_rm_table(table_type, create_table->db, create_table->real_name); diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index ce37318ca01..8a705a7438b 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -144,7 +144,7 @@ void lex_start(THD *thd, uchar *buf,uint length) lex->select_lex.init_order(); lex->select_lex.group_list.empty(); lex->describe= 0; - lex->derived_tables= FALSE; + lex->subqueries= lex->derived_tables= FALSE; lex->view_prepare_mode= FALSE; lex->lock_option= TL_READ; lex->found_colon= 0; diff --git a/sql/sql_lex.h b/sql/sql_lex.h index e99e6138b6d..1c0e3e2e02e 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -687,7 +687,6 @@ typedef struct st_lex List<Item_param> param_list; List<LEX_STRING> view_list; // view list (list of field names in view) SQL_LIST proc_list, auxilliary_table_list, save_list; - TYPELIB *interval; create_field *last_field; char *savepoint_name; // Transaction savepoint id udf_func udf; @@ -721,6 +720,7 @@ typedef struct st_lex /* special JOIN::prepare mode: changing of query is prohibited */ bool view_prepare_mode; bool safe_to_cache_query; + bool subqueries; bool variables_used; ALTER_INFO alter_info; /* Prepared statements SQL syntax:*/ diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index e27cd20e15e..44adc28d41d 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2830,7 +2830,7 @@ create_error: if (mysql_bin_log.is_open()) { thd->clear_error(); // No binlog error generated - Query_log_event qinfo(thd, thd->query, thd->query_length, 0); + Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); mysql_bin_log.write(&qinfo); } } @@ -2860,7 +2860,7 @@ create_error: if (mysql_bin_log.is_open()) { thd->clear_error(); // No binlog error generated - Query_log_event qinfo(thd, thd->query, thd->query_length, 0); + Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); mysql_bin_log.write(&qinfo); } } @@ -2883,7 +2883,7 @@ create_error: if (mysql_bin_log.is_open()) { thd->clear_error(); // No binlog error generated - Query_log_event qinfo(thd, thd->query, thd->query_length, 0); + Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); mysql_bin_log.write(&qinfo); } } @@ -3411,7 +3411,7 @@ create_error: { if (mysql_bin_log.is_open()) { - Query_log_event qinfo(thd, thd->query, thd->query_length, 0); + Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); mysql_bin_log.write(&qinfo); } send_ok(thd); @@ -3426,7 +3426,7 @@ create_error: { if (mysql_bin_log.is_open()) { - Query_log_event qinfo(thd, thd->query, thd->query_length, 0); + Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); mysql_bin_log.write(&qinfo); } send_ok(thd); @@ -3441,7 +3441,7 @@ create_error: { if (mysql_bin_log.is_open()) { - Query_log_event qinfo(thd, thd->query, thd->query_length, 0); + Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); mysql_bin_log.write(&qinfo); } send_ok(thd); @@ -3484,7 +3484,7 @@ create_error: mysql_bin_log.is_open()) { thd->clear_error(); - Query_log_event qinfo(thd, thd->query, thd->query_length, 0); + Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); mysql_bin_log.write(&qinfo); } } @@ -3504,7 +3504,7 @@ create_error: if (mysql_bin_log.is_open()) { thd->clear_error(); - Query_log_event qinfo(thd, thd->query, thd->query_length, 0); + Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); mysql_bin_log.write(&qinfo); } if (mqh_used && lex->sql_command == SQLCOM_GRANT) @@ -3544,7 +3544,7 @@ create_error: { if (mysql_bin_log.is_open()) { - Query_log_event qinfo(thd, thd->query, thd->query_length, 0); + Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); mysql_bin_log.write(&qinfo); } } @@ -4529,6 +4529,7 @@ mysql_new_select(LEX *lex, bool move_down) select_lex->parent_lex= lex; if (move_down) { + lex->subqueries= TRUE; /* first select_lex of subselect or derived table */ SELECT_LEX_UNIT *unit; if (!(unit= new(lex->thd->mem_root) SELECT_LEX_UNIT())) @@ -4717,31 +4718,6 @@ bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length) -/* - Calculate interval lengths. - Strip trailing spaces from all strings. - After this function call: - - ENUM uses max_length - - SET uses tot_length. -*/ -void calculate_interval_lengths(THD *thd, TYPELIB *interval, - uint32 *max_length, uint32 *tot_length) -{ - const char **pos; - uint *len; - CHARSET_INFO *cs= thd->variables.character_set_client; - *max_length= *tot_length= 0; - for (pos= interval->type_names, len= interval->type_lengths; - *pos ; pos++, len++) - { - *len= (uint) strip_sp((char*) *pos); - uint length= cs->cset->numchars(cs, *pos, *pos + *len); - *tot_length+= length; - set_if_bigger(*max_length, (uint32)length); - } -} - - /***************************************************************************** ** Store field definition for create ** Return 0 if ok @@ -4752,7 +4728,8 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type, uint type_modifier, Item *default_value, Item *on_update_value, LEX_STRING *comment, - char *change, TYPELIB *interval, CHARSET_INFO *cs, + char *change, + List<String> *interval_list, CHARSET_INFO *cs, uint uint_geom_type) { register create_field *new_field; @@ -5059,62 +5036,39 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type, break; case FIELD_TYPE_SET: { - if (interval->count > sizeof(longlong)*8) + if (interval_list->elements > sizeof(longlong)*8) { my_error(ER_TOO_BIG_SET, MYF(0), field_name); /* purecov: inspected */ - DBUG_RETURN(1); /* purecov: inspected */ + DBUG_RETURN(1); /* purecov: inspected */ } - new_field->pack_length=(interval->count+7)/8; + new_field->pack_length= (interval_list->elements + 7) / 8; if (new_field->pack_length > 4) - new_field->pack_length=8; - new_field->interval=interval; - uint32 dummy_max_length; - calculate_interval_lengths(thd, interval, - &dummy_max_length, &new_field->length); - new_field->length+= (interval->count - 1); - set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1); - if (default_value) - { - char *not_used; - uint not_used2; - bool not_used3; - - thd->cuted_fields=0; - String str,*res; - res=default_value->val_str(&str); - (void) find_set(interval, res->ptr(), res->length(), - &my_charset_bin, - ¬_used, ¬_used2, ¬_used3); - if (thd->cuted_fields) - { - my_error(ER_INVALID_DEFAULT, MYF(0), field_name); - DBUG_RETURN(1); - } - } + new_field->pack_length=8; + + List_iterator<String> it(*interval_list); + String *tmp; + while ((tmp= it++)) + new_field->interval_list.push_back(tmp); + /* + Set fake length to 1 to pass the below conditions. + Real length will be set in mysql_prepare_table() + when we know the character set of the column + */ + new_field->length= 1; } break; case FIELD_TYPE_ENUM: { - new_field->interval=interval; - new_field->pack_length=interval->count < 256 ? 1 : 2; // Should be safe + // Should be safe + new_field->pack_length= interval_list->elements < 256 ? 1 : 2; - uint32 dummy_tot_length; - calculate_interval_lengths(thd, interval, - &new_field->length, &dummy_tot_length); - set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1); - if (default_value) - { - String str,*res; - res=default_value->val_str(&str); - res->strip_sp(); - if (!find_type(interval, res->ptr(), res->length(), 0)) - { - my_error(ER_INVALID_DEFAULT, MYF(0), field_name); - DBUG_RETURN(1); - } - } - break; + List_iterator<String> it(*interval_list); + String *tmp; + while ((tmp= it++)) + new_field->interval_list.push_back(tmp); + new_field->length= 1; // See comment for FIELD_TYPE_SET above. } + break; } if ((new_field->length > MAX_FIELD_CHARLENGTH && type != FIELD_TYPE_SET && diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index d4851393a89..6d59d465445 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -427,8 +427,17 @@ static void set_param_date(Item_param *param, uchar **pos, ulong len) #else/*!EMBEDDED_LIBRARY*/ void set_param_time(Item_param *param, uchar **pos, ulong len) { - MYSQL_TIME *to= (MYSQL_TIME*)*pos; - param->set_time(to, MYSQL_TIMESTAMP_TIME, + MYSQL_TIME tm= *((MYSQL_TIME*)*pos); + tm.hour+= tm.day * 24; + tm.day= tm.year= tm.month= 0; + if (tm.hour > 838) + { + /* TODO: add warning 'Data truncated' here */ + tm.hour= 838; + tm.minute= 59; + tm.second= 59; + } + param->set_time(&tm, MYSQL_TIMESTAMP_TIME, MAX_TIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN); } diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc index 9f29a975441..1640fc1a634 100644 --- a/sql/sql_rename.cc +++ b/sql/sql_rename.cc @@ -84,7 +84,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list) if (mysql_bin_log.is_open()) { thd->clear_error(); - Query_log_event qinfo(thd, thd->query, thd->query_length, 0); + Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); mysql_bin_log.write(&qinfo); } send_ok(thd); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 0a7cd0f7338..ba9933a3d15 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1050,7 +1050,7 @@ JOIN::optimize() } } - if (select_lex->master_unit()->uncacheable) + if (thd->lex->subqueries) { if (!(tmp_join= (JOIN*)thd->alloc(sizeof(JOIN)))) DBUG_RETURN(-1); @@ -5702,7 +5702,9 @@ JOIN::join_free(bool full) JOIN_TAB *tab,*end; DBUG_ENTER("JOIN::join_free"); - full= full || !select_lex->uncacheable; + full= full || (!select_lex->uncacheable && + !thd->lex->subqueries && + !thd->lex->describe); // do not cleanup too early on EXPLAIN if (table) { @@ -5731,6 +5733,7 @@ JOIN::join_free(bool full) for (tab= join_tab, end= tab+tables; tab != end; tab++) tab->cleanup(); table= 0; + tables= 0; } else { diff --git a/sql/sql_show.cc b/sql/sql_show.cc index eb9ca43b56a..fd12c206e64 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -847,6 +847,15 @@ append_identifier(THD *thd, String *packet, const char *name, uint length) { uchar chr= (uchar) *name; length= my_mbcharlen(system_charset_info, chr); + /* + my_mbcharlen can retur 0 on a wrong multibyte + sequence. It is possible when upgrading from 4.0, + and identifier contains some accented characters. + The manual says it does not work. So we'll just + change length to 1 not to hang in the endless loop. + */ + if (!length) + length= 1; if (length == 1 && chr == (uchar) quote_char) packet->append("e_char, 1, system_charset_info); packet->append(name, length, packet->charset()); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index a7c08f356a2..a1e09d74620 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -29,12 +29,6 @@ #include <io.h> #endif -#define tmp_disable_binlog(A) \ - ulong save_options= (A)->options; \ - (A)->options&= ~OPTION_BIN_LOG; - -#define reenable_binlog(A) (A)->options= save_options; - const char *primary_key_name="PRIMARY"; static bool check_if_keyname_exists(const char *name,KEY *start, KEY *end); @@ -281,7 +275,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, if (!error) thd->clear_error(); Query_log_event qinfo(thd, thd->query, thd->query_length, - tmp_table_deleted && !some_tables_deleted); + tmp_table_deleted && !some_tables_deleted, + FALSE); mysql_bin_log.write(&qinfo); } } @@ -390,6 +385,41 @@ void check_duplicates_in_interval(const char *set_or_name, } } + +/* + Check TYPELIB (set or enum) max and total lengths + + SYNOPSIS + calculate_interval_lengths() + cs charset+collation pair of the interval + typelib list of values for the column + max_length length of the longest item + tot_length sum of the item lengths + + DESCRIPTION + After this function call: + - ENUM uses max_length + - SET uses tot_length. + + RETURN VALUES + void +*/ +void calculate_interval_lengths(CHARSET_INFO *cs, TYPELIB *interval, + uint32 *max_length, uint32 *tot_length) +{ + const char **pos; + uint *len; + *max_length= *tot_length= 0; + for (pos= interval->type_names, len= interval->type_lengths; + *pos ; pos++, len++) + { + uint length= cs->cset->numchars(cs, *pos, *pos + *len); + *tot_length+= length; + set_if_bigger(*max_length, (uint32)length); + } +} + + /* Preparation for table creation @@ -453,6 +483,91 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, DBUG_RETURN(-1); } + if ((sql_field->sql_type == FIELD_TYPE_SET || + sql_field->sql_type == FIELD_TYPE_ENUM) && !sql_field->interval) + { + uint32 dummy; + CHARSET_INFO *cs= sql_field->charset; + TYPELIB *interval; + + /* + Create typelib from interval_list, and if necessary + convert strings from client character set to the + column character set. + */ + + interval= sql_field->interval= typelib(sql_field->interval_list); + List_iterator<String> it(sql_field->interval_list); + String conv, *tmp; + for (uint i= 0; (tmp= it++); i++) + { + if (String::needs_conversion(tmp->length(), tmp->charset(), cs, &dummy)) + { + uint cnv_errs; + conv.copy(tmp->ptr(), tmp->length(), tmp->charset(), cs, &cnv_errs); + char *buf= (char*) sql_alloc(conv.length()+1); + memcpy(buf, conv.ptr(), conv.length()); + buf[conv.length()]= '\0'; + interval->type_names[i]= buf; + interval->type_lengths[i]= conv.length(); + } + + // Strip trailing spaces. + uint lengthsp= cs->cset->lengthsp(cs, interval->type_names[i], + interval->type_lengths[i]); + interval->type_lengths[i]= lengthsp; + ((uchar *)interval->type_names[i])[lengthsp]= '\0'; + } + sql_field->interval_list.empty(); // Don't need interval_list anymore + + + /* + Convert the default value from client character + set into the column character set if necessary. + */ + if (sql_field->def) + { + sql_field->def= + sql_field->def->safe_charset_converter(cs); + } + + if (sql_field->sql_type == FIELD_TYPE_SET) + { + if (sql_field->def) + { + char *not_used; + uint not_used2; + bool not_found= 0; + String str, *def= sql_field->def->val_str(&str); + def->length(cs->cset->lengthsp(cs, def->ptr(), def->length())); + (void) find_set(interval, def->ptr(), def->length(), + cs, ¬_used, ¬_used2, ¬_found); + if (not_found) + { + my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name); + DBUG_RETURN(-1); + } + } + calculate_interval_lengths(cs, interval, &dummy, &sql_field->length); + sql_field->length+= (interval->count - 1); + } + else /* FIELD_TYPE_ENUM */ + { + if (sql_field->def) + { + String str, *def= sql_field->def->val_str(&str); + def->length(cs->cset->lengthsp(cs, def->ptr(), def->length())); + if (!find_type2(interval, def->ptr(), def->length(), cs)) + { + my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name); + DBUG_RETURN(-1); + } + } + calculate_interval_lengths(cs, interval, &sql_field->length, &dummy); + } + set_if_smaller(sql_field->length, MAX_FIELD_WIDTH-1); + } + sql_field->create_length_to_internal_length(); /* Don't pack keys in old tables if the user has requested this */ @@ -816,8 +931,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, DBUG_RETURN(-1); } } - else - if (key_info->algorithm == HA_KEY_ALG_RTREE) + else if (key_info->algorithm == HA_KEY_ALG_RTREE) { #ifdef HAVE_RTREE_KEYS if ((key_info->key_parts & 1) == 1) @@ -839,6 +953,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, CHARSET_INFO *ft_key_charset=0; // for FULLTEXT for (uint column_nr=0 ; (column=cols++) ; column_nr++) { + key_part_spec *dup_column; + it.rewind(); field=0; while ((sql_field=it++) && @@ -851,9 +967,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), column->field_name); DBUG_RETURN(-1); } - for (uint dup_nr= 0; dup_nr < column_nr; dup_nr++) + while ((dup_column= cols2++) != column) { - key_part_spec *dup_column= cols2++; if (!my_strcasecmp(system_charset_info, column->field_name, dup_column->field_name)) { @@ -864,12 +979,6 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, } } cols2.rewind(); - /* for fulltext keys keyseg length is 1 for blobs (it's ignored in - ft code anyway, and 0 (set to column width later) for char's. - it has to be correct col width for char's, as char data are not - prefixed with length (unlike blobs, where ft code takes data length - from a data prefix, ignoring column->length). - */ if (key->type == Key::FULLTEXT) { if ((sql_field->sql_type != FIELD_TYPE_STRING && @@ -1296,10 +1405,12 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name, thd->clear_error(); Query_log_event qinfo(thd, thd->query, thd->query_length, test(create_info->options & - HA_LEX_CREATE_TMP_TABLE)); + HA_LEX_CREATE_TMP_TABLE), + FALSE); mysql_bin_log.write(&qinfo); } error= FALSE; + end: VOID(pthread_mutex_unlock(&LOCK_open)); start_waiting_global_read_lock(thd); @@ -2274,7 +2385,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, thd->clear_error(); Query_log_event qinfo(thd, thd->query, thd->query_length, test(create_info->options & - HA_LEX_CREATE_TMP_TABLE)); + HA_LEX_CREATE_TMP_TABLE), + FALSE); mysql_bin_log.write(&qinfo); } res= FALSE; @@ -2384,7 +2496,7 @@ mysql_discard_or_import_tablespace(THD *thd, goto err; if (mysql_bin_log.is_open()) { - Query_log_event qinfo(thd, thd->query, thd->query_length, 0); + Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); mysql_bin_log.write(&qinfo); } err: @@ -2773,7 +2885,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, if (mysql_bin_log.is_open()) { thd->clear_error(); - Query_log_event qinfo(thd, thd->query, thd->query_length, 0); + Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); mysql_bin_log.write(&qinfo); } if (do_send_ok) @@ -3189,7 +3301,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, if (mysql_bin_log.is_open()) { thd->clear_error(); - Query_log_event qinfo(thd, thd->query, thd->query_length, 0); + Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); mysql_bin_log.write(&qinfo); } goto end_temporary; @@ -3323,7 +3435,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, if (mysql_bin_log.is_open()) { thd->clear_error(); - Query_log_event qinfo(thd, thd->query, thd->query_length, 0); + Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); mysql_bin_log.write(&qinfo); } VOID(pthread_cond_broadcast(&COND_refresh)); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 4a2790f7d78..7c55f281f38 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -482,7 +482,7 @@ int mysql_update(THD *thd, if (error <= 0) thd->clear_error(); Query_log_event qinfo(thd, thd->query, thd->query_length, - log_delayed); + log_delayed, FALSE); if (mysql_bin_log.write(&qinfo) && transactional_table) error=1; // Rollback update } @@ -1417,7 +1417,7 @@ bool multi_update::send_eof() if (local_error <= 0) thd->clear_error(); Query_log_event qinfo(thd, thd->query, thd->query_length, - log_delayed); + log_delayed, FALSE); if (mysql_bin_log.write(&qinfo) && trans_safe) local_error= 1; // Rollback update } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 74a96701bdc..8ea7cdb34fa 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2728,7 +2728,7 @@ field_spec: field_ident { LEX *lex=Lex; - lex->length=lex->dec=0; lex->type=0; lex->interval=0; + lex->length=lex->dec=0; lex->type=0; lex->default_value= lex->on_update_value= 0; lex->comment=0; lex->charset=NULL; @@ -2741,7 +2741,7 @@ field_spec: lex->length,lex->dec,lex->type, lex->default_value, lex->on_update_value, lex->comment, - lex->change,lex->interval,lex->charset, + lex->change,&lex->interval_list,lex->charset, lex->uint_geom_type)) YYABORT; }; @@ -2838,17 +2838,9 @@ type: | FIXED_SYM float_options field_options { $$=FIELD_TYPE_DECIMAL;} | ENUM {Lex->interval_list.empty();} '(' string_list ')' opt_binary - { - LEX *lex=Lex; - lex->interval=typelib(lex->interval_list); - $$=FIELD_TYPE_ENUM; - } + { $$=FIELD_TYPE_ENUM; } | SET { Lex->interval_list.empty();} '(' string_list ')' opt_binary - { - LEX *lex=Lex; - lex->interval=typelib(lex->interval_list); - $$=FIELD_TYPE_SET; - } + { $$=FIELD_TYPE_SET; } | LONG_SYM opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; } | SERIAL_SYM { @@ -3328,7 +3320,7 @@ alter_list_item: | MODIFY_SYM opt_column field_ident { LEX *lex=Lex; - lex->length=lex->dec=0; lex->type=0; lex->interval=0; + lex->length=lex->dec=0; lex->type=0; lex->default_value= lex->on_update_value= 0; lex->comment=0; lex->charset= NULL; @@ -3342,7 +3334,7 @@ alter_list_item: lex->length,lex->dec,lex->type, lex->default_value, lex->on_update_value, lex->comment, - $3.str, lex->interval, lex->charset, + $3.str, &lex->interval_list, lex->charset, lex->uint_geom_type)) YYABORT; } diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 851c2044f47..403d31aa15b 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -218,11 +218,78 @@ static int my_strnncoll_ucs2(CHARSET_INFO *cs, return t_is_prefix ? t-te : ((se-s) - (te-t)); } -static int my_strnncollsp_ucs2(CHARSET_INFO *cs, - const uchar *s, uint slen, +/* + Compare strings, discarding end space + + SYNOPSIS + my_strnncollsp_ucs2() + cs character set handler + a First string to compare + a_length Length of 'a' + b Second string to compare + b_length Length of 'b' + + IMPLEMENTATION + If one string is shorter as the other, then we space extend the other + so that the strings have equal length. + + This will ensure that the following things hold: + + "a" == "a " + "a\0" < "a" + "a\0" < "a " + + RETURN + < 0 a < b + = 0 a == b + > 0 a > b +*/ + +static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)), + const uchar *s, uint slen, const uchar *t, uint tlen) { - return my_strnncoll_ucs2(cs,s,slen,t,tlen,0); + const uchar *se, *te; + uint minlen; + + /* extra safety to make sure the lengths are even numbers */ + slen= (slen >> 1) << 1; + tlen= (tlen >> 1) << 1; + + se= s + slen; + te= t + tlen; + + for (minlen= min(slen, tlen); minlen; minlen-= 2) + { + int s_wc = uni_plane[s[0]] ? (int) uni_plane[s[0]][s[1]].sort : + (((int) s[0]) << 8) + (int) s[1]; + + int t_wc = uni_plane[t[0]] ? (int) uni_plane[t[0]][t[1]].sort : + (((int) t[0]) << 8) + (int) t[1]; + if ( s_wc != t_wc ) + return s_wc - t_wc; + + s+= 2; + t+= 2; + } + + if (slen != tlen) + { + int swap= 0; + if (slen < tlen) + { + s= t; + se= te; + swap= -1; + } + + for ( ; s < se ; s+= 2) + { + if (s[0] || s[1] != ' ') + return (((int)s[0] << 8) + (int) s[1] - (int) ' ') ^ swap; + } + } + return 0; } diff --git a/tests/client_test.c b/tests/client_test.c index 8bc945eac2c..aac0a92df65 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -694,8 +694,10 @@ static void verify_prepare_field(MYSQL_RES *result, as utf8. Field length is calculated as number of characters * maximum number of bytes a character can occupy. */ +#ifndef EMBEDDED_LIBRARY if (length) DIE_UNLESS(field->length == length * cs->mbmaxlen); +#endif if (def) DIE_UNLESS(strcmp(field->def, def) == 0); } diff --git a/tests/grant.pl b/tests/grant.pl index eb2d00f3e1d..cd6a2eb80de 100644 --- a/tests/grant.pl +++ b/tests/grant.pl @@ -74,9 +74,9 @@ safe_query("revoke select(user) on mysql.user from $user"); safe_query("grant select on *.* to $user"); safe_query("set password FOR ${opt_user}2\@$opt_host = password('test')",1); -safe_query("set password FOR $opt_user=password('test')"); +safe_query("set password FOR $opt_user\@$opt_host=password('test')"); user_connect(1); -safe_query("set password FOR $opt_user=''"); +safe_query("set password FOR $opt_user\@$opt_host=''"); user_connect(0); user_query("select * from mysql.user where user = '$opt_user'"); user_query("select * from mysql.db where user = '$opt_user'"); |