This commit is contained in:
Fyren 2011-08-20 16:41:14 -07:00
parent 1c0abbfce6
commit 88d4abeaf8
5 changed files with 15 additions and 12 deletions

View File

@ -26,7 +26,7 @@ OBJECTS += smn_bitbuffer.cpp smn_console.cpp smn_core.cpp \
smn_filesystem.cpp smn_halflife.cpp \ smn_filesystem.cpp smn_halflife.cpp \
smn_keyvalues.cpp smn_player.cpp \ smn_keyvalues.cpp smn_player.cpp \
smn_usermsgs.cpp smn_menus.cpp smn_vector.cpp \ smn_usermsgs.cpp smn_menus.cpp smn_vector.cpp \
smn_hudtext.cpp smn_nextmap.cpp smn_hudtext.cpp smn_nextmap.cpp smn_database.cpp
OBJECTS += ExtensionSys.cpp \ OBJECTS += ExtensionSys.cpp \
ForwardSys.cpp \ ForwardSys.cpp \
HandleSys.cpp \ HandleSys.cpp \
@ -120,12 +120,13 @@ endif
CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_BLOODYGOODTIME=4 -DSE_EYE=5 \ CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_BLOODYGOODTIME=4 -DSE_EYE=5 \
-DSE_ORANGEBOXVALVE=6 -DSE_LEFT4DEAD=7 -DSE_LEFT4DEAD2=8 -DSE_ALIENSWARM=9 -DSE_ORANGEBOXVALVE=6 -DSE_LEFT4DEAD=7 -DSE_LEFT4DEAD2=8 -DSE_ALIENSWARM=9
#LINK += /usr/lib/mysql/libmysqlclient_r.a /usr/lib/libssl.a /usr/lib/libkrb5.a /usr/lib/libcrypto.a $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a $(LIB_PREFIX)vstdlib$(LIB_SUFFIX)
LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a $(LIB_PREFIX)vstdlib$(LIB_SUFFIX) \ LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a $(LIB_PREFIX)vstdlib$(LIB_SUFFIX) \
$(LIB_PREFIX)tier0$(LIB_SUFFIX) -static-libgcc $(LIB_PREFIX)tier0$(LIB_SUFFIX) -static-libgcc -L/usr/lib/mysql -lmysqlclient
INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/vstdlib \ INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/vstdlib \
-I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I$(METAMOD) -I$(METAMOD)/sourcehook \ -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I$(METAMOD) -I$(METAMOD)/sourcehook \
-I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I/usr/include/mysql
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \ CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror \ -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror \

View File

@ -29,6 +29,7 @@
* Version: $Id$ * Version: $Id$
*/ */
#include "mysql.h"
#include "sm_globals.h" #include "sm_globals.h"
#include "HandleSys.h" #include "HandleSys.h"
#include "Database.h" #include "Database.h"
@ -662,22 +663,23 @@ static cell_t SQL_GetError(IPluginContext *pContext, const cell_t *params)
static cell_t SQL_QuoteString(IPluginContext *pContext, const cell_t *params) static cell_t SQL_QuoteString(IPluginContext *pContext, const cell_t *params)
{ {
IDatabase *db = NULL; //IDatabase *db = NULL;
HandleError err; //HandleError err;
if ((err = g_DBMan.ReadHandle(params[1], DBHandle_Database, (void **)&db)) /* if ((err = g_DBMan.ReadHandle(params[1], DBHandle_Database, (void **)&db))
!= HandleError_None) != HandleError_None)
{ {
return pContext->ThrowNativeError("Invalid database Handle %x (error: %d)", params[1], err); return pContext->ThrowNativeError("Invalid database Handle %x (error: %d)", params[1], err);
} }
*/
char *input, *output; char *input, *output;
size_t maxlength = (size_t)params[4]; //size_t maxlength = (size_t)params[4];
pContext->LocalToString(params[2], &input); pContext->LocalToString(params[2], &input);
pContext->LocalToString(params[3], &output); pContext->LocalToString(params[3], &output);
size_t written; size_t written;
bool s = db->QuoteString(input, output, maxlength, &written); bool s = mysql_escape_string(output, input, strlen(input));
cell_t *addr; cell_t *addr;
pContext->LocalToPhysAddr(params[5], &addr); pContext->LocalToPhysAddr(params[5], &addr);

View File

@ -85,11 +85,11 @@ ifeq "$(USEMETA)" "true"
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
else else
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(MMSOURCE17)/core/sourcehook \ INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(MMSOURCE17)/core/sourcehook \
-I$(MYSQL)/include -I/usr/include/mysql
CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_ORANGEBOXVALVE=4 -DSE_LEFT4DEAD=5 CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_ORANGEBOXVALVE=4 -DSE_LEFT4DEAD=5
endif endif
LINK += $(MYSQL)/lib/libmysqlclient_r.a -lz -lpthread LINK += -m32 /usr/lib/mysql/libmysqlclient_r.a -lz -lpthread
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \ CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \ -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \

View File

@ -186,7 +186,7 @@ bool MyDatabase::QuoteString(const char *str, char buffer[], size_t maxlength, s
return false; return false;
} }
needed = mysql_real_escape_string(m_mysql, buffer, str, size); needed = mysql_escape_string(buffer, str, size);
if (newSize) if (newSize)
{ {
*newSize = (size_t)needed; *newSize = (size_t)needed;

View File

@ -47,7 +47,7 @@ the end
The Patty Winters show this morning was about how terrible sawce is, same as yesterday's show; however, things are looking up for tomorrow. The Patty Winters show this morning was about how terrible sawce is, same as yesterday's show; however, things are looking up for tomorrow.
IT'S CLOBBERIN' TIME IT'S CLOBBERIN' TIME
vc2005 supremecy vc2005 supremecy
clobbermonkey clobstermonkey
that thing that thing
clobber build because amx.h changed (sigh) clobber build because amx.h changed (sigh)
a dead fish a dead fish