From d78a0c87b819b3e5e3b462dda6d63c28752fadc2 Mon Sep 17 00:00:00 2001 From: Fyren Date: Sat, 20 Aug 2011 16:44:16 -0700 Subject: [PATCH] Backed out changeset 42462959f48d --- core/Makefile | 7 +++---- core/smn_database.cpp | 12 +++++------- extensions/mysql/Makefile | 4 ++-- extensions/mysql/mysql/MyDatabase.cpp | 2 +- pushbuild.txt | 2 +- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/core/Makefile b/core/Makefile index b46ce05c0..2c029e325 100644 --- a/core/Makefile +++ b/core/Makefile @@ -26,7 +26,7 @@ OBJECTS += smn_bitbuffer.cpp smn_console.cpp smn_core.cpp \ smn_filesystem.cpp smn_halflife.cpp \ smn_keyvalues.cpp smn_player.cpp \ smn_usermsgs.cpp smn_menus.cpp smn_vector.cpp \ - smn_hudtext.cpp smn_nextmap.cpp smn_database.cpp + smn_hudtext.cpp smn_nextmap.cpp OBJECTS += ExtensionSys.cpp \ ForwardSys.cpp \ HandleSys.cpp \ @@ -120,13 +120,12 @@ endif 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 -#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) \ - $(LIB_PREFIX)tier0$(LIB_SUFFIX) -static-libgcc -L/usr/lib/mysql -lmysqlclient + $(LIB_PREFIX)tier0$(LIB_SUFFIX) -static-libgcc 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$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I/usr/include/mysql + -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn 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 \ diff --git a/core/smn_database.cpp b/core/smn_database.cpp index e50c1af01..3c0482384 100644 --- a/core/smn_database.cpp +++ b/core/smn_database.cpp @@ -29,7 +29,6 @@ * Version: $Id$ */ -#include "mysql.h" #include "sm_globals.h" #include "HandleSys.h" #include "Database.h" @@ -663,23 +662,22 @@ static cell_t SQL_GetError(IPluginContext *pContext, const cell_t *params) static cell_t SQL_QuoteString(IPluginContext *pContext, const cell_t *params) { - //IDatabase *db = NULL; - //HandleError err; + IDatabase *db = NULL; + 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) { return pContext->ThrowNativeError("Invalid database Handle %x (error: %d)", params[1], err); } - */ 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[3], &output); size_t written; - bool s = mysql_escape_string(output, input, strlen(input)); + bool s = db->QuoteString(input, output, maxlength, &written); cell_t *addr; pContext->LocalToPhysAddr(params[5], &addr); diff --git a/extensions/mysql/Makefile b/extensions/mysql/Makefile index 487f7eee3..50e236e1d 100644 --- a/extensions/mysql/Makefile +++ b/extensions/mysql/Makefile @@ -85,11 +85,11 @@ ifeq "$(USEMETA)" "true" -I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn else INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(MMSOURCE17)/core/sourcehook \ - -I/usr/include/mysql + -I$(MYSQL)/include CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_ORANGEBOXVALVE=4 -DSE_LEFT4DEAD=5 endif -LINK += -m32 /usr/lib/mysql/libmysqlclient_r.a -lz -lpthread +LINK += $(MYSQL)/lib/libmysqlclient_r.a -lz -lpthread 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 \ diff --git a/extensions/mysql/mysql/MyDatabase.cpp b/extensions/mysql/mysql/MyDatabase.cpp index 11e338428..e62ccbfda 100644 --- a/extensions/mysql/mysql/MyDatabase.cpp +++ b/extensions/mysql/mysql/MyDatabase.cpp @@ -186,7 +186,7 @@ bool MyDatabase::QuoteString(const char *str, char buffer[], size_t maxlength, s return false; } - needed = mysql_escape_string(buffer, str, size); + needed = mysql_real_escape_string(m_mysql, buffer, str, size); if (newSize) { *newSize = (size_t)needed; diff --git a/pushbuild.txt b/pushbuild.txt index d4a2bb54d..74027d752 100644 --- a/pushbuild.txt +++ b/pushbuild.txt @@ -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. IT'S CLOBBERIN' TIME vc2005 supremecy -clobstermonkey +clobbermonkey that thing clobber build because amx.h changed (sigh) a dead fish