sqlstmt 0.1.18 → 0.1.19
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/sqlstmt/query.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 171563e5033c5838b9c8a2055d841b0ab97a7b59
|
4
|
+
data.tar.gz: 6aab01e8dc7fd4ace0d64d4f5514036cc605ba9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0adcff0c4693dc8c2cbebfe74b3e88a47db21c943dce993e970bb6792cb74f1ba200133f955812872b673085f2ead5e886f9db1bb7413efaa09e8d47f618faba
|
7
|
+
data.tar.gz: 13c6f5d0b69919ff840cebf92aaf35c0603c7a59ad8430a0cdd81485416986d2a70f6c98c74e83cf8971fbf2b940dc93215ced7a81e1341c7a2ca8619f18ba7b
|
data/lib/sqlstmt/query.rb
CHANGED
@@ -26,7 +26,7 @@ class Query
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def optional_join(table, expr)
|
29
|
-
unless
|
29
|
+
unless includes_table?(table)
|
30
30
|
join(table, expr)
|
31
31
|
end
|
32
32
|
end
|
@@ -66,14 +66,14 @@ class Query
|
|
66
66
|
build_stmt
|
67
67
|
end
|
68
68
|
|
69
|
-
|
70
|
-
def has_join_or_table?(table_to_find)
|
69
|
+
def includes_table?(table_to_find)
|
71
70
|
return true if @tables.include?(table_to_find)
|
72
71
|
@joins.find do |_, table, _|
|
73
72
|
table_to_find == table
|
74
73
|
end
|
75
74
|
end
|
76
75
|
|
76
|
+
private
|
77
77
|
def verify_minimum_requirements
|
78
78
|
if (@where_behavior == :require) && @wheres.empty?
|
79
79
|
raise SqlStmt::Error, "unable to build sql - must call :where, :no_where, or :optional_where"
|