slyce 1.2.5 → 1.2.7

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/bin/slyce +22 -3
  3. data/bin/slyced +2 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87533fb98af597c5c0db5ee86c5bf43bd036d48c135dcd670308f470abd0d9e6
4
- data.tar.gz: 23a914d5c339f06b5713633ab7d51997617957a4188e745effbd2e909fc192ff
3
+ metadata.gz: fec75a29f832be5cce086420a326344089addb6804c8c881b0608560797f8f5c
4
+ data.tar.gz: 2f24983ed709549e1ef18f10e80a5417e8bd7c890f43e725abbcbe18c656232e
5
5
  SHA512:
6
- metadata.gz: 2cb87eb5c536252a3ea0a393850fac9851738965d3aeb15f70be67a6be24655d8b0168ab1c718c86457293f182ef468a4e286364b71a9a1761968d88aaf567d5
7
- data.tar.gz: c7c5e8211890e4c3b9a5606dab94f22a9db2c266d1090e89b07b64f429d15539e790c4431a3d4833ed8f9d6449d26a83d7421e0330e2f97382ed83cc70ccee30
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.5"
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
- conn = Mysql2::Client.new(database: dbas, as: :array)
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 & cols
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.5"
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 & cols
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.5
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.2.33
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