gadget 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +8 -0
- data/lib/gadget.rb +8 -4
- data/lib/gadget/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 871bc48234116c2a7488eba4a4a354c3cb8d4961
|
4
|
+
data.tar.gz: 74561ca3469ef7dbc9f5acc8e5d7813a39daa5a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e671d7aaf1b8227c5811967c7abb3355de0d72323f3bb1104405a22e8caaba24dd0bbe4fabbd1def1145b5955c8434bf2f4625d82ae5e938f0f02257858560ee
|
7
|
+
data.tar.gz: 0a9135347a3cdf0cc941ab753f2584d33df9dfa73041f3211e555cb175edd8458d559f8f9b729c8356f433a2caa798830f030a93cd282ff72e915a59d0a85e52
|
data/Rakefile
CHANGED
data/lib/gadget.rb
CHANGED
@@ -82,22 +82,26 @@ WHERE t.schemaname='public'
|
|
82
82
|
def self.columns(conn, *args)
|
83
83
|
options = args.extract_options!
|
84
84
|
tablename = args.shift
|
85
|
+
nspname = args.shift || "public"
|
85
86
|
|
86
87
|
sql = <<-END_OF_SQL
|
87
|
-
SELECT t.tablename, a.attname
|
88
|
+
SELECT t.tablename, a.attname, ns.nspname
|
88
89
|
FROM pg_catalog.pg_attribute a
|
89
90
|
INNER JOIN pg_catalog.pg_class c ON a.attrelid = c.oid
|
90
91
|
INNER JOIN pg_catalog.pg_tables t ON c.relname = t.tablename
|
92
|
+
INNER JOIN pg_catalog.pg_namespace ns ON c.relnamespace = ns.oid
|
91
93
|
WHERE a.attnum >= 0
|
94
|
+
AND t.schemaname = ns.nspname
|
95
|
+
AND ns.nspname = $1
|
92
96
|
END_OF_SQL
|
93
97
|
unless options[:include_dropped]
|
94
98
|
sql += " AND a.attisdropped IS FALSE"
|
95
99
|
end
|
96
100
|
if tablename.nil?
|
97
|
-
rs = conn.
|
101
|
+
rs = conn.exec_params(sql, [ nspname ])
|
98
102
|
else
|
99
|
-
sql += " AND t.tablename = $
|
100
|
-
rs = conn.exec_params(sql, [ tablename ])
|
103
|
+
sql += " AND t.tablename = $2"
|
104
|
+
rs = conn.exec_params(sql, [ nspname, tablename ])
|
101
105
|
end
|
102
106
|
tuples = rs.reduce({}) do | h, row |
|
103
107
|
h[row['tablename']] ||= { :columns => [] }
|
data/lib/gadget/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gadget
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Craig S. Cottingham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|