sequel_pg 1.6.5 → 1.6.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1aa68756578004af7fd8902e1e1a1560f451aa8
4
- data.tar.gz: aaff4eb191c7b19815122a5988508e70e43ef5f0
3
+ metadata.gz: b4534a4f3fc0a9874f98a9975d3e6438f569fdd8
4
+ data.tar.gz: 31ead4011ba3060f4883c62b1fba0431db2d593e
5
5
  SHA512:
6
- metadata.gz: 781963db94f96ce1834d19b3ac7acd0a707a358fc5574dc1b721e84d7b572154548b8ad58ba063407698e4bb6ffe44d29c13373e00c71d4e9785adbfb0e20e2f
7
- data.tar.gz: 5dc8901c114698aa9ffc8d0cea2a12b116a1a1c1f41a9d13216091ca1ee3047f2d5b638a3d0c57390936384269d417cd362377fe69fa21fdb50fff5312fbbadf
6
+ metadata.gz: b4c43e04b77565a9a0dfc1ef933b2eab36e1635837d5e740c18ca13dc2edaf2cf783a7e640cd54df40a0a3aa6205158d66d5952470e7208d7c6c95854503c4bc
7
+ data.tar.gz: 3351d0c50c38a078fbe04fe2cbcf5cbe6ab22cade617a08d4f1c1daabb44420d594e9af75b2b04a8537219572b221b95992c731e6187ddaecdd700b6871e532b
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ === 1.6.6 (2013-05-31)
2
+
3
+ * Work correctly when using the named_timezones extension (jeremyevans)
4
+
5
+ * Work around format-security false positive (jeremyevans) (#9)
6
+
1
7
  === 1.6.5 (2013-03-06)
2
8
 
3
9
  * Handle infinite dates using Database#convert_infinite_timestamps (jeremyevans)
data/README.rdoc CHANGED
@@ -157,7 +157,7 @@ sequel_pg has been tested on the following:
157
157
  * ruby 1.8.7
158
158
  * ruby 1.9.2
159
159
  * ruby 1.9.3
160
- * ruby 2.0.0preview1
160
+ * ruby 2.0.0
161
161
  * rbx 1.2.4
162
162
 
163
163
  If your platform, compiler version, or ruby version is not listed
@@ -178,10 +178,6 @@ above, please test and send me a report including:
178
178
  should be OK.
179
179
  * Adding your own type conversion procs only has an effect if those
180
180
  types are not handled by default.
181
- * The named_timezones plugin does not integrate with sequel_pg, since
182
- sequel_pg does it's own timestamp conversions. The :local and :utc
183
- settings for database_timestamp and application_timestamp do work,
184
- as does setting the datetime_class to DateTime.
185
181
  * You do not need to require the library, the sequel postgres adapter
186
182
  will require it automatically. If you are using bundler, you
187
183
  should add it to your Gemfile like so:
@@ -83,6 +83,7 @@ static ID spg_id_day;
83
83
  static ID spg_id_output_identifier;
84
84
  static ID spg_id_datetime_class;
85
85
  static ID spg_id_application_timezone;
86
+ static ID spg_id_to_application_timestamp;
86
87
  static ID spg_id_timezone;
87
88
  static ID spg_id_op_plus;
88
89
  static ID spg_id_utc;
@@ -276,7 +277,7 @@ static VALUE spg_timestamp_error(const char *s, VALUE self, const char *error_ms
276
277
  return rb_funcall(db, spg_id_infinite_timestamp_value, 1, rb_tainted_str_new2(s));
277
278
  }
278
279
  }
279
- rb_raise(rb_eArgError, error_msg);
280
+ rb_raise(rb_eArgError, "%s", error_msg);
280
281
  }
281
282
 
282
283
  static VALUE spg_date(const char *s, VALUE self) {
@@ -290,7 +291,7 @@ static VALUE spg_date(const char *s, VALUE self) {
290
291
  }
291
292
 
292
293
  static VALUE spg_timestamp(const char *s, VALUE self) {
293
- VALUE dtc, dt, rtz;
294
+ VALUE dtc, dt, rtz, db;
294
295
  int tz = SPG_NO_TZ;
295
296
  int year, month, day, hour, min, sec, usec, tokens, utc_offset;
296
297
  int usec_start, usec_stop;
@@ -300,6 +301,18 @@ static VALUE spg_timestamp(const char *s, VALUE self) {
300
301
  int offset_seconds = 0;
301
302
  double offset_fraction = 0.0;
302
303
 
304
+ db = rb_funcall(self, spg_id_db, 0);
305
+ rtz = rb_funcall(db, spg_id_timezone, 0);
306
+ if (rtz != Qnil) {
307
+ if (rtz == spg_sym_local) {
308
+ tz += SPG_DB_LOCAL;
309
+ } else if (rtz == spg_sym_utc) {
310
+ tz += SPG_DB_UTC;
311
+ } else {
312
+ return rb_funcall(db, spg_id_to_application_timestamp, 1, rb_str_new2(s));
313
+ }
314
+ }
315
+
303
316
  if (0 != strchr(s, '.')) {
304
317
  tokens = sscanf(s, "%d-%2d-%2d %2d:%2d:%2d.%n%d%n%c%02d:%02d",
305
318
  &year, &month, &day, &hour, &min, &sec,
@@ -330,12 +343,6 @@ static VALUE spg_timestamp(const char *s, VALUE self) {
330
343
 
331
344
  /* Get values of datetime_class, database_timezone, and application_timezone */
332
345
  dtc = rb_funcall(spg_Sequel, spg_id_datetime_class, 0);
333
- rtz = rb_funcall(rb_funcall(self, spg_id_db, 0), spg_id_timezone, 0);
334
- if (rtz == spg_sym_local) {
335
- tz += SPG_DB_LOCAL;
336
- } else if (rtz == spg_sym_utc) {
337
- tz += SPG_DB_UTC;
338
- }
339
346
  rtz = rb_funcall(spg_Sequel, spg_id_application_timezone, 0);
340
347
  if (rtz == spg_sym_local) {
341
348
  tz += SPG_APP_LOCAL;
@@ -977,6 +984,7 @@ void Init_sequel_pg(void) {
977
984
  spg_id_output_identifier = rb_intern("output_identifier");
978
985
  spg_id_datetime_class = rb_intern("datetime_class");
979
986
  spg_id_application_timezone = rb_intern("application_timezone");
987
+ spg_id_to_application_timestamp = rb_intern("to_application_timestamp");
980
988
  spg_id_timezone = rb_intern("timezone");
981
989
  spg_id_op_plus = rb_intern("+");
982
990
  spg_id_utc = rb_intern("utc");
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel_pg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.5
4
+ version: 1.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-06 00:00:00.000000000 Z
11
+ date: 2013-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  version: '0'
87
87
  requirements: []
88
88
  rubyforge_project:
89
- rubygems_version: 2.0.0
89
+ rubygems_version: 2.0.2
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: Faster SELECTs when using Sequel with pg