core/smn_database.cpp
changeset 3375 42462959f48d
parent 3271 acc921bc57ef
child 3376 fbd21905e3b0
     1.1 --- a/core/smn_database.cpp	Sat Aug 20 19:21:27 2011 -0400
     1.2 +++ b/core/smn_database.cpp	Sat Aug 20 16:41:14 2011 -0700
     1.3 @@ -29,6 +29,7 @@
     1.4   * Version: $Id$
     1.5   */
     1.6  
     1.7 +#include "mysql.h"
     1.8  #include "sm_globals.h"
     1.9  #include "HandleSys.h"
    1.10  #include "Database.h"
    1.11 @@ -662,22 +663,23 @@
    1.12  
    1.13  static cell_t SQL_QuoteString(IPluginContext *pContext, const cell_t *params)
    1.14  {
    1.15 -	IDatabase *db = NULL;
    1.16 -	HandleError err;
    1.17 +	//IDatabase *db = NULL;
    1.18 +	//HandleError err;
    1.19  
    1.20 -	if ((err = g_DBMan.ReadHandle(params[1], DBHandle_Database, (void **)&db))
    1.21 +/*	if ((err = g_DBMan.ReadHandle(params[1], DBHandle_Database, (void **)&db))
    1.22  		!= HandleError_None)
    1.23  	{
    1.24  		return pContext->ThrowNativeError("Invalid database Handle %x (error: %d)", params[1], err);
    1.25  	}
    1.26 +	*/
    1.27  
    1.28  	char *input, *output;
    1.29 -	size_t maxlength = (size_t)params[4];
    1.30 +	//size_t maxlength = (size_t)params[4];
    1.31  	pContext->LocalToString(params[2], &input);
    1.32  	pContext->LocalToString(params[3], &output);
    1.33  
    1.34  	size_t written;
    1.35 -	bool s = db->QuoteString(input, output, maxlength, &written);
    1.36 +	bool s = mysql_escape_string(output, input, strlen(input));
    1.37  
    1.38  	cell_t *addr;
    1.39  	pContext->LocalToPhysAddr(params[5], &addr);