cassandra-cql 1.1.1 → 1.1.2

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.
@@ -102,10 +102,12 @@ module CassandraCQL
102
102
  end
103
103
 
104
104
  def self.sanitize(statement, bind_vars=[])
105
+ # If there are no bind variables, return the statement unaltered
106
+ return statement if bind_vars.empty?
107
+
105
108
  bind_vars = bind_vars.dup
106
109
  expected_bind_vars = statement.count("?")
107
110
 
108
- return statement if expected_bind_vars == 0 and bind_vars.empty?
109
111
  raise Error::InvalidBindVariable, "Wrong number of bound variables (statement expected #{expected_bind_vars}, was #{bind_vars.size})" if expected_bind_vars != bind_vars.size
110
112
 
111
113
  statement.gsub(/\?/) {
@@ -15,5 +15,5 @@ limitations under the License.
15
15
  =end
16
16
 
17
17
  module CassandraCQL
18
- VERSION = "1.1.1"
18
+ VERSION = "1.1.2"
19
19
  end
@@ -183,10 +183,6 @@ describe "sanitize" do
183
183
 
184
184
  context "when expecting bind vars" do
185
185
  it "should raise an exception with bind variable mismatch" do
186
- expect {
187
- Statement.sanitize("use keyspace ?")
188
- }.to raise_error(Error::InvalidBindVariable)
189
-
190
186
  expect {
191
187
  Statement.sanitize("use keyspace ?", ['too', 'many'])
192
188
  }.to raise_error(Error::InvalidBindVariable)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cassandra-cql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-25 00:00:00.000000000 Z
12
+ date: 2012-10-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -211,7 +211,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
211
211
  version: '0'
212
212
  segments:
213
213
  - 0
214
- hash: 161187349336626850
214
+ hash: -3942152054633015494
215
215
  required_rubygems_version: !ruby/object:Gem::Requirement
216
216
  none: false
217
217
  requirements: