[Mysql]:No active cache
#1

Hi, I don't understand why I got a "[04:10:36] [WARNING] cache_get_row_count - no active cache" when this code executes itself.

Mysql Log file:
Код:
[04:08:36] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM `voitures`", callback: "(null)", format: "(null)"
[04:08:36] [DEBUG] cache_get_row_count - connection: 1
[04:08:36] [WARNING] cache_get_row_count - no active cache
Code:
Код:
public SauvegardeVoitures()
{
	new query[128];
	format(query, sizeof(query), "SELECT * FROM `voitures`");
	mysql_tquery(mysql, query, "");
	new nbVoitures =  cache_get_row_count();
	printf("Dйbut save v, nbVoitures = %d", nbVoitures);
	if(nbVoitures > 0)
	{
		for(new v = 1; v < nbVoitures; v++)
		{	
			SauvegardeVoiture(v);
			printf("Save veh: %d", v);
		}
	}
	return 1;
}
This code is supposed to find in the database how much vehicles there is, then save them.
But actually, nbVoitures is always 0 what ever there's in database.


Anybody know how could I fix this please ?


Thank you
Reply
#2

Bump
Reply
#3

try to make a callback to be called when the query executed (threaded query), and then put the rest (after "mysql_tquery") inside the new callback
Reply
#4

I tried this:

Код:
public SauvegardeVoitures()
{
	new query[128];
	format(query, sizeof(query), "SELECT * FROM `voitures`");
	mysql_tquery(mysql, query, "");
	SetTimer("SauvegardeVoiture2", 1000, false);
	return 1;
}


forward SauvegardeVoiture2();
public SauvegardeVoiture2()
{
	new nbVoitures = cache_get_row_count();
	printf("Dйbut save v, nbVoitures = %d", nbVoitures);
	if(nbVoitures > 0)
	{
		for(new v = 1; v < nbVoitures; v++)
		{	
			SauvegardeVoiture(v);
			printf("Save veh: %d", v);
		}
	}
}
Same problem, still not working.
Reply
#5

you're doing it wrong

pawn Код:
public SauvegardeVoitures()
{
    new query[128];
    format(query, sizeof(query), "SELECT * FROM `voitures`");
    mysql_tquery(mysql, query, "SauvegardeVoiture2");
    return 1;
}


forward SauvegardeVoiture2();
public SauvegardeVoiture2()
{
    new nbVoitures = cache_get_row_count();
    printf("Dйbut save v, nbVoitures = %d", nbVoitures);
    if(nbVoitures > 0)
    {
        for(new v = 1; v < nbVoitures; v++)
        {  
            SauvegardeVoiture(v);
            printf("Save veh: %d", v);
        }
    }
}
Reply
#6

You right, I totally forgot this, thank you !
+Rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)