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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86bb79014e513987ddd1093cb0fa906e911048624dfbd13a590dc02e287957e7
4
- data.tar.gz: f07f4b6efa8d19f792e00ccd5194304fc70f0434fb93c8609940757c8fec42d5
3
+ metadata.gz: 683f48c7299759f9bc62ba332ecd9ec8276c554172dc4ce367892d1f38b513f1
4
+ data.tar.gz: 7a12b4b148c5a1fbedc8d7a2dd3d50b1d17e3bbd0e3bc154a3ea927a46422de1
5
5
  SHA512:
6
- metadata.gz: 6e9ac660c7c36c57fe536b63560d63a0da407cead1164e367dfadf363db7e39b27820186701a1cbd3cd11a6f978d920d57b952fe3f970ce99a45060d83d9ffd9
7
- data.tar.gz: d606e7bce05701fb3b1e14f6e8ef591546403a4697579228d4505afec554cf9ab7c114ecd706d71fd31ccdf6d2a8ab3422d193ec8a118ce45622eee66140fdd3
6
+ metadata.gz: 74a20d5314daa6d58f00d197d127e238ee9ccacbc2c4303619e624d4235e2a66672cf943b098f6333340e076ab89681b973051008118777daa116a7247461af4
7
+ data.tar.gz: 4e761fe217c3511a5dc9ea9aa41430b10a1dc6872f712f15b3b30fd33df586431077734f8f90337ea901f54043b1d8b4c481d72e0dbc30f7bda02ce16d822344
@@ -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
- op = operator == :in ? "IN" : "NOT IN"
89
- sql << "#{key} #{op} (#{escaped_values})"
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
@@ -1,3 +1,3 @@
1
1
  module SQB
2
- VERSION = '1.0.4'
2
+ VERSION = '1.0.5'
3
3
  end
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
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-02-28 00:00:00.000000000 Z
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: