use of org.dbflute.dbmeta.info.ColumnInfo in project dbflute-core by dbflute.
the class AbstractConditionQuery method registerOrderBy.
// ===================================================================================
// Order By
// ========
// -----------------------------------------------------
// Basic
// -----
protected void registerOrderBy(String columnDbName, boolean ascOrDesc) {
final DBMeta dbmeta = xgetLocalDBMeta();
final ColumnInfo columnInfo = dbmeta.findColumnInfo(columnDbName);
final ColumnRealName columnRealName = toColumnRealName(columnInfo);
xgetSqlClause().registerOrderBy(columnRealName.toString(), ascOrDesc, columnInfo);
}
use of org.dbflute.dbmeta.info.ColumnInfo in project dbflute-core by dbflute.
the class AbstractConditionQuery method xdoMatchByLikeSearch.
// -----------------------------------------------------
// PostgreSQL/Oracle
// -----------------
protected void xdoMatchByLikeSearch(List<ColumnInfo> textColumnList, String conditionValue) {
if (conditionValue == null || conditionValue.length() == 0) {
return;
}
assertObjectNotNull("textColumnList", textColumnList);
if (textColumnList.isEmpty()) {
String msg = "The argument 'textColumnList' should not be empty list.";
throw new IllegalArgumentException(msg);
}
conditionValue = xescapeFullTextSearchValue(conditionValue);
xgetSqlClause().beginOrScopeQuery();
try {
for (ColumnInfo columnInfo : textColumnList) {
if (columnInfo == null) {
continue;
}
final String tableOfColumn = columnInfo.getDBMeta().getTableDbName();
if (!tableOfColumn.equalsIgnoreCase(asTableDbName())) {
String msg = "The table of the text column should be '" + asTableDbName() + "'";
msg = msg + " but the table is '" + tableOfColumn + "': column=" + columnInfo;
throw new IllegalArgumentException(msg);
}
if (!columnInfo.isObjectNativeTypeString()) {
String msg = "The text column should be String type:";
msg = msg + " column=" + columnInfo;
throw new IllegalArgumentException(msg);
}
invokeQueryLikeSearch(columnInfo.getColumnDbName(), conditionValue, xcreateMatchLikeSearch());
}
} finally {
xgetSqlClause().endOrScopeQuery();
}
}
use of org.dbflute.dbmeta.info.ColumnInfo in project dbflute-core by dbflute.
the class AbstractConditionQuery method xregOutJo.
protected void xregOutJo(String prop) {
// should be called after registration
if (_queryRelationKeepingMap == null) {
// no way, just in case
_queryRelationKeepingMap = newLinkedHashMapSized(4);
}
final ConditionQuery cq = _queryRelationKeepingMap.get(prop);
if (cq == null) {
// no way, just in case
String msg = "Not found the condition-query for (Query)Relation: " + prop;
throw new IllegalStateException(msg);
}
final ForeignInfo foreignInfo = xgetLocalDBMeta().findForeignInfo(prop);
final Map<ColumnInfo, ColumnInfo> localForeignColMap = foreignInfo.getLocalForeignColumnInfoMap();
final Map<String, String> joinOnMap = newLinkedHashMapSized(localForeignColMap.size());
for (Entry<ColumnInfo, ColumnInfo> entry : localForeignColMap.entrySet()) {
final ColumnInfo localCol = entry.getKey();
final ColumnInfo foreignCol = entry.getValue();
joinOnMap.put(localCol.getColumnDbName(), foreignCol.getColumnDbName());
}
registerOuterJoin(cq, joinOnMap, prop);
}
use of org.dbflute.dbmeta.info.ColumnInfo in project dbflute-core by dbflute.
the class AbstractConditionQuery method setupConditionValueAndRegisterWhereClause.
protected void setupConditionValueAndRegisterWhereClause(ConditionKey key, Object value, ConditionValue cvalue, String columnDbName, ConditionOption option) {
final DBMeta dbmeta = xgetLocalDBMeta();
final ColumnInfo columnInfo = dbmeta.findColumnInfo(columnDbName);
final QueryModeProvider queryModeProvider = xcreateQueryModeProvider();
final Object filtered = filterConditionValueIfNeeds(key, value, cvalue, columnDbName, option, columnInfo);
final String propertyName = columnInfo.getPropertyName();
final String uncapPropName = initUncap(propertyName);
// if Java, it is necessary to use uncapPropName
final String location = xgetLocation(uncapPropName);
key.setupConditionValue(queryModeProvider, cvalue, filtered, location, option);
final ColumnRealName columnRealName = toColumnRealName(columnDbName);
final ColumnFunctionCipher cipher = xgetSqlClause().findColumnFunctionCipher(columnInfo);
final String usedAliasName = xgetAliasName();
xgetSqlClause().registerWhereClause(columnRealName, key, cvalue, cipher, option, usedAliasName);
}
use of org.dbflute.dbmeta.info.ColumnInfo in project dbflute-core by dbflute.
the class AbstractConditionQuery method xcreateInvalidQueryInfo.
protected HpInvalidQueryInfo xcreateInvalidQueryInfo(ConditionKey key, Object value, String columnDbName) {
final String locationBase = xgetLocationBase();
final ColumnInfo targetColumn = xgetLocalDBMeta().findColumnInfo(columnDbName);
final HpInvalidQueryInfo invalidQueryInfo = new HpInvalidQueryInfo(locationBase, targetColumn, key, value);
if (_inline) {
invalidQueryInfo.inlineView();
} else if (_onClause) {
invalidQueryInfo.onClause();
}
return invalidQueryInfo;
}
Aggregations