Raised This Month: $51 Target: $400
 12% 

SQL Error - Invalid query Handle 0 (error: 4)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TheeDeer
Junior Member
Join Date: Dec 2016
Old 09-21-2017 , 18:40   SQL Error - Invalid query Handle 0 (error: 4)
Reply With Quote #1

I am trying to pull admins from an external database (hosted via nfo) however I keep getting the error "Invalid query Handle 0 (error: 4)"

Error:
Code:
L 09/21/2017 - 17:01:06: [SM] Exception reported: Invalid query Handle 0 (error: 4)
L 09/21/2017 - 17:01:06: [SM] Blaming: InfiusGaming.smx
L 09/21/2017 - 17:01:06: [SM] Call stack trace:
L 09/21/2017 - 17:01:06: [SM]   [0] SQL_FetchRow
L 09/21/2017 - 17:01:06: [SM]   [1] Line 42, infiusgaming/admins.sp::AdminQueryCallback
Here is my callback code,
Code:
public AdminQueryCallback(Handle:owner, Handle:hndl, const String:error[], any:data)
{
	if (hndl == INVALID_HANDLE) {
		PrintToServer("AdminQueryCallback Error - %s - %s", error, data);
	}
	new client = data;
	new bool:result_found = false; // Should be false
	// Using Sample Data for now
	new String:ply_id[MAX_COMMUNITYID_LENGTH];
	GetClientAuthId(client, AuthId_SteamID64, ply_id, MAX_COMMUNITYID_LENGTH);
	new String:ply_name[36];
	GetClientName(client, ply_name, sizeof(ply_name));
	
	new admin_user_id;
	new String:admin_name[40] = "";
	new String:admin_groups[40] = "";
	if (!IsValidClient(client)) {
		return false;
	}
	if (SQL_FetchRow(hndl)) {
		result_found = true;
		admin_user_id = SQL_FetchInt(hndl, 0);
		SQL_FetchString(hndl, 1, admin_name, sizeof(admin_name));
		SQL_FetchString(hndl, 2, admin_groups, sizeof(admin_groups));
	}
	else
	{
		PrintToServer("Failed");
	}
	if (result_found) {
		//CENSORED
	}
	NotifyPostAdminCheck(client); // This function MUST be called - even if we don't give the client any admin
	return false;
}
"if (SQL_FetchRow(hndl)) {" is line 44 (The line that the error trace gives.

Database connection;
Code:
ConnectDatabase()
{
	SQL_TConnect(GetDatabase);
}

public GetDatabase(Handle:owner, Handle:hndl, const String:error[], any:data)
{
	hDatabase = hndl;
}
I have the correct information is Databases.cfg under SourceMod/cfg/ any thoughts as to why im getting this error????
TheeDeer is offline
headline
SourceMod Moderator
Join Date: Mar 2015
Old 09-21-2017 , 20:25   Re: SQL Error - Invalid query Handle 0 (error: 4)
Reply With Quote #2

Quote:
Originally Posted by TheeDeer View Post
-snip-
Check to see if hndl is invalid, and if it is log the error that the function gives you. Then you'll see why you queries are failing.

Last edited by headline; 09-21-2017 at 20:25.
headline is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-23-2017 , 02:41   Re: SQL Error - Invalid query Handle 0 (error: 4)
Reply With Quote #3

*old syntax version
5 Threading
__________________
Do not Private Message @me
Bacardi is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:53.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode