Commit 0dec6c9b authored by joreland@mysql.com's avatar joreland@mysql.com

wl1744 - ndb on windows

parent f63b126f
......@@ -13,11 +13,8 @@
#define PATH_MAX 256
#define DIR_SEPARATOR "\\"
#define MYSQLCLUSTERDIR "c:\\mysql\\mysql-cluster"
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define HAVE_STRCASECMP
#define strcasecmp _strcmpi
#define strncasecmp _strncmpi
#pragma warning(disable: 4503 4786)
#else
#undef NDB_WIN32
......
......@@ -206,9 +206,9 @@ FileLogHandler::setMaxSize(const BaseString &size) {
long val = strtol(size.c_str(), &end, 0); /* XXX */
if(size.c_str() == end)
return false;
if(strncasecmp("M", end, 1) == 0)
if(end[0] == 'M')
val *= 1024*1024;
if(strncasecmp("k", end, 1) == 0)
if(end[0] == 'k')
val *= 1024;
m_maxFileSize = val;
......
......@@ -183,9 +183,13 @@ Logger::addHandler(const BaseString &logstring) {
LogHandler *handler = NULL;
if(type == "SYSLOG") {
#ifndef NDB_WIN32
if(type == "SYSLOG")
{
handler = new SysLogHandler();
} else if(type == "FILE")
} else
#endif
if(type == "FILE")
handler = new FileLogHandler();
else if(type == "CONSOLE")
handler = new ConsoleLogHandler();
......
......@@ -65,7 +65,8 @@ int NdbMutex_Trylock(NdbMutex* p_mutex)
int result = -1;
if(p_mutex)
{
result = (TryEnterCriticalSection(p_mutex) ? 0 : -1);
result = NdbMutex_Lock(p_mutex);
//(TryEnterCriticalSection(p_mutex) ? 0 : -1);
}
return result;
}
......
......@@ -20,10 +20,12 @@
#include <basestring_vsnprintf.h>
#include <my_config.h>
#ifdef _WINDOWS
#define SNPRINTF_RETURN_TRUNC
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#endif
/*
#define SNPRINTF_RETURN_TRUNC
*/
int
basestring_snprintf(char *str, size_t size, const char *format, ...)
{
......@@ -35,16 +37,6 @@ basestring_snprintf(char *str, size_t size, const char *format, ...)
return(ret);
}
#ifdef HAVE_SNPRINTF
#define BASESTRING_VSNPRINTF_FUNC(a,b,c,d) vsnprintf(a,b,c,d)
#else
#define SNPRINTF_RETURN_TRUNC
/* #define BASESTRING_VSNPRINTF_FUNC(a,b,c,d) my_vsnprintf(a,b,c,d)
* we would like to use my_vsnprintf but it does not have enough features
* Let's hope vsnprintf works anyways
*/
#define BASESTRING_VSNPRINTF_FUNC(a,b,c,d) vsnprintf(a,b,c,d)
#endif
#ifdef SNPRINTF_RETURN_TRUNC
static char basestring_vsnprintf_buf[16*1024];
#endif
......@@ -54,20 +46,20 @@ basestring_vsnprintf(char *str, size_t size, const char *format, va_list ap)
if (size == 0)
{
#ifdef SNPRINTF_RETURN_TRUNC
return BASESTRING_VSNPRINTF_FUNC(basestring_vsnprintf_buf,
return vsnprintf(basestring_vsnprintf_buf,
sizeof(basestring_vsnprintf_buf),
format, ap);
#else
char buf[1];
return BASESTRING_VSNPRINTF_FUNC(buf, 1, format, ap);
return vsnprintf(buf, 1, format, ap);
#endif
}
{
int ret= BASESTRING_VSNPRINTF_FUNC(str, size, format, ap);
int ret= vsnprintf(str, size, format, ap);
#ifdef SNPRINTF_RETURN_TRUNC
if (ret == size-1 || ret == -1)
{
ret= BASESTRING_VSNPRINTF_FUNC(basestring_vsnprintf_buf,
ret= vsnprintf(basestring_vsnprintf_buf,
sizeof(basestring_vsnprintf_buf),
format, ap);
}
......
......@@ -368,7 +368,7 @@ ndb_mgm_connect(NdbMgmHandle handle, const char * mgmsrv)
*/
SocketClient s(handle->hostname, handle->port);
const NDB_SOCKET_TYPE sockfd = s.connect();
if (sockfd < 0) {
if (sockfd == NDB_INVALID_SOCKET) {
setError(handle, NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET, __LINE__,
"Unable to connect to %s", mgmsrv);
return -1;
......@@ -1082,7 +1082,7 @@ ndb_mgm_listen_event(NdbMgmHandle handle, int filter[])
SocketClient s(handle->hostname, handle->port);
const NDB_SOCKET_TYPE sockfd = s.connect();
if (sockfd < 0) {
if (sockfd == NDB_INVALID_SOCKET) {
setError(handle, NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET, __LINE__,
"Unable to connect to");
return -1;
......
......@@ -532,7 +532,7 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
{
MgmStatService::StatListener se;
se.m_socket = -1;
se.m_socket = NDB_INVALID_SOCKET;
for(size_t t = 0; t<LogLevel::LOGLEVEL_CATEGORIES; t++){
se.m_logLevel.setLogLevel((LogLevel::EventCategory)t, 7);
}
......
......@@ -1268,7 +1268,7 @@ MgmStatService::log(int eventType, const Uint32* theData, NodeId nodeId){
m_clients.lock();
for(i = m_clients.size() - 1; i >= 0; i--){
if(threshold <= m_clients[i].m_logLevel.getLogLevel(cat)){
if(m_clients[i].m_socket >= 0 &&
if(m_clients[i].m_socket != NDB_INVALID_SOCKET &&
println_socket(m_clients[i].m_socket,
MAX_WRITE_TIMEOUT, m_text) == -1){
copy.push_back(m_clients[i].m_socket);
......@@ -1318,7 +1318,7 @@ MgmStatService::add_listener(const StatListener& client){
void
MgmStatService::stopSessions(){
for(int i = m_clients.size() - 1; i >= 0; i--){
if(m_clients[i].m_socket >= 0){
if(m_clients[i].m_socket != NDB_INVALID_SOCKET){
NDB_CLOSE_SOCKET(m_clients[i].m_socket);
m_clients.erase(i);
}
......@@ -1404,7 +1404,7 @@ MgmApiSession::listen_event(Parser<MgmApiSession>::Context & ctx,
m_mgmsrv.m_statisticsListner.add_listener(le);
m_stop = true;
m_socket = -1;
m_socket = NDB_INVALID_SOCKET;
done:
m_output->println("listen event");
......
......@@ -84,4 +84,65 @@ testBackup_LDADD = $(LDADD) bank/libbank.a
# Don't update the files from bitkeeper
%::SCCS/s.%
windoze-dsp:
windoze-dsp: flexBench.dsp testBasic.dsp testBlobs.dsp \
testScan.dsp
flexBench.dsp: Makefile \
$(top_srcdir)/ndb/config/win-prg.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-prg.am > $@
@$(top_srcdir)/ndb/config/win-name $@ flexBench
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(flexBench_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
testBasic.dsp: Makefile \
$(top_srcdir)/ndb/config/win-prg.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-prg.am > $@
@$(top_srcdir)/ndb/config/win-name $@ testBasic
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(testBasic_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
testOIBasic.dsp: Makefile \
$(top_srcdir)/ndb/config/win-prg.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-prg.am > $@
@$(top_srcdir)/ndb/config/win-name $@ testOIBasic
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(testOIBasic_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
testBlobs.dsp: Makefile \
$(top_srcdir)/ndb/config/win-prg.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-prg.am > $@
@$(top_srcdir)/ndb/config/win-name $@ testBlobs
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(testBlobs_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
testScan.dsp: Makefile \
$(top_srcdir)/ndb/config/win-prg.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-prg.am > $@
@$(top_srcdir)/ndb/config/win-name $@ testScan
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(testScan_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
......@@ -38,4 +38,108 @@ ndb_select_count_LDFLAGS = @ndb_bin_am_ldflags@
# Don't update the files from bitkeeper
%::SCCS/s.%
windoze-dsp:
windoze-dsp: \
ndb_waiter.dsp \
ndb_drop_table.dsp \
ndb_delete_all.dsp \
ndb_desc.dsp \
ndb_drop_index.dsp \
ndb_show_tables.dsp \
ndb_select_all.dsp \
ndb_select_count.dsp
ndb_waiter.dsp: Makefile \
$(top_srcdir)/ndb/config/win-prg.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-prg.am > $@
@$(top_srcdir)/ndb/config/win-name $@ ndb_waiter
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_waiter_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
ndb_drop_table.dsp: Makefile \
$(top_srcdir)/ndb/config/win-prg.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-prg.am > $@
@$(top_srcdir)/ndb/config/win-name $@ ndb_drop_table
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_drop_table_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
ndb_delete_all.dsp: Makefile \
$(top_srcdir)/ndb/config/win-prg.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-prg.am > $@
@$(top_srcdir)/ndb/config/win-name $@ ndb_delete_all
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_delete_all_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
ndb_desc.dsp: Makefile \
$(top_srcdir)/ndb/config/win-prg.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-prg.am > $@
@$(top_srcdir)/ndb/config/win-name $@ ndb_desc
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_desc_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
ndb_drop_index.dsp: Makefile \
$(top_srcdir)/ndb/config/win-prg.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-prg.am > $@
@$(top_srcdir)/ndb/config/win-name $@ ndb_drop_index
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_drop_index_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
ndb_show_tables.dsp: Makefile \
$(top_srcdir)/ndb/config/win-prg.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-prg.am > $@
@$(top_srcdir)/ndb/config/win-name $@ ndb_show_tables
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_show_tables_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
ndb_select_all.dsp: Makefile \
$(top_srcdir)/ndb/config/win-prg.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-prg.am > $@
@$(top_srcdir)/ndb/config/win-name $@ ndb_select_all
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_select_all_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
ndb_select_count.dsp: Makefile \
$(top_srcdir)/ndb/config/win-prg.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-prg.am > $@
@$(top_srcdir)/ndb/config/win-name $@ ndb_select_count
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_select_count_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
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