MYSQL - R34 - No active cache
#1

I've recently started using BlueG's MySQL plugin and i would like to know what "No active cache" means. My sql log has been spammed by it and i'd like to know about it.
Reply
#2

It means you are using cache functions(the ones which start with cache_) without a valid cache. Basically you don't retrieve any data before using those functions.
Reply
#3

Quote:
Originally Posted by dusk
Посмотреть сообщение
It means you are using cache functions(the ones which start with cache_) without a valid cache. Basically you don't retrieve any data before using those functions.
I'm just going to add to your comment:

To retreive data with cache you do this:

new rows, fields;
cache_get_data(rows, fields)
if(rows)
{
//your code
}
else
{
//your code here if nothing has appeared
}
Reply
#4

FIXED
Reply
#5

Quote:
Originally Posted by MikeEd
Посмотреть сообщение
Ty for explaining, i'd be happy if you could help me with this as well

pawn Код:
stock LoadAccount(playerid)
{
    new LoadAccountQuery[128];
    format(LoadAccountQuery, sizeof(LoadAccountQuery), "SELECT * FROM `users` WHERE `username`= '%s' ", GetName(playerid));
    print(LoadAccountQuery);
    mysql_function_query(handle, LoadAccountQuery, true, "OnAccountLoad", "i", playerid);
}

forward OnAccountLoad(playerid);

public OnAccountLoad(playerid)
{

    Account[playerid][User_ID] =                 cache_get_row_int(0,0,handle);
    Account[playerid][Admin_Level] =             cache_get_row_int(0,3,handle);
    Account[playerid][Money] =                   cache_get_row_int(0,4,handle);
    Account[playerid][Armour] =                  cache_get_row_float(0,5,handle);
    Account[playerid][Health] =                  cache_get_row_float(0,6,handle);
   

    return 1;
}
This code is called upon login, when the password is succesfully entered, however whenever this code is called my player spawns in the air with CJ Skin even though my SQL table saves the right variable

This is what i get in the SQL Log

Код:
[23:37:23] [WARNING] cache_get_row_int - no active cache
[23:37:23] [WARNING] cache_get_row_int - no active cache
[23:37:23] [WARNING] cache_get_row_int - no active cache
[23:37:23] [WARNING] cache_get_row_float - no active cache
[23:37:23] [WARNING] cache_get_row_float - no active cache
That's because you haven't retrieved any data.
Look at my first comment where I added a thing to the other guy's comment.
Reply
#6

Thank you very much for your help, everything worked but i am getting this Warning in my logs

Код:
[15:53:17] [WARNING] cache_get_data - no active cache
Reply
#7

Quote:
Originally Posted by MikeEd
Посмотреть сообщение
Thank you very much for your help, everything worked but i am getting this Warning in my logs

Код:
[15:53:17] [WARNING] cache_get_data - no active cache
Would be glad if someone responded to this
Reply
#8

A fraction of my code, no need to explain since it is self-explanatory:

pawn Код:
new
        Cache:car_cache,
        query[128],
        opis[128]
    ;
   
    mysql_format(database_connection, query, sizeof(query), "SELECT * FROM `pojazdy` WHERE `id` = '%d'", carid);
    mysql_check();
    car_cache = mysql_query_dbg(query, true);
   
    CarInfo[carid][cUID]                        = cache_get_row_int(0, 0);
    CarInfo[carid][cModel]                      = cache_get_row_int(0, 1);
...
cache_delete(car_cache);
Briefly: You don't need to retrieve the data like it was said above. You create a cache, load the data into the cache and then extract it from the cache.

mysql_check() is my internal function, no need to worry about that at all.
Reply
#9

I am pretty sure you are using a different version of the MySQL plugin
Reply
#10

I deleted my account from the database and re-registered, it works fine. But when the server is restarted, i cant login anymore and i get that error
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)