@@ -32,26 +32,22 @@ finishQueryWith :: RowParser r -> Connection -> Query -> PQ.Result -> IO [r]
3232finishQueryWith parser conn q result = do
3333 status <- PQ. resultStatus result
3434 case status of
35- PQ. EmptyQuery ->
36- throwIO $ QueryError " query: Empty query" q
37- PQ. CommandOk ->
38- throwIO $ QueryError " query resulted in a command response" q
3935 PQ. TuplesOk -> do
4036 nrows <- PQ. ntuples result
4137 ncols <- PQ. nfields result
4238 forM' 0 (nrows- 1 ) $ \ row ->
4339 getRowWith parser row ncols conn result
44- PQ. CopyOut ->
45- throwIO $ QueryError " query: COPY TO is not supported" q
46- PQ. CopyIn ->
47- throwIO $ QueryError " query: COPY FROM is not supported" q
48- PQ. CopyBoth ->
49- throwIO $ QueryError " query: COPY BOTH is not supported" q
50- PQ. SingleTuple ->
51- throwIO $ QueryError " query: single-row mode is not supported" q
40+ PQ. EmptyQuery -> queryErr " query: Empty query"
41+ PQ. CommandOk -> queryErr " query resulted in a command response"
42+ PQ. CopyOut -> queryErr " query: COPY TO is not supported"
43+ PQ. CopyIn -> queryErr " query: COPY FROM is not supported"
44+ PQ. CopyBoth -> queryErr " query: COPY BOTH is not supported"
45+ PQ. SingleTuple -> queryErr " query: single-row mode is not supported"
5246 PQ. BadResponse -> throwResultError " query" result status
5347 PQ. NonfatalError -> throwResultError " query" result status
5448 PQ. FatalError -> throwResultError " query" result status
49+ where
50+ queryErr msg = throwIO $ QueryError msg q
5551
5652getRowWith :: RowParser r -> PQ. Row -> PQ. Column -> Connection -> PQ. Result -> IO r
5753getRowWith parser row ncols conn result = do
0 commit comments