All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.easy.query.mysql.func.MySQLStringCompareToSQLFunction Maven / Gradle / Ivy

The newest version!
package com.easy.query.mysql.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 MySQLStringCompareToSQLFunction extends AbstractExpressionSQLFunction {
    private final List columnExpressions;

    public MySQLStringCompareToSQLFunction(List columnExpressions) {

        this.columnExpressions = columnExpressions;
    }

    @Override
    public String sqlSegment(TableAvailable defaultTable) {
        if(columnExpressions.size()<2){
            throw new IllegalArgumentException("compare arguments < 2");
        }
        return "STRCMP({0},{1})";
    }

    @Override
    public int paramMarks() {
        return columnExpressions.size();
    }

    @Override
    protected List getColumnExpressions() {
        return columnExpressions;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy