summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2012-06-06 14:28:50 +0200
committerLionel Elie Mamane <lionel@mamane.lu>2012-06-06 14:52:04 +0200
commitb679dd69c0ebc1e8f4a3e85a2ef39c6a68a814f5 (patch)
treef7e1b8855185cc2fd234051d285eb4eabe862000 /wizards
parente08b4b98c35a5e314c35e24174f31aaaa6950064 (diff)
legacy reports: unify treatment of query and table
In *both* cases, the value of hidden control "Sorting" (if non-empty) decides the columns being sorted on. Change-Id: I7f4b50c3af8c12e48e5dedd36b5877ad7a9e1b66
Diffstat (limited to 'wizards')
-rw-r--r--wizards/com/sun/star/wizards/report/ReportTextImplementation.java25
1 files changed, 17 insertions, 8 deletions
diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
index 6be5b36982ce..937d9f271bd9 100644
--- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
+++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
@@ -264,7 +264,8 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
}
getRecordParser().setRecordFieldNames(sNewList);
getRecordParser().GroupFieldNames = JavaTools.ArrayoutofString(sGroupFieldNames, PropertyNames.SEMI_COLON);
- getRecordParser().setCommandType(Integer.valueOf(sCommandType).intValue());
+ int nOrigCommandType = Integer.valueOf(sCommandType).intValue();
+ getRecordParser().setCommandType(nOrigCommandType);
sMsgQueryCreationImpossible = JavaTools.replaceSubString(sMsgQueryCreationImpossible, getRecordParser().Command, "<STATEMENT>");
bgetConnection = getRecordParser().getConnection(_properties);
@@ -278,8 +279,6 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
if (getRecordParser().hasEscapeProcessing(oCommand.getPropertySet()))
{
getRecordParser().Command = (String) oCommand.getPropertySet().getPropertyValue(PropertyNames.COMMAND);
- getRecordParser().getSQLQueryComposer().m_xQueryAnalyzer.setQuery(getRecordParser().Command);
- getRecordParser().Command = getRecordParser().getSQLQueryComposer().getQuery();
}
else
{
@@ -291,14 +290,24 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
bexecute = getRecordParser().executeCommand(nCommandType); //sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot, sFieldNameList, true);
if (bexecute)
{
- DBMetaData.CommandObject oCommand = getRecordParser().getQueryByName(sQueryName);
bexecute = getRecordParser().getFields(sFieldNameList, true);
- if (bexecute && getRecordParser().hasEscapeProcessing(oCommand.getPropertySet()))
+
+ boolean addSort = true;
+ if ( (nOrigCommandType == CommandType.QUERY) && !sQueryName.equals(PropertyNames.EMPTY_STRING) )
{
- getRecordParser().getSQLQueryComposer().prependSortingCriteria();
- getRecordParser().Command = getRecordParser().getSQLQueryComposer().getQuery();
- bexecute = getRecordParser().executeCommand(nCommandType);
+ DBMetaData.CommandObject oCommand = getRecordParser().getQueryByName(sQueryName);
+ if (!getRecordParser().hasEscapeProcessing(oCommand.getPropertySet()))
+ addSort = false;
}
+ if ( !(addSort && bexecute) )
+ {
+ return bexecute;
+ }
+ getRecordParser().getSQLQueryComposer().m_xQueryAnalyzer.setQuery(getRecordParser().Command);
+ getRecordParser().getSQLQueryComposer().prependSortingCriteria();
+ getRecordParser().Command = getRecordParser().getSQLQueryComposer().getQuery();
+
+ bexecute = getRecordParser().executeCommand(nCommandType);
}
return bexecute;
}