[WARNING] cache_get_field_content_int - no active cache
#1

mysql_log.txt

Code:
[17:02:55] [DEBUG] mysql_format - connection: 1, len: 1024, format: "SELECT * FROM accounts WHERE username = 'Jacob'"
[17:02:55] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM accounts WHERE username = 'Jacob'", callback: "FJ37DH3JG_MYSQL_INTERNAL", format: "d"
[17:02:55] [DEBUG] CMySQLQuery::Execute[FJ37DH3JG_MYSQL_INTERNAL] - starting query execution
[17:02:55] [DEBUG] CMySQLQuery::Execute[FJ37DH3JG_MYSQL_INTERNAL] - query was successfully executed within 143.281 milliseconds
[17:02:55] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[17:02:55] [DEBUG] Calling callback "FJ37DH3JG_MYSQL_INTERNAL"..
[17:02:55] [DEBUG] cache_get_data - connection: 1
[17:02:55] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[17:02:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "accountindex", connection: 1
[17:02:57] [WARNING] cache_get_field_content_int - no active cache
[17:02:57] [DEBUG] cache_get_field_content - row: 0, field_name: "username", connection: 1, max_len: 24
[17:02:57] [WARNING] cache_get_field_content - no active cache
[17:02:57] [DEBUG] cache_get_field_content - row: 0, field_name: "password", connection: 1, max_len: 129
[17:02:57] [WARNING] cache_get_field_content - no active cache
I'm using y_inline, y_hooks and y_dialog.

Code:
hook OnPlayerConnect(playerid)
{
	new query[1024];
	mysql_format(MySQL_Handle, query, sizeof(query), "SELECT * FROM accounts WHERE username = 'Jacob'");
	
	inline OnAccountCheck()
	{
		new row, field;
		cache_get_data(row, field, MySQL_Handle);
		
		if (row > 0)
		{
			inline Response(pid, dialogid, response, listitem, string:inputtext[])
			{
				#pragma unused pid, dialogid, listitem, inputtext
				
				if (!response)
				{
					Kick(playerid);
				}
				else if (response)
				{
					AccountData[playerid][Account_ID] = cache_get_field_content_int(0, "accountindex");
					cache_get_field_content(0, "username", AccountData[playerid][Account_Username], MySQL_Handle, 24);
					cache_get_field_content(0, "password", AccountData[playerid][Account_Password], MySQL_Handle, 129);
					
					printf("ID: %d, Username: %s, Password: %s", AccountData[playerid][Account_ID], AccountData[playerid][Account_Username], AccountData[playerid][Account_Password]);
				}
			}
			Dialog_ShowCallback(playerid, using inline Response, DIALOG_STYLE_PASSWORD, "{FFFFFF}San Andreas Logistics .:. Login!", "{FFFFFF}Welcome to San Andreas Logistics, Jacob!\n\nThis account is registered and you may continue by typing the password to login to it below.", "Login", "Cancel");
		} else
		{
			inline Response(pid, dialogid, response, listitem, string:inputtext[])
			{
				#pragma unused pid, dialogid, listitem, inputtext
				
				if (!response)
				{
					Kick(playerid);
				}
				else if (response)
				{
					
				}
			}
			Dialog_ShowCallback(playerid, using inline Response, DIALOG_STYLE_PASSWORD, "{FFFFFF}San Andreas Logistics .:. Register!", "{FFFFFF}Welcome to San Andreas Logistics, Jacob!\n\nThis account is not registered and you may continue by typing a password to register it below.", "Register", "Cancel");
		}
	}
	mysql_tquery_inline(MySQL_Handle, query, using inline OnAccountCheck, "");
	
	return 1;
}
Keep in mind that this is unfinished code. I also have the account created in the database.
Reply
#2

IDK to be honest.. Try making it a normal callback and not inline..
EDIT: and the dialog too.

OffTopic:
From where did you get that mysql_tquery_inline btw ?
Reply
#3

y_inline is a little misleading. It's not inline function per se as in C. Even though it has access to variables from outside scope, it manually copies variables from stack and allows to access some from the heap - to access strings you need to define "string:" tag, arrays are handled as well with macro magic. However query callbacks "automagically" destroy the cache after callback is finished. So currently, for you it looks like:

1. Execute query
2. Execute query callback - Create cache
3. Display dialog and specify its callback
4. Destroy cache
5. Execute dialog callback - cache no longer present

You can circumvent it with cache_save, and manual cache_destroy within inner inline function.
Reply
#4

Oh, okay. Thanks for the information Misiur.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)