import {parseTableAggregationSelection} from '../../parsing/selection/table_aggregation_selection_parsing' import {Runnable} from '../../databases/database_context' import {SelectStatement} from '../../statements/select_statement' import {GroupSelectStatement} from '../../statements/group_select_statement' export class SelectGuaranteedSingleRow implements Runnable { constructor(public statement: SelectStatement|GroupSelectStatement) {} readonly clientInstruction = 'guarantee-single-row' } export function aggregateTables(statement: SelectStatement, aggregation: Function): SelectGuaranteedSingleRow { return new SelectGuaranteedSingleRow({ ...statement, selection: parseTableAggregationSelection(aggregation, statement.joins.length+1) }) }