| Copyright | (c) Winterland 2016 |
|---|---|
| License | BSD |
| Maintainer | drkoster@qq.com |
| Stability | experimental |
| Portability | PORTABLE |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Database.MySQL.Connection
Description
This is an internal module, the MySQLConn type should not directly acessed to user.
Synopsis
- data MySQLConn = MySQLConn {
- mysqlRead :: !(InputStream Packet)
- mysqlWrite :: Packet -> IO ()
- mysqlCloseSocket :: IO ()
- isConsumed :: !(IORef Bool)
- data ConnectInfo = ConnectInfo {}
- defaultConnectInfo :: ConnectInfo
- defaultConnectInfoMB4 :: ConnectInfo
- utf8_general_ci :: Word8
- utf8mb4_unicode_ci :: Word8
- bUFSIZE :: Int
- connect :: ConnectInfo -> IO MySQLConn
- connectDetail :: ConnectInfo -> IO (Greeting, MySQLConn)
- mkAuth :: ByteString -> ByteString -> ByteString -> Word8 -> Greeting -> Auth
- decodeInputStream :: InputStream ByteString -> IO (InputStream Packet)
- close :: MySQLConn -> IO ()
- ping :: MySQLConn -> IO OK
- command :: MySQLConn -> Command -> IO OK
- waitCommandReply :: InputStream Packet -> IO OK
- waitCommandReplys :: InputStream Packet -> IO [OK]
- readPacket :: InputStream Packet -> IO Packet
- writeCommand :: Command -> (Packet -> IO ()) -> IO ()
- guardUnconsumed :: MySQLConn -> IO ()
- writeIORef' :: IORef a -> a -> IO ()
- data NetworkException = NetworkException
- data UnconsumedResultSet = UnconsumedResultSet
- data ERRException = ERRException ERR
- data UnexpectedPacket = UnexpectedPacket Packet
Documentation
MySQLConn wrap both InputStream and OutputStream for MySQL Packet.
You shouldn't use one MySQLConn in different thread, if you do that,
consider protecting it with a MVar.
Constructors
| MySQLConn | |
Fields
| |
data ConnectInfo Source #
Everything you need to establish a MySQL connection.
To setup a TLS connection, use module Database.MySQL.TLS or Database.MySQL.OpenSSL.
Constructors
| ConnectInfo | |
Fields
| |
Instances
| Show ConnectInfo Source # | |
Defined in Database.MySQL.Connection Methods showsPrec :: Int -> ConnectInfo -> ShowS # show :: ConnectInfo -> String # showList :: [ConnectInfo] -> ShowS # | |
defaultConnectInfo :: ConnectInfo Source #
A simple ConnectInfo targeting localhost with user=root and empty password.
Default charset is set to utf8_general_ci to support older(< 5.5.3) MySQL versions,
but be aware this is a partial utf8 encoding, you may want to use defaultConnectInfoMB4
instead to support full utf8 charset(emoji, etc.). You can query your server's support
with SELECT id, collation_name FROM information_schema.collations ORDER BY id;
defaultConnectInfoMB4 :: ConnectInfo Source #
defaultConnectInfo with charset set to utf8mb4_unicode_ci
This is recommanded on any MySQL server version >= 5.5.3.
Socket buffer size.
maybe exposed to ConnectInfo laster?
connectDetail :: ConnectInfo -> IO (Greeting, MySQLConn) Source #
Establish a MySQL connection with Greeting back, so you can find server's version .etc.
mkAuth :: ByteString -> ByteString -> ByteString -> Word8 -> Greeting -> Auth Source #
decodeInputStream :: InputStream ByteString -> IO (InputStream Packet) Source #
A specialized decodeInputStream here for speed
waitCommandReply :: InputStream Packet -> IO OK Source #
waitCommandReplys :: InputStream Packet -> IO [OK] Source #
readPacket :: InputStream Packet -> IO Packet Source #
guardUnconsumed :: MySQLConn -> IO () Source #
writeIORef' :: IORef a -> a -> IO () Source #
data NetworkException Source #
Constructors
| NetworkException |
Instances
| Exception NetworkException Source # | |
Defined in Database.MySQL.Connection Methods toException :: NetworkException -> SomeException # | |
| Show NetworkException Source # | |
Defined in Database.MySQL.Connection Methods showsPrec :: Int -> NetworkException -> ShowS # show :: NetworkException -> String # showList :: [NetworkException] -> ShowS # | |
data UnconsumedResultSet Source #
Constructors
| UnconsumedResultSet |
Instances
| Exception UnconsumedResultSet Source # | |
Defined in Database.MySQL.Connection Methods toException :: UnconsumedResultSet -> SomeException # fromException :: SomeException -> Maybe UnconsumedResultSet # | |
| Show UnconsumedResultSet Source # | |
Defined in Database.MySQL.Connection Methods showsPrec :: Int -> UnconsumedResultSet -> ShowS # show :: UnconsumedResultSet -> String # showList :: [UnconsumedResultSet] -> ShowS # | |
data ERRException Source #
Constructors
| ERRException ERR |
Instances
| Exception ERRException Source # | |
Defined in Database.MySQL.Connection Methods toException :: ERRException -> SomeException # fromException :: SomeException -> Maybe ERRException # displayException :: ERRException -> String # | |
| Show ERRException Source # | |
Defined in Database.MySQL.Connection Methods showsPrec :: Int -> ERRException -> ShowS # show :: ERRException -> String # showList :: [ERRException] -> ShowS # | |
data UnexpectedPacket Source #
Constructors
| UnexpectedPacket Packet |
Instances
| Exception UnexpectedPacket Source # | |
Defined in Database.MySQL.Connection Methods toException :: UnexpectedPacket -> SomeException # | |
| Show UnexpectedPacket Source # | |
Defined in Database.MySQL.Connection Methods showsPrec :: Int -> UnexpectedPacket -> ShowS # show :: UnexpectedPacket -> String # showList :: [UnexpectedPacket] -> ShowS # | |