switchman 3.0.7 → 3.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/switchman/arel.rb +28 -6
- data/lib/switchman/rails.rb +1 -1
- data/lib/switchman/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e1083f3908c00847426bb780ec185b1845840da0fad4b7954fb678f904d879e
|
4
|
+
data.tar.gz: 0a29cd8e066d74aae0195c0ff1533e8859b01441bc788de6fda2ddb08e9d87fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fcd4a43310bd96e006bba2fdce3e86ec304648a4e86bcede565e136fd2fa52dd62b6aaeb6e055a8f48c9a80a1b2fe742cd6e18e91cdfbecdae1241d05b79276
|
7
|
+
data.tar.gz: 2f5e5dd5d949c50c8b5279efdbbc43aef2845d9be4575b2b730b437eac86e121d677a990db878940373440207b2dfeed8a9724c66366d8c353dcff2768cc5e98
|
data/lib/switchman/arel.rb
CHANGED
@@ -11,22 +11,44 @@ module Switchman
|
|
11
11
|
module Visitors
|
12
12
|
module ToSql
|
13
13
|
# rubocop:disable Naming/MethodName
|
14
|
+
# rubocop:disable Naming/MethodParameterName
|
14
15
|
|
15
|
-
def visit_Arel_Nodes_TableAlias(
|
16
|
-
o, collector = args
|
16
|
+
def visit_Arel_Nodes_TableAlias(o, collector)
|
17
17
|
collector = visit o.relation, collector
|
18
18
|
collector << ' '
|
19
19
|
collector << quote_local_table_name(o.name)
|
20
20
|
end
|
21
21
|
|
22
|
-
def visit_Arel_Attributes_Attribute(
|
23
|
-
o = args.first
|
22
|
+
def visit_Arel_Attributes_Attribute(o, collector)
|
24
23
|
join_name = o.relation.table_alias || o.relation.name
|
25
|
-
|
26
|
-
|
24
|
+
collector << quote_local_table_name(join_name) << '.' << quote_column_name(o.name)
|
25
|
+
end
|
26
|
+
|
27
|
+
def visit_Arel_Nodes_HomogeneousIn(o, collector)
|
28
|
+
collector.preparable = false
|
29
|
+
|
30
|
+
collector << quote_local_table_name(o.table_name) << '.' << quote_column_name(o.column_name)
|
31
|
+
|
32
|
+
collector << if o.type == :in
|
33
|
+
' IN ('
|
34
|
+
else
|
35
|
+
' NOT IN ('
|
36
|
+
end
|
37
|
+
|
38
|
+
values = o.casted_values
|
39
|
+
|
40
|
+
if values.empty?
|
41
|
+
collector << @connection.quote(nil)
|
42
|
+
else
|
43
|
+
collector.add_binds(values, o.proc_for_binds, &bind_block)
|
44
|
+
end
|
45
|
+
|
46
|
+
collector << ')'
|
47
|
+
collector
|
27
48
|
end
|
28
49
|
|
29
50
|
# rubocop:enable Naming/MethodName
|
51
|
+
# rubocop:enable Naming/MethodParameterName
|
30
52
|
|
31
53
|
def quote_local_table_name(name)
|
32
54
|
return name if ::Arel::Nodes::SqlLiteral === name
|
data/lib/switchman/rails.rb
CHANGED
data/lib/switchman/version.rb
CHANGED