SA-MP Forums Archive
samp mysql-r35b3 - 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: samp mysql-r35b3 (/showthread.php?tid=490088)



samp mysql-r35b3 - audriuxxx - 25.01.2014

Hi,

I use blueG newest plugin mysql-r35b3. I want to ask that user who use it. Can i use non-thread, and threaded mysql queries? because i want to thread all my gamemod but now i want just somethings thread. If i do that, it's not harm my server?


Re: samp mysql-r35b3 - Shetch - 25.01.2014

What's the point in threading only part of your server queries?
I can't imagine that being very safe.


Re: samp mysql-r35b3 - audriuxxx - 25.01.2014

Because, am not rushing... And is it true, can i use thread and non-threaded queries? And now two qustions more:

When i use query with threaded query, and in callback i can do anything i want, can i without more ado make another query? ex:

Код:
mysql_pquery(1, "SELECT Name FROM players", "PlayerNassewqe", "d", playerid);

forward PlayerNassewqe( playerid );
public PlayerNassewqe( playerid )
{
if(cache_num_rows() == 1)
	{
mysql_pquery(1, "SELECT Name FROM zombies", "PlayerNassewqerrr", "d", playerid); // I CAN MAKE A QUERY JUST NOW?

}
}



Re: samp mysql-r35b3 - maddinat0r - 25.01.2014

Yes, you can use threaded (mysql_tquery, mysql_pquery) and unthreaded (mysql_query) queries.
And yes, you can send queries in result callbacks (like in your example code), just be careful that your code doesn't get stuck in a loop.


Re: samp mysql-r35b3 - audriuxxx - 25.01.2014

Thanks so much.. And now one question: when i use non threaded query for ex:

Код:
mysql_query("SELECT Name FROM players");
Now i need to change to this?

Код:
mysql_query(1,"SELECT Name FROM players", false);
If i use false, i need use mysql_store_result, mysql_free_result, and other things?


Re: samp mysql-r35b3 - maddinat0r - 25.01.2014

If you use "false" for the parameter "use_cache", then you won't get any result at all. There is also no "mysql_store_result" or "mysql_free_result", you'll have to use the cache natives. You should take a look at the documentation about the native "mysql_query".


Re: samp mysql-r35b3 - audriuxxx - 25.01.2014

It means, when i use mysql_query, i need to use cache_delete like alternative mysql_free_result? but can i use mysql_store_result()?


Re: samp mysql-r35b3 - maddinat0r - 25.01.2014

Like I said, there is no "mysql_store_result", the result is automatically stored into the cache when you call "mysql_query". The only thing you have to care about is (like you already said) deleting the cache when you don't need it anymore (with cache_delete).


Re: samp mysql-r35b3 - audriuxxx - 25.01.2014

If i use threaded query, mysql_pquery or mysql_tquery, how i need work with cycle's? because now i do like that:

Код:
while( mysql_fetch_row_format( savignstr ) )
		{
Because for ex, i need to know what directors are in my server, and i want to show, and another stuff, when you need to load, from different places, some things and show them to player. How with threaded functions i need to do cycle?


Re: samp mysql-r35b3 - maddinat0r - 25.01.2014

Post some more code with these "cycles" and I'll convert it for you.