cql-rb 2.0.1 → 2.0.2

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
  SHA1:
3
- metadata.gz: e3f3bbe6a70ee126fc4ebcf7a33fcd19812bbc69
4
- data.tar.gz: 28c7bf1d6d92bd3ac5fb8e38155a7ea6ee06eef5
3
+ metadata.gz: de475cb52182f982ae799799efa2666839c515eb
4
+ data.tar.gz: 6d736d939d31b342a732c7e47708b39329cce374
5
5
  SHA512:
6
- metadata.gz: fd921b73960d9bd46289cfe98d3a18239b09df793b1eed9cf87f7d7e211e0d71716aed118ef1a536149722f0939d8466a24aed27b063e8819325e4286262b300
7
- data.tar.gz: 95de3b5aaf74d6c7a072ebe054fd4cd73b92b16a6ecb1d02e629d73b675df04e00d8fec3cd8c646ab47c060a08bd4962c6f4df2c4edae0f5efc1909f07050148
6
+ metadata.gz: 087c4fb13f332dd30744a2b7e11a180a23043383b637221895723a9e5cbc9ccf12e56d7fbe30ec95f09d54ce5092338670b46bf1130b815c864b672c13f6b37b
7
+ data.tar.gz: 066cb8bb0af5e671443acc12b68b0c6975fcd22da11ec4236299f19ea34d41558bae878f64ebddcb7b1801075df3cfa0b1815de15a728614ed11d3b3313ec49a
data/README.md CHANGED
@@ -364,6 +364,8 @@ after_fork do |server, worker|
364
364
  end
365
365
  ```
366
366
 
367
+ Since prepared statements are tied to a particular connection, you'll need to recreate those after forking as well.
368
+
367
369
  If your process does not fork and you still encounter deadlock errors, it might also be a bug. All IO is done is a dedicated thread, and if something happens that makes that thread shut down, Ruby will detect that the locks that the client code is waiting on can't be unlocked.
368
370
 
369
371
  ## I get "Bad file descriptor"
@@ -264,9 +264,12 @@ module Cql
264
264
  end
265
265
 
266
266
  def append_decimal(n)
267
- sign, number_string, _, size = n.split
267
+ str = n.to_s(FLOAT_STRING_FORMAT)
268
+ size = str.index(DECIMAL_POINT)
269
+ number_string = str.gsub(DECIMAL_POINT, NO_CHAR)
270
+
268
271
  num = number_string.to_i
269
- raw = self.class.new.append_varint(sign * num)
272
+ raw = self.class.new.append_varint(num)
270
273
  append_int(number_string.length - size)
271
274
  append(raw)
272
275
  end
@@ -284,6 +287,8 @@ module Cql
284
287
  MINUS = '-'.freeze
285
288
  ZERO = '0'.freeze
286
289
  DECIMAL_POINT = '.'.freeze
290
+ FLOAT_STRING_FORMAT = 'F'.freeze
291
+ NO_CHAR = ''.freeze
287
292
  end
288
293
  end
289
294
  end
data/lib/cql/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Cql
4
- VERSION = '2.0.1'.freeze
4
+ VERSION = '2.0.2'.freeze
5
5
  end
@@ -853,6 +853,16 @@ module Cql
853
853
  buffer.should eql_bytes("\x00\x00\x00\x01\x00")
854
854
  end
855
855
 
856
+ it 'encodes a BigDecimal ending in .0' do
857
+ buffer.append_decimal(BigDecimal.new('1042342234234.0'))
858
+ buffer.should eql_bytes("\x00\x00\x00\x01\tz\xE4b\xD4\xC4")
859
+ end
860
+
861
+ it 'encodes a BigDecimal ending with 00.0' do
862
+ buffer.append_decimal(BigDecimal.new('12000.0'))
863
+ buffer.should eql_bytes("\x00\x00\x00\x01\x01\xD4\xC0")
864
+ end
865
+
856
866
  it 'appends to the buffer' do
857
867
  buffer << "\x99"
858
868
  buffer.append_decimal(BigDecimal.new('1042342234234.123423435647768234'))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cql-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Theo Hultberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-26 00:00:00.000000000 Z
11
+ date: 2014-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ione