本文整理了Java中net.sf.jsqlparser.expression.Function
类的一些代码示例,展示了Function
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Function
类的具体详情如下:
包路径:net.sf.jsqlparser.expression.Function
类名称:Function
[英]A function as MAX,COUNT...
[中]一个函数作为MAX,COUNT。。。
代码示例来源:origin: geotools/geotools
public void visit(Function function) {
Function qfunction = new Function();
qfunction.setAllColumns(function.isAllColumns());
qfunction.setEscaped(function.isEscaped());
qfunction.setName(function.getName());
ExpressionList parameters = function.getParameters();
ExpressionList qualifiedParams;
qualifiedParams =
(ExpressionList) ItemsListQualifier.qualify(session, tableAliases, parameters);
qfunction.setParameters(qualifiedParams);
this._qualifiedExpression = qfunction;
}
代码示例来源:origin: JSQLParser/JSqlParser
@Override
public void visit(Function function) {
if (function.getParameters() != null) {
function.getParameters().accept(this);
}
if (function.getKeep() != null) {
function.getKeep().accept(this);
}
}
代码示例来源:origin: alibaba/mdrill
public void visit(Function function) {
if (function.isEscaped()) {
buffer.append("{fn ");
}
buffer.append(function.getName());
if (function.isAllColumns()) {
buffer.append("(*)");
} else if (function.getParameters() == null) {
buffer.append("()");
} else {
boolean oldUseBracketsInExprList = useBracketsInExprList;
if (function.isDistinct()) {
useBracketsInExprList = false;
buffer.append("(DISTINCT ");
}
visit(function.getParameters());
useBracketsInExprList = oldUseBracketsInExprList;
if (function.isDistinct()) {
buffer.append(")");
}
}
if (function.isEscaped()) {
buffer.append("}");
}
}
代码示例来源:origin: JSQLParser/JSqlParser
@Override
public void visit(Function function) {
if (function.isEscaped()) {
buffer.append("{fn ");
buffer.append(function.getName());
if (function.isAllColumns() && function.getParameters() == null) {
buffer.append("(*)");
} else if (function.getParameters() == null && function.getNamedParameters() == null) {
buffer.append("()");
} else {
boolean oldUseBracketsInExprList = useBracketsInExprList;
if (function.isDistinct()) {
useBracketsInExprList = false;
buffer.append("(DISTINCT ");
} else if (function.isAllColumns()) {
useBracketsInExprList = false;
buffer.append("(ALL ");
if(function.getNamedParameters() != null){
visit(function.getNamedParameters());
if(function.getParameters() != null){
visit(function.getParameters());
if (function.isDistinct() || function.isAllColumns()) {
buffer.append(")");
if (function.getAttribute() != null) {
buffer.append(".").append(function.getAttribute());
代码示例来源:origin: it.unibz.inf.ontop/ontop-obdalib-core
@Override
public void visit(Function function) {
// ROMAN (22 Sep 2015): longer list of supported functions?
if (function.getName().toLowerCase().equals("regexp_like")) {
for (Expression ex :function.getParameters().getExpressions())
ex.accept(this);
}
else
unsupported(function);
}
代码示例来源:origin: org.opencadc/cadc-adql
@Override
public void visit(Function function)
{
log.debug("visit(function)" + function);
String functionName = function.getName();
String newName = map.get(functionName);
if (newName != null)
function.setName(newName);
// DIST returns radians, we want degrees.
if (function.getName().equals("DIST"))
{
Function dist = new Function();
dist.setName("dist");
dist.setParameters(function.getParameters());
List<Expression> list = new ArrayList<Expression>();
list.add(dist);
ExpressionList parameters = new ExpressionList();
parameters.setExpressions(list);
function.setName("degrees");
function.setParameters(parameters);
}
}
代码示例来源:origin: baomidou/mybatis-plus
/**
* 获取jsqlparser中count的SelectItem
*/
private static List<SelectItem> countSelectItem() {
Function function = new Function();
function.setName("COUNT");
List<Expression> expressions = new ArrayList<>();
LongValue longValue = new LongValue(1);
ExpressionList expressionList = new ExpressionList();
expressions.add(longValue);
expressionList.setExpressions(expressions);
function.setParameters(expressionList);
List<SelectItem> selectItems = new ArrayList<>();
SelectExpressionItem selectExpressionItem = new SelectExpressionItem(function);
selectItems.add(selectExpressionItem);
return selectItems;
}
}
代码示例来源:origin: JSQLParser/JSqlParser
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));Function retval = new Function();
String funcName = null;
String tmp = null;
case 236:{
jj_consume_token(236);
retval.setEscaped(true);
break;
case K_DISTINCT:{
jj_consume_token(K_DISTINCT);
retval.setDistinct(true);
break;
retval.setAllColumns(true);
break;
case 201:{
jj_consume_token(201);
retval.setAllColumns(true);
break;
jj_consume_token(202);
tmp = RelObjectName();
retval.setAttribute(tmp);
break;
代码示例来源:origin: alibaba/mdrill
final public Function Function() throws ParseException {
Function retval = new Function();
String funcName = null;
String tmp = null;
case 102:
jj_consume_token(102);
retval.setEscaped(true);
break;
default:
case K_DISTINCT:
jj_consume_token(K_DISTINCT);
retval.setDistinct(true);
break;
case K_ALL:
jj_consume_token(K_ALL);
retval.setAllColumns(true);
break;
default:
case 82:
jj_consume_token(82);
retval.setAllColumns(true);
break;
default:
retval.setParameters(expressionList);
retval.setName(funcName);
{if (true) return retval;}
代码示例来源:origin: com.eas.platypus/platypus-js-sql-parser
public void visit(Function function) {
if (function.isEscaped()) {
buffer.append(function.getCommentBeginEscaped() != null ? function.getCommentBeginEscaped() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append("{fn ");
}
buffer.append(function.getCommentName() != null ? function.getCommentName() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append(function.getName());
if (function.isAllColumns()) {
buffer.append(function.getCommentBeginEscaped() != null ? function.getCommentBeginBracket() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append("(").append(function.getCommentBeginEscaped() != null ? function.getCommentAllColumns() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append("*").append(function.getCommentBeginEscaped() != null ? function.getCommentEndBracket() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append(")");
} else if (function.getParameters() == null) {
buffer.append(function.getCommentBeginEscaped() != null ? function.getCommentBeginBracket() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append("(").append(function.getCommentEndEscaped() != null ? function.getCommentEndBracket() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append(")");
} else {
boolean oldUseBracketsInExprList = useBracketsInExprList;
if (function.isDistinct()) {
useBracketsInExprList = false;
buffer.append(function.getCommentBeginEscaped() != null ? function.getCommentBeginBracket() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append("(").append(function.getCommentDistinct() != null ? function.getCommentDistinct() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append("Distinct ");
}
visit(function.getParameters());
useBracketsInExprList = oldUseBracketsInExprList;
if (function.isDistinct()) {
buffer.append(function.getCommentBeginEscaped() != null ? function.getCommentEndBracket() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append(")");
}
}
if (function.isEscaped()) {
buffer.append(function.getCommentEndEscaped() != null ? function.getCommentEndEscaped() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append("}");
}
}
代码示例来源:origin: com.eas.platypus/platypus-js-sql-parser
final public Function Function() throws ParseException {Function retval = new Function();
String funcName = null;
String tmp = null;
case ESCAPEDLITEARL:{
tk = jj_consume_token(ESCAPEDLITEARL);
retval.setEscaped(true);
if (tk.specialToken != null) {
retval.setCommentBeginEscaped(tk.specialToken.image);
funcName = RelObjectName();
if (token.specialToken != null) {
retval.setCommentName(token.specialToken.image);
funcName = "REPLACE";
if (tk.specialToken != null) {
retval.setCommentName(tk.specialToken.image);
retval.setCommentBeginBracket(tk.specialToken.image);
case K_DISTINCT:{
tk = jj_consume_token(K_DISTINCT);
retval.setDistinct(true);
if (tk.specialToken != null) {
retval.setCommentDistinct(tk.specialToken.image);
retval.setAllColumns(true);
if (tk.specialToken != null) {
retval.setCommentAll(tk.specialToken.image);
代码示例来源:origin: diennea/herddb
@Override
public void visit(Function function) {
function.setName(function.getName().toLowerCase());
if (function.getParameters() != null) {
function.getParameters().accept(this);
}
}
代码示例来源:origin: JSQLParser/JSqlParser
@Override
public void visit(Function function) {
ExpressionList exprList = function.getParameters();
if (exprList != null) {
visit(exprList);
}
}
代码示例来源:origin: pagehelper/Mybatis-PageHelper
Expression expression = ((SelectExpressionItem) item).getExpression();
if (expression instanceof Function) {
String name = ((Function) expression).getName();
if (name != null) {
String NAME = name.toUpperCase();
代码示例来源:origin: io.github.itfinally/mybatis-paging
private List<SelectItem> createCountFunction() {
SelectExpressionItem selectExpression = new SelectExpressionItem();
Function counter = new Function();
counter.setName( "count" );
counter.setAllColumns( true );
selectExpression.setExpression( counter );
return Lists.<SelectItem>newArrayList( selectExpression );
}
代码示例来源:origin: org.opencadc/cadc-adql
ExpressionList exprList = f.getParameters();
ExpressionList implExprList = convertToImplementation(exprList);
f.setParameters(implExprList);
implExpr = convertToImplementation(f);
代码示例来源:origin: JSQLParser/JSqlParser
if(parameters != null){
params = parameters.toString();
if (isDistinct()) {
params = params.replaceFirst("\\(", "(DISTINCT ");
} else if (isAllColumns()) {
params = params.replaceFirst("\\(", "(ALL ");
params = namedParameters.toString();
} else if (isAllColumns()) {
params = "(*)";
} else {
代码示例来源:origin: diennea/herddb
public static Column toAggregatedOutputColumn(String fieldName, Function f) {
if (f.getName().equalsIgnoreCase(BuiltinFunctions.COUNT)) {
return Column.column(fieldName, ColumnTypes.LONG);
}
if (f.getName().equalsIgnoreCase(BuiltinFunctions.SUM) && f.getParameters() != null && f.getParameters().getExpressions() != null && f.getParameters().getExpressions().size() == 1) {
return Column.column(fieldName, ColumnTypes.LONG);
}
if (f.getName().equalsIgnoreCase(BuiltinFunctions.MIN) && f.getParameters() != null && f.getParameters().getExpressions() != null && f.getParameters().getExpressions().size() == 1) {
return Column.column(fieldName, ColumnTypes.LONG);
}
if (f.getName().equalsIgnoreCase(BuiltinFunctions.MAX) && f.getParameters() != null && f.getParameters().getExpressions() != null && f.getParameters().getExpressions().size() == 1) {
return Column.column(fieldName, ColumnTypes.LONG);
}
return null;
}
代码示例来源:origin: org.opencadc/cadc-adql
public Lat(Function adqlFunction)
{
super();
Function latFunction = new Function();
latFunction.setName("lat");
latFunction.setParameters(adqlFunction.getParameters());
List<Expression> expressions = new ArrayList<Expression>();
expressions.add(latFunction);
ExpressionList expressionList = new ExpressionList();
expressionList.setExpressions(expressions);
setName("degrees");
setParameters(expressionList);
}
代码示例来源:origin: com.baomidou/mybatis-plus-extension
/**
* <p>
* 获取jsqlparser中count的SelectItem
* </p>
*/
private static List<SelectItem> countSelectItem() {
Function function = new Function();
function.setName("COUNT");
List<Expression> expressions = new ArrayList<>();
LongValue longValue = new LongValue(1);
ExpressionList expressionList = new ExpressionList();
expressions.add(longValue);
expressionList.setExpressions(expressions);
function.setParameters(expressionList);
List<SelectItem> selectItems = new ArrayList<>();
SelectExpressionItem selectExpressionItem = new SelectExpressionItem(function);
selectItems.add(selectExpressionItem);
return selectItems;
}
}
内容来源于网络,如有侵权,请联系作者删除!