sequel_pg 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/CHANGELOG +4 -0
  2. data/ext/sequel_pg/sequel_pg.c +20 -1
  3. metadata +41 -66
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);
metadata CHANGED
@@ -1,70 +1,56 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: sequel_pg
3
- version: !ruby/object:Gem::Version
4
- hash: 31
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.1
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 2
9
- - 0
10
- version: 1.2.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Jeremy Evans
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-11-01 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-02-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: pg
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &4325145540 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 63
29
- segments:
30
- - 0
31
- - 8
32
- - 0
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
33
21
  version: 0.8.0
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: sequel
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *4325145540
25
+ - !ruby/object:Gem::Dependency
26
+ name: sequel
27
+ requirement: &4325143400 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 115
45
- segments:
46
- - 3
47
- - 29
48
- - 0
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
49
32
  version: 3.29.0
50
33
  type: :runtime
51
- version_requirements: *id002
52
- description: |
53
- sequel_pg overwrites the inner loop of the Sequel postgres
34
+ prerelease: false
35
+ version_requirements: *4325143400
36
+ description: ! 'sequel_pg overwrites the inner loop of the Sequel postgres
37
+
54
38
  adapter row fetching code with a C version. The C version
39
+
55
40
  is significantly faster (2-6x) than the pure ruby version
41
+
56
42
  that Sequel uses by default.
57
43
 
44
+ '
58
45
  email: code@jeremyevans.net
59
46
  executables: []
60
-
61
- extensions:
47
+ extensions:
62
48
  - ext/sequel_pg/extconf.rb
63
- extra_rdoc_files:
49
+ extra_rdoc_files:
64
50
  - README.rdoc
65
51
  - CHANGELOG
66
52
  - MIT-LICENSE
67
- files:
53
+ files:
68
54
  - MIT-LICENSE
69
55
  - CHANGELOG
70
56
  - README.rdoc
@@ -74,44 +60,33 @@ files:
74
60
  - lib/sequel_pg/sequel_pg.rb
75
61
  homepage: http://github.com/jeremyevans/sequel_pg
76
62
  licenses: []
77
-
78
63
  post_install_message:
79
- rdoc_options:
64
+ rdoc_options:
80
65
  - --quiet
81
66
  - --line-numbers
82
67
  - --inline-source
83
68
  - --title
84
- - "sequel_pg: Faster SELECTs when using Sequel with pg"
69
+ - ! 'sequel_pg: Faster SELECTs when using Sequel with pg'
85
70
  - --main
86
71
  - README.rdoc
87
- require_paths:
72
+ require_paths:
88
73
  - lib
89
- required_ruby_version: !ruby/object:Gem::Requirement
74
+ required_ruby_version: !ruby/object:Gem::Requirement
90
75
  none: false
91
- requirements:
92
- - - ">="
93
- - !ruby/object:Gem::Version
94
- hash: 59
95
- segments:
96
- - 1
97
- - 8
98
- - 6
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
99
79
  version: 1.8.6
100
- required_rubygems_version: !ruby/object:Gem::Requirement
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
81
  none: false
102
- requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- hash: 3
106
- segments:
107
- - 0
108
- version: "0"
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
109
86
  requirements: []
110
-
111
87
  rubyforge_project:
112
- rubygems_version: 1.8.10
88
+ rubygems_version: 1.8.11
113
89
  signing_key:
114
90
  specification_version: 3
115
91
  summary: Faster SELECTs when using Sequel with pg
116
92
  test_files: []
117
-