Functions retreiving information about connection

This commit is contained in:
VyacheslavHashov 2017-02-02 02:31:06 +03:00
parent 22f4d6f047
commit 45c8f03ebe

View File

@ -50,7 +50,7 @@ data DataMessage = DataMessage [V.Vector B.ByteString]
-- | Parameters of the current connection.
-- We store only the parameters that cannot change after startup.
-- For more information about additional parameters see documentation.
-- For more information about additional parameters see PostgreSQL documentation.
data ConnectionParameters = ConnectionParameters
{ paramServerVersion :: ServerVersion
, paramServerEncoding :: B.ByteString -- ^ character set name
@ -332,3 +332,14 @@ withConnectionMode conn mode handler = do
where
ref = connMode conn
-- Information about connection
getServerVersion :: Connection -> ServerVersion
getServerVersion = paramServerVersion . connParameters
getServerEncoding :: Connection -> B.ByteString
getServerEncoding = paramServerEncoding . connParameters
getIntegerDatetimes :: Connection -> Bool
getIntegerDatetimes = paramIntegerDatetimes . connParameters