/// <summary>
/// This method sets up the database connection string based on the
/// default connection information set for the MySQL plugin.
///
/// The pool size of 3 is based on :
///
/// - One connection for polling for input by the GameWorldManager
/// synchronization thread.
///
/// - One connection for background ad-hoc queries kicked off by the
/// server communicator on work items (account record lookup, etc.).
///
/// - One connection for miscellaneous use.
/// </summary>
private void SetupConnectionString()
{
SystemInfo.SQLConnectionSettings ConnectionSettings = SystemInfo.GetSQLConnectionSettings();
ConnectionString = String.Format("Server={0};Uid={1};Password={2};Allow Batch=true;Treat Tiny As Boolean=false",
ConnectionSettings.Server,
ConnectionSettings.User,
ConnectionSettings.Password,
ConnectionSettings.Schema);
//
// If a dedicated connection is not in use, prepend the database
// with a USE statement to slightly increase performance.
//
if (Dedicated == false)
{
ConnectionString += ";Max Pool Size=3;Pooling=true";
this.DatabaseName = ConnectionSettings.Schema;
this.QueryPrepend = String.Format("USE {0}; ", DatabaseName);
}
else
{
//
// Explicitly set the database for a dedicated connection.
//
ConnectionString += String.Format(";Database={0}", ConnectionSettings.Schema);
}
}