mysql-haskell-0.1.0.0: pure haskell MySQL driver

Copyright(c) Winterland, 2016
LicenseBSD
Maintainerdrkoster@qq.com
Stabilityexperimental
PortabilityPORTABLE
Safe HaskellNone
LanguageHaskell2010

Database.MySQL.BinLogProtocol.BinLogValue

Description

Binlog protocol

Synopsis

Documentation

data BinLogValue Source

Data type for representing binlog values.

This data type DOES NOT try to parse binlog values into detailed haskell values, because you may not want to waste performance in situations like database middleware.

Due to the lack of signedness infomation in binlog meta, we cannot distinguish, for example, between unsigned tiny 255 and tiny -1, so we use int to present TINY,SHORT,INT,LONG. If you have unsigned columns, use fromIntegral to convert it to word to get real unsigned value back, for example, fromIntegral (-1 :: Int) == 255 :: Word

For above reason, we use Int24 to present MySQL's INT24 type, you can get back the unsigned value using word24 package's Word24 type.

Timestamp types(BinLogTimeStamp and BinLogTimeStamp2) are values converted into UTC already, see MySQLVaule 's note.

There's also no infomation about charset, so we use ByteString to present both text and blob types.

The SET and ENUM values are presented by their index's value and bitmap respectively, if you need get the string value back, you have to perform a 'DESC tablename' to get the set or enum table.

Constructors

BinLogTiny !Int8 
BinLogShort !Int16 
BinLogInt24 !Int24 
BinLogLong !Int32 
BinLogLongLong !Int64 
BinLogFloat !Float 
BinLogDouble !Double 
BinLogBit !Word64

a 64bit bitmap.

BinLogTimeStamp !Word32

a utc timestamp, note 0 doesn't mean 1970-01-01 00:00:00, because mysql choose 0 to present '0000-00-00 00:00:00'

BinLogTimeStamp2 !Word32 !Word32

like BinLogTimeStamp with an addtional microseconds field.

BinLogDateTime !Word16 !Word8 !Word8 !Word8 !Word8 !Word8

YYYY MM DD hh mm ss

BinLogDateTime2 !Word16 !Word8 !Word8 !Word8 !Word8 !Word8 !Word32

YYYY MM DD hh mm ss microsecond

BinLogDate !Word16 !Word8 !Word8

YYYY MM DD

BinLogTime !Word8 !Word16 !Word8 !Word8

sign(1= non-negative, 0= negative) hh mm ss

BinLogTime2 !Word8 !Word16 !Word8 !Word8 !Word32

sign(1= non-negative, 0= negative) hh mm ss microsecond

BinLogYear !Word16

year value, 0 stand for '0000'

BinLogNewDecimal !Scientific

sign(1= non-negative, 0= negative) integeral part, fractional part

BinLogEnum !Word16

enum indexing value

BinLogSet !Word64

set indexing 64bit bitmap.

BinLogBytes !ByteString

all string and blob values.

BinLogGeometry !ByteString 
BinLogNull 

getBinLogField :: BinLogMeta -> Get BinLogValue Source

BinLog protocol decoder

getBinLogRow :: [BinLogMeta] -> BitMap -> Get [BinLogValue] Source

BinLog row decoder