use of org.dbflute.cbean.sqlclause.query.QueryUsedAliasInfo in project dbflute-core by dbflute.
the class AbstractConditionBean method xregisterColQyClause.
protected <CB extends ConditionBean> void xregisterColQyClause(QueryClause queryClause, final HpCalcSpecification<CB> leftCalcSp, final HpCalcSpecification<CB> rightCalcSp) {
// /= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
// may null-revived -> no way to be inner-join
// (DerivedReferrer or conversion's coalesce)
//
// for example, the following SQL is no way to be inner
// (suppose if PURCHASE refers WITHDRAWAL)
//
// select mb.MEMBER_ID, mb.MEMBER_NAME
// , mb.MEMBER_STATUS_CODE, wd.MEMBER_ID as WD_MEMBER_ID
// from MEMBER mb
// left outer join MEMBER_SERVICE ser on mb.MEMBER_ID = ser.MEMBER_ID
// left outer join MEMBER_WITHDRAWAL wd on mb.MEMBER_ID = wd.MEMBER_ID
// where (select coalesce(max(pc.PURCHASE_PRICE), 0)
// from PURCHASE pc
// where pc.MEMBER_ID = wd.MEMBER_ID -- may null
// ) < ser.SERVICE_POINT_COUNT
// order by mb.MEMBER_ID
//
// it has a possible to be inner-join in various case
// but it is hard to analyze in detail so simplify it
// = = = = = = = = = =/
final QueryUsedAliasInfo leftInfo = xcreateColQyAliasInfo(leftCalcSp);
final QueryUsedAliasInfo rightInfo = xcreateColQyAliasInfo(rightCalcSp);
getSqlClause().registerWhereClause(queryClause, leftInfo, rightInfo);
}
use of org.dbflute.cbean.sqlclause.query.QueryUsedAliasInfo in project dbflute-core by dbflute.
the class HpAbstractSpecification method reflectDreamCruiseWhereUsedToJoin.
protected void reflectDreamCruiseWhereUsedToJoin(String relationPath, String tableAliasName) {
if (!_baseCB.xisDreamCruiseShip()) {
return;
}
// to suppress CountLeastJoin of the relation
// the DreamCruise might be used in where clause (not correctly but safety logic)
final ConditionBean portCB = _baseCB.xgetDreamCruiseDeparturePort();
final QueryUsedAliasInfo usedAliasInfo = new QueryUsedAliasInfo(tableAliasName, new InnerJoinNoWaySpeaker() {
public boolean isNoWayInner() {
// non fact of inner-join, because judge is so difficult when DreamCruise
return true;
}
});
portCB.getSqlClause().reflectWhereUsedToJoin(usedAliasInfo);
}
use of org.dbflute.cbean.sqlclause.query.QueryUsedAliasInfo in project dbflute-core by dbflute.
the class AbstractSqlClause method registerWhereClause.
/**
* {@inheritDoc}
*/
public void registerWhereClause(QueryClause clause, QueryUsedAliasInfo... usedAliasInfos) {
assertObjectNotNull("clause", clause);
assertObjectNotNull("usedAliasInfos", usedAliasInfos);
if (usedAliasInfos.length == 0) {
String msg = "The argument 'usedAliasInfos' should not be empty.";
throw new IllegalArgumentException(msg);
}
final List<QueryClause> clauseList = getWhereClauseList4Register();
doRegisterWhereClause(clauseList, clause);
for (QueryUsedAliasInfo usedAliasInfo : usedAliasInfos) {
reflectWhereUsedToJoin(usedAliasInfo);
}
}
use of org.dbflute.cbean.sqlclause.query.QueryUsedAliasInfo in project dbflute-core by dbflute.
the class AbstractSqlClause method registerInnerJoinLazyReflector.
// -----------------------------------------------------
// InnerJoin Reflection
// --------------------
protected void registerInnerJoinLazyReflector(String usedAliasName) {
// without no-way speaker
if (isOutOfWhereUsedInnerJoin()) {
return;
}
final QueryUsedAliasInfo usedAliasInfo = new QueryUsedAliasInfo(usedAliasName, null);
registerInnerJoinLazyReflector(usedAliasInfo);
}
use of org.dbflute.cbean.sqlclause.query.QueryUsedAliasInfo 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);
}
Aggregations