------------------------------------------------------------------------------- |-- Module : Database.PostgreSQL.LibPQ.Internal-- Copyright : (c) 2010 Grant Monroe,-- (c) 2011 Leon P Smith-- License : BSD3---- This module exports the data constructor for the database connection-- object so that people may create their own foreign bindings to libpq-- functions that may not exist yet in vanilla postgresql-libpq.-------------------------------------------------------------------------------{-# LANGUAGE BangPatterns #-}{-# LANGUAGE EmptyDataDecls #-}moduleDatabase.PostgreSQL.LibPQ.InternalwhereimportControl.Concurrent.MVar(MVar)importForeign-- | 'Connection' encapsulates a connection to the backend.dataConnection =Conn {-# UNPACK#-}!(ForeignPtrPGconn ){-# UNPACK#-}!(MVarNoticeBuffer )instanceEqConnection where(Conn ForeignPtr PGconn c MVar NoticeBuffer _)== :: Connection -> Connection -> Bool ==(Conn ForeignPtr PGconn d MVar NoticeBuffer _)=ForeignPtr PGconn c ForeignPtr PGconn -> ForeignPtr PGconn -> Bool forall a. Eq a => a -> a -> Bool ==ForeignPtr PGconn d (Conn ForeignPtr PGconn c MVar NoticeBuffer _)/= :: Connection -> Connection -> Bool /=(Conn ForeignPtr PGconn d MVar NoticeBuffer _)=ForeignPtr PGconn c ForeignPtr PGconn -> ForeignPtr PGconn -> Bool forall a. Eq a => a -> a -> Bool /=ForeignPtr PGconn d withConn ::Connection ->(PtrPGconn ->IOb )->IOb withConn :: Connection -> (Ptr PGconn -> IO b) -> IO b withConn (Conn !ForeignPtr PGconn fp MVar NoticeBuffer _)Ptr PGconn -> IO b f =ForeignPtr PGconn -> (Ptr PGconn -> IO b) -> IO b forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b withForeignPtrForeignPtr PGconn fp Ptr PGconn -> IO b f {-# INLINEwithConn #-}dataPGconn dataCNoticeBuffer typeNoticeBuffer =PtrCNoticeBuffer