ruby-binlog 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README +14 -1
  2. data/ext/ruby_binlog_row_event.cpp +16 -3
  3. metadata +15 -15
data/README CHANGED
@@ -4,7 +4,8 @@
4
4
 
5
5
  ruby-binlog is Ruby binding for MySQL Binary log API.
6
6
 
7
- see http://www.oscon.com/oscon2011/public/schedule/detail/18785
7
+ * http://www.oscon.com/oscon2011/public/schedule/detail/18785
8
+ * https://launchpad.net/mysql-replication-listener
8
9
 
9
10
  == Install
10
11
 
@@ -33,9 +34,12 @@ gem install ruby-binlog
33
34
 
34
35
  case event
35
36
  when Binlog::QueryEvent
37
+ puts event.db_name
36
38
  puts event.query
37
39
  when Binlog::RowEvent
38
40
  puts event.event_type
41
+ puts event.db_name
42
+ puts event.table_name
39
43
  p event.columns
40
44
  p event.rows
41
45
  when Binlog::RotateEvent
@@ -54,5 +58,14 @@ gem install ruby-binlog
54
58
 
55
59
  The following type are not supported in row mode.
56
60
 
61
+ * DECIMAL
62
+ * INT24
57
63
  * DATE
64
+ * TIME
65
+ * YEAR
66
+ * BIT
58
67
  * ENUM
68
+ * SET
69
+ * GEOMETRY
70
+
71
+ see http://bazaar.launchpad.net/~mysql/mysql-replication-listener/trunk/view/head:/src/value.cpp#L310
@@ -217,9 +217,22 @@ void RowEvent::proc0(mysql::Row_of_fields &fields, VALUE rb_fields) {
217
217
  mysql::Row_of_fields::iterator itor = fields.begin();
218
218
 
219
219
  do {
220
- std::string str;
221
- converter.to(str, *itor);
222
- rb_ary_push(rb_fields, rb_str_new2(str.c_str()));
220
+ VALUE rval = Qnil;
221
+ mysql::system::enum_field_types type = itor->type();
222
+
223
+ if (itor->is_null()) {
224
+ rval = Qnil;
225
+ } else if (type == mysql::system::MYSQL_TYPE_FLOAT) {
226
+ rval = rb_float_new(itor->as_float());
227
+ } else if (type == mysql::system::MYSQL_TYPE_DOUBLE) {
228
+ rval = rb_float_new(itor->as_double());
229
+ } else {
230
+ std::string out;
231
+ converter.to(out, *itor);
232
+ rval = rb_str_new2(out.c_str());
233
+ }
234
+
235
+ rb_ary_push(rb_fields, rval);
223
236
  } while(++itor != fields.end());
224
237
  }
225
238
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-binlog
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 6
10
- version: 0.1.6
9
+ - 7
10
+ version: 0.1.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - winebarrel
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-11-15 00:00:00 Z
18
+ date: 2012-11-16 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: Ruby binding for MySQL Binary log API.
@@ -27,22 +27,22 @@ extensions:
27
27
  extra_rdoc_files:
28
28
  - README
29
29
  files:
30
+ - ext/ruby_binlog_row_event.cpp
30
31
  - ext/ruby_binlog_incident_event.cpp
31
- - ext/ruby_binlog_xid_event.cpp
32
- - ext/ruby_binlog.cpp
32
+ - ext/ruby_binlog_table_map_event.cpp
33
+ - ext/ruby_binlog_int_var_event.cpp
33
34
  - ext/ruby_binlog_query_event.cpp
34
- - ext/ruby_binlog_event.cpp
35
+ - ext/ruby_binlog_user_var_event.cpp
35
36
  - ext/ruby_binlog_format_event.cpp
36
- - ext/ruby_binlog_row_event.cpp
37
- - ext/ruby_binlog_get_field_type_str.cpp
37
+ - ext/ruby_binlog_cast_to_tcp_driver.cpp
38
+ - ext/ruby_binlog.cpp
38
39
  - ext/ruby_binlog_rotate_event.cpp
39
- - ext/ruby_binlog_int_var_event.cpp
40
+ - ext/ruby_binlog_xid_event.cpp
41
+ - ext/ruby_binlog_event.cpp
42
+ - ext/ruby_binlog_get_field_type_str.cpp
40
43
  - ext/ruby_binlog_unimplemented_event.cpp
41
- - ext/ruby_binlog_table_map_event.cpp
42
- - ext/ruby_binlog_user_var_event.cpp
43
- - ext/ruby_binlog_cast_to_tcp_driver.cpp
44
- - ext/ruby_binlog_event.h
45
44
  - ext/ruby_binlog.h
45
+ - ext/ruby_binlog_event.h
46
46
  - ext/extconf.rb
47
47
  - README
48
48
  homepage: https://bitbucket.org/winebarrel/ruby-binlog
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  requirements: []
76
76
 
77
77
  rubyforge_project:
78
- rubygems_version: 1.8.11
78
+ rubygems_version: 1.8.24
79
79
  signing_key:
80
80
  specification_version: 3
81
81
  summary: Ruby binding for MySQL Binary log API.