testCorrectDatarows :: IO ()
testCorrectDatarows = withConnection $ \c -> do
    let stmt = "SELECT * FROM generate_series(1, 1000)"
    sendBatchAndSync c [Query stmt [] Text Text NeverCache]
    r <- readNextData c
    case r of
        Left e -> error $ show e
        Right rows -> do
            map (BS.pack . show ) [1 .. 1000] @=? V.toList (decodeManyRows decodeDataRow rows)
            countDataRows rows @=? 1000
  where
    -- TODO Right parser later
    decodeDataRow :: Decode B.ByteString
    decodeDataRow = do
        decodeHeader
        getInt16BE
        getByteString . fromIntegral =<< getInt32BE
testCorrectDatarows :: IO ()
testCorrectDatarows = withConnection $ \c -> do
    let stmt = "SELECT * FROM generate_series(1, 1000)"
    sendBatchAndSync c [Query stmt [] Text Text NeverCache]
    r <- readNextData c
    case r of
        Left e -> error $ show e
        Right rows -> do
            map (BS.pack . show ) [1 .. 1000] @=? V.toList (decodeManyRows decodeDataRow rows)
            countDataRows rows @=? 1000
  where
    -- TODO Right parser later
    decodeDataRow :: Decode B.ByteString
    decodeDataRow = do
        decodeHeader
        getInt16BE
        getByteString . fromIntegral =<< getInt32BE
testCorrectDatarows = withConnection $ \c -> do
    let stmt = "SELECT * FROM generate_series(1, 1000)"
    sendBatchAndSync c [Query stmt [] Text Text NeverCache]
    r <- readNextData c
    case r of
        Left e -> error $ show e
        Right rows -> do
            map (BS.pack . show ) [1 .. 1000] @=? V.toList (decodeManyRows decodeDataRow rows)
            countDataRows rows @=? 1000
  where
    -- TODO Right parser later
    decodeDataRow :: Decode B.ByteString
    decodeDataRow = do
        decodeHeader
        getInt16BE
        getByteString . fromIntegral =<< getInt32BE