예제 #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());
            }
        }
예제 #2
0
 public Driver(MySqlConnectionString settings)
 {
     this.encoding         = Encoding.GetEncoding("latin1");
     this.connectionString = settings;
     this.threadId         = -1;
     this.selectLimit      = -1;
 }
예제 #3
0
        public static Driver Create(MySqlConnectionString settings)
        {
            Driver driver = new NativeDriver(settings);

            driver.Open();
            return(driver);
        }
예제 #4
0
        public static Driver Create(MySqlConnectionString settings)
        {
            Driver d;

//			if (settings.Protocol == ConnectionProtocol.Client)
//				d = new ClientDriver( settings );
//			else
            d = new NativeDriver(settings);
            d.Open();
            return(d);
        }
예제 #5
0
        public MySqlPool(MySqlConnectionString settings)
        {
            minSize       = settings.MinPoolSize;
            maxSize       = settings.MaxPoolSize;
            this.settings = settings;
            inUsePool     = new ArrayList(maxSize);
            idlePool      = new Queue(maxSize);

            // prepopulate the idle pool to minSize
            for (int i = 0; i < minSize; i++)
            {
                CreateNewPooledConnection();
            }
        }
예제 #6
0
 public MySqlPool(MySqlConnectionString settings)
 {
     this.minSize   = settings.MinPoolSize;
     this.maxSize   = settings.MaxPoolSize;
     this.settings  = settings;
     this.inUsePool = new ArrayList(this.maxSize);
     this.idlePool  = new Queue(this.maxSize);
     for (int i = 0; i < this.minSize; i++)
     {
         this.CreateNewPooledConnection();
     }
     this.procedureCache = new ProcedureCache(settings.ProcedureCacheSize);
     this.poolGate       = new Semaphore(this.maxSize, this.maxSize);
     this.lockObject     = new object();
 }
예제 #7
0
        public static MySqlPool GetPool(MySqlConnectionString settings)
        {
            string    connectionString = settings.GetConnectionString(true);
            MySqlPool result;

            lock (MySqlPoolManager.pools.SyncRoot)
            {
                MySqlPool mySqlPool;
                if (!MySqlPoolManager.pools.Contains(connectionString))
                {
                    mySqlPool = new MySqlPool(settings);
                    MySqlPoolManager.pools.Add(connectionString, mySqlPool);
                }
                else
                {
                    mySqlPool          = (MySqlPoolManager.pools[connectionString] as MySqlPool);
                    mySqlPool.Settings = settings;
                }
                result = mySqlPool;
            }
            return(result);
        }
예제 #8
0
 public NativeDriver(MySqlConnectionString settings) : base(settings)
 {
     packetSeq     = 0;
     isOpen        = false;
     maxPacketSize = 1047552;
 }
예제 #9
0
 public NativeDriver(MySqlConnectionString settings) : base(settings)
 {
     this.packetSeq     = 0;
     this.isOpen        = false;
     this.maxPacketSize = 1047552L;
 }
예제 #10
0
 public Driver(MySqlConnectionString settings)
 {
     encoding         = System.Text.Encoding.GetEncoding("latin1");
     connectionString = settings;
     threadId         = -1;
 }
예제 #11
0
 public MySqlConnection()
 {
     this.settings = new MySqlConnectionString();
     this.settings.LoadDefaultValues();
 }
예제 #12
0
 /// <include file='docs/MySqlConnection.xml' path='docs/DefaultCtor/*'/>
 public MySqlConnection()
 {
     //TODO: add event data to StateChange docs
     settings = new MySqlConnectionString();
     settings.LoadDefaultValues();
 }