sequel_pg 1.7.0 → 1.7.1

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 +4 -4
  2. data/CHANGELOG +13 -1
  3. data/ext/sequel_pg/sequel_pg.c +14 -6
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6a40cb36583e8f82e16b3346ba16ae6bfd76f6f
4
- data.tar.gz: fe8457e463a51d1bc522cb87a14236e4dfee23c4
3
+ metadata.gz: '08ac123f28a04a27f31f8e0c36f35357c97518db'
4
+ data.tar.gz: f55ca7eec3931cbc8b4d3a4c6eb1295299d511a1
5
5
  SHA512:
6
- metadata.gz: a098d4cc78fa9c3f13c7cdd7fd88fe83f222d42c36acf258eb757eb99d5015dd5c7b4db6052f0429fe6a49a75de6b3982133ff4c80daeb8b68428bebee86a5e5
7
- data.tar.gz: cd9d11acc5c408fd3f3868fdc2c3364d477292e22891d52005057db456cfbce09aea65f8d02935482d42fa2d2cfd8cbb09f05ba6401dbfa38239919a23c08c64
6
+ metadata.gz: fdee057696e6a5cf1c283a2e1305df07dd7a9773e5eb284a6bdd7ecf5df4e21288a7f961afaad334ff23d71ec1b6ef980be95753ec80f0912d86920b897b7073
7
+ data.tar.gz: 97715ed30e04d22e9f479720e8bd08c830050e86408a67dae20f60ce1aca397a40155b8c31c6d837b651b4b2b426e79757a1a802281cba8fdf21a8142d2fb0ea
data/CHANGELOG CHANGED
@@ -1,4 +1,16 @@
1
- === master
1
+ === 1.7.1 (2017-08-25)
2
+
3
+ * Handle case where PGconn#get_result returns nil in single row mode (jeremyevans)
4
+
5
+ * Fix RB_GC_GUARD usage to handle additional segfault (Eric Wong)
6
+
7
+ === 1.7.0 (2017-06-30)
8
+
9
+ * Add Dataset#with_optimize_model_load to change optimized model loading for specific datasets (jeremyevans)
10
+
11
+ * Deprecate optimize_model_load Database and Dataset accessors (jeremyevans)
12
+
13
+ * Turn optimized model loading on by default, disable automatically when Model.call overridden (jeremyevans)
2
14
 
3
15
  * Override Dataset#as_hash instead of #to_hash if #as_hash is defined (jeremyevans)
4
16
 
@@ -1,4 +1,4 @@
1
- #define SEQUEL_PG_VERSION_INTEGER 10700
1
+ #define SEQUEL_PG_VERSION_INTEGER 10701
2
2
 
3
3
  #include <string.h>
4
4
  #include <stdio.h>
@@ -127,13 +127,14 @@ static int enc_get_index(VALUE val)
127
127
  }
128
128
  #endif
129
129
 
130
- static VALUE read_array(int *index, char *c_pg_array_string, int array_string_length, char *word, VALUE converter
130
+ static VALUE read_array(int *index, char *c_pg_array_string, int array_string_length, VALUE buf, VALUE converter
131
131
  #ifdef SPG_ENCODING
132
132
  , int enc_index
133
133
  #endif
134
134
  )
135
135
  {
136
136
  int word_index = 0;
137
+ char *word = RSTRING_PTR(buf);
137
138
 
138
139
  /* The current character in the input string. */
139
140
  char c;
@@ -203,7 +204,7 @@ static VALUE read_array(int *index, char *c_pg_array_string, int array_string_le
203
204
  else if(c == '{')
204
205
  {
205
206
  (*index)++;
206
- rb_ary_push(array, read_array(index, c_pg_array_string, array_string_length, word, converter
207
+ rb_ary_push(array, read_array(index, c_pg_array_string, array_string_length, buf, converter
207
208
  #ifdef SPG_ENCODING
208
209
  , enc_index
209
210
  #endif
@@ -236,6 +237,8 @@ static VALUE read_array(int *index, char *c_pg_array_string, int array_string_le
236
237
  }
237
238
  }
238
239
 
240
+ RB_GC_GUARD(buf);
241
+
239
242
  return array;
240
243
  }
241
244
 
@@ -246,8 +249,6 @@ static VALUE parse_pg_array(VALUE self, VALUE pg_array_string, VALUE converter)
246
249
  char *c_pg_array_string = StringValueCStr(pg_array_string);
247
250
  int array_string_length = RSTRING_LEN(pg_array_string);
248
251
  VALUE buf = rb_str_buf_new(array_string_length);
249
- RB_GC_GUARD(buf);
250
- char *word = RSTRING_PTR(buf);
251
252
  int index = 1;
252
253
 
253
254
  if (array_string_length == 0) {
@@ -271,7 +272,7 @@ static VALUE parse_pg_array(VALUE self, VALUE pg_array_string, VALUE converter)
271
272
  rb_raise(rb_eArgError, "unexpected PostgreSQL array format, doesn't start with { or [");
272
273
  }
273
274
 
274
- return read_array(&index, c_pg_array_string, array_string_length, word, converter
275
+ return read_array(&index, c_pg_array_string, array_string_length, buf, converter
275
276
  #ifdef SPG_ENCODING
276
277
  , enc_get_index(pg_array_string)
277
278
  #endif
@@ -924,6 +925,9 @@ static VALUE spg__yield_each_row(VALUE self) {
924
925
  GetPGconn(rconn, conn);
925
926
 
926
927
  rres = rb_funcall(rconn, spg_id_get_result, 0);
928
+ if (rres == Qnil) {
929
+ goto end_yield_each_row;
930
+ }
927
931
  rb_funcall(rres, spg_id_check, 0);
928
932
  GetPGresult(rres, res);
929
933
 
@@ -970,11 +974,15 @@ static VALUE spg__yield_each_row(VALUE self) {
970
974
  }
971
975
 
972
976
  rres = rb_funcall(rconn, spg_id_get_result, 0);
977
+ if (rres == Qnil) {
978
+ goto end_yield_each_row;
979
+ }
973
980
  rb_funcall(rres, spg_id_check, 0);
974
981
  GetPGresult(rres, res);
975
982
  }
976
983
  rb_funcall(rres, spg_id_clear, 0);
977
984
 
985
+ end_yield_each_row:
978
986
  return self;
979
987
  }
980
988
 
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.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-30 00:00:00.000000000 Z
11
+ date: 2017-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg