bmg 0.20.1 → 0.20.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bmg/operator/autowrap.rb +21 -5
- data/lib/bmg/operator/project.rb +4 -0
- data/lib/bmg/sequel/translator.rb +1 -1
- data/lib/bmg/sql/nodes/expr.rb +4 -0
- data/lib/bmg/sql/processor/limit_offset.rb +8 -1
- data/lib/bmg/sql/processor/order_by.rb +1 -1
- data/lib/bmg/type.rb +5 -0
- data/lib/bmg/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb2c9a67394ec85b7898ecf5c3d0b0dcf9532666
|
4
|
+
data.tar.gz: 6a8c8ed5c60392299225c7187e2d05ac95b59798
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 633a62f541c6f2fe87d20de2809fd2dc3166d1118320623ea3c16edd54435a164ef45d11d8a8475f927203abb0e247083525d280393dc30c0ffc06ff485c70ba
|
7
|
+
data.tar.gz: c8b357936dc6511d3e955b80da8b48dee258adef5d2ad1cd1024fd45c3bd895ed31a382fcf27141c32afa9d0e7728c38866bd1f720830b29fdb941f98dec1411
|
@@ -68,6 +68,20 @@ module Bmg
|
|
68
68
|
|
69
69
|
protected ### optimization
|
70
70
|
|
71
|
+
def _allbut(type, butlist)
|
72
|
+
new_roots = wrapped_roots!
|
73
|
+
separator = @options[:split]
|
74
|
+
down = operand.type.attrlist!.select { |attr|
|
75
|
+
root = attr.to_s.split(separator).map(&:to_sym).first
|
76
|
+
butlist.include?(root)
|
77
|
+
}
|
78
|
+
r = operand.allbut(down)
|
79
|
+
r = r.autowrap(options) unless (butlist & new_roots == new_roots)
|
80
|
+
r
|
81
|
+
rescue UnknownAttributesError
|
82
|
+
super
|
83
|
+
end
|
84
|
+
|
71
85
|
def _autowrap(type, opts)
|
72
86
|
if same_options?(opts)
|
73
87
|
self
|
@@ -122,11 +136,12 @@ module Bmg
|
|
122
136
|
end
|
123
137
|
|
124
138
|
def _project(type, attrlist)
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
139
|
+
separator = @options[:split]
|
140
|
+
to_keep = operand.type.attrlist!.select { |attr|
|
141
|
+
root = attr.to_s.split(separator).map(&:to_sym).first
|
142
|
+
attrlist.include?(root)
|
143
|
+
}
|
144
|
+
operand.project(to_keep).autowrap(options)
|
130
145
|
rescue UnknownAttributesError
|
131
146
|
super
|
132
147
|
end
|
@@ -169,6 +184,7 @@ module Bmg
|
|
169
184
|
|
170
185
|
def wrapped_roots_of!(r, opts)
|
171
186
|
raise UnknownAttributesError unless r.type.knows_attrlist?
|
187
|
+
|
172
188
|
Support.wrapped_roots(r.type.to_attrlist, opts[:split])
|
173
189
|
end
|
174
190
|
|
data/lib/bmg/operator/project.rb
CHANGED
@@ -11,7 +11,7 @@ module Bmg
|
|
11
11
|
def on_with_exp(sexpr)
|
12
12
|
if sequel_db.select(1).supports_cte?
|
13
13
|
dataset = apply(sexpr.select_exp)
|
14
|
-
apply(sexpr.with_spec).each_pair do |name,subquery|
|
14
|
+
apply(sexpr.with_spec).each_pair do |name, subquery|
|
15
15
|
dataset = dataset.with(name, subquery)
|
16
16
|
end
|
17
17
|
dataset
|
data/lib/bmg/sql/nodes/expr.rb
CHANGED
@@ -18,12 +18,19 @@ module Bmg
|
|
18
18
|
alias :on_intersect :on_set_operator
|
19
19
|
|
20
20
|
def on_select_exp(sexpr)
|
21
|
-
sexpr
|
21
|
+
sexpr = builder.from_self(sexpr) if must_from_self?(sexpr)
|
22
|
+
|
22
23
|
limit_clause = builder.limit_clause(limit)
|
23
24
|
offset_clause = builder.offset_clause(offset)
|
24
25
|
sexpr.with_push(limit_clause, offset_clause)
|
25
26
|
end
|
26
27
|
|
28
|
+
private
|
29
|
+
|
30
|
+
def must_from_self?(sexpr)
|
31
|
+
sexpr.limit_or_offset?
|
32
|
+
end
|
33
|
+
|
27
34
|
end # class LimitOffset
|
28
35
|
end # class Processor
|
29
36
|
end # module Sql
|
data/lib/bmg/type.rb
CHANGED
data/lib/bmg/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bmg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.20.
|
4
|
+
version: 0.20.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernard Lambeau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: predicate
|