sequel_pg 1.2.1-x86-mingw32 → 1.2.2-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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);
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: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 1
10
- version: 1.2.1
9
+ - 2
10
+ version: 1.2.2
11
11
  platform: x86-mingw32
12
12
  authors:
13
13
  - Jeremy Evans