-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | PostgreSQL driver for hdbi -- -- This package provides a PostgreSQL driver for hdbi @package hdbi-postgresql @version 1.1.1 module Database.HDBI.PostgreSQL.Parser buildSqlQuery :: Query -> ByteString qidentifier :: Parser [ParseResult] quoteLiteral :: Parser [ParseResult] dollarLiteral :: Parser [ParseResult] ccomment :: Parser [ParseResult] linecomment :: Parser [ParseResult] literal :: Parser [ParseResult] instance Show ParseResult instance Eq ParseResult module Database.HDBI.PostgreSQL.Implementation data PostgreConnection PostgreConnection :: MVar (Maybe Connection) -> ChildList PostgreStatement -> Text -> PostgreConnection -- | LibPQ connection if established postNative :: PostgreConnection -> MVar (Maybe Connection) -- | List of weak refs to statements to finalize on disconnect postStatements :: PostgreConnection -> ChildList PostgreStatement -- | Original connection string postConnString :: PostgreConnection -> Text data PGStatementState -- | Newly created or reseted statement STNew :: PGStatementState -- | Just executed statement STExecuted :: !Result -> PGStatementState -- | The result to fetch data from pgstResult :: PGStatementState -> !Result -- | Fetching rows is in progress STFetching :: !Result -> !Column -> ![Format] -> ![Oid] -> !Row -> !Row -> PGStatementState -- | The result to fetch data from pgstResult :: PGStatementState -> !Result -- | Columns count pgstColumns :: PGStatementState -> !Column pgstFormats :: PGStatementState -> ![Format] pgstTypes :: PGStatementState -> ![Oid] -- | Tuples in result pgstTuples :: PGStatementState -> !Row -- | Row number waiting to fetch pgstCurrent :: PGStatementState -> !Row -- | Statement is finished, can still be reseted STFinished :: PGStatementState data PostgreStatement PostgreStatement :: Query -> PostgreConnection -> MVar PGStatementState -> PostgreStatement -- | Initial query stQuery :: PostgreStatement -> Query -- | Connection this statement working with stConnection :: PostgreStatement -> PostgreConnection -- | State of statement stState :: PostgreStatement -> MVar PGStatementState -- | Establish new PostgreSQL connection connectPostgreSQL :: Text -> IO PostgreConnection -- | If connection is opened then execute an action, else throw an error. withPGConnection :: PostgreConnection -> (Connection -> IO a) -> IO a -- | Get the count of rows affected by UPDATE, DELETE or INSERT query pgAffectedRows :: PostgreStatement -> IO Integer -- | Convert SqlValue to native libPQ data representation sqlValueToNative :: SqlValue -> Maybe (Oid, ByteString, Format) -- | Format UTCTime as ByteString formatUTC :: UTCTime -> ByteString -- | Format Day as ByteString formatDay :: Day -> ByteString -- | format TimeOfDay to ByteString formatT :: TimeOfDay -> ByteString -- | format LocalTime as ByteString formatDT :: LocalTime -> ByteString -- | format Word64 as bit field (001010111) formatBits :: Word64 -> ByteString -- | convert Oid to BuiltinType if not converted then throw -- an error o2b :: Oid -> BuiltinType -- | convert native LibPQ data representation to SqlValue. Now -- support just Text format completely. Maybe binary protocol will -- be added in future versions. nativeToSqlValue :: ByteString -> Format -> Oid -> IO SqlValue -- | parse ByteString as TimeOfDay parseT :: ByteString -> TimeOfDay -- | parse ByteString as LocalTime parseDT :: ByteString -> LocalTime -- | parse ByteString as Day parseD :: ByteString -> Day -- | parse ByteString as UTCTime parseUTC :: ByteString -> UTCTime -- | parse ByteString as 64 bit field (00101110) and convert to Word64 parseBit :: ByteString -> Word64 -- | get last error code and error message from connection and throw proper -- SqlError throwErrorMessage :: Connection -> IO a -- | Throws appropriate SqlError when no Result is not given, or it -- is in wrong status getPGResult :: Connection -> Maybe Result -> IO Result -- | Get error message from the result and throw it as SqlError throwResultError :: Result -> IO a pgRun :: PostgreConnection -> Query -> [SqlValue] -> IO Result pgRunRaw :: PostgreConnection -> Query -> IO Result pgRunMany :: PostgreConnection -> Query -> [[SqlValue]] -> IO () -- | get Result from PGStatementState if can. If can not throw an -- error with specified message pgstGetResult :: String -> PGStatementState -> Result instance Typeable PostgreStatement instance Typeable PostgreConnection instance Statement PostgreStatement instance Connection PostgreConnection -- | HDBI driver interface for PostgreSQL 8.x and above -- -- Written by John Goerzen, jgoerzen@complete.org module Database.HDBI.PostgreSQL data PostgreConnection PostgreConnection :: MVar (Maybe Connection) -> ChildList PostgreStatement -> Text -> PostgreConnection -- | LibPQ connection if established postNative :: PostgreConnection -> MVar (Maybe Connection) -- | List of weak refs to statements to finalize on disconnect postStatements :: PostgreConnection -> ChildList PostgreStatement -- | Original connection string postConnString :: PostgreConnection -> Text data PostgreStatement PostgreStatement :: Query -> PostgreConnection -> MVar PGStatementState -> PostgreStatement -- | Initial query stQuery :: PostgreStatement -> Query -- | Connection this statement working with stConnection :: PostgreStatement -> PostgreConnection -- | State of statement stState :: PostgreStatement -> MVar PGStatementState data PGStatementState -- | Newly created or reseted statement STNew :: PGStatementState -- | Just executed statement STExecuted :: !Result -> PGStatementState -- | The result to fetch data from pgstResult :: PGStatementState -> !Result -- | Fetching rows is in progress STFetching :: !Result -> !Column -> ![Format] -> ![Oid] -> !Row -> !Row -> PGStatementState -- | The result to fetch data from pgstResult :: PGStatementState -> !Result -- | Columns count pgstColumns :: PGStatementState -> !Column pgstFormats :: PGStatementState -> ![Format] pgstTypes :: PGStatementState -> ![Oid] -- | Tuples in result pgstTuples :: PGStatementState -> !Row -- | Row number waiting to fetch pgstCurrent :: PGStatementState -> !Row -- | Statement is finished, can still be reseted STFinished :: PGStatementState -- | Establish new PostgreSQL connection connectPostgreSQL :: Text -> IO PostgreConnection -- | Get the count of rows affected by UPDATE, DELETE or INSERT query pgAffectedRows :: PostgreStatement -> IO Integer