Exemplo n.º 1
0
 public Driver(MySqlConnectionStringBuilder settings)
 {
   encoding = Encoding.GetEncoding(1252);
   if (encoding == null)
     throw new MySqlException(Resources.DefaultEncodingNotFound);
   connectionString = settings;
   serverCharSet = "latin1";
   serverCharSetIndex = -1;
   maxPacketSize = 1024;
   handler = new NativeDriver(this);
 }
Exemplo n.º 2
0
    public MySqlPool(MySqlConnectionStringBuilder settings)
    {
      minSize = settings.MinimumPoolSize;
      maxSize = settings.MaximumPoolSize;

      available = (int)maxSize;
      autoEvent = new AutoResetEvent(false);

      if (minSize > maxSize)
        minSize = maxSize;
      this.settings = settings;
      inUsePool = new List<Driver>((int)maxSize);
      idlePool = new Queue<Driver>((int)maxSize);

      // prepopulate the idle pool to minSize
      for (int i = 0; i < minSize; i++)
        EnqueueIdle(CreateNewPooledConnection());

      procedureCache = new ProcedureCache((int)settings.ProcedureCacheSize);
    }
Exemplo n.º 3
0
        //internal static string connString;

        private void createNewConnectionString()
        {
            MySqlConnectionStringBuilder connectionString = new MySqlConnectionStringBuilder
            {
				ServerEndPoint = this.server.getHost(),
				ServerPort = this.server.getPort(),
                UserID = this.server.getUsername(),
                Database = this.server.getDatabaseName(),
                MinimumPoolSize = this.maxPoolSize / 2,
                MaximumPoolSize = this.maxPoolSize,
                AllowZeroDateTime = true,
                ConvertZeroDateTime = true,
                DefaultCommandTimeout = 300,
                ConnectionTimeout = 10
            };
            //connString = connectionString.ToString();
            string test = connectionString.GetConnectionString(true);
            MySqlConnection.CurrentStringBuilder = connectionString;
            
        }
Exemplo n.º 4
0
 internal void Serialize(MySqlPacket packet, bool binary, MySqlConnectionStringBuilder settings)
 {
     if (!binary && (paramValue == null || paramValue == DBNull.Value))
     packet.WriteStringNoNull("NULL");
       else
       {
     if (ValueObject.MySqlDbType == MySqlDbType.Guid)
     {
       MySqlGuid g = (MySqlGuid)ValueObject;
       g.OldGuids = settings.OldGuids;
       valueObject = g;
     }
     ValueObject.WriteValue(packet, binary, paramValue, size);
       }
 }
Exemplo n.º 5
0
 public TracingDriver(MySqlConnectionStringBuilder settings)
     : base(settings)
 {
     driverId = Interlocked.Increment(ref driverCounter);
 }
Exemplo n.º 6
0
		public MySqlConnection()
		{
			settings = CurrentStringBuilder;
			if (settings.Database != null && settings.Database.Length > 0)
				this.database = settings.Database;
		}
Exemplo n.º 7
0
    public static Driver Create(MySqlConnectionStringBuilder settings)
    {
      Driver d = null;
      if (d == null)
        d = new Driver(settings);

      d.Open();
      return d;
    }