SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 30/07/2015, 07:13 PM   #1
Rise_above_hate
Little Clucker
 
Rise_above_hate's Avatar
 
Join Date: Jul 2012
Location: Tunisia
Posts: 25
Reputation: -9
Default Some Questions aBout Threaded Queries

What is Threaded Queries?
And What does it do?
How to Do it?
__________________
Rise_above_hate is offline   Reply With Quote
Old 30/07/2015, 07:30 PM   #2
Jacket
Little Clucker
 
Join Date: Jul 2015
Posts: 16
Reputation: 1
Default Re: Some Questions aBout Threaded Queries

Threaded queries are queries that respond quickly which means they are fast, and are used for loading or saving data in MySQL, just like a normal query. Here is a tutorial on how to make a script with MySQL threaded queries.

http://forum.sa-mp.com/showthread.php?t=574714
Jacket is offline   Reply With Quote
Old 30/07/2015, 07:38 PM   #3
Rise_above_hate
Little Clucker
 
Rise_above_hate's Avatar
 
Join Date: Jul 2012
Location: Tunisia
Posts: 25
Reputation: -9
Default Re : Re: Some Questions aBout Threaded Queries

Quote:
Originally Posted by Jacket View Post
Threaded queries are queries that respond quickly which means they are fast, and are used for loading or saving data in MySQL, just like a normal query. Here is a tutorial on how to make a script with MySQL threaded queries.

http://forum.sa-mp.com/showthread.php?t=574714
thx but , he Didn't Say exactly Whats The Thing that Makes your System Threaded,
is it that Accountcheck Forwards and else?
__________________
Rise_above_hate is offline   Reply With Quote
Old 30/07/2015, 07:44 PM   #4
!damo!spiderman
Huge Clucker
 
!damo!spiderman's Avatar
 
Join Date: Oct 2006
Posts: 244
Reputation: 160
Default Re: Some Questions aBout Threaded Queries

Threaded queries run on a separate thread in the background. Basically SA-MP server is a single threaded program by default, which means any functions you run have to wait in turn to get executed. What the mysql plugin does is it allows you to run a query on a separate thread, so it means that if your query takes too long it's not going to block the main thread causing it to freeze and lag, instead it will execute the query in the background and then notify that it is done via a callback.
__________________
!damo!spiderman is offline   Reply With Quote
Old 30/07/2015, 07:51 PM   #5
Rise_above_hate
Little Clucker
 
Rise_above_hate's Avatar
 
Join Date: Jul 2012
Location: Tunisia
Posts: 25
Reputation: -9
Default Re : Re: Some Questions aBout Threaded Queries

Quote:
Originally Posted by !damo!spiderman View Post
Threaded queries run on a separate thread in the background. Basically SA-MP server is a single threaded program by default, which means any functions you run have to wait in turn to get executed. What the mysql plugin does is it allows you to run a query on a separate thread, so it means that if your query takes too long it's not going to block the main thread causing it to freeze and lag, instead it will execute the query in the background and then notify that it is done via a callback.
Well Explained! Thanks!
But , can you asnwer my question please
That Accountcheck and Register Forwards And Stocks are the ones That Makes the Threaded Queries on my script?
__________________
Rise_above_hate is offline   Reply With Quote
Old 30/07/2015, 08:38 PM   #6
!damo!spiderman
Huge Clucker
 
!damo!spiderman's Avatar
 
Join Date: Oct 2006
Posts: 244
Reputation: 160
Default Re: Some Questions aBout Threaded Queries

Those functions are the ones that get called after the query is finished.

mysql_tquery(mysql, query, "OnAccountCheck", "i", playerid);

That function there is the threaded query function. You can see that it calls OnAccountCheck after the query has finished.
__________________
!damo!spiderman is offline   Reply With Quote
Old 30/07/2015, 08:48 PM   #7
Rise_above_hate
Little Clucker
 
Rise_above_hate's Avatar
 
Join Date: Jul 2012
Location: Tunisia
Posts: 25
Reputation: -9
Default Re : Some Questions aBout Threaded Queries

Thanks,
Another question,
is MellAdmin System using Threaded Queries?
I Noticed it does use this
#define _THREAD_LOAD_PLAYER (0)
#define _THREAD_SAVE_PLAYER (1)
#define _THREAD_CREATE_PLAYER (2)
#define _THREAD_ACCOUNT_EXIST (3)
#define _FETCH_PLAYER_INFO (4)
#define _FETCH_BAN_STAT (5)
#define _UPDATE_PLAYER_PW (6)
#define _THREAD_IS_BANNED (7)
#define _CHECK_PASSWORD (
#define _THREAD_BAN_USER (9)
#define _CHECK_AUTO_LOGIN (10)
#define _THREAD_PLAYER_LOGIN (11)
#define _THREAD_PLAYER_LOGOUT (12)
__________________
Rise_above_hate is offline   Reply With Quote
Old 30/07/2015, 10:45 PM   #8
!damo!spiderman
Huge Clucker
 
!damo!spiderman's Avatar
 
Join Date: Oct 2006
Posts: 244
Reputation: 160
Default Re: Some Questions aBout Threaded Queries

It looks that way as they use the MySQL plugin and having defines like that seem to point to that but I can't be sure as the filterscript has been depreciated and the source code removed due to security issues.
__________________
!damo!spiderman is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
About threaded queries. audriuxxx Scripting Help 1 09/02/2014 10:19 AM
MySQL Threaded Queries CONTROLA Scripting Help 4 25/11/2012 03:02 PM
Threaded and non threaded queries CoDeZ Scripting Help 3 12/09/2012 01:17 PM
Threaded Queries C0dy09 Scripting Help 3 08/05/2012 01:41 PM
Threaded queries armyoftwo Help Archive 0 11/12/2010 01:49 PM


All times are GMT. The time now is 11:36 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.