@@ -92,13 +92,13 @@ class BaseBuffer {
9292 return 0 ;
9393 } else if ( size & 0x80 ) {
9494 if ( ! signed ) {
95- errors . throwErr ( errors . ERR_UNEXPECTED_NEGATIVE_INTEGER ) ;
95+ errors . throwErr ( errors . ERR_UNEXPECTED_NEGATIVE_INTEGER , this . pos , this . packetNum ) ;
9696 }
9797 isNegative = true ;
9898 size = size & 0x7f ;
9999 }
100100 if ( size > maxSize ) {
101- errors . throwErr ( errors . ERR_INTEGER_TOO_LARGE , size , maxSize ) ;
101+ errors . throwErr ( errors . ERR_INTEGER_TOO_LARGE , size , maxSize , this . pos , this . packetNum ) ;
102102 }
103103 if ( skip ) {
104104 this . skipBytes ( size ) ;
@@ -375,18 +375,18 @@ class BaseBuffer {
375375 const obj = { } ;
376376 let numBytes = this . readUB4 ( ) ;
377377 if ( numBytes > 0 )
378- obj . toid = this . readBytesWithLength ( ) ;
378+ obj . toid = Buffer . from ( this . readBytesWithLength ( ) ) ;
379379 numBytes = this . readUB4 ( ) ;
380380 if ( numBytes > 0 )
381- obj . oid = this . readBytesWithLength ( ) ;
381+ obj . oid = Buffer . from ( this . readBytesWithLength ( ) ) ;
382382 numBytes = this . readUB4 ( ) ;
383383 if ( numBytes > 0 )
384- obj . snapshot = this . readBytesWithLength ( ) ;
384+ obj . snapshot = Buffer . from ( this . readBytesWithLength ( ) ) ;
385385 this . skipUB2 ( ) ; // version
386386 numBytes = this . readUB4 ( ) ;
387387 this . skipUB2 ( ) ; // flags
388388 if ( numBytes > 0 )
389- obj . packedData = this . readBytesWithLength ( ) ;
389+ obj . packedData = Buffer . from ( this . readBytesWithLength ( ) ) ;
390390 return obj ;
391391 }
392392
@@ -465,7 +465,7 @@ class BaseBuffer {
465465 if ( ! buf ) {
466466 return null ;
467467 }
468- if ( csfrm === constants . TNS_CS_IMPLICIT )
468+ if ( csfrm === constants . CSFRM_IMPLICIT )
469469 return buf . toString ( ) ;
470470
471471 // need a copy of the buffer since swap16() changes the buffer in place and
@@ -748,7 +748,7 @@ class BaseBuffer {
748748 const ptr = this . reserveBytes ( length ) ;
749749 if ( type === types . DB_TYPE_DATE || type == types . DB_TYPE_TIMESTAMP ) {
750750 const year = date . getFullYear ( ) ;
751- ptr [ 0 ] = Math . floor ( year / 100 ) + 100 ;
751+ ptr [ 0 ] = Math . trunc ( year / 100 ) + 100 ;
752752 ptr [ 1 ] = year % 100 + 100 ;
753753 ptr [ 2 ] = date . getMonth ( ) + 1 ;
754754 ptr [ 3 ] = date . getDate ( ) ;
@@ -757,7 +757,7 @@ class BaseBuffer {
757757 ptr [ 6 ] = date . getSeconds ( ) + 1 ;
758758 } else {
759759 const year = date . getUTCFullYear ( ) ;
760- ptr [ 0 ] = Math . floor ( year / 100 ) + 100 ;
760+ ptr [ 0 ] = Math . trunc ( year / 100 ) + 100 ;
761761 ptr [ 1 ] = year % 100 + 100 ;
762762 ptr [ 2 ] = date . getUTCMonth ( ) + 1 ;
763763 ptr [ 3 ] = date . getUTCDate ( ) ;
0 commit comments