com.easy.query.gauss.db.func.GaussDBJoinSQLFunction Maven / Gradle / Ivy
The newest version!
package com.easy.query.gauss.db.func;
import com.easy.query.core.expression.parser.core.available.TableAvailable;
import com.easy.query.core.func.column.ColumnExpression;
import com.easy.query.core.func.def.AbstractExpressionSQLFunction;
import java.util.List;
/**
* create time 2023/12/21 11:58
* 文件说明
*
* @author xuejiaming
*/
public class GaussDBJoinSQLFunction extends AbstractExpressionSQLFunction {
private final List columnExpressions;
private final boolean distinct;
public GaussDBJoinSQLFunction(List columnExpressions, boolean distinct) {
this.columnExpressions = columnExpressions;
this.distinct = distinct;
}
@Override
public String sqlSegment(TableAvailable defaultTable) {
if(columnExpressions.size()!=2){
throw new IllegalArgumentException("join arguments != 2");
}
if(distinct){
return "STRING_AGG(DISTINCT ({1})::TEXT, {0})";
}
return "STRING_AGG(({1})::TEXT, {0})";
}
@Override
public int paramMarks() {
return columnExpressions.size();
}
@Override
protected List getColumnExpressions() {
return columnExpressions;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy