1
0
mirror of https://github.com/MariaDB/server.git synced 2025-05-28 13:01:41 +03:00

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

into mysql.com:/home/psergey/mysql-5.0-bug13317
This commit is contained in:
sergefp@mysql.com 2005-09-25 01:36:26 +04:00
commit 2294c9b57a
141 changed files with 4000 additions and 1381 deletions

View File

@ -478,6 +478,8 @@ libmysqld/sql_cache.cc
libmysqld/sql_class.cc
libmysqld/sql_command
libmysqld/sql_crypt.cc
libmysqld/sql_cursor.cc
libmysqld/sql_cursor.h
libmysqld/sql_db.cc
libmysqld/sql_delete.cc
libmysqld/sql_derived.cc

View File

@ -24,7 +24,7 @@
AdditionalIncludeDirectories="../include,../libmysqld,../sql,../regex,../extra/yassl/include,../bdb/build_win32,../zlib"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;SAFEMALLOC;HAVE_BERKELEY_DB;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;USE_TLS;__WIN__"
BasicRuntimeChecks="3"
RuntimeLibrary="0"
RuntimeLibrary="1"
PrecompiledHeaderFile=".\debug/libmysqld.pch"
AssemblerListingLocation=".\debug/"
ObjectFile=".\debug/"
@ -37,11 +37,11 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="odbc32.lib odbccp32.lib Wsock32.lib ..\lib_debug\dbug_tls.lib ..\lib_debug\mysys_tls.lib ..\lib_debug\strings.lib ..\lib_debug\regex.lib ..\lib_debug\heap_tls.lib ..\lib_debug\innodb.lib ..\extra\yassl\Debug\yassl.lib"
AdditionalDependencies="odbc32.lib odbccp32.lib Wsock32.lib"
OutputFile="../lib_debug/libmysqld.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
IgnoreDefaultLibraryNames="LIBCMTD"
IgnoreDefaultLibraryNames=""
ModuleDefinitionFile=".\libmysqld.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\debug/libmysqld.pdb"
@ -106,7 +106,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\myisam_tls.lib ..\lib_release\myisammrg_tls.lib ..\lib_release\mysys_tls.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap_tls.lib ..\lib_release\innodb.lib ..\lib_release\zlib.lib ..\extra\yassl\Release\yassl.lib"
AdditionalDependencies="odbc32.lib odbccp32.lib Wsock32.lib"
OutputFile="../lib_pro/libmysqld.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
@ -172,7 +172,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\myisam_tls.lib ..\lib_release\myisammrg_tls.lib ..\lib_release\mysys_tls.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap_tls.lib ..\lib_release\innodb.lib ..\lib_release\bdb.lib ..\lib_release\zlib.lib ..\extra\yassl\Release\yassl.lib"
AdditionalDependencies="odbc32.lib odbccp32.lib Wsock32.lib"
OutputFile="../lib_release/libmysqld.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
@ -238,7 +238,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\myisam_tls.lib ..\lib_release\myisammrg_tls.lib ..\lib_release\mysys_tls.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap_tls.lib ..\lib_release\zlib.lib ..\extra\yassl\Release\yassl.lib"
AdditionalDependencies="odbc32.lib odbccp32.lib Wsock32.lib"
OutputFile="../lib_classic/libmysqld.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
@ -2299,7 +2299,7 @@
</FileConfiguration>
</File>
<File
RelativePath="..\sql\protocol_cursor.cpp">
RelativePath="..\sql\sql_cursor.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool

View File

@ -40,7 +40,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libmysql.lib odbc32.lib odbccp32.lib"
OutputFile=".\release/myTest.exe"
OutputFile="..\client_release/myTest.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\lib_release"
@ -74,7 +74,7 @@
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\debug"
OutputDirectory="..\client_debug"
IntermediateDirectory=".\debug"
ConfigurationType="1"
UseOfMFC="0"
@ -100,7 +100,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libmysql.lib odbc32.lib odbccp32.lib"
OutputFile=".\debug/myTest.exe"
OutputFile="../client_debug/myTest.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\lib_debug"

View File

@ -101,7 +101,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="wsock32.lib setargv.obj ..\lib_release\myisam.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\zlib.lib"
AdditionalDependencies="wsock32.lib setargv.obj"
OutputFile="../client_classic/myisamchk.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"

View File

@ -37,6 +37,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmysqld", "libmysqld\libm
{13D37150-54D0-46C5-9519-03923243C7C7} = {13D37150-54D0-46C5-9519-03923243C7C7}
{BA86AE72-0CF5-423D-BBA2-E12B0D72EBFB} = {BA86AE72-0CF5-423D-BBA2-E12B0D72EBFB}
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3} = {6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}
{DB28DE80-837F-4497-9AA9-CC0A20584C98} = {DB28DE80-837F-4497-9AA9-CC0A20584C98}
{D8E4B489-C5DD-407D-99DB-FE7C7A5A83A0} = {D8E4B489-C5DD-407D-99DB-FE7C7A5A83A0}
{262280A8-37D5-4037-BDFB-242468DFB3D2} = {262280A8-37D5-4037-BDFB-242468DFB3D2}
{8762A9B8-72A9-462E-A9A2-F3265081F8AF} = {8762A9B8-72A9-462E-A9A2-F3265081F8AF}
@ -268,6 +269,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqltest", "client\mysqlte
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysql_client_test", "tests\mysql_client_test.vcproj", "{DA224DAB-5006-42BE-BB77-16E8BE5326D5}"
ProjectSection(ProjectDependencies) = postProject
{26383276-4843-494B-8BE0-8936ED3EBAAB} = {26383276-4843-494B-8BE0-8936ED3EBAAB}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysql_test_run_new", "mysql-test\mysql_test_run_new.vcproj", "{6189F838-21C6-42A1-B2D0-9146316573F7}"
@ -305,24 +307,32 @@ Global
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.classic.ActiveCfg = Debug|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.classic nt.ActiveCfg = Debug|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.classic.ActiveCfg = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.classic.Build.0 = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.classic nt.ActiveCfg = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.classic nt.Build.0 = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Debug.ActiveCfg = Debug|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Debug.Build.0 = Debug|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Embedded_Classic.ActiveCfg = Debug|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Embedded_Classic.Build.0 = Debug|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Embedded_Classic.ActiveCfg = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Embedded_Classic.Build.0 = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Embedded_Debug.ActiveCfg = Debug|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Embedded_Debug.Build.0 = Debug|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Embedded_Pro.ActiveCfg = Debug|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Embedded_Pro.ActiveCfg = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Embedded_Pro.Build.0 = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Embedded_Release.ActiveCfg = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Embedded_Release.Build.0 = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Max.ActiveCfg = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Max.Build.0 = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Max nt.ActiveCfg = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Max nt.Build.0 = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.nt.ActiveCfg = Debug|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.pro.ActiveCfg = Debug|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.pro nt.ActiveCfg = Debug|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Release.ActiveCfg = Debug|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.nt.ActiveCfg = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.nt.Build.0 = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.pro.ActiveCfg = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.pro.Build.0 = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.pro nt.ActiveCfg = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.pro nt.Build.0 = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Release.ActiveCfg = Max|Win32
{6EEF697A-3772-48D8-A5BA-EF11B9AC46E3}.Release.Build.0 = Max|Win32
{1FD8A136-B86A-4B54-95B0-FA4E2EE2CCBC}.classic.ActiveCfg = Release|Win32
{1FD8A136-B86A-4B54-95B0-FA4E2EE2CCBC}.classic nt.ActiveCfg = Release|Win32
{1FD8A136-B86A-4B54-95B0-FA4E2EE2CCBC}.classic nt.Build.0 = Release|Win32
@ -349,11 +359,14 @@ Global
{FC369DF4-AEB7-4531-BF34-A638C4363BFE}.classic nt.Build.0 = Release|Win32
{FC369DF4-AEB7-4531-BF34-A638C4363BFE}.Debug.ActiveCfg = Debug|Win32
{FC369DF4-AEB7-4531-BF34-A638C4363BFE}.Debug.Build.0 = Debug|Win32
{FC369DF4-AEB7-4531-BF34-A638C4363BFE}.Embedded_Classic.ActiveCfg = Debug|Win32
{FC369DF4-AEB7-4531-BF34-A638C4363BFE}.Embedded_Classic.ActiveCfg = Release|Win32
{FC369DF4-AEB7-4531-BF34-A638C4363BFE}.Embedded_Classic.Build.0 = Release|Win32
{FC369DF4-AEB7-4531-BF34-A638C4363BFE}.Embedded_Debug.ActiveCfg = TLS_DEBUG|Win32
{FC369DF4-AEB7-4531-BF34-A638C4363BFE}.Embedded_Debug.Build.0 = TLS_DEBUG|Win32
{FC369DF4-AEB7-4531-BF34-A638C4363BFE}.Embedded_Pro.ActiveCfg = Debug|Win32
{FC369DF4-AEB7-4531-BF34-A638C4363BFE}.Embedded_Pro.ActiveCfg = Release|Win32
{FC369DF4-AEB7-4531-BF34-A638C4363BFE}.Embedded_Pro.Build.0 = Release|Win32
{FC369DF4-AEB7-4531-BF34-A638C4363BFE}.Embedded_Release.ActiveCfg = Release|Win32
{FC369DF4-AEB7-4531-BF34-A638C4363BFE}.Embedded_Release.Build.0 = Release|Win32
{FC369DF4-AEB7-4531-BF34-A638C4363BFE}.Max.ActiveCfg = Release|Win32
{FC369DF4-AEB7-4531-BF34-A638C4363BFE}.Max.Build.0 = Release|Win32
{FC369DF4-AEB7-4531-BF34-A638C4363BFE}.Max nt.ActiveCfg = Release|Win32
@ -392,11 +405,14 @@ Global
{C70A6DC7-7D45-4C16-8654-7E57713A4C04}.pro nt.Build.0 = Release|Win32
{C70A6DC7-7D45-4C16-8654-7E57713A4C04}.Release.ActiveCfg = Release|Win32
{C70A6DC7-7D45-4C16-8654-7E57713A4C04}.Release.Build.0 = Release|Win32
{13D37150-54D0-46C5-9519-03923243C7C7}.classic.ActiveCfg = nt|Win32
{13D37150-54D0-46C5-9519-03923243C7C7}.classic.ActiveCfg = Release|Win32
{13D37150-54D0-46C5-9519-03923243C7C7}.classic.Build.0 = Release|Win32
{13D37150-54D0-46C5-9519-03923243C7C7}.classic nt.ActiveCfg = nt|Win32
{13D37150-54D0-46C5-9519-03923243C7C7}.classic nt.Build.0 = nt|Win32
{13D37150-54D0-46C5-9519-03923243C7C7}.Debug.ActiveCfg = Debug|Win32
{13D37150-54D0-46C5-9519-03923243C7C7}.Debug.Build.0 = Debug|Win32
{13D37150-54D0-46C5-9519-03923243C7C7}.Embedded_Classic.ActiveCfg = nt|Win32
{13D37150-54D0-46C5-9519-03923243C7C7}.Embedded_Classic.ActiveCfg = Release|Win32
{13D37150-54D0-46C5-9519-03923243C7C7}.Embedded_Classic.Build.0 = Release|Win32
{13D37150-54D0-46C5-9519-03923243C7C7}.Embedded_Debug.ActiveCfg = Debug|Win32
{13D37150-54D0-46C5-9519-03923243C7C7}.Embedded_Debug.Build.0 = Debug|Win32
{13D37150-54D0-46C5-9519-03923243C7C7}.Embedded_Pro.ActiveCfg = Release|Win32
@ -454,8 +470,8 @@ Global
{93CA92A0-D7B8-4FAE-9EBB-D92EFBF631C9}.pro.ActiveCfg = pro|Win32
{93CA92A0-D7B8-4FAE-9EBB-D92EFBF631C9}.pro nt.ActiveCfg = pro|Win32
{93CA92A0-D7B8-4FAE-9EBB-D92EFBF631C9}.Release.ActiveCfg = Release|Win32
{2794E434-7CCE-44DB-B2FB-789ABE53D6B9}.classic.ActiveCfg = Debug|Win32
{2794E434-7CCE-44DB-B2FB-789ABE53D6B9}.classic.Build.0 = Debug|Win32
{2794E434-7CCE-44DB-B2FB-789ABE53D6B9}.classic.ActiveCfg = Release|Win32
{2794E434-7CCE-44DB-B2FB-789ABE53D6B9}.classic.Build.0 = Release|Win32
{2794E434-7CCE-44DB-B2FB-789ABE53D6B9}.classic nt.ActiveCfg = Release|Win32
{2794E434-7CCE-44DB-B2FB-789ABE53D6B9}.classic nt.Build.0 = Release|Win32
{2794E434-7CCE-44DB-B2FB-789ABE53D6B9}.Debug.ActiveCfg = Debug|Win32
@ -507,6 +523,7 @@ Global
{262280A8-37D5-4037-BDFB-242468DFB3D2}.Embedded_Classic.ActiveCfg = TLS|Win32
{262280A8-37D5-4037-BDFB-242468DFB3D2}.Embedded_Classic.Build.0 = TLS|Win32
{262280A8-37D5-4037-BDFB-242468DFB3D2}.Embedded_Debug.ActiveCfg = Debug|Win32
{262280A8-37D5-4037-BDFB-242468DFB3D2}.Embedded_Debug.Build.0 = Debug|Win32
{262280A8-37D5-4037-BDFB-242468DFB3D2}.Embedded_Pro.ActiveCfg = TLS|Win32
{262280A8-37D5-4037-BDFB-242468DFB3D2}.Embedded_Pro.Build.0 = TLS|Win32
{262280A8-37D5-4037-BDFB-242468DFB3D2}.Embedded_Release.ActiveCfg = TLS|Win32
@ -589,8 +606,8 @@ Global
{194F5EE6-9440-4298-A6FE-A9B4B480B44C}.pro nt.Build.0 = Release|Win32
{194F5EE6-9440-4298-A6FE-A9B4B480B44C}.Release.ActiveCfg = Release|Win32
{194F5EE6-9440-4298-A6FE-A9B4B480B44C}.Release.Build.0 = Release|Win32
{D8E4B489-C5DD-407D-99DB-FE7C7A5A83A0}.classic.ActiveCfg = Debug|Win32
{D8E4B489-C5DD-407D-99DB-FE7C7A5A83A0}.classic.Build.0 = Debug|Win32
{D8E4B489-C5DD-407D-99DB-FE7C7A5A83A0}.classic.ActiveCfg = Release|Win32
{D8E4B489-C5DD-407D-99DB-FE7C7A5A83A0}.classic.Build.0 = Release|Win32
{D8E4B489-C5DD-407D-99DB-FE7C7A5A83A0}.classic nt.ActiveCfg = Release|Win32
{D8E4B489-C5DD-407D-99DB-FE7C7A5A83A0}.classic nt.Build.0 = Release|Win32
{D8E4B489-C5DD-407D-99DB-FE7C7A5A83A0}.Debug.ActiveCfg = Debug|Win32
@ -598,6 +615,7 @@ Global
{D8E4B489-C5DD-407D-99DB-FE7C7A5A83A0}.Embedded_Classic.ActiveCfg = TLS|Win32
{D8E4B489-C5DD-407D-99DB-FE7C7A5A83A0}.Embedded_Classic.Build.0 = TLS|Win32
{D8E4B489-C5DD-407D-99DB-FE7C7A5A83A0}.Embedded_Debug.ActiveCfg = Debug|Win32
{D8E4B489-C5DD-407D-99DB-FE7C7A5A83A0}.Embedded_Debug.Build.0 = Debug|Win32
{D8E4B489-C5DD-407D-99DB-FE7C7A5A83A0}.Embedded_Pro.ActiveCfg = TLS|Win32
{D8E4B489-C5DD-407D-99DB-FE7C7A5A83A0}.Embedded_Pro.Build.0 = TLS|Win32
{D8E4B489-C5DD-407D-99DB-FE7C7A5A83A0}.Embedded_Release.ActiveCfg = TLS|Win32
@ -724,8 +742,8 @@ Global
{67154F28-D076-419E-B149-819EF548E670}.pro nt.Build.0 = Release|Win32
{67154F28-D076-419E-B149-819EF548E670}.Release.ActiveCfg = Release|Win32
{67154F28-D076-419E-B149-819EF548E670}.Release.Build.0 = Release|Win32
{26383276-4843-494B-8BE0-8936ED3EBAAB}.classic.ActiveCfg = Debug|Win32
{26383276-4843-494B-8BE0-8936ED3EBAAB}.classic.Build.0 = Debug|Win32
{26383276-4843-494B-8BE0-8936ED3EBAAB}.classic.ActiveCfg = Release|Win32
{26383276-4843-494B-8BE0-8936ED3EBAAB}.classic.Build.0 = Release|Win32
{26383276-4843-494B-8BE0-8936ED3EBAAB}.classic nt.ActiveCfg = Release|Win32
{26383276-4843-494B-8BE0-8936ED3EBAAB}.classic nt.Build.0 = Release|Win32
{26383276-4843-494B-8BE0-8936ED3EBAAB}.Debug.ActiveCfg = Debug|Win32
@ -911,9 +929,13 @@ Global
{DB28DE80-837F-4497-9AA9-CC0A20584C98}.Debug.ActiveCfg = Debug|Win32
{DB28DE80-837F-4497-9AA9-CC0A20584C98}.Debug.Build.0 = Debug|Win32
{DB28DE80-837F-4497-9AA9-CC0A20584C98}.Embedded_Classic.ActiveCfg = Release|Win32
{DB28DE80-837F-4497-9AA9-CC0A20584C98}.Embedded_Classic.Build.0 = Release|Win32
{DB28DE80-837F-4497-9AA9-CC0A20584C98}.Embedded_Debug.ActiveCfg = Debug|Win32
{DB28DE80-837F-4497-9AA9-CC0A20584C98}.Embedded_Debug.Build.0 = Debug|Win32
{DB28DE80-837F-4497-9AA9-CC0A20584C98}.Embedded_Pro.ActiveCfg = Release|Win32
{DB28DE80-837F-4497-9AA9-CC0A20584C98}.Embedded_Pro.Build.0 = Release|Win32
{DB28DE80-837F-4497-9AA9-CC0A20584C98}.Embedded_Release.ActiveCfg = Release|Win32
{DB28DE80-837F-4497-9AA9-CC0A20584C98}.Embedded_Release.Build.0 = Release|Win32
{DB28DE80-837F-4497-9AA9-CC0A20584C98}.Max.ActiveCfg = Release|Win32
{DB28DE80-837F-4497-9AA9-CC0A20584C98}.Max.Build.0 = Release|Win32
{DB28DE80-837F-4497-9AA9-CC0A20584C98}.Max nt.ActiveCfg = Release|Win32
@ -1022,14 +1044,14 @@ Global
{16699B52-ECC6-4A96-A99F-A043059BA2E7}.pro nt.Build.0 = Release|Win32
{16699B52-ECC6-4A96-A99F-A043059BA2E7}.Release.ActiveCfg = Release|Win32
{16699B52-ECC6-4A96-A99F-A043059BA2E7}.Release.Build.0 = Release|Win32
{EEC1300B-85A5-497C-B3E1-F708021DF859}.classic.ActiveCfg = Debug|Win32
{EEC1300B-85A5-497C-B3E1-F708021DF859}.classic.Build.0 = Debug|Win32
{EEC1300B-85A5-497C-B3E1-F708021DF859}.classic.ActiveCfg = Release|Win32
{EEC1300B-85A5-497C-B3E1-F708021DF859}.classic.Build.0 = Release|Win32
{EEC1300B-85A5-497C-B3E1-F708021DF859}.classic nt.ActiveCfg = Release|Win32
{EEC1300B-85A5-497C-B3E1-F708021DF859}.classic nt.Build.0 = Release|Win32
{EEC1300B-85A5-497C-B3E1-F708021DF859}.Debug.ActiveCfg = Debug|Win32
{EEC1300B-85A5-497C-B3E1-F708021DF859}.Debug.Build.0 = Debug|Win32
{EEC1300B-85A5-497C-B3E1-F708021DF859}.Embedded_Classic.ActiveCfg = Debug|Win32
{EEC1300B-85A5-497C-B3E1-F708021DF859}.Embedded_Classic.Build.0 = Debug|Win32
{EEC1300B-85A5-497C-B3E1-F708021DF859}.Embedded_Classic.ActiveCfg = Release|Win32
{EEC1300B-85A5-497C-B3E1-F708021DF859}.Embedded_Classic.Build.0 = Release|Win32
{EEC1300B-85A5-497C-B3E1-F708021DF859}.Embedded_Debug.ActiveCfg = Debug|Win32
{EEC1300B-85A5-497C-B3E1-F708021DF859}.Embedded_Debug.Build.0 = Debug|Win32
{EEC1300B-85A5-497C-B3E1-F708021DF859}.Embedded_Pro.ActiveCfg = Release|Win32
@ -1048,8 +1070,8 @@ Global
{EEC1300B-85A5-497C-B3E1-F708021DF859}.pro nt.Build.0 = Release|Win32
{EEC1300B-85A5-497C-B3E1-F708021DF859}.Release.ActiveCfg = Release|Win32
{EEC1300B-85A5-497C-B3E1-F708021DF859}.Release.Build.0 = Release|Win32
{8CB5AB80-05DA-49DA-BC9F-EAC20667E0D0}.classic.ActiveCfg = Debug|Win32
{8CB5AB80-05DA-49DA-BC9F-EAC20667E0D0}.classic.Build.0 = Debug|Win32
{8CB5AB80-05DA-49DA-BC9F-EAC20667E0D0}.classic.ActiveCfg = Release|Win32
{8CB5AB80-05DA-49DA-BC9F-EAC20667E0D0}.classic.Build.0 = Release|Win32
{8CB5AB80-05DA-49DA-BC9F-EAC20667E0D0}.classic nt.ActiveCfg = Debug|Win32
{8CB5AB80-05DA-49DA-BC9F-EAC20667E0D0}.Debug.ActiveCfg = Debug|Win32
{8CB5AB80-05DA-49DA-BC9F-EAC20667E0D0}.Debug.Build.0 = Debug|Win32
@ -1065,7 +1087,6 @@ Global
{8CB5AB80-05DA-49DA-BC9F-EAC20667E0D0}.Release.ActiveCfg = Release|Win32
{8CB5AB80-05DA-49DA-BC9F-EAC20667E0D0}.Release.Build.0 = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.classic.ActiveCfg = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.classic.Build.0 = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.classic nt.ActiveCfg = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Debug.ActiveCfg = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Embedded_Classic.ActiveCfg = Release|Win32
@ -1074,12 +1095,10 @@ Global
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Embedded_Release.ActiveCfg = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Max.ActiveCfg = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Max nt.ActiveCfg = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Max nt.Build.0 = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.nt.ActiveCfg = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.pro.ActiveCfg = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.pro nt.ActiveCfg = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Release.ActiveCfg = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Release.Build.0 = Release|Win32
{7FFA3009-E0E1-4E4E-9CDF-F408AA108CC8}.classic.ActiveCfg = Release|Win32
{7FFA3009-E0E1-4E4E-9CDF-F408AA108CC8}.classic.Build.0 = Release|Win32
{7FFA3009-E0E1-4E4E-9CDF-F408AA108CC8}.classic nt.ActiveCfg = Release|Win32
@ -1102,16 +1121,20 @@ Global
{7FFA3009-E0E1-4E4E-9CDF-F408AA108CC8}.pro nt.Build.0 = Release|Win32
{7FFA3009-E0E1-4E4E-9CDF-F408AA108CC8}.Release.ActiveCfg = Release|Win32
{7FFA3009-E0E1-4E4E-9CDF-F408AA108CC8}.Release.Build.0 = Release|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.classic.ActiveCfg = Debug|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.classic.Build.0 = Debug|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.classic.ActiveCfg = Release|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.classic.Build.0 = Release|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.classic nt.ActiveCfg = Release|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.classic nt.Build.0 = Release|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.Debug.ActiveCfg = Debug|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.Debug.Build.0 = Debug|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.Embedded_Classic.ActiveCfg = Debug|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.Embedded_Classic.ActiveCfg = Release|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.Embedded_Classic.Build.0 = Release|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.Embedded_Debug.ActiveCfg = Debug|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.Embedded_Pro.ActiveCfg = Debug|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.Embedded_Debug.Build.0 = Debug|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.Embedded_Pro.ActiveCfg = Release|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.Embedded_Pro.Build.0 = Release|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.Embedded_Release.ActiveCfg = Release|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.Embedded_Release.Build.0 = Release|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.Max.ActiveCfg = Release|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.Max.Build.0 = Release|Win32
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B}.Max nt.ActiveCfg = Release|Win32
@ -1133,6 +1156,7 @@ Global
{8762A9B8-72A9-462E-A9A2-F3265081F8AF}.Embedded_Classic.ActiveCfg = Release|Win32
{8762A9B8-72A9-462E-A9A2-F3265081F8AF}.Embedded_Classic.Build.0 = Release|Win32
{8762A9B8-72A9-462E-A9A2-F3265081F8AF}.Embedded_Debug.ActiveCfg = Debug|Win32
{8762A9B8-72A9-462E-A9A2-F3265081F8AF}.Embedded_Debug.Build.0 = Debug|Win32
{8762A9B8-72A9-462E-A9A2-F3265081F8AF}.Embedded_Pro.ActiveCfg = Release|Win32
{8762A9B8-72A9-462E-A9A2-F3265081F8AF}.Embedded_Pro.Build.0 = Release|Win32
{8762A9B8-72A9-462E-A9A2-F3265081F8AF}.Embedded_Release.ActiveCfg = Release|Win32
@ -1171,8 +1195,8 @@ Global
{8961F149-C68A-4154-A499-A2AB39E607E8}.pro nt.Build.0 = Release|Win32
{8961F149-C68A-4154-A499-A2AB39E607E8}.Release.ActiveCfg = Release|Win32
{8961F149-C68A-4154-A499-A2AB39E607E8}.Release.Build.0 = Release|Win32
{DA224DAB-5006-42BE-BB77-16E8BE5326D5}.classic.ActiveCfg = Debug|Win32
{DA224DAB-5006-42BE-BB77-16E8BE5326D5}.classic.Build.0 = Debug|Win32
{DA224DAB-5006-42BE-BB77-16E8BE5326D5}.classic.ActiveCfg = Release|Win32
{DA224DAB-5006-42BE-BB77-16E8BE5326D5}.classic.Build.0 = Release|Win32
{DA224DAB-5006-42BE-BB77-16E8BE5326D5}.classic nt.ActiveCfg = Release|Win32
{DA224DAB-5006-42BE-BB77-16E8BE5326D5}.classic nt.Build.0 = Release|Win32
{DA224DAB-5006-42BE-BB77-16E8BE5326D5}.Debug.ActiveCfg = Debug|Win32
@ -1184,7 +1208,6 @@ Global
{DA224DAB-5006-42BE-BB77-16E8BE5326D5}.Max.ActiveCfg = Release|Win32
{DA224DAB-5006-42BE-BB77-16E8BE5326D5}.Max.Build.0 = Release|Win32
{DA224DAB-5006-42BE-BB77-16E8BE5326D5}.Max nt.ActiveCfg = Release|Win32
{DA224DAB-5006-42BE-BB77-16E8BE5326D5}.Max nt.Build.0 = Release|Win32
{DA224DAB-5006-42BE-BB77-16E8BE5326D5}.nt.ActiveCfg = Release|Win32
{DA224DAB-5006-42BE-BB77-16E8BE5326D5}.nt.Build.0 = Release|Win32
{DA224DAB-5006-42BE-BB77-16E8BE5326D5}.pro.ActiveCfg = Release|Win32

View File

View File

@ -12,7 +12,7 @@
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
OutputDirectory="..\lib_debug"
IntermediateDirectory=".\Debug"
ConfigurationType="4"
UseOfMFC="0"
@ -38,7 +38,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\Debug\mysqlserver.lib"
OutputFile="$(OutDir)\mysqlserver.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
@ -63,7 +63,7 @@
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\release"
OutputDirectory="..\lib_release"
IntermediateDirectory=".\release"
ConfigurationType="4"
UseOfMFC="0"
@ -90,7 +90,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\release\mysqlserver.lib"
OutputFile="$(OutDir)\mysqlserver.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
@ -117,6 +117,9 @@
<References>
</References>
<Files>
<File
RelativePath=".\dummy.cpp">
</File>
</Files>
<Globals>
</Globals>

View File

@ -4578,7 +4578,7 @@
</FileConfiguration>
</File>
<File
RelativePath="protocol_cursor.cpp">
RelativePath="sql_cursor.cpp">
<FileConfiguration
Name="classic nt|Win32">
<Tool

View File

@ -25,7 +25,7 @@
AdditionalIncludeDirectories="../include,../"
PreprocessorDefinitions="DBUG_OFF;_WINDOWS;SAFE_MUTEX;USE_TLS;MYSQL_CLIENT;__WIN__;_WIN32"
StringPooling="TRUE"
RuntimeLibrary="1"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\Release/mysql_client_test.pch"
AssemblerListingLocation=".\Release/"
@ -38,7 +38,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="odbc32.lib odbccp32.lib Ws2_32.lib mysqlclient.lib mysys.lib regex.lib ..\extra\yassl\Release\yassl.lib"
AdditionalDependencies="odbc32.lib odbccp32.lib Ws2_32.lib"
OutputFile="..\client_release\mysql_client_test.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
@ -98,7 +98,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib mysys.lib regex.lib ..\extra\yassl\Debug\yassl.lib"
AdditionalDependencies="odbc32.lib odbccp32.lib wsock32.lib"
OutputFile="..\client_debug\mysql_client_test.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"

View File

@ -4125,6 +4125,7 @@ int main(int argc, char **argv)
error|= run_query(&cur_con->mysql, q, QUERY_REAP|QUERY_SEND);
display_result_vertically= old_display_result_vertically;
q->last_argument= q->end;
query_executed= 1;
break;
}
case Q_QUERY:

View File

@ -59,3 +59,42 @@ AC_DEFUN([MYSQL_CHECK_NEW_RL_INTERFACE], [
)
)
])
dnl
dnl check for availability of multibyte characters and functions
dnl (Based on BASH_CHECK_MULTIBYTE in aclocal.m4 of readline-5.0)
dnl
AC_DEFUN([MYSQL_CHECK_MULTIBYTE],
[
AC_CHECK_HEADERS(wctype.h)
AC_CHECK_HEADERS(wchar.h)
AC_CHECK_HEADERS(langinfo.h)
AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE([HAVE_MBSRTOWCS],[],[Define if you have mbsrtowcs]))
AC_CHECK_FUNC(mbrtowc, AC_DEFINE([HAVE_MBRTOWC],[],[Define if you have mbrtowc]))
AC_CHECK_FUNC(mbrlen, AC_DEFINE([HAVE_MBRLEN],[],[Define if you have mbrlen]))
AC_CHECK_FUNC(wctomb, AC_DEFINE([HAVE_WCTOMB],[],[Define if you have wctomb]))
AC_CHECK_FUNC(wcwidth, AC_DEFINE([HAVE_WCWIDTH],[],[Define if you have wcwidth]))
AC_CHECK_FUNC(wcsdup, AC_DEFINE([HAVE_WCSDUP],[],[Define if you check wcsdup]))
AC_CACHE_CHECK([for mbstate_t], mysql_cv_have_mbstate_t,
[AC_TRY_COMPILE([
#include <wchar.h>], [
mbstate_t ps;
mbstate_t *psp;
psp = (mbstate_t *)0;
], mysql_cv_have_mbstate_t=yes, mysql_cv_have_mbstate_t=no)])
if test $mysql_cv_have_mbstate_t = yes; then
AC_DEFINE([HAVE_MBSTATE_T],[],[Define if mysql_cv_have_mbstate_t=yes])
fi
AC_CACHE_CHECK([for nl_langinfo and CODESET], mysql_cv_langinfo_codeset,
[AC_TRY_LINK(
[#include <langinfo.h>],
[char* cs = nl_langinfo(CODESET);],
mysql_cv_langinfo_codeset=yes, mysql_cv_langinfo_codeset=no)])
if test $mysql_cv_langinfo_codeset = yes; then
AC_DEFINE([HAVE_LANGINFO_CODESET],[],[Define if mysql_cv_langinfo_codeset=yes])
fi
])

View File

@ -1820,6 +1820,7 @@ MYSQL_HAVE_TIOCSTAT
MYSQL_STRUCT_DIRENT_D_INO
MYSQL_STRUCT_DIRENT_D_NAMLEN
MYSQL_TYPE_SIGHANDLER
MYSQL_CHECK_MULTIBYTE
if test "$with_named_curses" = "no"
then
MYSQL_CHECK_LIB_TERMCAP

View File

@ -95,7 +95,11 @@ OS_Seed::OS_Seed()
{
fd_ = open("/dev/urandom",O_RDONLY);
if (fd_ == -1)
{
fd_ = open("/dev/random",O_RDONLY);
if (fd_ == -1)
error_.SetError(OPEN_RAN_E);
}
}

View File

@ -775,6 +775,7 @@ extern void my_free_lock(byte *ptr,myf flags);
extern void init_alloc_root(MEM_ROOT *mem_root, uint block_size,
uint pre_alloc_size);
extern gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size);
extern gptr multi_alloc_root(MEM_ROOT *mem_root, ...);
extern void free_root(MEM_ROOT *root, myf MyFLAGS);
extern void set_prealloc_root(MEM_ROOT *root, char *ptr);
extern void reset_root_defaults(MEM_ROOT *mem_root, uint block_size,

View File

@ -561,12 +561,12 @@ dtuple_convert_big_rec(
}
/* We do not store externally fields which are smaller than
DICT_MAX_COL_PREFIX_LEN */
DICT_MAX_INDEX_COL_LEN */
ut_a(DICT_MAX_COL_PREFIX_LEN > REC_1BYTE_OFFS_LIMIT);
ut_a(DICT_MAX_INDEX_COL_LEN > REC_1BYTE_OFFS_LIMIT);
if (longest < BTR_EXTERN_FIELD_REF_SIZE + 10
+ DICT_MAX_COL_PREFIX_LEN) {
+ DICT_MAX_INDEX_COL_LEN) {
/* Cannot shorten more */
mem_heap_free(heap);
@ -588,10 +588,10 @@ dtuple_convert_big_rec(
dfield = dtuple_get_nth_field(entry, longest_i);
vector->fields[n_fields].field_no = longest_i;
ut_a(dfield->len > DICT_MAX_COL_PREFIX_LEN);
ut_a(dfield->len > DICT_MAX_INDEX_COL_LEN);
vector->fields[n_fields].len = dfield->len
- DICT_MAX_COL_PREFIX_LEN;
- DICT_MAX_INDEX_COL_LEN;
vector->fields[n_fields].data = mem_heap_alloc(heap,
vector->fields[n_fields].len);

View File

@ -1625,7 +1625,7 @@ dict_index_add_col(
variable-length fields, so that the extern flag can be embedded in
the length word. */
if (field->fixed_len > DICT_MAX_COL_PREFIX_LEN) {
if (field->fixed_len > DICT_MAX_INDEX_COL_LEN) {
field->fixed_len = 0;
}
@ -2189,7 +2189,7 @@ dict_foreign_error_report(
dict_foreign_error_report_low(file, fk->foreign_table_name);
fputs(msg, file);
fputs(" Constraint:\n", file);
dict_print_info_on_foreign_key_in_create_format(file, NULL, fk);
dict_print_info_on_foreign_key_in_create_format(file, NULL, fk, TRUE);
if (fk->foreign_index) {
fputs("\nThe index in the foreign key in table is ", file);
ut_print_name(file, NULL, fk->foreign_index->name);
@ -4330,9 +4330,10 @@ CREATE TABLE. */
void
dict_print_info_on_foreign_key_in_create_format(
/*============================================*/
FILE* file, /* in: file where to print */
trx_t* trx, /* in: transaction */
dict_foreign_t* foreign)/* in: foreign key constraint */
FILE* file, /* in: file where to print */
trx_t* trx, /* in: transaction */
dict_foreign_t* foreign, /* in: foreign key constraint */
ibool add_newline) /* in: whether to add a newline */
{
const char* stripped_id;
ulint i;
@ -4345,7 +4346,16 @@ dict_print_info_on_foreign_key_in_create_format(
stripped_id = foreign->id;
}
fputs(",\n CONSTRAINT ", file);
putc(',', file);
if (add_newline) {
/* SHOW CREATE TABLE wants constraints each printed nicely
on its own line, while error messages want no newlines
inserted. */
fputs("\n ", file);
}
fputs(" CONSTRAINT ", file);
ut_print_name(file, trx, stripped_id);
fputs(" FOREIGN KEY (", file);
@ -4447,7 +4457,7 @@ dict_print_info_on_foreign_keys(
while (foreign != NULL) {
if (create_table_format) {
dict_print_info_on_foreign_key_in_create_format(
file, trx, foreign);
file, trx, foreign, TRUE);
} else {
ulint i;
fputs("; (", file);

View File

@ -420,7 +420,7 @@ dtype_get_fixed_size(
}
/***************************************************************************
Returns the size of a fixed size data type, 0 if not a fixed size type. */
Returns the minimum size of a data type. */
UNIV_INLINE
ulint
dtype_get_min_size(

View File

@ -375,9 +375,10 @@ CREATE TABLE. */
void
dict_print_info_on_foreign_key_in_create_format(
/*============================================*/
FILE* file, /* in: file where to print */
trx_t* trx, /* in: transaction */
dict_foreign_t* foreign);/* in: foreign key constraint */
FILE* file, /* in: file where to print */
trx_t* trx, /* in: transaction */
dict_foreign_t* foreign, /* in: foreign key constraint */
ibool add_newline); /* in: whether to add a newline */
/************************************************************************
Displays the names of the index and the table. */
void

View File

@ -152,12 +152,12 @@ struct dict_col_struct{
in some of the functions below */
};
/* DICT_MAX_COL_PREFIX_LEN is measured in bytes. Starting from 4.1.6, we
set max col prefix len to < 3 * 256, so that one can create a column prefix
index on 255 characters of a TEXT field also in the UTF-8 charset. In that
charset, a character may take at most 3 bytes. */
/* DICT_MAX_INDEX_COL_LEN is measured in bytes and is the max index column
length + 1. Starting from 4.1.6, we set it to < 3 * 256, so that one can
create a column prefix index on 255 characters of a TEXT field also in the
UTF-8 charset. In that charset, a character may take at most 3 bytes. */
#define DICT_MAX_COL_PREFIX_LEN 768
#define DICT_MAX_INDEX_COL_LEN 768
/* Data structure for a field in an index */
struct dict_field_struct{
@ -169,12 +169,12 @@ struct dict_field_struct{
prefix in bytes in a MySQL index of
type, e.g., INDEX (textcol(25));
must be smaller than
DICT_MAX_COL_PREFIX_LEN; NOTE that
DICT_MAX_INDEX_COL_LEN; NOTE that
in the UTF-8 charset, MySQL sets this
to 3 * the prefix len in UTF-8 chars */
ulint fixed_len; /* 0 or the fixed length of the
column if smaller than
DICT_MAX_COL_PREFIX_LEN */
DICT_MAX_INDEX_COL_LEN */
ulint fixed_offs; /* offset to the field, or
ULINT_UNDEFINED if it is not fixed
within the record (due to preceding

View File

@ -432,6 +432,17 @@ os_file_read(
offset */
ulint n); /* in: number of bytes to read */
/***********************************************************************
Rewind file to its start, read at most size - 1 bytes from it to str, and
NUL-terminate str. All errors are silently ignored. This function is
mostly meant to be used with temporary files. */
void
os_file_read_string(
/*================*/
FILE* file, /* in: file to read from */
char* str, /* in: buffer where to read */
ulint size); /* in: size of buffer */
/***********************************************************************
Requests a synchronous positioned read operation. This function does not do
any error handling. In case of error it returns FALSE. */

View File

@ -335,8 +335,14 @@ int
row_create_index_for_mysql(
/*=======================*/
/* out: error number or DB_SUCCESS */
dict_index_t* index, /* in: index defintion */
trx_t* trx); /* in: transaction handle */
dict_index_t* index, /* in: index definition */
trx_t* trx, /* in: transaction handle */
const ulint* field_lengths); /* in: if not NULL, must contain
dict_index_get_n_fields(index)
actual field lengths for the
index columns, which are
then checked for not being too
large. */
/*************************************************************************
Scans a table create SQL string and adds to the data dictionary
the foreign key constraints declared in the string. This function

View File

@ -56,6 +56,22 @@ void
trx_search_latch_release_if_reserved(
/*=================================*/
trx_t* trx); /* in: transaction */
/**********************************************************************
Set detailed error message for the transaction. */
void
trx_set_detailed_error(
/*===================*/
trx_t* trx, /* in: transaction struct */
char* msg); /* in: detailed error message */
/*****************************************************************
Set detailed error message for the transaction from a file. Note that the
file is rewinded before reading from it. */
void
trx_set_detailed_error_from_file(
/*=============================*/
trx_t* trx, /* in: transaction struct */
FILE* file); /* in: file to read message from */
/********************************************************************
Retrieves the error_info field from a trx. */
@ -205,7 +221,7 @@ trx_recover_for_mysql(
XID* xid_list, /* in/out: prepared transactions */
ulint len); /* in: number of slots in xid_list */
/***********************************************************************
This function is used to commit one X/Open XA distributed transaction
This function is used to find one X/Open XA distributed transaction
which is in the prepared state */
trx_t *
trx_get_trx_by_xid(
@ -649,6 +665,9 @@ struct trx_struct{
trx_undo_arr_t* undo_no_arr; /* array of undo numbers of undo log
records which are currently processed
by a rollback operation */
/*------------------------------*/
char detailed_error[256]; /* detailed error message for last
error, or empty. */
};
#define TRX_MAX_N_THREADS 32 /* maximum number of concurrent

View File

@ -118,6 +118,18 @@ UNIV_INLINE
int
ut_strcmp(const void* str1, const void* str2);
/**************************************************************************
Copies up to size - 1 characters from the NUL-terminated string src to
dst, NUL-terminating the result. Returns strlen(src), so truncation
occurred if the return value >= size. */
ulint
ut_strlcpy(
/*=======*/
/* out: strlen(src) */
char* dst, /* in: destination buffer */
const char* src, /* in: source buffer */
ulint size); /* in: size of destination buffer */
/**************************************************************************
Compute strlen(ut_strcpyq(str, q)). */
UNIV_INLINE

View File

@ -2248,6 +2248,29 @@ error_handling:
return(FALSE);
}
/***********************************************************************
Rewind file to its start, read at most size - 1 bytes from it to str, and
NUL-terminate str. All errors are silently ignored. This function is
mostly meant to be used with temporary files. */
void
os_file_read_string(
/*================*/
FILE* file, /* in: file to read from */
char* str, /* in: buffer where to read */
ulint size) /* in: size of buffer */
{
size_t flen;
if (size == 0) {
return;
}
rewind(file);
flen = fread(str, 1, size - 1, file);
str[flen] = '\0';
}
/***********************************************************************
Requests a synchronous write operation. */

View File

@ -621,7 +621,7 @@ rec_set_nth_field_extern_bit_new(
if (field->fixed_len) {
/* fixed-length fields cannot be external
(Fixed-length fields longer than
DICT_MAX_COL_PREFIX_LEN will be treated as
DICT_MAX_INDEX_COL_LEN will be treated as
variable-length ones in dict_index_add_col().) */
ut_ad(i != ith);
continue;

View File

@ -578,6 +578,30 @@ row_ins_cascade_calc_update_vec(
return(n_fields_updated);
}
/*************************************************************************
Set detailed error message associated with foreign key errors for
the given transaction. */
static
void
row_ins_set_detailed(
/*=================*/
trx_t* trx, /* in: transaction */
dict_foreign_t* foreign) /* in: foreign key constraint */
{
FILE* tf = os_file_create_tmpfile();
ut_a(tf);
ut_print_name(tf, trx, foreign->foreign_table_name);
dict_print_info_on_foreign_key_in_create_format(tf, trx,
foreign, FALSE);
trx_set_detailed_error_from_file(trx, tf);
fclose(tf);
}
/*************************************************************************
Reports a foreign key error associated with an update or a delete of a
parent table index entry. */
@ -598,6 +622,8 @@ row_ins_foreign_report_err(
FILE* ef = dict_foreign_err_file;
trx_t* trx = thr_get_trx(thr);
row_ins_set_detailed(trx, foreign);
mutex_enter(&dict_foreign_err_mutex);
rewind(ef);
ut_print_timestamp(ef);
@ -607,7 +633,8 @@ row_ins_foreign_report_err(
fputs("Foreign key constraint fails for table ", ef);
ut_print_name(ef, trx, foreign->foreign_table_name);
fputs(":\n", ef);
dict_print_info_on_foreign_key_in_create_format(ef, trx, foreign);
dict_print_info_on_foreign_key_in_create_format(ef, trx, foreign,
TRUE);
putc('\n', ef);
fputs(errstr, ef);
fputs(" in parent table, in index ", ef);
@ -648,7 +675,9 @@ row_ins_foreign_report_add_err(
child table */
{
FILE* ef = dict_foreign_err_file;
row_ins_set_detailed(trx, foreign);
mutex_enter(&dict_foreign_err_mutex);
rewind(ef);
ut_print_timestamp(ef);
@ -657,7 +686,8 @@ row_ins_foreign_report_add_err(
fputs("Foreign key constraint fails for table ", ef);
ut_print_name(ef, trx, foreign->foreign_table_name);
fputs(":\n", ef);
dict_print_info_on_foreign_key_in_create_format(ef, trx, foreign);
dict_print_info_on_foreign_key_in_create_format(ef, trx, foreign,
TRUE);
fputs("\nTrying to add in child table, in index ", ef);
ut_print_name(ef, trx, foreign->foreign_index->name);
if (entry) {
@ -1224,6 +1254,9 @@ run_again:
if (check_table == NULL || check_table->ibd_file_missing) {
if (check_ref) {
FILE* ef = dict_foreign_err_file;
row_ins_set_detailed(trx, foreign);
mutex_enter(&dict_foreign_err_mutex);
rewind(ef);
ut_print_timestamp(ef);
@ -1233,7 +1266,7 @@ run_again:
ut_print_name(ef, trx, foreign->foreign_table_name);
fputs(":\n", ef);
dict_print_info_on_foreign_key_in_create_format(ef,
trx, foreign);
trx, foreign, TRUE);
fputs("\nTrying to add to index ", ef);
ut_print_name(ef, trx, foreign->foreign_index->name);
fputs(" tuple:\n", ef);

View File

@ -1973,13 +1973,20 @@ row_create_index_for_mysql(
/*=======================*/
/* out: error number or DB_SUCCESS */
dict_index_t* index, /* in: index definition */
trx_t* trx) /* in: transaction handle */
trx_t* trx, /* in: transaction handle */
const ulint* field_lengths) /* in: if not NULL, must contain
dict_index_get_n_fields(index)
actual field lengths for the
index columns, which are
then checked for not being too
large. */
{
ind_node_t* node;
mem_heap_t* heap;
que_thr_t* thr;
ulint err;
ulint i, j;
ulint len;
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX));
@ -2018,10 +2025,16 @@ row_create_index_for_mysql(
}
}
/* Check also that prefix_len < DICT_MAX_COL_PREFIX_LEN */
/* Check also that prefix_len and actual length
< DICT_MAX_INDEX_COL_LEN */
if (dict_index_get_nth_field(index, i)->prefix_len
>= DICT_MAX_COL_PREFIX_LEN) {
len = dict_index_get_nth_field(index, i)->prefix_len;
if (field_lengths) {
len = ut_max(len, field_lengths[i]);
}
if (len >= DICT_MAX_INDEX_COL_LEN) {
err = DB_TOO_BIG_RECORD;
goto error_handling;

View File

@ -52,6 +52,32 @@ trx_start_if_not_started_noninline(
trx_start_if_not_started(trx);
}
/*****************************************************************
Set detailed error message for the transaction. */
void
trx_set_detailed_error(
/*===================*/
trx_t* trx, /* in: transaction struct */
char* msg) /* in: detailed error message */
{
ut_strlcpy(trx->detailed_error, msg, sizeof(trx->detailed_error));
}
/*****************************************************************
Set detailed error message for the transaction from a file. Note that the
file is rewinded before reading from it. */
void
trx_set_detailed_error_from_file(
/*=============================*/
trx_t* trx, /* in: transaction struct */
FILE* file) /* in: file to read message from */
{
os_file_read_string(file, trx->detailed_error,
sizeof(trx->detailed_error));
}
/********************************************************************
Retrieves the error_info field from a trx. */
@ -130,6 +156,7 @@ trx_create(
trx->undo_no_arr = NULL;
trx->error_state = DB_SUCCESS;
trx->detailed_error[0] = '\0';
trx->sess = sess;
trx->que_state = TRX_QUE_RUNNING;

View File

@ -342,6 +342,31 @@ ut_free_all_mem(void)
}
}
/**************************************************************************
Copies up to size - 1 characters from the NUL-terminated string src to
dst, NUL-terminating the result. Returns strlen(src), so truncation
occurred if the return value >= size. */
ulint
ut_strlcpy(
/*=======*/
/* out: strlen(src) */
char* dst, /* in: destination buffer */
const char* src, /* in: source buffer */
ulint size) /* in: size of destination buffer */
{
ulint src_size = strlen(src);
if (size != 0) {
ulint n = ut_min(src_size, size - 1);
memcpy(dst, src, n);
dst[n] = '\0';
}
return src_size;
}
/**************************************************************************
Make a quoted copy of a NUL-terminated string. Leading and trailing
quotes will not be included; only embedded quotes will be escaped.

View File

@ -60,7 +60,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
sql_string.cc sql_table.cc sql_test.cc sql_udf.cc \
sql_update.cc sql_yacc.cc table.cc thr_malloc.cc time.cc \
unireg.cc uniques.cc stacktrace.c sql_union.cc hash_filo.cc \
spatial.cc gstream.cc sql_help.cc tztime.cc protocol_cursor.cc \
spatial.cc gstream.cc sql_help.cc tztime.cc sql_cursor.cc \
sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
ha_blackhole.cc

View File

@ -3994,7 +3994,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
...
The 'unique' array is collected in one sequential scan through the entire
index. This is done in two places: in chk_index() and in sort_key_write().
Statistics collection may consider NULLs as either equal or inequal (see
Statistics collection may consider NULLs as either equal or unequal (see
SEARCH_NULL_ARE_NOT_EQUAL, MI_STATS_METHOD_*).
Output is an array:

View File

@ -67,7 +67,7 @@ static const char *field_pack[]=
"no zeros", "blob", "constant", "table-lockup",
"always zero","varchar","unique-hash","?","?"};
static const char *myisam_stats_method_str="nulls_inequal";
static const char *myisam_stats_method_str="nulls_unequal";
static void get_options(int *argc,char * * *argv);
static void print_version(void);
@ -339,7 +339,7 @@ static struct my_option my_long_options[] =
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"stats_method", OPT_STATS_METHOD,
"Specifies how index statistics collection code should threat NULLs. "
"Possible values of name are \"nulls_inequal\" (default behavior for 4.1/5.0), and \"nulls_equal\" (emulate 4.0 behavior).",
"Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), and \"nulls_equal\" (emulate 4.0 behavior).",
(gptr*) &myisam_stats_method_str, (gptr*) &myisam_stats_method_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
@ -471,7 +471,7 @@ static void usage(void)
#include <help_end.h>
const char *myisam_stats_method_names[] = {"nulls_inequal", "nulls_equal",
const char *myisam_stats_method_names[] = {"nulls_unequal", "nulls_equal",
NullS};
TYPELIB myisam_stats_method_typelib= {
array_elements(myisam_stats_method_names) - 1, "",

View File

@ -2271,3 +2271,33 @@ select c1 from t1 where c1 like 'abcde111%' order by c1;
c1
abcde111
drop table t1;
DROP TABLE IF EXISTS t1, t2;
DROP PROCEDURE IF EXISTS sp1;
set names ujis;
set character_set_database = ujis;
set character_set_server = ujis;
CREATE TABLE t1(c1 char(2)) default charset = ujis;
CREATE TABLE t2(c2 char(2)) default charset = ujis;
INSERT INTO t1 VALUES(_ujis 0xA4A2);
CREATE PROCEDURE sp1()
BEGIN
DECLARE a CHAR(1);
DECLARE cur1 CURSOR FOR SELECT c1 FROM t1;
OPEN cur1;
FETCH cur1 INTO a;
INSERT INTO t2 VALUES (a);
CLOSE cur1;
END|
CALL sp1();
SELECT c1,c2 FROM t1,t2;
c1 c2
¤¢ ¤¢
SELECT hex(convert(_latin1 0xA4A2 using ujis)),hex(c2) FROM t1,t2;
hex(convert(_latin1 0xA4A2 using ujis)) hex(c2)
8FA2F0A1F1 A4A2
DROP PROCEDURE sp1;
DROP TABLE t1;
DROP TABLE t2;
set names default;
set character_set_database=default;
set character_set_server=default;

View File

@ -821,6 +821,142 @@ SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
MAX(id)
NULL
DROP TABLE t1;
create table t1m (a int) engine=myisam;
create table t1i (a int) engine=innodb;
create table t2m (a int) engine=myisam;
create table t2i (a int) engine=innodb;
insert into t2m values (5);
insert into t2i values (5);
select min(a) from t1m;
min(a)
NULL
select min(7) from t1m;
min(7)
NULL
select min(7) from DUAL;
min(7)
NULL
explain select min(7) from t2m join t1m;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
select min(7) from t2m join t1m;
min(7)
NULL
select max(a) from t1m;
max(a)
NULL
select max(7) from t1m;
max(7)
NULL
select max(7) from DUAL;
max(7)
NULL
explain select max(7) from t2m join t1m;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
select max(7) from t2m join t1m;
max(7)
NULL
select 1, min(a) from t1m where a=99;
1 min(a)
1 NULL
select 1, min(a) from t1m where 1=99;
1 min(a)
1 NULL
select 1, min(1) from t1m where a=99;
1 min(1)
select 1, min(1) from t1m where 1=99;
1 min(1)
1 NULL
select 1, max(a) from t1m where a=99;
1 max(a)
1 NULL
select 1, max(a) from t1m where 1=99;
1 max(a)
1 NULL
select 1, max(1) from t1m where a=99;
1 max(1)
select 1, max(1) from t1m where 1=99;
1 max(1)
1 NULL
select min(a) from t1i;
min(a)
NULL
select min(7) from t1i;
min(7)
NULL
select min(7) from DUAL;
min(7)
NULL
explain select min(7) from t2i join t1i;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
select min(7) from t2i join t1i;
min(7)
NULL
select max(a) from t1i;
max(a)
NULL
select max(7) from t1i;
max(7)
NULL
select max(7) from DUAL;
max(7)
NULL
explain select max(7) from t2i join t1i;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
select max(7) from t2i join t1i;
max(7)
NULL
select 1, min(a) from t1i where a=99;
1 min(a)
1 NULL
select 1, min(a) from t1i where 1=99;
1 min(a)
1 NULL
select 1, min(1) from t1i where a=99;
1 min(1)
1 NULL
select 1, min(1) from t1i where 1=99;
1 min(1)
1 NULL
select 1, max(a) from t1i where a=99;
1 max(a)
1 NULL
select 1, max(a) from t1i where 1=99;
1 max(a)
1 NULL
select 1, max(1) from t1i where a=99;
1 max(1)
1 NULL
select 1, max(1) from t1i where 1=99;
1 max(1)
1 NULL
explain select count(*), min(7), max(7) from t1m, t1i;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
select count(*), min(7), max(7) from t1m, t1i;
count(*) min(7) max(7)
0 NULL NULL
explain select count(*), min(7), max(7) from t1m, t2i;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
select count(*), min(7), max(7) from t1m, t2i;
count(*) min(7) max(7)
0 NULL NULL
explain select count(*), min(7), max(7) from t2m, t1i;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2m system NULL NULL NULL NULL 1
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
select count(*), min(7), max(7) from t2m, t1i;
count(*) min(7) max(7)
0 NULL NULL
drop table t1m, t1i, t2m, t2i;
create table t2 (ff double);
insert into t2 values (2.2);
select cast(sum(distinct ff) as decimal(5,2)) from t2;

View File

@ -193,6 +193,15 @@ select * from t1 where a in (NULL, 'aa');
a
aa
drop table t1;
create table t1 (id int, key(id));
insert into t1 values (1),(2),(3);
select count(*) from t1 where id not in (1);
count(*)
2
select count(*) from t1 where id not in (1,2);
count(*)
1
drop table t1;
CREATE TABLE t1 (a int PRIMARY KEY);
INSERT INTO t1 VALUES (44), (45), (46);
SELECT * FROM t1 WHERE a IN (45);

View File

@ -1011,3 +1011,9 @@ t
1000000
1
drop table t1;
create table t1 (d decimal default null);
insert into t1 values (null);
select format(d, 2) from t1;
format(d, 2)
NULL
drop table t1;

View File

@ -1,4 +1,5 @@
DROP TABLE IF EXISTS t0,t1,t2,t3,t5;
DROP TABLE IF EXISTS t0,t1,t2,t3,t4,t5;
DROP VIEW IF EXISTS v1;
show variables where variable_name like "skip_show_database";
Variable_name Value
skip_show_database OFF
@ -638,8 +639,8 @@ use test;
create function sub1(i int) returns int
return i+1;
create table t1(f1 int);
create view t2 (c) as select f1 from t1;
create view t3 (c) as select sub1(1);
create view v2 (c) as select f1 from t1;
create view v3 (c) as select sub1(1);
create table t4(f1 int, KEY f1_key (f1));
drop table t1;
drop function sub1;
@ -647,29 +648,29 @@ select table_name from information_schema.views
where table_schema='test';
table_name
Warnings:
Warning 1356 View 'test.t2' references invalid table(s) or column(s) or function(s)
Warning 1356 View 'test.t3' references invalid table(s) or column(s) or function(s)
Warning 1356 View 'test.v2' references invalid table(s) or column(s) or function(s)
Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s)
select table_name from information_schema.views
where table_schema='test';
table_name
Warnings:
Warning 1356 View 'test.t2' references invalid table(s) or column(s) or function(s)
Warning 1356 View 'test.t3' references invalid table(s) or column(s) or function(s)
Warning 1356 View 'test.v2' references invalid table(s) or column(s) or function(s)
Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s)
select column_name from information_schema.columns
where table_schema='test';
column_name
f1
Warnings:
Warning 1356 View 'test.t2' references invalid table(s) or column(s) or function(s)
Warning 1356 View 'test.t3' references invalid table(s) or column(s) or function(s)
Warning 1356 View 'test.v2' references invalid table(s) or column(s) or function(s)
Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s)
select index_name from information_schema.statistics where table_schema='test';
index_name
f1_key
select constraint_name from information_schema.table_constraints
where table_schema='test';
constraint_name
drop view t2;
drop view t3;
drop view v2;
drop view v3;
drop table t4;
select * from information_schema.table_names;
ERROR 42S02: Unknown table 'table_names' in information_schema

View File

@ -1,4 +1,4 @@
DROP TABLE IF EXISTS t1,t2;
DROP TABLE IF EXISTS t1,t2,t3;
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, id),
FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE,

View File

@ -1378,9 +1378,9 @@ 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
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
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
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
ERROR 42S22: Unknown column 't1.id' in 'where clause'
drop table t3,t2,t1;
@ -1392,7 +1392,7 @@ 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
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `t1` (`id`) ON DELETE CASCADE)
delete from t1 where id=15;
delete from t1 where id=0;
drop table t1;
@ -2559,3 +2559,60 @@ FOREIGN KEY (b) REFERENCES test.t1(id)
) ENGINE=InnoDB;
Got one of the listed errors
DROP TABLE t1;
create table t1 (col1 varchar(2000), index (col1(767)))
character set = latin1 engine = innodb;
create table t2 (col1 char(255), index (col1))
character set = latin1 engine = innodb;
create table t3 (col1 binary(255), index (col1))
character set = latin1 engine = innodb;
create table t4 (col1 varchar(767), index (col1))
character set = latin1 engine = innodb;
create table t5 (col1 varchar(767) primary key)
character set = latin1 engine = innodb;
create table t6 (col1 varbinary(767) primary key)
character set = latin1 engine = innodb;
create table t7 (col1 text, index(col1(767)))
character set = latin1 engine = innodb;
create table t8 (col1 blob, index(col1(767)))
character set = latin1 engine = innodb;
create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2))
character set = latin1 engine = innodb;
drop table t1, t2, t3, t4, t5, t6, t7, t8, t9;
create table t1 (col1 varchar(768), index (col1))
character set = latin1 engine = innodb;
ERROR HY000: Can't create table './test/t1.frm' (errno: 139)
create table t2 (col1 varchar(768) primary key)
character set = latin1 engine = innodb;
ERROR HY000: Can't create table './test/t2.frm' (errno: 139)
create table t3 (col1 varbinary(768) primary key)
character set = latin1 engine = innodb;
ERROR HY000: Can't create table './test/t3.frm' (errno: 139)
create table t4 (col1 text, index(col1(768)))
character set = latin1 engine = innodb;
ERROR HY000: Can't create table './test/t4.frm' (errno: 139)
create table t5 (col1 blob, index(col1(768)))
character set = latin1 engine = innodb;
ERROR HY000: Can't create table './test/t5.frm' (errno: 139)
CREATE TABLE t1
(
id INT PRIMARY KEY
) ENGINE=InnoDB;
CREATE TABLE t2
(
v INT,
CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id)
) ENGINE=InnoDB;
INSERT INTO t2 VALUES(2);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
INSERT INTO t1 VALUES(1);
INSERT INTO t2 VALUES(1);
DELETE FROM t1 WHERE id = 1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
DROP TABLE t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE t1;
SET FOREIGN_KEY_CHECKS=1;
INSERT INTO t2 VALUES(3);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
DROP TABLE t2;

View File

@ -66,6 +66,17 @@ a b
3 row 3
0
drop table t1;
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
create table t1(id integer not null auto_increment primary key);
insert into t1 values(0);
select * from t1;
id
0
select * from t1;
id
0
SET @@SQL_MODE=@OLD_SQL_MODE;
drop table t1;
create table t1 (a int default 100, b int, c varchar(60));
load data infile '../../std_data/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=concat("b=",@b);
select * from t1;

View File

@ -1,3 +1,4 @@
DROP TABLE IF EXISTS t1;
select 1;
1
1

View File

@ -610,7 +610,7 @@ test.t2 984116287
drop table t1, t2;
show variables like 'myisam_stats_method';
Variable_name Value
myisam_stats_method nulls_inequal
myisam_stats_method nulls_unequal
create table t1 (a int, key(a));
insert into t1 values (0),(1),(2),(3),(4);
insert into t1 select NULL from t1;
@ -651,7 +651,7 @@ t1 1 a 1 a A 5 NULL NULL YES BTREE
set myisam_stats_method=DEFAULT;
show variables like 'myisam_stats_method';
Variable_name Value
myisam_stats_method nulls_inequal
myisam_stats_method nulls_unequal
insert into t1 values (11);
delete from t1 where a=11;
analyze table t1;

View File

@ -200,3 +200,119 @@ a
drop table t4;
show tables;
Tables_in_test
create table t1 (
ai bigint auto_increment,
c001 int(11) not null,
c002 int(11) not null,
c003 int(11) not null,
c004 int(11) not null,
c005 int(11) not null,
c006 int(11) not null,
c007 int(11) not null,
c008 int(11) not null,
c009 int(11) not null,
c010 int(11) not null,
c011 int(11) not null,
c012 int(11) not null,
c013 int(11) not null,
c014 int(11) not null,
c015 int(11) not null,
c016 int(11) not null,
c017 int(11) not null,
c018 int(11) not null,
c019 int(11) not null,
c020 int(11) not null,
c021 int(11) not null,
c022 int(11) not null,
c023 int(11) not null,
c024 int(11) not null,
c025 int(11) not null,
c026 int(11) not null,
c027 int(11) not null,
c028 int(11) not null,
c029 int(11) not null,
c030 int(11) not null,
c031 int(11) not null,
c032 int(11) not null,
c033 int(11) not null,
c034 int(11) not null,
c035 int(11) not null,
c036 int(11) not null,
c037 int(11) not null,
c038 int(11) not null,
c039 int(11) not null,
c040 int(11) not null,
c041 int(11) not null,
c042 int(11) not null,
c043 int(11) not null,
c044 int(11) not null,
c045 int(11) not null,
c046 int(11) not null,
c047 int(11) not null,
c048 int(11) not null,
c049 int(11) not null,
c050 int(11) not null,
c051 int(11) not null,
c052 int(11) not null,
c053 int(11) not null,
c054 int(11) not null,
c055 int(11) not null,
c056 int(11) not null,
c057 int(11) not null,
c058 int(11) not null,
c059 int(11) not null,
c060 int(11) not null,
c061 int(11) not null,
c062 int(11) not null,
c063 int(11) not null,
c064 int(11) not null,
c065 int(11) not null,
c066 int(11) not null,
c067 int(11) not null,
c068 int(11) not null,
c069 int(11) not null,
c070 int(11) not null,
c071 int(11) not null,
c072 int(11) not null,
c073 int(11) not null,
c074 int(11) not null,
c075 int(11) not null,
c076 int(11) not null,
c077 int(11) not null,
c078 int(11) not null,
c079 int(11) not null,
c080 int(11) not null,
c081 int(11) not null,
c082 int(11) not null,
c083 int(11) not null,
c084 int(11) not null,
c085 int(11) not null,
c086 int(11) not null,
c087 int(11) not null,
c088 int(11) not null,
c089 int(11) not null,
c090 int(11) not null,
c091 int(11) not null,
c092 int(11) not null,
c093 int(11) not null,
c094 int(11) not null,
c095 int(11) not null,
c096 int(11) not null,
c097 int(11) not null,
c098 int(11) not null,
c099 int(11) not null,
c100 int(11) not null,
c101 int(11) not null,
c102 int(11) not null,
c103 int(11) not null,
c104 int(11) not null,
c105 int(11) not null,
c106 int(11) not null,
c107 int(11) not null,
c108 int(11) not null,
c109 int(11) not null,
primary key (ai),
unique key tx1 (c002, c003, c004, c005)) engine=ndb;
create index tx2
on t1 (c010, c011, c012, c013);
drop table t1;

View File

@ -5,3 +5,10 @@ GRANT USAGE ON *.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255'
GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255'
REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255';
DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
select user();
user()
#
show processlist;
Id User Host db Command Time State Info
# root # test Sleep # NULL
# root # test Query # NULL show processlist

View File

@ -13,3 +13,49 @@ select @value;
3
drop procedure test.longprocedure;
drop table t1;
create table t1 (f1 char(100) , f2 mediumint , f3 int , f4 real, f5 numeric);
insert into t1 (f1, f2, f3, f4, f5) values
("This is a test case for for Bug#9819", 1, 2, 3.0, 4.598);
Warnings:
Note 1265 Data truncated for column 'f5' at row 1
create table t2 like t1;
select count(*) from t1;
count(*)
256
select count(*) from t2;
count(*)
0
create procedure p1()
begin
declare done integer default 0;
declare vf1 char(100) ;
declare vf2 mediumint;
declare vf3 int ;
declare vf4 real ;
declare vf5 numeric ;
declare cur1 cursor for select f1,f2,f3,f4,f5 from t1;
declare continue handler for sqlstate '02000' set done = 1;
open cur1;
while done <> 1 do
fetch cur1 into vf1, vf2, vf3, vf4, vf5;
if not done then
insert into t2 values (vf1, vf2, vf3, vf4, vf5);
end if;
end while;
close cur1;
end|
call p1();
select count(*) from t1;
count(*)
256
select count(*) from t2;
count(*)
256
select f1 from t1 limit 1;
f1
This is a test case for for Bug#9819
select f1 from t2 limit 1;
f1
This is a test case for for Bug#9819
drop procedure p1;
drop table t1, t2;

View File

@ -1,4 +1,5 @@
drop table if exists t1,t2;
drop view if exists v1;
CREATE TABLE t1 (c int not null, d char (10) not null);
insert into t1 values(1,""),(2,"a"),(3,"b");
CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
@ -99,32 +100,32 @@ Variable_name Value
Created_tmp_disk_tables 0
Created_tmp_tables 2
drop table t1;
create temporary table t1 as select 'This is temp. table' A;
create view t1 as select 'This is view' A;
select * from t1;
create temporary table v1 as select 'This is temp. table' A;
create view v1 as select 'This is view' A;
select * from v1;
A
This is temp. table
show create table t1;
show create table v1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
v1 CREATE TEMPORARY TABLE `v1` (
`A` varchar(19) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create view t1;
show create view v1;
View Create View
t1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `t1` AS select _latin1'This is view' AS `A`
drop view t1;
select * from t1;
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _latin1'This is view' AS `A`
drop view v1;
select * from v1;
A
This is temp. table
create view t1 as select 'This is view again' A;
select * from t1;
create view v1 as select 'This is view again' A;
select * from v1;
A
This is temp. table
drop table t1;
select * from t1;
drop table v1;
select * from v1;
A
This is view again
drop view t1;
drop view v1;
create table t1 (a int, b int, index(a), index(b));
create table t2 (c int auto_increment, d varchar(255), primary key (c));
insert into t1 values (3,1),(3,2);

View File

@ -553,3 +553,13 @@ sum(a1) b1+0 b2+0
2 0 0
4 2 2
8 1 1
select 1 from t1 join t2 on b1 = b2 group by b1 order by 1;
1
1
1
1
select b1+0,sum(b1), sum(b2) from t1 join t2 on b1 = b2 group by b1 order by 1;
b1+0 sum(b1) sum(b2)
0 0 0
1 4 4
2 2 2

View File

@ -672,6 +672,17 @@ a
9999.999
0000.000
drop table t1;
create table t1(a decimal(10,5), b decimal(10,1));
insert into t1 values(123.12345, 123.12345);
Warnings:
Note 1265 Data truncated for column 'b' at row 1
update t1 set b=a;
Warnings:
Note 1265 Data truncated for column 'b' at row 1
select * from t1;
a b
123.12345 123.1
drop table t1;
CREATE TABLE t1
(EMPNUM CHAR(3) NOT NULL,
HOURS DECIMAL(5));

View File

@ -780,21 +780,6 @@ t1 CREATE TABLE `t1` (
`b` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t2;
create table t1 (d decimal(10,1));
create table t2 (d decimal(10,9));
insert into t1 values ("100000000.0");
insert into t2 values ("1.23456780");
create table t3 select * from t2 union select * from t1;
select * from t3;
d
1.234567800
100000000.000000000
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`d` decimal(18,9) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t2,t3;
create table t1 select 1 union select -1;
select * from t1;
1

View File

@ -251,3 +251,15 @@ f1 f2
1 1
2 2
drop table t1,t2;
create table t1(f1 int);
select DATABASE();
DATABASE()
test
update t1 set f1=1 where count(*)=1;
ERROR HY000: Invalid use of group function
select DATABASE();
DATABASE()
test
delete from t1 where count(*)=1;
ERROR HY000: Invalid use of group function
drop table t1;

View File

@ -1151,3 +1151,45 @@ SET collation_connection='ujis_bin';
-- source include/ctype_innodb_like.inc
# End of 4.1 tests
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
set names ujis;
set character_set_database = ujis;
set character_set_server = ujis;
CREATE TABLE t1(c1 char(2)) default charset = ujis;
CREATE TABLE t2(c2 char(2)) default charset = ujis;
INSERT INTO t1 VALUES(_ujis 0xA4A2);
DELIMITER |;
CREATE PROCEDURE sp1()
BEGIN
DECLARE a CHAR(1);
DECLARE cur1 CURSOR FOR SELECT c1 FROM t1;
OPEN cur1;
FETCH cur1 INTO a;
INSERT INTO t2 VALUES (a);
CLOSE cur1;
END|
DELIMITER ;|
CALL sp1();
#The data in t1 and t2 should be the same but different
SELECT c1,c2 FROM t1,t2;
#Since the result of hex(convert(_latin1 0xA4A2 using ujis))
#equals to hex(c2), it seems that the value which was inserted
#by using cursor is interpreted as latin1 character set
SELECT hex(convert(_latin1 0xA4A2 using ujis)),hex(c2) FROM t1,t2;
DROP PROCEDURE sp1;
DROP TABLE t1;
DROP TABLE t2;
set names default;
set character_set_database=default;
set character_set_server=default;

View File

@ -539,6 +539,75 @@ INSERT INTO t1 VALUES
SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
DROP TABLE t1;
#
# Bug #12882 min/max inconsistent on empty table
#
create table t1m (a int) engine=myisam;
create table t1i (a int) engine=innodb;
create table t2m (a int) engine=myisam;
create table t2i (a int) engine=innodb;
insert into t2m values (5);
insert into t2i values (5);
# test with MyISAM
select min(a) from t1m;
select min(7) from t1m;
select min(7) from DUAL;
explain select min(7) from t2m join t1m;
select min(7) from t2m join t1m;
select max(a) from t1m;
select max(7) from t1m;
select max(7) from DUAL;
explain select max(7) from t2m join t1m;
select max(7) from t2m join t1m;
select 1, min(a) from t1m where a=99;
select 1, min(a) from t1m where 1=99;
select 1, min(1) from t1m where a=99;
select 1, min(1) from t1m where 1=99;
select 1, max(a) from t1m where a=99;
select 1, max(a) from t1m where 1=99;
select 1, max(1) from t1m where a=99;
select 1, max(1) from t1m where 1=99;
# test with InnoDB
select min(a) from t1i;
select min(7) from t1i;
select min(7) from DUAL;
explain select min(7) from t2i join t1i;
select min(7) from t2i join t1i;
select max(a) from t1i;
select max(7) from t1i;
select max(7) from DUAL;
explain select max(7) from t2i join t1i;
select max(7) from t2i join t1i;
select 1, min(a) from t1i where a=99;
select 1, min(a) from t1i where 1=99;
select 1, min(1) from t1i where a=99;
select 1, min(1) from t1i where 1=99;
select 1, max(a) from t1i where a=99;
select 1, max(a) from t1i where 1=99;
select 1, max(1) from t1i where a=99;
select 1, max(1) from t1i where 1=99;
# mixed MyISAM/InnoDB test
explain select count(*), min(7), max(7) from t1m, t1i;
select count(*), min(7), max(7) from t1m, t1i;
explain select count(*), min(7), max(7) from t1m, t2i;
select count(*), min(7), max(7) from t1m, t2i;
explain select count(*), min(7), max(7) from t2m, t1i;
select count(*), min(7), max(7) from t2m, t1i;
drop table t1m, t1i, t2m, t2i;
# End of 4.1 tests
#

View File

@ -102,6 +102,13 @@ insert into t1 values ('aa'), ('bb');
select * from t1 where a in (NULL, 'aa');
drop table t1;
# BUG#13419
create table t1 (id int, key(id));
insert into t1 values (1),(2),(3);
select count(*) from t1 where id not in (1);
select count(*) from t1 where id not in (1,2);
drop table t1;
# End of 4.1 tests
#

View File

@ -665,3 +665,13 @@ select rpad(i, 7, ' ') as t from t1;
drop table t1;
# End of 4.1 tests
#
# Bug #13361: SELECT FORMAT(<decimal field with null>, 2) crashes
#
create table t1 (d decimal default null);
insert into t1 values (null);
select format(d, 2) from t1;
drop table t1;
# End of 5.0 tests

View File

@ -5,7 +5,8 @@
# show databases
--disable_warnings
DROP TABLE IF EXISTS t0,t1,t2,t3,t5;
DROP TABLE IF EXISTS t0,t1,t2,t3,t4,t5;
DROP VIEW IF EXISTS v1;
--enable_warnings
@ -364,8 +365,8 @@ use test;
create function sub1(i int) returns int
return i+1;
create table t1(f1 int);
create view t2 (c) as select f1 from t1;
create view t3 (c) as select sub1(1);
create view v2 (c) as select f1 from t1;
create view v3 (c) as select sub1(1);
create table t4(f1 int, KEY f1_key (f1));
drop table t1;
drop function sub1;
@ -378,8 +379,8 @@ where table_schema='test';
select index_name from information_schema.statistics where table_schema='test';
select constraint_name from information_schema.table_constraints
where table_schema='test';
drop view t2;
drop view t3;
drop view v2;
drop view v3;
drop table t4;
#

View File

@ -1,6 +1,6 @@
-- source include/have_innodb.inc
--disable_warnings
DROP TABLE IF EXISTS t1,t2;
DROP TABLE IF EXISTS t1,t2,t3;
--enable_warnings
#

View File

@ -978,9 +978,9 @@ create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` )
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 ) ;
--error 1217
--error 1451
delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
--error 1217
--error 1451
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 1054
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
@ -996,7 +996,7 @@ create table t1(
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);
-- error 1217
-- error 1451
delete from t1 where id=0;
delete from t1 where id=15;
delete from t1 where id=0;
@ -1482,3 +1482,85 @@ CREATE TEMPORARY TABLE t2
FOREIGN KEY (b) REFERENCES test.t1(id)
) ENGINE=InnoDB;
DROP TABLE t1;
#
# Test that index column max sizes are checked (bug #13315)
#
# prefix index
create table t1 (col1 varchar(2000), index (col1(767)))
character set = latin1 engine = innodb;
# normal indexes
create table t2 (col1 char(255), index (col1))
character set = latin1 engine = innodb;
create table t3 (col1 binary(255), index (col1))
character set = latin1 engine = innodb;
create table t4 (col1 varchar(767), index (col1))
character set = latin1 engine = innodb;
create table t5 (col1 varchar(767) primary key)
character set = latin1 engine = innodb;
create table t6 (col1 varbinary(767) primary key)
character set = latin1 engine = innodb;
create table t7 (col1 text, index(col1(767)))
character set = latin1 engine = innodb;
create table t8 (col1 blob, index(col1(767)))
character set = latin1 engine = innodb;
# multi-column indexes are allowed to be longer
create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2))
character set = latin1 engine = innodb;
drop table t1, t2, t3, t4, t5, t6, t7, t8, t9;
--error 1005
create table t1 (col1 varchar(768), index (col1))
character set = latin1 engine = innodb;
--error 1005
create table t2 (col1 varchar(768) primary key)
character set = latin1 engine = innodb;
--error 1005
create table t3 (col1 varbinary(768) primary key)
character set = latin1 engine = innodb;
--error 1005
create table t4 (col1 text, index(col1(768)))
character set = latin1 engine = innodb;
--error 1005
create table t5 (col1 blob, index(col1(768)))
character set = latin1 engine = innodb;
#
# Test improved foreign key error messages (bug #3443)
#
CREATE TABLE t1
(
id INT PRIMARY KEY
) ENGINE=InnoDB;
CREATE TABLE t2
(
v INT,
CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id)
) ENGINE=InnoDB;
--error 1452
INSERT INTO t2 VALUES(2);
INSERT INTO t1 VALUES(1);
INSERT INTO t2 VALUES(1);
--error 1451
DELETE FROM t1 WHERE id = 1;
--error 1217
DROP TABLE t1;
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE t1;
SET FOREIGN_KEY_CHECKS=1;
--error 1452
INSERT INTO t2 VALUES(3);
DROP TABLE t2;

View File

@ -31,6 +31,34 @@ load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated
select * from t1;
drop table t1;
#
# Bug #12053 LOAD DATA INFILE ignores NO_AUTO_VALUE_ON_ZERO setting
#
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
create table t1(id integer not null auto_increment primary key);
insert into t1 values(0);
disable_query_log;
eval SELECT * INTO OUTFILE '$MYSQL_TEST_DIR/var/tmp/t1' from t1;
delete from t1;
eval load data infile '$MYSQL_TEST_DIR/var/tmp/t1' into table t1;
enable_query_log;
select * from t1;
--exec rm $MYSQL_TEST_DIR/var/tmp/t1
disable_query_log;
eval SELECT * INTO OUTFILE '$MYSQL_TEST_DIR/var/tmp/t1'
FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n'
FROM t1;
delete from t1;
eval load data infile '$MYSQL_TEST_DIR/var/tmp/t1' into table t1
FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n';
enable_query_log;
select * from t1;
--exec rm $MYSQL_TEST_DIR/var/tmp/t1
SET @@SQL_MODE=@OLD_SQL_MODE;
drop table t1;
# End of 4.1 tests
#

View File

@ -1,6 +1,10 @@
# PS doesn't support multi-statements
--disable_ps_protocol
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
select 1;
delimiter ||||;
select 2;

View File

@ -19,16 +19,16 @@ insert into t1 values(1);
--disable_query_log
# Test delimiter : supplied on the command line
select "Test delimiter : from command line" as " ";
--exec $MYSQL test --delimiter=':' -e 'select * from t1:'
--exec $MYSQL test --delimiter=":" -e "select * from t1:"
# Test delimiter :; supplied on the command line
select "Test delimiter :; from command line" as " ";
--exec $MYSQL test --delimiter=':;' -e 'select * from t1:;'
--exec $MYSQL test --delimiter=":;" -e "select * from t1:;"
# Test 'go' command (vertical output) \G
select "Test 'go' command(vertical output) \G" as " ";
--exec $MYSQL test -e 'select * from t1\G'
--exec $MYSQL test -e "select * from t1\G"
# Test 'go' command \g
select "Test 'go' command \g" as " ";
--exec $MYSQL test -e 'select * from t1\g'
--exec $MYSQL test -e "select * from t1\g"
--enable_query_log
drop table t1;
@ -37,7 +37,7 @@ drop table t1;
#
create table t1(a int);
lock tables t1 write;
--exec $MYSQL -e 'use test; select database();'
--exec $MYSQL -e "use test; select database();"
unlock tables;
drop table t1;

View File

@ -102,10 +102,10 @@ select "--- --position --" as "";
select "--- reading stdin --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec cat $MYSQL_TEST_DIR/std_data/trunc_binlog.000001 | $MYSQL_BINLOG --short-form -
--exec $MYSQL_BINLOG --short-form - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec cat $MYSQL_TEST_DIR/std_data/trunc_binlog.000001 | $MYSQL_BINLOG --short-form --position=79 -
--exec $MYSQL_BINLOG --short-form --position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
# clean up
drop table t1, t2;

View File

@ -203,5 +203,124 @@ drop table t4;
show tables;
connection server1;
create table t1 (
ai bigint auto_increment,
c001 int(11) not null,
c002 int(11) not null,
c003 int(11) not null,
c004 int(11) not null,
c005 int(11) not null,
c006 int(11) not null,
c007 int(11) not null,
c008 int(11) not null,
c009 int(11) not null,
c010 int(11) not null,
c011 int(11) not null,
c012 int(11) not null,
c013 int(11) not null,
c014 int(11) not null,
c015 int(11) not null,
c016 int(11) not null,
c017 int(11) not null,
c018 int(11) not null,
c019 int(11) not null,
c020 int(11) not null,
c021 int(11) not null,
c022 int(11) not null,
c023 int(11) not null,
c024 int(11) not null,
c025 int(11) not null,
c026 int(11) not null,
c027 int(11) not null,
c028 int(11) not null,
c029 int(11) not null,
c030 int(11) not null,
c031 int(11) not null,
c032 int(11) not null,
c033 int(11) not null,
c034 int(11) not null,
c035 int(11) not null,
c036 int(11) not null,
c037 int(11) not null,
c038 int(11) not null,
c039 int(11) not null,
c040 int(11) not null,
c041 int(11) not null,
c042 int(11) not null,
c043 int(11) not null,
c044 int(11) not null,
c045 int(11) not null,
c046 int(11) not null,
c047 int(11) not null,
c048 int(11) not null,
c049 int(11) not null,
c050 int(11) not null,
c051 int(11) not null,
c052 int(11) not null,
c053 int(11) not null,
c054 int(11) not null,
c055 int(11) not null,
c056 int(11) not null,
c057 int(11) not null,
c058 int(11) not null,
c059 int(11) not null,
c060 int(11) not null,
c061 int(11) not null,
c062 int(11) not null,
c063 int(11) not null,
c064 int(11) not null,
c065 int(11) not null,
c066 int(11) not null,
c067 int(11) not null,
c068 int(11) not null,
c069 int(11) not null,
c070 int(11) not null,
c071 int(11) not null,
c072 int(11) not null,
c073 int(11) not null,
c074 int(11) not null,
c075 int(11) not null,
c076 int(11) not null,
c077 int(11) not null,
c078 int(11) not null,
c079 int(11) not null,
c080 int(11) not null,
c081 int(11) not null,
c082 int(11) not null,
c083 int(11) not null,
c084 int(11) not null,
c085 int(11) not null,
c086 int(11) not null,
c087 int(11) not null,
c088 int(11) not null,
c089 int(11) not null,
c090 int(11) not null,
c091 int(11) not null,
c092 int(11) not null,
c093 int(11) not null,
c094 int(11) not null,
c095 int(11) not null,
c096 int(11) not null,
c097 int(11) not null,
c098 int(11) not null,
c099 int(11) not null,
c100 int(11) not null,
c101 int(11) not null,
c102 int(11) not null,
c103 int(11) not null,
c104 int(11) not null,
c105 int(11) not null,
c106 int(11) not null,
c107 int(11) not null,
c108 int(11) not null,
c109 int(11) not null,
primary key (ai),
unique key tx1 (c002, c003, c004, c005)) engine=ndb;
create index tx2
on t1 (c010, c011, c012, c013);
drop table t1;
# End of 4.1 tests

View File

@ -24,7 +24,7 @@ connection master;
delete from t1;
delete from t2;
connection slave;
sync_slave_with_master;
# force a difference to see if master's multi-DELETE will correct it
insert into t1 values(1);
insert into t2 values(1);

View File

@ -33,7 +33,7 @@ delete from t2;
insert into t1 values(1,1);
insert into t2 values(1,1);
connection slave;
sync_slave_with_master;
# force a difference to see if master's multi-UPDATE will correct it
update t1 set a=2;

View File

@ -8,3 +8,13 @@ REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255';
DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
# End of 4.1 tests
# Bug #13407 "Remote connecting crashes server".
# Server crashed when one used USER() function in connection for which
# was impossible to obtain peer hostname.
connect (con1, 127.0.0.1, root, , test, $MASTER_MYPORT, );
--replace_column 1 #
select user();
--replace_column 1 # 6 # 3 #
show processlist;
connection default;

View File

@ -31,3 +31,52 @@ call test.longprocedure(@value); select @value;
drop procedure test.longprocedure;
drop table t1;
#
# Bug #9819 "Cursors: Mysql Server Crash while fetching from table with 5
# million records.":
# To really test the bug, increase the number of loop iterations ($1).
# For 4 millions set $1 to 22.
create table t1 (f1 char(100) , f2 mediumint , f3 int , f4 real, f5 numeric);
insert into t1 (f1, f2, f3, f4, f5) values
("This is a test case for for Bug#9819", 1, 2, 3.0, 4.598);
create table t2 like t1;
let $1=8;
--disable_query_log
--disable_result_log
while ($1)
{
eval insert into t1 select * from t1;
dec $1;
}
--enable_result_log
--enable_query_log
select count(*) from t1;
select count(*) from t2;
delimiter |;
create procedure p1()
begin
declare done integer default 0;
declare vf1 char(100) ;
declare vf2 mediumint;
declare vf3 int ;
declare vf4 real ;
declare vf5 numeric ;
declare cur1 cursor for select f1,f2,f3,f4,f5 from t1;
declare continue handler for sqlstate '02000' set done = 1;
open cur1;
while done <> 1 do
fetch cur1 into vf1, vf2, vf3, vf4, vf5;
if not done then
insert into t2 values (vf1, vf2, vf3, vf4, vf5);
end if;
end while;
close cur1;
end|
delimiter ;|
call p1();
select count(*) from t1;
select count(*) from t2;
select f1 from t1 limit 1;
select f1 from t2 limit 1;
drop procedure p1;
drop table t1, t2;

View File

@ -4,6 +4,7 @@
--disable_warnings
drop table if exists t1,t2;
drop view if exists v1;
--enable_warnings
CREATE TABLE t1 (c int not null, d char (10) not null);
@ -91,18 +92,18 @@ show status like "created_tmp%tables";
drop table t1;
# Fix for BUG#8921: Check that temporary table is ingored by view commands.
create temporary table t1 as select 'This is temp. table' A;
create view t1 as select 'This is view' A;
select * from t1;
show create table t1;
show create view t1;
drop view t1;
select * from t1;
create view t1 as select 'This is view again' A;
select * from t1;
drop table t1;
select * from t1;
drop view t1;
create temporary table v1 as select 'This is temp. table' A;
create view v1 as select 'This is view' A;
select * from v1;
show create table v1;
show create view v1;
drop view v1;
select * from v1;
create view v1 as select 'This is view again' A;
select * from v1;
drop table v1;
select * from v1;
drop view v1;
# Bug #8497: tmpdir with extra slashes would cause failures
#

View File

@ -224,3 +224,5 @@ select a1, a2, b1+0, b2+0 from t1 join t2 on a1 = a2;
select a1, a2, b1+0, b2+0 from t1 join t2 on a1 = a2 order by a1;
select a1, a2, b1+0, b2+0 from t1 join t2 on b1 = b2;
select sum(a1), b1+0, b2+0 from t1 join t2 on b1 = b2 group by b1 order by 1;
select 1 from t1 join t2 on b1 = b2 group by b1 order by 1;
select b1+0,sum(b1), sum(b2) from t1 join t2 on b1 = b2 group by b1 order by 1;

View File

@ -268,6 +268,16 @@ insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000
select * from t1;
drop table t1;
#
# Bug #7589: a problem with update from column
#
create table t1(a decimal(10,5), b decimal(10,1));
insert into t1 values(123.12345, 123.12345);
update t1 set b=a;
select * from t1;
drop table t1;
# End of 4.1 tests
#

View File

@ -443,14 +443,6 @@ create table t1 SELECT b from t2 UNION select tx from t2;
select * from t1;
show create table t1;
drop table t1,t2;
create table t1 (d decimal(10,1));
create table t2 (d decimal(10,9));
insert into t1 values ("100000000.0");
insert into t2 values ("1.23456780");
create table t3 select * from t2 union select * from t1;
select * from t3;
show create table t3;
drop table t1,t2,t3;
create table t1 select 1 union select -1;
select * from t1;
show create table t1;

View File

@ -215,4 +215,16 @@ UPDATE t1 SET t1.f2=(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1);
select * from t1;
drop table t1,t2;
#
# Bug #13180 sometimes server accepts sum func in update/delete where condition
#
create table t1(f1 int);
select DATABASE();
--error 1111
update t1 set f1=1 where count(*)=1;
select DATABASE();
--error 1111
delete from t1 where count(*)=1;
drop table t1;
# End of 4.1 tests

View File

@ -51,6 +51,16 @@
fun:pthread_create
}
{
pthread pthread_key_create
Memcheck:Leak
fun:malloc
fun:*
fun:*
fun:pthread_key_create
fun:my_thread_global_init
}
{
pthread strstr uninit
Memcheck:Cond
@ -127,8 +137,18 @@
{
libz deflate
Memcheck:Cond
obj:/usr/lib/libz.so.*
obj:/usr/lib/libz.so.*
obj:*/libz.so.*
obj:*/libz.so.*
fun:deflate
fun:compress2
}
{
libz deflate2
Memcheck:Cond
obj:*/libz.so.*
obj:*/libz.so.*
fun:deflate
obj:*/libz.so.*
fun:gzflush
}

View File

@ -221,6 +221,57 @@ gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size)
#endif
}
/*
Allocate many pointers at the same time.
DESCRIPTION
ptr1, ptr2, etc all point into big allocated memory area.
SYNOPSIS
multi_alloc_root()
root Memory root
ptr1, length1 Multiple arguments terminated by a NULL pointer
ptr2, length2 ...
...
NULL
RETURN VALUE
A pointer to the beginning of the allocated memory block
in case of success or NULL if out of memory.
*/
gptr multi_alloc_root(MEM_ROOT *root, ...)
{
va_list args;
char **ptr, *start, *res;
uint tot_length, length;
DBUG_ENTER("multi_alloc_root");
va_start(args, root);
tot_length= 0;
while ((ptr= va_arg(args, char **)))
{
length= va_arg(args, uint);
tot_length+= ALIGN_SIZE(length);
}
va_end(args);
if (!(start= (char*) alloc_root(root, tot_length)))
DBUG_RETURN(0); /* purecov: inspected */
va_start(args, root);
res= start;
while ((ptr= va_arg(args, char **)))
{
*ptr= res;
length= va_arg(args, uint);
res+= ALIGN_SIZE(length);
}
va_end(args);
DBUG_RETURN((gptr) start);
}
#define TRASH_MEM(X) TRASH(((char*)(X) + ((X)->size-(X)->left)), (X)->left)
/* Mark all data in blocks free for reusage */

View File

@ -3214,8 +3214,8 @@ Dbdict::alterTable_backup_mutex_locked(Signal* signal,
lreq->gci = tablePtr.p->gciTableCreated;
lreq->requestType = AlterTabReq::AlterTablePrepare;
sendSignal(rg, GSN_ALTER_TAB_REQ, signal,
AlterTabReq::SignalLength, JBB);
sendFragmentedSignal(rg, GSN_ALTER_TAB_REQ, signal,
AlterTabReq::SignalLength, JBB);
}
void Dbdict::alterTableRef(Signal * signal,
@ -3699,8 +3699,8 @@ Dbdict::execALTER_TAB_CONF(Signal * signal){
lreq->gci = gci;
lreq->requestType = AlterTabReq::AlterTableCommit;
sendSignal(rg, GSN_ALTER_TAB_REQ, signal,
AlterTabReq::SignalLength, JBB);
sendFragmentedSignal(rg, GSN_ALTER_TAB_REQ, signal,
AlterTabReq::SignalLength, JBB);
}
}
else {

View File

@ -31,6 +31,7 @@ Comment:
#include <ndb_global.h>
class Ndb;
class NdbApiSignal;
class NdbOperation;

View File

@ -29,6 +29,10 @@
#include <NdbOut.hpp>
#include <NdbSleep.h>
#include "ObjectMap.hpp"
#include <NdbIndexScanOperation.hpp>
#include <NdbIndexOperation.hpp>
#include "NdbUtil.hpp"
#include <NdbBlob.hpp>
class NdbGlobalEventBufferHandle;
NdbGlobalEventBufferHandle *NdbGlobalEventBuffer_init(int);

View File

@ -169,7 +169,8 @@ for i in \
libmysql_r/.libs/libmysqlclient_r.so* libmysql_r/libmysqlclient_r.* \
mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a \
libmysqld/.libs/libmysqld.a libmysqld/.libs/libmysqld.so* \
libmysqld/libmysqld.a netware/libmysql.imp
libmysqld/libmysqld.a netware/libmysql.imp \
zlib/.libs/libz.a
do
if [ -f $i ]
then

View File

@ -12,7 +12,7 @@
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
OutputDirectory="../../client_debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
@ -63,7 +63,7 @@
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
OutputDirectory="../../client_release"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">

View File

@ -61,7 +61,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
tztime.h my_decimal.h\
sp_head.h sp_pcontext.h sp_rcontext.h sp.h sp_cache.h \
parse_file.h sql_view.h sql_trigger.h \
sql_array.h \
sql_array.h sql_cursor.h \
examples/ha_example.h examples/ha_archive.h \
examples/ha_tina.h ha_blackhole.h \
ha_federated.h
@ -94,7 +94,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
client.c sql_client.cc mini_client_errors.c pack.c\
stacktrace.c repl_failsafe.h repl_failsafe.cc \
sql_olap.cc sql_view.cc \
gstream.cc spatial.cc sql_help.cc protocol_cursor.cc \
gstream.cc spatial.cc sql_help.cc sql_cursor.cc \
tztime.cc my_time.c my_decimal.cc\
sp_head.cc sp_pcontext.cc sp_rcontext.cc sp.cc \
sp_cache.cc parse_file.cc sql_trigger.cc \

View File

@ -588,12 +588,15 @@ static int parse_url(FEDERATED_SHARE *share, TABLE *table,
DBUG_ENTER("ha_federated::parse_url");
share->port= 0;
share->socket= 0;
DBUG_PRINT("info", ("Length %d \n", table->s->connect_string.length));
DBUG_PRINT("info", ("String %.*s \n", table->s->connect_string.length,
table->s->connect_string.str));
share->scheme= my_strdup_with_length(table->s->connect_string.str,
table->s->connect_string.length+1,
MYF(0));
share->scheme= my_strdup_with_length((const byte*)table->s->
connect_string.str,
table->s->connect_string.length,
MYF(0));
// Add a null for later termination of table name
share->scheme[table->s->connect_string.length]= 0;
DBUG_PRINT("info",("parse_url alloced share->scheme %lx", share->scheme));
@ -1374,13 +1377,9 @@ static int free_share(FEDERATED_SHARE *share)
if (!--share->use_count)
{
if (share->scheme)
{
my_free((gptr) share->scheme, MYF(0));
share->scheme= 0;
}
hash_delete(&federated_open_tables, (byte*) share);
my_free((gptr) share->scheme, MYF(MY_ALLOW_ZERO_PTR));
share->scheme= 0;
thr_lock_delete(&share->lock);
VOID(pthread_mutex_destroy(&share->mutex));
my_free((gptr) share, MYF(0));
@ -2626,7 +2625,8 @@ int ha_federated::stash_remote_error()
{
DBUG_ENTER("ha_federated::stash_remote_error()");
remote_error_number= mysql_errno(mysql);
snprintf(remote_error_buf, FEDERATED_QUERY_BUFFER_SIZE, mysql_error(mysql));
my_snprintf(remote_error_buf, FEDERATED_QUERY_BUFFER_SIZE,
mysql_error(mysql));
DBUG_RETURN(HA_FEDERATED_ERROR_WITH_REMOTE_SYSTEM);
}

View File

@ -1252,7 +1252,7 @@ innobase_init(void)
copy of it: */
internal_innobase_data_file_path = my_strdup(innobase_data_file_path,
MYF(MY_WME));
MYF(MY_FAE));
ret = (bool) srv_parse_data_file_paths_and_sizes(
internal_innobase_data_file_path,
@ -2386,7 +2386,7 @@ ha_innobase::open(
"how you can resolve the problem.\n",
norm_name);
free_share(share);
my_free((char*) upd_buff, MYF(0));
my_free((gptr) upd_buff, MYF(0));
my_errno = ENOENT;
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
@ -2404,7 +2404,7 @@ ha_innobase::open(
"how you can resolve the problem.\n",
norm_name);
free_share(share);
my_free((char*) upd_buff, MYF(0));
my_free((gptr) upd_buff, MYF(0));
my_errno = ENOENT;
dict_table_decrement_handle_count(ib_table);
@ -2498,7 +2498,7 @@ ha_innobase::close(void)
row_prebuilt_free((row_prebuilt_t*) innobase_prebuilt);
my_free((char*) upd_buff, MYF(0));
my_free((gptr) upd_buff, MYF(0));
free_share(share);
/* Tell InnoDB server that there might be work for
@ -4492,7 +4492,8 @@ create_index(
ulint is_unsigned;
ulint i;
ulint j;
ulint* field_lengths;
DBUG_ENTER("create_index");
key = form->key_info + key_num;
@ -4514,6 +4515,10 @@ create_index(
index = dict_mem_index_create((char*) table_name, key->name, 0,
ind_type, n_fields);
field_lengths = (ulint*) my_malloc(sizeof(ulint) * n_fields,
MYF(MY_FAE));
for (i = 0; i < n_fields; i++) {
key_part = key->key_part + i;
@ -4568,6 +4573,8 @@ create_index(
prefix_len = 0;
}
field_lengths[i] = key_part->length;
/* We assume all fields should be sorted in ascending
order, hence the '0': */
@ -4576,10 +4583,12 @@ create_index(
0, prefix_len);
}
error = row_create_index_for_mysql(index, trx);
error = row_create_index_for_mysql(index, trx, field_lengths);
error = convert_error_code_to_mysql(error, NULL);
my_free((gptr) field_lengths, MYF(0));
DBUG_RETURN(error);
}
@ -4602,7 +4611,7 @@ create_clustered_index_when_no_primary(
index = dict_mem_index_create((char*) table_name,
(char*) "GEN_CLUST_INDEX",
0, DICT_CLUSTERED, 0);
error = row_create_index_for_mysql(index, trx);
error = row_create_index_for_mysql(index, trx, NULL);
error = convert_error_code_to_mysql(error, NULL);
@ -5138,7 +5147,7 @@ ha_innobase::records_in_range(
mysql_byte* key_val_buff2 = (mysql_byte*) my_malloc(
table->s->reclength
+ table->s->max_key_length + 100,
MYF(MY_WME));
MYF(MY_FAE));
ulint buff2_len = table->s->reclength
+ table->s->max_key_length + 100;
dtuple_t* range_start;
@ -5197,7 +5206,7 @@ ha_innobase::records_in_range(
dtuple_free_for_mysql(heap1);
dtuple_free_for_mysql(heap2);
my_free((char*) key_val_buff2, MYF(0));
my_free((gptr) key_val_buff2, MYF(0));
prebuilt->trx->op_info = (char*)"";
@ -6065,6 +6074,8 @@ ha_innobase::start_stmt(
}
}
trx->detailed_error[0] = '\0';
/* Set the MySQL flag to mark that there is an active transaction */
if (trx->active_trans == 0) {
@ -6138,6 +6149,8 @@ ha_innobase::external_lock(
if (lock_type != F_UNLCK) {
/* MySQL is setting a new table lock */
trx->detailed_error[0] = '\0';
/* Set the MySQL flag to mark that there is an active
transaction */
if (trx->active_trans == 0) {
@ -6941,6 +6954,18 @@ ha_innobase::reset_auto_increment(ulonglong value)
DBUG_RETURN(0);
}
/* See comment in handler.cc */
bool
ha_innobase::get_error_message(int error, String *buf)
{
trx_t* trx = check_trx_exists(current_thd);
buf->copy(trx->detailed_error, strlen(trx->detailed_error),
system_charset_info);
return FALSE;
}
/***********************************************************************
Compares two 'refs'. A 'ref' is the (internal) primary key value of the row.
If there is no explicitly declared non-null unique key or a primary key, then

View File

@ -174,6 +174,8 @@ class ha_innobase: public handler
void init_table_handle_for_HANDLER();
ulonglong get_auto_increment();
int reset_auto_increment(ulonglong value);
virtual bool get_error_message(int error, String *buf);
uint8 table_cache_type() { return HA_CACHE_TBL_ASKTRANSACT; }
/*
@ -344,4 +346,4 @@ restored to a transaction read view. */
void
innobase_set_cursor_view(
/*=====================*/
void* curview); /* in: Consistent read view to be closed */
void* curview); /* in: Consistent read view to be set */

View File

@ -39,7 +39,7 @@ const char *myisam_recover_names[] =
TYPELIB myisam_recover_typelib= {array_elements(myisam_recover_names)-1,"",
myisam_recover_names, NULL};
const char *myisam_stats_method_names[] = {"nulls_inequal", "nulls_equal",
const char *myisam_stats_method_names[] = {"nulls_unequal", "nulls_equal",
NullS};
TYPELIB myisam_stats_method_typelib= {
array_elements(myisam_stats_method_names) - 1, "",

View File

@ -119,12 +119,12 @@ struct show_table_type_st sys_table_types[]=
struct show_table_alias_st sys_table_aliases[]=
{
{"INNOBASE", "InnoDB", NULL },
{"NDB", "NDBCLUSTER", NULL},
{"BDB", "BERKELEYDB", NULL},
{"HEAP", "MEMORY", NULL},
{"MERGE", "MRG_MYISAM", NULL},
{NullS, NullS, NULL}
{"INNOBASE", "InnoDB"},
{"NDB", "NDBCLUSTER"},
{"BDB", "BERKELEYDB"},
{"HEAP", "MEMORY"},
{"MERGE", "MRG_MYISAM"},
{NullS, NullS}
};
const char *ha_row_type[] = {
@ -145,28 +145,32 @@ enum db_type ha_resolve_by_name(const char *name, uint namelen)
THD *thd= current_thd;
show_table_alias_st *table_alias;
show_table_type_st *types;
const char *ptr= name;
if (thd && !my_strcasecmp(&my_charset_latin1, name, "DEFAULT")) {
if (thd && !my_strcasecmp(&my_charset_latin1, ptr, "DEFAULT"))
return (enum db_type) thd->variables.table_type;
}
retest:
for (types= sys_table_types; types->type; types++)
{
if (!my_strcasecmp(&my_charset_latin1, name, types->type))
if (!my_strcasecmp(&my_charset_latin1, ptr, types->type))
return (enum db_type) types->db_type;
}
/*
We check for the historical aliases next.
We check for the historical aliases.
*/
for (table_alias= sys_table_aliases; table_alias->type; table_alias++)
{
if (!my_strcasecmp(&my_charset_latin1, name, table_alias->alias) && table_alias->st)
return (enum db_type) table_alias->st->db_type;
if (!my_strcasecmp(&my_charset_latin1, ptr, table_alias->alias))
{
ptr= table_alias->type;
goto retest;
}
}
return DB_TYPE_UNKNOWN;
}
const char *ha_get_storage_engine(enum db_type db_type)
{
show_table_type_st *types;
@ -340,8 +344,8 @@ static int ha_init_errors(void)
SETMSG(HA_ERR_READ_ONLY_TRANSACTION, ER(ER_READ_ONLY_TRANSACTION));
SETMSG(HA_ERR_LOCK_DEADLOCK, ER(ER_LOCK_DEADLOCK));
SETMSG(HA_ERR_CANNOT_ADD_FOREIGN, ER(ER_CANNOT_ADD_FOREIGN));
SETMSG(HA_ERR_NO_REFERENCED_ROW, ER(ER_NO_REFERENCED_ROW));
SETMSG(HA_ERR_ROW_IS_REFERENCED, ER(ER_ROW_IS_REFERENCED));
SETMSG(HA_ERR_NO_REFERENCED_ROW, ER(ER_NO_REFERENCED_ROW_2));
SETMSG(HA_ERR_ROW_IS_REFERENCED, ER(ER_ROW_IS_REFERENCED_2));
SETMSG(HA_ERR_NO_SAVEPOINT, "No savepoint with that name");
SETMSG(HA_ERR_NON_UNIQUE_BLOCK_SIZE, "Non unique key block size");
SETMSG(HA_ERR_NO_SUCH_TABLE, "No such table: '%.64s'");
@ -398,29 +402,20 @@ int ha_init()
if (ha_init_errors())
return 1;
/*
This will go away soon.
*/
for (types= sys_table_types; types->type; types++)
{
switch (types->db_type) {
case DB_TYPE_HEAP:
types->ht= &heap_hton;
for (table_alias= sys_table_aliases; table_alias->type; table_alias++)
{
if (!my_strcasecmp(&my_charset_latin1, types->ht->name,
table_alias->type))
table_alias->st= types;
}
break;
case DB_TYPE_MYISAM:
types->ht= &myisam_hton;
break;
case DB_TYPE_MRG_MYISAM:
types->ht= &myisammrg_hton;
for (table_alias= sys_table_aliases; table_alias->type; table_alias++)
{
if (!my_strcasecmp(&my_charset_latin1, types->ht->name,
table_alias->type))
table_alias->st= types;
}
break;
#ifdef HAVE_BERKELEY_DB
case DB_TYPE_BERKELEY_DB:
@ -434,11 +429,6 @@ int ha_init()
else
{
types->ht= &berkeley_hton;
for (table_alias= sys_table_aliases; table_alias->type; table_alias++)
{
if (!my_strcasecmp(&my_charset_latin1, types->ht->name, table_alias->type))
table_alias->st= types;
}
ha_was_inited_ok(ht++);
}
}
@ -457,11 +447,6 @@ int ha_init()
{
ha_was_inited_ok(ht++);
types->ht= &innobase_hton;
for (table_alias= sys_table_aliases; table_alias->type; table_alias++)
{
if (!my_strcasecmp(&my_charset_latin1, types->ht->name, table_alias->type))
table_alias->st= types;
}
}
}
break;
@ -479,11 +464,6 @@ int ha_init()
{
ha_was_inited_ok(ht++);
types->ht= &ndbcluster_hton;
for (table_alias= sys_table_aliases; table_alias->type; table_alias++)
{
if (!my_strcasecmp(&my_charset_latin1, types->ht->name, table_alias->type))
table_alias->st= types;
}
}
}
break;
@ -1456,11 +1436,9 @@ int handler::ha_open(const char *name, int mode, int test_if_locked)
table->db_stat|=HA_READ_ONLY;
(void) extra(HA_EXTRA_NO_READCHECK); // Not needed in SQL
if (!alloc_root_inited(&table->mem_root)) // If temporary table
ref=(byte*) sql_alloc(ALIGN_SIZE(ref_length)*2);
else
ref=(byte*) alloc_root(&table->mem_root, ALIGN_SIZE(ref_length)*2);
if (!ref)
DBUG_ASSERT(alloc_root_inited(&table->mem_root));
if (!(ref= (byte*) alloc_root(&table->mem_root, ALIGN_SIZE(ref_length)*2)))
{
close();
error=HA_ERR_OUT_OF_MEM;
@ -1820,11 +1798,19 @@ void handler::print_error(int error, myf errflag)
textno=ER_CANNOT_ADD_FOREIGN;
break;
case HA_ERR_ROW_IS_REFERENCED:
textno=ER_ROW_IS_REFERENCED;
break;
{
String str;
get_error_message(error, &str);
my_error(ER_ROW_IS_REFERENCED_2, MYF(0), str.c_ptr_safe());
DBUG_VOID_RETURN;
}
case HA_ERR_NO_REFERENCED_ROW:
textno=ER_NO_REFERENCED_ROW;
break;
{
String str;
get_error_message(error, &str);
my_error(ER_NO_REFERENCED_ROW_2, MYF(0), str.c_ptr_safe());
DBUG_VOID_RETURN;
}
case HA_ERR_TABLE_DEF_CHANGED:
textno=ER_TABLE_DEF_CHANGED;
break;

View File

@ -367,7 +367,6 @@ struct show_table_type_st {
struct show_table_alias_st {
const char *alias;
const char *type;
show_table_type_st *st;
};
/* Possible flags of a handlerton */

View File

@ -1286,9 +1286,6 @@ public:
{
ft_handler->please->close_search(ft_handler);
ft_handler=0;
if (join_key)
table->file->ft_handler=0;
table->fulltext_searched=0;
}
concat= 0;
DBUG_VOID_RETURN;

View File

@ -1608,7 +1608,7 @@ String *Item_func_user::val_str(String *str)
else
{
user= thd->main_security_ctx.user;
host= thd->main_security_ctx.host;
host= thd->main_security_ctx.host_or_ip;
}
// For system threads (e.g. replication SQL thread) user may be empty
@ -1733,6 +1733,8 @@ String *Item_func_format::val_str(String *str)
{
my_decimal dec_val, rnd_dec, *res;
res= args[0]->val_decimal(&dec_val);
if ((null_value=args[0]->null_value))
return 0; /* purecov: inspected */
my_decimal_round(E_DEC_FATAL_ERROR, res, decimals, false, &rnd_dec);
my_decimal2string(E_DEC_FATAL_ERROR, &rnd_dec, 0, 0, 0, str);
str_length= str->length();

View File

@ -1468,7 +1468,7 @@ int subselect_single_select_engine::prepare()
int subselect_union_engine::prepare()
{
return unit->prepare(thd, result, SELECT_NO_UNLOCK, "");
return unit->prepare(thd, result, SELECT_NO_UNLOCK);
}
int subselect_uniquesubquery_engine::prepare()

View File

@ -1367,8 +1367,8 @@ void Item_sum_hybrid::cleanup()
void Item_sum_hybrid::no_rows_in_result()
{
Item_sum::no_rows_in_result();
was_values= FALSE;
clear();
}

View File

@ -2793,7 +2793,7 @@ void TC_LOG_MMAP::close()
case 3:
my_free((gptr)pages, MYF(0));
case 2:
my_munmap(data, (size_t)file_length);
my_munmap((byte*)data, (size_t)file_length);
case 1:
my_close(fd, MYF(0));
}

View File

@ -432,7 +432,7 @@ char server_version[SERVER_VERSION_LENGTH];
char *mysqld_unix_port, *opt_mysql_tmpdir;
const char **errmesg; /* Error messages */
const char *myisam_recover_options_str="OFF";
const char *myisam_stats_method_str="nulls_inequal";
const char *myisam_stats_method_str="nulls_unequal";
/* name of reference on left espression in rewritten IN subquery */
const char *in_left_expr_name= "<left expr>";
/* name of additional condition */
@ -4016,8 +4016,8 @@ extern "C" pthread_handler_decl(handle_connections_namedpipes,arg)
delete thd;
continue;
}
/* host name is unknown */
thd->host = my_strdup(my_localhost,MYF(0)); /* Host is unknown */
/* Host is unknown */
thd->security_ctx->host= my_strdup(my_localhost, MYF(0));
create_new_thread(thd);
}
@ -4208,7 +4208,7 @@ pthread_handler_decl(handle_connections_shared_memory,arg)
errmsg= 0;
goto errorconn;
}
thd->host= my_strdup(my_localhost,MYF(0)); /* Host is unknown */
thd->security_ctx->host= my_strdup(my_localhost, MYF(0)); /* Host is unknown */
create_new_thread(thd);
connect_number++;
continue;
@ -5519,7 +5519,7 @@ The minimum value for this variable is 4096.",
GET_ULONG, REQUIRED_ARG, 8192*1024, 4, ~0L, 0, 1, 0},
{"myisam_stats_method", OPT_MYISAM_STATS_METHOD,
"Specifies how MyISAM index statistics collection code should threat NULLs. "
"Possible values of name are \"nulls_inequal\" (default behavior for 4.1/5.0), and \"nulls_equal\" (emulate 4.0 behavior).",
"Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), and \"nulls_equal\" (emulate 4.0 behavior).",
(gptr*) &myisam_stats_method_str, (gptr*) &myisam_stats_method_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"net_buffer_length", OPT_NET_BUFFER_LENGTH,
@ -5827,10 +5827,10 @@ struct show_var_st status_vars[]= {
{"Com_show_fields", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_FIELDS]), SHOW_LONG_STATUS},
{"Com_show_grants", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_GRANTS]), SHOW_LONG_STATUS},
{"Com_show_innodb_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_INNODB_STATUS]), SHOW_LONG_STATUS},
{"Com_show_ndb_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_NDBCLUSTER_STATUS]), SHOW_LONG_STATUS},
{"Com_show_keys", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_KEYS]), SHOW_LONG_STATUS},
{"Com_show_logs", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_LOGS]), SHOW_LONG_STATUS},
{"Com_show_master_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_MASTER_STAT]), SHOW_LONG_STATUS},
{"Com_show_ndb_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_NDBCLUSTER_STATUS]), SHOW_LONG_STATUS},
{"Com_show_new_master", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_NEW_MASTER]), SHOW_LONG_STATUS},
{"Com_show_open_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_OPEN_TABLES]), SHOW_LONG_STATUS},
{"Com_show_privileges", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PRIVILEGES]), SHOW_LONG_STATUS},
@ -6106,7 +6106,7 @@ static void mysql_init_variables(void)
query_id= thread_id= 1L;
strmov(server_version, MYSQL_SERVER_VERSION);
myisam_recover_options_str= sql_mode_str= "OFF";
myisam_stats_method_str= "nulls_inequal";
myisam_stats_method_str= "nulls_unequal";
my_bind_addr = htonl(INADDR_ANY);
threads.empty();
thread_cache.empty();
@ -6157,7 +6157,7 @@ static void mysql_init_variables(void)
global_system_variables.old_passwords= 0;
/*
Default behavior for 4.1 and 5.0 is to treat NULL values as inequal
Default behavior for 4.1 and 5.0 is to treat NULL values as unequal
when collecting index statistics for MyISAM tables.
*/
global_system_variables.myisam_stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL;

View File

@ -80,6 +80,8 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
List_iterator_fast<Item> it(all_fields);
int const_result= 1;
bool recalc_const_item= 0;
longlong count= 1;
bool is_exact_count= TRUE;
table_map removed_tables= 0, outer_tables= 0, used_tables= 0;
table_map where_tables= 0;
Item *item;
@ -88,9 +90,13 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
if (conds)
where_tables= conds->used_tables();
/* Don't replace expression on a table that is part of an outer join */
/*
Analyze outer join dependencies, and, if possible, compute the number
of returned rows.
*/
for (TABLE_LIST *tl= tables; tl; tl= tl->next_leaf)
{
/* Don't replace expression on a table that is part of an outer join */
if (tl->on_expr)
{
outer_tables|= tl->table->map;
@ -102,15 +108,31 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
WHERE t2.field IS NULL;
*/
if (tl->table->map & where_tables)
return 0;
const_result= 0;
}
else
used_tables|= tl->table->map;
/*
If the storage manager of 'tl' gives exact row count, compute the total
number of rows. If there are no outer table dependencies, this count
may be used as the real count.
*/
if (tl->table->file->table_flags() & HA_NOT_EXACT_COUNT)
is_exact_count= FALSE;
else
{
tl->table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
count*= tl->table->file->records;
}
}
if (!const_result)
return 0;
/*
Iterate through item is select part and replace COUNT(), MIN() and MAX()
with constants (if possible)
Iterate through all items in the SELECT clause and replace
COUNT(), MIN() and MAX() with constants (if possible).
*/
while ((item= it++))
@ -122,9 +144,11 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
case Item_sum::COUNT_FUNC:
/*
If the expr in count(expr) can never be null we can change this
to the number of rows in the tables
to the number of rows in the tables if this number is exact and
there are no outer joins.
*/
if (!conds && !((Item_sum_count*) item)->args[0]->maybe_null)
if (!conds && !((Item_sum_count*) item)->args[0]->maybe_null &&
!outer_tables && is_exact_count)
{
longlong count= 1;
TABLE_LIST *table;
@ -210,12 +234,27 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
}
removed_tables|= table->map;
}
else if (!expr->const_item()) // This is VERY seldom false
else if (!expr->const_item() || !is_exact_count)
{
/*
The optimization is not applicable in both cases:
(a) 'expr' is a non-constant expression. Then we can't
replace 'expr' by a constant.
(b) 'expr' is a costant. According to ANSI, MIN/MAX must return
NULL if the query does not return any rows. Thus, if we are not
able to determine if the query returns any rows, we can't apply
the optimization and replace MIN/MAX with a constant.
*/
const_result= 0;
break;
}
((Item_sum_min*) item_sum)->reset();
if (!count)
{
/* If count != 1, then we know that is_exact_count == TRUE. */
((Item_sum_min*) item_sum)->clear(); /* Set to NULL. */
}
else
((Item_sum_min*) item_sum)->reset(); /* Set to the constant value. */
((Item_sum_min*) item_sum)->make_const();
recalc_const_item= 1;
break;
@ -282,13 +321,28 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
}
removed_tables|= table->map;
}
else if (!expr->const_item()) // This is VERY seldom false
else if (!expr->const_item() || !is_exact_count)
{
/*
The optimization is not applicable in both cases:
(a) 'expr' is a non-constant expression. Then we can't
replace 'expr' by a constant.
(b) 'expr' is a costant. According to ANSI, MIN/MAX must return
NULL if the query does not return any rows. Thus, if we are not
able to determine if the query returns any rows, we can't apply
the optimization and replace MIN/MAX with a constant.
*/
const_result= 0;
break;
}
((Item_sum_min*) item_sum)->reset();
((Item_sum_min*) item_sum)->make_const();
if (!count)
{
/* If count != 1, then we know that is_exact_count == TRUE. */
((Item_sum_max*) item_sum)->clear(); /* Set to NULL. */
}
else
((Item_sum_max*) item_sum)->reset(); /* Set to the constant value. */
((Item_sum_max*) item_sum)->make_const();
recalc_const_item= 1;
break;
}

View File

@ -150,30 +150,6 @@ public:
virtual bool store(Field *field);
};
class Protocol_cursor :public Protocol_simple
{
public:
MEM_ROOT *alloc;
MYSQL_FIELD *fields;
MYSQL_ROWS *data;
MYSQL_ROWS **prev_record;
ulong row_count;
Protocol_cursor() :data(NULL) {}
Protocol_cursor(THD *thd_arg, MEM_ROOT *ini_alloc) :Protocol_simple(thd_arg), alloc(ini_alloc), data(NULL) {}
bool prepare_for_send(List<Item> *item_list)
{
row_count= 0;
fields= NULL;
data= NULL;
prev_record= &data;
return Protocol_simple::prepare_for_send(item_list);
}
bool send_fields(List<Item> *list, uint flags);
bool write();
uint get_field_count() { return field_count; }
};
void send_warning(THD *thd, uint sql_errno, const char *err=0);
void net_printf_error(THD *thd, uint sql_errno, ...);
void net_send_error(THD *thd, uint sql_errno=0, const char *err=0);

View File

@ -5415,3 +5415,7 @@ ER_NO_SUCH_USER
eng "There is not %-.64s@%-.64s registered"
ER_FORBID_SCHEMA_CHANGE
eng "Changing schema from '%-.64s' to '%-.64s' is not allowed."
ER_ROW_IS_REFERENCED_2 23000
eng "Cannot delete or update a parent row: a foreign key constraint fails (%.192s)"
ER_NO_REFERENCED_ROW_2 23000
eng "Cannot add or update a child row: a foreign key constraint fails (%.192s)"

View File

@ -199,11 +199,18 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type,
Item *it= sp_prepare_func_item(thd, it_addr);
uint rsize;
Query_arena backup_arena;
Item *old_item_next, *old_free_list, **p_free_list;
DBUG_PRINT("info", ("type: %d", type));
if (!it)
{
DBUG_RETURN(NULL);
if (reuse)
{
old_item_next= reuse->next;
p_free_list= use_callers_arena ? &thd->spcont->callers_arena->free_list :
&thd->free_list;
old_free_list= *p_free_list;
}
switch (sp_map_result_type(type)) {
@ -312,15 +319,23 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type,
default:
DBUG_ASSERT(0);
}
it->rsize= rsize;
DBUG_RETURN(it);
goto end;
return_null_item:
CREATE_ON_CALLERS_ARENA(it= new(reuse, &rsize) Item_null(),
use_callers_arena, &backup_arena);
end:
it->rsize= rsize;
if (reuse && it == reuse)
{
/*
The Item constructor registered itself in the arena free list,
while the item slot is reused, so we have to restore the list.
*/
it->next= old_item_next;
*p_free_list= old_free_list;
}
DBUG_RETURN(it);
}
@ -1358,14 +1373,6 @@ int sp_head::execute_procedure(THD *thd, List<Item> *args)
uint offset= static_cast<Item_splocal *>(it)->get_offset();
Item *val= nctx->get_item(i);
Item *orig= octx->get_item(offset);
Item *o_item_next;
/* we'll use callers_arena in sp_eval_func_item */
Item *o_free_list= thd->spcont->callers_arena->free_list;
LINT_INIT(o_item_next);
if (orig)
o_item_next= orig->next;
/*
We might need to allocate new item if we weren't able to
@ -1380,15 +1387,6 @@ int sp_head::execute_procedure(THD *thd, List<Item> *args)
}
if (copy != orig)
octx->set_item(offset, copy);
if (orig && copy == orig)
{
/*
A reused item slot, where the constructor put it in the
free_list, so we have to restore the list.
*/
thd->spcont->callers_arena->free_list= o_free_list;
copy->next= o_item_next;
}
}
else
{
@ -2478,6 +2476,10 @@ sp_instr_cpop::backpatch(uint dest, sp_pcontext *dst_ctx)
int
sp_instr_copen::execute(THD *thd, uint *nextp)
{
/*
We don't store a pointer to the cursor in the instruction to be
able to reuse the same instruction among different threads in future.
*/
sp_cursor *c= thd->spcont->get_cursor(m_cursor);
int res;
DBUG_ENTER("sp_instr_copen::execute");
@ -2486,41 +2488,33 @@ sp_instr_copen::execute(THD *thd, uint *nextp)
res= -1;
else
{
sp_lex_keeper *lex_keeper= c->pre_open(thd);
if (!lex_keeper) // cursor already open or OOM
{
res= -1;
*nextp= m_ip+1;
}
else
{
Query_arena *old_arena= thd->stmt_arena;
sp_lex_keeper *lex_keeper= c->get_lex_keeper();
Query_arena *old_arena= thd->stmt_arena;
/*
Get the Query_arena from the cpush instruction, which contains
the free_list of the query, so new items (if any) are stored in
the right free_list, and we can cleanup after each open.
*/
thd->stmt_arena= c->get_instr();
res= lex_keeper->reset_lex_and_exec_core(thd, nextp, FALSE, this);
/* Cleanup the query's items */
if (thd->stmt_arena->free_list)
cleanup_items(thd->stmt_arena->free_list);
thd->stmt_arena= old_arena;
/*
Work around the fact that errors in selects are not returned properly
(but instead converted into a warning), so if a condition handler
caught, we have lost the result code.
*/
if (!res)
{
uint dummy1, dummy2;
/*
Get the Query_arena from the cpush instruction, which contains
the free_list of the query, so new items (if any) are stored in
the right free_list, and we can cleanup after each open.
*/
thd->stmt_arena= c->get_instr();
res= lex_keeper->reset_lex_and_exec_core(thd, nextp, FALSE, this);
/* Cleanup the query's items */
if (thd->stmt_arena->free_list)
cleanup_items(thd->stmt_arena->free_list);
thd->stmt_arena= old_arena;
/*
Work around the fact that errors in selects are not returned properly
(but instead converted into a warning), so if a condition handler
caught, we have lost the result code.
*/
if (!res)
{
uint dummy1, dummy2;
if (thd->spcont->found_handler(&dummy1, &dummy2))
res= -1;
}
c->post_open(thd, res ? FALSE : TRUE);
if (thd->spcont->found_handler(&dummy1, &dummy2))
res= -1;
}
/* TODO: Assert here that we either have an error or a cursor */
}
DBUG_RETURN(res);
}
@ -2529,7 +2523,8 @@ sp_instr_copen::execute(THD *thd, uint *nextp)
int
sp_instr_copen::exec_core(THD *thd, uint *nextp)
{
int res= mysql_execute_command(thd);
sp_cursor *c= thd->spcont->get_cursor(m_cursor);
int res= c->open(thd);
*nextp= m_ip+1;
return res;
}
@ -2584,14 +2579,7 @@ sp_instr_cfetch::execute(THD *thd, uint *nextp)
Query_arena backup_arena;
DBUG_ENTER("sp_instr_cfetch::execute");
if (! c)
res= -1;
else
{
thd->set_n_backup_active_arena(thd->spcont->callers_arena, &backup_arena);
res= c->fetch(thd, &m_varlist);
thd->restore_active_arena(thd->spcont->callers_arena, &backup_arena);
}
res= c ? c->fetch(thd, &m_varlist) : -1;
*nextp= m_ip+1;
DBUG_RETURN(res);

View File

@ -866,6 +866,12 @@ public:
virtual void print(String *str);
/*
This call is used to cleanup the instruction when a sensitive
cursor is closed. For now stored procedures always use materialized
cursors and the call is not used.
*/
virtual void cleanup_stmt() { /* no op */ }
private:
sp_lex_keeper m_lex_keeper;
@ -1036,4 +1042,7 @@ sp_add_to_query_tables(THD *thd, LEX *lex,
const char *db, const char *name,
thr_lock_type locktype);
Item *sp_eval_func_item(THD *thd, Item **it, enum_field_types type,
Item *reuse, bool use_callers_arena);
#endif /* _SP_HEAD_H_ */

View File

@ -25,6 +25,7 @@
#include "mysql.h"
#include "sp_head.h"
#include "sql_cursor.h"
#include "sp_rcontext.h"
#include "sp_pcontext.h"
@ -45,31 +46,18 @@ int
sp_rcontext::set_item_eval(THD *thd, uint idx, Item **item_addr,
enum_field_types type)
{
extern Item *sp_eval_func_item(THD *thd, Item **it, enum_field_types type,
Item *reuse, bool use_callers_arena);
Item *it;
Item *reuse_it;
Item *old_item_next;
/* sp_eval_func_item will use callers_arena */
Item *old_free_list= thd->spcont->callers_arena->free_list;
int res;
LINT_INIT(old_item_next);
if ((reuse_it= get_item(idx)))
old_item_next= reuse_it->next;
reuse_it= get_item(idx);
it= sp_eval_func_item(thd, item_addr, type, reuse_it, TRUE);
if (! it)
res= -1;
else
{
res= 0;
if (reuse_it && it == reuse_it)
{
// A reused item slot, where the constructor put it in the free_list,
// so we have to restore the list.
thd->spcont->callers_arena->free_list= old_free_list;
it->next= old_item_next;
}
set_item(idx, it);
}
@ -170,7 +158,8 @@ sp_rcontext::pop_cursors(uint count)
*/
sp_cursor::sp_cursor(sp_lex_keeper *lex_keeper, sp_instr_cpush *i)
:m_lex_keeper(lex_keeper), m_prot(NULL), m_isopen(0), m_current_row(NULL),
:m_lex_keeper(lex_keeper),
server_side_cursor(NULL),
m_i(i)
{
/*
@ -182,59 +171,37 @@ sp_cursor::sp_cursor(sp_lex_keeper *lex_keeper, sp_instr_cpush *i)
/*
pre_open cursor
Open an SP cursor
SYNOPSIS
pre_open()
THD Thread handler
open()
THD Thread handler
NOTES
We have to open cursor in two steps to make it easy for sp_instr_copen
to reuse the sp_instr::exec_stmt() code.
If this function returns 0, post_open should not be called
RETURN
0 ERROR
0 in case of success, -1 otherwise
*/
sp_lex_keeper*
sp_cursor::pre_open(THD *thd)
int
sp_cursor::open(THD *thd)
{
if (m_isopen)
if (server_side_cursor)
{
my_message(ER_SP_CURSOR_ALREADY_OPEN, ER(ER_SP_CURSOR_ALREADY_OPEN),
MYF(0));
return NULL;
return -1;
}
init_alloc_root(&m_mem_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC);
if ((m_prot= new Protocol_cursor(thd, &m_mem_root)) == NULL)
return NULL;
/* Save for execution. Will be restored in post_open */
m_oprot= thd->protocol;
m_nseof= thd->net.no_send_eof;
/* Change protocol for execution */
thd->protocol= m_prot;
thd->net.no_send_eof= TRUE;
return m_lex_keeper;
}
void
sp_cursor::post_open(THD *thd, my_bool was_opened)
{
thd->net.no_send_eof= m_nseof; // Restore the originals
thd->protocol= m_oprot;
if ((m_isopen= was_opened))
m_current_row= m_prot->data;
if (mysql_open_cursor(thd, (uint) ALWAYS_MATERIALIZED_CURSOR, &result,
&server_side_cursor))
return -1;
return 0;
}
int
sp_cursor::close(THD *thd)
{
if (! m_isopen)
if (! server_side_cursor)
{
my_message(ER_SP_CURSOR_NOT_OPEN, ER(ER_SP_CURSOR_NOT_OPEN), MYF(0));
return -1;
@ -247,106 +214,82 @@ sp_cursor::close(THD *thd)
void
sp_cursor::destroy()
{
if (m_prot)
{
delete m_prot;
m_prot= NULL;
free_root(&m_mem_root, MYF(0));
}
m_isopen= FALSE;
delete server_side_cursor;
server_side_cursor= 0;
}
int
sp_cursor::fetch(THD *thd, List<struct sp_pvar> *vars)
{
List_iterator_fast<struct sp_pvar> li(*vars);
sp_pvar_t *pv;
MYSQL_ROW row;
uint fldcount;
if (! m_isopen)
if (! server_side_cursor)
{
my_message(ER_SP_CURSOR_NOT_OPEN, ER(ER_SP_CURSOR_NOT_OPEN), MYF(0));
return -1;
}
if (m_current_row == NULL)
{
my_message(ER_SP_FETCH_NO_DATA, ER(ER_SP_FETCH_NO_DATA), MYF(0));
return -1;
}
row= m_current_row->data;
for (fldcount= 0 ; (pv= li++) ; fldcount++)
{
Item *it;
Item *reuse;
uint rsize;
Item *old_item_next;
Item *old_free_list= thd->free_list;
const char *s;
LINT_INIT(old_item_next);
if (fldcount >= m_prot->get_field_count())
{
my_message(ER_SP_WRONG_NO_OF_FETCH_ARGS,
ER(ER_SP_WRONG_NO_OF_FETCH_ARGS), MYF(0));
return -1;
}
if ((reuse= thd->spcont->get_item(pv->offset)))
old_item_next= reuse->next;
s= row[fldcount];
if (!s)
it= new(reuse, &rsize) Item_null();
else
{
/*
Length of data can be calculated as:
pointer_to_next_not_null_object - s -1
where the last -1 is to remove the end \0
*/
uint len;
MYSQL_ROW next= row+fldcount+1;
while (!*next) // Skip nulls
next++;
len= (*next -s)-1;
switch (sp_map_result_type(pv->type)) {
case INT_RESULT:
it= new(reuse, &rsize) Item_int(s);
break;
case REAL_RESULT:
it= new(reuse, &rsize) Item_float(s, len);
break;
case DECIMAL_RESULT:
it= new(reuse, &rsize) Item_decimal(s, len, thd->db_charset);
break;
case STRING_RESULT:
/* TODO: Document why we do an extra copy of the string 's' here */
it= new(reuse, &rsize) Item_string(thd->strmake(s, len), len,
thd->db_charset);
break;
case ROW_RESULT:
default:
DBUG_ASSERT(0);
}
}
it->rsize= rsize;
if (reuse && it == reuse)
{
// A reused item slot, where the constructor put it in the free_list,
// so we have to restore the list.
thd->free_list= old_free_list;
it->next= old_item_next;
}
thd->spcont->set_item(pv->offset, it);
}
if (fldcount < m_prot->get_field_count())
if (vars->elements != result.get_field_count())
{
my_message(ER_SP_WRONG_NO_OF_FETCH_ARGS,
ER(ER_SP_WRONG_NO_OF_FETCH_ARGS), MYF(0));
return -1;
}
m_current_row= m_current_row->next;
result.set_spvar_list(vars);
/* Attempt to fetch one row */
if (server_side_cursor->is_open())
server_side_cursor->fetch(1);
/*
If the cursor was pointing after the last row, the fetch will
close it instead of sending any rows.
*/
if (! server_side_cursor->is_open())
{
my_message(ER_SP_FETCH_NO_DATA, ER(ER_SP_FETCH_NO_DATA), MYF(0));
return -1;
}
return 0;
}
/***************************************************************************
Select_fetch_into_spvars
****************************************************************************/
int Select_fetch_into_spvars::prepare(List<Item> &fields, SELECT_LEX_UNIT *u)
{
/*
Cache the number of columns in the result set in order to easily
return an error if column count does not match value count.
*/
field_count= fields.elements;
return select_result_interceptor::prepare(fields, u);
}
bool Select_fetch_into_spvars::send_data(List<Item> &items)
{
List_iterator_fast<struct sp_pvar> pv_iter(*spvar_list);
List_iterator_fast<Item> item_iter(items);
sp_pvar_t *pv;
Item *item;
/* Must be ensured by the caller */
DBUG_ASSERT(spvar_list->elements == items.elements);
/*
Assign the row fetched from a server side cursor to stored
procedure variables.
*/
for (; pv= pv_iter++, item= item_iter++; )
{
Item *reuse= thd->spcont->get_item(pv->offset);
/* Evaluate a new item on the arena of the calling instruction */
Item *it= sp_eval_func_item(thd, &item, pv->type, reuse, TRUE);
thd->spcont->set_item(pv->offset, it);
}
return FALSE;
}

View File

@ -216,6 +216,27 @@ private:
}; // class sp_rcontext : public Sql_alloc
/*
An interceptor of cursor result set used to implement
FETCH <cname> INTO <varlist>.
*/
class Select_fetch_into_spvars: public select_result_interceptor
{
List<struct sp_pvar> *spvar_list;
uint field_count;
public:
uint get_field_count() { return field_count; }
void set_spvar_list(List<struct sp_pvar> *vars) { spvar_list= vars; }
virtual bool send_eof() { return FALSE; }
virtual bool send_data(List<Item> &items);
virtual int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
};
/* A mediator between stored procedures and server side cursors */
class sp_cursor : public Sql_alloc
{
public:
@ -227,12 +248,11 @@ public:
destroy();
}
// We have split this in two to make it easy for sp_instr_copen
// to reuse the sp_instr::exec_stmt() code.
sp_lex_keeper *
pre_open(THD *thd);
void
post_open(THD *thd, my_bool was_opened);
get_lex_keeper() { return m_lex_keeper; }
int
open(THD *thd);
int
close(THD *thd);
@ -240,7 +260,7 @@ public:
inline my_bool
is_open()
{
return m_isopen;
return test(server_side_cursor);
}
int
@ -251,18 +271,13 @@ public:
{
return m_i;
}
private:
MEM_ROOT m_mem_root; // My own mem_root
Select_fetch_into_spvars result;
sp_lex_keeper *m_lex_keeper;
Protocol_cursor *m_prot;
my_bool m_isopen;
my_bool m_nseof; // Original no_send_eof
Protocol *m_oprot; // Original protcol
MYSQL_ROWS *m_current_row;
Server_side_cursor *server_side_cursor;
sp_instr_cpush *m_i; // My push instruction
void
destroy();

View File

@ -1488,7 +1488,7 @@ bool is_acl_user(const char *host, const char *user)
{
bool res;
VOID(pthread_mutex_lock(&acl_cache->lock));
res= find_acl_user(host, user, TRUE);
res= find_acl_user(host, user, TRUE) != NULL;
VOID(pthread_mutex_unlock(&acl_cache->lock));
return res;
}

View File

@ -1327,6 +1327,8 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
table->keys_in_use_for_query= table->s->keys_in_use;
table->insert_values= 0;
table->used_keys= table->s->keys_for_keyread;
table->fulltext_searched= 0;
table->file->ft_handler= 0;
if (table->timestamp_field)
table->timestamp_field_type= table->timestamp_field->get_auto_set_type();
table_list->updatable= 1; // It is not derived table nor non-updatable VIEW

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