View Single Post
Fastmancz
Senior Member
Join Date: Jul 2013
Location: Czech Republic
Old 12-29-2016 , 12:38   Re: [RELEASE] SourceBans++ (v1.5.4.7) [Updated: 2016-04-28]
#933

Hello, who have problem with error "[sbpp_main.smx] Query Failed: Query was empty" then, there is fix. The problem was in code at line 997.

I changed this code:
Code:
SQL_SetCharset(DB, "utf8");
at:
Code:
FormatEx(query, sizeof(query), "SET NAMES \"UTF8\"");
Edit - I find next problem with:
Code:
[SM] Exception reported: Invalid database Handle 0 (error: 4)
[SM] Blaming: sbpp_comms.smx
[SM] Call stack trace:
[SM]   [0] SQL_TQuery
[SM]   [1] Line 264, C:\....
Solution is here. I removed following code in sbpp_comms:
Code:
public OnMapEnd()
{
	decl String:Query[2048];
	Format(Query, sizeof(Query),
		"UPDATE	%s_comms \
		SET		RemovedBy = 0, \
				RemoveType = 'E', \
				RemovedOn = UNIX_TIMESTAMP() \
		WHERE	sid = %d \
		AND		RemovedOn IS NULL \
		AND		length = -1",
		DatabasePrefix, serverID);
	#if defined LOG_QUERIES
	LogToFile(logQuery, "OnMapEnd for: %s. QUERY: %s", clientAuth, Query);
	#endif
	SQL_TQuery(g_hDatabase, Query_ErrorCheck, Query);

	// Clean up on map end just so we can start a fresh connection when we need it later.
	// Also it is necessary for using SQL_SetCharset
	if (g_hDatabase)
		CloseHandle(g_hDatabase);

	g_hDatabase = INVALID_HANDLE;
}
and I changed the code to:
Code:
public OnMapEnd()
{
	// Clean up on map end just so we can start a fresh connection when we need it later.
	// Also it is necessary for using SQL_SetCharset
	if (g_hDatabase)
		CloseHandle(g_hDatabase);

	g_hDatabase = INVALID_HANDLE;
}
Attached Files
File Type: smx sbpp_main.smx (33.8 KB, 363 views)
File Type: smx sbpp_comms.smx (41.1 KB, 381 views)
File Type: sp Get Plugin or Get Source (sbpp_main.sp - 371 views - 71.8 KB)
File Type: sp Get Plugin or Get Source (sbpp_comms.sp - 346 views - 93.5 KB)
__________________


Main owner of the CMGPORTAL.CZ.
---------------------------------------
My plugins:
[CS:GO] Panorama - Timeleft
[CS:GO] JailBreak - Be quiet, please!

Last edited by Fastmancz; 12-29-2016 at 13:11.
Fastmancz is offline