use of org.dbflute.dbmeta.name.ColumnSqlName in project dbflute-core by dbflute.
the class SqlClauseMySql method buildMatchCondition.
// [DBFlute-0.9.5]
// ===================================================================================
// Full-Text Search
// ================
/**
* Build a condition string of match statement for full-text search. <br>
* Bind variable is unused because the condition value should be literal in MySQL.
* @param textColumnList The list of text column. (NotNull, NotEmpty, StringColumn, TargetTableColumn)
* @param conditionValue The condition value embedded without binding (by MySQL restriction) but escaped. (NotNull)
* @param modifier The modifier of full-text search. (NullAllowed: If the value is null, No modifier specified)
* @param tableDbName The DB name of the target table. (NotNull)
* @param aliasName The alias name of the target table. (NotNull)
* @return The condition string of match statement. (NotNull)
*/
public String buildMatchCondition(List<ColumnInfo> textColumnList, String conditionValue, FullTextSearchModifier modifier, String tableDbName, String aliasName) {
assertTextColumnList(textColumnList);
assertVariousTextSearchResource(conditionValue, modifier, tableDbName, aliasName);
final StringBuilder sb = new StringBuilder();
int index = 0;
for (ColumnInfo columnInfo : textColumnList) {
if (columnInfo == null) {
continue;
}
assertTextColumnTable(tableDbName, columnInfo);
assertTextColumnType(tableDbName, columnInfo);
final ColumnSqlName columnSqlName = columnInfo.getColumnSqlName();
if (index > 0) {
sb.append(",");
}
sb.append(aliasName).append(".").append(columnSqlName);
++index;
}
sb.insert(0, "match(").append(") against ('");
sb.append(escapeMatchConditionValue(conditionValue)).append("'");
if (modifier != null) {
sb.append(" ").append(modifier.code());
}
sb.append(")");
return sb.toString();
}
use of org.dbflute.dbmeta.name.ColumnSqlName in project dbflute-core by dbflute.
the class AbstractConditionQuery method doRegIQ.
protected void doRegIQ(ConditionKey key, Object value, ConditionValue cvalue, String columnDbName, ConditionOption option) {
if (!prepareQueryChecked(key, value, cvalue, columnDbName).newClause()) {
return;
}
final DBMeta dbmeta = xgetDBMetaProvider().provideDBMetaChecked(asTableDbName());
final ColumnInfo columnInfo = dbmeta.findColumnInfo(columnDbName);
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(xcreateQueryModeProvider(), cvalue, value, location, option);
final ColumnSqlName columnSqlName = columnInfo.getColumnSqlName();
final ColumnFunctionCipher cipher = xgetSqlClause().findColumnFunctionCipher(columnInfo);
if (isBaseQuery()) {
xgetSqlClause().registerBaseTableInlineWhereClause(columnSqlName, key, cvalue, cipher, option);
} else {
final String aliasName = xgetAliasName();
xgetSqlClause().registerOuterJoinInlineWhereClause(aliasName, columnSqlName, key, cvalue, cipher, option, _onClause);
}
}
use of org.dbflute.dbmeta.name.ColumnSqlName in project dbflute-core by dbflute.
the class HpCalcSpecification method buildStatementAsSqlName.
// ===================================================================================
// Statement
// =========
/**
* {@inheritDoc}
*/
public String buildStatementAsSqlName(String aliasName) {
// e.g. VaryingUpdate, VaryingQueryUdpate
final ColumnSqlName columnSqlName = getResolvedSpecifiedColumnSqlName();
if (columnSqlName == null) {
// very rare case, e.g. DreamCruise
String msg = "Specified column is not found or too many columns are specified: " + aliasName;
throw new IllegalConditionBeanOperationException(msg);
}
final String columnExp = (aliasName != null ? aliasName : "") + columnSqlName.toString();
final boolean removeCalcAlias = aliasName == null;
return doBuildStatement(columnExp, null, removeCalcAlias);
}
use of org.dbflute.dbmeta.name.ColumnSqlName in project dbflute-core by dbflute.
the class ConditionKey method resolveCompoundColumn.
protected ColumnRealName resolveCompoundColumn(ColumnRealName baseRealName, ConditionOption option) {
if (option == null || !option.hasCompoundColumn()) {
return baseRealName;
}
if (!option.hasStringConnector()) {
// basically no way
String msg = "The option should have string connector when compound column is specified: " + option;
throw new IllegalConditionBeanOperationException(msg);
}
final List<SpecifiedColumn> compoundColumnList = option.getCompoundColumnList();
final List<ColumnRealName> realNameList = new ArrayList<ColumnRealName>();
// already cipher
realNameList.add(doResolveCompoundColumnOption(option, baseRealName));
for (SpecifiedColumn specifiedColumn : compoundColumnList) {
realNameList.add(doResolveCompoundColumnOption(option, doResolveCompoundColumnCipher(option, specifiedColumn)));
}
final OnQueryStringConnector stringConnector = option.getStringConnector();
final String connected = stringConnector.connect(realNameList.toArray());
return ColumnRealName.create(null, new ColumnSqlName(connected));
}
use of org.dbflute.dbmeta.name.ColumnSqlName in project dbflute-core by dbflute.
the class TnAbstractPropertyTypeFactory method createPropertyType.
protected TnPropertyType createPropertyType(DfPropertyDesc propertyDesc) {
final ValueType valueType = getValueType(propertyDesc);
final String columnDbName = getColumnDbName(propertyDesc);
final ColumnSqlName columnSqlName = getColumnSqlName(columnDbName);
final ColumnInfo entityColumnInfo = getEntityColumnInfo(columnDbName);
return new TnPropertyTypeImpl(propertyDesc, valueType, columnDbName, columnSqlName, entityColumnInfo);
}
Aggregations