MySQL connects two times - 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 connects two times (
/showthread.php?tid=627242)
MySQL connects two times -
poorgentleman - 25.01.2017
Hello, i have really strange problem. My MySQL connects two times, when i run samp server. Firstly, i thought its smth wrong in my code, so i created new one, where i wrote only mysql connect function and issue is still alive. For example, in my orginal script i have loading vehicles from database and it loads vehicles 2 times. Where is the problem? Here is clean mysql connect code, which i used.
MySQL include from BlueG(the newest one).
Код:
#include <a_samp>
#include <a_mysql>
new MySQL:test_SQL;
#define mysql_user "root"
#define mysql_password ""
#define mysql_host "localhost"
#define mysql_db "test"
main();
public OnGameModeInit()
{
test_SQL = mysql_connect(mysql_host, mysql_user, mysql_password, mysql_db);
if (test_SQL == MYSQL_INVALID_HANDLE || mysql_errno(test_SQL) != 0)
{
print("Nope");
return 1;
}
else
print("Connected");
return 1;
}
public OnGameModeExit()
{
mysql_close(test_SQL);
return 1;
}
server log:
Код:
SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team
[16:21:57] filterscripts = "" (string)
[16:21:57]
[16:21:57] Server Plugins
[16:21:57] --------------
[16:21:57] Loading plugin: mysql
[16:21:57] >> plugin.mysql: R41-2 successfully loaded.
[16:21:57] Loaded.
[16:21:57] Loading plugin: crashdetect
[16:21:57] CrashDetect v4.18 is OK.
[16:21:57] Loaded.
[16:21:57] Loaded 2 plugins.
[16:21:57]
[16:21:57] Filterscripts
[16:21:57] ---------------
[16:21:57] Loaded 0 filterscripts.
[16:21:58] Connected
[16:21:58] Connected
[16:21:58] Number of vehicle models: 0
Re: MySQL connects two times -
Vince - 25.01.2017
Number of connections is dependent on the pool_size parameter in mysql_connect and by default this is set to 2. These additional connections are used with mysql_pquery.