Beispiel #1
0
		public Driver(MySqlConnectionStringBuilder settings) {
			this.connectionString = settings;
			this.threadId = -1;
			this.serverCharSetIndex = -1;
			this.serverCharSet = null;
			this.hasWarnings = false;
			this.maxPacketSize = 0x400L;
		}
Beispiel #2
0
		public static MySqlPool GetPool(MySqlConnectionStringBuilder settings) {
			string connectionString = settings.GetConnectionString(true);
			lock (pools.SyncRoot) {
				MySqlPool pool = pools[connectionString] as MySqlPool;
				if (pool == null) {
					pool = new MySqlPool(settings);
					pools.Add(connectionString, pool);
				} else {
					pool.Settings = settings;
				}
				return pool;
			}
		}
Beispiel #3
0
		public MySqlPool(MySqlConnectionStringBuilder settings) {
			this.minSize = settings.MinimumPoolSize;
			this.maxSize = settings.MaximumPoolSize;
			this.available = (int)this.maxSize;
			this.autoEvent = new AutoResetEvent(false);
			if (this.minSize > this.maxSize) {
				this.minSize = this.maxSize;
			}
			this.settings = settings;
			this.inUsePool = new List<Driver>((int)this.maxSize);
			this.idlePool = new Queue<Driver>((int)this.maxSize);
			for (int i = 0; i < this.minSize; i++) {
				this.idlePool.Enqueue(this.CreateNewPooledConnection());
			}
			this.procedureCache = new GodLesZ.Library.MySql.Data.MySqlClient.ProcedureCache((int)settings.ProcedureCacheSize);
			this.beingCleared = false;
		}
Beispiel #4
0
		public static Driver Create(MySqlConnectionStringBuilder settings) {
			Driver driver = null;
			if (settings.DriverType == MySqlDriverType.Native) {
				driver = new NativeDriver(settings);
			}
			driver.Open();
			return driver;
		}
Beispiel #5
0
		public override void Cancel() {
			if (!this.connection.driver.Version.isAtLeast(5, 0, 0)) {
				throw new NotSupportedException(Resources.CancelNotSupported);
			}
			MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder(this.connection.Settings.GetConnectionString(true));
			builder.Pooling = false;
			using (MySqlConnection connection = new MySqlConnection(builder.ConnectionString)) {
				connection.Open();
				new MySqlCommand(string.Format("KILL QUERY {0}", this.connection.ServerThread), connection).ExecuteNonQuery();
			}
		}
Beispiel #6
0
		public NativeDriver(MySqlConnectionStringBuilder settings)
			: base(settings) {
			base.isOpen = false;
		}
Beispiel #7
0
		public MySqlConnection() {
			this.settings = new MySqlConnectionStringBuilder();
			this.advisor = new GodLesZ.Library.MySql.Data.MySqlClient.UsageAdvisor(this);
			this.database = string.Empty;
		}
Beispiel #8
0
		public static void ClearPool(MySqlConnectionStringBuilder settings) {
			ClearPoolByText(settings.GetConnectionString(true));
		}