Commits

Bryan O'Sullivan  committed 6f5e1e7

SSL cipher info.

  • Participants
  • Parent commits 32b656f

Comments (0)

Files changed (2)

File Database/MySQL.hs

     , hostInfo
     , protocolInfo
     , characterSetName
+    , sslCipher
     -- * General information
     , clientInfo
     , clientVersion
 characterSetName conn = withConn conn $ \ptr ->
                         peekCString =<< mysql_character_set_name ptr
 
+sslCipher :: Connection -> IO (Maybe String)
+sslCipher conn = withConn conn $ \ptr -> do
+  name <- mysql_get_ssl_cipher ptr
+  if name == nullPtr
+    then return Nothing
+    else Just <$> peekCString name
+
 clientInfo :: String
 clientInfo = unsafePerformIO $ peekCString mysql_get_client_info
 {-# NOINLINE clientInfo #-}

File Database/MySQL/C.hsc

     , mysql_get_host_info
     , mysql_get_proto_info
     , mysql_character_set_name
+    , mysql_get_ssl_cipher
     -- * General information
     , mysql_get_client_info
     , mysql_get_client_version
 foreign import ccall safe mysql_character_set_name
     :: Ptr MYSQL -> IO CString
 
+foreign import ccall safe mysql_get_ssl_cipher
+    :: Ptr MYSQL -> IO CString
+
 foreign import ccall safe mysql_get_client_info :: CString
 
 foreign import ccall safe mysql_get_client_version :: CULong