01.06.2016, 17:45
Hi all,
I'm new with the MySQL threaded queries, however I've been working my way through things. I am using the latest up to date version of BlueG's MySQL. I have a function called LoadUserData. Unfortunately, I'm unable to retrieve the result from the database without passing through a callback to mysql_tquery. Code is below:
My MySQL log is giving me the following error:
I realise obviously that the results aren't being saved into the cache...but how do I fix that, so I can retrieve the data there? Should I be using mysql_query instead? Or is there a way to do this with mysql_tquery?
Many thanks.
I'm new with the MySQL threaded queries, however I've been working my way through things. I am using the latest up to date version of BlueG's MySQL. I have a function called LoadUserData. Unfortunately, I'm unable to retrieve the result from the database without passing through a callback to mysql_tquery. Code is below:
Код:
forward LoadUserData(playerid, dbid);
public LoadUserData(playerid, dbid){
//this stock takes the ID passed to it and queries the user table
//it then stores info in the player enum
new query[128], rows, fields;
mysql_format(mysql, query, sizeof(query), "SELECT * FROM `user` WHERE `id` = %i LIMIT 1;", dbid);
mysql_tquery(mysql, query);
cache_get_data(rows, fields, mysql);
if(rows){
User[playerid][id] = cache_get_field_content_int(0, "id"); //user id
cache_get_field_content(0, "username", User[playerid][username], mysql, 24); //username
User[playerid][id] = cache_get_field_content_int(0, "level"); //level
User[playerid][pass] = 0; //password..never going to need this really so overwritten
cache_get_field_content(0, "timestamp", User[playerid][timestamp], mysql, 10); //timestamp
GetPlayerIp(playerid, User[playerid][ip_address], 16); //set ip address
return true;
}else{
SendClientMessage(playerid, COLOR_RED, "--------------------------------------------------------");
SendClientMessage(playerid, COLOR_RED, "An error occurred loading user information. Please try again.");
SendClientMessage(playerid, COLOR_RED, "If the problem persists, contact system administrators.");
SetTimerEx("DelayedKick", 1000, false, "i", playerid);
return false;
}
}
Код:
[18:35:02] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving
Many thanks.

