Created
July 14, 2019 09:52
-
-
Save TheByKotik/5aec71b763cd2a8586be035d6f59df77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma newdecls required | |
#pragma semicolon 1 | |
Plugin myinfo = { | |
name = "Test", | |
author = "", | |
description = "", | |
version = "", }; | |
stock Database g_dbTest; | |
public void OnPluginStart () | |
{ | |
Database.Connect( DB_Connect_Callback, "Test" ); | |
} | |
stock void DB_Connect_Callback (Database dbHandle, const char[] szError, any aData) | |
{ | |
if ( dbHandle ) { | |
delete g_dbTest; | |
g_dbTest = dbHandle; | |
g_dbTest.SetCharset( "utf8" ); } | |
} | |
public void OnClientPostAdminCheck (int iClient) | |
{ | |
if ( !IsFakeClient( iClient ) ) { | |
char szQ[64]; | |
FormatEx( szQ, sizeof szQ, "CALL`StoredProc`('%i');", 1 ); | |
Transaction tQuery = new Transaction(); | |
tQuery.AddQuery( szQ ); | |
LogToFileEx( "addons/sourcemod/logs/TestError.log", "Call StoredProc." ); | |
g_dbTest.Execute( tQuery, DB_Success, DB_Failure, GetClientUserId( iClient ) ); } | |
} | |
stock void DB_Success (Database dbHandle, int iUserID, int iNumQueries, DBResultSet[] results, any[] aQueryData) | |
{ | |
int iClient = GetClientOfUserId( iUserID ); | |
if ( iClient && results[0].FetchRow() ) { | |
PrintToChat( iClient, "DEBUG: %i", results[0].FetchInt( 0 ) ); } | |
/* I tried clear result set. */ | |
for ( int i = 0; i < iNumQueries; ++i ) { | |
while ( results[i].FetchMoreResults() ) {} | |
delete results[i]; } | |
} | |
stock void DB_Failure (Database dbHandle, any aData, int iNumQueries, const char[] szError, int iFailIndex, any[] aQueryData) | |
{ | |
LogToFileEx( "addons/sourcemod/logs/TestError.log", "Test: %s", szError ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment