postgresql-libpq 0.8.1 → 0.8.2
raw patch · 2 files changed
+8/−75 lines, 2 files
Files
- Database/PostgreSQL/LibPQ.hsc +5/−72
- postgresql-libpq.cabal +3/−3
Database/PostgreSQL/LibPQ.hsc view
@@ -127,8 +127,6 @@ , getlength , nparams , paramtype- , PrintOpt(..)- , defaultPrintOpt -- Retrieving Result Information for Other Commands -- $othercommands@@ -1338,72 +1336,6 @@ withResult result $ \p -> c_PQparamtype p $ fromIntegral param_number -data PrintOpt = PrintOpt {- poHeader :: Bool -- ^ print output field headings and row count- , poAlign :: Bool -- ^ fill align the fields- , poStandard :: Bool -- ^ old brain dead format- , poHtml3 :: Bool -- ^ output HTML tables- , poExpanded :: Bool -- ^ expand tables- , poPager :: Bool -- ^ use pager for output if needed- , poFieldSep :: B.ByteString -- ^ field separator- , poTableOpt :: B.ByteString -- ^ attributes for HTML table element- , poCaption :: B.ByteString -- ^ HTML table caption- , poFieldName :: [B.ByteString] -- ^ list of replacement field names- } deriving Show---defaultPrintOpt :: PrintOpt-defaultPrintOpt = PrintOpt True True False False False False "|" "" "" []---#let alignment t = "%lu", (unsigned long)offsetof(struct {char x__; t (y__); }, y__)-instance Storable PrintOpt where- sizeOf _ = #{size PQprintOpt}-- alignment _ = #{alignment PQprintOpt}-- peek ptr = do- a <- fmap pqbool $ #{peek PQprintOpt, header } ptr- b <- fmap pqbool $ #{peek PQprintOpt, align } ptr- c <- fmap pqbool $ #{peek PQprintOpt, standard} ptr- d <- fmap pqbool $ #{peek PQprintOpt, html3 } ptr- e <- fmap pqbool $ #{peek PQprintOpt, expanded} ptr- f <- fmap pqbool $ #{peek PQprintOpt, pager } ptr- g <- B.packCString =<< #{peek PQprintOpt, fieldSep} ptr- h <- B.packCString =<< #{peek PQprintOpt, tableOpt} ptr- i <- B.packCString =<< #{peek PQprintOpt, caption} ptr- j <- #{peek PQprintOpt, fieldName} ptr- j' <- peekArray0 nullPtr j- j'' <- mapM B.packCString j'- return $ PrintOpt a b c d e f g h i j''- where- pqbool :: CChar -> Bool- pqbool = toEnum . fromIntegral-- poke ptr (PrintOpt a b c d e f g h i j) =- B.useAsCString g $ \g' -> do- B.useAsCString h $ \h' -> do- B.useAsCString i $ \i' -> do- withMany B.useAsCString j $ \j' ->- withArray0 nullPtr j' $ \j'' -> do- let a' = (fromIntegral $ fromEnum a)::CChar- b' = (fromIntegral $ fromEnum b)::CChar- c' = (fromIntegral $ fromEnum c)::CChar- d' = (fromIntegral $ fromEnum d)::CChar- e' = (fromIntegral $ fromEnum e)::CChar- f' = (fromIntegral $ fromEnum f)::CChar- #{poke PQprintOpt, header} ptr a'- #{poke PQprintOpt, align} ptr b'- #{poke PQprintOpt, standard} ptr c'- #{poke PQprintOpt, html3} ptr d'- #{poke PQprintOpt, expanded} ptr e'- #{poke PQprintOpt, pager} ptr f'- #{poke PQprintOpt, fieldSep} ptr g'- #{poke PQprintOpt, tableOpt} ptr h'- #{poke PQprintOpt, caption} ptr i'- #{poke PQprintOpt, fieldName} ptr j''-- -- $othercommands -- These functions are used to extract other information from PGresult -- objects.@@ -1918,6 +1850,7 @@ , notifyExtra :: B.ByteString -- ^ notification payload string } deriving Show +#let alignment t = "%lu", (unsigned long)offsetof(struct {char x__; t (y__); }, y__) instance Storable Notify where sizeOf _ = #{size PGnotify} @@ -2438,11 +2371,11 @@ foreign import ccall "libpq-fe.h PQcancel" c_PQcancel :: Ptr PGcancel -> CString -> CInt -> IO CInt -foreign import ccall "libpq-fe.h PQnotifies"+foreign import ccall unsafe "libpq-fe.h PQnotifies" c_PQnotifies :: Ptr PGconn -> IO (Ptr Notify) -foreign import ccall "libpq-fe.h PQconsumeInput"- c_PQconsumeInput :: Ptr PGconn ->IO CInt+foreign import ccall unsafe "libpq-fe.h PQconsumeInput"+ c_PQconsumeInput :: Ptr PGconn -> IO CInt foreign import ccall "libpq-fe.h PQisBusy" c_PQisBusy :: Ptr PGconn -> IO CInt@@ -2502,7 +2435,7 @@ foreign import ccall unsafe "libpq-fe.h PQfname" c_PQfname :: Ptr PGresult -> CInt -> IO CString -foreign import ccall "libpq-fe.h PQfnumber"+foreign import ccall unsafe "libpq-fe.h PQfnumber" c_PQfnumber :: Ptr PGresult -> CString -> IO CInt foreign import ccall unsafe "libpq-fe.h PQftable"
postgresql-libpq.cabal view
@@ -1,5 +1,5 @@ Name: postgresql-libpq-Version: 0.8.1+Version: 0.8.2 Synopsis: low-level binding to libpq Description: This is a binding to libpq: the C application@@ -12,7 +12,7 @@ Homepage: http://github.com/lpsmith/postgresql-libpq License: BSD3 License-file: LICENSE-Author: Grant Monroe, Leon P Smith+Author: Grant Monroe, Leon P Smith, Joey Adams Maintainer: Leon P Smith <leon@melding-monads.com> Copyright: (c) 2010 Grant Monroe (c) 2011 Leon P Smith@@ -38,4 +38,4 @@ source-repository this type: git location: http://github.com/lpsmith/postgresql-libpq- tag: v0.8.1+ tag: v0.8.2