sequel_pg 1.6.16 → 1.6.17

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 +5 -1
  3. data/ext/sequel_pg/sequel_pg.c +16 -4
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 705be350454b9fdb7851a2ecff14239a3959aa53
4
- data.tar.gz: 46888862c2aa099fe86f05ff429cb42cf521a7f2
3
+ metadata.gz: 41fd896c78d22b043d2544d1593fca2d48a02efe
4
+ data.tar.gz: 566b1a460e4af2088e4f6aa223ea8e2ad815927d
5
5
  SHA512:
6
- metadata.gz: 12ea5f1f40ecf6088796187cf9ab726a41c25e8a38f1fa09e53d962564476f41478b334ee91038ac209f08dcbe4db1857951f820c56625f2f9dcdd8d1ed136a0
7
- data.tar.gz: 92404c36e8ca5891d48e3996b580a3f788c5679fc5162aac520d01ab5a370f3229bb24e87dbfaeb12c828efd7ed3b34dcbad918e3f9e2d718555badce236da6a
6
+ metadata.gz: 7c556a5e5db2f11691b2faeb934594c3b25f5cd93cf4c9d2c2c32182102e8bb2a64d71bb25cff84ec40f87bfb89a5e13b9bac584fe96de5fd5b4e4943353c2b5
7
+ data.tar.gz: 95bca2c496c52da648384c0aad749e881c5bf85f9740298e85df76342cd57ec89cad717e25d5c72e457e4924d7d83822bddf72782780039a559a33990638f746
data/CHANGELOG CHANGED
@@ -1,10 +1,14 @@
1
+ === 1.6.17 (2016-04-29)
2
+
3
+ * Work with upcoming 4.34.0 release, supporting the duplicate_column_handler extension (jeremyevans)
4
+
1
5
  === 1.6.16 (2016-04-11)
2
6
 
3
7
  * Work with upcoming Sequel 4.34.0 release, and Sequel 4.0+ (jeremyevans) (#22)
4
8
 
5
9
  === 1.6.15 (2016-04-11)
6
10
 
7
- * Work with upcoming Sequel 4.34.0 release (jeremyevans)
11
+ * Work with upcoming Sequel 4.34.0 release, supporting to_hash taking the hash to insert into (jeremyevans)
8
12
 
9
13
  === 1.6.14 (2016-01-19)
10
14
 
@@ -45,6 +45,7 @@
45
45
 
46
46
  /* Whether the data objects are structs instead of just pointers */
47
47
  static int unwrap_structs;
48
+ static int use_columns_method;
48
49
 
49
50
  /* External functions defined by ruby-pg when data objects are structs */
50
51
  PGconn* pg_get_pgconn(VALUE);
@@ -102,6 +103,7 @@ static ID spg_id_opts;
102
103
  static ID spg_id_db;
103
104
  static ID spg_id_conversion_procs;
104
105
 
106
+ static ID spg_id_columns_equal;
105
107
  static ID spg_id_columns;
106
108
  static ID spg_id_encoding;
107
109
  static ID spg_id_values;
@@ -584,6 +586,14 @@ static VALUE spg__field_ids(VALUE v, VALUE *colsyms, long nfields) {
584
586
  return pg_columns;
585
587
  }
586
588
 
589
+ static void spg_set_columns(VALUE self, VALUE cols) {
590
+ if (use_columns_method) {
591
+ rb_funcall(self, spg_id_columns_equal, 1, cols);
592
+ } else {
593
+ rb_ivar_set(self, spg_id_columns, cols);
594
+ }
595
+ }
596
+
587
597
  static void spg_set_column_info(VALUE self, PGresult *res, VALUE *colsyms, VALUE *colconvert) {
588
598
  long i;
589
599
  long j;
@@ -624,6 +634,7 @@ static void spg_set_column_info(VALUE self, PGresult *res, VALUE *colsyms, VALUE
624
634
  break;
625
635
  }
626
636
  }
637
+ spg_set_columns(self, rb_ary_new4(nfields, colsyms));
627
638
  }
628
639
 
629
640
  static VALUE spg_yield_hash_rows(VALUE self, VALUE rres, VALUE ignore) {
@@ -658,8 +669,6 @@ static VALUE spg_yield_hash_rows(VALUE self, VALUE rres, VALUE ignore) {
658
669
 
659
670
  spg_set_column_info(self, res, colsyms, colconvert);
660
671
 
661
- rb_ivar_set(self, spg_id_columns, rb_ary_new4(nfields, colsyms));
662
-
663
672
  opts = rb_funcall(self, spg_id_opts, 0);
664
673
  if (rb_type(opts) == T_HASH) {
665
674
  pg_type = rb_hash_aref(opts, spg_sym__sequel_pg_type);
@@ -941,8 +950,6 @@ static VALUE spg__yield_each_row(VALUE self) {
941
950
 
942
951
  spg_set_column_info(self, res, colsyms, colconvert);
943
952
 
944
- rb_ivar_set(self, spg_id_columns, rb_ary_new4(nfields, colsyms));
945
-
946
953
  while (PQntuples(res) != 0) {
947
954
  h = rb_hash_new();
948
955
  for(j=0; j<nfields; j++) {
@@ -1036,6 +1043,7 @@ void Init_sequel_pg(void) {
1036
1043
 
1037
1044
  spg_id_db = rb_intern("db");
1038
1045
  spg_id_conversion_procs = rb_intern("conversion_procs");
1046
+ spg_id_columns_equal = rb_intern("columns=");
1039
1047
 
1040
1048
  spg_id_columns = rb_intern("@columns");
1041
1049
  spg_id_encoding = rb_intern("@encoding");
@@ -1086,6 +1094,10 @@ void Init_sequel_pg(void) {
1086
1094
  rb_define_private_method(c, "yield_hash_rows", spg_yield_hash_rows, 2);
1087
1095
  rb_define_private_method(c, "fetch_rows_set_cols", spg_fetch_rows_set_cols, 1);
1088
1096
 
1097
+ if (rb_eval_string("Sequel::Dataset.private_method_defined?(:columns=)") == Qtrue) {
1098
+ use_columns_method = 1;
1099
+ }
1100
+
1089
1101
  rb_define_singleton_method(spg_Postgres, "supports_streaming?", spg_supports_streaming_p, 0);
1090
1102
 
1091
1103
  #if HAVE_PQSETSINGLEROWMODE
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.16
4
+ version: 1.6.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-11 00:00:00.000000000 Z
11
+ date: 2016-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg