sequel_pg 1.6.4-x86-mswin32-60 → 1.6.5-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.6.5 (2013-03-06)
2
+
3
+ * Handle infinite dates using Database#convert_infinite_timestamps (jeremyevans)
4
+
1
5
  === 1.6.4 (2013-01-14)
2
6
 
3
7
  * Remove type conversion of int2vector and money types on PostgreSQL, since previous conversions were wrong (jeremyevans) (#8)
@@ -268,17 +268,7 @@ static VALUE spg_time(const char *s) {
268
268
  return rb_funcall(spg_SQLTime, spg_id_local, 7, rb_funcall(now, spg_id_year, 0), rb_funcall(now, spg_id_month, 0), rb_funcall(now, spg_id_day, 0), INT2NUM(hour), INT2NUM(minute), INT2NUM(second), INT2NUM(usec));
269
269
  }
270
270
 
271
- static VALUE spg_date(const char *s) {
272
- int year, month, day;
273
-
274
- if(3 != sscanf(s, "%d-%2d-%2d", &year, &month, &day)) {
275
- rb_raise(rb_eArgError, "unexpected date format");
276
- }
277
-
278
- return rb_funcall(spg_Date, spg_id_new, 3, INT2NUM(year), INT2NUM(month), INT2NUM(day));
279
- }
280
-
281
- static VALUE spg_timestamp_error(const char *s, VALUE self) {
271
+ static VALUE spg_timestamp_error(const char *s, VALUE self, const char *error_msg) {
282
272
  VALUE db;
283
273
  db = rb_funcall(self, spg_id_db, 0);
284
274
  if(RTEST(rb_funcall(db, spg_id_convert_infinite_timestamps, 0))) {
@@ -286,7 +276,17 @@ static VALUE spg_timestamp_error(const char *s, VALUE self) {
286
276
  return rb_funcall(db, spg_id_infinite_timestamp_value, 1, rb_tainted_str_new2(s));
287
277
  }
288
278
  }
289
- rb_raise(rb_eArgError, "unexpected datetime format");
279
+ rb_raise(rb_eArgError, error_msg);
280
+ }
281
+
282
+ static VALUE spg_date(const char *s, VALUE self) {
283
+ int year, month, day;
284
+
285
+ if(3 != sscanf(s, "%d-%2d-%2d", &year, &month, &day)) {
286
+ return spg_timestamp_error(s, self, "unexpected date format");
287
+ }
288
+
289
+ return rb_funcall(spg_Date, spg_id_new, 3, INT2NUM(year), INT2NUM(month), INT2NUM(day));
290
290
  }
291
291
 
292
292
  static VALUE spg_timestamp(const char *s, VALUE self) {
@@ -306,7 +306,7 @@ static VALUE spg_timestamp(const char *s, VALUE self) {
306
306
  &usec_start, &usec, &usec_stop,
307
307
  &offset_sign, &offset_hour, &offset_minute);
308
308
  if(tokens < 7) {
309
- return spg_timestamp_error(s, self);
309
+ return spg_timestamp_error(s, self, "unexpected datetime format");
310
310
  }
311
311
  usec *= (int) pow(10, (6 - (usec_stop - usec_start)));
312
312
  } else {
@@ -318,7 +318,7 @@ static VALUE spg_timestamp(const char *s, VALUE self) {
318
318
  min = 0;
319
319
  sec = 0;
320
320
  } else if (tokens < 6) {
321
- return spg_timestamp_error(s, self);
321
+ return spg_timestamp_error(s, self, "unexpected datetime format");
322
322
  }
323
323
  usec = 0;
324
324
  }
@@ -474,7 +474,7 @@ static VALUE spg__col_value(VALUE self, PGresult *res, long i, long j, VALUE* co
474
474
  rv = rb_funcall(spg_BigDecimal, spg_id_new, 1, rb_str_new(v, PQgetlength(res, i, j)));
475
475
  break;
476
476
  case 1082: /* date */
477
- rv = spg_date(v);
477
+ rv = spg_date(v, self);
478
478
  break;
479
479
  case 1083: /* time */
480
480
  case 1266:
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: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 6
9
- - 4
10
- version: 1.6.4
9
+ - 5
10
+ version: 1.6.5
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: 2012-12-18 00:00:00 Z
18
+ date: 2012-12-19 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: pg