/// <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 }
/// <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; } } }
/// <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; } } }