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

            driver.Open();
            return(driver);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 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();
 }
Exemplo n.º 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);
        }
Exemplo n.º 8
0
 public NativeDriver(MySqlConnectionString settings) : base(settings)
 {
     packetSeq     = 0;
     isOpen        = false;
     maxPacketSize = 1047552;
 }
Exemplo n.º 9
0
 public NativeDriver(MySqlConnectionString settings) : base(settings)
 {
     this.packetSeq     = 0;
     this.isOpen        = false;
     this.maxPacketSize = 1047552L;
 }
Exemplo n.º 10
0
 public Driver(MySqlConnectionString settings)
 {
     encoding         = System.Text.Encoding.GetEncoding("latin1");
     connectionString = settings;
     threadId         = -1;
 }
Exemplo n.º 11
0
 public MySqlConnection()
 {
     this.settings = new MySqlConnectionString();
     this.settings.LoadDefaultValues();
 }
Exemplo n.º 12
0
 /// <include file='docs/MySqlConnection.xml' path='docs/DefaultCtor/*'/>
 public MySqlConnection()
 {
     //TODO: add event data to StateChange docs
     settings = new MySqlConnectionString();
     settings.LoadDefaultValues();
 }