Exemplo n.º 1
0
Arquivo: Field.cs Projeto: BjkGkh/R106
 public MySqlField(Driver driver)
 {
   this.driver = driver;
   connVersion = driver.Version;
   maxLength = 1;
   binaryOk = true;
 }
Exemplo n.º 2
0
 public NativeDriver(Driver owner)
 {
     this.owner = owner;
     threadId = -1;
 }
Exemplo n.º 3
0
 private void EnqueueIdle(Driver driver)
 {
   driver.IdleSince = DateTime.Now;
   idlePool.Enqueue(driver);
 }
Exemplo n.º 4
0
    /// <summary>
    /// Removes a connection from the in use pool.  The only situations where this method 
    /// would be called are when a connection that is in use gets some type of fatal exception
    /// or when the connection is being returned to the pool and it's too old to be 
    /// returned.
    /// </summary>
    /// <param name="driver"></param>
    public void RemoveConnection(Driver driver)
    {
      lock ((inUsePool as ICollection).SyncRoot)
      {
        if (inUsePool.Contains(driver))
        {
          inUsePool.Remove(driver);
          Interlocked.Increment(ref available);
          autoEvent.Set();
        }
      }

      // if we are being cleared and we are out of connections then have
      // the manager destroy us.
      if (beingCleared && NumConnections == 0)
        MySqlPoolManager.RemoveClearedPool(this);
    }
Exemplo n.º 5
0
    public void ReleaseConnection(Driver driver)
    {
      lock ((inUsePool as ICollection).SyncRoot)
      {
        if (inUsePool.Contains(driver))
          inUsePool.Remove(driver);
      }

      if (driver.ConnectionLifetimeExpired() || beingCleared)
      {
        driver.Close();
        Debug.Assert(!idlePool.Contains(driver));
      }
      else
      {
        lock ((idlePool as ICollection).SyncRoot)
        {
          EnqueueIdle(driver);
        }
      }

      Interlocked.Increment(ref available);
      autoEvent.Set();
    }
Exemplo n.º 6
0
    public static Driver Create(MySqlConnectionStringBuilder settings)
    {
      Driver d = null;
      if (d == null)
        d = new Driver(settings);

      d.Open();
      return d;
    }