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

ru.curs.celesta.dbutils.term.FieldCompTerm Maven / Gradle / Ivy

The newest version!
package ru.curs.celesta.dbutils.term;

import ru.curs.celesta.dbutils.QueryBuildingHelper;
import ru.curs.celesta.dbutils.stmt.ParameterSetter;

import java.util.List;

/**
 * Comparision of a field with a value.
 */
public final class FieldCompTerm extends WhereTerm {
    // quoted column name
    private final String fieldName;
    private final int fieldIndex;
    private final String op;

    public FieldCompTerm(String fieldName, int fieldIndex, String op) {
        this.fieldName = fieldName;
        this.fieldIndex = fieldIndex;
        this.op = op;
    }

    @Override
    public String getWhere() {
        return String.format("(%s %s ?)", fieldName, op);
    }

    @Override
    public void programParams(List program, QueryBuildingHelper queryBuildingHelper) {
        program.add(ParameterSetter.create(fieldIndex, queryBuildingHelper));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy