Another MySQL question - 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: Another MySQL question (
/showthread.php?tid=300130)
Another MySQL question -
hellangel - 28.11.2011
Well, I have a question
I'm using MySQL for the accounts on my gamemode, and I thread all of them. Can I run 2 queries at the SAME TIME using the same thread? I mean, let's suppose that the login query is threaded as MYSQL_THREAD_LOGIN, and then two players log in exactly at the same time, would it crash the server? Or would the plugin wait till the first query is executed?
Thanks
Re: Another MySQL question -
BlackBank - 28.11.2011
It will wait when the first query is finished. So you can't get any crashes and lag.
Re: Another MySQL question -
hellangel - 28.11.2011
Oh, okay. Now here's another example
My OnPlayerUpdateEx query is EXTREMELY BIG and it's called every 10 seconds. I divided it into 3 update queries. The main thread define (MYSQLT_UPDATEPLAYER) is defined as 12. Then I defined the first query as MYSQLT_UPDATEPLAYER + playerid + 500 (so every player will have it's own query, and the 500 is set so this query will not interfere with the other two), the second as MYSQLT_UPDATEPLAYER + playerid + 1000 and the third as MYSQLT_UPDATEPLAYER + playerid + 1500. Can I use just MYSQLT_UPDATEPLAYER for the three queries? Would it take more time to update? Am I doing something wrong? Thanks!
EDIT: I think it's better doing one thread for each player, because it crashed when 3 players logged in here, all being updated with query thread 12.