sequel_pg 1.6.4 → 1.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +4 -0
  3. data/ext/sequel_pg/sequel_pg.c +15 -15
  4. metadata +14 -24
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b1aa68756578004af7fd8902e1e1a1560f451aa8
4
+ data.tar.gz: aaff4eb191c7b19815122a5988508e70e43ef5f0
5
+ SHA512:
6
+ metadata.gz: 781963db94f96ce1834d19b3ac7acd0a707a358fc5574dc1b721e84d7b572154548b8ad58ba063407698e4bb6ffe44d29c13373e00c71d4e9785adbfb0e20e2f
7
+ data.tar.gz: 5dc8901c114698aa9ffc8d0cea2a12b116a1a1c1f41a9d13216091ca1ee3047f2d5b638a3d0c57390936384269d417cd362377fe69fa21fdb50fff5312fbbadf
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:
metadata CHANGED
@@ -1,57 +1,48 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel_pg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.4
5
- prerelease:
4
+ version: 1.6.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jeremy Evans
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-14 00:00:00.000000000 Z
11
+ date: 2013-03-06 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: pg
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.8.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.8.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: sequel
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: 3.39.0
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: 3.39.0
46
- description: ! 'sequel_pg overwrites the inner loop of the Sequel postgres
47
-
41
+ description: |
42
+ sequel_pg overwrites the inner loop of the Sequel postgres
48
43
  adapter row fetching code with a C version. The C version
49
-
50
44
  is significantly faster (2-6x) than the pure ruby version
51
-
52
45
  that Sequel uses by default.
53
-
54
- '
55
46
  email: code@jeremyevans.net
56
47
  executables: []
57
48
  extensions:
@@ -71,33 +62,32 @@ files:
71
62
  - lib/sequel/extensions/pg_streaming.rb
72
63
  homepage: http://github.com/jeremyevans/sequel_pg
73
64
  licenses: []
65
+ metadata: {}
74
66
  post_install_message:
75
67
  rdoc_options:
76
68
  - --quiet
77
69
  - --line-numbers
78
70
  - --inline-source
79
71
  - --title
80
- - ! 'sequel_pg: Faster SELECTs when using Sequel with pg'
72
+ - 'sequel_pg: Faster SELECTs when using Sequel with pg'
81
73
  - --main
82
74
  - README.rdoc
83
75
  require_paths:
84
76
  - lib
85
77
  required_ruby_version: !ruby/object:Gem::Requirement
86
- none: false
87
78
  requirements:
88
- - - ! '>='
79
+ - - '>='
89
80
  - !ruby/object:Gem::Version
90
81
  version: 1.8.7
91
82
  required_rubygems_version: !ruby/object:Gem::Requirement
92
- none: false
93
83
  requirements:
94
- - - ! '>='
84
+ - - '>='
95
85
  - !ruby/object:Gem::Version
96
86
  version: '0'
97
87
  requirements: []
98
88
  rubyforge_project:
99
- rubygems_version: 1.8.23
89
+ rubygems_version: 2.0.0
100
90
  signing_key:
101
- specification_version: 3
91
+ specification_version: 4
102
92
  summary: Faster SELECTs when using Sequel with pg
103
93
  test_files: []