/// <summary> /// Setup the accounts connections pool. /// </summary> /// <param name="aCount">The number of connections in the pool.</param> /// <param name="aHost">The hostname of the MySQL server</param> /// <param name="aDatabase">The database to connect to</param> /// <param name="aUsername">The username to use to connect to the database</param> /// <param name="aPassword">The password to use to connect to the database</param> /// <returns>True on success, false otherwise.</returns> public static bool SetupAccMySQL(int aCount, String aHost, String aDatabase, String aUsername, String aPassword) { sAccPool = MySqlConnectionPool.CreatePool(aCount, aHost, aDatabase, aUsername, aPassword); if (sAccPool != null) { sAccPool.Name = "Accounts"; } return(sAccPool != null); }
/// <summary> /// Setup the IP2Location connections pool. /// </summary> /// <param name="aCount">The number of connections in the pool.</param> /// <param name="aHost">The hostname of the MySQL server</param> /// <param name="aDatabase">The database to connect to</param> /// <param name="aUsername">The username to use to connect to the database</param> /// <param name="aPassword">The password to use to connect to the database</param> /// <returns>True on success, false otherwise.</returns> public static bool SetupIP2Location(int aCount, String aHost, String aDatabase, String aUsername, String aPassword) { sIP2LocPool = MySqlConnectionPool.CreatePool(aCount, aHost, aDatabase, aUsername, aPassword); if (sIP2LocPool != null) { sIP2LocPool.Name = "IP2Location"; } return(sIP2LocPool != null); }
/// <summary> /// Create a new MySQL connections pool. /// </summary> /// <param name="aCount">The number of connections in the pool.</param> /// <param name="aHost">The hostname of the MySQL server</param> /// <param name="aDatabase">The database to connect to</param> /// <param name="aUsername">The username to use to connect to the database</param> /// <param name="aPassword">The password to use to connect to the database</param> /// <returns>A MySQL connections pool on success, null otherwise.</returns> public static MySqlConnectionPool CreatePool(int aCount, String aHost, String aDatabase, String aUsername, String aPassword) { MySqlConnectionPool pool = new MySqlConnectionPool(); if (pool.Setup(aCount, aHost, aDatabase, aUsername, aPassword)) { return(pool); } pool.Dispose(); return(null); }
/// <summary> /// Create a new wrapper around a MySqlConnection for the specified pool. /// </summary> /// <param name="aPool">The pool owning the connection.</param> /// <param name="aConnection">The internal connection.</param> internal Connection(MySqlConnectionPool aPool, MySqlConnection aConnection) { mPool = aPool; mConnection = aConnection; }