Skip to content

Commit

Permalink
Simplify tests for when to send tinyint, smallint and int parameters …
Browse files Browse the repository at this point in the history
…as null or as a value.

Fixes #15
  • Loading branch information
pekim committed Apr 24, 2012
1 parent 61945ba commit cd012d4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/data-type.coffee
Expand Up @@ -18,11 +18,11 @@ TYPE =
buffer.writeUInt8(1)

# ParamLenData
if typeof parameter.value == 'undefined' || parameter == null
buffer.writeUInt8(0)
else
if parameter.value?
buffer.writeUInt8(1)
buffer.writeInt8(parameter.value)
else
buffer.writeUInt8(0)
0x32:
type: 'BIT'
name: 'Bit'
Expand All @@ -37,11 +37,11 @@ TYPE =
buffer.writeUInt8(2)

# ParamLenData
if typeof parameter.value == 'undefined' || parameter == null
buffer.writeUInt8(0)
else
if parameter.value?
buffer.writeUInt8(2)
buffer.writeInt16LE(parameter.value)
else
buffer.writeUInt8(0)
0x38:
type: 'INT4'
name: 'Int'
Expand All @@ -53,11 +53,11 @@ TYPE =
buffer.writeUInt8(4)

# ParamLenData
if typeof parameter.value == 'undefined' || parameter == null
buffer.writeUInt8(0)
else
if parameter.value?
buffer.writeUInt8(4)
buffer.writeInt32LE(parameter.value)
else
buffer.writeUInt8(0)
0x3A:
type: 'DATETIM4'
name: 'SmallDateTime'
Expand Down

0 comments on commit cd012d4

Please sign in to comment.