Skip to content
Browse files

Fix PLP nulls

  • Loading branch information...
1 parent 5e51de9 commit 342315eb4ada014bfd3748b454cf2fabb1a12c26 @patriksimek patriksimek committed Mar 31, 2014
Showing with 18 additions and 3 deletions.
  1. +18 −3 src/data-type.coffee
View
21 src/data-type.coffee
@@ -351,7 +351,12 @@ TYPE =
# PLP_TERMINATOR (no more chunks).
buffer.writeUInt32LE 0
else
- buffer.writeUInt16LE NULL
+ if parameter.length <= @maximumLength
+ buffer.writeUInt16LE NULL
+ else
+ # PLP_NULL
+ buffer.writeUInt32LE(0xFFFFFFFF)
+ buffer.writeUInt32LE(0xFFFFFFFF)
0xA7:
type: 'BIGVARCHR'
@@ -410,7 +415,12 @@ TYPE =
# PLP_TERMINATOR (no more chunks).
buffer.writeUInt32LE(0)
else
- buffer.writeUInt16LE(NULL)
+ if parameter.length <= @maximumLength
+ buffer.writeUInt16LE(NULL)
+ else
+ # PLP_NULL
+ buffer.writeUInt32LE(0xFFFFFFFF)
+ buffer.writeUInt32LE(0xFFFFFFFF)
0xAD:
type: 'BIGBinary'
name: 'Binary'
@@ -497,7 +507,12 @@ TYPE =
# PLP_TERMINATOR (no more chunks).
buffer.writeUInt32LE(0)
else
- buffer.writeUInt16LE(NULL)
+ if parameter.length <= @maximumLength
+ buffer.writeUInt16LE(NULL)
+ else
+ # PLP_NULL
+ buffer.writeUInt32LE(0xFFFFFFFF)
+ buffer.writeUInt32LE(0xFFFFFFFF)
0xEF:
type: 'NCHAR'
name: 'NChar'

0 comments on commit 342315e

Please sign in to comment.
Something went wrong with that request. Please try again.