pgsql 1.7 → 1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/lib/conn.c +4 -2
  3. data/lib/conn_exec.c +6 -5
  4. data/lib/module.c +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc7ec22892e0bd75f3a0c63832471264c74e5bf758844f3fc87b9b5e2fb73b59
4
- data.tar.gz: c1d31689274d2ccd7a97b4381b635f390886e419cbef1c44b7017839b8b520a9
3
+ metadata.gz: b9774f4721fba4301276843fea1a5287083234d0aadf8947559b08e2619a97e7
4
+ data.tar.gz: b6df52ab912e62f814770c339cce1de5444f41c249869a6edf3e069dd6be7132
5
5
  SHA512:
6
- metadata.gz: 2c94ab8fc0eb95ed34e1ffb84d0f90dd34d7ac4858b693217d94e36e913d5b02f9a7653459864f002d9d84cf02219b07191ee64757a5a42899cae6b8f31aa512
7
- data.tar.gz: 4a893e13d60d470e8bde739c7f33f3d6260cd20670c746d115ebd93aa74531af69059c32a9dd59419fc68dd6ddd7d7630b12b892c615c1beeb4600aa336d9c31
6
+ metadata.gz: 908112734acf984c86746934cea2471a702e0eeb7b93a5bf39b4abbd640eae9cb962788da168396919994429fce7d6cbfe04c3b6834e8bb5bd5a845d2a248ace
7
+ data.tar.gz: c4ac1fe22fca378f9e321f6fbc33bbd3371d0e7e831321c9ad496ce673d7a7d120a8527c31f07696a66ffa0d7c35ec760540e6954ed8c013db233056d60d3197
data/lib/conn.c CHANGED
@@ -74,6 +74,7 @@ static VALUE rb_ePgConnInvalid;
74
74
  static VALUE sym_dbname = Qundef;
75
75
  static VALUE sym_password = Qundef;
76
76
 
77
+ static ID id_to_s;
77
78
 
78
79
 
79
80
  void
@@ -289,8 +290,7 @@ pgconn_init( int argc, VALUE *argv, VALUE self)
289
290
  Data_Get_Struct( self, struct pgconn_data, c);
290
291
 
291
292
  if (NIL_P( params)) {
292
- StringValue( str);
293
- c->conn = PQconnectdb( RSTRING_PTR( str));
293
+ c->conn = PQconnectdb( RSTRING_PTR( rb_funcall( str, id_to_s, 0)));
294
294
  } else {
295
295
  int expand_dbname;
296
296
  VALUE orig_params = params;
@@ -900,6 +900,8 @@ Init_pgsql_conn( void)
900
900
 
901
901
  rb_define_method( rb_cPgConn, "on_notice", &pgconn_on_notice, 0);
902
902
 
903
+ id_to_s = rb_intern( "to_s");
904
+
903
905
  Init_pgsql_conn_quote();
904
906
  Init_pgsql_conn_exec();
905
907
  }
data/lib/conn_exec.c CHANGED
@@ -24,7 +24,7 @@ static VALUE yield_or_return_result( VALUE res);
24
24
  static VALUE clear_resultqueue( VALUE self);
25
25
 
26
26
  static VALUE pgconn_query( int argc, VALUE *argv, VALUE self);
27
- static VALUE pgconn_select_one( int argc, VALUE *argv, VALUE self);
27
+ static VALUE pgconn_select_row( int argc, VALUE *argv, VALUE self);
28
28
  static VALUE pgconn_select_value( int argc, VALUE *argv, VALUE self);
29
29
  static VALUE pgconn_select_values( int argc, VALUE *argv, VALUE self);
30
30
  static VALUE pgconn_get_notify( VALUE self);
@@ -303,13 +303,13 @@ pgconn_query( int argc, VALUE *argv, VALUE self)
303
303
 
304
304
  /*
305
305
  * call-seq:
306
- * conn.select_one( query, *bind_values)
306
+ * conn.select_row( query, *bind_values)
307
307
  *
308
308
  * Return the first row of the query results.
309
309
  * Equivalent to <code>conn.query( query, *bind_values).first</code>.
310
310
  */
311
311
  VALUE
312
- pgconn_select_one( int argc, VALUE *argv, VALUE self)
312
+ pgconn_select_row( int argc, VALUE *argv, VALUE self)
313
313
  {
314
314
  VALUE cmd, par;
315
315
  VALUE res;
@@ -327,7 +327,7 @@ pgconn_select_one( int argc, VALUE *argv, VALUE self)
327
327
  * conn.select_value( query, *bind_values)
328
328
  *
329
329
  * Return the first value of the first row of the query results.
330
- * Equivalent to conn.query( query, *bind_values).first.first
330
+ * Equivalent to conn.query( query, *bind_values).first&.first
331
331
  */
332
332
  VALUE
333
333
  pgconn_select_value( int argc, VALUE *argv, VALUE self)
@@ -348,6 +348,7 @@ pgconn_select_value( int argc, VALUE *argv, VALUE self)
348
348
  * call-seq:
349
349
  * conn.select_values( query, *bind_values)
350
350
  *
351
+ * Return the all values over all rows as one array.
351
352
  * Equivalent to conn.query( query, *bind_values).flatten
352
353
  */
353
354
  VALUE
@@ -865,7 +866,7 @@ Init_pgsql_conn_exec( void)
865
866
  rb_define_method( rb_cPgConn, "fetch", &pgconn_fetch, 0);
866
867
 
867
868
  rb_define_method( rb_cPgConn, "query", &pgconn_query, -1);
868
- rb_define_method( rb_cPgConn, "select_one", &pgconn_select_one, -1);
869
+ rb_define_method( rb_cPgConn, "select_row", &pgconn_select_row, -1);
869
870
  rb_define_method( rb_cPgConn, "select_value", &pgconn_select_value, -1);
870
871
  rb_define_method( rb_cPgConn, "select_values", &pgconn_select_values, -1);
871
872
  rb_define_method( rb_cPgConn, "get_notify", &pgconn_get_notify, 0);
data/lib/module.c CHANGED
@@ -8,7 +8,7 @@
8
8
  #include "result.h"
9
9
 
10
10
 
11
- #define PGSQL_VERSION "1.7"
11
+ #define PGSQL_VERSION "1.8"
12
12
 
13
13
 
14
14
  VALUE rb_mPg;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgsql
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.7'
4
+ version: '1.8'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bertram Scharpf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-09 00:00:00.000000000 Z
11
+ date: 2021-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: autorake