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

db.sql.api.impl.cmd.basic.AllField Maven / Gradle / Ivy

There is a newer version: 1.7.6-RC2
Show newest version
package db.sql.api.impl.cmd.basic;


import db.sql.api.Cmd;
import db.sql.api.SqlBuilderContext;
import db.sql.api.cmd.basic.IDataset;
import db.sql.api.impl.cmd.struct.query.Select;
import db.sql.api.impl.tookit.SqlConst;

public class AllField extends AbstractDatasetField {

    public final static AllField ALL = new AllField();

    public AllField() {
        super(null, SqlConst.ALL);
    }

    public AllField(IDataset table) {
        super(table, SqlConst.ALL);
    }

    @Override
    public AllField as(String alias) {
        throw new RuntimeException("AllField不能设置别名");
    }

    @Override
    public StringBuilder sql(Cmd module, Cmd parent, SqlBuilderContext context, StringBuilder sqlBuilder) {
        if (module instanceof Select) {
            if (getTable() != null) {
                if (getTable().getAlias() != null) {
                    sqlBuilder.append(getTable().getAlias()).append(SqlConst.DOT);
                }
            }
        }
        return sqlBuilder.append(SqlConst.ALL);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy