Signed-off-by: Pranav C <pranavxc@gmail.com>
@ -87,7 +87,9 @@ export default {
'SEARCH',
'INT',
'RIGHT',
'LEFT'
'LEFT',
'SUBSTR',
'MID'
],
availableBinOps: ['+', '-', '*', '/'],
autocomplete: false,
@ -49,6 +49,7 @@ const mssql = {
INT: (args: MapFnArgs) => {
return args.knex.raw(`CASE WHEN ISNUMERIC(${args.fn(args.pt.arguments[0]).toQuery()}) = 1 THEN FLOOR(${args.fn(args.pt.arguments[0]).toQuery()}) ELSE 0 END${args.colAlias}`)
},
MID:'SUBSTR'
}
export default mssql;
@ -19,7 +19,8 @@ const mysql2 = {
RIGHT:(args: MapFnArgs)=> {
return args.knex.raw(`SUBSTR(${args.fn(args.pt.arguments[0])},-${args.fn(args.pt.arguments[1])})${args.colAlias}`)
@ -15,6 +15,7 @@ const pg = {
// todo: correction
return args.knex.raw(`REGEXP_REPLACE(COALESCE(${args.fn(args.pt.arguments[0])}::character varying, '0'), '[^0-9]+|\\.[0-9]+' ,'')${args.colAlias}`)
MID: 'SUBSTR'
@ -31,7 +31,8 @@ const sqlite3 = {