Permalink
Browse files

fix bigint negative numbers and test for them also

Signed-off-by: Zach Aller <zachaller@hotmail.com>
  • Loading branch information...
1 parent 101bb0a commit da3f8532a4e62663a2c96da84f5a72c7ffe7ae64 @zachaller committed Sep 5, 2012
Showing with 4 additions and 6 deletions.
  1. +3 −5 src/data-type.coffee
  2. +1 −1 test/integration/parameterised-statements-test.coffee
View
@@ -177,12 +177,10 @@ TYPE =
buffer.writeUInt8(8)
# ParamLenData
- if parameter.value?
+ if parameter.value
buffer.writeUInt8(8)
- buffer.writeUInt32LE(parseInt(parameter.value) % 0x100000000)
- buffer.writeUInt32LE(Math.floor(parseInt(parameter.value) / 0x100000000))
- # might need to sign the high value not sure
- # buffer.writeInt32LE(Math.floor(parseInt(parameter.value) / 0x100000000))
+ buffer.writeInt32LE(parseInt(parameter.value) % 0x100000000)
+ buffer.writeInt32LE(Math.floor(parseInt(parameter.value) / 0x100000000))
else
buffer.writeUInt8(0)
@@ -50,7 +50,7 @@ exports.bigint = (test) ->
execSql(test, TYPES.BigInt, 18014402804449279)
exports.bigintsmall = (test) ->
- execSql(test, TYPES.BigInt, 8)
+ execSql(test, TYPES.BigInt, -8)
exports.float = (test) ->
execSql(test, TYPES.Float, 9654.2546456567565767644)

0 comments on commit da3f853

Please sign in to comment.