axiom-sql-generator 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -0
- data/.ruby-gemset +1 -0
- data/.travis.yml +17 -23
- data/CONTRIBUTING.md +1 -2
- data/Gemfile +10 -3
- data/Gemfile.devtools +39 -27
- data/README.md +5 -33
- data/axiom-sql-generator.gemspec +3 -5
- data/config/devtools.yml +2 -0
- data/config/flay.yml +1 -1
- data/config/reek.yml +1 -1
- data/config/rubocop.yml +59 -0
- data/lib/axiom/sql/generator/core_ext/date_time.rb +5 -6
- data/lib/axiom/sql/generator/direction.rb +4 -4
- data/lib/axiom/sql/generator/function/predicate.rb +1 -1
- data/lib/axiom/sql/generator/relation.rb +12 -11
- data/lib/axiom/sql/generator/relation/binary.rb +1 -1
- data/lib/axiom/sql/generator/relation/insertion.rb +1 -1
- data/lib/axiom/sql/generator/relation/unary.rb +20 -20
- data/lib/axiom/sql/generator/version.rb +1 -1
- data/lib/axiom/sql/generator/visitor.rb +3 -3
- data/spec/spec_helper.rb +11 -10
- data/spec/support/config_alias.rb +2 -0
- data/spec/unit/axiom/sql/generator/direction/{visit_axiom_relation_operation_order_ascending_spec.rb → visit_axiom_relation_operation_sorted_ascending_spec.rb} +2 -2
- data/spec/unit/axiom/sql/generator/direction/{visit_axiom_relation_operation_order_descending_spec.rb → visit_axiom_relation_operation_sorted_descending_spec.rb} +2 -2
- data/spec/unit/axiom/sql/generator/function/predicate/visit_axiom_function_predicate_exclusion_spec.rb +1 -1
- data/spec/unit/axiom/sql/generator/function/predicate/visit_axiom_function_predicate_inclusion_spec.rb +1 -1
- data/spec/unit/axiom/sql/generator/function/predicate/visit_axiom_function_predicate_inequality_spec.rb +3 -3
- data/spec/unit/axiom/sql/generator/literal/visit_enumerable_spec.rb +1 -1
- data/spec/unit/axiom/sql/generator/relation/binary/base/to_subquery_spec.rb +7 -7
- data/spec/unit/axiom/sql/generator/relation/binary/base/visit_axiom_relation_base_spec.rb +8 -8
- data/spec/unit/axiom/sql/generator/relation/binary/to_s_spec.rb +7 -7
- data/spec/unit/axiom/sql/generator/relation/binary/to_subquery_spec.rb +7 -7
- data/spec/unit/axiom/sql/generator/relation/binary/visit_axiom_algebra_join_spec.rb +20 -20
- data/spec/unit/axiom/sql/generator/relation/binary/visit_axiom_algebra_product_spec.rb +26 -26
- data/spec/unit/axiom/sql/generator/relation/class_methods/visit_spec.rb +10 -10
- data/spec/unit/axiom/sql/generator/relation/insertion/to_subquery_spec.rb +2 -2
- data/spec/unit/axiom/sql/generator/relation/insertion/visit_axiom_relation_operation_insertion_spec.rb +23 -23
- data/spec/unit/axiom/sql/generator/relation/materialized/visit_axiom_relation_materialized_spec.rb +3 -3
- data/spec/unit/axiom/sql/generator/relation/materialized/visited_spec.rb +2 -2
- data/spec/unit/axiom/sql/generator/relation/set/class_methods/normalize_operand_headers_spec.rb +5 -5
- data/spec/unit/axiom/sql/generator/relation/set/to_s_spec.rb +7 -7
- data/spec/unit/axiom/sql/generator/relation/set/to_subquery_spec.rb +7 -7
- data/spec/unit/axiom/sql/generator/relation/set/visit_axiom_algebra_difference_spec.rb +19 -19
- data/spec/unit/axiom/sql/generator/relation/set/visit_axiom_algebra_intersection_spec.rb +19 -19
- data/spec/unit/axiom/sql/generator/relation/set/visit_axiom_algebra_union_spec.rb +19 -19
- data/spec/unit/axiom/sql/generator/relation/to_s_spec.rb +9 -9
- data/spec/unit/axiom/sql/generator/relation/to_sql_spec.rb +8 -8
- data/spec/unit/axiom/sql/generator/relation/to_subquery_spec.rb +9 -9
- data/spec/unit/axiom/sql/generator/relation/unary/to_s_spec.rb +9 -9
- data/spec/unit/axiom/sql/generator/relation/unary/to_subquery_spec.rb +11 -11
- data/spec/unit/axiom/sql/generator/relation/unary/visit_axiom_algebra_extension_spec.rb +17 -17
- data/spec/unit/axiom/sql/generator/relation/unary/visit_axiom_algebra_projection_spec.rb +23 -23
- data/spec/unit/axiom/sql/generator/relation/unary/visit_axiom_algebra_rename_spec.rb +19 -19
- data/spec/unit/axiom/sql/generator/relation/unary/visit_axiom_algebra_restriction_spec.rb +22 -22
- data/spec/unit/axiom/sql/generator/relation/unary/visit_axiom_algebra_summarization_spec.rb +48 -48
- data/spec/unit/axiom/sql/generator/relation/unary/visit_axiom_relation_base_spec.rb +8 -8
- data/spec/unit/axiom/sql/generator/relation/unary/visit_axiom_relation_operation_limit_spec.rb +24 -24
- data/spec/unit/axiom/sql/generator/relation/unary/visit_axiom_relation_operation_offset_spec.rb +24 -24
- data/spec/unit/axiom/sql/generator/relation/unary/visit_axiom_relation_operation_reverse_spec.rb +26 -26
- data/spec/unit/axiom/sql/generator/relation/unary/{visit_axiom_relation_operation_order_spec.rb → visit_axiom_relation_operation_sorted_spec.rb} +28 -28
- data/spec/unit/axiom/sql/generator/relation/visit_spec.rb +3 -3
- data/spec/unit/axiom/sql/generator/relation/visited_spec.rb +7 -7
- data/spec/unit/axiom/sql/generator/visitor/visit_spec.rb +2 -2
- metadata +22 -41
- data/.rvmrc +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f5e40b841ac0de3395606dc63f690b93dbe801b
|
4
|
+
data.tar.gz: 0101aab61557b95116cdc6a97ee1ce17f52aeb46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15ea52586ef4a567cd64dcdb0b27746189201d058d47e9b7d4fd784ac0ee96e239afdbd5c1e9851217b5826dd00cc93bc70639e43e8ce06eb180faf448a5f28e
|
7
|
+
data.tar.gz: e5ee3c0437f8793002ea99aef0c6a1133830ac534e0dd263614922d56fa9e6def8f35b1107908da74e6e2473617ed7ce50d43851acbd1491ae54846df0557229
|
data/.rubocop.yml
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
axiom-sql-generator
|
data/.travis.yml
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
language: ruby
|
2
2
|
before_install: gem install bundler
|
3
3
|
bundler_args: --without yard guard benchmarks
|
4
|
-
script: "bundle exec rake ci"
|
4
|
+
script: "bundle exec rake ci:metrics"
|
5
5
|
rvm:
|
6
|
-
- ree
|
7
|
-
- 1.8.7
|
8
|
-
- 1.9.2
|
9
6
|
- 1.9.3
|
10
7
|
- 2.0.0
|
8
|
+
- 2.1.0
|
11
9
|
- ruby-head
|
12
|
-
- rbx
|
13
|
-
- rbx-19mode
|
14
|
-
- jruby-18mode
|
15
|
-
notifications:
|
16
|
-
irc:
|
17
|
-
channels:
|
18
|
-
- irc.freenode.org#datamapper
|
19
|
-
on_success: never
|
20
|
-
on_failure: change
|
21
|
-
email:
|
22
|
-
recipients:
|
23
|
-
- dan.kubb@gmail.com
|
24
|
-
on_success: never
|
25
|
-
on_failure: change
|
10
|
+
- rbx
|
26
11
|
matrix:
|
27
12
|
include:
|
28
13
|
- rvm: jruby-19mode
|
29
|
-
env: JRUBY_OPTS="$JRUBY_OPTS --debug"
|
14
|
+
env: JRUBY_OPTS="$JRUBY_OPTS --debug" # for simplecov
|
15
|
+
- rvm: jruby-20mode
|
16
|
+
env: JRUBY_OPTS="$JRUBY_OPTS --debug" # for simplecov
|
17
|
+
- rvm: jruby-21mode
|
18
|
+
env: JRUBY_OPTS="$JRUBY_OPTS --debug" # for simplecov
|
30
19
|
- rvm: jruby-head
|
31
|
-
env: JRUBY_OPTS="$JRUBY_OPTS --debug"
|
20
|
+
env: JRUBY_OPTS="$JRUBY_OPTS --debug" # for simplecov
|
32
21
|
allow_failures:
|
33
|
-
#
|
34
|
-
|
35
|
-
|
22
|
+
- rvm: 2.1.0 # buggy runtime
|
23
|
+
fast_finish: true
|
24
|
+
notifications:
|
25
|
+
irc:
|
26
|
+
channels:
|
27
|
+
- irc.freenode.org#rom-rb
|
28
|
+
on_success: never
|
29
|
+
on_failure: change
|
data/CONTRIBUTING.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
Contributing
|
2
|
-
------------
|
1
|
+
# Contributing
|
3
2
|
|
4
3
|
* If you want your code merged into the mainline, please discuss the proposed changes with me before doing any work on it. This library is still in early development, and the direction it is going may not always be clear. Some features may not be appropriate yet, may need to be deferred until later when the foundation for them is laid, or may be more applicable in a plugin.
|
5
4
|
* Fork the project.
|
data/Gemfile
CHANGED
@@ -2,7 +2,14 @@
|
|
2
2
|
|
3
3
|
source 'https://rubygems.org'
|
4
4
|
|
5
|
-
|
5
|
+
gemspec
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
platform :rbx do
|
8
|
+
gem 'rubysl-bigdecimal', '~> 2.0.2'
|
9
|
+
end
|
10
|
+
|
11
|
+
group :development, :test do
|
12
|
+
gem 'devtools', git: 'https://github.com/rom-rb/devtools.git'
|
13
|
+
end
|
14
|
+
|
15
|
+
eval_gemfile 'Gemfile.devtools'
|
data/Gemfile.devtools
CHANGED
@@ -1,48 +1,60 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
group :development do
|
4
|
-
gem 'rake', '~> 10.0
|
5
|
-
gem 'rspec', '~> 2.
|
6
|
-
gem 'yard', '~> 0.8.
|
4
|
+
gem 'rake', '~> 10.1.0'
|
5
|
+
gem 'rspec', '~> 2.14.1'
|
6
|
+
gem 'yard', '~> 0.8.7'
|
7
|
+
|
8
|
+
platform :rbx do
|
9
|
+
gem 'rubysl-singleton', '~> 2.0.0'
|
10
|
+
end
|
7
11
|
end
|
8
12
|
|
9
13
|
group :yard do
|
10
|
-
gem 'kramdown', '~> 1.0
|
14
|
+
gem 'kramdown', '~> 1.3.0'
|
11
15
|
end
|
12
16
|
|
13
17
|
group :guard do
|
14
|
-
gem 'guard', '~>
|
15
|
-
gem 'guard-bundler', '~>
|
16
|
-
gem 'guard-rspec', '~> 2.
|
18
|
+
gem 'guard', '~> 2.3.0'
|
19
|
+
gem 'guard-bundler', '~> 2.0.0'
|
20
|
+
gem 'guard-rspec', '~> 4.2.0'
|
21
|
+
gem 'guard-rubocop', '~> 1.0.0'
|
17
22
|
|
18
23
|
# file system change event handling
|
19
|
-
gem 'listen', '~>
|
20
|
-
gem 'rb-fchange', '~> 0.0.6', :
|
21
|
-
gem 'rb-fsevent', '~> 0.9.3', :
|
22
|
-
gem 'rb-inotify', '~> 0.9.0', :
|
24
|
+
gem 'listen', '~> 2.4.0'
|
25
|
+
gem 'rb-fchange', '~> 0.0.6', require: false
|
26
|
+
gem 'rb-fsevent', '~> 0.9.3', require: false
|
27
|
+
gem 'rb-inotify', '~> 0.9.0', require: false
|
23
28
|
|
24
29
|
# notification handling
|
25
|
-
gem 'libnotify', '~> 0.8.0', :
|
26
|
-
gem 'rb-notifu', '~> 0.0.4', :
|
27
|
-
gem 'terminal-notifier-guard', '~> 1.5.3', :
|
30
|
+
gem 'libnotify', '~> 0.8.0', require: false
|
31
|
+
gem 'rb-notifu', '~> 0.0.4', require: false
|
32
|
+
gem 'terminal-notifier-guard', '~> 1.5.3', require: false
|
28
33
|
end
|
29
34
|
|
30
35
|
group :metrics do
|
31
|
-
gem '
|
32
|
-
gem '
|
33
|
-
gem '
|
34
|
-
gem '
|
35
|
-
gem '
|
36
|
-
gem 'simplecov',
|
37
|
-
gem 'yardstick',
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
36
|
+
gem 'coveralls', '~> 0.7.0'
|
37
|
+
gem 'flay', '~> 2.4.0'
|
38
|
+
gem 'flog', '~> 4.2.0'
|
39
|
+
gem 'reek', '~> 1.3.2'
|
40
|
+
gem 'rubocop', '~> 0.16.0'
|
41
|
+
gem 'simplecov', '~> 0.8.2'
|
42
|
+
gem 'yardstick', '~> 0.9.9'
|
43
|
+
|
44
|
+
platforms :mri do
|
45
|
+
gem 'mutant', '~> 0.3.4'
|
46
|
+
end
|
47
|
+
|
48
|
+
platforms :ruby_19, :ruby_20 do
|
49
|
+
gem 'yard-spellcheck', '~> 0.1.5'
|
42
50
|
end
|
43
51
|
|
44
|
-
|
45
|
-
gem '
|
52
|
+
platform :rbx do
|
53
|
+
gem 'json', '~> 1.8.1'
|
54
|
+
gem 'racc', '~> 1.4'
|
55
|
+
gem 'rubysl-logger', '~> 2.0.0'
|
56
|
+
gem 'rubysl-open-uri', '~> 2.0.0'
|
57
|
+
gem 'rubysl-prettyprint', '~> 2.0.2'
|
46
58
|
end
|
47
59
|
end
|
48
60
|
|
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
axiom-sql-generator
|
2
|
-
===================
|
1
|
+
# axiom-sql-generator
|
3
2
|
|
4
3
|
Relational algebra SQL generator
|
5
4
|
|
@@ -15,31 +14,7 @@ Relational algebra SQL generator
|
|
15
14
|
[codeclimate]: https://codeclimate.com/github/dkubb/axiom-sql-generator
|
16
15
|
[coveralls]: https://coveralls.io/r/dkubb/axiom-sql-generator
|
17
16
|
|
18
|
-
|
19
|
-
------------
|
20
|
-
|
21
|
-
With Rubygems:
|
22
|
-
|
23
|
-
```bash
|
24
|
-
$ gem install axiom-sql-generator
|
25
|
-
$ irb -rubygems
|
26
|
-
>> require 'axiom-sql-generator'
|
27
|
-
=> true
|
28
|
-
```
|
29
|
-
|
30
|
-
With git and local working copy:
|
31
|
-
|
32
|
-
```bash
|
33
|
-
$ git clone git://github.com/dkubb/axiom-sql-generator.git
|
34
|
-
$ cd axiom-sql-generator
|
35
|
-
$ rake install
|
36
|
-
$ irb -rubygems
|
37
|
-
>> require 'axiom-sql-generator'
|
38
|
-
=> true
|
39
|
-
```
|
40
|
-
|
41
|
-
Usage
|
42
|
-
-----
|
17
|
+
## Usage
|
43
18
|
|
44
19
|
```ruby
|
45
20
|
# visit every node in the relation AST
|
@@ -52,19 +27,16 @@ sql = generator.to_sql
|
|
52
27
|
subquery_sql = generator.to_subquery
|
53
28
|
```
|
54
29
|
|
55
|
-
Description
|
56
|
-
-----------
|
30
|
+
## Description
|
57
31
|
|
58
32
|
The purpose of this gem is to produce valid SQL from a [axiom](https://github.com/dkubb/axiom) relation. A relation is a representation of a query constructed using relational algebra organized into an AST. Each node in the AST corresponds to an operation defined in the algebra.
|
59
33
|
|
60
34
|
The SQL produced has been verified and tested against [PostgreSQL](http://www.postgresql.org/) 9.0.4. Dialects for [MySQL](http://www.mysql.com/), [SQLite](http://www.sqlite.org/), [Oracle](http://www.oracle.com/) and [SQL Server](http://www.microsoft.com/sqlserver/) are planned.
|
61
35
|
|
62
|
-
Contributing
|
63
|
-
------------
|
36
|
+
## Contributing
|
64
37
|
|
65
38
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
|
66
39
|
|
67
|
-
Copyright
|
68
|
-
---------
|
40
|
+
## Copyright
|
69
41
|
|
70
42
|
Copyright © 2010-2013 Dan Kubb. See LICENSE for details.
|
data/axiom-sql-generator.gemspec
CHANGED
@@ -10,16 +10,14 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.description = 'Generate SQL from a axiom relation'
|
11
11
|
gem.summary = 'Relational algebra SQL generator'
|
12
12
|
gem.homepage = 'https://github.com/dkubb/axiom-sql-generator'
|
13
|
-
gem.
|
13
|
+
gem.license = 'MIT'
|
14
14
|
|
15
15
|
gem.require_paths = %w[lib]
|
16
16
|
gem.files = `git ls-files`.split($/)
|
17
17
|
gem.test_files = `git ls-files -- spec/unit`.split($/)
|
18
18
|
gem.extra_rdoc_files = %w[LICENSE README.md CONTRIBUTING.md TODO]
|
19
19
|
|
20
|
-
gem.add_runtime_dependency('axiom', '~> 0.
|
20
|
+
gem.add_runtime_dependency('axiom', '~> 0.2.0')
|
21
21
|
|
22
|
-
gem.add_development_dependency('
|
23
|
-
gem.add_development_dependency('rspec', '~> 2.13.0')
|
24
|
-
gem.add_development_dependency('yard', '~> 0.8.5.2')
|
22
|
+
gem.add_development_dependency('bundler', '~> 1.5', '>= 1.5.2')
|
25
23
|
end
|
data/config/devtools.yml
ADDED
data/config/flay.yml
CHANGED
data/config/reek.yml
CHANGED
@@ -114,7 +114,7 @@ TooManyStatements:
|
|
114
114
|
- Axiom::SQL::Generator::Relation::Unary#visit_axiom_relation_operation_binary
|
115
115
|
- Axiom::SQL::Generator::Relation::Unary#visit_axiom_relation_operation_limit
|
116
116
|
- Axiom::SQL::Generator::Relation::Unary#visit_axiom_relation_operation_offset
|
117
|
-
- Axiom::SQL::Generator::Relation::Unary#
|
117
|
+
- Axiom::SQL::Generator::Relation::Unary#visit_axiom_relation_operation_sorted
|
118
118
|
- Axiom::SQL::Generator::Visitor#self.method_for
|
119
119
|
- each
|
120
120
|
max_statements: 2
|
data/config/rubocop.yml
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
inherit_from: ../.rubocop.yml
|
2
|
+
|
3
|
+
# Avoid parameter lists longer than five parameters.
|
4
|
+
ParameterLists:
|
5
|
+
Max: 3
|
6
|
+
CountKeywordArgs: true
|
7
|
+
|
8
|
+
# Avoid more than `Max` levels of nesting.
|
9
|
+
BlockNesting:
|
10
|
+
Max: 3
|
11
|
+
|
12
|
+
# Align with the style guide.
|
13
|
+
CollectionMethods:
|
14
|
+
PreferredMethods:
|
15
|
+
collect: 'map'
|
16
|
+
inject: 'reduce'
|
17
|
+
find: 'detect'
|
18
|
+
find_all: 'select'
|
19
|
+
|
20
|
+
# Do not force public/protected/private keyword to be indented at the same
|
21
|
+
# level as the def keyword. My personal preference is to outdent these keywords
|
22
|
+
# because I think when scanning code it makes it easier to identify the
|
23
|
+
# sections of code and visually separate them. When the keyword is at the same
|
24
|
+
# level I think it sort of blends in with the def keywords and makes it harder
|
25
|
+
# to scan the code and see where the sections are.
|
26
|
+
AccessModifierIndentation:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
# Limit line length
|
30
|
+
LineLength:
|
31
|
+
Max: 392 # TODO: lower to 79
|
32
|
+
|
33
|
+
# Disable documentation checking until a class needs to be documented once
|
34
|
+
Documentation:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
# Do not always use &&/|| instead of and/or.
|
38
|
+
AndOr:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
# Do not favor modifier if/unless usage when you have a single-line body
|
42
|
+
IfUnlessModifier:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
# Allow case equality operator (in limited use within the specs)
|
46
|
+
CaseEquality:
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
# Constants do not always have to use SCREAMING_SNAKE_CASE
|
50
|
+
ConstantName:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
# Not all trivial readers/writers can be defined with attr_* methods
|
54
|
+
TrivialAccessors:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
# Allow empty lines around body
|
58
|
+
EmptyLinesAroundBody:
|
59
|
+
Enabled: false
|
@@ -33,12 +33,11 @@ private
|
|
33
33
|
def iso8601_timediv(time_scale)
|
34
34
|
date_time = frozen? ? dup : self
|
35
35
|
|
36
|
-
fractional_seconds =
|
37
|
-
'.%0*d'
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
36
|
+
fractional_seconds = sprintf(
|
37
|
+
'.%0*d',
|
38
|
+
time_scale,
|
39
|
+
date_time.sec_fraction * SEC_FRACTION_MULTIPLIER * 10**time_scale
|
40
|
+
) unless time_scale.zero?
|
42
41
|
|
43
42
|
date_time.strftime("T%T#{fractional_seconds}%Z")
|
44
43
|
end
|
@@ -12,23 +12,23 @@ module Axiom
|
|
12
12
|
|
13
13
|
# Visit an Ascending Direction
|
14
14
|
#
|
15
|
-
# @param [Relation::Operation::
|
15
|
+
# @param [Relation::Operation::Sorted::Ascending] direction
|
16
16
|
#
|
17
17
|
# @return [#to_s]
|
18
18
|
#
|
19
19
|
# @api private
|
20
|
-
def
|
20
|
+
def visit_axiom_relation_operation_sorted_ascending(direction)
|
21
21
|
dispatch direction.attribute
|
22
22
|
end
|
23
23
|
|
24
24
|
# Visit an Descending Direction
|
25
25
|
#
|
26
|
-
# @param [Relation::Operation::
|
26
|
+
# @param [Relation::Operation::Sorted::Descending] direction
|
27
27
|
#
|
28
28
|
# @return [#to_s]
|
29
29
|
#
|
30
30
|
# @api private
|
31
|
-
def
|
31
|
+
def visit_axiom_relation_operation_sorted_descending(direction)
|
32
32
|
dispatch(direction.attribute) << DESC
|
33
33
|
end
|
34
34
|
|
@@ -29,16 +29,17 @@ module Axiom
|
|
29
29
|
#
|
30
30
|
# @api private
|
31
31
|
def self.visit(relation)
|
32
|
-
klass =
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
32
|
+
klass =
|
33
|
+
case relation
|
34
|
+
when Axiom::Relation::Operation::Insertion then self::Insertion
|
35
|
+
when Axiom::Relation::Operation::Set then self::Set
|
36
|
+
when Axiom::Relation::Operation::Binary then self::Binary
|
37
|
+
when Axiom::Relation::Operation::Unary then self::Unary
|
38
|
+
when Axiom::Relation::Base then self::Base
|
39
|
+
when Axiom::Relation::Materialized then self::Materialized
|
40
|
+
else
|
41
|
+
fail InvalidRelationError, "#{relation.class} is not a visitable relation"
|
42
|
+
end
|
42
43
|
klass.new.visit(relation)
|
43
44
|
end
|
44
45
|
|
@@ -144,7 +145,7 @@ module Axiom
|
|
144
145
|
#
|
145
146
|
# @api private
|
146
147
|
def implicit_columns
|
147
|
-
sql = [
|
148
|
+
sql = [STAR, column_list_for(@extensions)]
|
148
149
|
sql.reject! { |fragment| fragment.empty? }
|
149
150
|
sql.join(SEPARATOR)
|
150
151
|
end
|