Ejemplo n.º 1
0
        public GdsDatabase()
        {
            this.connection = new GdsConnection();
            this.charset    = Charset.DefaultCharset;
            this.dialect    = 3;
            this.packetSize = 8192;

            GC.SuppressFinalize(this);
        }
Ejemplo n.º 2
0
        public GdsEventManager(int handle, string ipAddress, int portNumber)
        {
            this.events = new Hashtable();
            this.events = Hashtable.Synchronized(this.events);
            this.handle = handle;

            // Initialize the connection
            if (this.connection == null)
            {
                this.connection = new GdsConnection();
                this.connection.Connect(ipAddress, portNumber);
            }
        }
		public GdsEventManager(int handle, string ipAddress, int portNumber)
		{
			this.events = new Hashtable();
			this.events = Hashtable.Synchronized(this.events);
			this.handle = handle;

			// Initialize the connection
			if (this.connection == null)
			{
				this.connection = new GdsConnection();
				this.connection.Connect(ipAddress, portNumber);
			}
		}
Ejemplo n.º 4
0
        public void Detach()
        {
            lock (this)
            {
                if (this.TransactionCount > 0)
                {
                    throw new IscException(IscCodes.isc_open_trans, this.TransactionCount);
                }

                try
                {
                    this.Send.Write(IscCodes.op_detach);
                    this.Send.Write(this.handle);
                    this.Send.Flush();

                    this.ReadGenericResponse();

                    // Close the Event Manager
                    this.CloseEventManager();

                    // Close the connection	to the server
                    this.connection.Disconnect();

                    this.transactionCount = 0;
                    this.handle           = 0;
                    this.dialect          = 0;
                    this.packetSize       = 0;
                    this.charset          = null;
                    this.connection       = null;
                    this.serverVersion    = null;
                }
                catch (IOException)
                {
                    try
                    {
                        this.connection.Disconnect();
                    }
                    catch (IOException)
                    {
                        throw new IscException(IscCodes.isc_network_error);
                    }

                    throw new IscException(IscCodes.isc_network_error);
                }
            }
        }
Ejemplo n.º 5
0
		public void Attach(ServiceParameterBuffer spb, string dataSource, int port, string service)
		{
			lock (this)
			{
				try
				{
					if (this.connection == null)
					{
						this.connection = new GdsConnection();
					}

					this.connection.Connect(dataSource, port, 8192, Charset.DefaultCharset);

					this.connection.Send.Write(IscCodes.op_service_attach);
					this.connection.Send.Write(0);
					this.connection.Send.Write(service);
					this.connection.Send.WriteBuffer(spb.ToArray());
					this.connection.Send.Flush();

					try
					{
						this.handle = this.connection.ReadGenericResponse().ObjectHandle;
					}
					catch (IscException)
					{
						try
						{
							this.Detach();
						}
						catch
						{
						}

						throw;
					}
				}
				catch (IOException)
				{
					this.connection.Disconnect();

					throw new IscException(IscCodes.isc_net_write_err);
				}
			}
		}
Ejemplo n.º 6
0
		public void Detach()
		{
			lock (this)
			{
				if (this.TransactionCount > 0)
				{
					throw new IscException(IscCodes.isc_open_trans, this.TransactionCount);
				}

				try
				{
					this.Send.Write(IscCodes.op_detach);
					this.Send.Write(this.handle);
					this.Send.Flush();

					this.ReadGenericResponse();

					// Close the Event Manager
					this.CloseEventManager();

					// Close the connection	to the server
					this.connection.Disconnect();

					this.transactionCount	= 0;
					this.handle				= 0;
					this.dialect			= 0;
					this.packetSize			= 0;
					this.charset			= null;
					this.connection			= null;
					this.serverVersion		= null;
				}
				catch (IOException)
				{
					try
					{
						this.connection.Disconnect();
					}
					catch (IOException)
					{
						throw new IscException(IscCodes.isc_network_error);
					}

					throw new IscException(IscCodes.isc_network_error);
				}
			}
		}
Ejemplo n.º 7
0
		private void Dispose(bool disposing)
		{
			lock (this)
			{
				if (!this.disposed)
				{
					try
					{
						// release any unmanaged resources
						this.Detach();

						// release any managed resources
						if (disposing)
						{
							this.connection		= null;
							this.charset		= null;
							this.eventManager	= null;
							this.serverVersion	= null;
							this.dialect		= 0;
							this.eventsId		= 0;
							this.handle			= 0;
							this.packetSize		= 0;
							this.warningMessage = null;
							this.transactionCount = 0;
						}
					}
					finally
					{
					}

					this.disposed = true;
				}
			}
		}
Ejemplo n.º 8
0
		public GdsDatabase()
		{
			this.connection		= new GdsConnection();
			this.charset		= Charset.DefaultCharset;
			this.dialect		= 3;
			this.packetSize		= 8192;

			GC.SuppressFinalize(this);
		}