slyce 1.2.5 → 1.2.7
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/bin/slyce +22 -3
- data/bin/slyced +2 -2
- 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: fec75a29f832be5cce086420a326344089addb6804c8c881b0608560797f8f5c
|
4
|
+
data.tar.gz: 2f24983ed709549e1ef18f10e80a5417e8bd7c890f43e725abbcbe18c656232e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c746ea7eeb63859b7318f9245028f530b973b997ca1de1220a2346d363307756e8ca6d879f4155719da49dd2420220e54ef34bdf225ea39dade507a49030400d
|
7
|
+
data.tar.gz: 213560784f729604ce2cea20dc57b51c45775cfc8c9be273842cb0818448f9792764516dcb2ff00fc435c2de9b8f0ceccfd9153bcd7899a8043969dc21c689bb
|
data/bin/slyce
CHANGED
@@ -11,7 +11,7 @@ dbas = nil
|
|
11
11
|
tabl = nil
|
12
12
|
|
13
13
|
OptionParser.new.instance_eval do
|
14
|
-
@version = "1.2.
|
14
|
+
@version = "1.2.7"
|
15
15
|
@banner = "usage: #{program_name} [options] <database> <table>"
|
16
16
|
|
17
17
|
on "--csv" , "Output comma separated values"
|
@@ -75,10 +75,29 @@ end
|
|
75
75
|
|
76
76
|
# ==[ Let 'er rip! ]==
|
77
77
|
|
78
|
-
|
78
|
+
if dbas.include?("/")
|
79
|
+
dbas = $' if dbas =~ %r|^mysql://| # drop mysql:// prefix, if present
|
80
|
+
auth, dbas = dbas.split("/", 2)
|
81
|
+
if auth =~ /^(?:(\w+)(?::([^@]+))?@)?(?:([^:]+)?(?::(\d+))?)$/
|
82
|
+
user, pass, host, port = $1, $2, $3, $4 # user:pass@host:port
|
83
|
+
conf = {
|
84
|
+
database: dbas,
|
85
|
+
username: $1,
|
86
|
+
password: $2,
|
87
|
+
host: $3,
|
88
|
+
port: $4,
|
89
|
+
}.compact
|
90
|
+
else
|
91
|
+
abort "invalid database value #{dbas.inspect}"
|
92
|
+
end
|
93
|
+
else
|
94
|
+
conf = { database: dbas }
|
95
|
+
end
|
96
|
+
|
97
|
+
conn = Mysql2::Client.new(**conf, as: :array)
|
79
98
|
resu = conn.query("select * from `#{tabl}` limit 0")
|
80
99
|
cols = resu.fields
|
81
|
-
want = want.empty? ? cols : want
|
100
|
+
want = want.empty? ? cols : want.select {|e| cols.include?(e) }
|
82
101
|
|
83
102
|
if opts[:columns]
|
84
103
|
puts cols
|
data/bin/slyced
CHANGED
@@ -11,7 +11,7 @@ dbas = nil
|
|
11
11
|
tabl = nil
|
12
12
|
|
13
13
|
OptionParser.new.instance_eval do
|
14
|
-
@version = "1.2.
|
14
|
+
@version = "1.2.7"
|
15
15
|
@banner = "usage: #{program_name} [options] <database> <table>"
|
16
16
|
|
17
17
|
on "--csv" , "Output comma separated values"
|
@@ -83,7 +83,7 @@ resu = conn.query(<<~end)
|
|
83
83
|
order by ordinal_position
|
84
84
|
end
|
85
85
|
cols = resu.to_a.flatten
|
86
|
-
want = want.empty? ? cols : want
|
86
|
+
want = want.empty? ? cols : want.select {|e| cols.include?(e) }
|
87
87
|
|
88
88
|
if opts[:columns]
|
89
89
|
puts cols
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slyce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Shreeve
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
requirements: []
|
118
|
-
rubygems_version: 3.
|
118
|
+
rubygems_version: 3.4.14
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: Ruby utility to show data statistics for MySQL databases
|