Skip to content

Commit

Permalink
fix bigint negative numbers and test for them also
Browse files Browse the repository at this point in the history
Signed-off-by: Zach Aller <zachaller@hotmail.com>
  • Loading branch information
zachaller committed Sep 5, 2012
1 parent 101bb0a commit da3f853
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/data-type.coffee
Expand Up @@ -177,12 +177,10 @@ TYPE =
buffer.writeUInt8(8) buffer.writeUInt8(8)


# ParamLenData # ParamLenData
if parameter.value? if parameter.value
buffer.writeUInt8(8) buffer.writeUInt8(8)
buffer.writeUInt32LE(parseInt(parameter.value) % 0x100000000) buffer.writeInt32LE(parseInt(parameter.value) % 0x100000000)
buffer.writeUInt32LE(Math.floor(parseInt(parameter.value) / 0x100000000)) buffer.writeInt32LE(Math.floor(parseInt(parameter.value) / 0x100000000))
# might need to sign the high value not sure
# buffer.writeInt32LE(Math.floor(parseInt(parameter.value) / 0x100000000))
else else
buffer.writeUInt8(0) buffer.writeUInt8(0)


Expand Down
2 changes: 1 addition & 1 deletion test/integration/parameterised-statements-test.coffee
Expand Up @@ -50,7 +50,7 @@ exports.bigint = (test) ->
execSql(test, TYPES.BigInt, 18014402804449279) execSql(test, TYPES.BigInt, 18014402804449279)


exports.bigintsmall = (test) -> exports.bigintsmall = (test) ->
execSql(test, TYPES.BigInt, 8) execSql(test, TYPES.BigInt, -8)


exports.float = (test) -> exports.float = (test) ->
execSql(test, TYPES.Float, 9654.2546456567565767644) execSql(test, TYPES.Float, 9654.2546456567565767644)
Expand Down

0 comments on commit da3f853

Please sign in to comment.