Ejemplo n.º 1
0
        }         // close

        /*
        ** Name: cancel
        **
        ** Description:
        **	Issues an interrupt to the Data Access Server which
        **	will attempt to cancel any active query.
        **
        ** Input:
        **	None.
        **
        ** Output:
        **	None.
        **
        ** Returns:
        **	void.
        **
        ** History:
        **	 4-Nov-99 (gordy)
        **	    Created.
        **	26-Dec-02 (gordy)
        **	    Allocate cncl buffer on first request.
        */

        public virtual void  cancel()
        {
            lock (this)
            {
                /*
                ** Allocate cancel buffer on first request.
                */
                if (cncl == null)
                {
                    try
                    {
                        // wrap the socket's NetworkStream in our OutputStream
                        OutputStream outputStream = new OutputStream(socket.GetStream());
                        cncl = new OutBuff(outputStream, ConnID, 16);
                        cncl.TL_ProtocolLevel = this.TL_ProtocolLevel;
                    }
                    catch (Exception ex)
                    {
                        if (trace.enabled(1))
                        {
                            trace.write(title + ": error creating cancel buffer: " +
                                        ex.Message);
                        }
                        disconnect();
                        throw SqlEx.get(ERR_GC4001_CONNECT_ERR, ex);
                    }
                }

                try
                {
                    if (trace.enabled(2))
                    {
                        trace.write(title + ": interrupt network connection");
                    }
                    cncl.begin(DAM_TL_INT, 0);
                    cncl.flush();
                }
                catch (SqlEx ex)
                {
                    disconnect();
                    throw ex;
                }

                return;
            }
        }         // cancel
Ejemplo n.º 2
0
        }         // MsgConn

        /*
        ** Name: disconnect
        **
        ** Description:
        **	Disconnect from server and free all I/O resources.
        **
        ** Input:
        **	None.
        **
        ** Output:
        **	None.
        **
        ** Returns:
        **	void
        **
        ** History:
        **	 7-Jun-99 (gordy)
        **	    Created.
        **	17-Nov-99 (gordy)
        **	    Extracted I/O functionality to DbConnIo, DbConnOut, DbConnIn.*/

        protected internal override void  disconnect()
        {
            /*
            ** We don't set the I/O buffer reference to null
            ** here so that we don't have to check it on each
            ** use.  I/O buffer functions will continue to work
            ** until a request results in a stream I/O request,
            ** in which case an exception will be thrown by the
            ** I/O buffer.
            **
            ** We must, however, test the reference for null
            ** since we may be called by the constructor with
            ** a null cancel buffer.
            */
            if (cncl != null)
            {
                try { cncl.close(); }
                catch (Exception) {}
                finally { cncl = null; }
            }

            base.disconnect();
            return;
        }         // disconnect
Ejemplo n.º 3
0
            private ITrace trace; // Tracing.

            #endregion Fields

            #region Constructors

            /*
            ** Name: Ucs2SegWtr
            **
            ** Description:
            **	Class constructor.
            **
            ** Input:
            **	None.
            **
            ** Output:
            **	None.
            **
            ** Returns:
            **	None.
            **
            ** History:
            **	 1-Dec-03 (gordy)
            **	    Created.
            **	 1-Oct-06 (thoda04)
            **	    Ported to .NET
            */
            public Ucs2SegWtr(MsgOut msg_out, OutBuff outBuff, ITrace trace)
            {
                title = "Ucs2SegWtr[" + msg_out.ConnID + "]";

                this.trace = trace;
                this.msg_out = msg_out;
                this.outBuff = outBuff;
            }
Ejemplo n.º 4
0
            private ITrace trace; // Tracing.

            #endregion Fields

            #region Constructors

            /*
            ** Name: ByteSegOS
            **
            ** Description:
            **	Class constructor.
            **
            ** Input:
            **	msg_out	Message layer output.
            **	outBuff	Buffered output stream.
            **	trace  	Tracing.
            **
            ** Output:
            **	None.
            **
            ** Returns:
            **	None.
            **
            ** History:
            **	29-Sep-99 (gordy)
            **	    Created.
            **	17-Nov-99 (gordy)
            **	    Removed msg parameter when class nested.
            **	10-May-01 (gordy)
            **	    Added msg_out parameter when class made static.*/
            /// <summary>
            /// Class constructor for converting byte stream into
            /// segmented output stream.
            /// </summary>
            /// <param name="msg_out">Message layer output.</param>
            /// <param name="outBuff">Buffered output stream.</param>
            /// <param name="trace">Tracing</param>
            public ByteSegOS(MsgOut msg_out, OutBuff outBuff, ITrace trace)
                : base(outBuff.outputStream)
            {
                title = "ByteSegOS[" + msg_out.ConnID + "]";
                this.trace = trace;
                this.msg_out = msg_out;
                this.outBuff = outBuff;

                ba = new byte[1];
            }
Ejemplo n.º 5
0
        /*
        ** Name: connect
        **
        ** Description:
        **	Connect to target server.  Initializes the output buffer.
        **
        ** Input:
        **	host	Host name or address.
        **	portID	Symbolic or numeric port ID.
        **
        ** Output:
        **	None.
        **
        ** Returns:
        **	void.
        **
        ** History:
        **	 7-Jun-99 (gordy)
        **	    Created.
        **	17-Nov-99 (gordy)
        **	    Extracted output functionality from DbConn.
        **	 3-Nov-08 (gordy, ported by thoda04)
        **	    Extracted from constructor.
        */
        protected internal override void connect(String host, String portID)
        {
            base.connect( host, portID );

            try
            {
            // wrap the socket's NetworkStream in our OutputStream
            OutputStream outputStream = new OutputStream(socket.GetStream());
            outBuff = new OutBuff(outputStream, ConnID, 1 << DAM_TL_PKT_MIN);
            }
            catch (System.Exception ex)
            {
            if (trace.enabled(1))
                trace.write(title + ": error creating output buffer: " + ex.Message);
            disconnect();
            throw SqlEx.get(ERR_GC4001_CONNECT_ERR, ex);
            }

            return;
        }
Ejemplo n.º 6
0
        /*
        ** Name: disconnect
        **
        ** Description:
        **	Disconnect from server and free all I/O resources.
        **
        ** Input:
        **	None.
        **
        ** Output:
        **	None.
        **
        ** Returns:
        **	void
        **
        ** History:
        **	 7-Jun-99 (gordy)
        **	    Created.
        **	17-Nov-99 (gordy)
        **	    Extracted I/O functionality to DbConnIo, DbConnOut, DbConnIn.*/
        protected internal override void disconnect()
        {
            /*
            ** We don't set the I/O buffer reference to null
            ** here so that we don't have to check it on each
            ** use.  I/O buffer functions will continue to work
            ** until a request results in a stream I/O request,
            ** in which case an exception will be thrown by the
            ** I/O buffer.
            **
            ** We must, however, test the reference for null
            ** since we may be called by the constructor with
            ** a null cancel buffer.
            */
            if (cncl != null)
            {
                try { cncl.close(); }
                catch( Exception ) {}
                finally { cncl = null; }
            }

            base.disconnect();
            return ;
        }
Ejemplo n.º 7
0
        /*
        ** Name: cancel
        **
        ** Description:
        **	Issues an interrupt to the Data Access Server which
        **	will attempt to cancel any active query.
        **
        ** Input:
        **	None.
        **
        ** Output:
        **	None.
        **
        ** Returns:
        **	void.
        **
        ** History:
        **	 4-Nov-99 (gordy)
        **	    Created.
        **	26-Dec-02 (gordy)
        **	    Allocate cncl buffer on first request.
        */
        public virtual void cancel()
        {
            lock(this)
            {
                /*
                ** Allocate cancel buffer on first request.
                */
                if ( cncl == null )
                    try
                    {
                        // wrap the socket's NetworkStream in our OutputStream
                        OutputStream outputStream = new OutputStream(socket.GetStream());
                        cncl = new OutBuff(outputStream, ConnID, 16);
                        cncl.TL_ProtocolLevel = this.TL_ProtocolLevel;
                    }
                    catch( Exception ex )
                    {
                        if ( trace.enabled( 1 ) )
                            trace.write( title + ": error creating cancel buffer: " +
                                ex.Message );
                        disconnect();
                        throw SqlEx.get( ERR_GC4001_CONNECT_ERR, ex );
                    }

                try
                {
                    if ( trace.enabled( 2 ) )
                        trace.write( title + ": interrupt network connection" );
                    cncl.begin( DAM_TL_INT, 0 );
                    cncl.flush();
                }
                catch( SqlEx ex )
                {
                    disconnect();
                    throw ex;
                }

                return;
            }
        }