filter lookups improvements

This commit is contained in:
Jan Prochazka 2021-11-20 11:50:59 +01:00
parent 6f7452ab6d
commit f010e7c934
4 changed files with 8 additions and 5 deletions

View File

@ -6,6 +6,8 @@ export type FilterMultipleValuesMode = 'is' | 'is_not' | 'contains' | 'begins' |
export function getFilterValueExpression(value, dataType) {
if (value == null) return 'NULL';
if (isTypeDateTime(dataType)) return moment(value).format('YYYY-MM-DD HH:mm:ss');
if (value === true) return 'TRUE';
if (value === false) return 'FALSE';
return `="${value}"`;
}

View File

@ -6,12 +6,12 @@ import { dumpSqlCondition } from './dumpSqlCondition';
export function dumpSqlSelect(dmp: SqlDumper, cmd: Select) {
dmp.put('^select ');
if (cmd.topRecords) {
if (!dmp.dialect.rangeSelect || dmp.dialect.offsetFetchRangeSyntax) dmp.put('^top %s ', cmd.topRecords);
}
if (cmd.distinct) {
dmp.put('^distinct ');
}
if (cmd.topRecords) {
if (!dmp.dialect.rangeSelect || dmp.dialect.offsetFetchRangeSyntax) dmp.put('^top %s ', cmd.topRecords);
}
if (cmd.selectAll) {
dmp.put('* ');
}

View File

@ -6,6 +6,7 @@
import splitterDrag from '../utility/splitterDrag';
import FilterMultipleValuesModal from '../modals/FilterMultipleValuesModal.svelte';
import { getFilterValueExpression } from 'dbgate-filterparser';
import { showModal } from '../modals/modalTools';
import SetFilterModal from '../modals/SetFilterModal.svelte';
@ -223,7 +224,7 @@
schemaName,
pureName,
columnName,
onConfirm: keys => setFilter(keys.map(x => `'${x}'`).join(',')),
onConfirm: keys => setFilter(keys.map(x => getFilterValueExpression(x)).join(',')),
});
}

View File

@ -151,7 +151,7 @@
{
fieldName: 'value',
header: 'Value',
formatter: row => row[columnName],
formatter: row => (row[columnName] == null ? '(NULL)' : row[columnName]),
},
]}
>