SA-MP Forums Archive
MySQL question.. - 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 question.. (/showthread.php?tid=368286)



MySQL question.. - Speed++ - 12.08.2012

NOTE: i use BlueG MySQL Plugin, R6

in my OnGameModeInit i have this...

pawn Код:
// mysql debug
    mysql_debug(1);
   
    // iConnectionHandle
    iConnectionHandle = mysql_connect(HOST_MySQL, USER_MySQL, DATA_MySQL, PASS_MySQL);
   
    if(mysql_ping()) print("MySQL connection is still alive!");

    if(!mysql_ping()) print("MySQL connection is dead!");
and when i load the sa-mp server.exe... print

MySQL connection is still alive!

MySQL connection is still alive!

why ??


Re: MySQL question.. - Kindred - 12.08.2012

Where is this placed? Make sure its not within a loop and shit, if you mean it keeps spamming "MySQL connection is still alive!".

You were very vague, please re-explain if this is not the correct answer.


Re: MySQL question.. - Speed++ - 12.08.2012

is placed in OnGameModeInit.. and i have no loop in the gamemode..


Re: MySQL question.. - Speed++ - 12.08.2012

help ??


Re: MySQL question.. - FalconX - 12.08.2012

Quote:
Originally Posted by Speed++
Посмотреть сообщение
help ??
pawn Код:
public OnGameModeInit()
{
    // mysql debug
    mysql_debug( 1 );

    // iConnectionHandle
    iConnectionHandle = mysql_connect( HOST_MySQL, USER_MySQL, DATA_MySQL, PASS_MySQL );

    if( mysql_ping( ) >= 1 ) // if pings are 1 or more then 1 that means the connection is alive
    {
        print( "MySQL connection is alive!" );
    }
    else // dead
    {
        print( "MySQL connection is dead!" );
    }
    return 1;
}



Re: MySQL question.. - Speed++ - 12.08.2012

Quote:
Originally Posted by FalconX
Посмотреть сообщение
pawn Код:
public OnGameModeInit()
{
    // mysql debug
    mysql_debug( 1 );

    // iConnectionHandle
    iConnectionHandle = mysql_connect( HOST_MySQL, USER_MySQL, DATA_MySQL, PASS_MySQL );

    if( mysql_ping( ) >= 1 ) // if pings are 1 or more then 1 that means the connection is alive
    {
        print( "MySQL connection is alive!" );
    }
    else // dead
    {
        print( "MySQL connection is dead!" );
    }
    return 1;
}
thanks but, does not change anything :\

image..



debug logs:

Код:
[00:24:15] ---------------------------

[00:24:15] MySQL Debugging activated (08/13/12)

[00:24:15] ---------------------------

[00:24:15]  

[00:24:15] >> mysql_connect( )

[00:24:15] CMySQLHandler::CMySQLHandler() - constructor called.

[00:24:15] CMySQLHandler::CMySQLHandler() - Connecting to "localhost" | DB: "db_test" | Username: "root" ...

[00:24:15] CMySQLHandler::Connect() - Connection was successful.

[00:24:15] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.

[00:24:15] >> mysql_ping( Connection handle: 1 )

[00:24:15] CMySQLHandler::Ping() - Connection is still alive.

[00:24:15]  

[00:24:15] ---------------------------

[00:24:15] MySQL Debugging activated (08/13/12)

[00:24:15] ---------------------------

[00:24:15]  

[00:24:15] >> mysql_connect( )

[00:24:15] CMySQLHandler::Connect() - Connection was successful.

[00:24:15] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.

[00:24:15] >> mysql_ping( Connection handle: 1 )

[00:24:15] CMySQLHandler::Ping() - Connection is still alive.

[00:28:16] >> mysql_close( Connection handle: 1 )

[00:28:16] CMySQLHandler::~CMySQLHandler() - deconstructor called.

[00:28:16] CMySQLHandler::FreeResult() - The result is already empty.

[00:28:16] CMySQLHandler::Disconnect() - Connection was closed.
logs:

Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3e-R2, ©2005-2012 SA-MP Team

[13/08/2012 00:24:15] 
[13/08/2012 00:24:15] Server Plugins
[13/08/2012 00:24:15] --------------
[13/08/2012 00:24:15]  Loading plugin: mysql
[13/08/2012 00:24:15] 

  > MySQL plugin R5 successfully loaded.

[13/08/2012 00:24:15]   Loaded.
[13/08/2012 00:24:15]  Loading plugin: Whirlpool
[13/08/2012 00:24:15]  
[13/08/2012 00:24:15]  ==================
[13/08/2012 00:24:15]  
[13/08/2012 00:24:15]   Whirlpool loaded
[13/08/2012 00:24:15]  
[13/08/2012 00:24:15]  ==================
[13/08/2012 00:24:15]  
[13/08/2012 00:24:15]   Loaded.
[13/08/2012 00:24:15]  Loaded 2 plugins.

[13/08/2012 00:24:15] 
[13/08/2012 00:24:15] Filterscripts
[13/08/2012 00:24:15] ---------------
[13/08/2012 00:24:15]   Loaded 0 filterscripts.

[13/08/2012 00:24:15] MySQL connection is alive!
[13/08/2012 00:24:15] MySQL connection is alive!
[13/08/2012 00:24:15] Number of vehicle models: 0
Console input: exit
[13/08/2012 00:28:16] --- Server Shutting Down.
[13/08/2012 00:28:16]



Re: MySQL question.. - Speed++ - 12.08.2012

mhmm ??


Re: MySQL question.. - FalconX - 12.08.2012

Quote:
Originally Posted by Speed++
Посмотреть сообщение
mhmm ??
Show us your OnGameModeInit?


Respuesta: MySQL question.. - [DOG]irinel1996 - 12.08.2012

I noticed this too, I though I was doing something wrong, but seems it's a bug?


Re: Respuesta: MySQL question.. - Speed++ - 12.08.2012

Quote:
Originally Posted by irinel1996
Посмотреть сообщение
I noticed this too, I though I was doing something wrong, but seems it's a bug?
possible, :\ i have controlled my code 100 %.. is correct..


Quote:
Originally Posted by FalconX
Посмотреть сообщение
Show us your OnGameModeInit?
yes.. this is the ongamemodeinit..

NOTE: i use BlueG MySQL Plugin, R6

pawn Код:
public OnGameModeInit()
{
    // mysql debug
    mysql_debug(1);
   
    // iConnectionHandle
    iConnectionHandle = mysql_connect(HOST_MySQL, USER_MySQL, DATA_MySQL, PASS_MySQL);

    if(mysql_ping() >= 1) // if pings are 1 or more then 1 that means the connection is alive
    {
        print("MySQL connection is alive!");
    }
    else // dead
    {
        print("MySQL connection is dead!");
    }

    // SetGameModeText
    SetGameModeText("MySQL GM WIP");

    // AddPlayerClass
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);

    return 1;
}