gadget 0.4.1 → 0.5.0

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/lib/gadget/version.rb +1 -1
  3. data/lib/gadget.rb +27 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e4d6413191588ac10253e987f681fd7cca81fc6
4
- data.tar.gz: bb69c5b920ca8dc498669a8b852f53bd5e6d3999
3
+ metadata.gz: f09c3a81dfcb53cd77fcb8e4424cd499090a70d1
4
+ data.tar.gz: 0d825ead338e99f9e4b943ed68e61007211ef665
5
5
  SHA512:
6
- metadata.gz: 33e399d963fb54a5ee2ec76a3c0758a7e1a0103e1c548310ce2445285e1370702ad15967977f3f39c1a925a51c36c9f306cac3e4468649f0729b6bfb624012be
7
- data.tar.gz: 50acf9b5c72dba3353b9e759c3bb18726ea9a84c0e87a8e258e0e3b455a125098aac639101ab67ce88a36b9545c3c4221196dc0eabac9327ee023822561a2bca
6
+ metadata.gz: 4eab0f6694c28afd497ccb1b877577f85b8880adb82815944ed710c5b3196146e29e39ff617b6640262ff6e9201d3742212f7a7f3dead92151c6ab6d843e0c8f
7
+ data.tar.gz: 74c61f5c790d09e455d7c414431d3bab81f9d73132c4342e1de8ae6f5ee57667d9a79578d99fe7782b2b40864e0d784bb4004ea5c78e7fd41355bc0929fe5735
@@ -1,3 +1,3 @@
1
1
  module Gadget
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  end
data/lib/gadget.rb CHANGED
@@ -16,7 +16,14 @@ module Gadget
16
16
  end
17
17
 
18
18
  def self.tables(conn)
19
- rs = conn.exec("SELECT c.oid, t.tablename FROM pg_tables t INNER JOIN pg_class c ON c.relname=t.tablename WHERE t.schemaname='public' ORDER BY t.tablename")
19
+ sql = <<-END_OF_SQL
20
+ SELECT c.oid, t.tablename
21
+ FROM pg_catalog.pg_tables t
22
+ INNER JOIN pg_catalog.pg_class c ON c.relname=t.tablename
23
+ WHERE t.schemaname='public'
24
+ ORDER BY t.tablename
25
+ END_OF_SQL
26
+ rs = conn.exec("")
20
27
  tuples = rs.reduce({}) do | h, row |
21
28
  h[row['tablename']] = {
22
29
  :oid => row['oid'].to_i,
@@ -181,6 +188,25 @@ WHERE n.nspname = 'public'
181
188
  tuples
182
189
  end
183
190
 
191
+ def self.sequences(conn)
192
+ sql = <<-END_OF_SQL
193
+ SELECT c.oid, c.relname
194
+ FROM pg_catalog.pg_class c
195
+ INNER JOIN pg_catalog.pg_namespace n on c.relnamespace = n.oid
196
+ WHERE c.relkind = 'S'
197
+ AND n.nspname = 'public'
198
+ END_OF_SQL
199
+ rs = conn.exec(sql)
200
+ tuples = rs.reduce({}) do | h, row |
201
+ h[row['relname']] = {
202
+ :oid => row['oid'].to_i,
203
+ }
204
+ h
205
+ end
206
+ rs.clear
207
+ tuples
208
+ end
209
+
184
210
  def self.triggers(conn)
185
211
  rs = conn.exec(<<-END_OF_SQL)
186
212
  SELECT tg.oid, tg.tgname, t.tablename, p.proname
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.4.1
4
+ version: 0.5.0
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-02-21 00:00:00.000000000 Z
11
+ date: 2014-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg