sequel_pg 1.2.0-x86-mswin32-60 → 1.2.1-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.2.1 (2012-02-22)
2
+
3
+ * Handle NaN, Infinity, and -Infinity for double precision values correctly (jeremyevans)
4
+
1
5
  === 1.2.0 (2011-11-01)
2
6
 
3
7
  * Add optimize_model_load setting to speedup loading of model objects, off by default (jeremyevans)
@@ -52,6 +52,10 @@ static VALUE spg_sym_model;
52
52
  static VALUE spg_sym__sequel_pg_type;
53
53
  static VALUE spg_sym__sequel_pg_value;
54
54
 
55
+ static VALUE spg_nan;
56
+ static VALUE spg_pos_inf;
57
+ static VALUE spg_neg_inf;
58
+
55
59
  static ID spg_id_new;
56
60
  static ID spg_id_local;
57
61
  static ID spg_id_year;
@@ -289,7 +293,15 @@ static VALUE spg__col_value(VALUE self, PGresult *res, long i, long j, VALUE* co
289
293
  break;
290
294
  case 700: /* float */
291
295
  case 701:
292
- rv = rb_float_new(rb_cstr_to_dbl(v, Qfalse));
296
+ if (strcmp("NaN", v) == 0) {
297
+ rv = spg_nan;
298
+ } else if (strcmp("Infinity", v) == 0) {
299
+ rv = spg_pos_inf;
300
+ } else if (strcmp("-Infinity", v) == 0) {
301
+ rv = spg_neg_inf;
302
+ } else {
303
+ rv = rb_float_new(rb_cstr_to_dbl(v, Qfalse));
304
+ }
293
305
  break;
294
306
  case 790: /* numeric */
295
307
  case 1700:
@@ -631,10 +643,17 @@ void Init_sequel_pg(void) {
631
643
  spg_Date = rb_funcall(rb_cObject, cg, 1, rb_str_new2("Date"));
632
644
  spg_Postgres = rb_funcall(spg_Sequel, cg, 1, rb_str_new2("Postgres"));
633
645
 
646
+ spg_nan = rb_eval_string("0.0/0.0");
647
+ spg_pos_inf = rb_eval_string("1.0/0.0");
648
+ spg_neg_inf = rb_eval_string("-1.0/0.0");
649
+
634
650
  rb_global_variable(&spg_Sequel);
635
651
  rb_global_variable(&spg_Blob);
636
652
  rb_global_variable(&spg_BigDecimal);
637
653
  rb_global_variable(&spg_Date);
654
+ rb_global_variable(&spg_nan);
655
+ rb_global_variable(&spg_pos_inf);
656
+ rb_global_variable(&spg_neg_inf);
638
657
 
639
658
  c = rb_funcall(spg_Postgres, cg, 1, rb_str_new2("Dataset"));
640
659
  rb_define_private_method(c, "yield_hash_rows", spg_yield_hash_rows, 2);
data/lib/1.8/sequel_pg.so CHANGED
Binary file
data/lib/1.9/sequel_pg.so CHANGED
Binary file
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel_pg
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 0
10
- version: 1.2.0
9
+ - 1
10
+ version: 1.2.1
11
11
  platform: x86-mswin32-60
12
12
  authors:
13
13
  - Jeremy Evans
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-31 00:00:00 -07:00
18
+ date: 2011-11-01 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency