Browse Source

refactor: convert decimal value in mysql to float

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/6470/head
Pranav C 12 months ago
parent
commit
ff8fc5ec9c
  1. 8
      packages/nocodb/src/utils/common/NcConnectionMgrv2.ts

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

@ -66,13 +66,19 @@ export default class NcConnectionMgrv2 {
connection: {
...defaultConnectionConfig,
...connectionConfig.connection,
typeCast(_field, next) {
typeCast(field, next) {
const res = next();
if (res instanceof Buffer) {
return [...res]
.map((v) => ('00' + v.toString(16)).slice(-2))
.join('');
}
// mysql `decimal` datatype returns value as string, convert it to float number
if (field.type == 'NEWDECIMAL') {
return res && parseFloat(res);
}
return res;
},
},

Loading…
Cancel
Save