SA-MP Forums Archive
[Mysql]:No active cache - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Mysql]:No active cache (/showthread.php?tid=532730)



[Mysql]:No active cache - anou1 - 20.08.2014

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


Re: [Mysql]:No active cache - anou1 - 20.08.2014

Bump


Re: [Mysql]:No active cache - AiRaLoKa - 20.08.2014

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


Re: [Mysql]:No active cache - anou1 - 20.08.2014

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.


Re: [Mysql]:No active cache - AiRaLoKa - 20.08.2014

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);
        }
    }
}



Re: [Mysql]:No active cache - anou1 - 20.08.2014

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