ruby-binlog 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,80 @@
1
+ #include "ruby_binlog.h"
2
+
3
+ VALUE rb_cBinlogUserVarEvent;
4
+
5
+ namespace ruby {
6
+ namespace binlog {
7
+
8
+ void UserVarEvent::free(UserVarEvent *p) {
9
+ if (p->m_event) {
10
+ delete p->m_event;
11
+ p->m_event = 0;
12
+ p->m_event_header = 0;
13
+ }
14
+
15
+ delete p;
16
+ }
17
+
18
+ VALUE UserVarEvent::alloc(VALUE klass) {
19
+ UserVarEvent *p;
20
+
21
+ p = new UserVarEvent();
22
+ p->m_event = 0;
23
+ p->m_event_header = 0;
24
+
25
+ return Data_Wrap_Struct(klass, 0, &free, p);
26
+ }
27
+
28
+ void UserVarEvent::set_event(VALUE self, mysql::Binary_log_event *event) {
29
+ UserVarEvent *p;
30
+
31
+ Data_Get_Struct(self, UserVarEvent, p);
32
+ p->m_event = static_cast<User_var_event*>(event);
33
+ p->m_event_header = event->header();
34
+ }
35
+
36
+ void UserVarEvent::init() {
37
+ rb_cBinlogUserVarEvent = rb_define_class_under(rb_mBinlog, "UserVarEvent", rb_cBinlogEvent);
38
+ rb_define_alloc_func(rb_cBinlogUserVarEvent, &alloc);
39
+
40
+ Event::init(rb_cBinlogUserVarEvent);
41
+
42
+ rb_define_method(rb_cBinlogUserVarEvent, "name", __F(&get_name), 0);
43
+ rb_define_method(rb_cBinlogUserVarEvent, "is_null", __F(&get_is_null), 0);
44
+ rb_define_method(rb_cBinlogUserVarEvent, "var_type", __F(&get_type), 0);
45
+ rb_define_method(rb_cBinlogUserVarEvent, "charset", __F(&get_charset), 0);
46
+ rb_define_method(rb_cBinlogUserVarEvent, "value", __F(&get_value), 0);
47
+ }
48
+
49
+ VALUE UserVarEvent::get_name(VALUE self) {
50
+ UserVarEvent *p;
51
+ Data_Get_Struct(self, UserVarEvent, p);
52
+ return rb_str_new2(p->m_event->name.c_str());
53
+ }
54
+
55
+ VALUE UserVarEvent::get_is_null(VALUE self) {
56
+ UserVarEvent *p;
57
+ Data_Get_Struct(self, UserVarEvent, p);
58
+ return UINT2NUM(p->m_event->is_null);
59
+ }
60
+
61
+ VALUE UserVarEvent::get_type(VALUE self) {
62
+ UserVarEvent *p;
63
+ Data_Get_Struct(self, UserVarEvent, p);
64
+ return UINT2NUM(p->m_event->type);
65
+ }
66
+
67
+ VALUE UserVarEvent::get_charset(VALUE self) {
68
+ UserVarEvent *p;
69
+ Data_Get_Struct(self, UserVarEvent, p);
70
+ return ULONG2NUM(p->m_event->charset);
71
+ }
72
+
73
+ VALUE UserVarEvent::get_value(VALUE self) {
74
+ UserVarEvent *p;
75
+ Data_Get_Struct(self, UserVarEvent, p);
76
+ return rb_str_new2(p->m_event->value.c_str());
77
+ }
78
+
79
+ } // namespace binlog
80
+ } // namespace ruby
Binary file
@@ -0,0 +1,52 @@
1
+ #include "ruby_binlog.h"
2
+
3
+ VALUE rb_cBinlogXid;
4
+
5
+ namespace ruby {
6
+ namespace binlog {
7
+
8
+ void XidEvent::free(XidEvent *p) {
9
+ if (p->m_event) {
10
+ delete p->m_event;
11
+ p->m_event = 0;
12
+ p->m_event_header = 0;
13
+ }
14
+
15
+ delete p;
16
+ }
17
+
18
+ VALUE XidEvent::alloc(VALUE klass) {
19
+ XidEvent *p;
20
+
21
+ p = new XidEvent();
22
+ p->m_event = 0;
23
+ p->m_event_header = 0;
24
+
25
+ return Data_Wrap_Struct(klass, 0, &free, p);
26
+ }
27
+
28
+ void XidEvent::set_event(VALUE self, mysql::Binary_log_event *event) {
29
+ XidEvent *p;
30
+
31
+ Data_Get_Struct(self, XidEvent, p);
32
+ p->m_event = static_cast<Xid*>(event);
33
+ p->m_event_header = event->header();
34
+ }
35
+
36
+ void XidEvent::init() {
37
+ rb_cBinlogXid = rb_define_class_under(rb_mBinlog, "Xid", rb_cBinlogEvent);
38
+ rb_define_alloc_func(rb_cBinlogXid, &alloc);
39
+
40
+ Event::init(rb_cBinlogXid);
41
+
42
+ rb_define_method(rb_cBinlogXid, "xid_id", __F(&get_xid_id), 0);
43
+ }
44
+
45
+ VALUE XidEvent::get_xid_id(VALUE self) {
46
+ XidEvent *p;
47
+ Data_Get_Struct(self, XidEvent, p);
48
+ return ULL2NUM(p->m_event->xid_id);
49
+ }
50
+
51
+ } // namespace binlog
52
+ } // namespace ruby
Binary file
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-binlog
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - winebarrel
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-08-25 00:00:00 Z
19
+ dependencies: []
20
+
21
+ description: Ruby binding for MySQL Binary log API.
22
+ email: sgwr_dts@yahoo.co.jp
23
+ executables: []
24
+
25
+ extensions:
26
+ - ext/extconf.rb
27
+ extra_rdoc_files:
28
+ - README
29
+ files:
30
+ - ext/ruby_binlog_xid_event.cpp
31
+ - ext/ruby_binlog_int_var_event.o
32
+ - ext/ruby_binlog.h
33
+ - ext/ruby_binlog_unimplemented_event.o
34
+ - ext/ruby_binlog_rotate_event.cpp
35
+ - ext/ruby_binlog_format_event.cpp
36
+ - ext/Makefile
37
+ - ext/ruby_binlog_format_event.o
38
+ - ext/ruby_binlog_user_var_event.o
39
+ - ext/ruby_binlog_user_var_event.cpp
40
+ - ext/ruby_binlog_event.o
41
+ - ext/ruby_binlog_event.h
42
+ - ext/extconf.rb
43
+ - ext/ruby_binlog.cpp
44
+ - ext/ruby_binlog_table_map_event.cpp
45
+ - ext/ruby_binlog_row_event.o
46
+ - ext/mkmf.log
47
+ - ext/ruby_binlog_row_event.cpp
48
+ - ext/ruby_binlog_event.cpp
49
+ - ext/ruby_binlog_query_event.cpp
50
+ - ext/ruby_binlog_incident_event.o
51
+ - ext/ruby_binlog_unimplemented_event.cpp
52
+ - ext/ruby_binlog_rotate_event.o
53
+ - ext/ruby_binlog_xid_event.o
54
+ - ext/ruby_binlog_query_event.o
55
+ - ext/ruby_binlog.o
56
+ - ext/ruby_binlog_int_var_event.cpp
57
+ - ext/binlog.so
58
+ - ext/ruby_binlog_incident_event.cpp
59
+ - ext/ruby_binlog_table_map_event.o
60
+ - README
61
+ homepage: https://bitbucket.org/winebarrel/ruby-binlog
62
+ licenses: []
63
+
64
+ post_install_message:
65
+ rdoc_options:
66
+ - --title
67
+ - ruby-binlog - Ruby binding for MySQL Binary log API.
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ hash: 3
85
+ segments:
86
+ - 0
87
+ version: "0"
88
+ requirements: []
89
+
90
+ rubyforge_project:
91
+ rubygems_version: 1.8.11
92
+ signing_key:
93
+ specification_version: 3
94
+ summary: Ruby binding for MySQL Binary log API.
95
+ test_files: []
96
+