Permalink
Browse files

Minor refactoring in authQuery and the way the rows are fetched

  • Loading branch information...
1 parent e724cfc commit bea9850eb3dbadc08705ab6c2d4abbd888d745a5 @norm2782 committed Nov 1, 2011
Showing with 6 additions and 5 deletions.
  1. +6 −5 src/Snap/Snaplet/Auth/Backends/Hdbc.hs
@@ -249,11 +249,12 @@ prepExec conn qry vals = withTransaction conn $ \conn' -> do
return ()
authQuery :: HdbcAuthManager -> (String, [SqlValue]) -> IO (Maybe AuthUser)
-authQuery (HdbcAuthManager pool tbl _) (qry, vals) = withResource pool $
- \conn -> do
- stmt <- prepare conn qry
- _ <- execute stmt vals
- res <- fetchRowMap stmt
+authQuery (HdbcAuthManager pool tbl _) (qry, vals) =
+ withResource pool $ \conn -> do
+ res <- do
+ stmt <- prepare conn qry
+ _ <- execute stmt vals
+ fetchRowMap stmt
return $ (return . mkUser tbl) =<< res
mkUser :: AuthTable -> Map String SqlValue -> AuthUser

0 comments on commit bea9850

Please sign in to comment.