oracle-sql-parser 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8298f6ea76a3b8ad33bbdaa2ee4c2d8055a266c
4
- data.tar.gz: 6bf031d20d4ee9d2718d6c17d6ca4f9abfce4a6e
3
+ metadata.gz: 809b6d47e50c4330d56e67f5b5e466280868e868
4
+ data.tar.gz: 85083da0a0d2743e599c3a8998b057e0ed807f0a
5
5
  SHA512:
6
- metadata.gz: 4bed5224575dc5ab3873878f843d93bcd1568232b52bc9b8f11193c72281b73f0561b4da16833d27c1014560331391c956c4d7a5b0ca77a6f66c67d7481a7100
7
- data.tar.gz: 9f1a55461fc0aa234fb01a1503217c61648ddf00ae8e9dd1781fe37ea96e9337dd2176dbbe8c767b0dab5c23f0f68ee6032e812807d1e7805976e32c22f547f2
6
+ metadata.gz: c019067407242c554ccc49f97401e99f9c896ab4369b637fcd93b8f67e65b6ad95dfc72d5ea47aaac7e8aefcb0d4c58a839825bc5c2c94a7b25d377df02599b2
7
+ data.tar.gz: 6911dd676c0398c238f42bd1d0e41443ed883d0a0eb70705ea0a9112b14f1876fe3bf29dbe19ca53a3cf11e7eb996e852cdd7bf320b1568a911315eda9a8ecce
data/HISTORY.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.7.0
2
+ * Enchancement
3
+ * added syntax table alias, like "select a.* from table1 a". https://github.com/jksy/sql_parser/issues/8
4
+
1
5
  ### 0.6.0
2
6
  * Enchancement
3
7
  * added travis-ci
@@ -6,7 +10,7 @@
6
10
 
7
11
  ### 0.5.1
8
12
  * Bug fix
9
- * fix spell. to_pameternized is deprecated and will be removed. use to_parameterized
13
+ * fix spell. to_pameternized is deprecated and will be removed. use to_parameterized
10
14
 
11
15
  ### 0.5.0
12
16
  * Enchancement
data/Rakefile CHANGED
@@ -4,14 +4,17 @@ require 'rake/testtask'
4
4
 
5
5
  GRAMMAR_FILES = FileList['lib/oracle-sql-parser/grammar/*.treetop']
6
6
 
7
+ desc "generate parser files"
7
8
  task :gen do
8
9
  generate_parser_files(false)
9
10
  end
10
11
 
12
+ desc "generate parser files(force)"
11
13
  task :gen_force do
12
14
  generate_parser_files(true)
13
15
  end
14
16
 
17
+ desc "clean files"
15
18
  task :clean do
16
19
  GRAMMAR_FILES.each do |f|
17
20
  file = "#{f.gsub(/\.treetop$/,'')}.rb"
@@ -19,6 +22,7 @@ task :clean do
19
22
  end
20
23
  end
21
24
 
25
+ desc "build gem for current versioin"
22
26
  task :build_gem => [:gen_force] do
23
27
  sh 'gem build oracle-sql-parser.gemspec'
24
28
  end
@@ -4,7 +4,6 @@ module OracleSqlParser::Ast
4
4
  result = []
5
5
  result << "insert into"
6
6
  result << @ast[:insert]
7
- result << @ast[:alias]
8
7
  result << "(#{@ast[:columns].map(&:to_sql).join(',')})" if @ast[:columns]
9
8
  result << @ast[:values]
10
9
  result.compact.map(&:to_sql).join(' ')
@@ -1,6 +1,6 @@
1
1
  module OracleSqlParser::Ast
2
2
  class TableReference < Hash
3
-
3
+
4
4
  def inspect
5
5
  "#<#{self.class.name} #{@ast.inspect}>"
6
6
  end
@@ -10,6 +10,7 @@ module OracleSqlParser::Ast
10
10
  result += "#{@ast[:schema_name].to_sql}." if @ast[:schema_name]
11
11
  result += @ast[:table_name].to_sql
12
12
  result += "@#{@ast[:dblink].to_sql}" if @ast[:dblink]
13
+ result += " #{@ast[:table_alias].to_sql}" if @ast[:table_alias]
13
14
  result
14
15
  end
15
16
  end
@@ -136,17 +136,26 @@ module OracleSqlParser::Grammar
136
136
  t:(
137
137
  schema_name:schema_name '.' table_name:table_name /
138
138
  table_name:table_name
139
- ) l:('@' dblink)? {
139
+ ) l:('@' dblink)? a:(space t_alias)? {
140
140
  def ast
141
141
  OracleSqlParser::Ast::TableReference[
142
142
  :schema_name => t.try(:schema_name).ast,
143
143
  :table_name => t.try(:table_name).ast,
144
- :dblink => l.try(:dblink).ast
144
+ :dblink => l.try(:dblink).ast,
145
+ :table_alias => a.try(:t_alias).ast,
145
146
  ]
146
147
  end
147
148
  }
148
149
  end
149
150
 
151
+ rule t_alias
152
+ ident {
153
+ def ast
154
+ super
155
+ end
156
+ }
157
+ end
158
+
150
159
  rule current_of
151
160
  current_of_keyword space? cursor_name {
152
161
  def ast
@@ -1,3 +1,3 @@
1
1
  module OracleSqlParser
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oracle-sql-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Junichiro Kasuya
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-13 00:00:00.000000000 Z
11
+ date: 2016-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: treetop
@@ -216,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
216
  version: '0'
217
217
  requirements: []
218
218
  rubyforge_project:
219
- rubygems_version: 2.4.5
219
+ rubygems_version: 2.5.1
220
220
  signing_key:
221
221
  specification_version: 4
222
222
  summary: SQL Parser for Oracle