each_sql 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +3 -0
- data/VERSION +1 -1
- data/lib/each_sql/each_sql.rb +3 -2
- data/lib/each_sql.rb +2 -2
- data/test/test_each_sql.rb +27 -2
- metadata +75 -83
data/CHANGELOG.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/lib/each_sql/each_sql.rb
CHANGED
@@ -38,12 +38,13 @@ class EachSQL
|
|
38
38
|
|
39
39
|
# Process callbacks
|
40
40
|
@options[:callbacks].each do |pattern, callback|
|
41
|
-
md = statement.match pattern
|
41
|
+
#md = statement.match pattern
|
42
|
+
md = zero_out(statement).strip.match pattern
|
42
43
|
callback.call self, statement, md if md
|
43
44
|
end
|
44
45
|
|
45
46
|
# Ignore
|
46
|
-
if (@options[:ignore] || []).all? { |ipat| statement !~ ipat }
|
47
|
+
if (@options[:ignore] || []).all? { |ipat| statement !~ ipat } && statement.empty? == false
|
47
48
|
yield statement
|
48
49
|
@prev_statement = statement
|
49
50
|
end
|
data/lib/each_sql.rb
CHANGED
@@ -95,7 +95,7 @@ class EachSQL
|
|
95
95
|
}
|
96
96
|
},
|
97
97
|
:nesting_context => [
|
98
|
-
/\A\s*(begin|declare|create\b[^;]+?\b(procedure|function|trigger|package))\b/im
|
98
|
+
/\A\s*(\/\s*)*(begin|declare|create\b[^;]+?\b(procedure|function|trigger|package))\b/im
|
99
99
|
],
|
100
100
|
:callbacks => {
|
101
101
|
/\Abegin\b/ => lambda { |obj, stmt, md|
|
@@ -105,7 +105,7 @@ class EachSQL
|
|
105
105
|
},
|
106
106
|
:ignore => [],
|
107
107
|
:replace => { %r[\A/] => '' },
|
108
|
-
:strip_delimiter => lambda { |obj, stmt|
|
108
|
+
:strip_delimiter => lambda { |obj, stmt|
|
109
109
|
stmt.gsub(/(#{stmt =~ /;\s*\// ? '/' : ';'})+\Z/, '')
|
110
110
|
}
|
111
111
|
}
|
data/test/test_each_sql.rb
CHANGED
@@ -95,7 +95,8 @@ exception
|
|
95
95
|
when others then
|
96
96
|
raise;
|
97
97
|
end;",
|
98
|
-
"
|
98
|
+
"-- declaration
|
99
|
+
declare
|
99
100
|
a int;
|
100
101
|
begin
|
101
102
|
1 / 2;
|
@@ -110,9 +111,19 @@ end;",
|
|
110
111
|
"begin
|
111
112
|
null;
|
112
113
|
end;",
|
114
|
+
"begin
|
115
|
+
null;
|
116
|
+
end;",
|
113
117
|
"select * from dual",
|
114
118
|
"select begin, end, create, procedure, end, from dual",
|
115
|
-
"select * from dual"
|
119
|
+
"select * from dual",
|
120
|
+
"-- TMP_DB_TOOLS_CONV
|
121
|
+
begin
|
122
|
+
execute immediate 'DROP TABLE TMP_DB_TOOLS_CONV CASCADE CONSTRAINTS';
|
123
|
+
exception
|
124
|
+
when others then
|
125
|
+
null;
|
126
|
+
end;"
|
116
127
|
]
|
117
128
|
|
118
129
|
@oracle_script = "
|
@@ -138,6 +149,7 @@ exception
|
|
138
149
|
raise;
|
139
150
|
end;
|
140
151
|
/
|
152
|
+
-- declaration
|
141
153
|
declare
|
142
154
|
a int;
|
143
155
|
begin
|
@@ -155,6 +167,10 @@ begin
|
|
155
167
|
null;
|
156
168
|
end;
|
157
169
|
/
|
170
|
+
begin
|
171
|
+
null;
|
172
|
+
end;
|
173
|
+
/
|
158
174
|
select * from dual;
|
159
175
|
;
|
160
176
|
;
|
@@ -166,6 +182,15 @@ select * from dual;
|
|
166
182
|
|
167
183
|
select begin, end, create, procedure, end, from dual;
|
168
184
|
select * from dual;
|
185
|
+
|
186
|
+
-- TMP_DB_TOOLS_CONV
|
187
|
+
begin
|
188
|
+
execute immediate 'DROP TABLE TMP_DB_TOOLS_CONV CASCADE CONSTRAINTS';
|
189
|
+
exception
|
190
|
+
when others then
|
191
|
+
null;
|
192
|
+
end;
|
193
|
+
/
|
169
194
|
"
|
170
195
|
|
171
196
|
@mysql = [
|
metadata
CHANGED
@@ -1,104 +1,96 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: each_sql
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.3
|
4
5
|
prerelease:
|
5
|
-
version: 0.2.2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
|
7
|
+
authors:
|
8
|
+
- Junegunn Choi
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
prerelease: false
|
48
|
-
type: :development
|
12
|
+
date: 2011-07-08 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: &2157020060 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.0
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2157020060
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: jeweler
|
27
|
+
requirement: &2157019580 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.6.2
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2157019580
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rcov
|
38
|
+
requirement: &2157019100 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2157019100
|
49
47
|
description: Enumerate each SQL statement in SQL scripts.
|
50
48
|
email: junegunn.c@gmail.com
|
51
49
|
executables: []
|
52
|
-
|
53
50
|
extensions: []
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
- test/test_each_sql.rb
|
72
|
-
has_rdoc: true
|
51
|
+
extra_rdoc_files:
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.rdoc
|
54
|
+
files:
|
55
|
+
- .document
|
56
|
+
- CHANGELOG.rdoc
|
57
|
+
- Gemfile
|
58
|
+
- Gemfile.lock
|
59
|
+
- LICENSE.txt
|
60
|
+
- README.rdoc
|
61
|
+
- Rakefile
|
62
|
+
- VERSION
|
63
|
+
- lib/each_sql.rb
|
64
|
+
- lib/each_sql/each_sql.rb
|
65
|
+
- test/helper.rb
|
66
|
+
- test/postgres.sql
|
67
|
+
- test/test_each_sql.rb
|
73
68
|
homepage: http://github.com/junegunn/each_sql
|
74
|
-
licenses:
|
75
|
-
|
69
|
+
licenses:
|
70
|
+
- MIT
|
76
71
|
post_install_message:
|
77
72
|
rdoc_options: []
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
76
|
none: false
|
83
|
-
requirements:
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
segments:
|
82
|
+
- 0
|
83
|
+
hash: -2366804221344298051
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
85
|
none: false
|
92
|
-
requirements:
|
93
|
-
|
94
|
-
|
95
|
-
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
96
90
|
requirements: []
|
97
|
-
|
98
91
|
rubyforge_project:
|
99
|
-
rubygems_version: 1.
|
92
|
+
rubygems_version: 1.7.2
|
100
93
|
signing_key:
|
101
94
|
specification_version: 3
|
102
95
|
summary: Enumerate each SQL statement in SQL scripts.
|
103
96
|
test_files: []
|
104
|
-
|