Commit 84c3b534 authored by unknown's avatar unknown

Changes to make mysqlslap buildable and runable on win32.


VC++Files/client/mysqlslap.vcproj:
  Added references to mysqlclient.lib & mysys.lib for mysqlslap build on win32.
VC++Files/mysql.sln:
  mysqlslap.vcproj is added into mysql.sln
client/mysqlslap.c:
  Win32 specific code is added to build & run mysqlslap successfully on win32.
parent acbe66e6
......@@ -3,6 +3,7 @@
ProjectType="Visual C++"
Version="7.10"
Name="mysqlslap"
ProjectGUID="{2E9332CF-072A-4381-BF37-17C5AB4F8583}"
SccProjectName=""
SccLocalPath="">
<Platforms>
......@@ -39,7 +40,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="wsock32.lib odbc32.lib odbccp32.lib"
AdditionalDependencies="wsock32.lib odbc32.lib odbccp32.lib mysqlclient.lib mysys.lib"
OutputFile="../client_release/mysqlslap.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
......@@ -101,7 +102,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="wsock32.lib odbc32.lib odbccp32.lib"
AdditionalDependencies="wsock32.lib odbc32.lib odbccp32.lib mysqlclient.lib mysys.lib"
OutputFile="../client_classic/mysqlslap.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
......@@ -161,7 +162,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="wsock32.lib odbc32.lib odbccp32.lib"
AdditionalDependencies="wsock32.lib odbc32.lib odbccp32.lib mysqlclient.lib mysys.lib"
OutputFile="../client_debug/mysqlslap.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
......
......@@ -22,16 +22,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmysqld", "libmysqld\libm
ProjectSection(ProjectDependencies) = postProject
{EEC1300B-85A5-497C-B3E1-F708021DF859} = {EEC1300B-85A5-497C-B3E1-F708021DF859}
{207E9014-C4D1-4F6D-B76F-BC7DD7E31113} = {207E9014-C4D1-4F6D-B76F-BC7DD7E31113}
{13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD} = {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}
{BA86AE72-0CF5-423D-BBA2-E12B0D72EBFB} = {BA86AE72-0CF5-423D-BBA2-E12B0D72EBFB}
{DB28DE80-837F-4497-9AA9-CC0A20584C98} = {DB28DE80-837F-4497-9AA9-CC0A20584C98}
{433BCD9B-15C5-4B11-B8BE-825EA98EACE6} = {433BCD9B-15C5-4B11-B8BE-825EA98EACE6}
{8762A9B8-72A9-462E-A9A2-F3265081F8AF} = {8762A9B8-72A9-462E-A9A2-F3265081F8AF}
{44D9C7DC-6636-4B82-BD01-6876C64017DF} = {44D9C7DC-6636-4B82-BD01-6876C64017DF}
{B3BFA8E5-90CF-4794-96E0-0B03ACA57A30} = {B3BFA8E5-90CF-4794-96E0-0B03ACA57A30}
{8A3A2CF1-E581-47CC-95DD-1D0DA85BE83B} = {8A3A2CF1-E581-47CC-95DD-1D0DA85BE83B}
{FC369DF4-AEB7-4531-BF34-A638C4363BFE} = {FC369DF4-AEB7-4531-BF34-A638C4363BFE}
{86276BF8-FB93-49C8-8157-4F2181375CD0} = {86276BF8-FB93-49C8-8157-4F2181375CD0}
{8A3A2CF1-E581-47CC-95DD-1D0DA85BE83B} = {8A3A2CF1-E581-47CC-95DD-1D0DA85BE83B}
{13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD} = {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}
{433BCD9B-15C5-4B11-B8BE-825EA98EACE6} = {433BCD9B-15C5-4B11-B8BE-825EA98EACE6}
{B3BFA8E5-90CF-4794-96E0-0B03ACA57A30} = {B3BFA8E5-90CF-4794-96E0-0B03ACA57A30}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "myTest", "libmysqltest\myTest.vcproj", "{2794E434-7CCE-44DB-B2FB-789ABE53D6B9}"
......@@ -49,36 +49,36 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "myisam_ftdump", "myisam_ftdump\myisam_ftdump.vcproj", "{4C5D0EB1-B953-4BE9-A48B-4F3A874E6635}"
ProjectSection(ProjectDependencies) = postProject
{EEC1300B-85A5-497C-B3E1-F708021DF859} = {EEC1300B-85A5-497C-B3E1-F708021DF859}
{13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD} = {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}
{44D9C7DC-6636-4B82-BD01-6876C64017DF} = {44D9C7DC-6636-4B82-BD01-6876C64017DF}
{FC369DF4-AEB7-4531-BF34-A638C4363BFE} = {FC369DF4-AEB7-4531-BF34-A638C4363BFE}
{13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD} = {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "myisamchk", "myisamchk\myisamchk.vcproj", "{87CD9881-D234-4306-BBC6-0668C6168C0F}"
ProjectSection(ProjectDependencies) = postProject
{EEC1300B-85A5-497C-B3E1-F708021DF859} = {EEC1300B-85A5-497C-B3E1-F708021DF859}
{13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD} = {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}
{8762A9B8-72A9-462E-A9A2-F3265081F8AF} = {8762A9B8-72A9-462E-A9A2-F3265081F8AF}
{44D9C7DC-6636-4B82-BD01-6876C64017DF} = {44D9C7DC-6636-4B82-BD01-6876C64017DF}
{FC369DF4-AEB7-4531-BF34-A638C4363BFE} = {FC369DF4-AEB7-4531-BF34-A638C4363BFE}
{13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD} = {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "myisamlog", "myisamlog\myisamlog.vcproj", "{194F5EE6-9440-4298-A6FE-A9B4B480B44C}"
ProjectSection(ProjectDependencies) = postProject
{EEC1300B-85A5-497C-B3E1-F708021DF859} = {EEC1300B-85A5-497C-B3E1-F708021DF859}
{13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD} = {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}
{8762A9B8-72A9-462E-A9A2-F3265081F8AF} = {8762A9B8-72A9-462E-A9A2-F3265081F8AF}
{44D9C7DC-6636-4B82-BD01-6876C64017DF} = {44D9C7DC-6636-4B82-BD01-6876C64017DF}
{FC369DF4-AEB7-4531-BF34-A638C4363BFE} = {FC369DF4-AEB7-4531-BF34-A638C4363BFE}
{13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD} = {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "myisampack", "myisampack\myisampack.vcproj", "{EF833A1E-E358-4B6C-9C27-9489E85041CC}"
ProjectSection(ProjectDependencies) = postProject
{EEC1300B-85A5-497C-B3E1-F708021DF859} = {EEC1300B-85A5-497C-B3E1-F708021DF859}
{13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD} = {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}
{8762A9B8-72A9-462E-A9A2-F3265081F8AF} = {8762A9B8-72A9-462E-A9A2-F3265081F8AF}
{44D9C7DC-6636-4B82-BD01-6876C64017DF} = {44D9C7DC-6636-4B82-BD01-6876C64017DF}
{FC369DF4-AEB7-4531-BF34-A638C4363BFE} = {FC369DF4-AEB7-4531-BF34-A638C4363BFE}
{13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD} = {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysql", "client\mysql.vcproj", "{F9868FD3-7AE2-486D-BAB3-A299E11F6AC1}"
......@@ -124,6 +124,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqld", "sql\mysqld.vcproj
{13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD} = {13A3EB35-EF87-42DC-AFD6-CDF5EFB228AD}
{BA86AE72-0CF5-423D-BBA2-E12B0D72EBFB} = {BA86AE72-0CF5-423D-BBA2-E12B0D72EBFB}
{DB28DE80-837F-4497-9AA9-CC0A20584C98} = {DB28DE80-837F-4497-9AA9-CC0A20584C98}
{433BCD9B-15C5-4B11-B8BE-825EA98EACE6} = {433BCD9B-15C5-4B11-B8BE-825EA98EACE6}
{8762A9B8-72A9-462E-A9A2-F3265081F8AF} = {8762A9B8-72A9-462E-A9A2-F3265081F8AF}
{F74653C4-8003-4A79-8F53-FC69E0AD7A9B} = {F74653C4-8003-4A79-8F53-FC69E0AD7A9B}
{44D9C7DC-6636-4B82-BD01-6876C64017DF} = {44D9C7DC-6636-4B82-BD01-6876C64017DF}
......@@ -131,7 +132,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqld", "sql\mysqld.vcproj
{8A3A2CF1-E581-47CC-95DD-1D0DA85BE83B} = {8A3A2CF1-E581-47CC-95DD-1D0DA85BE83B}
{FC369DF4-AEB7-4531-BF34-A638C4363BFE} = {FC369DF4-AEB7-4531-BF34-A638C4363BFE}
{86276BF8-FB93-49C8-8157-4F2181375CD0} = {86276BF8-FB93-49C8-8157-4F2181375CD0}
{433BCD9B-15C5-4B11-B8BE-825EA98EACE6} = {433BCD9B-15C5-4B11-B8BE-825EA98EACE6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqldemb", "mysqldemb\mysqldemb.vcproj", "{37D9BA79-302E-4582-A545-CB5FF7982EA3}"
......@@ -286,6 +286,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bdb", "storage\bdb\bdb.vcpr
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqlslap", "client\mysqlslap.vcproj", "{2E9332CF-072A-4381-BF37-17C5AB4F8583}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
classic = classic
......@@ -1033,7 +1037,7 @@ Global
{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.Build.0 = TLS_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
......@@ -1654,6 +1658,42 @@ Global
{B3BFA8E5-90CF-4794-96E0-0B03ACA57A30}.TLS.Build.0 = Debug|Win32
{B3BFA8E5-90CF-4794-96E0-0B03ACA57A30}.TLS_DEBUG.ActiveCfg = Debug|Win32
{B3BFA8E5-90CF-4794-96E0-0B03ACA57A30}.TLS_DEBUG.Build.0 = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.classic.ActiveCfg = classic|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.classic.Build.0 = classic|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.classic nt.ActiveCfg = classic|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.classic nt.Build.0 = classic|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.Debug.ActiveCfg = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.Debug.Build.0 = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.Embedded_Classic.ActiveCfg = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.Embedded_Classic.Build.0 = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.Embedded_Debug.ActiveCfg = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.Embedded_Debug.Build.0 = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.Embedded_Pro.ActiveCfg = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.Embedded_Pro.Build.0 = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.Embedded_ProGPL.ActiveCfg = Debug|Win32
{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}.nt.ActiveCfg = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.nt.Build.0 = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.pro.ActiveCfg = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.pro.Build.0 = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.pro gpl.ActiveCfg = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.pro gpl.Build.0 = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.pro gpl nt.ActiveCfg = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.pro gpl nt.Build.0 = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.pro nt.ActiveCfg = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.pro nt.Build.0 = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.Release.ActiveCfg = Release|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.Release.Build.0 = Release|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.TLS.ActiveCfg = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.TLS.Build.0 = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.TLS_DEBUG.ActiveCfg = Debug|Win32
{2E9332CF-072A-4381-BF37-17C5AB4F8583}.TLS_DEBUG.Build.0 = Debug|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
......
......@@ -85,13 +85,28 @@
#include <stdarg.h>
#include <sslopt-vars.h>
#include <sys/types.h>
#ifndef __WIN__
#include <sys/wait.h>
#endif
#include <ctype.h>
#include <my_pthread.h>
#define MYSLAPLOCK "/myslaplock.lck"
#define MYSLAPLOCK_DIR "/tmp"
#ifdef __WIN__
#define srandom srand
#define random rand
#define snprintf _snprintf
#define USE_THREADS_DEFAULT TRUE
#else
#define USE_THREADS_DEFAULT FALSE
#endif
#ifdef HAVE_SMEM
static char *shared_memory_base_name=0;
#endif
static char **defaults_argv;
static char *host= NULL, *opt_password= NULL, *user= NULL,
......@@ -213,6 +228,17 @@ static long int timedif(struct timeval a, struct timeval b)
return s + us;
}
#ifdef __WIN__
static int gettimeofday(struct timeval *tp, void *tzp)
{
unsigned int ticks;
ticks= GetTickCount();
tp->tv_usec= ticks*1000;
tp->tv_sec= ticks/1000;
return 0;
}
#endif
int main(int argc, char **argv)
{
......@@ -222,7 +248,7 @@ int main(int argc, char **argv)
unsigned long long client_limit;
statement *eptr;
DBUG_ENTER("main");
//DBUG_ENTER("main");
MY_INIT(argv[0]);
/* Seed the random number generator if we will be using it. */
......@@ -353,7 +379,7 @@ int main(int argc, char **argv)
free_defaults(defaults_argv);
my_end(0);
DBUG_RETURN(0); /* No compiler warnings */
return 0;
}
......@@ -452,7 +478,7 @@ static struct my_option my_long_options[] =
{"use-threads", OPT_USE_THREADS,
"Use pthread calls instead of fork() calls (default on Windows)",
(gptr*) &opt_use_threads, (gptr*) &opt_use_threads, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
GET_NO_ARG, NO_ARG, USE_THREADS_DEFAULT, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.", (gptr*) &user,
......@@ -936,7 +962,6 @@ drop_schema(MYSQL *mysql, const char *db)
DBUG_RETURN(0);
}
static int
run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit)
{
......@@ -980,6 +1005,7 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit)
}
}
}
#ifndef __WIN__
else
{
fflush(NULL);
......@@ -1020,6 +1046,7 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit)
}
}
}
#endif
/* Lets release use some clients! */
if (!opt_slave)
......@@ -1041,6 +1068,7 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit)
}
my_lock(lock_file, F_UNLCK, 0, F_TO_EOF, MYF(0));
}
#ifndef __WIN__
else
{
WAIT:
......@@ -1051,6 +1079,7 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit)
DBUG_PRINT("info", ("Parent: child %d status %d", pid, status));
}
}
#endif
gettimeofday(&end_time, NULL);
my_close(lock_file, MYF(0));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment