slyce 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/slyce +8 -14
- data/bin/slyce3 +8 -14
- 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: 3e12e5c9ffea5f786419c30b2cca3fc8a7dacf2f3a389e28f30b23595a813574
|
4
|
+
data.tar.gz: 8f25aeac74b908508787b68ad352948e6aed14cbd35d3efa67e9a34aed4fb350
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7182a32b9b2734f8813e6741ea562333f78809607c708b4bd08e08ed16df29a737f1966cbbec0e26b50ae12c818a0bfef5651757d0b08ec3d2890e90d10c1149
|
7
|
+
data.tar.gz: 7563b2004ca166a364de70fa42a20739c4f9f1e26f39ccc22cf0cf7d2ae81111c67adbec2c59f1afeb379549ee50689f2f21527ce5327b0e2dd32b6fa743fcbb
|
data/bin/slyce
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
VERSION="0.9.
|
3
|
+
VERSION="0.9.9"
|
4
4
|
|
5
5
|
STDOUT.sync = true
|
6
6
|
|
@@ -15,19 +15,19 @@ tabl = nil
|
|
15
15
|
OptionParser.new.instance_eval do
|
16
16
|
@banner = "usage: #{program_name} [options] <database> <table>"
|
17
17
|
|
18
|
-
on "-a", "--alpha" , "Sort alphabetically, not numerically"
|
19
18
|
on "-c", "--columns" , "Display column names and quit"
|
20
19
|
on "-h", "--help" , "Show help and command usage" do Kernel.abort to_s; end
|
20
|
+
on "-n", "--natural" , "Sort naturally, not numerically",
|
21
21
|
on "-s", "--show <count>" , "Show this many values", Integer
|
22
22
|
on "-v", "--version" , "Show version number" do Kernel.abort "#{program_name} #{VERSION}"; end
|
23
|
-
on "-w", "--where <cond>" , "
|
23
|
+
on "-w", "--where <cond>" , "Where clause (eg - 'age>50 and state='AZ')"
|
24
24
|
on "-x", "--extract <col1,col2,...>", "Comma separated list of columns to extract"
|
25
25
|
|
26
26
|
self
|
27
27
|
end.parse!(into: opts={}) rescue abort($!.message)
|
28
28
|
|
29
|
-
abcd = opts[:alpha]
|
30
29
|
filt = opts[:where] and filt = "where\n #{filt}"
|
30
|
+
natu = opts[:natural]
|
31
31
|
show = opts[:show]
|
32
32
|
want = opts[:extract].to_s.downcase.split(",")
|
33
33
|
|
@@ -57,7 +57,7 @@ def display(name, data, show, uniq, tots)
|
|
57
57
|
puts "\n#{fill} #{name}\n#{fill} #{line}\n"
|
58
58
|
data.each {|cnt, val| puts "%*d %s" % [wide, cnt, val || "NULL"] }
|
59
59
|
puts "#{fill} -----\n"
|
60
|
-
puts "%*d shown (top %d)" % [wide,
|
60
|
+
puts "%*d shown (top %d)" % [wide, seen, rows] if show
|
61
61
|
puts "%*d total (all %d)" % [wide, tots, uniq]
|
62
62
|
end
|
63
63
|
|
@@ -78,7 +78,7 @@ if want.empty?
|
|
78
78
|
end
|
79
79
|
|
80
80
|
want.each do |name|
|
81
|
-
sort =
|
81
|
+
sort = natu ? "" : "cnt desc,"
|
82
82
|
stmt = show ? "limit #{show}" : ""
|
83
83
|
data = conn.sql(<<~"" + stmt).to_a
|
84
84
|
select
|
@@ -95,15 +95,9 @@ want.each do |name|
|
|
95
95
|
-if(regexp_like(`#{name}`, '^\\\\d'), regexp_instr(`#{name}`, '[^\\\\d]'), null) desc,
|
96
96
|
`#{name}` is null, `#{name}`
|
97
97
|
|
98
|
-
uniq = conn.sql(<<~"").to_a[0]
|
99
|
-
select
|
100
|
-
count(distinct(ifnull(`#{name}`,0)))
|
101
|
-
from
|
102
|
-
`#{tabl}`
|
103
|
-
#{filt}
|
104
|
-
|
105
|
-
tots = conn.sql(<<~"").to_a[0][0]
|
98
|
+
uniq, tots = conn.sql(<<~"").to_a[0]
|
106
99
|
select
|
100
|
+
count(distinct(ifnull(`#{name}`,0))),
|
107
101
|
count(ifnull(`#{name}`,0))
|
108
102
|
from
|
109
103
|
`#{tabl}`
|
data/bin/slyce3
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
# wget https://github.com/nalgeon/sqlean/releases/download/0.19.3/sqlean-macos-arm64.zip
|
10
10
|
# unzip sqlean-macos-arm64.zip regexp.dylib
|
11
11
|
|
12
|
-
VERSION="0.9.
|
12
|
+
VERSION="0.9.9"
|
13
13
|
|
14
14
|
STDOUT.sync = true
|
15
15
|
|
@@ -24,20 +24,20 @@ tabl = nil
|
|
24
24
|
OptionParser.new.instance_eval do
|
25
25
|
@banner = "usage: #{program_name} [options] <database> <table>"
|
26
26
|
|
27
|
-
on "-a", "--alpha" , "Sort alphabetically, not numerically"
|
28
27
|
on "-c", "--columns" , "Display column names and quit"
|
29
28
|
on "-h", "--help" , "Show help and command usage" do Kernel.abort to_s; end
|
29
|
+
on "-n", "--natural" , "Sort naturally, not numerically",
|
30
30
|
on "-r", "--regexp <path>" , "Path to the sqlean/regexp extension"
|
31
31
|
on "-s", "--show <count>" , "Show this many values", Integer
|
32
32
|
on "-v", "--version" , "Show version number" do Kernel.abort "#{program_name} #{VERSION}"; end
|
33
|
-
on "-w", "--where <cond>" , "
|
33
|
+
on "-w", "--where <cond>" , "Where clause (eg - 'age>50 and state='AZ')"
|
34
34
|
on "-x", "--extract <col1,col2,...>", "Comma separated list of columns to extract"
|
35
35
|
|
36
36
|
self
|
37
37
|
end.parse!(into: opts={}) rescue abort($!.message)
|
38
38
|
|
39
|
-
abcd = opts[:alpha]
|
40
39
|
filt = opts[:where] and filt = "where\n #{filt}"
|
40
|
+
natu = opts[:natural]
|
41
41
|
regx = opts[:regexp] || Dir["{,sqlean}/regexp.{dll,dylib,so}"].first
|
42
42
|
show = opts[:show]
|
43
43
|
want = opts[:extract].to_s.downcase.split(",")
|
@@ -70,7 +70,7 @@ def display(name, data, show, uniq, tots)
|
|
70
70
|
puts "\n#{fill} #{name}\n#{fill} #{line}\n"
|
71
71
|
data.each {|cnt, val| puts "%*d %s" % [wide, cnt, val || "NULL"] }
|
72
72
|
puts "#{fill} -----\n"
|
73
|
-
puts "%*d shown (top %d)" % [wide,
|
73
|
+
puts "%*d shown (top %d)" % [wide, seen, rows] if show
|
74
74
|
puts "%*d total (all %d)" % [wide, tots, uniq]
|
75
75
|
end
|
76
76
|
|
@@ -91,7 +91,7 @@ if want.empty?
|
|
91
91
|
end
|
92
92
|
|
93
93
|
want.each do |name|
|
94
|
-
sort =
|
94
|
+
sort = natu ? "" : "cnt desc,"
|
95
95
|
stmt = show ? "limit #{show}" : ""
|
96
96
|
data = conn.sql(<<~"" + stmt).to_a
|
97
97
|
select
|
@@ -109,15 +109,9 @@ want.each do |name|
|
|
109
109
|
`#{name}` is null, `#{name}`
|
110
110
|
collate nocase
|
111
111
|
|
112
|
-
uniq = conn.sql(<<~"").to_a[0]
|
113
|
-
select
|
114
|
-
count(distinct(ifnull(`#{name}`,0)))
|
115
|
-
from
|
116
|
-
`#{tabl}`
|
117
|
-
#{filt}
|
118
|
-
|
119
|
-
tots = conn.sql(<<~"").to_a[0][0]
|
112
|
+
uniq, tots = conn.sql(<<~"").to_a[0]
|
120
113
|
select
|
114
|
+
count(distinct(ifnull(`#{name}`,0))),
|
121
115
|
count(ifnull(`#{name}`,0))
|
122
116
|
from
|
123
117
|
`#{tabl}`
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slyce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Shreeve
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: extralite-bundle
|