MySQL connection handle.
#1

Quote:

[16:45:12] >> mysql_format( Connection handle: 76 )
[16:45:12] >> mysql_format() - Invalid connection handle. (You set: 76, Highest connection handle ID is 1).
[16:45:12] >> mysql_query_callback( Connection handle: 76 )
[16:45:12] >> mysql_query_callback() - Invalid connection handle. (You set: 76, Highest connection handle ID is 1).
[16:45:31] >> mysql_format( Connection handle: 76 )
[16:45:31] >> mysql_format() - Invalid connection handle. (You set: 76, Highest connection handle ID is 1).
[16:45:31] >> mysql_query_callback( Connection handle: 76 )
[16:45:31] >> mysql_query_callback() - Invalid connection handle. (You set: 76, Highest connection handle ID is 1).
[16:45:31] >> mysql_close( Connection handle: 76 )
[16:45:31] >> mysql_close() - Invalid connection handle. (You set: 76, Highest connection handle ID is 1).

Hello. Today I wanted to test some of my scripts, the problem is that whole mysql system is being ruint because connection handle somewhy changes when a player connects. I've did some debugs:


pawn Код:
stock ConnectToMySQL()
{
    mysqlHandle = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_DB, MYSQL_PASS);
    mysql_debug(true);
   
    printf("Handle # OGI # 1: %d", mysqlHandle);

    if (mysqlHandle > 0)
    {
        // connect success
        printf("Handle # OGI # 2: %d" mysqlHandle);
    }
   
    else
    {
        // something wrong with the connection
        printf("Handle # OGI # 3: %d", mysqlHandle);
        SendRconCommand("exit");
        return (true);
    }
   
    printf("Handle # OGI # 4: %d", mysqlHandle);
   
    return (true);
}
pawn Код:
public OnPlayerConnect(playerid)
{
    printf("Handle # OPC # 1: %d", mysqlHandle);
           <...> code
    printf("Handle # OPC # 2: %d", mysqlHandle);
    return (true);
}
pawn Код:
Hook:user_OnPlayerConnect(playerid)
{
    printf("Handle # OPC # 3: %d", mysqlHandle);
    <..>code
    printf("Handle # OPC # 4: %d", mysqlHandle);
    return (true);
}
Results:

Quote:

[16:44:35] Handle # OGI # 1: 1
[16:44:35] Handle # OGI # 2: 1
[16:44:35] Handle # OGI # 4: 1
[16:45:08] Handle # OPC # 3: 76
[16:45:08] Handle # OPC # 4: 76
[16:45:08] Handle # OPC # 1: 76
[16:45:08] Handle # OPC # 2: 76
[16:45:11] Handle # OPC # 5: 76
[16:45:11] Handle # OPC # 6: 76
[16:45:12] Handle # OPC # 7: 76
[16:45:12] Handle # OPC # 8: 76

Reply
#2

Bump
Reply
#3

Quote:

Note: Every function except mysql_connect(...) and mysql_debug() has connectionHandle parameter. If you use only one database connection you don't need to mind it. Connection handle is 1 by default.

Any help for you? :P (read it on the wiki) Check your scripts for the value 76, and find the lines that might interfere with your codes.
Reply
#4

Okay, I thought its changed in R7 plugin, anyway I'll try. Thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)