|Title:||SQLiteCommand.Execute SQLiteExecuteType.Reader support|
|Last Modified:||2014-11-07 23:51:02|
|Version Found In:||184.108.40.206|
anonymous added on 2014-11-05 19:58:03:
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:
Fixed on trunk via check-in [ad79758d0c].