SA-MP Forums Archive
MYSQL - mysql_close() - close all connections? - 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: MYSQL - mysql_close() - close all connections? (/showthread.php?tid=580726)



MYSQL - mysql_close() - close all connections? - Adi007 - 07.07.2015

Hi all!
I have a question, i didn't found the answer on wiki.
If i open a mysql connection in my gamemode and another mysql connection in a filterscript, when i use mysql_close(); in one of them (gamemode or filterscript), the function will close only script's connection or all mysql connections started by gamemode + filterscript?

I use this: https://sampwiki.blast.hk/wiki/MySQL/R33


Re: MYSQL - mysql_close() - close all connections? - dusk - 07.07.2015

It has a parameter "connectionHandle" its the same value(which defaults to 1) returned by mysql_connect. So no, if for example a filterscript opens a connection, it will have to close it itself.


Re: MYSQL - mysql_close() - close all connections? - Adi007 - 07.07.2015

Thanks


Re: MYSQL - mysql_close() - close all connections? - Vince - 07.07.2015

It is important to note that if both scripts connect to the same database with the same user and the same password then both scripts will use the same connection handle and hence mysql_close will close the connection in both scripts. This is important to note as it can obviously cause problems. This behavior can be disabled with the "duplicate connections" option.