Im wondering, when you make a connection to a database and you lose connection to it, will it auto-reconnect on the next map start, or do I have to connect again?
Example, do I have to do this or can I get rid of the "OnMapStart()"?
Code:
Database g_hDatabase = null;
public void OnPluginStart()
{
Database.Connect(SQL_Connection, "db");
}
public void OnMapStart()
{
if (g_hDatabase == null)
{
Database.Connect(SQL_Connection, "db");
}
}
public void SQL_Connection(Database hDatabase, const char[] sError, int iData)
{
if (hDatabase == null)
{
ThrowError(sError);
}
else
{
g_hDatabase = hDatabase;
PrintToServer("[SQL] Connected to DB.");
return;
}
}