Browse Source

feat(api): oracledb - formula weekday function support

feat/oracle-support
Pranav C 2 years ago committed by Pranav C
parent
commit
fb50783b94
  1. 26
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/oracle.ts

26
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/oracle.ts

@ -1,5 +1,7 @@
import commonFns from './commonFns'; import commonFns from './commonFns';
import { MapFnArgs } from '../mapFunctionName'; import { MapFnArgs } from '../mapFunctionName';
import dayjs from 'dayjs';
import { getWeekdayByText } from '../helpers/formulaFnHelper';
const pg = { const pg = {
...commonFns, ...commonFns,
@ -63,19 +65,17 @@ const pg = {
END${colAlias}` END${colAlias}`
); );
}, },
// WEEKDAY: ({ fn, knex, pt, colAlias }: MapFnArgs) => { WEEKDAY: ({ fn, knex, pt, colAlias }: MapFnArgs) => {
// // isodow: the day of the week as Monday (1) to Sunday (7) return knex.raw(
// // WEEKDAY() returns an index from 0 to 6 for Monday to Sunday `MOD(to_char(${
// return knex.raw( pt.arguments[0].type === 'Literal'
// `(EXTRACT(ISODOW FROM ${ ? `date '${dayjs(fn(pt.arguments[0])).format('YYYY-MM-DD')}'`
// pt.arguments[0].type === 'Literal' : fn(pt.arguments[0])
// ? `date '${dayjs(fn(pt.arguments[0])).format('YYYY-MM-DD')}'` },'D') - 2 - ${getWeekdayByText(
// : fn(pt.arguments[0]) pt?.arguments[1]?.value
// }) - 1 - ${getWeekdayByText( )} + 7, 7) ${colAlias}`
// pt?.arguments[1]?.value );
// )} % 7 + 7) ::INTEGER % 7 ${colAlias}` },
// );
// },
}; };
export default pg; export default pg;

Loading…
Cancel
Save