SA-MP Forums Archive
Temporary or constant MySQL connection? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Temporary or constant MySQL connection? (/showthread.php?tid=132357)



Temporary or constant MySQL connection? - Ellis - 07.03.2010

In which cases temporary or constant MySQL connection is better? What do you preffer?


Re: Temporary or constant MySQL connection? - Carlton - 07.03.2010

It depends what you're doing. In my opinion, I think a constant MySQL connnection is better, because it's less work to keep closing the connection in re-connecting. To be honest, I don't know what you mean by temporary? Do you mean in a case where you load data from a db and close the connection?


Re: Temporary or constant MySQL connection? - Ellis - 07.03.2010

Quote:
Originally Posted by Carlton
I don't know what you mean by temporary? Do you mean in a case where you load data from a db and close the connection?
Yes.

Waiting for more opinions.


Re: Temporary or constant MySQL connection? - Carlton - 07.03.2010

Quote:
Originally Posted by Ellis
Quote:
Originally Posted by Carlton
I don't know what you mean by temporary? Do you mean in a case where you load data from a db and close the connection?
Yes.

Waiting for more opinions.
You can do that not a big problem, I just use constant for loading data, and saving it at the end when a player disconnects. So say like, you're using a temporary connection ok, and you wan't save data when a player leaves or something, the DB will keep connection and re-connecting over and over again, it's better to just leave it connected until you exit the GM or the Filterscript.


Re: Temporary or constant MySQL connection? - Ellis - 07.03.2010

Sure, i do understand that keeping MySQL connection constatly speeds things up because connecting takes a little time (not sure how much). But what about memory? Still looking forward to other's opinion.


Re: Temporary or constant MySQL connection? - Carlton - 07.03.2010

Quote:
Originally Posted by Ellis
Sure, i do understand that keeping MySQL connection constatly speeds things up because connecting takes a little time (not sure how much). But what about memory? Still looking forward to other's opinion.
No it doesn't, well, depends what plugin you're using, [RAZ]ADreNaLiNe-DJ's mysql plugin is a bit slow connecting, the others work fine. I don't know about memory though, all I know is it's not much.


Re: Temporary or constant MySQL connection? - Ellis - 07.03.2010

Does everyone think the same?