Browse Source

refactor: convert bit value in mysql to int

At the moment bit is converted as hex string and change it to number

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/6470/head
Pranav C 1 year ago
parent
commit
23c78af54b
  1. 11
      packages/nocodb/src/utils/common/NcConnectionMgrv2.ts

11
packages/nocodb/src/utils/common/NcConnectionMgrv2.ts

@ -68,10 +68,13 @@ export default class NcConnectionMgrv2 {
...connectionConfig.connection,
typeCast(field, next) {
const res = next();
if (res instanceof Buffer) {
return [...res]
.map((v) => ('00' + v.toString(16)).slice(-2))
.join('');
// 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 `decimal` datatype returns value as string, convert it to float number

Loading…
Cancel
Save