Close() public method

public Close ( ) : void
return void
コード例 #1
0
        public void Close(bool isOpen)
        {
            try
            {
                if (isOpen)
                {
                    try
                    {
                        packet.Clear();
                        packet.WriteByte((byte)DBCmd.QUIT);
                        ExecutePacket(packet);
                    }
                    catch (Exception ex)
                    {
                        MySqlTrace.LogError(ThreadId, ex.ToString());
                        // Eat exception here. We should try to closing
                        // the stream anyway.
                    }
                }

                if (stream != null)
                {
                    stream.Close();
                }
                stream = null;
            }
            catch (Exception)
            {
                // we are just going to eat any exceptions
                // generated here
            }
        }
コード例 #2
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                try
                {
                    if (isOpen)
                    {
                        ExecuteCommand(DBCmd.QUIT, null, 0);
                    }

                    if (stream != null)
                    {
                        stream.Close();
                    }
                    stream = null;
                }
                catch (Exception)
                {
                    // we are just going to eat any exceptions
                    // generated here
                }
            }

            base.Dispose(disposing);
        }
コード例 #3
0
        public override void Close()
        {
            try
            {
                if (isOpen)
                {
                    ExecuteCommand(DBCmd.QUIT, null, 0);
                }

                if (stream != null)
                {
                    stream.Close();
                }
                stream = null;
                base.Close();
            }
            catch (Exception)
            {
                // we are just going to eat any exceptions
                // generated here
            }
        }