mysql-haskell-1.1.5: pure haskell MySQL driver
Copyright(c) Winterland 2016
LicenseBSD
Maintainerdrkoster@qq.com
Stabilityexperimental
PortabilityPORTABLE
Safe HaskellSafe-Inferred
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, if you want to get text representation back, you have to query column charset infomation, and use icu or iconv to decode. IT MAY NOT BE UTF-8.

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 

Instances

Instances details
Generic BinLogValue Source # 
Instance details

Defined in Database.MySQL.BinLogProtocol.BinLogValue

Associated Types

type Rep BinLogValue :: Type -> Type #

Show BinLogValue Source # 
Instance details

Defined in Database.MySQL.BinLogProtocol.BinLogValue

Eq BinLogValue Source # 
Instance details

Defined in Database.MySQL.BinLogProtocol.BinLogValue

type Rep BinLogValue Source # 
Instance details

Defined in Database.MySQL.BinLogProtocol.BinLogValue

type Rep BinLogValue = D1 ('MetaData "BinLogValue" "Database.MySQL.BinLogProtocol.BinLogValue" "mysql-haskell-1.1.5-Lci34tIS5e1Py7iUMs9yW" 'False) ((((C1 ('MetaCons "BinLogTiny" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int8)) :+: C1 ('MetaCons "BinLogShort" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int16))) :+: (C1 ('MetaCons "BinLogInt24" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int24)) :+: (C1 ('MetaCons "BinLogLong" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int32)) :+: C1 ('MetaCons "BinLogLongLong" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int64))))) :+: ((C1 ('MetaCons "BinLogFloat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Float)) :+: (C1 ('MetaCons "BinLogDouble" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double)) :+: C1 ('MetaCons "BinLogBit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)))) :+: (C1 ('MetaCons "BinLogTimeStamp" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word32)) :+: (C1 ('MetaCons "BinLogTimeStamp2" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word32)) :+: C1 ('MetaCons "BinLogDateTime" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word16) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8))) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8)))))))) :+: (((C1 ('MetaCons "BinLogDateTime2" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word16) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8))) :*: ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word32)))) :+: C1 ('MetaCons "BinLogDate" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word16) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8)))) :+: (C1 ('MetaCons "BinLogTime" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word16)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8))) :+: (C1 ('MetaCons "BinLogTime2" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word16)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word32)))) :+: C1 ('MetaCons "BinLogYear" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word16))))) :+: ((C1 ('MetaCons "BinLogNewDecimal" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Scientific)) :+: (C1 ('MetaCons "BinLogEnum" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word16)) :+: C1 ('MetaCons "BinLogSet" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)))) :+: (C1 ('MetaCons "BinLogBytes" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString)) :+: (C1 ('MetaCons "BinLogGeometry" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString)) :+: C1 ('MetaCons "BinLogNull" 'PrefixI 'False) (U1 :: Type -> Type))))))

getBinLogField :: BinLogMeta -> Get BinLogValue Source #

BinLog protocol decoder

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

BinLog row decoder