use of org.dbflute.cbean.sqlclause.query.QueryClause 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.QueryClause in project dbflute-core by dbflute.
the class AbstractSqlClause method buildWhereClause.
protected void buildWhereClause(StringBuilder sb, boolean template) {
final List<QueryClause> whereList = getWhereList();
if (whereList.isEmpty()) {
if (template) {
sb.append(" ").append(getWhereClauseMark());
}
return;
}
int count = 0;
for (QueryClause whereClause : whereList) {
final String clauseElement = filterWhereClauseSimply(whereClause.toString());
if (count == 0) {
sb.append(ln()).append(" ");
sb.append("where ").append(template ? getWhereFirstConditionMark() : "").append(clauseElement);
} else {
sb.append(ln()).append(" ");
sb.append(" and ").append(clauseElement);
}
++count;
}
}
use of org.dbflute.cbean.sqlclause.query.QueryClause in project dbflute-core by dbflute.
the class AbstractSqlClause method buildJoinTableClause.
protected void buildJoinTableClause(StringBuilder sb, LeftOuterJoinInfo joinInfo, String joinExp, boolean canBeInnerJoin) {
final String foreignTableDbName = joinInfo.getForeignTableDbName();
// basically for in-line view indent
final int tablePos = 3 + joinExp.length();
final DBMeta foreignDBMeta = findDBMeta(foreignTableDbName);
final TableSqlName foreignTableSqlName = foreignDBMeta.getTableSqlName();
final List<QueryClause> inlineWhereClauseList = joinInfo.getInlineWhereClauseList();
final String tableExp;
if (inlineWhereClauseList.isEmpty()) {
tableExp = foreignTableSqlName.toString();
} else {
tableExp = getInlineViewClause(foreignTableSqlName, inlineWhereClauseList, tablePos);
}
if (joinInfo.hasFixedCondition()) {
sb.append(joinInfo.resolveFixedInlineView(tableExp, canBeInnerJoin));
} else {
sb.append(tableExp);
}
}
use of org.dbflute.cbean.sqlclause.query.QueryClause in project dbflute-core by dbflute.
the class AbstractSqlClause method markOrScopeQueryAndPart.
protected void markOrScopeQueryAndPart(List<QueryClause> clauseList) {
if (_orScopeQueryEffective && _orScopeQueryAndPartEffective && !clauseList.isEmpty()) {
// as latest
final QueryClause original = clauseList.remove(clauseList.size() - 1);
clauseList.add(new OrScopeQueryAndPartQueryClause(original, _orScopeQueryAndPartIdentity));
}
}
use of org.dbflute.cbean.sqlclause.query.QueryClause in project dbflute-core by dbflute.
the class AbstractSqlClause method registerBaseTableInlineWhereClause.
// ===================================================================================
// In-line Where
// =============
// -----------------------------------------------------
// In-line for Base Table
// ----------------------
public // SQL name of column
void registerBaseTableInlineWhereClause(// SQL name of column
ColumnSqlName columnSqlName, // basic resources
ConditionKey key, // basic resources
ConditionValue value, ColumnFunctionCipher cipher, ConditionOption option) {
// optional resources
final List<QueryClause> clauseList = getBaseTableInlineWhereClauseList4Register();
final String inlineBaseAlias = getInlineViewBasePointAlias();
final ColumnRealName columnRealName = ColumnRealName.create(inlineBaseAlias, columnSqlName);
doRegisterWhereClause(clauseList, columnRealName, key, value, cipher, option, true, false);
}
Aggregations