pg_conn 0.3.5 → 0.3.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
  SHA256:
3
- metadata.gz: 7ac1d6afe8aefb33c2abfb88f2741ff2e1d1bacf4d6abc1936ecd178a36eaec5
4
- data.tar.gz: 1596428cde81f7d3fe9cb9087e2c6c8c3d8a58ff696ead2156b512cb72ea6497
3
+ metadata.gz: 5f4b26e4c641b161de759efb248c690f9c35fe394006328a065b99a453f99505
4
+ data.tar.gz: 4ec2c0ac1cf0b2dd910688520bde9fda1d9dfdf30ee2d53781caeeb81450fcfb
5
5
  SHA512:
6
- metadata.gz: a04dd7e76e131e04e4e1b37786b2667bc09786ae5dc570fc3d4cd6a52909ea9d2335e27b0bfa5ca1fb30d371e76055f8d498d106f919e52cb001a0f7b11e3a60
7
- data.tar.gz: 31db0d179111b95440acf06b743c3cefbf30900f85ac311b81c82a224f73e5b871439ede71d2bf5b50393bfd0c79c75254d33ab77f1a26c998ec9a2bc855888e
6
+ metadata.gz: d40cf6491babd1cec85d65c3d658836889fc09a953c02957e435e7cc7013a5320a5adf5da65369f2c3c2d62c50880e6f456c682be1a5c0b34d69d083cd2644d2
7
+ data.tar.gz: b7182f38bd7469eeeaf5ba0c9414bc5b4c195ecf4fa05a6041cd17bb9b05b8e19104d8ebba0e6511b4a7e808ce32593f0b9086f788141f763e753e071e1878f9
@@ -53,7 +53,7 @@ module PgConn
53
53
 
54
54
  # Return true if table exists
55
55
  def exist_table?(schema, table)
56
- conn.exist?(relation_exist_query(schema, table, kind: %w(r)))
56
+ conn.exist?(relation_exist_query(schema, table, kind: %w(r f)))
57
57
  end
58
58
 
59
59
  # Return true if view exists
@@ -73,7 +73,7 @@ module PgConn
73
73
 
74
74
  # Return list of tables in the schema
75
75
  def list_tables(schema)
76
- conn.values relation_list_query(schema, kind: %w(r))
76
+ conn.values relation_list_query(schema, kind: %w(r f))
77
77
  end
78
78
 
79
79
  # Return list of view in the schema
@@ -103,7 +103,7 @@ module PgConn
103
103
 
104
104
  private
105
105
  def relation_exist_query(schema, relation, kind: nil)
106
- kind_sql_list = "'" + (kind.nil? ? %w(r v m) : Array(kind).flatten).join("', '") + "'"
106
+ kind_sql_list = "'" + (kind.nil? ? %w(r f v m) : Array(kind).flatten).join("', '") + "'"
107
107
  %(
108
108
  select 1
109
109
  from pg_class
@@ -114,7 +114,7 @@ module PgConn
114
114
  end
115
115
 
116
116
  def relation_list_query(schema, kind: nil)
117
- kind_sql_list = "'" + (kind.nil? ? %w(r v m) : Array(kind).flatten).join("', '") + "'"
117
+ kind_sql_list = "'" + (kind.nil? ? %w(r f v m) : Array(kind).flatten).join("', '") + "'"
118
118
  %(
119
119
  select relname
120
120
  from pg_class
@@ -1,3 +1,3 @@
1
1
  module PgConn
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
data/lib/pg_conn.rb CHANGED
@@ -451,8 +451,7 @@ module PgConn
451
451
  raise ArgumentError, "Unrecognized value: #{arg.inspect}"
452
452
  end
453
453
  }.join(", ")
454
- query = "select * from #{name}(#{args_sql})"
455
- r = pg_exec(query)
454
+ r = pg_exec "select * from #{name}(#{args_sql})"
456
455
  if r.ntuples == 0
457
456
  raise Error, "No records returned"
458
457
  elsif r.ntuples == 1
@@ -478,7 +477,7 @@ module PgConn
478
477
  # fail is false #exec instead return nil but note that postgres doesn't
479
478
  # ignore it so that if you're inside a transaction, the transaction will be
480
479
  # in an error state and if you're also using subtransactions the whole
481
- # transaction stack collapses.
480
+ # transaction stack has collapsed
482
481
  #
483
482
  # TODO: Make sure the transaction stack is emptied on postgres errors
484
483
  def exec(sql, commit: true, fail: true, silent: false)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_conn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-13 00:00:00.000000000 Z
11
+ date: 2022-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg