Posts: 737
Threads: 338
Joined: Jan 2013
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?
Posts: 526
Threads: 59
Joined: Feb 2011
Reputation:
0
What's the point in threading only part of your server queries?
I can't imagine that being very safe.
Posts: 737
Threads: 338
Joined: Jan 2013
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?
}
}
Posts: 845
Threads: 3
Joined: Jun 2010
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.
Posts: 737
Threads: 338
Joined: Jan 2013
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?
Posts: 845
Threads: 3
Joined: Jun 2010
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".
Posts: 737
Threads: 338
Joined: Jan 2013
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()?
Posts: 845
Threads: 3
Joined: Jun 2010
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).
Posts: 737
Threads: 338
Joined: Jan 2013
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?
Posts: 845
Threads: 3
Joined: Jun 2010
Post some more code with these "cycles" and I'll convert it for you.