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.
- checksums.yaml +4 -4
- data/lib/huqua.rb +17 -26
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: af309fd0e0ca7f2993e87034fe5d598ad1cfd26d898a2d3a0d4d96b4bb8ca609
|
|
4
|
+
data.tar.gz: e964ba5dae560bb880b2bec82ff7c1119602cefb63674d56d06307be8d5b3ddf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
106
|
-
if
|
|
107
|
-
|
|
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
|
-
|
|
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
|