sequel_pg 1.2.1 → 1.2.2

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 +11 -2
  3. metadata +6 -6
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.2.2 (2012-03-09)
2
+
3
+ * Get microsecond accuracy when using datetime_class = DateTime with 1.8-1.9.2 stdlib date library via Rational (jeremyevans)
4
+
1
5
  === 1.2.1 (2012-02-22)
2
6
 
3
7
  * Handle NaN, Infinity, and -Infinity for double precision values correctly (jeremyevans)
@@ -13,11 +13,12 @@
13
13
  #endif
14
14
 
15
15
  #define SPG_MAX_FIELDS 256
16
- #define SPG_MILLISECONDS_PER_DAY 86400000000.0
16
+ #define SPG_MICROSECONDS_PER_DAY_LL 86400000000ULL
17
+ #define SPG_MICROSECONDS_PER_DAY 86400000000.0
17
18
  #define SPG_MINUTES_PER_DAY 1440.0
18
19
  #define SPG_SECONDS_PER_DAY 86400.0
19
20
 
20
- #define SPG_DT_ADD_USEC if (usec != 0) { dt = rb_funcall(dt, spg_id_op_plus, 1, rb_float_new(usec/SPG_MILLISECONDS_PER_DAY)); }
21
+ #define SPG_DT_ADD_USEC if (usec != 0) { dt = rb_funcall(dt, spg_id_op_plus, 1, spg_id_Rational ? rb_funcall(rb_cObject, spg_id_Rational, 2, INT2NUM(usec), ULL2NUM(SPG_MICROSECONDS_PER_DAY_LL)) : rb_float_new(usec/SPG_MICROSECONDS_PER_DAY)); }
21
22
 
22
23
  #define SPG_NO_TZ 0
23
24
  #define SPG_DB_LOCAL 1
@@ -56,6 +57,7 @@ static VALUE spg_nan;
56
57
  static VALUE spg_pos_inf;
57
58
  static VALUE spg_neg_inf;
58
59
 
60
+ static ID spg_id_Rational;
59
61
  static ID spg_id_new;
60
62
  static ID spg_id_local;
61
63
  static ID spg_id_year;
@@ -651,10 +653,17 @@ void Init_sequel_pg(void) {
651
653
  rb_global_variable(&spg_Blob);
652
654
  rb_global_variable(&spg_BigDecimal);
653
655
  rb_global_variable(&spg_Date);
656
+ rb_global_variable(&spg_SQLTime);
657
+ rb_global_variable(&spg_Postgres);
654
658
  rb_global_variable(&spg_nan);
655
659
  rb_global_variable(&spg_pos_inf);
656
660
  rb_global_variable(&spg_neg_inf);
657
661
 
662
+ /* Check for 1.8-1.9.2 stdlib date that needs Rational for usec accuracy */
663
+ if (rb_eval_string("Date.today.instance_variable_get(:@ajd)") != Qnil) {
664
+ spg_id_Rational = rb_intern("Rational");
665
+ }
666
+
658
667
  c = rb_funcall(spg_Postgres, cg, 1, rb_str_new2("Dataset"));
659
668
  rb_define_private_method(c, "yield_hash_rows", spg_yield_hash_rows, 2);
660
669
  rb_define_private_method(c, "fetch_rows_set_cols", spg_fetch_rows_set_cols, 1);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel_pg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-22 00:00:00.000000000 Z
12
+ date: 2012-03-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pg
16
- requirement: &4325145540 !ruby/object:Gem::Requirement
16
+ requirement: &4298956700 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.8.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *4325145540
24
+ version_requirements: *4298956700
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sequel
27
- requirement: &4325143400 !ruby/object:Gem::Requirement
27
+ requirement: &4298956220 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 3.29.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *4325143400
35
+ version_requirements: *4298956220
36
36
  description: ! 'sequel_pg overwrites the inner loop of the Sequel postgres
37
37
 
38
38
  adapter row fetching code with a C version. The C version