core/smn_database.cpp
changeset 3947 999d29e113db
parent 3872 4c93f74cae51
     1.1 --- a/core/smn_database.cpp	Wed Jul 17 08:05:42 2013 -0400
     1.2 +++ b/core/smn_database.cpp	Thu Jul 18 10:27:12 2013 -0400
     1.3 @@ -1407,6 +1407,23 @@
     1.4  	return hndl;
     1.5  }
     1.6  
     1.7 +static cell_t SQL_SetCharset(IPluginContext *pContext, const cell_t *params)
     1.8 +{
     1.9 +	IDatabase *db = NULL;
    1.10 +	HandleError err;
    1.11 +
    1.12 +	if ((err = g_DBMan.ReadHandle(params[1], DBHandle_Database, (void **)&db))
    1.13 +		!= HandleError_None)
    1.14 +	{
    1.15 +		return pContext->ThrowNativeError("Invalid database Handle %x (error: %d)", params[1], err);
    1.16 +	}
    1.17 +
    1.18 +	char *characterset;
    1.19 +	pContext->LocalToString(params[2], &characterset);
    1.20 +
    1.21 +	return db->SetCharacterSet(characterset);
    1.22 +}
    1.23 +
    1.24  REGISTER_NATIVES(dbNatives)
    1.25  {
    1.26  	{"SQL_BindParamInt",		SQL_BindParamInt},
    1.27 @@ -1448,6 +1465,7 @@
    1.28  	{"SQL_TQuery",				SQL_TQuery},
    1.29  	{"SQL_UnlockDatabase",		SQL_UnlockDatabase},
    1.30  	{"SQL_ConnectCustom",		SQL_ConnectCustom},
    1.31 +	{"SQL_SetCharset",		SQL_SetCharset},
    1.32  	{NULL,						NULL},
    1.33  };
    1.34