Hello,

Here is a patch for the mentioned bug, actually the problem mentioned in
the bug info was just the minority, wizard didn't work for all the
queries where I wanted to sort by an aggregate field. I did several
tries,and it seems to be ok now, however without "group by" in an
aggregate query it seems to be silly to sort by anything, I must notice
Oracle even handles it as an error, it seems that for HSQL it's not a
problem. Please review the patch and push it to git.

Thanks,

Gabor
>From 3210fcf363e242ecca3bfca686ef9b8ac91305ee Mon Sep 17 00:00:00 2001
From: Gabor Jenei <jen...@elte.hu>
Date: Fri, 12 Aug 2011 10:15:24 +0200
Subject: [PATCH] Bug 38486 SQL fix

---
 .../com/sun/star/wizards/db/SQLQueryComposer.java  |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java
index a6d2c2b..3f595f2 100644
--- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java
+++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java
@@ -205,7 +205,7 @@ public class SQLQueryComposer
                 {
                     sOrder += ", ";
                 }
-                sOrder += CurDBMetaData.AggregateFieldNames[iAggregate][1] + "(" + CurDBMetaData.AggregateFieldNames[iAggregate][0] + ")";
+                sOrder += CurDBMetaData.AggregateFieldNames[iAggregate][1] + "(" + getComposedAliasFieldName(CurDBMetaData.AggregateFieldNames[iAggregate][0]) + ")";
                 sOrder += " " + CurDBMetaData.getSortFieldNames()[i][1];
                 m_queryComposer.setOrder(sOrder);
             }
-- 
1.7.2.5

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to