Problem using 2 database connections with a gamemode and filterscript -
VIRUXE - 18.09.2010
Hi there,
I'm creating a filterscript for my server and that filterscript uses a different database connection than my gamemode.
The thing is that the filterscript and gamemode connection are working fine but since the filterscript loads first, when a query from the gamemode gets executed it executes the query using the filterscript's database and not the gamemode's one.
Here is an example of what I'm saying:
[20:28:13] >> mysql_connect( )
[20:28:13] CMySQLHandler::CMySQLHandler() - constructor called.
[20:28:13] -- Connecting to "x" | DB: "x" | Username: "x" ...
[20:28:13] CMySQLHandler::Connect() - Connection was successful.
[20:28:13] >> mysql_ping( Connection handle: 1 )
[20:28:13] CMySQLHandler::Ping() - Connection is still alive.
[20:28:13] >> mysql_connect( )
[20:28:13] CMySQLHandler::CMySQLHandler() - constructor called.
[20:28:13] -- Connecting to "y" | DB: "y" | Username: "y" ...
[20:28:13] CMySQLHandler::Connect() - Connection was successful.
[20:28:13] >> mysql_query( Connection handle: 1 )
[20:28:14] CMySQLHandler::Query(SELECT id, x,y,z, objectid FROM lockers ORDER BY id ASC) - An error has occured. (Error ID: 1146, Table 'x.lockers' doesn't exist)
[20:28:14] >> mysql_store_result( Connection handle: 1 )
[20:28:14] CMySQLHandler::StoreResult() - No data to store.
[20:28:14] >> mysql_fetch_row_format( Connection handle: 1 )
[20:28:14] CMySQLHandler::FetchRow() - You cannot call this function now. (Reason: Empty Result)
[20:28:14] >> mysql_free_result( Connection handle: 1 )
[20:28:14] CMySQLHandler::FreeResult() - The result is already empty.
Does anyone know a solution for this?
Thanks.
Re: Problem using 2 database connections with a gamemode and filterscript -
VIRUXE - 19.09.2010
Really, no-one experienced this already?
Re: Problem using 2 database connections with a gamemode and filterscript -
tjying95 - 19.09.2010
save the connection handler to a variable (on the mysql_connect() i think) and use it for each database
Re: Problem using 2 database connections with a gamemode and filterscript -
VIRUXE - 19.09.2010
Already tried it with the filterscript. I'm doing to do that with the gamemode later on just to eliminate that option.