Пример #1
0
        public static Driver GetConnection(MySqlConnectionString settings)
        {
            // make sure the manager is initialized
            if (MySqlPoolManager.pools == null)
            {
                MySqlPoolManager.Initialize();
            }

            string text = settings.GetConnectionString(true);

            lock (pools.SyncRoot)
            {
                MySqlPool pool;
                if (!pools.Contains(text))
                {
                    pool = new MySqlPool(settings);
                    pools.Add(text, pool);
                }
                else
                {
                    pool          = (pools[text] as MySqlPool);
                    pool.Settings = settings;
                }

                return(pool.GetConnection());
            }
        }