sqlconv 0.9 → 0.9.1

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/sqlconv +17 -0
  3. data/sqlconv.gemspec +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 983c1c2fc4a1dbdd9ee7c4f80af79cf939c6e3c680b620241156eeb35dc7ef0c
4
- data.tar.gz: 917c85af386c08ad81f711548f41d5b3244a6ecfa607408aae58acc8c759e74a
3
+ metadata.gz: c5e7b92b5dc45bdff66046a2a632acf9b6e33a5e324365633cae0f51e016122e
4
+ data.tar.gz: de89675de412523cb91e6822ba66d4284c932dc934b22c35be7c0d6cdd15e181
5
5
  SHA512:
6
- metadata.gz: a6eab5df9b47ab5797cc02d832277a9bcf637b7c7131f1caf2f7d7035923bb27d734f7244993201cbf7fece5943da40ad3069d03e9b396e06e480360e1e1467d
7
- data.tar.gz: 935fd564e8799acbc67831008d4745197f978aea6d13fe4a95b0c2797263267739ce6ba917032471ba89587f3798e2e4c542126214b890177ce66a18d7391a62
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "sqlconv"
5
- s.version = "0.9"
5
+ s.version = "0.9.1"
6
6
  s.author = "Steve Shreeve"
7
7
  s.email = "steve.shreeve@gmail.com"
8
8
  s.summary = "Handy utility to massage MySQL dump files"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqlconv
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.9'
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Shreeve