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 +4 -4
- data/lib/pg_conn/schema_methods.rb +4 -4
- data/lib/pg_conn/version.rb +1 -1
- data/lib/pg_conn.rb +2 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f4b26e4c641b161de759efb248c690f9c35fe394006328a065b99a453f99505
|
4
|
+
data.tar.gz: 4ec2c0ac1cf0b2dd910688520bde9fda1d9dfdf30ee2d53781caeeb81450fcfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/pg_conn/version.rb
CHANGED
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
|
-
|
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
|
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.
|
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-
|
11
|
+
date: 2022-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|