示例#1
0
        internal void DisconnectFromDataReaderAndConnection()
        {
            // get a reference to the datareader if it is alive
            OdbcDataReader liveReader = null;

            if (this.weakDataReaderReference != null)
            {
                OdbcDataReader reader;
                reader = (OdbcDataReader)this.weakDataReaderReference.Target;
                if (this.weakDataReaderReference.IsAlive)
                {
                    liveReader = reader;
                }
            }

            // remove reference to this from the live datareader
            if (liveReader != null)
            {
                liveReader.Command = null;
            }

            this.transaction = null;

            if (null != _connection)
            {
                _connection.RemoveCommand(this);
                _connection = null;
            }

            // if the reader is dead we have to dismiss the statement
            if (liveReader == null)
            {
                if (_cmdWrapper != null)
                {
                    _cmdWrapper.Dispose(true);
                }
            }
        }
示例#2
0
        private void CloseCommandWrapper()
        {
            CMDWrapper wrapper = _cmdWrapper;

            if (null != wrapper)
            {
                try {
                    wrapper.Dispose();

                    if (null != _connection)
                    {
                        _connection.RemoveWeakReference(this);
                    }
                }
                finally {
                    _cmdWrapper = null;
                }
            }
        }
        private void CloseCommandWrapper()
        {
            CMDWrapper wrapper = this._cmdWrapper;

            if (wrapper != null)
            {
                try
                {
                    wrapper.Dispose();
                    if (this._connection != null)
                    {
                        this._connection.RemoveWeakReference(this);
                    }
                }
                finally
                {
                    this._cmdWrapper = null;
                }
            }
        }