|
|
@ -69,12 +69,16 @@ export default class NcConnectionMgrv2 { |
|
|
|
typeCast(field, next) { |
|
|
|
typeCast(field, next) { |
|
|
|
const res = next(); |
|
|
|
const res = next(); |
|
|
|
|
|
|
|
|
|
|
|
// mysql `bit` datatype returns value as Buffer, convert it to integer number
|
|
|
|
// mysql - convert all other buffer values to hex string
|
|
|
|
if (field.type == 'BIT' && res && res instanceof Buffer) { |
|
|
|
// if `bit` datatype then convert it to integer number
|
|
|
|
return parseInt( |
|
|
|
if (res && res instanceof Buffer) { |
|
|
|
[...res].map((v) => ('00' + v.toString(16)).slice(-2)).join(''), |
|
|
|
const hex = [...res] |
|
|
|
16, |
|
|
|
.map((v) => ('00' + v.toString(16)).slice(-2)) |
|
|
|
); |
|
|
|
.join(''); |
|
|
|
|
|
|
|
if (field.type == 'BIT') { |
|
|
|
|
|
|
|
return parseInt(hex, 16); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return hex; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// mysql `decimal` datatype returns value as string, convert it to float number
|
|
|
|
// mysql `decimal` datatype returns value as string, convert it to float number
|
|
|
|