use of org.dbflute.dbmeta.info.ColumnInfo in project dbflute-core by dbflute.
the class DerivedReferrer method setupUnionMainForFixedCondition.
protected void setupUnionMainForFixedCondition(StringBuilder keySb, String tableAliasName, ColumnSqlName derivedColumnSqlName) {
// all columns because fixed condition might contain them
final List<ColumnInfo> columnInfoList = _subQueryDBMeta.getColumnInfoList();
for (ColumnInfo columnInfo : columnInfoList) {
final ColumnSqlName sqlName = columnInfo.getColumnSqlName();
if (sqlName.equals(derivedColumnSqlName)) {
// to suppress same columns selected
continue;
}
final ColumnRealName realName = ColumnRealName.create(tableAliasName, columnInfo.getColumnSqlName());
keySb.append(keySb.length() > 0 ? ", " : "");
keySb.append(realName);
}
}
use of org.dbflute.dbmeta.info.ColumnInfo in project dbflute-core by dbflute.
the class DerivedReferrer method buildUnionMainPartClause.
protected String buildUnionMainPartClause(ColumnSqlName relatedColumnSqlName, String tableAliasName, ColumnRealName derivedColumnRealName, ColumnSqlName derivedColumnSqlName, String correlatedFixedCondition) {
// derivedColumnSqlName : e.g. PURCHASE_PRICE
// derivedRealSqlName : might be sub-query
final ColumnSqlName derivedRealSqlName = derivedColumnRealName.getColumnSqlName();
final StringBuilder keySb = new StringBuilder();
if (isFixedCondition(correlatedFixedCondition)) {
setupUnionMainForFixedCondition(keySb, tableAliasName, derivedColumnSqlName);
} else {
// no fixed condition, mainly here
final List<ColumnInfo> pkList = _subQueryDBMeta.getPrimaryInfo().getPrimaryColumnList();
for (ColumnInfo pk : pkList) {
final ColumnSqlName pkSqlName = pk.getColumnSqlName();
if (pkSqlName.equals(derivedRealSqlName) || pkSqlName.equals(relatedColumnSqlName)) {
// to suppress same columns selected
continue;
}
keySb.append(keySb.length() > 0 ? ", " : "");
keySb.append(ColumnRealName.create(tableAliasName, pk.getColumnSqlName()));
}
if (!relatedColumnSqlName.equals(derivedRealSqlName)) {
// to suppress same columns selected
keySb.append(keySb.length() > 0 ? ", " : "");
keySb.append(ColumnRealName.create(tableAliasName, relatedColumnSqlName));
}
}
setupUnionMainForDerivedColumn(keySb, derivedColumnRealName, derivedColumnSqlName, derivedRealSqlName);
return completeUnionMainWholeClause(tableAliasName, keySb);
}
use of org.dbflute.dbmeta.info.ColumnInfo in project dbflute-core by dbflute.
the class DerivedReferrer method buildUnionMainPartClause.
protected String buildUnionMainPartClause(ColumnRealName[] correlatedColumnRealNames, ColumnSqlName[] relatedColumnSqlNames, String tableAliasName, ColumnRealName derivedColumnRealName, ColumnSqlName derivedColumnSqlName, String correlatedFixedCondition) {
// similar to simple primary key so refer it
final StringBuilder keySb = new StringBuilder();
final ColumnSqlName derivedRealSqlName = derivedColumnRealName.getColumnSqlName();
if (isFixedCondition(correlatedFixedCondition)) {
setupUnionMainForFixedCondition(keySb, tableAliasName, derivedColumnSqlName);
} else {
// no fixed condition, mainly here
final Set<ColumnSqlName> relatedColumnSqlSet = new HashSet<ColumnSqlName>();
for (ColumnSqlName columnSqlName : relatedColumnSqlNames) {
relatedColumnSqlSet.add(columnSqlName);
}
final ColumnSqlName derivedSqlName = derivedRealSqlName;
final List<ColumnInfo> pkList = _subQueryDBMeta.getPrimaryInfo().getPrimaryColumnList();
for (ColumnInfo pk : pkList) {
final ColumnSqlName pkSqlName = pk.getColumnSqlName();
if (pkSqlName.equals(derivedSqlName) || relatedColumnSqlSet.contains(pkSqlName)) {
// to suppress same columns selected
continue;
}
keySb.append(keySb.length() > 0 ? ", " : "");
keySb.append(ColumnRealName.create(tableAliasName, pk.getColumnSqlName()));
}
for (ColumnSqlName relatedSqlName : relatedColumnSqlNames) {
if (relatedSqlName.equals(derivedSqlName)) {
// to suppress same columns selected
continue;
}
keySb.append(keySb.length() > 0 ? ", " : "");
keySb.append(ColumnRealName.create(tableAliasName, relatedSqlName));
}
}
setupUnionMainForDerivedColumn(keySb, derivedColumnRealName, derivedColumnSqlName, derivedRealSqlName);
return completeUnionMainWholeClause(tableAliasName, keySb);
}
use of org.dbflute.dbmeta.info.ColumnInfo in project dbflute-core by dbflute.
the class AbstractDBMeta method cci.
protected // column name
ColumnInfo cci(// column name
String columnDbName, // column name
String columnSqlName, // column name
String columnSynonym, // column name
String columnAlias, // property info
Class<?> objectNativeType, // property info
String propertyName, // property info
Class<?> propertyAccessType, // column basic check
boolean primary, // column basic check
boolean autoIncrement, // column basic check
boolean notNull, // column type
String columnDbType, // column type
Integer columnSize, // column type
Integer decimalDigits, // column type
Integer datetimePrecision, // column type
String defaultValue, // column others
boolean commonColumn, // column others
OptimisticLockType optimisticLockType, // column others
String columnComment, // relation property
String foreignListExp, // relation property
String referrerListExp, // various info
ClassificationMeta classificationMeta, // various info
boolean canBeNullObject) {
// createColumnInfo()
final Class<?> realPt = chooseColumnPropertyAccessType(objectNativeType, propertyName, propertyAccessType);
final String delimiter = ",";
List<String> foreignPropList = null;
if (foreignListExp != null && foreignListExp.trim().length() > 0) {
foreignPropList = splitListTrimmed(foreignListExp, delimiter);
}
List<String> referrerPropList = null;
if (referrerListExp != null && referrerListExp.trim().length() > 0) {
referrerPropList = splitListTrimmed(referrerListExp, delimiter);
}
final PropertyMethodFinder propertyMethodFinder = createColumnPropertyMethodFinder();
return new ColumnInfo(this, columnDbName, columnSqlName, columnSynonym, columnAlias, objectNativeType, propertyName, realPt, primary, autoIncrement, notNull, columnDbType, columnSize, decimalDigits, datetimePrecision, defaultValue, commonColumn, optimisticLockType, columnComment, foreignPropList, referrerPropList, classificationMeta, canBeNullObject, propertyMethodFinder);
}
use of org.dbflute.dbmeta.info.ColumnInfo in project dbflute-core by dbflute.
the class SqlClauseOracle method lockForUpdate.
// ===================================================================================
// Lock Override
// =============
/**
* {@inheritDoc}
*/
public void lockForUpdate() {
final DBMeta dbmeta = findDBMeta(_tableDbName);
final String basePointAliasName = getBasePointAliasName();
if (dbmeta.hasPrimaryKey()) {
final ColumnSqlName primaryKeyName = dbmeta.getPrimaryInfo().getFirstColumn().getColumnSqlName();
_lockSqlSuffix = " for update of " + basePointAliasName + "." + primaryKeyName;
} else {
final ColumnSqlName randomColumnName = ((ColumnInfo) dbmeta.getColumnInfoList().get(0)).getColumnSqlName();
_lockSqlSuffix = " for update of " + basePointAliasName + "." + randomColumnName;
}
}
Aggregations