summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore1
-rw-r--r--VC++Files/client/mysqldump.vcproj27
-rw-r--r--VC++Files/client/mysqlslap.vcproj4
-rw-r--r--VC++Files/mysql.sln28
-rw-r--r--VC++Files/sql/mysqld.vcproj543
-rw-r--r--client/mysqltest.c473
-rw-r--r--mysql-test/r/mysqltest.result19
-rw-r--r--mysql-test/t/mysqltest.test27
-rw-r--r--scripts/make_win_src_distribution.sh2
-rw-r--r--sql/event.h2
-rw-r--r--sql/event_executor.cc2
-rw-r--r--sql/event_timed.cc2
-rw-r--r--sql/ha_archive.cc2
-rw-r--r--sql/handler.h2
-rw-r--r--sql/opt_range.cc4
-rw-r--r--sql/set_var.cc4
-rw-r--r--sql/sql_partition.cc8
-rw-r--r--storage/ndb/src/kernel/blocks/backup/Backup.cpp48
-rw-r--r--storage/ndb/src/kernel/blocks/backup/Backup.hpp7
-rw-r--r--storage/ndb/src/kernel/blocks/backup/BackupInit.cpp2
20 files changed, 1124 insertions, 83 deletions
diff --git a/.bzrignore b/.bzrignore
index dd2a5d4530a..16211ff2ecf 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -1611,3 +1611,4 @@ vio/viotest-sslconnect.cpp
vio/viotest.cpp
zlib/*.ds?
zlib/*.vcproj
+BitKeeper/etc/RESYNC_TREE
diff --git a/VC++Files/client/mysqldump.vcproj b/VC++Files/client/mysqldump.vcproj
index b6a33596083..3585374eea5 100644
--- a/VC++Files/client/mysqldump.vcproj
+++ b/VC++Files/client/mysqldump.vcproj
@@ -226,6 +226,33 @@
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
+ <File
+ RelativePath="..\sql-common\my_user.c">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="classic|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
</Files>
<Globals>
</Globals>
diff --git a/VC++Files/client/mysqlslap.vcproj b/VC++Files/client/mysqlslap.vcproj
index ff0d9a437ed..072c7957f11 100644
--- a/VC++Files/client/mysqlslap.vcproj
+++ b/VC++Files/client/mysqlslap.vcproj
@@ -40,7 +40,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="wsock32.lib odbc32.lib odbccp32.lib mysqlclient.lib mysys.lib"
+ AdditionalDependencies="wsock32.lib odbc32.lib odbccp32.lib"
OutputFile="../client_release/mysqlslap.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
@@ -102,7 +102,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="wsock32.lib odbc32.lib odbccp32.lib mysqlclient.lib mysys.lib"
+ AdditionalDependencies="wsock32.lib odbc32.lib odbccp32.lib"
OutputFile="../client_classic/mysqlslap.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
diff --git a/VC++Files/mysql.sln b/VC++Files/mysql.sln
index 44409aff48c..afe09897ace 100644
--- a/VC++Files/mysql.sln
+++ b/VC++Files/mysql.sln
@@ -1048,8 +1048,8 @@ Global
{44D9C7DC-6636-4B82-BD01-6876C64017DF}.classic.Build.0 = TLS|Win32
{44D9C7DC-6636-4B82-BD01-6876C64017DF}.classic nt.ActiveCfg = TLS|Win32
{44D9C7DC-6636-4B82-BD01-6876C64017DF}.classic nt.Build.0 = TLS|Win32
- {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Debug.ActiveCfg = TLS_DEBUG|Win32
- {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Debug.Build.0 = TLS_DEBUG|Win32
+ {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Debug.ActiveCfg = Debug|Win32
+ {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Debug.Build.0 = Debug|Win32
{44D9C7DC-6636-4B82-BD01-6876C64017DF}.Embedded_Classic.ActiveCfg = Release|Win32
{44D9C7DC-6636-4B82-BD01-6876C64017DF}.Embedded_Classic.Build.0 = Release|Win32
{44D9C7DC-6636-4B82-BD01-6876C64017DF}.Embedded_Debug.ActiveCfg = Debug|Win32
@@ -1060,10 +1060,10 @@ Global
{44D9C7DC-6636-4B82-BD01-6876C64017DF}.Embedded_ProGPL.Build.0 = Release|Win32
{44D9C7DC-6636-4B82-BD01-6876C64017DF}.Embedded_Release.ActiveCfg = Release|Win32
{44D9C7DC-6636-4B82-BD01-6876C64017DF}.Embedded_Release.Build.0 = Release|Win32
- {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Max.ActiveCfg = TLS|Win32
- {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Max.Build.0 = TLS|Win32
- {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Max nt.ActiveCfg = TLS|Win32
- {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Max nt.Build.0 = TLS|Win32
+ {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Max.ActiveCfg = Max|Win32
+ {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Max.Build.0 = Max|Win32
+ {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Max nt.ActiveCfg = Max|Win32
+ {44D9C7DC-6636-4B82-BD01-6876C64017DF}.Max nt.Build.0 = Max|Win32
{44D9C7DC-6636-4B82-BD01-6876C64017DF}.nt.ActiveCfg = TLS|Win32
{44D9C7DC-6636-4B82-BD01-6876C64017DF}.nt.Build.0 = TLS|Win32
{44D9C7DC-6636-4B82-BD01-6876C64017DF}.pro.ActiveCfg = TLS|Win32
@@ -1542,10 +1542,10 @@ Global
{13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Embedded_ProGPL.Build.0 = Release|Win32
{13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Embedded_Release.ActiveCfg = Release|Win32
{13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Embedded_Release.Build.0 = Release|Win32
- {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Max.ActiveCfg = TLS|Win32
- {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Max.Build.0 = TLS|Win32
- {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Max nt.ActiveCfg = TLS|Win32
- {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Max nt.Build.0 = TLS|Win32
+ {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Max.ActiveCfg = Release|Win32
+ {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Max.Build.0 = Release|Win32
+ {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Max nt.ActiveCfg = Release|Win32
+ {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.Max nt.Build.0 = Release|Win32
{13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.nt.ActiveCfg = TLS|Win32
{13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.nt.Build.0 = TLS|Win32
{13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}.pro.ActiveCfg = TLS|Win32
@@ -1686,10 +1686,10 @@ Global
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.Embedded_ProGPL.Build.0 = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.Embedded_Release.ActiveCfg = Release|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.Embedded_Release.Build.0 = Release|Win32
- {2E9332CF-072A-4381-BF37-17C5AB4F8583}.Max.ActiveCfg = Debug|Win32
- {2E9332CF-072A-4381-BF37-17C5AB4F8583}.Max.Build.0 = Debug|Win32
- {2E9332CF-072A-4381-BF37-17C5AB4F8583}.Max nt.ActiveCfg = Debug|Win32
- {2E9332CF-072A-4381-BF37-17C5AB4F8583}.Max nt.Build.0 = Debug|Win32
+ {2E9332CF-072A-4381-BF37-17C5AB4F8583}.Max.ActiveCfg = Release|Win32
+ {2E9332CF-072A-4381-BF37-17C5AB4F8583}.Max.Build.0 = Release|Win32
+ {2E9332CF-072A-4381-BF37-17C5AB4F8583}.Max nt.ActiveCfg = Release|Win32
+ {2E9332CF-072A-4381-BF37-17C5AB4F8583}.Max nt.Build.0 = Release|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.nt.ActiveCfg = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.nt.Build.0 = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.pro.ActiveCfg = Debug|Win32
diff --git a/VC++Files/sql/mysqld.vcproj b/VC++Files/sql/mysqld.vcproj
index 6002fb5d815..a9e05a5aaa7 100644
--- a/VC++Files/sql/mysqld.vcproj
+++ b/VC++Files/sql/mysqld.vcproj
@@ -25,7 +25,7 @@
InlineFunctionExpansion="1"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include"
- PreprocessorDefinitions="__NT__;DBUG_OFF;NDEBUG;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;LICENSE=Commercial"
+ PreprocessorDefinitions="__NT__;DBUG_OFF;NDEBUG;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;LICENSE=Commercial;HAVE_ROW_BASED_REPLICATION"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
@@ -212,7 +212,7 @@
InlineFunctionExpansion="1"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include"
- PreprocessorDefinitions="__NT__;DBUG_OFF;NDEBUG;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;WITH_INNOBASE_STORAGE_ENGINE;WITH_ARCHIVE_STORAGE_ENGINE"
+ PreprocessorDefinitions="__NT__;DBUG_OFF;NDEBUG;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;WITH_INNOBASE_STORAGE_ENGINE;WITH_ARCHIVE_STORAGE_ENGINE;HAVE_ROW_BASED_REPLICATION"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
@@ -276,7 +276,7 @@
InlineFunctionExpansion="1"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include"
- PreprocessorDefinitions="__NT__;DBUG_OFF;NDEBUG;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;MYSQL_SERVER;LICENSE=Commercial;_WINDOWS;_CONSOLE;HAVE_DLOPEN;WITH_INNOBASE_STORAGE_ENGINE"
+ PreprocessorDefinitions="__NT__;DBUG_OFF;NDEBUG;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;MYSQL_SERVER;LICENSE=Commercial;_WINDOWS;_CONSOLE;HAVE_DLOPEN;WITH_INNOBASE_STORAGE_ENGINE;HAVE_ROW_BASED_REPLICATION"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
@@ -398,7 +398,7 @@
InlineFunctionExpansion="1"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include"
- PreprocessorDefinitions="MYSQL_SERVER;LICENSE=Commercial;HAVE_DLOPEN;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;WITH_INNOBASE_STORAGE_ENGINE;WITH_ARCHIVE_STORAGE_ENGINE"
+ PreprocessorDefinitions="MYSQL_SERVER;LICENSE=Commercial;HAVE_DLOPEN;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;WITH_INNOBASE_STORAGE_ENGINE;WITH_ARCHIVE_STORAGE_ENGINE;HAVE_ROW_BASED_REPLICATION"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
@@ -460,7 +460,7 @@
InlineFunctionExpansion="1"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="../include,../regex,../zlib,../extra/yassl/include"
- PreprocessorDefinitions="LICENSE=Commercial;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;DBUG_OFF;NDEBUG"
+ PreprocessorDefinitions="LICENSE=Commercial;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;DBUG_OFF;NDEBUG;HAVE_ROW_BASED_REPLICATION"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
@@ -521,7 +521,7 @@
InlineFunctionExpansion="1"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="../zlib,../include,../regex,../extra/yassl/include"
- PreprocessorDefinitions="NDEBUG;DBUG_OFF;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;WITH_INNOBASE_STORAGE_ENGINE;WITH_ARCHIVE_STORAGE_ENGINE"
+ PreprocessorDefinitions="NDEBUG;DBUG_OFF;HAVE_INNOBASE_DB;HAVE_ARCHIVE_DB;MYSQL_SERVER;_WINDOWS;_CONSOLE;HAVE_DLOPEN;WITH_INNOBASE_STORAGE_ENGINE;WITH_ARCHIVE_STORAGE_ENGINE;HAVE_ROW_BASED_REPLICATION"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
@@ -3925,6 +3925,81 @@
</FileConfiguration>
</File>
<File
+ RelativePath="my_user.c">
+ <FileConfiguration
+ Name="classic nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Max|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Max nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="pro nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="pro|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="classic|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\storage\myisammrg\myrg_rnext_same.c">
<FileConfiguration
Name="classic nt|Win32">
@@ -9137,6 +9212,462 @@
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
+ <File
+ RelativePath="rpl_injector.cpp">
+ <FileConfiguration
+ Name="classic nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Max|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Max nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="pro nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ OptimizeForProcessor="1"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="pro|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="classic|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="my_user.c">
+ <FileConfiguration
+ Name="classic nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Max|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Max nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="pro nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ OptimizeForProcessor="1"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="pro|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="classic|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="event_executor.cpp">
+ <FileConfiguration
+ Name="classic nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Max|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Max nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="pro nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ OptimizeForProcessor="1"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="pro|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="classic|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="event.cpp">
+ <FileConfiguration
+ Name="classic nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Max|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Max nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="pro nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ OptimizeForProcessor="1"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="pro|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="classic|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="event_timed.cpp">
+ <FileConfiguration
+ Name="classic nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Max|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Max nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="pro nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ OptimizeForProcessor="1"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="pro|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="classic|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sql_tablespace.cpp">
+ <FileConfiguration
+ Name="classic nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Max|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Max nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="pro nt|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ OptimizeForProcessor="1"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="pro|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="classic|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
</Files>
<Globals>
</Globals>
diff --git a/client/mysqltest.c b/client/mysqltest.c
index acd0fc98ac0..2beef73d568 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -187,6 +187,35 @@ static test_file* cur_file;
static test_file* file_stack_end;
uint start_lineno; /* Start line of query */
+/* Stores regex substitutions */
+
+struct st_regex
+{
+ char* pattern; /* Pattern to be replaced */
+ char* replace; /* String or expression to replace the pattern with */
+ int icase; /* true if the match is case insensitive */
+};
+
+struct st_replace_regex
+{
+ DYNAMIC_ARRAY regex_arr; /* stores a list of st_regex subsitutions */
+
+ /*
+ Temporary storage areas for substitutions. To reduce unnessary copying
+ and memory freeing/allocation, we pre-allocate two buffers, and alternate
+ their use, one for input/one for output, the roles changing on the next
+ st_regex substition. At the end of substitutions buf points to the
+ one containing the final result.
+ */
+ char* buf;
+ char* even_buf;
+ uint even_buf_len;
+ char* odd_buf;
+ uint odd_buf_len;
+};
+
+struct st_replace_regex *glob_replace_regex= 0;
+
static char TMPDIR[FN_REFLEN];
static char delimiter[MAX_DELIMITER]= DEFAULT_DELIMITER;
static uint delimiter_length= 1;
@@ -226,6 +255,9 @@ static void init_re(void);
static int match_re(my_regex_t *, char *);
static void free_re(void);
+static int reg_replace(char** buf_p, int* buf_len_p, char *pattern, char *replace,
+ char *string, int icase);
+
static const char *embedded_server_groups[]=
{
"server",
@@ -336,6 +368,7 @@ Q_EXIT,
Q_DISABLE_RECONNECT, Q_ENABLE_RECONNECT,
Q_IF,
Q_DISABLE_PARSING, Q_ENABLE_PARSING,
+Q_REPLACE_REGEX,
Q_UNKNOWN, /* Unknown command. */
Q_COMMENT, /* Comments, ignored. */
@@ -429,6 +462,7 @@ const char *command_names[]=
"if",
"disable_parsing",
"enable_parsing",
+ "replace_regex",
0
};
@@ -469,6 +503,7 @@ struct st_replace *init_replace(my_string *from, my_string *to, uint count,
uint replace_strings(struct st_replace *rep, my_string *start,
uint *max_length, const char *from);
void free_replace();
+static void free_replace_regex();
static int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name);
void free_pointer_array(POINTER_ARRAY *pa);
static int initialize_replace_buffer(void);
@@ -1927,6 +1962,204 @@ static char *get_string(char **to_ptr, char **from_ptr,
DBUG_RETURN(start);
}
+/*
+ Finds the next (non-escaped) '/' in the expression.
+ (If the character '/' is needed, it can be escaped using '\'.)
+*/
+
+#define PARSE_REGEX_ARG \
+ while (p < expr_end) \
+ {\
+ char c= *p;\
+ if (c == '/')\
+ {\
+ if (last_c == '\\')\
+ {\
+ buf_p[-1]= '/';\
+ }\
+ else\
+ {\
+ *buf_p++ = 0;\
+ break;\
+ } \
+ } \
+ else\
+ *buf_p++ = c;\
+ \
+ last_c= c;\
+ p++;\
+ } \
+
+/*
+ Initializes the regular substitution expression to be used in the
+ result output of test.
+
+ Returns: st_replace_regex struct with pairs of substitutions
+*/
+
+static struct st_replace_regex* init_replace_regex(char* expr)
+{
+ struct st_replace_regex* res;
+ char* buf,*expr_end;
+ char* p;
+ char* buf_p;
+ uint expr_len= strlen(expr);
+ char last_c = 0;
+ struct st_regex reg;
+
+ /* my_malloc() will die on fail with MY_FAE */
+ res=(struct st_replace_regex*)my_malloc(
+ sizeof(*res)+expr_len ,MYF(MY_FAE+MY_WME));
+ my_init_dynamic_array(&res->regex_arr,sizeof(struct st_regex),128,128);
+
+ buf= (char*)res + sizeof(*res);
+ expr_end= expr + expr_len;
+ p= expr;
+ buf_p= buf;
+
+ /* for each regexp substitution statement */
+ while (p < expr_end)
+ {
+ bzero(&reg,sizeof(reg));
+ /* find the start of the statement */
+ while (p < expr_end)
+ {
+ if (*p == '/')
+ break;
+ p++;
+ }
+
+ if (p == expr_end || ++p == expr_end)
+ {
+ if (res->regex_arr.elements)
+ break;
+ else
+ goto err;
+ }
+ /* we found the start */
+ reg.pattern= buf_p;
+
+ /* Find first argument -- pattern string to be removed */
+ PARSE_REGEX_ARG
+
+ if (p == expr_end || ++p == expr_end)
+ goto err;
+
+ /* buf_p now points to the replacement pattern terminated with \0 */
+ reg.replace= buf_p;
+
+ /* Find second argument -- replace string to replace pattern */
+ PARSE_REGEX_ARG
+
+ if (p == expr_end)
+ goto err;
+
+ /* skip the ending '/' in the statement */
+ p++;
+
+ /* Check if we should do matching case insensitive */
+ if (p < expr_end && *p == 'i')
+ reg.icase= 1;
+
+ /* done parsing the statement, now place it in regex_arr */
+ if (insert_dynamic(&res->regex_arr,(gptr) &reg))
+ die("Out of memory");
+ }
+ res->odd_buf_len= res->even_buf_len= 8192;
+ res->even_buf= (char*)my_malloc(res->even_buf_len,MYF(MY_WME+MY_FAE));
+ res->odd_buf= (char*)my_malloc(res->odd_buf_len,MYF(MY_WME+MY_FAE));
+ res->buf= res->even_buf;
+
+ return res;
+
+err:
+ my_free((gptr)res,0);
+ die("Error parsing replace_regex \"%s\"", expr);
+ return 0;
+}
+
+/*
+ Execute all substitutions on val.
+
+ Returns: true if substituition was made, false otherwise
+ Side-effect: Sets r->buf to be the buffer with all substitutions done.
+
+ IN:
+ struct st_replace_regex* r
+ char* val
+ Out:
+ struct st_replace_regex* r
+ r->buf points at the resulting buffer
+ r->even_buf and r->odd_buf might have been reallocated
+ r->even_buf_len and r->odd_buf_len might have been changed
+
+ TODO: at some point figure out if there is a way to do everything
+ in one pass
+*/
+
+static int multi_reg_replace(struct st_replace_regex* r,char* val)
+{
+ uint i;
+ char* in_buf, *out_buf;
+ int* buf_len_p;
+
+ in_buf= val;
+ out_buf= r->even_buf;
+ buf_len_p= &r->even_buf_len;
+ r->buf= 0;
+
+ /* For each substitution, do the replace */
+ for (i= 0; i < r->regex_arr.elements; i++)
+ {
+ struct st_regex re;
+ char* save_out_buf= out_buf;
+
+ get_dynamic(&r->regex_arr,(gptr)&re,i);
+
+ if (!reg_replace(&out_buf, buf_len_p, re.pattern, re.replace,
+ in_buf, re.icase))
+ {
+ /* if the buffer has been reallocated, make adjustements */
+ if (save_out_buf != out_buf)
+ {
+ if (save_out_buf == r->even_buf)
+ r->even_buf= out_buf;
+ else
+ r->odd_buf= out_buf;
+ }
+
+ r->buf= out_buf;
+ if (in_buf == val)
+ in_buf= r->odd_buf;
+
+ swap_variables(char*,in_buf,out_buf);
+
+ buf_len_p= (out_buf == r->even_buf) ? &r->even_buf_len :
+ &r->odd_buf_len;
+ }
+ }
+
+ return (r->buf == 0);
+}
+
+/*
+ Parse the regular expression to be used in all result files
+ from now on.
+
+ The syntax is --replace_regex /from/to/i /from/to/i ...
+ i means case-insensitive match. If omitted, the match is
+ case-sensitive
+
+*/
+static void get_replace_regex(struct st_query *q)
+{
+ char *expr= q->first_argument;
+ free_replace_regex();
+ if (!(glob_replace_regex=init_replace_regex(expr)))
+ die("Could not init replace_regex");
+ q->last_argument= q->end;
+}
+
/*
Get arguments for replace. The syntax is:
@@ -1979,6 +2212,18 @@ static void get_replace(struct st_query *q)
DBUG_VOID_RETURN;
}
+static void free_replace_regex()
+{
+ if (glob_replace_regex)
+ {
+ my_free(glob_replace_regex->even_buf,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(glob_replace_regex->odd_buf,MYF(MY_ALLOW_ZERO_PTR));
+ my_free((char*) glob_replace_regex,MYF(0));
+ glob_replace_regex=0;
+ }
+}
+
+
void free_replace()
{
DBUG_ENTER("free_replace");
@@ -2277,6 +2522,7 @@ int connect_n_handle_errors(struct st_query *q, MYSQL* con, const char* host,
err:
free_replace();
+ free_replace_regex();
return error;
}
@@ -3126,6 +3372,214 @@ void dump_result_to_reject_file(const char *record_file, char *buf, int size)
str_to_file(fn_format(reject_file, record_file,"",".reject",2), buf, size);
}
+static void check_regerr(my_regex_t* r, int err)
+{
+ char err_buf[1024];
+
+ if (err)
+ {
+ my_regerror(err,r,err_buf,sizeof(err_buf));
+ die("Regex error: %s\n", err_buf);
+ }
+}
+
+/*
+ auxiluary macro used by reg_replace
+ makes sure the result buffer has sufficient length
+*/
+#define SECURE_REG_BUF if (buf_len < need_buf_len)\
+ {\
+ int off= res_p - buf;\
+ buf= (char*)my_realloc(buf,need_buf_len,MYF(MY_WME+MY_FAE));\
+ res_p= buf + off;\
+ buf_len= need_buf_len;\
+ }\
+
+/*
+ Performs a regex substitution
+
+ IN:
+
+ buf_p - result buffer pointer. Will change if reallocated
+ buf_len_p - result buffer length. Will change if the buffer is reallocated
+ pattern - regexp pattern to match
+ replace - replacement expression
+ string - the string to perform substituions in
+ icase - flag, if set to 1 the match is case insensitive
+ */
+static int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
+ char *replace, char *string, int icase)
+{
+ my_regex_t r;
+ my_regmatch_t* subs;
+ char* buf_end, *replace_end;
+ char* buf= *buf_p;
+ int len;
+ int buf_len,need_buf_len;
+ int cflags= REG_EXTENDED;
+ int err_code;
+ char* res_p,*str_p,*str_end;
+
+ buf_len= *buf_len_p;
+ len= strlen(string);
+ str_end= string + len;
+
+ /* start with a buffer of a reasonable size that hopefully will not
+ need to be reallocated
+ */
+ need_buf_len= len * 2 + 1;
+ res_p= buf;
+
+ SECURE_REG_BUF
+
+ buf_end = buf + buf_len;
+
+ if (icase)
+ cflags |= REG_ICASE;
+
+ if ((err_code=my_regcomp(&r,pattern,cflags,&my_charset_latin1)))
+ {
+ check_regerr(&r,err_code);
+ return 1;
+ }
+
+ subs= (my_regmatch_t*)my_malloc(sizeof(my_regmatch_t) * (r.re_nsub+1),
+ MYF(MY_WME+MY_FAE));
+
+ *res_p= 0;
+ str_p= string;
+ replace_end= replace + strlen(replace);
+
+ /* for each pattern match instance perform a replacement */
+ while (!err_code)
+ {
+ /* find the match */
+ err_code= my_regexec(&r,str_p, r.re_nsub+1, subs,
+ (str_p == string) ? REG_NOTBOL : 0);
+
+ /* if regular expression error (eg. bad syntax, or out of memory) */
+ if (err_code && err_code != REG_NOMATCH)
+ {
+ check_regerr(&r,err_code);
+ my_regfree(&r);
+ return 1;
+ }
+
+ /* if match found */
+ if (!err_code)
+ {
+ char* expr_p= replace;
+ int c;
+
+ /*
+ we need at least what we have so far in the buffer + the part
+ before this match
+ */
+ need_buf_len= (res_p - buf) + subs[0].rm_so;
+
+ /* on this pass, calculate the memory for the result buffer */
+ while (expr_p < replace_end)
+ {
+ int back_ref_num= -1;
+ c= *expr_p;
+
+ if (c == '\\' && expr_p + 1 < replace_end)
+ {
+ back_ref_num= expr_p[1] - '0';
+ }
+
+ /* found a valid back_ref (eg. \1)*/
+ if (back_ref_num >= 0 && back_ref_num <= (int)r.re_nsub)
+ {
+ int start_off,end_off;
+ if ((start_off=subs[back_ref_num].rm_so) > -1 &&
+ (end_off=subs[back_ref_num].rm_eo) > -1)
+ {
+ need_buf_len += (end_off - start_off);
+ }
+ expr_p += 2;
+ }
+ else
+ {
+ expr_p++;
+ need_buf_len++;
+ }
+ }
+ need_buf_len++;
+ /*
+ now that we know the size of the buffer,
+ make sure it is big enough
+ */
+ SECURE_REG_BUF
+
+ /* copy the pre-match part */
+ if (subs[0].rm_so)
+ {
+ memcpy(res_p,str_p,subs[0].rm_so);
+ res_p += subs[0].rm_so;
+ }
+
+ expr_p= replace;
+
+ /* copy the match and expand back_refs */
+ while (expr_p < replace_end)
+ {
+ int back_ref_num= -1;
+ c= *expr_p;
+
+ if (c == '\\' && expr_p + 1 < replace_end)
+ {
+ back_ref_num= expr_p[1] - '0';
+ }
+
+ if (back_ref_num >= 0 && back_ref_num <= (int)r.re_nsub)
+ {
+ int start_off,end_off;
+ if ((start_off=subs[back_ref_num].rm_so) > -1 &&
+ (end_off=subs[back_ref_num].rm_eo) > -1)
+ {
+ int block_len= end_off - start_off;
+ memcpy(res_p,str_p + start_off, block_len);
+ res_p += block_len;
+ }
+ expr_p += 2;
+ }
+ else
+ {
+ *res_p++ = *expr_p++;
+ }
+ }
+
+ /* handle the post-match part */
+ if (subs[0].rm_so == subs[0].rm_eo)
+ {
+ if (str_p + subs[0].rm_so >= str_end)
+ break;
+ str_p += subs[0].rm_eo ;
+ *res_p++ = *str_p++;
+ }
+ else
+ {
+ str_p += subs[0].rm_eo;
+ }
+ }
+ else /* no match this time, just copy the string as is */
+ {
+ int left_in_str= str_end-str_p;
+ need_buf_len= (res_p-buf) + left_in_str;
+ SECURE_REG_BUF
+ memcpy(res_p,str_p,left_in_str);
+ res_p += left_in_str;
+ str_p= str_end;
+ }
+ }
+ my_regfree(&r);
+ *res_p= 0;
+ *buf_p= buf;
+ *buf_len_p= buf_len;
+ return 0;
+}
+
/* Append the string to ds, with optional replace */
@@ -3139,6 +3593,16 @@ static void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val,
die("Out of memory in replace");
val=out_buff;
}
+
+ if (glob_replace_regex)
+ {
+ if (!multi_reg_replace(glob_replace_regex,(char*)val))
+ {
+ val= glob_replace_regex->buf;
+ len= strlen(val);
+ }
+ }
+
dynstr_append_mem(ds, val, len);
}
@@ -3577,6 +4041,7 @@ static void run_query_normal(MYSQL *mysql, struct st_query *command,
end:
free_replace();
+ free_replace_regex();
/*
We save the return code (mysql_errno(mysql)) from the last call sent
@@ -3887,7 +4352,8 @@ static void run_query_stmt(MYSQL *mysql, struct st_query *command,
end:
free_replace();
-
+ free_replace_regex();
+
if (!disable_warnings)
{
dynstr_free(&ds_prepare_warnings);
@@ -3899,6 +4365,7 @@ end:
to the server into the mysqltest builtin variable $mysql_errno. This
variable then can be used from the test case itself.
*/
+
var_set_errno(mysql_stmt_errno(stmt));
#ifndef BUG15518_FIXED
mysql_stmt_close(stmt);
@@ -4623,6 +5090,10 @@ int main(int argc, char **argv)
case Q_REPLACE:
get_replace(q);
break;
+ case Q_REPLACE_REGEX:
+ get_replace_regex(q);
+ break;
+
case Q_REPLACE_COLUMN:
get_replace_column(q);
break;
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index 3e1bf1946ff..1646260c218 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -419,3 +419,22 @@ select-me
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'insertz error query' at line 1
drop table t1;
drop table t1;
+select "b" as col1, "c" as col2;
+col1 col2
+b c
+select "b" as col1, "b" as col2, "c" as col3;
+col1 col2 col3
+b b c
+seled "b" bs col1, "d" bs col2;
+col1 col2
+b d
+select "raspberry and strawberry","blackberry","tomato";
+raspberry and strawberry blackberry tomato
+raspberry and strawberry blackberry tomato
+mysqltest: At line 1: Error parsing replace_regex "a"
+mysqltest: At line 1: Error parsing replace_regex "a;"
+mysqltest: At line 1: Error parsing replace_regex "a"
+mysqltest: At line 1: Error parsing replace_regex "a "
+mysqltest: At line 1: Error parsing replace_regex "a b"
+mysqltest: At line 1: Error parsing replace_regex "/a b c"
+mysqltest: At line 1: Error parsing replace_regex "/a /b c "
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index 55f08c28719..f928f0d3e6f 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -1061,3 +1061,30 @@ drop table t1;
drop table t1;
+# test for replace_regex
+--replace_regex /at/b/
+select "at" as col1, "c" as col2;
+
+--replace_regex /at/b/i
+select "at" as col1, "AT" as col2, "c" as col3;
+
+--replace_regex /a/b/ /ct/d/
+select "a" as col1, "ct" as col2;
+
+--replace_regex /(strawberry)/raspberry and \1/ /blueberry/blackberry/ /potato/tomato/;
+select "strawberry","blueberry","potato";
+
+--error 1
+--exec echo "--replace_regex a" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "--replace_regex a;" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "replace_regex a;" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "replace_regex a ;" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "replace_regex a b; echo OK;" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "--replace_regex /a b c" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "replace_regex /a /b c ;" | $MYSQL_TEST 2>&1
diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh
index b58c32ca741..8f2a4d809df 100644
--- a/scripts/make_win_src_distribution.sh
+++ b/scripts/make_win_src_distribution.sh
@@ -249,7 +249,7 @@ copy_dir_dirs() {
# Input directories to be copied
#
-for i in client dbug extra storage/heap include storage/archive \
+for i in client dbug extra storage/heap include storage/archive storage/example \
libmysql libmysqld storage/myisam storage/example \
storage/myisammrg mysys regex sql strings sql-common sql/examples \
tools vio zlib
diff --git a/sql/event.h b/sql/event.h
index 6ee9cea25ac..3d00ca388b9 100644
--- a/sql/event.h
+++ b/sql/event.h
@@ -177,7 +177,7 @@ public:
update_fields(THD *thd);
char *
- get_show_create_event(THD *thd, uint *length);
+ get_show_create_event(THD *thd, uint32 *length);
int
execute(THD *thd, MEM_ROOT *mem_root= NULL);
diff --git a/sql/event_executor.cc b/sql/event_executor.cc
index dbbff2a8c58..7960f1e1758 100644
--- a/sql/event_executor.cc
+++ b/sql/event_executor.cc
@@ -461,7 +461,7 @@ event_executor_worker(void *event_void)
thd->thread_stack = (char*)&thd; // remember where our stack is
thd->mem_root= &worker_mem_root;
- pthread_detach(pthread_self());
+ pthread_detach_this_thread();
if (init_event_thread(thd))
goto err;
diff --git a/sql/event_timed.cc b/sql/event_timed.cc
index 0be3f32e854..28d21089b74 100644
--- a/sql/event_timed.cc
+++ b/sql/event_timed.cc
@@ -952,7 +952,7 @@ done:
char *
-event_timed::get_show_create_event(THD *thd, uint *length)
+event_timed::get_show_create_event(THD *thd, uint32 *length)
{
char *dst, *ret;
uint len, tmp_len;
diff --git a/sql/ha_archive.cc b/sql/ha_archive.cc
index 06130f31504..65049bac135 100644
--- a/sql/ha_archive.cc
+++ b/sql/ha_archive.cc
@@ -801,7 +801,7 @@ int ha_archive::write_row(byte *buf)
error:
pthread_mutex_unlock(&share->mutex);
if (read_buf)
- my_free(read_buf, MYF(0));
+ my_free((gptr) read_buf, MYF(0));
DBUG_RETURN(rc);
}
diff --git a/sql/handler.h b/sql/handler.h
index d29c499f954..056abfbf7a5 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -794,7 +794,7 @@ typedef struct st_partition_iter
typedef int (*get_partitions_in_range_iter)(partition_info *part_info,
bool is_subpart,
- byte *min_val, byte *max_val,
+ char *min_val, char *max_val,
uint flags,
PARTITION_ITERATOR *part_iter);
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 1b3a4a6506f..9e20fa28239 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -338,8 +338,8 @@ public:
*/
if (min_flag || max_flag)
return FALSE;
- byte *min_val= min_value;
- byte *max_val= min_value;
+ byte *min_val= (byte *)min_value;
+ byte *max_val= (byte *)min_value;
if (maybe_null)
{
diff --git a/sql/set_var.cc b/sql/set_var.cc
index b85b2576b83..1a86cd1aef7 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -109,7 +109,7 @@ extern ulong ndb_report_thresh_binlog_mem_usage;
-extern my_bool event_executor_running_global_var;
+extern volatile my_bool event_executor_running_global_var;
static HASH system_variable_hash;
const char *bool_type_names[]= { "OFF", "ON", NullS };
@@ -216,7 +216,7 @@ sys_var_long_ptr sys_delayed_insert_timeout("delayed_insert_timeout",
sys_var_long_ptr sys_delayed_queue_size("delayed_queue_size",
&delayed_queue_size);
sys_var_event_executor sys_event_executor("event_scheduler",
- &event_executor_running_global_var);
+ (my_bool *)&event_executor_running_global_var);
sys_var_long_ptr sys_expire_logs_days("expire_logs_days",
&expire_logs_days);
sys_var_bool_ptr sys_flush("flush", &myisam_flush);
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index c29f5ef5650..aec0d2108ed 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -116,12 +116,12 @@ uint32 get_next_partition_id_range(PARTITION_ITERATOR* part_iter);
uint32 get_next_partition_id_list(PARTITION_ITERATOR* part_iter);
int get_part_iter_for_interval_via_mapping(partition_info *part_info,
bool is_subpart,
- byte *min_value, byte *max_value,
+ char *min_value, char *max_value,
uint flags,
PARTITION_ITERATOR *part_iter);
int get_part_iter_for_interval_via_walking(partition_info *part_info,
bool is_subpart,
- byte *min_value, byte *max_value,
+ char *min_value, char *max_value,
uint flags,
PARTITION_ITERATOR *part_iter);
static void set_up_range_analysis_info(partition_info *part_info);
@@ -5729,7 +5729,7 @@ typedef uint32 (*get_endpoint_func)(partition_info*, bool left_endpoint,
int get_part_iter_for_interval_via_mapping(partition_info *part_info,
bool is_subpart,
- byte *min_value, byte *max_value,
+ char *min_value, char *max_value,
uint flags,
PARTITION_ITERATOR *part_iter)
{
@@ -5845,7 +5845,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
int get_part_iter_for_interval_via_walking(partition_info *part_info,
bool is_subpart,
- byte *min_value, byte *max_value,
+ char *min_value, char *max_value,
uint flags,
PARTITION_ITERATOR *part_iter)
{
diff --git a/storage/ndb/src/kernel/blocks/backup/Backup.cpp b/storage/ndb/src/kernel/blocks/backup/Backup.cpp
index 836f8b4bb8b..69b0f51a951 100644
--- a/storage/ndb/src/kernel/blocks/backup/Backup.cpp
+++ b/storage/ndb/src/kernel/blocks/backup/Backup.cpp
@@ -349,7 +349,6 @@ Backup::execDUMP_STATE_ORD(Signal* signal)
c_backupFilePool.getPtr(lcp_file, lcp.p->dataFilePtr);
ndbrequire(c_pagePool.getSize() ==
c_pagePool.getNoOfFree() +
- lcp.p->pages.getSize() +
lcp_file.p->pages.getSize());
}
}
@@ -906,7 +905,6 @@ Backup::execBACKUP_REQ(Signal* signal)
return;
}//if
- ndbrequire(ptr.p->pages.empty());
ndbrequire(ptr.p->tables.isEmpty());
ptr.p->m_gsn = 0;
@@ -2756,11 +2754,6 @@ Backup::execGET_TABINFOREF(Signal* signal)
BackupRecordPtr ptr;
c_backupPool.getPtr(ptr, senderData);
- ndbout_c("execGET_TABINFOREF: tab: %d errorCode: %d extra: %d",
- ref->tableId,
- ref->errorCode,
- signal->theData[signal->getLength()-1]);
-
defineBackupRef(signal, ptr, ref->errorCode);
}
@@ -2791,27 +2784,12 @@ Backup::execGET_TABINFO_CONF(Signal* signal)
TablePtr tabPtr ;
ndbrequire(findTable(ptr, tabPtr, tableId));
- /**
- * No of pages needed
- */
- const Uint32 noPages = (len + sizeof(Page32) - 1) / sizeof(Page32);
- if(ptr.p->pages.getSize() < noPages) {
- jam();
- ptr.p->pages.release();
- if(ptr.p->pages.seize(noPages) == false) {
- jam();
- ptr.p->setErrorCode(DefineBackupRef::FailedAllocateTableMem);
- releaseSections(signal);
- defineBackupRef(signal, ptr);
- return;
- }//if
- }//if
-
BackupFilePtr filePtr;
ptr.p->files.getPtr(filePtr, ptr.p->ctlFilePtr);
FsBuffer & buf = filePtr.p->operation.dataBuffer;
+ Uint32* dst = 0;
{ // Write into ctl file
- Uint32* dst, dstLen = len + 3;
+ Uint32 dstLen = len + 3;
if(!buf.getWritePtr(&dst, dstLen)) {
jam();
ndbrequire(false);
@@ -2835,9 +2813,10 @@ Backup::execGET_TABINFO_CONF(Signal* signal)
}//if
}
+ releaseSections(signal);
+
if(ptr.p->checkError()) {
jam();
- releaseSections(signal);
defineBackupRef(signal, ptr);
return;
}//if
@@ -2845,7 +2824,6 @@ Backup::execGET_TABINFO_CONF(Signal* signal)
if (!DictTabInfo::isTable(tabPtr.p->tableType))
{
jam();
- releaseSections(signal);
TablePtr tmp = tabPtr;
ptr.p->tables.next(tabPtr);
@@ -2853,13 +2831,7 @@ Backup::execGET_TABINFO_CONF(Signal* signal)
goto next;
}
- ndbrequire(ptr.p->pages.getSize() >= noPages);
- Page32Ptr pagePtr;
- ptr.p->pages.getPtr(pagePtr, 0);
- copy(&pagePtr.p->data[0], dictTabInfoPtr);
- releaseSections(signal);
-
- if (!parseTableDescription(signal, ptr, tabPtr, len))
+ if (!parseTableDescription(signal, ptr, tabPtr, dst, len))
{
jam();
defineBackupRef(signal, ptr);
@@ -2884,8 +2856,6 @@ next:
*/
jam();
- ptr.p->pages.release();
-
if(ptr.p->is_lcp())
{
lcp_open_file_done(signal, ptr);
@@ -2916,13 +2886,10 @@ bool
Backup::parseTableDescription(Signal* signal,
BackupRecordPtr ptr,
TablePtr tabPtr,
+ const Uint32 * tabdescptr,
Uint32 len)
{
-
- Page32Ptr pagePtr;
- ptr.p->pages.getPtr(pagePtr, 0);
-
- SimplePropertiesLinearReader it(&pagePtr.p->data[0], len);
+ SimplePropertiesLinearReader it(tabdescptr, len);
it.first();
@@ -4448,7 +4415,6 @@ Backup::cleanup(Signal* signal, BackupRecordPtr ptr)
ptr.p->files.release();
ptr.p->tables.release();
ptr.p->triggers.release();
- ptr.p->pages.release();
ptr.p->backupId = ~0;
if(ptr.p->checkError())
diff --git a/storage/ndb/src/kernel/blocks/backup/Backup.hpp b/storage/ndb/src/kernel/blocks/backup/Backup.hpp
index 64a34ca5147..9ad244ed3e4 100644
--- a/storage/ndb/src/kernel/blocks/backup/Backup.hpp
+++ b/storage/ndb/src/kernel/blocks/backup/Backup.hpp
@@ -408,12 +408,12 @@ public:
* One record per backup
*/
struct BackupRecord {
- BackupRecord(Backup& b, ArrayPool<Page32> & pp,
+ BackupRecord(Backup& b,
ArrayPool<Table> & tp,
ArrayPool<BackupFile> & bp,
ArrayPool<TriggerRecord> & trp)
: slaveState(b, validSlaveTransitions, validSlaveTransitionsCount,1)
- , tables(tp), triggers(trp), files(bp), pages(pp)
+ , tables(tp), triggers(trp), files(bp)
, masterData(b), backup(b)
{
}
@@ -448,7 +448,6 @@ public:
Uint32 dataFilePtr; // Ptr.i to first data-file
Uint32 backupDataLen; // Used for (un)packing backup request
- Array<Page32> pages; // Used for (un)packing backup request
SimpleProperties props;// Used for (un)packing backup request
struct SlaveData {
@@ -608,7 +607,7 @@ public:
NodeId getMasterNodeId() const { return c_masterNodeId; }
bool findTable(const BackupRecordPtr &, TablePtr &, Uint32 tableId) const;
- bool parseTableDescription(Signal*, BackupRecordPtr ptr, TablePtr, Uint32);
+ bool parseTableDescription(Signal*, BackupRecordPtr ptr, TablePtr, const Uint32*, Uint32);
bool insertFileHeader(BackupFormat::FileType, BackupRecord*, BackupFile*);
void sendBackupRef(Signal* signal, BackupRecordPtr ptr, Uint32 errorCode);
diff --git a/storage/ndb/src/kernel/blocks/backup/BackupInit.cpp b/storage/ndb/src/kernel/blocks/backup/BackupInit.cpp
index a10b3d6e11a..a3ee655516c 100644
--- a/storage/ndb/src/kernel/blocks/backup/BackupInit.cpp
+++ b/storage/ndb/src/kernel/blocks/backup/BackupInit.cpp
@@ -206,7 +206,7 @@ Backup::execREAD_CONFIG_REQ(Signal* signal)
ArrayList<BackupRecord> recs(c_backupPool);
BackupRecordPtr ptr;
while(recs.seize(ptr)){
- new (ptr.p) BackupRecord(* this, c_pagePool, c_tablePool,
+ new (ptr.p) BackupRecord(* this, c_tablePool,
c_backupFilePool, c_triggerPool);
}
recs.release();