public void Detach()
        {
            try
            {
                _database.XdrStream.Write(IscCodes.op_service_detach);
                _database.XdrStream.Write(Handle);
                _database.XdrStream.Write(IscCodes.op_disconnect);
                _database.XdrStream.Flush();

                _handle = 0;
            }
            catch (IOException ex)
            {
                throw IscException.ForErrorCode(IscCodes.isc_network_error, ex);
            }
            finally
            {
                try
                {
                    _connection.Disconnect();
                }
                catch (IOException ex)
                {
                    throw IscException.ForErrorCode(IscCodes.isc_network_error, ex);
                }
                finally
                {
                    _database   = null;
                    _connection = null;
                }
            }
        }
        private void Dispose(bool disposing)
        {
            lock (_stateSyncRoot)
            {
                if (!_disposed)
                {
                    try
                    {
                        // release any unmanaged resources
                        Rollback();
                    }
                    catch
                    {
                    }
                    finally
                    {
                        // release any managed resources
                        if (disposing)
                        {
                            _database = null;
                            _handle   = 0;
                            _state    = TransactionState.NoTransaction;
                        }

                        _disposed = true;
                    }
                }
            }
        }
示例#3
0
        public override void Detach()
        {
            try
            {
                _database.Xdr.Write(IscCodes.op_service_detach);
                _database.Xdr.Write(Handle);
                _database.Xdr.Write(IscCodes.op_disconnect);
                _database.Xdr.Flush();

                Handle = 0;
            }
            catch (IOException ex)
            {
                throw IscException.ForIOException(ex);
            }
            finally
            {
                try
                {
                    _connection.Disconnect();
                }
                catch (IOException ex)
                {
                    throw IscException.ForIOException(ex);
                }
                finally
                {
                    _database   = null;
                    _connection = null;
                }
            }
        }
        public GdsStatement(IDatabase db, ITransaction transaction)
        {
            if (!(db is GdsDatabase))
            {
                throw new ArgumentException("Specified argument is not of GdsDatabase type.");
            }
            if (transaction != null && !(transaction is GdsTransaction))
            {
                throw new ArgumentException("Specified argument is not of GdsTransaction type.");
            }

            this.handle          = IscCodes.INVALID_OBJECT;
            this.RecordsAffected = -1;
            this.fetchSize       = 200;
            this.rows            = new Queue <DbValue[]>();
            this.outputParams    = new Queue <DbValue[]>();

            this.database = (GdsDatabase)db;

            if (transaction != null)
            {
                this.Transaction = transaction;
            }

            GC.SuppressFinalize(this);
        }
        public void Detach()
        {
            lock (this)
            {
                try
                {
                    _database.Write(IscCodes.op_service_detach);
                    _database.Write(Handle);
                    _database.Write(IscCodes.op_disconnect);
                    _database.Flush();

                    _handle = 0;
                }
                catch (IOException)
                {
                    throw new IscException(IscCodes.isc_network_error);
                }
                finally
                {
                    try
                    {
                        _connection.Disconnect();
                    }
                    catch (IOException)
                    {
                        throw new IscException(IscCodes.isc_network_error);
                    }
                    finally
                    {
                        _database   = null;
                        _connection = null;
                    }
                }
            }
        }
        private void Dispose(bool disposing)
        {
            lock (stateSyncRoot)
            {
                if (!this.disposed)
                {
                    try
                    {
                        // release any unmanaged resources
                        this.Rollback();
                    }
                    catch
                    {
                    }
                    finally
                    {
                        // release any managed resources
                        if (disposing)
                        {
                            this.database = null;
                            this.handle   = 0;
                            this.state    = TransactionState.NoTransaction;
                        }

                        this.disposed = true;
                    }
                }
            }
        }
示例#7
0
        public GdsStatement(IDatabase db, ITransaction transaction)
        {
            if (!(db is GdsDatabase))
            {
                throw new ArgumentException("Specified argument is not of GdsDatabase type.");
            }
            if (transaction != null && !(transaction is GdsTransaction))
            {
                throw new ArgumentException("Specified argument is not of GdsTransaction type.");
            }

            this.handle = IscCodes.INVALID_OBJECT;
            this.RecordsAffected = -1;
            this.fetchSize		= 200;
            this.rows			= new Queue<DbValue[]>();
            this.outputParams	= new Queue<DbValue[]>();

            this.database = (GdsDatabase)db;

            if (transaction != null)
            {
                this.Transaction = transaction;
            }

            GC.SuppressFinalize(this);
        }
示例#8
0
        public virtual async Task Detach(AsyncWrappingCommonArgs async)
        {
            try
            {
                await _database.Xdr.Write(IscCodes.op_service_detach, async).ConfigureAwait(false);

                await _database.Xdr.Write(Handle, async).ConfigureAwait(false);

                await _database.Xdr.Write(IscCodes.op_disconnect, async).ConfigureAwait(false);

                await _database.Xdr.Flush(async).ConfigureAwait(false);

                _handle = 0;
            }
            catch (IOException ex)
            {
                throw IscException.ForErrorCode(IscCodes.isc_network_error, ex);
            }
            finally
            {
                try
                {
                    await _connection.Disconnect(async).ConfigureAwait(false);
                }
                catch (IOException ex)
                {
                    throw IscException.ForErrorCode(IscCodes.isc_network_error, ex);
                }
                finally
                {
                    _database   = null;
                    _connection = null;
                }
            }
        }
示例#9
0
        public async Task Open(AsyncWrappingCommonArgs async)
        {
            var connection = new GdsConnection(_ipAddress, _portNumber, _timeout);
            await connection.Connect(async).ConfigureAwait(false);

            _database = new GdsDatabase(connection);
        }
示例#10
0
        protected override void Dispose(bool disposing)
        {
            lock (_stateSyncRoot)
            {
                if (!_disposed)
                {
                    try
                    {
                        if (_state != TransactionState.NoTransaction)
                        {
                            Rollback();
                        }
                    }
                    catch
                    { }
                    finally
                    {
                        if (disposing)
                        {
                            _database = null;
                            _handle   = 0;
                            _state    = TransactionState.NoTransaction;
                        }

                        _disposed = true;
                        base.Dispose(disposing);
                    }
                }
            }
        }
示例#11
0
        public override async ValueTask DetachAsync(CancellationToken cancellationToken = default)
        {
            try
            {
                await _database.Xdr.WriteAsync(IscCodes.op_service_detach, cancellationToken).ConfigureAwait(false);

                await _database.Xdr.WriteAsync(Handle, cancellationToken).ConfigureAwait(false);

                await _database.Xdr.WriteAsync(IscCodes.op_disconnect, cancellationToken).ConfigureAwait(false);

                await _database.Xdr.FlushAsync(cancellationToken).ConfigureAwait(false);

                Handle = 0;
            }
            catch (IOException ex)
            {
                throw IscException.ForIOException(ex);
            }
            finally
            {
                try
                {
                    await _connection.DisconnectAsync(cancellationToken).ConfigureAwait(false);
                }
                catch (IOException ex)
                {
                    throw IscException.ForIOException(ex);
                }
                finally
                {
                    _database   = null;
                    _connection = null;
                }
            }
        }
        public GdsEventManager(int handle, string ipAddress, int portNumber)
        {
            _handle = handle;
            var connection = new GdsConnection(ipAddress, portNumber);

            connection.Connect();
            _database = new GdsDatabase(connection);
        }
示例#13
0
        public GdsTransaction(DatabaseBase db)
        {
            if (!(db is GdsDatabase))
            {
                throw new ArgumentException($"Specified argument is not of {nameof(GdsDatabase)} type.");
            }

            _database = (GdsDatabase)db;
            State     = TransactionState.NoTransaction;
        }
示例#14
0
        public GdsTransaction(IDatabase db)
            : this()
        {
            if (!(db is GdsDatabase))
            {
                throw new ArgumentException("Specified argument is not of GdsDatabase type.");
            }

            _database = (GdsDatabase)db;
            _state    = TransactionState.NoTransaction;
        }
		public GdsTransaction(IDatabase db)
			: this()
		{
			if (!(db is GdsDatabase))
			{
				throw new ArgumentException("Specified argument is not of GdsDatabase type.");
			}

			_database = (GdsDatabase)db;
			_state = TransactionState.NoTransaction;
		}
        public GdsTransaction(IDatabase db)
        {
            if (!(db is GdsDatabase))
            {
                throw new ArgumentException("Specified argument is not of GdsDatabase type.");
            }

            this.database = (GdsDatabase)db;
            this.state    = TransactionState.NoTransaction;

            GC.SuppressFinalize(this);
        }
		public GdsTransaction(IDatabase db)
		{
			if (!(db is GdsDatabase))
			{
				throw new ArgumentException("Specified argument is not of GdsDatabase type.");
			}

			this.database		= (GdsDatabase)db;
			this.state	= TransactionState.NoTransaction;

			GC.SuppressFinalize(this);
		}
示例#18
0
 public override void Dispose()
 {
     if (!_disposed)
     {
         _disposed = true;
         if (_state != TransactionState.NoTransaction)
         {
             Rollback();
         }
         _database = null;
         _handle   = 0;
         _state    = TransactionState.NoTransaction;
         base.Dispose();
     }
 }
		public GdsEventManager(int handle, string ipAddress, int portNumber)
		{
			_events = new ConcurrentDictionary<int, RemoteEvent>();
			_handle = handle;

			// Initialize the connection
			if (_database == null)
			{
				GdsConnection connection = new GdsConnection(ipAddress, portNumber);

				connection.Connect();

				_database = new GdsDatabase(connection);
			}
		}
示例#20
0
 public override async ValueTask Dispose2Async(CancellationToken cancellationToken = default)
 {
     if (!_disposed)
     {
         _disposed = true;
         if (State != TransactionState.NoTransaction)
         {
             await RollbackAsync(cancellationToken).ConfigureAwait(false);
         }
         _database = null;
         _handle   = 0;
         State     = TransactionState.NoTransaction;
         await base.Dispose2Async(cancellationToken).ConfigureAwait(false);
     }
 }
示例#21
0
        public GdsEventManager(int handle, string ipAddress, int portNumber)
        {
            _events = new ConcurrentDictionary <int, RemoteEvent>();
            _handle = handle;

            // Initialize the connection
            if (_database == null)
            {
                GdsConnection connection = new GdsConnection(ipAddress, portNumber);

                connection.Connect();

                _database = new GdsDatabase(connection);
            }
        }
示例#22
0
 public override async Task Dispose2(AsyncWrappingCommonArgs async)
 {
     if (!_disposed)
     {
         _disposed = true;
         if (State != TransactionState.NoTransaction)
         {
             await Rollback(async).ConfigureAwait(false);
         }
         _database = null;
         _handle   = 0;
         State     = TransactionState.NoTransaction;
         await base.Dispose2(async).ConfigureAwait(false);
     }
 }
		public GdsBlob(IDatabase db, ITransaction transaction, long blobId) : base(db)
		{
			if (!(db is GdsDatabase))
			{
				throw new ArgumentException("Specified argument is not of GdsDatabase type.");
			}
			if (!(transaction is GdsTransaction))
			{
				throw new ArgumentException("Specified argument is not of GdsTransaction type.");
			}

			_database = (GdsDatabase)db;
			_transaction = transaction;
			_position = 0;
			_blobHandle = 0;
			_blobId = blobId;
		}
        public GdsArray(DatabaseBase db, TransactionBase transaction, long handle, string tableName, string fieldName)
            : base(tableName, fieldName)
        {
            if (!(db is GdsDatabase))
            {
                throw new ArgumentException($"Specified argument is not of {nameof(GdsDatabase)} type.");
            }

            if (!(transaction is GdsTransaction))
            {
                throw new ArgumentException($"Specified argument is not of {nameof(GdsTransaction)} type.");
            }

            _database    = (GdsDatabase)db;
            _transaction = (GdsTransaction)transaction;
            _handle      = handle;
        }
示例#25
0
        public GdsEventManager(int handle, string ipAddress, int portNumber)
        {
            this.events = new Hashtable();
            this.events = Hashtable.Synchronized(this.events);
            this.handle = handle;
            this.syncContext = SynchronizationContext.Current ?? new SynchronizationContext();

            // Initialize the connection
            if (this.database == null)
            {
                GdsConnection connection = new GdsConnection(ipAddress, portNumber);

                connection.Connect();

                this.database = new GdsDatabase(connection);
            }
        }
示例#26
0
        public GdsBlob(IDatabase db, ITransaction transaction, long blobId) : base(db)
        {
            if (!(db is GdsDatabase))
            {
                throw new ArgumentException("Specified argument is not of GdsDatabase type.");
            }
            if (!(transaction is GdsTransaction))
            {
                throw new ArgumentException("Specified argument is not of GdsTransaction type.");
            }

            this.database    = (GdsDatabase)db;
            this.transaction = transaction;
            this.position    = 0;
            this.blobHandle  = 0;
            this.blobId      = blobId;
        }
        public GdsBlob(IDatabase db, TransactionBase transaction, long blobId)
            : base(db)
        {
            if (!(db is GdsDatabase))
            {
                throw new ArgumentException($"Specified argument is not of {nameof(GdsDatabase)} type.");
            }
            if (!(transaction is GdsTransaction))
            {
                throw new ArgumentException($"Specified argument is not of {nameof(GdsTransaction)} type.");
            }

            _database    = (GdsDatabase)db;
            _transaction = transaction;
            _position    = 0;
            _blobHandle  = 0;
            _blobId      = blobId;
        }
示例#28
0
        public GdsArray(IDatabase db, ITransaction transaction, long handle, string tableName, string fieldName)
            : base(tableName, fieldName)
        {
            if (!(db is GdsDatabase))
            {
                throw new ArgumentException("Specified argument is not of GdsDatabase type.");
            }

            if (!(transaction is GdsTransaction))
            {
                throw new ArgumentException("Specified argument is not of GdsTransaction type.");
            }

            this.database				= (GdsDatabase)db;
            this.transaction	= (GdsTransaction)transaction;
            this.handle			= handle;

            this.LookupBounds();
        }
示例#29
0
        public GdsArray(IDatabase db, ITransaction transaction, long handle, string tableName, string fieldName)
            : base(tableName, fieldName)
        {
            if (!(db is GdsDatabase))
            {
                throw new ArgumentException("Specified argument is not of GdsDatabase type.");
            }

            if (!(transaction is GdsTransaction))
            {
                throw new ArgumentException("Specified argument is not of GdsTransaction type.");
            }

            this.database    = (GdsDatabase)db;
            this.transaction = (GdsTransaction)transaction;
            this.handle      = handle;

            this.LookupBounds();
        }
示例#30
0
 public override void Dispose()
 {
     if (!_disposed)
     {
         _disposed = true;
         Release();
         Clear();
         _rows           = null;
         _outputParams   = null;
         _database       = null;
         _fields         = null;
         _parameters     = null;
         _transaction    = null;
         _allRowsFetched = false;
         _handle         = 0;
         _fetchSize      = 0;
         base.Dispose();
     }
 }
        public override async Task Dispose2(AsyncWrappingCommonArgs async)
        {
            if (!_disposed)
            {
                _disposed = true;
                await Release(async).ConfigureAwait(false);

                Clear();
                _rows            = null;
                OutputParameters = null;
                _database        = null;
                _fields          = null;
                _parameters      = null;
                _transaction     = null;
                _allRowsFetched  = false;
                _handle          = 0;
                _fetchSize       = 0;
                await base.Dispose2(async).ConfigureAwait(false);
            }
        }
        protected override void Dispose(bool disposing)
        {
            lock (this)
            {
                if (!IsDisposed)
                {
                    try
                    {
                        // release any unmanaged resources
                        Release();
                    }
                    catch
                    {
                    }
                    finally
                    {
                        // release any managed resources
                        if (disposing)
                        {
                            Clear();

                            _rows           = null;
                            _outputParams   = null;
                            _database       = null;
                            _fields         = null;
                            _parameters     = null;
                            _transaction    = null;
                            _allRowsFetched = false;
                            _state          = StatementState.Deallocated;
                            _statementType  = DbStatementType.None;
                            _handle         = 0;
                            _fetchSize      = 0;
                            RecordsAffected = 0;
                        }

                        base.Dispose(disposing);
                    }
                }
            }
        }
        protected override void Dispose(bool disposing)
        {
            lock (this)
            {
                if (!this.IsDisposed)
                {
                    try
                    {
                        // release any unmanaged resources
                        this.Release();
                    }
                    catch
                    {
                    }
                    finally
                    {
                        // release any managed resources
                        if (disposing)
                        {
                            this.Clear();

                            this.rows            = null;
                            this.outputParams    = null;
                            this.database        = null;
                            this.fields          = null;
                            this.parameters      = null;
                            this.transaction     = null;
                            this.allRowsFetched  = false;
                            this.state           = StatementState.Deallocated;
                            this.statementType   = DbStatementType.None;
                            this.handle          = 0;
                            this.fetchSize       = 0;
                            this.RecordsAffected = 0;
                        }

                        base.Dispose(disposing);
                    }
                }
            }
        }
示例#34
0
 public override void Dispose()
 {
     if (!_disposed)
     {
         _disposed = true;
         Release();
         Clear();
         _rows           = null;
         _outputParams   = null;
         _database       = null;
         _fields         = null;
         _parameters     = null;
         _transaction    = null;
         _allRowsFetched = false;
         _state          = StatementState.Deallocated;
         _statementType  = DbStatementType.None;
         _handle         = 0;
         _fetchSize      = 0;
         RecordsAffected = 0;
         base.Dispose();
     }
 }
        //public Hashtable EventList
        //{
        //    get { return this.events; }
        //}

        #endregion

        #region · Constructors ·

        public GdsEventManager(int handle, string ipAddress, int portNumber)
        {
            this.events = new Hashtable();
            this.events = Hashtable.Synchronized(this.events);
            this.handle = handle;
#if (NET_CF)
            this.syncControl = new System.Windows.Forms.Control();
            IntPtr h = this.syncControl.Handle; // force handle creation
#else
            this.syncContext = SynchronizationContext.Current ?? new SynchronizationContext();
#endif
                    

            // Initialize the connection
            if (this.database == null)
            {
                GdsConnection connection = new GdsConnection(ipAddress, portNumber);

                connection.Connect();

                this.database = new GdsDatabase(connection);
            }
        }
示例#36
0
        public GdsStatement(IDatabase db, TransactionBase transaction)
        {
            if (!(db is GdsDatabase))
            {
                throw new ArgumentException($"Specified argument is not of {nameof(GdsDatabase)} type.");
            }
            if (transaction != null && !(transaction is GdsTransaction))
            {
                throw new ArgumentException($"Specified argument is not of {nameof(GdsTransaction)} type.");
            }

            _handle       = IscCodes.INVALID_OBJECT;
            _fetchSize    = 200;
            _rows         = new Queue <DbValue[]>();
            _outputParams = new Queue <DbValue[]>();

            _database = (GdsDatabase)db;

            if (transaction != null)
            {
                Transaction = transaction;
            }
        }
        //public Hashtable EventList
        //{
        //    get { return this.events; }
        //}

        #endregion

        #region · Constructors ·

        public GdsEventManager(int handle, string ipAddress, int portNumber)
        {
            this.events = new Hashtable();
            this.events = Hashtable.Synchronized(this.events);
            this.handle = handle;
#if (NET_CF)
            this.syncControl = new System.Windows.Forms.Control();
            IntPtr h = this.syncControl.Handle; // force handle creation
#else
            this.syncContext = SynchronizationContext.Current ?? new SynchronizationContext();
#endif


            // Initialize the connection
            if (this.database == null)
            {
                GdsConnection connection = new GdsConnection(ipAddress, portNumber);

                connection.Connect();

                this.database = new GdsDatabase(connection);
            }
        }
示例#38
0
		private void Dispose(bool disposing)
		{
			lock (stateSyncRoot)
			{
				if (!this.disposed)
				{
					try
					{
						// release any unmanaged resources
						this.Rollback();
					}
					catch
					{
					}
					finally
					{
						// release any managed resources
						if (disposing)
						{
							this.database     = null;
							this.handle = 0;
							this.state  = TransactionState.NoTransaction;
						}
						
						this.disposed = true;
					}
				}
			}
		}
示例#39
0
		public void Detach()
		{
			lock (this)
			{
				try
				{
					this.database.Write(IscCodes.op_service_detach);
					this.database.Write(this.Handle);
					this.database.Write(IscCodes.op_disconnect);
					this.database.Flush();

					this.handle = 0;
				}
				catch (IOException)
				{
					throw new IscException(IscCodes.isc_network_error);
				}
				finally
				{
					try
					{
						this.connection.Disconnect();
					}
					catch (IOException)
					{
						throw new IscException(IscCodes.isc_network_error);
					}
					finally
					{
						this.database   = null;
						this.connection = null;
					}
				}
			}
		}
示例#40
0
		public GdsServiceManager(GdsConnection connection)
		{
			this.connection = connection;
			this.database   = new GdsDatabase(this.connection);
		}
		public GdsServiceManager(GdsConnection connection)
		{
			_connection = connection;
			_database = new GdsDatabase(_connection);
		}
		public GdsStatement(IDatabase db, ITransaction transaction)
		{
			if (!(db is GdsDatabase))
			{
				throw new ArgumentException("Specified argument is not of GdsDatabase type.");
			}
			if (transaction != null && !(transaction is GdsTransaction))
			{
				throw new ArgumentException("Specified argument is not of GdsTransaction type.");
			}

			_handle = IscCodes.INVALID_OBJECT;
			RecordsAffected = -1;
			_fetchSize = 200;
			_rows = new Queue<DbValue[]>();
			_outputParams = new Queue<DbValue[]>();

			_database = (GdsDatabase)db;

			if (transaction != null)
			{
				Transaction = transaction;
			}
		}
		private void Dispose(bool disposing)
		{
			lock (_stateSyncRoot)
			{
				if (!_disposed)
				{
					try
					{
						Rollback();
					}
					catch
					{ }
					finally
					{
						if (disposing)
						{
							_database = null;
							_handle = 0;
							_state = TransactionState.NoTransaction;
						}

						_disposed = true;
					}
				}
			}
		}
		protected override void Dispose(bool disposing)
		{
			lock (this)
			{
				if (!IsDisposed)
				{
					try
					{
						Release();
					}
					catch
					{ }
					finally
					{
						if (disposing)
						{
							Clear();

							_rows = null;
							_outputParams = null;
							_database = null;
							_fields = null;
							_parameters = null;
							_transaction = null;
							_allRowsFetched = false;
							_state = StatementState.Deallocated;
							_statementType = DbStatementType.None;
							_handle = 0;
							_fetchSize = 0;
							RecordsAffected = 0;
						}

						base.Dispose(disposing);
					}
				}
			}
		}
		public void Detach()
		{
			lock (this)
			{
				try
				{
					_database.XdrStream.Write(IscCodes.op_service_detach);
					_database.XdrStream.Write(Handle);
					_database.XdrStream.Write(IscCodes.op_disconnect);
					_database.XdrStream.Flush();

					_handle = 0;
				}
				catch (IOException ex)
				{
					throw IscException.ForErrorCode(IscCodes.isc_network_error, ex);
				}
				finally
				{
					try
					{
						_connection.Disconnect();
					}
					catch (IOException ex)
					{
						throw IscException.ForErrorCode(IscCodes.isc_network_error, ex);
					}
					finally
					{
						_database = null;
						_connection = null;
					}
				}
			}
		}
示例#46
0
 public GdsServiceManager(GdsConnection connection)
 {
     _connection = connection;
     _database   = new GdsDatabase(_connection);
 }
示例#47
0
		protected override void Dispose(bool disposing)
		{
			lock (this)
			{
				if (!this.IsDisposed)
				{
					try
					{
						// release any unmanaged resources
						this.Release();
					}
					catch
					{
					}
					finally
					{
						// release any managed resources
						if (disposing)
						{
							this.Clear();

							this.rows               = null;
							this.outputParams       = null;
							this.database           = null;
							this.fields             = null;
							this.parameters         = null;
							this.transaction        = null;
							this.allRowsFetched     = false;
							this.state              = StatementState.Deallocated;
							this.statementType      = DbStatementType.None;
							this.handle             = 0;
							this.fetchSize          = 0;
							this.RecordsAffected    = 0;
						}
						
						base.Dispose(disposing);
					}
				}
			}
		}