sqb 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sqb/filtering.rb +7 -2
- data/lib/sqb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 683f48c7299759f9bc62ba332ecd9ec8276c554172dc4ce367892d1f38b513f1
|
4
|
+
data.tar.gz: 7a12b4b148c5a1fbedc8d7a2dd3d50b1d17e3bbd0e3bc154a3ea927a46422de1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74a20d5314daa6d58f00d197d127e238ee9ccacbc2c4303619e624d4235e2a66672cf943b098f6333340e076ab89681b973051008118777daa116a7247461af4
|
7
|
+
data.tar.gz: 4e761fe217c3511a5dc9ea9aa41430b10a1dc6872f712f15b3b30fd33df586431077734f8f90337ea901f54043b1d8b4c481d72e0dbc30f7bda02ce16d822344
|
data/lib/sqb/filtering.rb
CHANGED
@@ -85,8 +85,13 @@ module SQB
|
|
85
85
|
sql << "#{key} >= #{value_escape(value)}"
|
86
86
|
when :in, :not_in
|
87
87
|
escaped_values = value.map { |v| value_escape(v) }.join(', ')
|
88
|
-
|
89
|
-
|
88
|
+
if escaped_values.empty?
|
89
|
+
# If there are no values to search from, don't find anything
|
90
|
+
"1=0"
|
91
|
+
else
|
92
|
+
op = operator == :in ? "IN" : "NOT IN"
|
93
|
+
sql << "#{key} #{op} (#{escaped_values})"
|
94
|
+
end
|
90
95
|
when :like
|
91
96
|
sql << "#{key} LIKE #{value_escape(value)}"
|
92
97
|
when :not_like
|
data/lib/sqb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sqb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Cooke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A friendly SQL builder for MySQL.
|
14
14
|
email:
|