testExtendedEmptyQuery :: IO ()
testExtendedEmptyQuery = withConnectionCommonAll $ \c -> do
    let rawConn   = connRawConnection c
        sname     = StatementName "statement"
        pname     = PortalName ""
        statement = StatementSQL ""
    sendMessage rawConn $ Parse sname statement []
    sendMessage rawConn $
        Bind pname sname Text [] Text
    sendMessage rawConn $ Execute pname noLimitToReceive
    sendMessage rawConn Sync
    msgs <- collectUntilReadyForQuery c
    assertNoErrorResponse msgs
    assertContains msgs isEmptyQueryResponse "EmptyQueryResponse"
  where
    isEmptyQueryResponse EmptyQueryResponse = True
    isEmptyQueryResponse _ = False

-- | Tests that `desribe statement` receives NoData when a statement
-- has no data in the result.
testExtendedEmptyQuery :: IO ()
testExtendedEmptyQuery = withConnectionCommonAll $ \c -> do
    let rawConn   = connRawConnection c
        sname     = StatementName "statement"
        pname     = PortalName ""
        statement = StatementSQL ""
    sendMessage rawConn $ Parse sname statement []
    sendMessage rawConn $
        Bind pname sname Text [] Text
    sendMessage rawConn $ Execute pname noLimitToReceive
    sendMessage rawConn Sync
    msgs <- collectUntilReadyForQuery c
    assertNoErrorResponse msgs
    assertContains msgs isEmptyQueryResponse "EmptyQueryResponse"
  where
    isEmptyQueryResponse EmptyQueryResponse = True
    isEmptyQueryResponse _ = False

-- | Tests that `desribe statement` receives NoData when a statement
-- has no data in the result.
testExtendedEmptyQuery = withConnectionCommonAll $ \c -> do
    let rawConn   = connRawConnection c
        sname     = StatementName "statement"
        pname     = PortalName ""
        statement = StatementSQL ""
    sendMessage rawConn $ Parse sname statement []
    sendMessage rawConn $
        Bind pname sname Text [] Text
    sendMessage rawConn $ Execute pname noLimitToReceive
    sendMessage rawConn Sync
    msgs <- collectUntilReadyForQuery c
    assertNoErrorResponse msgs
    assertContains msgs isEmptyQueryResponse "EmptyQueryResponse"
  where
    isEmptyQueryResponse EmptyQueryResponse = True
    isEmptyQueryResponse _ = False

-- | Tests that `desribe statement` receives NoData when a statement
-- has no data in the result.