本文整理汇总了Java中net.sf.jsqlparser.expression.Function.getParameters方法的典型用法代码示例。如果您正苦于以下问题:Java Function.getParameters方法的具体用法?Java Function.getParameters怎么用?Java Function.getParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.jsqlparser.expression.Function
的用法示例。
在下文中一共展示了Function.getParameters方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import net.sf.jsqlparser.expression.Function; //导入方法依赖的package包/类
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("}");
}
}
示例2: visit
import net.sf.jsqlparser.expression.Function; //导入方法依赖的package包/类
@Override
public void visit(Function function) {
function.setName(function.getName().toLowerCase());
if (function.getParameters() != null) {
function.getParameters().accept(this);
}
}
示例3: toAggregatedOutputColumn
import net.sf.jsqlparser.expression.Function; //导入方法依赖的package包/类
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;
}
示例4: getColumnCalculator
import net.sf.jsqlparser.expression.Function; //导入方法依赖的package包/类
public static AggregatedColumnCalculator getColumnCalculator(Function f, String fieldName,
StatementEvaluationContext context) throws StatementExecutionException {
String functionName = f.getName();
CompiledSQLExpression firstParam = f.getParameters() == null || f.getParameters().getExpressions() == null || f.getParameters().getExpressions().isEmpty() ? null
: SQLExpressionCompiler.compileExpression(null, f.getParameters().getExpressions().get(0));
return getColumnCalculator(functionName, fieldName, firstParam, context);
}
示例5: visit
import net.sf.jsqlparser.expression.Function; //导入方法依赖的package包/类
@Override
public void visit(Function fnctn) {
if (fnctn.getParameters() != null) {
for (Iterator it = fnctn.getParameters().getExpressions().iterator(); it.hasNext();) {
((Expression) it.next()).accept(this);
}
}
}
示例6: visit
import net.sf.jsqlparser.expression.Function; //导入方法依赖的package包/类
@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) {
buffer.append("()");
} else {
boolean oldUseBracketsInExprList = useBracketsInExprList;
if (function.isDistinct()) {
useBracketsInExprList = false;
buffer.append("(DISTINCT ");
} else if (function.isAllColumns()) {
useBracketsInExprList = false;
buffer.append("(ALL ");
}
visit(function.getParameters());
useBracketsInExprList = oldUseBracketsInExprList;
if (function.isDistinct() || function.isAllColumns()) {
buffer.append(")");
}
}
if (function.getAttribute() != null) {
buffer.append(".").append(function.getAttribute());
}
if (function.getKeep() != null) {
buffer.append(" ").append(function.getKeep());
}
if (function.isEscaped()) {
buffer.append("}");
}
}
示例7: visit
import net.sf.jsqlparser.expression.Function; //导入方法依赖的package包/类
@Override
public void visit(Function function) {
ExpressionList exprList = function.getParameters();
if (exprList != null) {
visit(exprList);
}
}
示例8: create
import net.sf.jsqlparser.expression.Function; //导入方法依赖的package包/类
public static CompiledFunction create(Function f, String validatedTableAlias) {
String name = f.getName();
List<Expression> params = null;
if (f.getParameters() != null) {
params = f.getParameters().getExpressions();
}
switch (name) {
case BuiltinFunctions.COUNT:
case BuiltinFunctions.SUM:
case BuiltinFunctions.MIN:
case BuiltinFunctions.MAX:
// AGGREGATED FUNCTION
return new CompiledFunction(name, null);
case BuiltinFunctions.LOWER: {
if (params == null || params.size() != 1) {
throw new StatementExecutionException("function " + name + " must have one parameter");
}
break;
}
case BuiltinFunctions.UPPER: {
if (params == null || params.size() != 1) {
throw new StatementExecutionException("function " + name + " must have one parameter");
}
break;
}
case BuiltinFunctions.ABS: {
if (params == null || params.size() != 1) {
throw new StatementExecutionException("function " + name + " must have one parameter");
}
break;
}
case BuiltinFunctions.ROUND: {
if (params == null || (params.size() != 1 && params.size() != 2)) {
throw new StatementExecutionException("function " + name + " must have one or two parameters");
}
break;
}
default:
throw new StatementExecutionException("unhandled function " + name);
}
List<CompiledSQLExpression> compiledParams = new ArrayList<>();
for (Expression exp : f.getParameters().getExpressions()) {
compiledParams.add(compileExpression(validatedTableAlias, exp));
}
return new CompiledFunction(name, compiledParams);
}
示例9: visit
import net.sf.jsqlparser.expression.Function; //导入方法依赖的package包/类
@Override
public void visit(Function fnctn) {
if (fnctn.getParameters() != null && fnctn.getParameters().getExpressions() != null) {
fnctn.getParameters().getExpressions().forEach(e -> e.accept(this));
}
}