Skip to content
Browse files

Added binding to ftable

  • Loading branch information...
1 parent 8e7b32f commit 80a009f04f1b2c504c23ab1e09f76d97d7128a29 Grant Monroe committed Sep 17, 2010
Showing with 14 additions and 0 deletions.
  1. +14 −0 Database/PQ.hsc
View
14 Database/PQ.hsc
@@ -28,6 +28,7 @@ module Database.PQ ( Connection
, nfields
, fname
, fnumber
+ , ftable
, binaryTuples
)
where
@@ -539,6 +540,16 @@ fnumber (Result res) columnName =
else Just $ fromIntegral num
+-- | Returns the OID of the table from which the given column was
+-- fetched. Column numbers start at 0.
+ftable :: Result
+ -> Int
+ -> IO Oid
+ftable (Result res) columnNumber =
+ withForeignPtr res $ \ptr -> do
+ c_PQftable ptr (toEnum columnNumber)
+
+
-- | Returns True if the Result contains binary data and False if it
-- contains text data.
binaryTuples :: Result
@@ -634,5 +645,8 @@ foreign import ccall unsafe "libpq-fe.h PQfname"
foreign import ccall unsafe "libpq-fe.h PQfnumber"
c_PQfnumber :: Ptr PGresult -> CString -> IO CInt
+foreign import ccall unsafe "libpq-fe.h PQftable"
+ c_PQftable :: Ptr PGresult -> CInt -> IO Oid
+
foreign import ccall unsafe "libpq-fe.h PQbinaryTuples"
c_PQbinaryTuples :: Ptr PGresult -> IO CInt

0 comments on commit 80a009f

Please sign in to comment.
Something went wrong with that request. Please try again.