base new query wizard: fix confusion between display name and field name
Change-Id: I75354ffea2daede55b34e4cf3321d57196be3d9b
This commit is contained in:
@@ -77,7 +77,7 @@ public class SQLQueryComposer
|
|||||||
int iAggregate = CurDBMetaData.getAggregateIndex(CurDBMetaData.FieldColumns[i].getDisplayFieldName());
|
int iAggregate = CurDBMetaData.getAggregateIndex(CurDBMetaData.FieldColumns[i].getDisplayFieldName());
|
||||||
if (iAggregate > -1)
|
if (iAggregate > -1)
|
||||||
{
|
{
|
||||||
sSelectClause += CurDBMetaData.AggregateFieldNames[iAggregate][1] + "(" + getComposedAliasFieldName(CurDBMetaData.AggregateFieldNames[iAggregate][0]) + ")";
|
sSelectClause += CurDBMetaData.AggregateFieldNames[iAggregate][1] + "(" + getComposedAliasDisplayName(CurDBMetaData.AggregateFieldNames[iAggregate][0]) + ")";
|
||||||
if (_baddAliasFieldNames)
|
if (_baddAliasFieldNames)
|
||||||
{
|
{
|
||||||
sSelectClause += getAliasFieldNameClause(CurDBMetaData.AggregateFieldNames[iAggregate][0]);
|
sSelectClause += getAliasFieldNameClause(CurDBMetaData.AggregateFieldNames[iAggregate][0]);
|
||||||
@@ -85,7 +85,7 @@ public class SQLQueryComposer
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sSelectClause += getComposedAliasFieldName(CurDBMetaData.FieldColumns[i].getDisplayFieldName());
|
sSelectClause += getComposedAliasDisplayName(CurDBMetaData.FieldColumns[i].getDisplayFieldName());
|
||||||
if (_baddAliasFieldNames)
|
if (_baddAliasFieldNames)
|
||||||
{
|
{
|
||||||
sSelectClause += getAliasFieldNameClause(CurDBMetaData.FieldColumns[i].getDisplayFieldName());
|
sSelectClause += getAliasFieldNameClause(CurDBMetaData.FieldColumns[i].getDisplayFieldName());
|
||||||
@@ -181,7 +181,7 @@ public class SQLQueryComposer
|
|||||||
{
|
{
|
||||||
sOrder += ", ";
|
sOrder += ", ";
|
||||||
}
|
}
|
||||||
sOrder += CurDBMetaData.AggregateFieldNames[iAggregate][1] + "(" + getComposedAliasFieldName(CurDBMetaData.AggregateFieldNames[iAggregate][0]) + ")";
|
sOrder += CurDBMetaData.AggregateFieldNames[iAggregate][1] + "(" + getComposedAliasDisplayName(CurDBMetaData.AggregateFieldNames[iAggregate][0]) + ")";
|
||||||
sOrder += " " + CurDBMetaData.getSortFieldNames()[i][1];
|
sOrder += " " + CurDBMetaData.getSortFieldNames()[i][1];
|
||||||
m_queryComposer.setOrder(sOrder);
|
m_queryComposer.setOrder(sOrder);
|
||||||
}
|
}
|
||||||
@@ -307,7 +307,7 @@ public class SQLQueryComposer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getComposedAliasFieldName(String _fieldname)
|
private String getComposedAliasDisplayName(String _fieldname)
|
||||||
{
|
{
|
||||||
FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByDisplayName(_fieldname);
|
FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByDisplayName(_fieldname);
|
||||||
final String curCommandName = CurFieldColumn.getCommandName();
|
final String curCommandName = CurFieldColumn.getCommandName();
|
||||||
@@ -325,6 +325,24 @@ public class SQLQueryComposer
|
|||||||
return quoteName(curAliasName) + "." + quoteName(curFieldName);
|
return quoteName(curAliasName) + "." + quoteName(curFieldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getComposedAliasFieldName(String _fieldname)
|
||||||
|
{
|
||||||
|
FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByFieldName(_fieldname);
|
||||||
|
final String curCommandName = CurFieldColumn.getCommandName();
|
||||||
|
final String curFieldName = CurFieldColumn.getFieldName();
|
||||||
|
CommandName curComposedCommandName = getComposedCommandByDisplayName(curCommandName);
|
||||||
|
if (curComposedCommandName == null)
|
||||||
|
{
|
||||||
|
//return _fieldname;
|
||||||
|
if ( curCommandName.length() > 0 )
|
||||||
|
return quoteName(curCommandName) + "." + quoteName(curFieldName);
|
||||||
|
else
|
||||||
|
return quoteName(curFieldName);
|
||||||
|
}
|
||||||
|
String curAliasName = curComposedCommandName.getAliasName();
|
||||||
|
return quoteName(curAliasName) + "." + quoteName(curFieldName);
|
||||||
|
}
|
||||||
|
|
||||||
private CommandName getComposedCommandByAliasName(String _AliasName)
|
private CommandName getComposedCommandByAliasName(String _AliasName)
|
||||||
{
|
{
|
||||||
if (composedCommandNames != null)
|
if (composedCommandNames != null)
|
||||||
|
@@ -119,7 +119,7 @@ public class FilterComponent
|
|||||||
String sControlNameSuffix = sIncSuffix + "_" + getIndexNumber(sControlName);
|
String sControlNameSuffix = sIncSuffix + "_" + getIndexNumber(sControlName);
|
||||||
XListBox xCurFieldListBox = UnoRuntime.queryInterface(XListBox.class, CurUnoDialog.xDlgContainer.getControl(sControlName));
|
XListBox xCurFieldListBox = UnoRuntime.queryInterface(XListBox.class, CurUnoDialog.xDlgContainer.getControl(sControlName));
|
||||||
String CurDisplayFieldName = xCurFieldListBox.getSelectedItem();
|
String CurDisplayFieldName = xCurFieldListBox.getSelectedItem();
|
||||||
FieldColumn CurFieldColumn = new FieldColumn(oQueryMetaData, CurDisplayFieldName);
|
FieldColumn CurFieldColumn = oQueryMetaData.getFieldColumnByDisplayName(CurDisplayFieldName);
|
||||||
|
|
||||||
String sControlNameTextValue = "txtValue" + sControlNameSuffix;
|
String sControlNameTextValue = "txtValue" + sControlNameSuffix;
|
||||||
XControl xValueControl = CurUnoDialog.xDlgContainer.getControl(sControlNameTextValue);
|
XControl xValueControl = CurUnoDialog.xDlgContainer.getControl(sControlNameTextValue);
|
||||||
@@ -303,7 +303,7 @@ public class FilterComponent
|
|||||||
String FieldName;
|
String FieldName;
|
||||||
if (_CurDBMetaData != null)
|
if (_CurDBMetaData != null)
|
||||||
{
|
{
|
||||||
FieldColumn CurDBFieldColumn = _CurDBMetaData.getFieldColumnByDisplayName(_filtercondition.Name);
|
FieldColumn CurDBFieldColumn = _CurDBMetaData.getFieldColumnByFieldName(_filtercondition.Name);
|
||||||
FieldName = CurDBFieldColumn.getFieldTitle();
|
FieldName = CurDBFieldColumn.getFieldTitle();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user