[MySQL] Query not being executed?
#1

Hello,

I have this code which was working perfectly fine yesterday and all the time before, now when I started my testserver and attempted to join the game it wouldn't even let me log in because it got stuck at the query under OnPlayerConnect, here's the code:
pawn Код:
public OnPlayerConnect(playerid)
{
    GetPlayerName(playerid, MAInfo[playerid][UserName], MAX_PLAYER_NAME);
    ...
    print("Check 1");
    mysql_queryF("SELECT * FROM `masteraccounts` WHERE `AccountName` = '%s'", AccountName(playerid));
    print("Check 2");
    mysql_store_result();
    ...
    mysql_free_result();
    return 1;
}

stock AccountName(playerid)
{
    new nstring[MAX_PLAYER_NAME];
    strmid(nstring, MAInfo[playerid][UserName], 0, strlen(MAInfo[playerid][UserName]), sizeof(nstring));
    return nstring;
}

#define mysql_queryF(%0,%1)\
    do\
        {\
        CheckConnection();\
        new _string[128];\
        format(_string,sizeof(_string),%0,%1);\
        mysql_query(_string);\
        return 1;\
        }\
    while( FALSE )
   
CheckConnection()
{
    if(!mysql_ping(SQLConnection)) mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB, SQLConnection);
    if(mysql_ping(SQLConnection)) return MySQLLog("Reconnected on connection check."), 1;
    else return MySQLLog("Connection is dead, shutting server down."), SendRconCommand("exit"), 0;
}
I removed all unnecessary code as it does print "Check 1" but doesn't print "Check 2".

If anyone knows what's causing this or even better how to solve it I can't wait to hear from you!

Best regards,
Jesse

EDIT:
Full server, MySQL (Logging all instead of just errors) & custom MySQL logs;
Server log:
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3z, ©2005-2014 SA-MP Team

[18:44:52] filterscripts = ""  (string)
[18:44:52] weburl = "www.sa-mp.com"  (string)
[18:44:52] 
[18:44:52] Server Plugins
[18:44:52] --------------
[18:44:52]  Loading plugin: fixes2.dll
[18:44:52] 

[18:44:52]  ===============================

[18:44:52]        fixes plugin loaded.     

[18:44:52]    © 2012 Alex "******" Cole

[18:44:52]  ===============================

[18:44:52]   Loaded.
[18:44:52]  Loading plugin: crashdetect.dll
[18:44:52]   CrashDetect v4.10 is OK.
[18:44:52]   Loaded.
[18:44:52]  Loading plugin: Whirlpool.dll
[18:44:52]  
[18:44:52]  ==================
[18:44:52]  
[18:44:52]   Whirlpool loaded
[18:44:52]  
[18:44:52]  ==================
[18:44:52]  
[18:44:52]   Loaded.
[18:44:52]  Loading plugin: mysql.dll
[18:44:52]  SA:MP MySQL Plugin v2.1.1 Loaded.
[18:44:52]   Loaded.
[18:44:52] [MySQL] Thread running. Threadsafe: Yes.
[18:44:52]  Loading plugin: sscanf.dll
[18:44:52] 

[18:44:52]  ===============================

[18:44:52]       sscanf plugin loaded.     

[18:44:52]    © 2009 Alex "******" Cole

[18:44:52]    0.3d-R2 500 Players "dnee"

[18:44:52]  ===============================

[18:44:52]   Loaded.
[18:44:52]  Loading plugin: MapAndreas.dll
[18:44:52]   Loaded.
[18:44:52]  Loading plugin: audio.dll
[18:44:52] 

*** Audio Plugin v0.5 R2 by Incognito loaded ***

[18:44:52]   Loaded.
[18:44:52]  Loaded 7 plugins.

[18:44:52] 
[18:44:52] Filterscripts
[18:44:52] ---------------
[18:44:52]   Loaded 0 filterscripts.

[18:44:52] *** Audio Plugin: Started TCP server on port 7788
[18:44:52] [MySQL] Connected (0) to 'Admin'@'127.0.0.1 via TCP/IP'.
[18:44:52] [MySQL] Server Version 5.6.15-log.
[18:44:52] 
--------------------------------------
[18:44:52]  Map file by Jesse
[18:44:52] --------------------------------------

[18:44:52]   Filterscript 'map.amx' loaded.
[18:44:52] *** Audio_SetPack: Audio pack set to "URP_pack" (transferable and automated)
[18:44:52] [Server] Background created.
[18:44:52] 
----------------------------------
[18:44:52]  Testserver by Jesse
[18:44:52] ----------------------------------

[18:44:52] Number of vehicle models: 0
[18:45:04] Incoming connection: 192.168.0.1:58570
[18:45:05] [join] Ex0r1337 has joined the server (0:192.168.0.1)
[18:45:05] [nick] Ex0r1337 nick changed to Censored_0
[18:45:05] Check 1
[18:45:05] [MySQL] Connected (0) to 'Admin'@'127.0.0.1 via TCP/IP'.
[18:45:05] [MySQL] Server Version 5.6.15-log.
[18:45:05] --- Server Shutting Down.
[18:45:05]   Filterscript 'map.amx' unloaded.
[18:45:05] [MySQL] Closed (0). Logging ended.
[18:45:05] *** Audio Plugin: Stopped TCP server on port 7788
[18:45:05] [part] Censored_0 has left the server (0:0)
MySQL log:
Код:
[Sat Jun 14 18:44:52 2014] -------------------------
[Sat Jun 14 18:44:52 2014]      Logging Started
[Sat Jun 14 18:44:52 2014] -------------------------
[Sat Jun 14 18:44:52 2014] Function: mysql_init executed with result: "0".
[Sat Jun 14 18:44:52 2014] Connected (0) to Admin @ 127.0.0.1 via TCP/IP.
[Sat Jun 14 18:44:52 2014] MySQL Server Version 5.6.15-log.
[Sat Jun 14 18:44:52 2014] Function: mysql_query executed: "..." with result: "0".
[Sat Jun 14 18:44:52 2014] Function: mysql_query executed: "..." with result: "0".
[Sat Jun 14 18:44:52 2014] Function: mysql_query executed: "..." with result: "0".
[Sat Jun 14 18:44:52 2014] Function: mysql_query executed: "..." with result: "0".
[Sat Jun 14 18:44:52 2014] Function: mysql_store_result executed with result: "1"
[Sat Jun 14 18:44:52 2014] Function: mysql_num_rows executed with result: "".
[Sat Jun 14 18:44:52 2014] Function: mysql_free_result executed.
[Sat Jun 14 18:44:52 2014] Function: mysql_query executed: "..." with result: "0".
[Sat Jun 14 18:44:52 2014] Function: mysql_store_result executed with result: "1"
[Sat Jun 14 18:44:52 2014] Function: mysql_fetch_field executed.
[Sat Jun 14 18:44:52 2014] Function: mysql_free_result executed.
[Sat Jun 14 18:45:05 2014] Function: mysql_ping executed with result: "0".
[Sat Jun 14 18:45:05 2014] Connected (0) to Admin @ 127.0.0.1 via TCP/IP.
[Sat Jun 14 18:45:05 2014] MySQL Server Version 5.6.15-log.
[Sat Jun 14 18:45:05 2014] Function: mysql_ping executed with result: "0".
[Sat Jun 14 18:45:05 2014] Function: mysql_query executed: "SELECT * FROM `masteraccounts` WHERE `AccountName` = 'Ex0r1337'" with result: "0".
[Sat Jun 14 18:45:05 2014] Function: mysql_ping executed with result: "1".
[Sat Jun 14 18:45:05 2014] MySQL closed. Logging ended.
custom/scripted (MySQLLog function) MySQL log:
Код:
[Sunday 14 Jun, 18:44:52] Connected.
[Sunday 14 Jun, 18:44:52] Checking for table 'masteraccounts'.
[Sunday 14 Jun, 18:44:52] Table 'masteraccounts' created if not existed.
[Sunday 14 Jun, 18:44:52] Checking for table 'characters'.
[Sunday 14 Jun, 18:44:52] Table 'characters' created if not existed.
[Sunday 14 Jun, 18:44:52] Checking for table 'serverinfo'.
[Sunday 14 Jun, 18:44:52] Table 'serverinfo' created if not existed.
[Sunday 14 Jun, 18:45:4] Connection is dead, shutting server down.
Reply


Messages In This Thread
[MySQL] Connection dying? - by jessejanssen - 14.06.2014, 00:26

Forum Jump:


Users browsing this thread: 1 Guest(s)