From d54cf6ea7f2c7614b398efc19e4da58c4d6c4315 Mon Sep 17 00:00:00 2001 From: Paul Brinkmeier Date: Sat, 16 Sep 2023 19:14:12 +0200 Subject: [PATCH] Move column increment to decodeField --- lib/Database/PostgreSQL/Opium.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Database/PostgreSQL/Opium.hs b/lib/Database/PostgreSQL/Opium.hs index 0d734e0..15f024d 100644 --- a/lib/Database/PostgreSQL/Opium.hs +++ b/lib/Database/PostgreSQL/Opium.hs @@ -131,9 +131,8 @@ instance FromRow' f => FromRow' (M1 C c f) where fromRow' ctx row = M1 <$> fromRow' ctx row instance (FromRow' f, FromRow' g) => FromRow' (f :*: g) where - fromRow' ctx@(FromRowCtx _ _ iRef) row = do + fromRow' ctx row = do y <- fromRow' ctx row - liftIO $ modifyIORef' iRef (+1) z <- fromRow' ctx row pure $ y :*: z @@ -146,6 +145,7 @@ decodeField -> ExceptT Error IO (M1 S m (Rec0 t') p) decodeField nameText g (FromRowCtx result columnTable iRef) row = do i <- liftIO $ readIORef iRef + liftIO $ modifyIORef' iRef (+1) let (column, oid) = columnTable `indexColumnTable` i mbField <- liftIO $ getFieldText column mbValue <- except $ getValue oid mbField