huqua 1.0.3 → 1.0.5

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/huqua.rb +17 -26
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c90b9ae94175323229b53862fe715e5b72acd8dee86efd628b503a9ff99e302f
4
- data.tar.gz: 0fea95cc6a3f2ff1419387faafc6acc486de16b61ba19be7e778039e10442e8e
3
+ metadata.gz: af309fd0e0ca7f2993e87034fe5d598ad1cfd26d898a2d3a0d4d96b4bb8ca609
4
+ data.tar.gz: e964ba5dae560bb880b2bec82ff7c1119602cefb63674d56d06307be8d5b3ddf
5
5
  SHA512:
6
- metadata.gz: c6830bdbb4299a092af6b1518646c4bd9ca4a0a09407bbf5a7d94a112e754e79cc076a5e3a91cb18ba939db2765583284ee2f1f7e2b639fef633a20349323ac5
7
- data.tar.gz: 313360a5873e25fa0e9c205f94c44adb20f052b33ba4a0db0392ff6ecc4450150109fad59debc7ee10a94a38b9b314c49dde917473b34f9d9bfa933abbff49d1
6
+ metadata.gz: 72bd4476e158345d8f0fd6535e338c058d79db6b7bec06441ff2ae1d44095939ef4b71da645cca331e4acc24d36db4ed07d4bb3c9ae2bffee8c05e32d73ab5b9
7
+ data.tar.gz: cda53fc0a1f79e8dc79e8506f1734418ca5e3d5bf7e6591c4a2940d391d98a58e805d4e285ccfeb43534e2be41c46ae7ba2d7927d7914e2a709acf4da6bc81ba
data/lib/huqua.rb CHANGED
@@ -86,35 +86,26 @@ class Huqua
86
86
  # read and show tables name and size data.
87
87
  if !tables.size.zero?
88
88
  puts "You have #{tables.size} tables in your database:".green
89
- if tables.size > 30
90
- puts "Your database is large, top 30 tables: \n"
91
- 50.times do |n|
92
- term = "SELECT* FROM #{tables[n]}"
93
- res = $conn.exec(term)
94
- puts "#{tables[n]} - have #{res} records"
89
+ tables.size.times do |n|
90
+ term = "SELECT count(id) FROM #{tables[n]}"
91
+ # get size table
92
+ begin
93
+ res = $conn.exec(term)
94
+ rescue StandardError => e
95
+ res = nil
95
96
  end
96
- else
97
- tables.size.times do |n|
98
- term = "SELECT count(id) FROM #{tables[n]}"
99
- # get size table
100
- begin
101
- res = $conn.exec(term)
102
- rescue StandardError => e
103
- res = nil
97
+ # make color for fun
98
+ if n % 2 == 0
99
+ if res
100
+ puts "- #{tables[n]} (#{res[0]['count']})".blue
101
+ else
102
+ puts "Can not find #{tables[n]} in database".red
104
103
  end
105
- # make color for fun
106
- if n % 2 == 0
107
- if res
108
- puts "- #{tables[n]} (#{res[0]['count']})".blue
109
- else
110
- puts "Can not find #{tables[n]} in database".red
111
- end
104
+ else
105
+ if res
106
+ puts "- #{tables[n]} (#{res[0]['count']})".yellow
112
107
  else
113
- if res
114
- puts "- #{tables[n]} (#{res[0]['count']})".yellow
115
- else
116
- puts "Can not find #{tables[n]} in database".yellow
117
- end
108
+ puts "Can not find #{tables[n]} in database".yellow
118
109
  end
119
110
  end
120
111
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: huqua
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Duy Chinh