summaryrefslogtreecommitdiffstats
path: root/dbaccess
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2012-11-01 14:19:14 +0100
committerLionel Elie Mamane <lionel@mamane.lu>2012-11-02 10:54:12 +0100
commit10359585eb1fa338b686c288c1d3b3e0fe9fca66 (patch)
tree2ef2c81441026c718c258d19451f1d453e00eab3 /dbaccess
parentRetrieve CatalogName only once, too (diff)
downloadcore-10359585eb1fa338b686c288c1d3b3e0fe9fca66.tar.gz
core-10359585eb1fa338b686c288c1d3b3e0fe9fca66.zip
Columns should know their table
For example dbaccess::OSingleSelectQueryComposer::appendOrderByColumn expects it (via impl_getColumnName_throw via getTableAlias) There is some vagueness: Should the TableName property contain just the table name, or the *composed* table name (that is with catalog and/or schema if used by this DB)? In the case of a query, should it contain the table name (alias) *in* *the* *query* or of the original table? In the former case, what meaning do SchemaName and CatalogName have? They should be empty? For now, commit as such and deal with the fallout, if any, when it hits the fan. If we really need to store these *different* values, (that is, some code validly needs them) it would be easier / cleaner / ... to define *different* properties for these *different* notions. Change-Id: I032e619a60e7563cd51478db16cb5e0e5452bfde
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/api/definitioncolumn.cxx39
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx5
2 files changed, 30 insertions, 14 deletions
diff --git a/dbaccess/source/core/api/definitioncolumn.cxx b/dbaccess/source/core/api/definitioncolumn.cxx
index 7be166698494..e8e0acd063c9 100644
--- a/dbaccess/source/core/api/definitioncolumn.cxx
+++ b/dbaccess/source/core/api/definitioncolumn.cxx
@@ -44,10 +44,16 @@ using namespace ::comphelper;
using namespace ::osl;
using namespace dbaccess;
-#define HAS_DESCRIPTION 0x00000001
-#define HAS_DEFAULTVALUE 0x00000002
-#define HAS_ROWVERSION 0x00000004
-#define HAS_AUTOINCREMENT_CREATION 0x00000008
+namespace
+{
+ const sal_Int32 HAS_DESCRIPTION = 0x00000001;
+ const sal_Int32 HAS_DEFAULTVALUE = 0x00000002;
+ const sal_Int32 HAS_ROWVERSION = 0x00000004;
+ const sal_Int32 HAS_AUTOINCREMENT_CREATION = 0x00000008;
+ const sal_Int32 HAS_CATALOGNAME = 0x00000010;
+ const sal_Int32 HAS_SCHEMANAME = 0x00000020;
+ const sal_Int32 HAS_TABLENAME = 0x00000040;
+}
//============================================================
//= OTableColumnDescriptor
@@ -336,6 +342,9 @@ OColumnWrapper::OColumnWrapper( const Reference< XPropertySet > & rCol, const bo
m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_DEFAULTVALUE) ? HAS_DEFAULTVALUE : 0;
m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_ISROWVERSION) ? HAS_ROWVERSION : 0;
m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION) ? HAS_AUTOINCREMENT_CREATION : 0;
+ m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_CATALOGNAME) ? HAS_CATALOGNAME : 0;
+ m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_SCHEMANAME) ? HAS_SCHEMANAME : 0;
+ m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_TABLENAME) ? HAS_TABLENAME : 0;
m_xAggregate->getPropertyValue(PROPERTY_NAME) >>= m_sName;
}
@@ -445,15 +454,7 @@ Sequence< ::rtl::OUString > OTableColumnDescriptorWrapper::getSupportedServiceNa
const sal_Int32 nHaveAlways = 7;
// Which optional properties are contained?
- sal_Int32 nHaveOptionally = 0;
- if (nId & HAS_DESCRIPTION)
- ++nHaveOptionally;
- if (nId & HAS_DEFAULTVALUE)
- ++nHaveOptionally;
- if (nId & HAS_ROWVERSION)
- ++nHaveOptionally;
- if ( nId & HAS_AUTOINCREMENT_CREATION )
- ++nHaveOptionally;
+ const sal_Int32 nHaveOptionally (::std::bitset<7>(nId).count());
BEGIN_PROPERTY_SEQUENCE( nHaveAlways + nHaveOptionally )
@@ -481,6 +482,18 @@ Sequence< ::rtl::OUString > OTableColumnDescriptorWrapper::getSupportedServiceNa
{
DECL_PROP0_BOOL( ISROWVERSION );
}
+ if ( nId & HAS_CATALOGNAME )
+ {
+ DECL_PROP0( CATALOGNAME, ::rtl::OUString );
+ }
+ if ( nId & HAS_SCHEMANAME )
+ {
+ DECL_PROP0( SCHEMANAME, ::rtl::OUString );
+ }
+ if ( nId & HAS_TABLENAME )
+ {
+ DECL_PROP0( TABLENAME, ::rtl::OUString );
+ }
END_PROPERTY_SEQUENCE()
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index ebddbfc41813..13446b2d9c53 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -3085,7 +3085,10 @@ OSQLParseNode* OQueryDesignView::getPredicateTreeFromEntry(OTableFieldDescRef pE
nType,
sal_False,
sal_False,
- xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers());
+ xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers(),
+ ::rtl::OUString(),
+ ::rtl::OUString(),
+ ::rtl::OUString());
_rxColumn = pColumn;
pColumn->setFunction(sal_True);
pColumn->setRealName(pEntry->GetField());