
sf.dsl.example.UnionBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sorm Show documentation
Show all versions of sorm Show documentation
java jpa tool for spring
The newest version!
package sf.dsl.example;
import sf.database.dialect.DBDialect;
import sf.database.jdbc.sql.SQLContext;
import sf.database.jdbc.sql.SQLParameter;
import java.util.List;
public class UnionBuilder {
private String key;
private Example query;
public static UnionBuilder union(Example query) {
UnionBuilder unionBuilder = new UnionBuilder();
unionBuilder.key = " UNION ";
unionBuilder.query = query;
return unionBuilder;
}
public static UnionBuilder unionAll(Example query) {
UnionBuilder unionBuilder = new UnionBuilder();
unionBuilder.key = " UNION ALL ";
unionBuilder.query = query;
return unionBuilder;
}
private UnionBuilder() {
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public Example getQuery() {
return query;
}
public void setQuery(Example query) {
this.query = query;
}
public void buildSql(StringBuilder sqlBuilder, List list, DBDialect dialect) {
query.dialect = dialect;
SQLContext sqlContext = ExampleSQL.getSelectSQLContext(query, null, SelectOpt.all, true);
list.addAll(sqlContext.getParas());
sqlBuilder.append(key).append('(').append(sqlContext.getSql()).append(')');
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy