With a PostgreSQL-SDBC database, Base query design does not allow the
user to use groupings and aggregate functions.
Change PostgreSQL-SDBC so that it declares to support Core SQL.
Please apply to libreoffice-3-5
See dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
OSelectionBrowseBox::initialize
if ( lcl_SupportsCoreSQLGrammar(xConnection) )
{
xub_StrLen nCount = m_aFunctionStrings.GetTokenCount();
for (xub_StrLen nIdx = 0; nIdx < nCount; nIdx++)
m_pFunctionCell->InsertEntry(m_aFunctionStrings.GetToken(nIdx));
}
where m_aFunctionStrings has been prepopulated by:
IParseContext::InternationalKeyCode eFunctions[] = {
IParseContext::KEY_AVG,IParseContext::KEY_COUNT,IParseContext::KEY_MAX
,IParseContext::KEY_MIN,IParseContext::KEY_SUM
,IParseContext::KEY_EVERY
,IParseContext::KEY_ANY
,IParseContext::KEY_SOME
,IParseContext::KEY_STDDEV_POP
,IParseContext::KEY_STDDEV_SAMP
,IParseContext::KEY_VAR_SAMP
,IParseContext::KEY_VAR_POP
,IParseContext::KEY_COLLECT
,IParseContext::KEY_FUSION
,IParseContext::KEY_INTERSECTION
};
for (size_t i = 0; i < SAL_N_ELEMENTS(eFunctions); ++i)
{
m_aFunctionStrings += String(RTL_CONSTASCII_USTRINGPARAM(";"));
m_aFunctionStrings +=
String(ByteString(rContext.getIntlKeywordAscii(eFunctions[i])),RTL_TEXTENCODING_UTF8);
}
and also
OSelectionBrowseBox::setFunctionCell:
if ( xConnection.is() )
{
// Diese Funktionen stehen nur unter CORE zur Verf�gung
}
else
{
// nur COUNT(*) erlaubt
}
--
Lionel
>From c6955a3b9cff116310392be9bf280aea1dd9eac5 Mon Sep 17 00:00:00 2001
From: Lionel Elie Mamane <[email protected]>
Date: Thu, 9 Feb 2012 18:34:04 +0100
Subject: [PATCH] fdo#45249 declare support for Core SQL -> Base allows user
aggregate functions
---
.../drivers/postgresql/pq_databasemetadata.cxx | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
index 7170ff6..9821f3a 100644
--- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
@@ -725,7 +725,12 @@ sal_Bool DatabaseMetaData::supportsMinimumSQLGrammar( ) throw (SQLException, Ru
sal_Bool DatabaseMetaData::supportsCoreSQLGrammar( ) throw (SQLException, RuntimeException)
{
// LEM: jdbc driver says not, although the comments in it seem old
- return sal_False;
+ // fdo#45249 Base query design won't use any aggregate function
+ // (except COUNT(*) unless we say yes, so say yes.
+ // Actually, Base assumes *also* support for aggregate functions "collect, fusion, intersection"
+ // as soon as supportsCoreSQLGrammar() returns true.
+ // Those are *not* Core SQL, though. They are in optional feature S271 "Basic multiset support"
+ return sal_True;
}
sal_Bool DatabaseMetaData::supportsExtendedSQLGrammar( ) throw (SQLException, RuntimeException)
--
1.7.7.3
_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice