0

已解决

我有一个 C++ 代码:

int sq_mysql_connect(vm S)
{
    CHECK_PARAMS( 4 );

    const char* hostname;
    const char* username;
    const char* password;
    const char* database;

    GET_STRING( 1, hostname );
    GET_STRING( 2, username );
    GET_STRING( 3, password );
    GET_STRING( 4, database );

    MySQL* handler = new MySQL( hostname, username, password, database );
    if( handler->OK( ) )
    {
            handlers.push_back( handler );
            sq_pushuserpointer( S, handler );
    }
    else
    {
            LogPrintf( "MySQL Connection failed (#%d): %s", handler->Errno( ), handler->Error( ) );
            delete handler;
            sq_pushbool( S, false );
    }
    return 1;
}

当我运行它时,它说:

*MySQL Connection failed (#2058): This handle is already connected. Use a separate handle for each connection.*

编辑:它也写: http: //pastebin.com/ByCYTPMr

但是没有 GET_STRING 它不会写入 MySQL 错误。

4

0 回答 0