sequel_pg 1.6.5-x86-mswin32-60 → 1.6.6-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,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");
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: 5
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 6
9
- - 5
10
- version: 1.6.5
9
+ - 6
10
+ version: 1.6.6
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-19 00:00:00 Z
18
+ date: 2013-04-12 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: pg