oedipus 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -214,7 +214,11 @@ static VALUE odp_replace_bind_values(OdpMysql * conn, VALUE sql, VALUE * bind_va
214
214
  escaped_sql_len = sql_len;
215
215
 
216
216
  for (i = 0; i < num_values; ++i) {
217
- if (T_STRING == TYPE(bind_values[i])) {
217
+ if (Qtrue == bind_values[i]) {
218
+ str_values[i] = (char *) "1";
219
+ } else if (Qfalse == bind_values[i]) {
220
+ str_values[i] = (char *) "0";
221
+ } else if (T_STRING == TYPE(bind_values[i])) {
218
222
  str_values[i] = RSTRING_PTR(bind_values[i]);
219
223
  } else if (ODP_KIND_OF_P(bind_values[i], rb_cNumeric) && !(ODP_KIND_OF_P(bind_values[i], rb_cInteger))) {
220
224
  str_values[i] = RSTRING_PTR(ODP_TO_S(ODP_TO_F(bind_values[i])));
@@ -242,7 +246,7 @@ static VALUE odp_replace_bind_values(OdpMysql * conn, VALUE sql, VALUE * bind_va
242
246
  break;
243
247
  }
244
248
 
245
- if (!(ODP_KIND_OF_P(bind_values[i], rb_cNumeric))) {
249
+ if (!(ODP_KIND_OF_P(bind_values[i], rb_cNumeric) || T_TRUE == TYPE(bind_values[i]) || T_FALSE == TYPE(bind_values[i]))) {
246
250
  // would prefer to use stack allocation, but it segfaults with larger (megabytes) values
247
251
  char * escaped_str = (char *) malloc(escaped_value_lengths[i]);
248
252
  char * quoted_str = (char *) malloc(escaped_value_lengths[i]);
@@ -8,5 +8,5 @@
8
8
  ##
9
9
 
10
10
  module Oedipus
11
- VERSION = "0.0.12"
11
+ VERSION = "0.0.13"
12
12
  end
@@ -140,6 +140,14 @@ describe Oedipus::Connection do
140
140
  conn.execute("REPLACE INTO posts_rt (id, title, state, body) VALUES (?, 'question?', 'other?', ?)", 1, nil)
141
141
  end
142
142
 
143
+ it "handles true" do
144
+ conn.execute("REPLACE INTO posts_rt (id, views) VALUES (?, ?)", 1, true)
145
+ end
146
+
147
+ it "handles false" do
148
+ conn.execute("REPLACE INTO posts_rt (id, views) VALUES (?, ?)", 1, false)
149
+ end
150
+
143
151
  it "handles really long strings" do
144
152
  conn.execute("REPLACE INTO posts_rt (id, title, state, body) VALUES (?, 'question?', 'other?', ?)", 1, 'a' * 2_000_000)
145
153
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oedipus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-05-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &19781180 !ruby/object:Gem::Requirement
16
+ requirement: &23194300 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *19781180
24
+ version_requirements: *23194300
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake-compiler
27
- requirement: &19780720 !ruby/object:Gem::Requirement
27
+ requirement: &23193860 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *19780720
35
+ version_requirements: *23193860
36
36
  description: ! "== Sphinx 2 Comes to Ruby\n\nOedipus brings full support for Sphinx
37
37
  2 to Ruby:\n\n - real-time indexes (insert, replace, update, delete)\n - faceted
38
38
  search (variations on a base query)\n - multi-queries (multiple queries executed
@@ -111,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
111
  version: '0'
112
112
  segments:
113
113
  - 0
114
- hash: -3179225269925894902
114
+ hash: 1539164909782359047
115
115
  required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  segments:
122
122
  - 0
123
- hash: -3179225269925894902
123
+ hash: 1539164909782359047
124
124
  requirements: []
125
125
  rubyforge_project: oedipus
126
126
  rubygems_version: 1.8.11