PDA

View Full Version : Multithreading MySQL Module


Geesu
03-12-2004, 08:55
Is this a possiblity for AMX Mod X? I have loved MySQL but at the same time hated it because of how it functions. I hate how when you try to execute a query the server almost just stops until the call is done. So if you're ping to the MySQL server isn't great, then you're pretty much screwed and can't use it.

Is this a possibility?

Geesu
03-14-2004, 12:53
*BUMP*

Johnny got his gun
03-14-2004, 14:18
Tehre is already a mthread module over at amxmod.net, it worked pretty good.

Geesu
03-14-2004, 14:48
Nah, not if you want to call 32 sql statements.. IE: saving race information for 32 players at the end of each round. It would crash everytime. I tried EVERYTHING possibly on that module, it was not good at all.

BAILOPAN
03-14-2004, 15:06
You can construct one mysql statement to do 32 operations.

MagicShot
03-14-2004, 16:17
You can construct one mysql statement to do 32 operations.

Wanan share on how I knew it could be done but never done it... haven't did any programing in like atleast 5 years either :( I am getting rusty..

Geesu
03-14-2004, 22:07
You can modify 32 different records in one statement? Ok that would be AWESOME!

BAILOPAN
03-14-2004, 22:46
Sorry, I was being a little vague.

First: you should be able to concatenate multiple queries like this:
Query1; Query2; Query3; Query4; this lumping them all into one big string.

Otherwise, you can delete everything, and just use the extended insert syntax each round:
INSERT INTO db VALUES (set1) (set2) (set3) (set4) (set5) ... (set32)

Geesu
03-14-2004, 23:02
I tried doing 2 statements w/semicolons and it didn't work for me.

DopeFish
03-15-2004, 05:05
Sorry, I was being a little vague.

First: you should be able to concatenate multiple queries like this:
Query1; Query2; Query3; Query4; this lumping them all into one big string.

that's still 32 SQL statements, they are just thrown out all at the same time and run after each other. not sure how efficient that would be compared to having the 32 statements all run at the same time. Kind of defeats the purpose of multithreading ;) since you have to wait for the statements all to finish when posting one whole chunk you have to hope the map doesn't change before it's done or else your plugin won't be there to handle the task being ended.


Otherwise, you can delete everything, and just use the extended insert syntax each round:
INSERT INTO db VALUES (set1) (set2) (set3) (set4) (set5) ... (set32)
that of course works but unfortunatly won't work with our problem. the DB contains multiple entries for each player (depending on how popular the server is, generally entries for a few thousand players). only the entries for the players currently playing need to be changed.