| Ticket Hash: | daeaf3150ae6023320f31b628fe792234dc52342 | ||
| Title: | SQLiteCommand.Execute SQLiteExecuteType.Reader support | ||
| Status: | Closed | Type: | Code_Defect |
| Severity: | Important | Priority: | Blocker |
| Subsystem: | Command | Resolution: | Fixed |
| Last Modified: |
2014-11-07 23:51:02 11.53 years ago |
Created: |
2014-11-05 19:58:03 11.53 years ago |
| Version Found In: | 1.0.94.0 | ||
| User Comments: | ||||
anonymous added on 2014-11-05 19:58:03:
(text/x-fossil-plain)
I tried (at the F# repl) using the static SQLiteCommand.Execute method to execute a query (specifying SQLiteExecuteType.Reader). The method did indeed return a reader (Execute did not raise an exception), but the reader was effectively useless because (I believe) the connection that created it was already disposed. E.g.: > reader.HasRows;; System.ObjectDisposedException: Cannot access a disposed object. Looking at the code in SQLiteCommand, I see that ExecuteReader is called in a using block which will dispose the connection. Suggestion: when the executeType is Reader, do not dispose the connection after a successful ExecuteReader; instead, include CommandBehavior.CloseConnection in the commandBehavior flags so that closing the returned reader closes the connection as well. mistachkin added on 2014-11-07 23:51:02:
(text/x-fossil-plain)
Fixed on trunk via check-in [ad79758d0c]. | ||||