Copyright | (c) Winterland 2016 |
---|---|
License | BSD |
Maintainer | drkoster@qq.com |
Stability | experimental |
Portability | PORTABLE |
Safe Haskell | None |
Language | Haskell2010 |
This is an internal module, the MySQLConn
type should not directly acessed to user.
- data MySQLConn = MySQLConn {
- mysqlRead :: !(InputStream Packet)
- mysqlWrite :: !(OutputStream Packet)
- 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
- readPacket :: InputStream Packet -> IO Packet
- writeCommand :: Command -> OutputStream Packet -> 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
.
MySQLConn | |
|
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.
ConnectInfo | |
|
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 #
readPacket :: InputStream Packet -> IO Packet Source #
writeCommand :: Command -> OutputStream Packet -> IO () Source #
guardUnconsumed :: MySQLConn -> IO () Source #
writeIORef' :: IORef a -> a -> IO () Source #
data NetworkException Source #
data UnconsumedResultSet Source #
data ERRException Source #