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.BinLog

Contents

Description

This module provide tools for binlog listening and row based binlog decoding.

Synopsis

binlog utilities

data BinLogTracker Source

binlog filename and position to start listening.

Constructors

BinLogTracker 

registerPesudoSlave :: MySQLConn -> SlaveID -> IO OK Source

Register a pesudo slave to master, although MySQL document suggests you should call this before calling dumpBinLog, but it seems it's not really necessary.

dumpBinLog Source

Arguments

:: MySQLConn

connection to be listened

-> SlaveID

a number for our pesudo slave.

-> BinLogTracker

binlog position

-> Bool

if master support semi-ack, do we want to enable it? if master doesn't support, this parameter will be ignored.

-> IO (FormatDescription, IORef ByteString, InputStream BinLogPacket)

FormatDescription, IORef contains current binlog filename, BinLogPacket stream.

Setup binlog listening on given connection, during listening the connection CAN NOT be used to do query, or an UnconsumedResultSet will be thrown.

data RowBinLogEvent Source

Row based biblog event type.

It's recommended to enable row query event before dumpBinLog, so that you can get RowQueryEvent in row based binlog(it's important for detect a table change for example), more information please refer sysvar_binlog_rows_query_log_events

a BinLogTracker is included so that you can roll up your own HA solutions, for example, writing the tracker to zookeeper when you done with an event.

decodeRowBinLogEvent :: (FormatDescription, IORef ByteString, InputStream BinLogPacket) -> IO (InputStream RowBinLogEvent) Source

decode row based event from BinLogPacket stream.

helpers

getLastBinLogTracker :: MySQLConn -> IO (Maybe BinLogTracker) Source

Get latest master's binlog filename and position.

isCheckSumEnabled :: MySQLConn -> IO Bool Source

Return True if binlog_checksum = CRC32. Only for MySQL > 5.6

isSemiSyncEnabled :: MySQLConn -> IO Bool Source

Return True if rpl_semi_sync_master_enabled = ON. Only for MySQL > 5.5

re-export