In preparation for the MySQL UC and my session about binlogs I
started to implement a first few ideas. In a short coding rush I
moved some of the C-code from mysql-binlog-dump.c to
the right places in the libraries and wrapped it nicely for Lua.
My overall goal is to make a clean cut between
- a library to work with binlogs
- wrapping with for Lua's use
- a front-end that's making use of all of it
With code in hands I can now toss in a liitle lua script to dump a simple statement-based binlog:
local binlog = assert(require("mysql.binlog"))
local basedir = "/usr/local/mysql/data/"
local file = "jan-kneschkes-macbook-pro-bin.001005"
while file do
local f = assert(binlog.open(basedir .. file))
file = nil
for event in f:next() do
if event.type == "QUERY_EVENT" then
print(("/* threadid: %d */ %s"):format( …[Read more]