use of org.dbflute.cbean.sqlclause.query.QueryClause in project dbflute-core by dbflute.
the class AbstractSqlClause method getOuterJoinInlineWhereClauseList4Register.
protected List<QueryClause> getOuterJoinInlineWhereClauseList4Register(String foreignAliasName, boolean onClause) {
final LeftOuterJoinInfo joinInfo = getOuterJoinMap().get(foreignAliasName);
final List<QueryClause> clauseList;
if (onClause) {
if (_orScopeQueryEffective) {
clauseList = getTmpOrAdditionalOnClauseList(foreignAliasName);
} else {
clauseList = joinInfo.getAdditionalOnClauseList();
}
} else {
if (_orScopeQueryEffective) {
clauseList = getTmpOrOuterJoinInlineClauseList(foreignAliasName);
} else {
clauseList = joinInfo.getInlineWhereClauseList();
}
}
return clauseList;
}
use of org.dbflute.cbean.sqlclause.query.QueryClause in project dbflute-core by dbflute.
the class AbstractSqlClause method exchangeFirstWhereClauseForLastOne.
/**
* {@inheritDoc}
*/
public void exchangeFirstWhereClauseForLastOne() {
final List<QueryClause> whereList = getWhereList();
if (whereList.size() > 1) {
final QueryClause first = whereList.get(0);
final QueryClause last = whereList.get(whereList.size() - 1);
whereList.set(0, last);
whereList.set(whereList.size() - 1, first);
}
}
use of org.dbflute.cbean.sqlclause.query.QueryClause in project dbflute-core by dbflute.
the class AbstractSqlClause method registerOuterJoinInlineWhereClause.
// -----------------------------------------------------
// In-line for Outer Join
// ----------------------
public // foreign alias of column
void registerOuterJoinInlineWhereClause(// foreign alias of column
String foreignAliasName, // SQL name of column
ColumnSqlName columnSqlName, // basic resources
ConditionKey key, // basic resources
ConditionValue value, // optional resources
ColumnFunctionCipher cipher, // optional resources
ConditionOption option, boolean onClause) {
assertNotYetOuterJoin(foreignAliasName);
final List<QueryClause> clauseList = getOuterJoinInlineWhereClauseList4Register(foreignAliasName, onClause);
final String tableAliasName = onClause ? foreignAliasName : getInlineViewBasePointAlias();
final ColumnRealName columnRealName = ColumnRealName.create(tableAliasName, columnSqlName);
doRegisterWhereClause(clauseList, columnRealName, key, value, cipher, option, true, onClause);
}
use of org.dbflute.cbean.sqlclause.query.QueryClause in project dbflute-core by dbflute.
the class AbstractConditionQuery method doRegisterScalarCondition.
protected <CB extends ConditionBean> void doRegisterScalarCondition(final String function, final ConditionQuery subQuery, String propertyName, String operand, final HpSLCCustomized<CB> after, ScalarConditionOption option) {
assertSubQueryNotNull("ScalarCondition", propertyName, subQuery);
final SubQueryPath subQueryPath = new SubQueryPath(xgetLocation(propertyName));
final GeneralColumnRealNameProvider localRealNameProvider = new GeneralColumnRealNameProvider();
final int subQueryLevel = subQuery.xgetSqlClause().getSubQueryLevel();
final SqlClause subQueryClause = subQuery.xgetSqlClause();
final String subQueryIdentity = propertyName + "[" + subQueryLevel + "]";
final ColumnSqlNameProvider subQuerySqlNameProvider = dbName -> subQuery.toColumnSqlName(dbName);
final DBMeta subQueryDBMeta = findDBMeta(subQuery.asTableDbName());
final GearedCipherManager cipherManager = xgetSqlClause().getGearedCipherManager();
final String mainSubQueryIdentity = propertyName + "[" + subQueryLevel + ":subquerymain]";
final PartitionByProvider partitionByProvider = () -> after.preparePartitionBySqlClause();
final ScalarCondition scalarCondition = new ScalarCondition(subQueryPath, localRealNameProvider, subQuerySqlNameProvider, subQueryLevel, subQueryClause, subQueryIdentity, subQueryDBMeta, cipherManager, mainSubQueryIdentity, operand, partitionByProvider);
xregisterParameterOption(option);
final QueryClause clause = new QueryClause() {
/* lazy registration to use partition-by */
public String toString() {
return scalarCondition.buildScalarCondition(function, option);
}
};
// no speak about inner-join because of no possible of null revival
final QueryUsedAliasInfo usedAliasInfo = new QueryUsedAliasInfo(xgetAliasName(), null);
registerWhereClause(clause, usedAliasInfo);
}
use of org.dbflute.cbean.sqlclause.query.QueryClause in project dbflute-core by dbflute.
the class AbstractSqlClause method doBuildJoinOnClauseAdditional.
protected int doBuildJoinOnClauseAdditional(StringBuilder sb, LeftOuterJoinInfo joinInfo, Map<ColumnRealName, ColumnRealName> joinOnMap, int currentConditionCount) {
final List<QueryClause> additionalOnClauseList = joinInfo.getAdditionalOnClauseList();
for (QueryClause additionalOnClause : additionalOnClauseList) {
sb.append(ln()).append(" ");
sb.append(currentConditionCount > 0 ? " and " : "");
sb.append(additionalOnClause);
++currentConditionCount;
}
return currentConditionCount;
}
Aggregations