sqlconv 0.6.0 → 0.6.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 +9 -4
  3. data/sqlconv.gemspec +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad0c506523fe07b486e58a73ad256547b3a03394d5f8e402b59d493d1acb4c50
4
- data.tar.gz: c2efba37696f826f4a83895c8c69bad6b12f8a3b8c5bc4522ecffefad128ebe6
3
+ metadata.gz: ff0bf4b12a25f67b6ce9096183f72b382761003af3ae2c8381ad030e797e9485
4
+ data.tar.gz: 71f4f416585e7b63e4022b18da68913790a90a975bd5ed862a7637804335ef15
5
5
  SHA512:
6
- metadata.gz: e51b127c2bfad28a2667818b21e26c620949a249f11c7733c6c9b4860ce52247bfc981bfceccb2ed2cc630b21b5274d7cfa04733f19851a8828b5436ab0726d0
7
- data.tar.gz: dd824c0c63c49cd82c38a16a96171d404ae30b9bba0db70f1edb068d7c8b21a2f2938a51f280b3badd019de9a61402542e0250c930731d7d9ca032a236ea4fdd
6
+ metadata.gz: 7c7504113188e39febf08d952c3498d555fc1fe46fa36db1dab06ef5dbf3fb1b0f678c7214c354d96efea8b58a6d0ab1c1e502cccbeb13d574dc8b9f061bbc12
7
+ data.tar.gz: b0a4fc4f97c3b40432e2dd014a3f1133b7609b8ce8a220878eae2081b9b9ac75c29b4780abc4ce5ee3b9fd5db17e9f74e9fa5935e9ab68d500f0d7ec7232c5e2
data/bin/sqlconv CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  STDOUT.sync = true
4
4
 
5
+ def die(str)
6
+ warn str
7
+ exit
8
+ end
9
+
5
10
  require 'strscan'
6
11
 
7
12
  # parsing helpers
@@ -76,7 +81,7 @@ def conv(tab1, map1, tab2, map2, dump)
76
81
  # find source table
77
82
  data.string = dump.read # dump.read(5000) # TODO: Add streaming support
78
83
  into = data.scan_for(/insert into (['"`]?)#{tab1}\1 values /io)
79
- into or (warn "unable to find insert statements for the '#{tab1}' table" or exit)
84
+ into or die "unable to find insert statements for the '#{tab1}' table"
80
85
 
81
86
  # process each line
82
87
  loop do
@@ -84,7 +89,7 @@ def conv(tab1, map1, tab2, map2, dump)
84
89
  # parse insert statements
85
90
  if data.scan_str("(") or data.scan_str(into + "(")
86
91
  cols = data.scan_while(/('.*?(?<!\\)'|(?>[^',()]+)|,)/, 2)
87
- cols.empty? and (warn "bad sql parse: '#{line}'" or next)
92
+ cols.empty? and die "bad sql parse: '#{line}'"
88
93
  data.scan(/\)[;,]\s*/)
89
94
  else
90
95
  break
@@ -166,11 +171,11 @@ if ARGV.size > 0 and !File.exists?(ARGV.first)
166
171
  tab1 = nil if $0.size == 0 # no match, show usage
167
172
  end
168
173
 
169
- tab1 or (warn [
174
+ tab1 or die [
170
175
  "Usage: #{File.basename $0}",
171
176
  "<src_table>(:[sel1,sel2,...])",
172
177
  "[dst_table][:][col1,col2,...] file"
173
- ] * ' ' or exit)
178
+ ] * ' '
174
179
 
175
180
  conv tab1, map1, tab2 || tab1, map2, ARGF
176
181
 
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.6.0"
5
+ s.version = "0.6.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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqlconv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Shreeve
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-02 00:00:00.000000000 Z
11
+ date: 2018-06-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Allows mapping columns from a source to a destination table
14
14
  email: steve.shreeve@gmail.com