Problem using 2 database connections with a gamemode and filterscript
#1

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.
Reply
#2

Really, no-one experienced this already?
Reply
#3

save the connection handler to a variable (on the mysql_connect() i think) and use it for each database
Reply
#4

Already tried it with the filterscript. I'm doing to do that with the gamemode later on just to eliminate that option.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)