@@ -51,18 +51,18 @@ module.exports = BaseTypes => {
5151 // sending it over the wire as a string,
5252 // We pass it through escape function to remove un-necessary quotes
5353 // this.format in insert/bulkinsert query calls stringify hence we need to convert binary buffer
54- // to hex string. Since this block is used by both bind (insert/bulkinsert) and
55- // non-bind (select query where clause) hence we need to
54+ // to hex string. Since this block is used by both bind (insert/bulkinsert) and
55+ // non-bind (select query where clause) hence we need to
5656 // have an operation that supports both
5757 return options . escape ( value . toString ( 'hex' ) ) ;
58- }
58+ }
5959 return options . escape ( value ) ;
6060 }
6161
6262 _getBindDef ( oracledb ) {
6363 if ( this . _binary ) {
6464 return { type : oracledb . DB_TYPE_RAW , maxSize : this . _length } ;
65- }
65+ }
6666 return { type : oracledb . DB_TYPE_VARCHAR , maxSize : this . _length } ;
6767 }
6868
@@ -93,7 +93,7 @@ module.exports = BaseTypes => {
9393
9494 _sanitize ( value ) {
9595 if ( typeof value === 'string' ) {
96- // If value is a string we return true if among '1' and 'true'
96+ // If value is a string we return true if among '1' and 'true'
9797 // We return false if among '0' and 'false'
9898 // Else return the value as is and let the DB raise error for invalid values
9999 return value === '1' || value === 'true' ? true : value === '0' || value === 'false' ? false : value ;
@@ -212,7 +212,7 @@ module.exports = BaseTypes => {
212212 */
213213 _bindParam ( value , options ) {
214214 return options . bindParam ( value ) ;
215- }
215+ }
216216 }
217217
218218 DATE . prototype . escape = false ;
@@ -302,6 +302,14 @@ module.exports = BaseTypes => {
302302 _getBindDef ( oracledb ) {
303303 return { type : oracledb . DB_TYPE_NUMBER } ;
304304 }
305+
306+ _sanitize ( value ) {
307+ if ( typeof value === 'bigint' || typeof value === 'number' ) {
308+ return value . toString ( ) ;
309+ }
310+ return value ;
311+ }
312+
305313 }
306314
307315 class NUMBER extends BaseTypes . NUMBER {
@@ -335,7 +343,7 @@ module.exports = BaseTypes => {
335343 _stringify ( value ) {
336344 if ( value === Number . POSITIVE_INFINITY ) {
337345 return 'inf' ;
338- }
346+ }
339347 if ( value === Number . NEGATIVE_INFINITY ) {
340348 return '-inf' ;
341349 }
@@ -348,11 +356,11 @@ module.exports = BaseTypes => {
348356 }
349357
350358 class BLOB extends BaseTypes . BLOB {
351- // Generic hexify returns X'${hex}' but Oracle expects '${hex}' for BLOB datatype
359+ // Generic hexify returns X'${hex}' but Oracle expects '${hex}' for BLOB datatype
352360 _hexify ( hex ) {
353361 return `'${ hex } '` ;
354362 }
355-
363+
356364 toSql ( ) {
357365 return 'BLOB' ;
358366 }
@@ -438,9 +446,9 @@ module.exports = BaseTypes => {
438446 _bindParam ( value , options ) {
439447 if ( typeof value === 'string' ) {
440448 return options . bindParam ( new Date ( value ) ) ;
441- }
449+ }
442450 return options . bindParam ( value ) ;
443-
451+
444452 }
445453 }
446454
0 commit comments