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