Skip to content

Instantly share code, notes, and snippets.

Created December 3, 2015 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/02593d4981ac826f9837 to your computer and use it in GitHub Desktop.
Save anonymous/02593d4981ac826f9837 to your computer and use it in GitHub Desktop.
patch for MySQL Binlog Events example basic-2.ccp
--- basic-2.cpp 2015-12-03 23:27:10.211110217 +0900
+++ basic-2.fixed.cpp 2015-12-03 23:26:42.965113967 +0900
@@ -46,8 +46,9 @@ public:
}
Binary_log_event *process_event(User_var_event *event) {
- m_var[event->name] = event->val;
- return NULL;
+ std::string a(event->val, 0, event->val_len);
+ m_var[event->name] = a;
+ return event;
}
private:
@@ -75,6 +76,7 @@ public:
query.replace(start, end - start, "'" + m_var[key] + "'");
}
event->query= query.c_str();
+
return event;
}
private:
@@ -143,6 +145,7 @@ int main(int argc, char** argv) {
std::cerr << msg << std::endl;
break;
}
+ handler.handle_event(&event);
switch (event->get_event_type()) {
case QUERY_EVENT:
std::cout << static_cast<Query_event*>(event)->query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment