Search in sources :

Example 6 with QueryJoin

use of com.servoy.j2db.query.QueryJoin in project servoy-client by Servoy.

the class QBJoins method add.

public QBJoin add(IQueryBuilder subqueryBuilder, int joinType, String alias) {
    if (!DataSourceUtils.isSameServer(getRoot().getDataSource(), subqueryBuilder.getDataSource())) {
        throw new RuntimeException("Cannot add derived table join from different server: " + getRoot().getDataSource() + " vs " + subqueryBuilder.getDataSource());
    }
    QuerySelect subquery = ((QBSelect) subqueryBuilder).getQuery();
    QBJoin join = getJoin(alias);
    if (join == null) {
        join = addJoin(new QueryJoin(alias, parent.getQueryTable(), new DerivedTable(subquery, alias), new AndCondition(), joinType, true), subqueryBuilder.getDataSource(), alias);
    }
    return join;
}
Also used : DerivedTable(com.servoy.j2db.query.DerivedTable) QueryJoin(com.servoy.j2db.query.QueryJoin) QuerySelect(com.servoy.j2db.query.QuerySelect) AndCondition(com.servoy.j2db.query.AndCondition)

Aggregations

QueryJoin (com.servoy.j2db.query.QueryJoin)6 AndCondition (com.servoy.j2db.query.AndCondition)4 Column (com.servoy.j2db.persistence.Column)3 IColumn (com.servoy.j2db.persistence.IColumn)3 QueryColumn (com.servoy.j2db.query.QueryColumn)3 QueryTable (com.servoy.j2db.query.QueryTable)3 ArrayList (java.util.ArrayList)3 BaseQueryColumn (com.servoy.base.query.BaseQueryColumn)2 Relation (com.servoy.j2db.persistence.Relation)2 RepositoryException (com.servoy.j2db.persistence.RepositoryException)2 Table (com.servoy.j2db.persistence.Table)2 CompareCondition (com.servoy.j2db.query.CompareCondition)2 DerivedTable (com.servoy.j2db.query.DerivedTable)2 ISQLJoin (com.servoy.j2db.query.ISQLJoin)2 ISQLTableJoin (com.servoy.j2db.query.ISQLTableJoin)2 Placeholder (com.servoy.j2db.query.Placeholder)2 QuerySelect (com.servoy.j2db.query.QuerySelect)2 SafeArrayList (com.servoy.j2db.util.SafeArrayList)2 IVisitor (com.servoy.j2db.util.visitor.IVisitor)2 BaseQueryTable (com.servoy.base.query.BaseQueryTable)1