mirror of
https://github.com/postgres-haskell/postgres-wire.git
synced 2024-11-22 05:53:12 +03:00
Tests connection remains valid after PostgresError
This commit is contained in:
parent
2205b17dd0
commit
2072ede0a6
@ -34,6 +34,7 @@ testDriver = testGroup "Driver"
|
||||
, testCase "Empty query" testEmptyQuery
|
||||
, testCase "Query without result" testQueryWithoutResult
|
||||
, testCase "Invalid queries" testInvalidBatch
|
||||
, testCase "Valid after postgres error" testValidAfterError
|
||||
, testCase "Describe statement" testDescribeStatement
|
||||
, testCase "Describe statement with no data" testDescribeStatementNoData
|
||||
, testCase "Describe empty statement" testDescribeStatementEmpty
|
||||
@ -155,6 +156,22 @@ testInvalidBatch = do
|
||||
sendBatchAndSync c qs
|
||||
checkInvalidResult c $ length qs
|
||||
|
||||
-- | Connection remains valid even after PostgreSQL returned error on the
|
||||
-- previous query.
|
||||
testValidAfterError :: IO ()
|
||||
testValidAfterError = withConnection $ \c -> do
|
||||
let a = "5"
|
||||
rightQuery = makeQuery1 a
|
||||
invalidQuery = Query "SELECT $1" (V.fromList []) Text Text NeverCache
|
||||
sendBatchAndSync c [invalidQuery]
|
||||
checkInvalidResult c 1
|
||||
waitReadyForQuery c
|
||||
|
||||
sendBatchAndSync c [rightQuery]
|
||||
r <- readNextData c
|
||||
waitReadyForQuery c
|
||||
a @=? fromMessage r
|
||||
|
||||
-- | Describes usual statement.
|
||||
testDescribeStatement :: IO ()
|
||||
testDescribeStatement = withConnectionCommon $ \c -> do
|
||||
|
Loading…
Reference in New Issue
Block a user