Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix for ticket [e1b2e0f769] with test case. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
fa8d4d57734de3326cf545ca7b60ce61 |
User & Date: | mistachkin 2011-07-07 02:15:47.154 |
References
2011-07-07
| ||
04:32 | • Ticket [e1b2e0f769] Connection was closed, statement was terminated status still Closed with 2 other changes artifact: c5bf67ddc0 user: mistachkin | |
02:16 | • Closed ticket [e1b2e0f769]. artifact: 587640d245 user: mistachkin | |
Context
2011-07-07
| ||
02:40 | Further optimization/fix for ticket [201128cc88]. check-in: f09f0e8ea1 user: mistachkin tags: trunk | |
02:15 | Fix for ticket [e1b2e0f769] with test case. check-in: fa8d4d5773 user: mistachkin tags: trunk | |
2011-07-06
| ||
21:09 | Further simplify test case for [e1b2e0f769]. Prevent common.eagle from being treated as a test case file. check-in: bafc84af30 user: mistachkin tags: trunk | |
Changes
Changes to System.Data.SQLite/SQLiteDataReader.cs.
︙ | ︙ | |||
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | private CommandBehavior _commandBehavior; /// <summary> /// If set, then dispose of the command object when the reader is finished /// </summary> internal bool _disposeCommand; /// <summary> /// An array of rowid's for the active statement if CommandBehavior.KeyInfo is specified /// </summary> private SQLiteKeyReader _keyInfo; internal long _version; // Matches the version of the connection /// <summary> /// Internal constructor, initializes the datareader and sets up to begin executing statements /// </summary> /// <param name="cmd">The SQLiteCommand this data reader is for</param> /// <param name="behave">The expected behavior of the data reader</param> internal SQLiteDataReader(SQLiteCommand cmd, CommandBehavior behave) { _command = cmd; _version = _command.Connection._version; _commandBehavior = behave; _activeStatementIndex = -1; _rowsAffected = -1; if (_command != null) NextResult(); } internal void Cancel() { _version = 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 | > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | private CommandBehavior _commandBehavior; /// <summary> /// If set, then dispose of the command object when the reader is finished /// </summary> internal bool _disposeCommand; /// <summary> /// If set, then raise an exception when the object is accessed after being disposed. /// </summary> internal bool _throwOnDisposed; /// <summary> /// If set, then the object is currently being disposed. /// </summary> internal bool _disposing; /// <summary> /// An array of rowid's for the active statement if CommandBehavior.KeyInfo is specified /// </summary> private SQLiteKeyReader _keyInfo; internal long _version; // Matches the version of the connection /// <summary> /// Internal constructor, initializes the datareader and sets up to begin executing statements /// </summary> /// <param name="cmd">The SQLiteCommand this data reader is for</param> /// <param name="behave">The expected behavior of the data reader</param> internal SQLiteDataReader(SQLiteCommand cmd, CommandBehavior behave) { _throwOnDisposed = true; _command = cmd; _version = _command.Connection._version; _commandBehavior = behave; _activeStatementIndex = -1; _rowsAffected = -1; if (_command != null) NextResult(); } internal void Cancel() { _version = 0; } /// <summary> /// Dispose of all resources used by this datareader. /// </summary> /// <param name="disposing"></param> protected override void Dispose(bool disposing) { // // NOTE: Fix for ticket [e1b2e0f769], do NOT throw exceptions while we // are being disposed. // _disposing = true; _throwOnDisposed = false; base.Dispose(disposing); } /// <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 (!_disposing && (_version != 0)) { try { while (NextResult()) { } } |
︙ | ︙ | |||
147 148 149 150 151 152 153 154 155 156 157 158 159 160 | } /// <summary> /// Throw an error if the datareader is closed /// </summary> private void CheckClosed() { if (_command == null) throw new InvalidOperationException("DataReader has been closed"); if (_version == 0) throw new SQLiteException((int)SQLiteErrorCode.Abort, "Execution was aborted by the user"); if (_command.Connection.State != ConnectionState.Open || _command.Connection._version != _version) | > > > | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | } /// <summary> /// Throw an error if the datareader is closed /// </summary> private void CheckClosed() { if (!_throwOnDisposed) return; if (_command == null) throw new InvalidOperationException("DataReader has been closed"); if (_version == 0) throw new SQLiteException((int)SQLiteErrorCode.Abort, "Execution was aborted by the user"); if (_command.Connection.State != ConnectionState.Open || _command.Connection._version != _version) |
︙ | ︙ |
Changes to Tests/tkt-e1b2e0f769.eagle.
︙ | ︙ | |||
65 66 67 68 69 70 71 72 73 74 75 76 77 78 | // return the empty list. In this case, an exception // will be raised when exiting the using block for the // data reader because we are closing the connection out // from underneath it. // if (!dataReader.HasRows) { connection.Close(); return result; } while (dataReader.Read()) { result.Add((long?) dataReader\[0\]); | > > > > > > > | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | // return the empty list. In this case, an exception // will be raised when exiting the using block for the // data reader because we are closing the connection out // from underneath it. // if (!dataReader.HasRows) { // // NOTE: Closing the connection here caused an exception to // be raised when exiting the using block for the data // reader (below) because the Dispose method for the // data reader calls the Close method, which always // assumed the underlying connection was still open. // connection.Close(); return result; } while (dataReader.Read()) { result.Add((long?) dataReader\[0\]); |
︙ | ︙ | |||
113 114 115 116 117 118 119 | cleanupDb $fileName unset -nocomplain result2 result1 code results errors sql table dataSource \ id x db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -match regexp \ -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 3 Ok\ | | < | 120 121 122 123 124 125 126 127 128 129 130 131 | cleanupDb $fileName unset -nocomplain result2 result1 code results errors sql table dataSource \ id x db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA System.Data.SQLite} -match regexp \ -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 3 Ok\ System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 0$}} ############################################################################### runTestEpilogue |