本文整理了Java中net.sf.jsqlparser.expression.Function.getName()
方法的一些代码示例,展示了Function.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Function.getName()
方法的具体详情如下:
包路径:net.sf.jsqlparser.expression.Function
类名称:Function
方法名:getName
[英]The name of he function, i.e. "MAX"
[中]函数的名称,即“MAX”
代码示例来源: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: JSQLParser/JSqlParser
buffer.append(function.getName());
if (function.isAllColumns() && function.getParameters() == null) {
buffer.append("(*)");
代码示例来源: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: 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: vincentrussell/sql-to-mongo-db-query-converter
public static boolean isSpecialtyFunction(Expression incomingExpression) {
if (incomingExpression == null) {
return false;
}
if (Function.class.isInstance(incomingExpression) && containsIgnoreCase(SPECIALTY_FUNCTIONS, ((Function)incomingExpression).getName())) {
return true;
}
return false;
}
代码示例来源:origin: diennea/herddb
private boolean isAggregateFunction(Expression expression) throws StatementExecutionException {
if (!(expression instanceof Function)) {
return false;
}
Function function = (Function) expression;
String name = function.getName().toLowerCase();
if (BuiltinFunctions.isAggregateFunction(function.getName())) {
return true;
}
if (BuiltinFunctions.isScalarFunction(function.getName())) {
return false;
}
throw new StatementExecutionException("unsupported function " + name);
}
代码示例来源:origin: org.opencadc/cadc-adql
/**
* Find the FunctionDesc for a given Function.
*
* @param tapSchema
* @param function
* @return FunctionDesc
*/
public static FunctionDesc findFunctionDesc(TapSchema tapSchema, Function function)
{
if (function == null || function.getName() == null)
return null;
for (FunctionDesc functionDesc : tapSchema.getFunctionDescs())
{
log.debug("check: " + function.getName() + " vs " + functionDesc.getName());
if (function.getName().equalsIgnoreCase(functionDesc.getName()))
return functionDesc;
}
return null;
}
代码示例来源:origin: it.unibz.inf.ontop/ontop-mapping-sql-core
@Override
public void visit(net.sf.jsqlparser.expression.Function expression) {
// do not use ImmutableCollectors.toList because this cannot be done concurrently
ImmutableList<Term> terms = (expression.getParameters() != null)
? ImmutableList.<Term>builder()
.addAll(expression.getParameters().getExpressions().stream()
.map(t -> termVisitor.getTerm(t)).iterator())
.build()
: ImmutableList.of();
BiFunction<ImmutableList<Term>, net.sf.jsqlparser.expression.Function, Function> function
= BOOLEAN_FUNCTIONS.get(expression.getName().toUpperCase());
if (function == null)
throw new UnsupportedSelectQueryRuntimeException("Unsupported SQL function", expression);
result = ImmutableList.of(function.apply(terms, expression));
}
代码示例来源:origin: ontop/ontop
@Override
public void visit(net.sf.jsqlparser.expression.Function expression) {
// do not use ImmutableCollectors.toList because this cannot be done concurrently
ImmutableList<Term> terms = (expression.getParameters() != null)
? ImmutableList.<Term>builder()
.addAll(expression.getParameters().getExpressions().stream()
.map(t -> termVisitor.getTerm(t)).iterator())
.build()
: ImmutableList.of();
BiFunction<ImmutableList<Term>, net.sf.jsqlparser.expression.Function, Function> function
= BOOLEAN_FUNCTIONS.get(expression.getName().toUpperCase());
if (function == null)
throw new UnsupportedSelectQueryRuntimeException("Unsupported SQL function", expression);
result = ImmutableList.of(function.apply(terms, expression));
}
代码示例来源:origin: it.unibz.inf.ontop/ontop-mapping-sql-core
@Override
public void visit(net.sf.jsqlparser.expression.Function expression) {
// do not use ImmutableCollectors.toList because this cannot be done concurrently
ImmutableList<Term> terms = (expression.getParameters() != null)
? ImmutableList.<Term>builder()
.addAll(expression.getParameters().getExpressions().stream()
.map(t -> getTerm(t)).iterator())
.build()
: ImmutableList.of();
BiFunction<ImmutableList<Term>, net.sf.jsqlparser.expression.Function, Function> function
= FUNCTIONS.get(expression.getName().toUpperCase());
if (function == null)
throw new UnsupportedSelectQueryRuntimeException("Unsupported SQL function", expression);
result = function.apply(terms, expression);
}
代码示例来源:origin: ontop/ontop
@Override
public void visit(net.sf.jsqlparser.expression.Function expression) {
// do not use ImmutableCollectors.toList because this cannot be done concurrently
ImmutableList<Term> terms = (expression.getParameters() != null)
? ImmutableList.<Term>builder()
.addAll(expression.getParameters().getExpressions().stream()
.map(t -> getTerm(t)).iterator())
.build()
: ImmutableList.of();
BiFunction<ImmutableList<Term>, net.sf.jsqlparser.expression.Function, Function> function
= FUNCTIONS.get(expression.getName().toUpperCase());
if (function == null)
throw new UnsupportedSelectQueryRuntimeException("Unsupported SQL function", expression);
result = function.apply(terms, expression);
}
代码示例来源: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 Expression convertToImplementation(Function func)
{
Expression implExpr = super.convertToImplementation(func);
if (implExpr == func) // not handled
{
if (RANGE_S2D.equalsIgnoreCase(func.getName()))
{
ExpressionList exprList = func.getParameters();
if (exprList == null)
throw new IllegalArgumentException("RANGE_S2D requires long1, long2, lat1, lat2");
List<Expression> expressions = exprList.getExpressions();
if (expressions.size() != 4)
throw new IllegalArgumentException("RANGE_S2D requires long1, long2, lat1, lat2");
implExpr = handleRangeS2D(expressions.get(0), expressions.get(1), expressions.get(2), expressions.get(3));
}
}
return implExpr;
}
代码示例来源:origin: org.opencadc/cadc-adql
@Override
protected Expression convertToImplementation(Function func)
{
if (!func.getName().equalsIgnoreCase("match"))
return func;
List<Expression> exprs = func.getParameters().getExpressions();
if (exprs.size() == 2)
{
Expression e1 = exprs.get(0);
Expression e2 = exprs.get(1);
if (e1 instanceof Column && e2 instanceof StringValue)
{
Column col = (Column) e1;
String query = ((StringValue) e2).getValue();
return new TextSearchMatch(col, query);
}
}
throw new IllegalArgumentException("invalid args to match: expected match(<column>,<string>)");
}
代码示例来源:origin: it.unibz.inf.ontop/ontop-obdalib-core
@Override
public void visit(Function function) {
switch (function.getName().toLowerCase()) {
case "regexp_like" :
case "regexp_replace" :
case "replace" :
case "concat" :
case "substr" :
for (Expression ex :function.getParameters().getExpressions())
ex.accept(this);
break;
default:
unsupported(function);
break;
}
}
代码示例来源:origin: diennea/herddb
@Override
public void visit(Function function) {
function.setName(function.getName().toLowerCase());
if (function.getParameters() != null) {
function.getParameters().accept(this);
}
}
代码示例来源: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: it.unibz.inf.ontop/ontop-obdalib-core
@Override
public void visit(Function function) {
switch (function.getName().toLowerCase()) {
case "regexp_like" :
case "regexp_replace" :
case "replace" :
case "concat" :
//case "substr" :
for (Expression ex :function.getParameters().getExpressions())
ex.accept(this);
break;
default:
unsupported(function);
}
}
代码示例来源:origin: diennea/herddb
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);
}
代码示例来源:origin: org.geotools/gt-arcsde
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;
}
内容来源于网络,如有侵权,请联系作者删除!