io.odysz.transact.sql.parts.select.GroupbyList Maven / Gradle / Ivy
package io.odysz.transact.sql.parts.select;
import java.util.ArrayList;
import java.util.stream.Collectors;
import io.odysz.semantics.ISemantext;
import io.odysz.transact.sql.parts.AbsPart;
/**Order by list. A short cut for:
https://github.com/antlr/grammars-v4/blob/master/tsql/TSqlParser.g4
// https://msdn.microsoft.com/en-us/library/ms176104.aspx
query_specification
: SELECT (ALL | DISTINCT)? top_clause?
select_list
// https://msdn.microsoft.com/en-us/library/ms188029.aspx
(INTO table_name)?
(FROM table_sources)?
(WHERE where=search_condition)?
// https://msdn.microsoft.com/en-us/library/ms177673.aspx
(GROUP BY (ALL)? group_by_item (',' group_by_item)*)?
(HAVING having=search_condition)?
;
group_by_item
: expression
;
* @author ody
*/
public class GroupbyList extends AbsPart {
private ArrayList groups;
public GroupbyList(ArrayList groupBys) {
groups = groupBys;
}
@Override
public String sql(ISemantext sctx) {
return groups.stream().collect(Collectors.joining(", ", "group by ", ""));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy