fix: formula division for mysql
@ -136,6 +136,11 @@ export default function formulaQueryBuilder(
type: 'CallExpression',
arguments: [pt.left],
};
pt.right = {
callee: { name: 'FLOAT' },
arguments: [pt.right],
}
const query = knex.raw(
@ -646,6 +646,11 @@ export default async function formulaQueryBuilderv2(
pt.left.fnName = pt.left.fnName || 'ARITH';
pt.right.fnName = pt.right.fnName || 'ARITH';
@ -36,7 +36,7 @@ const mysql2 = {
MID: 'SUBSTR',
FLOAT: (args: MapFnArgs) => {
return args.knex
.raw(`CAST(${args.fn(args.pt.arguments[0])} as DOUBLE)${args.colAlias}`)
.raw(`CAST(CAST(${args.fn(args.pt.arguments[0])} as CHAR) AS DOUBLE)${args.colAlias}`)
.wrap('(', ')');
},
DATEADD: ({ fn, knex, pt, colAlias }: MapFnArgs) => {