Skip to content

Fetching records lazily after closing a connection should raise an error #21

@igrep

Description

@igrep

Minimum code to reproduce

import Database.HDBC
import Database.HDBC.Sqlite3

main :: IO ()
main = do
  c <- connectSqlite3 "some.db"
  r <- quickQuery c "select 1;" []
  disconnect c
  print r

Expected result

Raise an error to tell the connection is already closed,
similarly to putStrLn =<< (withFile "file" ReadMode $ hGetContents).

Actual result

Only an empty list [] is printed without any error.
This can make it very hard to detect I used lazy IO in a wrong way.

My environment

  • HDBC-sqlite3-2.3.3.1
  • HDBC-2.4.0.2
  • SQLite: 3.22.0
  • GHC 8.2.2
  • Windows 10 64bit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions