postgresql-simple 0.3.7.1 → 0.3.8.0
raw patch · 5 files changed
+24/−8 lines, 5 filesdep ~aeson
Dependency ranges changed: aeson
Files
- CONTRIBUTORS +1/−0
- postgresql-simple.cabal +3/−3
- src/Database/PostgreSQL/Simple/FromField.hs +4/−4
- src/Database/PostgreSQL/Simple/Notification.hs +12/−0
- src/Database/PostgreSQL/Simple/TypeInfo/Macro.hs +4/−1
CONTRIBUTORS view
@@ -14,3 +14,4 @@ Doug Beardsley <mightybyte@gmail.com> Manuel Gómez <targen@gmail.com> Michael Snoyman <michael@snoyman.com>+Adam Bergmark <adam@edea.se>
postgresql-simple.cabal view
@@ -1,5 +1,5 @@ Name: postgresql-simple-Version: 0.3.7.1+Version: 0.3.8.0 Synopsis: Mid-Level PostgreSQL client library Description: Mid-Level PostgreSQL client library, forked from mysql-simple.@@ -52,7 +52,7 @@ Database.PostgreSQL.Simple.TypeInfo.Types Build-depends:- aeson >= 0.6,+ aeson >= 0.6.2, attoparsec >= 0.10.3, base < 5, blaze-builder,@@ -78,7 +78,7 @@ source-repository this type: git location: http://github.com/lpsmith/postgresql-simple- tag: v0.3.7.1+ tag: v0.3.8.0 test-suite test type: exitcode-stdio-1.0
src/Database/PostgreSQL/Simple/FromField.hs view
@@ -32,9 +32,9 @@ @ import Data.UUID ( UUID ) import Database.PostgreSQL.Simple.FromField- ( typeOid, returnError, ResultError(..) )+ ( FromField (fromField) , typeOid, returnError, ResultError (..) ) import Database.PostgreSQL.Simple.TypeInfo.Static (typoid, uuid)-import qualified Data.ByteString as B+import qualified Data.ByteString.Char8 as B instance FromField UUID where fromField f mdata =@@ -45,7 +45,7 @@ Just dat -> case [ x | (x,t) <- reads dat, (\"\",\"\") <- lex t ] of [x] -> return x- _ -> returnError ConversionError f dat+ _ -> returnError ConversionFailed f dat @ Note that because PostgreSQL's @uuid@ type is built into postgres and is@@ -452,7 +452,7 @@ else case mbs of Nothing -> returnError UnexpectedNull f "" Just bs ->- case JSON.eitherDecode' $ LB.fromChunks [bs] of+ case JSON.eitherDecodeStrict' bs of Left err -> returnError ConversionFailed f err Right val -> pure val
src/Database/PostgreSQL/Simple/Notification.hs view
@@ -32,6 +32,7 @@ ( Notification(..) , getNotification , getNotificationNonBlocking+ , getBackendPID ) where import Control.Concurrent@@ -101,3 +102,14 @@ case mmsg' of Just msg -> return $! Just $! convertNotice msg Nothing -> return Nothing++-- | Returns the process 'CPid' of the backend server process+-- handling this connection.+--+-- The backend PID is useful for debugging purposes and for comparison+-- to NOTIFY messages (which include the PID of the notifying backend+-- process). Note that the PID belongs to a process executing on the+-- database server host, not the local host!++getBackendPID :: Connection -> IO CPid+getBackendPID conn = withConnection conn PQ.backendPID
src/Database/PostgreSQL/Simple/TypeInfo/Macro.hs view
@@ -29,7 +29,7 @@ mkCompats tys = [| \(Oid x) -> $(caseE [| x |] (map alt tys ++ [catchAll])) |] where alt :: TypeInfo -> MatchQ- alt ty = match (litP (getTypoid ty)) (normalB [| True |]) []+ alt ty = match (inlineTypoidP ty) (normalB [| True |]) [] catchAll :: MatchQ catchAll = match wildP (normalB [| False |]) []@@ -39,6 +39,9 @@ -- not to fold constants. inlineTypoid :: TypeInfo -> ExpQ inlineTypoid ty = [| Oid $(litE (getTypoid ty)) |]++inlineTypoidP :: TypeInfo -> PatQ+inlineTypoidP ty = litP (getTypoid ty) getTypoid :: TypeInfo -> Lit getTypoid ty = let (Oid x) = typoid ty in integerL (fromIntegral x)