org.fluentjdbc.DbTableAliasContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fluent-jdbc Show documentation
Show all versions of fluent-jdbc Show documentation
A Java library used to execute JDBC statements and build SQL
package org.fluentjdbc;
import javax.annotation.Nullable;
public class DbTableAliasContext {
private final DbTableContext dbTableContext;
private final DatabaseTableAlias alias;
public DbTableAliasContext(DbTableContext dbTableContext, String alias) {
this.dbTableContext = dbTableContext;
this.alias = dbTableContext.getTable().alias(alias);
}
public DatabaseColumnReference column(String columnName) {
return alias.column(columnName);
}
public DbJoinedSelectContext join(DatabaseColumnReference a, DatabaseColumnReference b) {
return select().join(a, b);
}
public DatabaseTableAlias getTableAlias() {
return alias;
}
public DbJoinedSelectContext where(String fieldName, @Nullable Object value) {
return select().whereExpression(alias.getAlias() + "." + fieldName + " = ?", value);
}
public DbJoinedSelectContext select() {
return new DbJoinedSelectContext(this);
}
public DbContext getDbContext() {
return dbTableContext.getDbContext();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy