decode mysqlbinlog in C#

不想你离开。 提交于 2019-12-12 06:07:06

问题


MySQL saves all changes to the database in a binary file called binary log. MySQL provides a decoder called mysqlbinlog to decode these files. I thought if I wanted to parse this log file directly from an application then I need to find a way to decode it myself using C# for instance.

I know if I had the privilege I could use SHOW BINLOG EVENTS. However, parsing the file would be a better solution for me.

Has any of you done that before? Any suggestions?


回答1:


A look into the mysqlbinlog-tool code might be useful. Additionally, the dependencies of that tool are available here




回答2:


Since I am not a C++ expert and would take considerably long for me to figure out the code suggested by tuergeist, I have choosen another approach.

Since mysqlbinlog is already provided why not use it?

  • I could use the binary-log index to get all log files
  • Pass the filenames to a method using ProcessStartInfo to read the output of mysqlbinlog
  • The output then could be parsed to an array for instance.

I haven't tested it yet, but I'm working on it...



来源:https://stackoverflow.com/questions/1460471/decode-mysqlbinlog-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!