Esempio n. 1
0
        /// <summary>
        /// Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified.
        /// </summary>
        public override void Close()
        {
            if (_command != null)
            {
                while (NextResult())
                {
                }
                _command.ClearDataReader();

                // If the datareader's behavior includes closing the connection, then do so here.
                if ((_commandBehavior & CommandBehavior.CloseConnection) != 0 && _command.Connection != null)
                {
                    _command.Connection.Close();
                }

                if (_disposeCommand)
                {
                    ((IDisposable)_command).Dispose();
                }
            }

            _command         = null;
            _activeStatement = null;
            _fieldTypeArray  = null;

#if MONO_SUPPORT_KEYREADER
            if (_keyInfo != null)
            {
                _keyInfo.Dispose();
                _keyInfo = null;
            }
#endif
        }
        private void LoadKeyInfo()
        {
            if (_keyInfo != null)
            {
                _keyInfo.Dispose();
            }

            _keyInfo = new SqliteKeyReader(_command.Connection, this, _activeStatement);
        }
        /// <summary>
        /// Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified.
        /// </summary>
        public override void Close()
        {
            try
            {
                if (_command != null)
                {
                    try
                    {
                        try
                        {
                            // Make sure we've not been canceled
                            if (_version != 0)
                            {
                                try
                                {
                                    while (NextResult())
                                    {
                                    }
                                }
                                catch
                                {
                                }
                            }
                            _command.ClearDataReader();
                        }
                        finally
                        {
                            // If the datareader's behavior includes closing the connection, then do so here.
                            if ((_commandBehavior & CommandBehavior.CloseConnection) != 0 && _command.Connection != null)
                            {
                                _command.Connection.Close();
                            }
                        }
                    }
                    finally
                    {
                        if (_disposeCommand)
                        {
                            _command.Dispose();
                        }
                    }
                }

                _command         = null;
                _activeStatement = null;
                _fieldTypeArray  = null;
            }
            finally
            {
                if (_keyInfo != null)
                {
                    _keyInfo.Dispose();
                    _keyInfo = null;
                }
            }
        }
Esempio n. 4
0
        private void LoadKeyInfo()
        {
#if MONO_SUPPORT_KEYREADER
            if (_keyInfo != null)
            {
                _keyInfo.Dispose();
            }

            _keyInfo = new SqliteKeyReader(_command.Connection, this, _activeStatement);
#endif
        }
Esempio n. 5
0
    /// <summary>
    /// Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified.
    /// </summary>
    public override void Close()
    {
      try
      {
        if (_command != null)
        {
          try
          {
            try
            {
              // Make sure we've not been canceled
              if (_version != 0)
              {
                try
                {
                  while (NextResult())
                  {
                  }
                }
                catch
                {
                }
              }
              _command.ClearDataReader();
            }
            finally
            {
              // If the datareader's behavior includes closing the connection, then do so here.
              if ((_commandBehavior & CommandBehavior.CloseConnection) != 0 && _command.Connection != null) {
                // We need to call Dispose on the command before we call Dispose on the Connection,
                // otherwise we'll get a SQLITE_LOCKED exception.
                var conn = _command.Connection;
                _command.Dispose ();
                conn.Close();
                _disposeCommand = false;
              }
            }
          }
          finally
          {
            if (_disposeCommand)
              _command.Dispose();
          }
        }

        _command = null;
        _activeStatement = null;
        _fieldTypeArray = null;
      }
      finally
      {
        if (_keyInfo != null)
        {
          _keyInfo.Dispose();
          _keyInfo = null;
        }
      }
    }
Esempio n. 6
0
    private void LoadKeyInfo()
    {
      if (_keyInfo != null)
        _keyInfo.Dispose();

      _keyInfo = new SqliteKeyReader(_command.Connection, this, _activeStatement);
    }
Esempio n. 7
0
        /// <summary>
        /// Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified.
        /// </summary>
        public override void Close()
        {
            try
            {
                if (_command != null)
                {
                    try
                    {
                        try
                        {
                            // Make sure we've not been canceled
                            if (_version != 0)
                            {
                                try
                                {
                                    while (NextResult())
                                    {
                                    }
                                }
                                catch
                                {
                                }
                            }
                            _command.ClearDataReader();
                        }
                        finally
                        {
                            // If the datareader's behavior includes closing the connection, then do so here.
                            if ((_commandBehavior & CommandBehavior.CloseConnection) != 0 && _command.Connection != null)
                            {
                                // We need to call Dispose on the command before we call Dispose on the Connection,
                                // otherwise we'll get a SQLITE_LOCKED exception.
                                var conn = _command.Connection;
                                _command.Dispose();
                                conn.Close();
                                _disposeCommand = false;
                            }
                        }
                    }
                    finally
                    {
                        if (_disposeCommand)
                        {
                            _command.Dispose();
                        }
                    }
                }

                _command         = null;
                _activeStatement = null;
                _fieldTypeArray  = null;
            }
            finally
            {
                if (_keyInfo != null)
                {
                    _keyInfo.Dispose();
                    _keyInfo = null;
                }
            }
        }
Esempio n. 8
0
    /// <summary>
    /// Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified.
    /// </summary>
    public override void Close()
    {
      try
      {
        if (_command != null)
        {
          try
          {
            try
            {
              // Make sure we've not been canceled
              if (_version != 0)
              {
                try
                {
                  while (NextResult())
                  {
                  }
                }
                catch
                {
                }
              }
              _command.ClearDataReader();
            }
            finally
            {
              // If the datareader's behavior includes closing the connection, then do so here.
              if ((_commandBehavior & CommandBehavior.CloseConnection) != 0 && _command.Connection != null)
                _command.Connection.Close();
            }
          }
          finally
          {
            if (_disposeCommand)
              _command.Dispose();
          }
        }

        _command = null;
        _activeStatement = null;
        _fieldTypeArray = null;
      }
      finally
      {
        if (_keyInfo != null)
        {
          _keyInfo.Dispose();
          _keyInfo = null;
        }
      }
    }
Esempio n. 9
0
    /// <summary>
    /// Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified.
    /// </summary>
    public override void Close()
    {
      if (_command != null)
      {
        while (NextResult())
        {
        }
        _command.ClearDataReader();

        // If the datareader's behavior includes closing the connection, then do so here.
        if ((_commandBehavior & CommandBehavior.CloseConnection) != 0 && _command.Connection != null)
          _command.Connection.Close();

        if (_disposeCommand)
          ((IDisposable)_command).Dispose();
      }

      _command = null;
      _activeStatement = null;
      _fieldTypeArray = null;

#if MONO_SUPPORT_KEYREADER
      if (_keyInfo != null)
      {
        _keyInfo.Dispose();
        _keyInfo = null;
      }
#endif
    }
Esempio n. 10
0
    private void LoadKeyInfo()
    {
#if MONO_SUPPORT_KEYREADER
      if (_keyInfo != null)
        _keyInfo.Dispose();

      _keyInfo = new SqliteKeyReader(_command.Connection, this, _activeStatement);
#endif
    }