Copyright | (c) Winterland 2016 |
---|---|
License | BSD |
Maintainer | drkoster@qq.com |
Stability | experimental |
Portability | PORTABLE |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
MySQL packet decoder&encoder, and varities utility.
Synopsis
- data Packet = Packet {}
- putPacket :: Packet -> Put
- getPacket :: Get Packet
- isERR :: Packet -> Bool
- isOK :: Packet -> Bool
- isEOF :: Packet -> Bool
- isThereMore :: OK -> Bool
- decodeFromPacket :: Binary a => Packet -> IO a
- getFromPacket :: Get a -> Packet -> IO a
- data DecodePacketException = DecodePacketFailed ByteString ByteOffset String
- encodeToPacket :: Binary a => Word8 -> a -> Packet
- putToPacket :: Word8 -> Put -> Packet
- data OK = OK {
- okAffectedRows :: !Int
- okLastInsertID :: !Int
- okStatus :: !Word16
- okWarningCnt :: !Word16
- getOK :: Get OK
- putOK :: OK -> Put
- data ERR = ERR {
- errCode :: !Word16
- errState :: !ByteString
- errMsg :: !ByteString
- getERR :: Get ERR
- putERR :: ERR -> Put
- data EOF = EOF {
- eofWarningCnt :: !Word16
- eofStatus :: !Word16
- getEOF :: Get EOF
- putEOF :: EOF -> Put
- getByteStringNul :: Get ByteString
- getRemainingByteString :: Get ByteString
- putLenEncBytes :: ByteString -> Put
- getLenEncBytes :: Get ByteString
- getLenEncInt :: Get Int
- putLenEncInt :: Int -> Put
- putWord24le :: Word32 -> Put
- getWord24le :: Get Word32
- putWord48le :: Word64 -> Put
- getWord48le :: Get Word64
- getWord24be :: Get Word24
- getInt24be :: Get Int24
- getWord40be :: Get Word64
- getWord48be :: Get Word64
- getWord56be :: Get Word64
Documentation
isThereMore :: OK -> Bool Source #
Is there more packet to be read?
decodeFromPacket :: Binary a => Packet -> IO a Source #
Decoding packet inside IO, throw DecodePacketException
on fail parsing,
here we choose stability over correctness by omit incomplete consumed case:
if we successful parse a packet, then we don't care if there're bytes left.
data DecodePacketException Source #
Instances
Exception DecodePacketException Source # | |
Show DecodePacketException Source # | |
Defined in Database.MySQL.Protocol.Packet showsPrec :: Int -> DecodePacketException -> ShowS # show :: DecodePacketException -> String # showList :: [DecodePacketException] -> ShowS # |
You may get interested in OK
packet because it provides information about
successful operations.
OK | |
|
ERR | |
|
EOF | |
|
putLenEncBytes :: ByteString -> Put Source #
getLenEncInt :: Get Int Source #
putLenEncInt :: Int -> Put Source #
putWord24le :: Word32 -> Put Source #
getWord24le :: Get Word32 Source #
putWord48le :: Word64 -> Put Source #
getWord48le :: Get Word64 Source #
getWord24be :: Get Word24 Source #
getInt24be :: Get Int24 Source #
getWord40be :: Get Word64 Source #
getWord48be :: Get Word64 Source #
getWord56be :: Get Word64 Source #