hdbi-postgresql 1.2.0 → 1.3.0
raw patch · 3 files changed
+11/−11 lines, 3 filesdep ~hdbidep ~hdbi-tests
Dependency ranges changed: hdbi, hdbi-tests
Files
- Database/HDBI/PostgreSQL/Implementation.hs +5/−5
- hdbi-postgresql.cabal +5/−5
- testsrc/runtests.hs +1/−1
Database/HDBI/PostgreSQL/Implementation.hs view
@@ -223,7 +223,7 @@ case mval of Nothing -> return SqlNull Just val -> nativeToSqlValue val fmt oid- return (x {pgstCurrent = current + 1}, Just ret)+ return (x {pgstCurrent = current + 1}, Just $ fromRow ret) _fetch x = throwIO $ SqlDriverError@@ -528,21 +528,21 @@ decodeUTF8 :: B.ByteString -> TL.Text decodeUTF8 x = TL.decodeUtf8 $ BL.fromChunks [x] -pgRun :: PostgreConnection -> Query -> [SqlValue] -> IO PQ.Result+pgRun :: (ToRow row) => PostgreConnection -> Query -> row -> IO PQ.Result pgRun conn query values = withPGConnection conn $ \con -> do r <- PQ.execParams con (buildSqlQuery query) binvals PQ.Text getPGResult con r -- Throwing error if failed where- binvals = map sqlValueToNative values+ binvals = map sqlValueToNative $ toRow values pgRunRaw :: PostgreConnection -> Query -> IO PQ.Result pgRunRaw conn query = withPGConnection conn $ \con -> do r <- PQ.exec con $ buildSqlQuery query getPGResult con r -pgRunMany :: PostgreConnection -> Query -> [[SqlValue]] -> IO ()+pgRunMany :: (ToRow row) => PostgreConnection -> Query -> [row] -> IO () pgRunMany conn query values = withPGConnection conn $ \con -> do- forM_ values $ \val -> do+ forM_ (map toRow values) $ \val -> do r <- PQ.execParams con binq (binv val) PQ.Text res <- getPGResult con r PQ.unsafeFreeResult res
hdbi-postgresql.cabal view
@@ -1,5 +1,5 @@ Name: hdbi-postgresql-Version: 1.2.0+Version: 1.3.0 License: BSD3 Maintainer: Aleksey Uymanov <s9gf4ult@gmail.com> Author: John Goerzen@@ -26,7 +26,7 @@ , attoparsec , blaze-builder , bytestring- , hdbi >= 1.2.0+ , hdbi >= 1.3.0 , mtl , old-locale , postgresql-libpq@@ -57,8 +57,8 @@ , blaze-builder , bytestring , containers- , hdbi >= 1.2.0- , hdbi-tests >= 1.2.0+ , hdbi >= 1.3.0+ , hdbi-tests >= 1.3.0 , ieee754 , mtl , old-locale@@ -90,7 +90,7 @@ , blaze-builder , bytestring , derive- , hdbi >= 1.2.0+ , hdbi >= 1.3.0 , mtl , old-locale , postgresql-libpq
testsrc/runtests.hs view
@@ -33,7 +33,7 @@ runRaw c "create table table2 (val bigint)" runMany c "insert into table2(val) values (?)" $ map ((:[]) . toSql) is withStatement c "update table2 set val=10" $ \s -> do- executeRaw s+ execute s () pgAffectedRows s QM.stop $ res ?== (genericLength is)