sqlconv 0.9 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/sqlconv +17 -0
- data/sqlconv.gemspec +1 -1
- 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: c5e7b92b5dc45bdff66046a2a632acf9b6e33a5e324365633cae0f51e016122e
|
4
|
+
data.tar.gz: de89675de412523cb91e6822ba66d4284c932dc934b22c35be7c0d6cdd15e181
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88f8d0b4303c6a49d5e824fda39f8f82daa875f41baba03d47e2038c8fd16443f1e8dbcddbece53320402c1a59e2be0ef6cd300b481d59d98636bc9033637dab
|
7
|
+
data.tar.gz: d8b34edce1ea7c65f6e2b3f6ee8a1fe28eab74c1f904b168fa69e893472a763c5ac39de379c1ce0790fcf3216a8c28f6fd1396329cc846fc0b157e3c972f45ea
|
data/bin/sqlconv
CHANGED
@@ -103,6 +103,18 @@ def conv(tab1, map1, tab2, map2, mode, dump)
|
|
103
103
|
# perform one-time check on source column bounds
|
104
104
|
unless len1
|
105
105
|
len1 = cols.size
|
106
|
+
if mode == "show"
|
107
|
+
max = 32
|
108
|
+
sep = "+-----+-#{'-' * max}-+"
|
109
|
+
puts sep, "| col | %-*.*s |" % [max, max, 'data'], sep
|
110
|
+
len1.times do |pos|
|
111
|
+
val = cols[pos]
|
112
|
+
val[max-3..] = '...' if val.size > max
|
113
|
+
puts "| %3d | %-*.*s | " % [pos + 1, max, max, val]
|
114
|
+
end
|
115
|
+
puts sep
|
116
|
+
exit
|
117
|
+
end
|
106
118
|
need.each do |item|
|
107
119
|
item.text &&= ["'", item.text.gsub("'", "\\\\'"), "'"].join
|
108
120
|
if (len2 = [item.from, item.till, 0].compact.max) > len1
|
@@ -189,6 +201,10 @@ elsif ARGV.delete "--pipes"
|
|
189
201
|
mode = "pipes"
|
190
202
|
end
|
191
203
|
|
204
|
+
if ARGV.delete "-s"
|
205
|
+
mode = "show"
|
206
|
+
end
|
207
|
+
|
192
208
|
if ARGV.shift =~ /^([a-z][-\w]*):?(.+)?$/
|
193
209
|
tab1 = $1
|
194
210
|
map1 = $2
|
@@ -207,6 +223,7 @@ tab1 or die [
|
|
207
223
|
"[-p <plugin1.rb> [-p <plugin2.rb>]...]",
|
208
224
|
"[--pipes] (to output pipe separated values instead of SQL",
|
209
225
|
"[-r] (to use 'replace into' instead of 'insert into')",
|
226
|
+
"[-s] (to show column indexes and values for the first row)",
|
210
227
|
"<src_table>(:[sel1,sel2,...])",
|
211
228
|
"[dst_table][:][col1,col2,...] file"
|
212
229
|
] * ' '
|
data/sqlconv.gemspec
CHANGED