oracle-sql-parser 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/HISTORY.md +6 -0
- data/Rakefile +2 -0
- data/lib/oracle-sql-parser/ast/compound_condition.rb +2 -2
- data/lib/oracle-sql-parser/ast/hash.rb +4 -0
- data/lib/oracle-sql-parser/ast/identifier.rb +6 -2
- data/lib/oracle-sql-parser/ast/searched_case_expression.rb +1 -1
- data/lib/oracle-sql-parser/grammar/condition.treetop +1 -1
- data/lib/oracle-sql-parser/grammar/expression.treetop +20 -14
- data/lib/oracle-sql-parser/version.rb +1 -1
- data/oracle-sql-parser.gemspec +4 -1
- metadata +44 -3
- data/.travis.yml +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8298f6ea76a3b8ad33bbdaa2ee4c2d8055a266c
|
4
|
+
data.tar.gz: 6bf031d20d4ee9d2718d6c17d6ca4f9abfce4a6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bed5224575dc5ab3873878f843d93bcd1568232b52bc9b8f11193c72281b73f0561b4da16833d27c1014560331391c956c4d7a5b0ca77a6f66c67d7481a7100
|
7
|
+
data.tar.gz: 9f1a55461fc0aa234fb01a1503217c61648ddf00ae8e9dd1781fe37ea96e9337dd2176dbbe8c767b0dab5c23f0f68ee6032e812807d1e7805976e32c22f547f2
|
data/.gitignore
CHANGED
data/HISTORY.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
### 0.6.0
|
2
|
+
* Enchancement
|
3
|
+
* added travis-ci
|
4
|
+
* added oracle enhanced adapter query(select, includes, joins, where)
|
5
|
+
* added syntax for column_alias
|
6
|
+
|
1
7
|
### 0.5.1
|
2
8
|
* Bug fix
|
3
9
|
* fix spell. to_pameternized is deprecated and will be removed. use to_parameterized
|
data/Rakefile
CHANGED
@@ -47,6 +47,10 @@ module OracleSqlParser::Ast
|
|
47
47
|
self.new(value)
|
48
48
|
end
|
49
49
|
|
50
|
+
def []=(name, value)
|
51
|
+
@ast[name] = value
|
52
|
+
end
|
53
|
+
|
50
54
|
def method_missing(name, *args)
|
51
55
|
return @ast.send(:[], name) if @ast.has_key? name
|
52
56
|
raise "no method:#{name}, #{@ast.class} in #{self.class}"
|
@@ -9,11 +9,15 @@ module OracleSqlParser::Ast
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def to_sql(options = {})
|
12
|
+
result = []
|
12
13
|
if quoted?
|
13
|
-
"\"#{@ast[:name]}\""
|
14
|
+
result << "\"#{@ast[:name]}\""
|
14
15
|
else
|
15
|
-
@ast[:name]
|
16
|
+
result << @ast[:name]
|
16
17
|
end
|
18
|
+
result << @ast[:as] if @ast[:as]
|
19
|
+
result << @ast[:alias] if @ast[:alias]
|
20
|
+
result.map(&:to_sql).join(' ')
|
17
21
|
end
|
18
22
|
end
|
19
23
|
end
|
@@ -251,7 +251,7 @@ module OracleSqlParser::Grammar
|
|
251
251
|
rule compound_condition
|
252
252
|
'(' logical_condition ')' {
|
253
253
|
def ast
|
254
|
-
OracleSqlParser::Ast::CompoundCondition[logical_condition.ast]
|
254
|
+
OracleSqlParser::Ast::CompoundCondition[:condition => logical_condition.ast]
|
255
255
|
end
|
256
256
|
}
|
257
257
|
end
|
@@ -1,20 +1,26 @@
|
|
1
1
|
module OracleSqlParser::Grammar
|
2
2
|
grammar Expression
|
3
3
|
rule sql_expression
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
4
|
+
ex:(
|
5
|
+
function_expression /
|
6
|
+
case_expression /
|
7
|
+
cursor_expression /
|
8
|
+
compound_expression /
|
9
|
+
datetime_expression /
|
10
|
+
interval_expression /
|
11
|
+
object_access_expression /
|
12
|
+
scalar_subquery_expression /
|
13
|
+
model_expression /
|
14
|
+
type_constructor_expression /
|
15
|
+
simple_expression /
|
16
|
+
variable_expression)
|
17
|
+
alias_name:(space as_keyword space ident)?
|
18
|
+
{
|
19
|
+
def ast
|
20
|
+
tree = ex.ast
|
21
|
+
tree[:as] = alias_name.try(:as_keyword).try(:ast)
|
22
|
+
tree[:alias] = alias_name.try(:ident).try(:ast)
|
23
|
+
tree
|
18
24
|
end
|
19
25
|
}
|
20
26
|
end
|
data/oracle-sql-parser.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = "https://github.com/jksy/sql_parser"
|
15
15
|
spec.licenses = ["MIT"]
|
16
16
|
|
17
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test)
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test)/|.travis}) }
|
18
18
|
spec.files += `echo lib/oracle-sql-parser/grammar/*.rb`.split(" ")
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
@@ -23,4 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.10"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
25
|
spec.add_development_dependency "test-unit", "~> 3.1"
|
26
|
+
spec.add_development_dependency "activerecord", "~> 4.2"
|
27
|
+
spec.add_development_dependency "activerecord-oracle_enhanced-adapter", "~> 1.6.0"
|
28
|
+
spec.add_development_dependency "ruby-oci8", "~> 2.0"
|
26
29
|
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.
|
4
|
+
version: 0.6.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-
|
11
|
+
date: 2016-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: treetop
|
@@ -66,6 +66,48 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activerecord
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.2'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '4.2'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: activerecord-oracle_enhanced-adapter
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.6.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.6.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: ruby-oci8
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2.0'
|
69
111
|
description: SQL Parser for Oracle
|
70
112
|
email:
|
71
113
|
- junichiro.kasuya@gmail.com
|
@@ -74,7 +116,6 @@ extensions: []
|
|
74
116
|
extra_rdoc_files: []
|
75
117
|
files:
|
76
118
|
- ".gitignore"
|
77
|
-
- ".travis.yml"
|
78
119
|
- Gemfile
|
79
120
|
- HISTORY.md
|
80
121
|
- README.md
|