Пример #1
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="Shared">Controls whether the connector can be shared.</param>
 public NpgsqlConnector(NpgsqlConnectionStringBuilder ConnectionString, bool Pooled, bool Shared)
 {
     this.settings = ConnectionString;
     State = ConnectionState.Closed;
     _pooled = Pooled;
     _shared = Shared;
     _isInitialized = false;
     _state = NpgsqlClosedState.Instance;
     _mediator = new NpgsqlMediator();
     _oidToNameMapping = new NpgsqlBackendTypeMapping();
     _planIndex = 0;
     _portalIndex = 0;
     _notificationThreadStopCount = 1;
     _notificationAutoResetEvent = new AutoResetEvent(true);
 }
Пример #2
0
		/// <summary>
		/// This method changes the current database by disconnecting from the actual
		/// database and connecting to the specified.
		/// </summary>
		/// <param name="dbName">The name of the database to use in place of the current database.</param>
		public override void ChangeDatabase(String dbName)
		{
			CheckNotDisposed();

			if (dbName == null)
			{
				throw new ArgumentNullException("dbName");
			}

			if (string.IsNullOrEmpty(dbName))
			{
				throw new ArgumentOutOfRangeException(String.Format(resman.GetString("Exception_InvalidDbName"), dbName), "dbName");
			}

			String oldDatabaseName = Database;

			Close();

			settings = settings.Clone();
			settings[Keywords.Database] = dbName;

			Open();
		}
		/// <summary>
		/// Return an exact copy of this NpgsqlConnectionString.
		/// </summary>
		public NpgsqlConnectionStringBuilder Clone()
		{
			NpgsqlConnectionStringBuilder builder = new NpgsqlConnectionStringBuilder();
			foreach (string key in this.Keys)
			{
				builder[key] = this[key];
			}
			return builder;
		}
Пример #4
0
		private NpgsqlConnection(NpgsqlConnectionStringBuilder builder)
		{
			this.settings = builder;

			NoticeDelegate = new NoticeEventHandler(OnNotice);
			NotificationDelegate = new NotificationEventHandler(OnNotification);

			ProvideClientCertificatesCallbackDelegate = new ProvideClientCertificatesCallback(DefaultProvideClientCertificatesCallback);
			CertificateValidationCallbackDelegate = new CertificateValidationCallback(DefaultCertificateValidationCallback);
			CertificateSelectionCallbackDelegate = new CertificateSelectionCallback(DefaultCertificateSelectionCallback);
			PrivateKeySelectionCallbackDelegate = new PrivateKeySelectionCallback(DefaultPrivateKeySelectionCallback);

			// Fix authentication problems. See https://bugzilla.novell.com/show_bug.cgi?id=MONO77559 and 
			// http://pgfoundry.org/forum/message.php?msg_id=1002377 for more info.
			RSACryptoServiceProvider.UseMachineKeyStore = true;

			promotable = new NpgsqlPromotableSinglePhaseNotification(this);
		}