summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbaccess/source/ui/dlg/DriverSettings.cxx52
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.cxx27
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.hxx3
-rw-r--r--dbaccess/source/ui/dlg/datasourceui.cxx100
-rw-r--r--dbaccess/source/ui/dlg/datasourceui.hxx80
-rw-r--r--dbaccess/source/ui/dlg/makefile.mk1
-rw-r--r--dbaccess/source/ui/inc/dsitems.hxx (renamed from dbaccess/source/ui/dlg/dsitems.hxx)2
-rw-r--r--dbaccess/source/ui/inc/dsmeta.hxx117
-rw-r--r--dbaccess/source/ui/misc/dsmeta.cxx147
9 files changed, 145 insertions, 384 deletions
diff --git a/dbaccess/source/ui/dlg/DriverSettings.cxx b/dbaccess/source/ui/dlg/DriverSettings.cxx
index fda1b37063e7..4977658daeac 100644
--- a/dbaccess/source/ui/dlg/DriverSettings.cxx
+++ b/dbaccess/source/ui/dlg/DriverSettings.cxx
@@ -32,13 +32,13 @@
#include "precompiled_dbaccess.hxx"
#include "DriverSettings.hxx"
-#include "dsitems.hxx"
-#include "datasourceui.hxx"
-#include <connectivity/DriversConfig.hxx>
+#include "dsmeta.hxx"
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/beans/NamedValue.hpp>
+#include <connectivity/DriversConfig.hxx>
+
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::beans::NamedValue;
@@ -47,35 +47,23 @@ void ODriversSettings::getSupportedIndirectSettings( const ::rtl::OUString& _sUR
{
// for a number of settings, we do not need to use hard-coded here, but can ask a
// central DataSourceUI instance.
- // TODO: isn't DataSourceUI obsolete, now that this is in the configuration?
- DataSourceMetaData aMeta(_sURLPrefix);
- DataSourceUI aDSUI( aMeta );
- const USHORT nGenericKnownSettings[] =
+ DataSourceMetaData aMeta( _sURLPrefix );
+ const FeatureSet& rFeatures( aMeta.getFeatureSet() );
+ for ( FeatureSet::const_iterator feature = rFeatures.begin();
+ feature != rFeatures.end();
+ ++feature
+ )
{
- DSID_SQL92CHECK,
- DSID_APPEND_TABLE_ALIAS,
- DSID_AS_BEFORE_CORRNAME,
- DSID_ENABLEOUTERJOIN,
- DSID_IGNOREDRIVER_PRIV,
- DSID_PARAMETERNAMESUBST,
- DSID_SUPPRESSVERSIONCL,
- DSID_CATALOG,
- DSID_SCHEMA,
- DSID_INDEXAPPENDIX,
- DSID_CHECK_REQUIRED_FIELDS,
- DSID_AUTORETRIEVEENABLED,
- DSID_AUTOINCREMENTVALUE,
- DSID_AUTORETRIEVEVALUE,
- DSID_BOOLEANCOMPARISON,
- DSID_ESCAPE_DATETIME,
- DSID_PRIMARY_KEY_SUPPORT,
- 0
- };
- for ( const USHORT* pGenericKnowSetting = nGenericKnownSettings; *pGenericKnowSetting; ++pGenericKnowSetting )
- if ( aDSUI.hasSetting( *pGenericKnowSetting ) )
- _out_rDetailsIds.push_back( *pGenericKnowSetting );
+ _out_rDetailsIds.push_back( *feature );
+ }
// the rest is configuration-based
+ // TODO: that's not really true: *everything* is configuration-based nowadays, even the FeatureSet obtained
+ // from the DataSourceMetaData has been initialized from the configuration. So in fact, we could consolidate
+ // the two blocks.
+ // The best approach would be to extend the FeatureSet to contain *all* known data source features, not only
+ // the ones from the "Advanced settings" UI.
+
::connectivity::DriversConfig aDriverConfig(_xFactory);
const ::comphelper::NamedValueCollection& aProperties = aDriverConfig.getProperties(_sURLPrefix);
#if OSL_DEBUG_LEVEL > 0
@@ -118,7 +106,11 @@ void ODriversSettings::getSupportedIndirectSettings( const ::rtl::OUString& _sUR
,TProperties(0,::rtl::OUString())
};
// TODO: This mapping between IDs and property names already exists - in ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper.
- // We should not duplicate it here.
+ // Another mapping (which is also duplicated in ODbDataSourceAdministrationHelper) exists in dsmeta.cxx. We should
+ // consolidate those three places into one.
+ // However, care has to be taken: We need to distinguish between "features" and "properties" of a data source (resp. driver).
+ // That is, a driver can support a certain property, but not allow to change it in the UI, which means it would
+ // not have the respective "feature".
for ( TProperties* pProps = aProps; pProps->first; ++pProps )
{
if ( aProperties.has(pProps->second) )
diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx
index 1f6faa969908..de429d1ea4b2 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.cxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.cxx
@@ -37,7 +37,6 @@
#include "dsitems.hxx"
#include "DbAdminImpl.hxx"
#include "DriverSettings.hxx"
-#include "datasourceui.hxx"
#include "optionalboolitem.hxx"
#include "dbu_resource.hrc"
#include "dbu_dlg.hrc"
@@ -103,11 +102,11 @@ namespace dbaui
,m_pBooleanComparisonMode( NULL )
,m_aControlDependencies()
,m_aBooleanSettings()
- ,m_aSupported( _rDSMeta.getAdvancedSettingsSupport() )
+ ,m_bHasBooleanComparisonMode( _rDSMeta.getFeatureSet().has( DSID_BOOLEANCOMPARISON ) )
{
impl_initBooleanSettings();
- DataSourceUI aDSUI( _rDSMeta );
+ const FeatureSet& rFeatures( _rDSMeta.getFeatureSet() );
// create all the check boxes for the boolean settings
for ( BooleanSettingDescs::const_iterator setting = m_aBooleanSettings.begin();
setting != m_aBooleanSettings.end();
@@ -115,7 +114,7 @@ namespace dbaui
)
{
USHORT nItemId = setting->nItemId;
- if ( aDSUI.hasSetting( nItemId ) )
+ if ( rFeatures.has( nItemId ) )
{
USHORT nResourceId = setting->nControlResId;
(*setting->ppControl) = new CheckBox( this, ModuleRes( nResourceId ) );
@@ -154,7 +153,7 @@ namespace dbaui
}
// create the controls for the boolean comparison mode
- if ( m_aSupported.bBooleanComparisonMode )
+ if ( m_bHasBooleanComparisonMode )
{
m_pBooleanComparisonModeLabel = new FixedText( this, ModuleRes( FT_BOOLEANCOMPARISON ) );
m_pBooleanComparisonMode = new ListBox( this, ModuleRes( LB_BOOLEANCOMPARISON ) );
@@ -230,7 +229,7 @@ namespace dbaui
// -----------------------------------------------------------------------
void SpecialSettingsPage::fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList )
{
- if ( m_aSupported.bBooleanComparisonMode )
+ if ( m_bHasBooleanComparisonMode )
{
_rControlList.push_back( new ODisableWrapper< FixedText >( m_pBooleanComparisonModeLabel ) );
}
@@ -250,7 +249,7 @@ namespace dbaui
}
}
- if ( m_aSupported.bBooleanComparisonMode )
+ if ( m_bHasBooleanComparisonMode )
_rControlList.push_back( new OSaveValueWrapper< ListBox >( m_pBooleanComparisonMode ) );
}
@@ -304,7 +303,7 @@ namespace dbaui
}
// the non-boolean items
- if ( m_aSupported.bBooleanComparisonMode )
+ if ( m_bHasBooleanComparisonMode )
{
SFX_ITEMSET_GET( _rSet, pBooleanComparison, SfxInt32Item, DSID_BOOLEANCOMPARISON, sal_True );
m_pBooleanComparisonMode->SelectEntryPos( static_cast< USHORT >( pBooleanComparison->GetValue() ) );
@@ -330,7 +329,7 @@ namespace dbaui
}
// the non-boolean items
- if ( m_aSupported.bBooleanComparisonMode )
+ if ( m_bHasBooleanComparisonMode )
{
if ( m_pBooleanComparisonMode->GetSelectEntryPos() != m_pBooleanComparisonMode->GetSavedValue() )
{
@@ -445,14 +444,14 @@ namespace dbaui
const ::rtl::OUString eType = m_pImpl->getDatasourceType(*_pItems);
DataSourceMetaData aMeta( eType );
- const AdvancedSettingsSupport& rAdvancedSupport( aMeta.getAdvancedSettingsSupport() );
+ const FeatureSet& rFeatures( aMeta.getFeatureSet() );
// auto-generated values?
- if ( rAdvancedSupport.bGeneratedValues )
+ if ( rFeatures.supportsGeneratedValues() )
AddTabPage( PAGE_GENERATED_VALUES, String( ModuleRes( STR_GENERATED_VALUE ) ), ODriversSettings::CreateGeneratedValuesPage, NULL );
// any "special settings"?
- if ( rAdvancedSupport.supportsAnySpecialSetting() )
+ if ( rFeatures.supportsAnySpecialSetting() )
AddTabPage( PAGE_ADVANCED_SETTINGS_SPECIAL, String( ModuleRes( STR_DS_BEHAVIOUR ) ), ODriversSettings::CreateSpecialSettingsPage, NULL );
// remove the reset button - it's meaning is much too ambiguous in this dialog
@@ -471,8 +470,8 @@ namespace dbaui
bool AdvancedSettingsDialog::doesHaveAnyAdvancedSettings( const ::rtl::OUString& _sURL )
{
DataSourceMetaData aMeta( _sURL );
- const AdvancedSettingsSupport& rSupport( aMeta.getAdvancedSettingsSupport() );
- if ( rSupport.bGeneratedValues || rSupport.supportsAnySpecialSetting() )
+ const FeatureSet& rFeatures( aMeta.getFeatureSet() );
+ if ( rFeatures.supportsGeneratedValues() || rFeatures.supportsAnySpecialSetting() )
return true;
return false;
}
diff --git a/dbaccess/source/ui/dlg/advancedsettings.hxx b/dbaccess/source/ui/dlg/advancedsettings.hxx
index ebe364592836..8145db32c4e2 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.hxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.hxx
@@ -84,8 +84,7 @@ namespace dbaui
BooleanSettingDescs m_aBooleanSettings;
- AdvancedSettingsSupport
- m_aSupported;
+ bool m_bHasBooleanComparisonMode;
public:
virtual BOOL FillItemSet ( SfxItemSet& _rCoreAttrs );
diff --git a/dbaccess/source/ui/dlg/datasourceui.cxx b/dbaccess/source/ui/dlg/datasourceui.cxx
deleted file mode 100644
index 129ef3b9702e..000000000000
--- a/dbaccess/source/ui/dlg/datasourceui.cxx
+++ /dev/null
@@ -1,100 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: datasourceui.cxx,v $
- * $Revision: 1.5.68.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "datasourceui.hxx"
-#include "dsmeta.hxx"
-#include "dsitems.hxx"
-
-/** === begin UNO includes === **/
-/** === end UNO includes === **/
-
-//........................................................................
-namespace dbaui
-{
-//........................................................................
-
- /** === begin UNO using === **/
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::RuntimeException;
- /** === end UNO using === **/
-
- //====================================================================
- //= DataSourceUI
- //====================================================================
- //--------------------------------------------------------------------
- DataSourceUI::DataSourceUI( const DataSourceMetaData& _rDSMeta )
- :m_aDSMeta( _rDSMeta )
- {
- }
-
- //--------------------------------------------------------------------
- DataSourceUI::~DataSourceUI()
- {
- }
-
- //--------------------------------------------------------------------
- bool DataSourceUI::hasSetting( const USHORT _nItemId ) const
- {
- const AdvancedSettingsSupport& rAdvancedSupport( m_aDSMeta.getAdvancedSettingsSupport() );
-
- switch ( _nItemId )
- {
- case DSID_SQL92CHECK: return rAdvancedSupport.bUseSQL92NamingConstraints;
- case DSID_APPEND_TABLE_ALIAS: return rAdvancedSupport.bAppendTableAliasInSelect;
- case DSID_AS_BEFORE_CORRNAME: return rAdvancedSupport.bUseKeywordAsBeforeAlias;
- case DSID_ENABLEOUTERJOIN: return rAdvancedSupport.bUseBracketedOuterJoinSyntax;
- case DSID_IGNOREDRIVER_PRIV: return rAdvancedSupport.bIgnoreDriverPrivileges;
- case DSID_PARAMETERNAMESUBST: return rAdvancedSupport.bParameterNameSubstitution;
- case DSID_SUPPRESSVERSIONCL: return rAdvancedSupport.bDisplayVersionColumns;
- case DSID_CATALOG: return rAdvancedSupport.bUseCatalogInSelect;
- case DSID_SCHEMA: return rAdvancedSupport.bUseSchemaInSelect;
- case DSID_INDEXAPPENDIX: return rAdvancedSupport.bUseIndexDirectionKeyword;
- case DSID_DOSLINEENDS: return rAdvancedSupport.bUseDOSLineEnds;
- case DSID_BOOLEANCOMPARISON: return rAdvancedSupport.bBooleanComparisonMode;
- case DSID_CHECK_REQUIRED_FIELDS:return rAdvancedSupport.bFormsCheckRequiredFields;
- case DSID_AUTORETRIEVEENABLED: return rAdvancedSupport.bGeneratedValues;
- case DSID_AUTOINCREMENTVALUE: return rAdvancedSupport.bGeneratedValues;
- case DSID_AUTORETRIEVEVALUE: return rAdvancedSupport.bGeneratedValues;
- case DSID_IGNORECURRENCY: return rAdvancedSupport.bIgnoreCurrency;
- case DSID_ESCAPE_DATETIME: return rAdvancedSupport.bEscapeDateTime;
- case DSID_PRIMARY_KEY_SUPPORT: return rAdvancedSupport.bPrimaryKeySupport;
- }
-
- OSL_ENSURE( false, "DataSourceUI::hasSetting: this item id is currently not supported!" );
- // Support for *all* items is a medium-term goal only.
- return false;
- }
-
-//........................................................................
-} // namespace dbaui
-//........................................................................
diff --git a/dbaccess/source/ui/dlg/datasourceui.hxx b/dbaccess/source/ui/dlg/datasourceui.hxx
deleted file mode 100644
index 4ea63439c0d5..000000000000
--- a/dbaccess/source/ui/dlg/datasourceui.hxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: datasourceui.hxx,v $
- * $Revision: 1.3.68.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef DBACCESS_DATASOURCEUI_HXX
-#define DBACCESS_DATASOURCEUI_HXX
-
-#include "dsntypes.hxx"
-#include "dsmeta.hxx"
-
-/** === begin UNO includes === **/
-/** === end UNO includes === **/
-
-#include <boost/shared_ptr.hpp>
-
-//........................................................................
-namespace dbaui
-{
-//........................................................................
-
- //====================================================================
- //= DataSourceUI
- //====================================================================
- /** encapsulates information about available UI features of a data source type
- */
- class DataSourceUI
- {
- public:
- DataSourceUI( const DataSourceMetaData& _rDSMeta );
- ~DataSourceUI();
-
- /** returns whether the data source's UI contains the specified setting
-
- Note that at the moment, not all items are supported by this method. In particular, use
- it for the following only
- <ul><li>All items which refer to advanced settings (see AdvancedSettingsSupport)</li>
- </ul>
-
- A complete support of *all* items is a medium-term goal.
-
- @param _nItemId
- the UI's item ID for the setting in question. See dsitems.hxx.
- */
- bool hasSetting( const USHORT _nItemId ) const;
-
- private:
- DataSourceMetaData m_aDSMeta;
- };
-
-//........................................................................
-} // namespace dbaui
-//........................................................................
-
-#endif // DBACCESS_DATASOURCEUI_HXX
diff --git a/dbaccess/source/ui/dlg/makefile.mk b/dbaccess/source/ui/dlg/makefile.mk
index 71cc69216dae..2ec59f3d7840 100644
--- a/dbaccess/source/ui/dlg/makefile.mk
+++ b/dbaccess/source/ui/dlg/makefile.mk
@@ -124,7 +124,6 @@ EXCEPTIONSFILES= \
$(SLO)$/DriverSettings.obj \
$(SLO)$/odbcconfig.obj \
$(SLO)$/advancedsettings.obj \
- $(SLO)$/datasourceui.obj \
$(SLO)$/textconnectionsettings.obj
SLOFILES= \
diff --git a/dbaccess/source/ui/dlg/dsitems.hxx b/dbaccess/source/ui/inc/dsitems.hxx
index 557c095da67c..20a6f4d83a8e 100644
--- a/dbaccess/source/ui/dlg/dsitems.hxx
+++ b/dbaccess/source/ui/inc/dsitems.hxx
@@ -31,6 +31,8 @@
#ifndef _DBAUI_DATASOURCEITEMS_HXX_
#define _DBAUI_DATASOURCEITEMS_HXX_
+typedef sal_Int32 ItemID;
+
//========================================================================
//= item ids for the data source administration dialog
diff --git a/dbaccess/source/ui/inc/dsmeta.hxx b/dbaccess/source/ui/inc/dsmeta.hxx
index 88f04388545b..1052ec7c536c 100644
--- a/dbaccess/source/ui/inc/dsmeta.hxx
+++ b/dbaccess/source/ui/inc/dsmeta.hxx
@@ -32,6 +32,7 @@
#define DBACCESS_DSMETA_HXX
#include "dsntypes.hxx"
+#include "dsitems.hxx"
/** === begin UNO includes === **/
/** === end UNO includes === **/
@@ -56,7 +57,7 @@ namespace dbaui
//====================================================================
//= DataSourceMetaData
//====================================================================
- struct AdvancedSettingsSupport;
+ class FeatureSet;
class DataSourceMetaData_Impl;
/** encapsulates meta data for a data source
@@ -74,7 +75,7 @@ namespace dbaui
~DataSourceMetaData();
/// returns a struct describing this data source type's support for our known advanced settings
- const AdvancedSettingsSupport& getAdvancedSettingsSupport() const;
+ const FeatureSet& getFeatureSet() const;
/// determines whether or not the data source requires authentication
AuthenticationMode getAuthentication() const;
@@ -86,80 +87,56 @@ namespace dbaui
};
//====================================================================
- //= AdvancedSettingsSupport
+ //= FeatureSet
//====================================================================
- /// struct taking flags for the supported advanced settings
- struct AdvancedSettingsSupport
+ /** can be used to ask for (UI) support for certain advanced features
+ */
+ class FeatureSet
{
- // auto-generated values
- bool bGeneratedValues;
- // various settings as found on the "Special Settings" page in the UI
- bool bUseSQL92NamingConstraints;
- bool bAppendTableAliasInSelect;
- bool bUseKeywordAsBeforeAlias;
- bool bUseBracketedOuterJoinSyntax;
- bool bIgnoreDriverPrivileges;
- bool bParameterNameSubstitution;
- bool bDisplayVersionColumns;
- bool bUseCatalogInSelect;
- bool bUseSchemaInSelect;
- bool bUseIndexDirectionKeyword;
- bool bUseDOSLineEnds;
- bool bBooleanComparisonMode;
- bool bFormsCheckRequiredFields;
- bool bIgnoreCurrency;
- bool bEscapeDateTime;
- bool bPrimaryKeySupport;
-
- // Note: If you extend this list, you need to adjust the ctor (of course)
- // and (maybe) the implementation of supportsAnySpecialSetting
-
- AdvancedSettingsSupport()
- :bGeneratedValues ( false )
- ,bUseSQL92NamingConstraints ( false )
- ,bAppendTableAliasInSelect ( false )
- ,bUseKeywordAsBeforeAlias ( false )
- ,bUseBracketedOuterJoinSyntax ( false )
- ,bIgnoreDriverPrivileges ( false )
- ,bParameterNameSubstitution ( false )
- ,bDisplayVersionColumns ( false )
- ,bUseCatalogInSelect ( false )
- ,bUseSchemaInSelect ( false )
- ,bUseIndexDirectionKeyword ( false )
- ,bUseDOSLineEnds ( false )
- ,bBooleanComparisonMode ( false )
- ,bFormsCheckRequiredFields ( false )
- ,bIgnoreCurrency ( false )
- ,bEscapeDateTime ( false )
- ,bPrimaryKeySupport ( false )
- {
- }
-
- /** determines whether there is support for any of the settings found on the "Special Settings"
- UI
- */
- inline bool supportsAnySpecialSetting() const;
+ public:
+ typedef ::std::set< ItemID >::const_iterator const_iterator;
+
+ public:
+ inline FeatureSet() { }
+
+ inline void put( const ItemID _id ) { m_aContent.insert( _id ); }
+ inline bool has( const ItemID _id ) const { return m_aContent.find( _id ) != m_aContent.end(); }
+
+ inline bool supportsAnySpecialSetting() const;
+ inline bool supportsGeneratedValues() const;
+
+ inline const_iterator begin() const { return m_aContent.begin(); }
+ inline const_iterator end() const { return m_aContent.end(); }
+
+ private:
+ ::std::set< ItemID > m_aContent;
};
//--------------------------------------------------------------------
- inline bool AdvancedSettingsSupport::supportsAnySpecialSetting() const
+ inline bool FeatureSet::supportsGeneratedValues() const
+ {
+ return has( DSID_AUTORETRIEVEENABLED );
+ }
+
+ //--------------------------------------------------------------------
+ inline bool FeatureSet::supportsAnySpecialSetting() const
{
- return ( bUseSQL92NamingConstraints == true )
- || ( bAppendTableAliasInSelect == true )
- || ( bUseKeywordAsBeforeAlias == true )
- || ( bUseBracketedOuterJoinSyntax == true )
- || ( bIgnoreDriverPrivileges == true )
- || ( bParameterNameSubstitution == true )
- || ( bDisplayVersionColumns == true )
- || ( bUseCatalogInSelect == true )
- || ( bUseSchemaInSelect == true )
- || ( bUseIndexDirectionKeyword == true )
- || ( bUseDOSLineEnds == true )
- || ( bBooleanComparisonMode == true )
- || ( bFormsCheckRequiredFields == true )
- || ( bIgnoreCurrency == true )
- || ( bEscapeDateTime == true )
- || ( bPrimaryKeySupport == true )
+ return has( DSID_SQL92CHECK )
+ || has( DSID_APPEND_TABLE_ALIAS )
+ || has( DSID_AS_BEFORE_CORRNAME )
+ || has( DSID_ENABLEOUTERJOIN )
+ || has( DSID_IGNOREDRIVER_PRIV )
+ || has( DSID_PARAMETERNAMESUBST )
+ || has( DSID_SUPPRESSVERSIONCL )
+ || has( DSID_CATALOG )
+ || has( DSID_SCHEMA )
+ || has( DSID_INDEXAPPENDIX )
+ || has( DSID_DOSLINEENDS )
+ || has( DSID_BOOLEANCOMPARISON )
+ || has( DSID_CHECK_REQUIRED_FIELDS )
+ || has( DSID_IGNORECURRENCY )
+ || has( DSID_ESCAPE_DATETIME )
+ || has( DSID_PRIMARY_KEY_SUPPORT )
;
}
diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx
index b8d7bd935a4d..6f348742afd4 100644
--- a/dbaccess/source/ui/misc/dsmeta.cxx
+++ b/dbaccess/source/ui/misc/dsmeta.cxx
@@ -63,102 +63,75 @@ namespace dbaui
}
};
+ struct FeatureMapping
+ {
+ /// one of the items from dsitems.hxx
+ ItemID nItemID;
+ const sal_Char* pAsciiFeatureName;
+ };
+
//====================================================================
//= global tables
//====================================================================
//--------------------------------------------------------------------
- static const AdvancedSettingsSupport& getAdvancedSettingsSupport( const ::rtl::OUString& _sURL )
+ static const FeatureMapping* lcl_getFeatureMappings()
{
- DECLARE_STL_USTRINGACCESS_MAP( AdvancedSettingsSupport, AdvancedSupport);
- static AdvancedSupport s_aSupport;
- if ( s_aSupport.empty() )
+ static const FeatureMapping s_aMappings[] = {
+ { DSID_AUTORETRIEVEENABLED, "GeneratedValues" },
+ { DSID_AUTOINCREMENTVALUE, "GeneratedValues" },
+ { DSID_AUTORETRIEVEVALUE, "GeneratedValues" },
+ { DSID_SQL92CHECK, "UseSQL92NamingConstraints" },
+ { DSID_APPEND_TABLE_ALIAS, "AppendTableAliasInSelect" },
+ { DSID_AS_BEFORE_CORRNAME, "UseKeywordAsBeforeAlias" },
+ { DSID_ENABLEOUTERJOIN, "UseBracketedOuterJoinSyntax" },
+ { DSID_IGNOREDRIVER_PRIV, "IgnoreDriverPrivileges" },
+ { DSID_PARAMETERNAMESUBST, "ParameterNameSubstitution" },
+ { DSID_SUPPRESSVERSIONCL, "DisplayVersionColumns" },
+ { DSID_CATALOG, "UseCatalogInSelect" },
+ { DSID_SCHEMA, "UseSchemaInSelect" },
+ { DSID_INDEXAPPENDIX, "UseIndexDirectionKeyword" },
+ { DSID_DOSLINEENDS, "UseDOSLineEnds" },
+ { DSID_BOOLEANCOMPARISON, "BooleanComparisonMode" },
+ { DSID_CHECK_REQUIRED_FIELDS, "FormsCheckRequiredFields" },
+ { DSID_IGNORECURRENCY, "IgnoreCurrency" },
+ { DSID_ESCAPE_DATETIME, "EscapeDateTime" },
+ { DSID_PRIMARY_KEY_SUPPORT, "PrimaryKeySupport" },
+ { 0, NULL }
+ };
+ return s_aMappings;
+ }
+
+ //--------------------------------------------------------------------
+ static const FeatureSet& lcl_getFeatureSet( const ::rtl::OUString _rURL )
+ {
+ typedef ::std::map< ::rtl::OUString, FeatureSet, ::comphelper::UStringLess > FeatureSets;
+ static FeatureSets s_aFeatureSets;
+ if ( s_aFeatureSets.empty() )
{
- ::connectivity::DriversConfig aDriverConfig(::comphelper::getProcessServiceFactory());
- const uno::Sequence< ::rtl::OUString > aURLs = aDriverConfig.getURLs();
- const ::rtl::OUString* pIter = aURLs.getConstArray();
- const ::rtl::OUString* pEnd = pIter + aURLs.getLength();
- for(;pIter != pEnd;++pIter)
+ ::connectivity::DriversConfig aDriverConfig( ::comphelper::getProcessServiceFactory() );
+ const uno::Sequence< ::rtl::OUString > aPatterns = aDriverConfig.getURLs();
+ for ( const ::rtl::OUString* pattern = aPatterns.getConstArray();
+ pattern != aPatterns.getConstArray() + aPatterns.getLength();
+ ++pattern
+ )
{
- AdvancedSettingsSupport aInit;
- const uno::Sequence< beans::NamedValue> aProperties = aDriverConfig.getFeatures(*pIter).getNamedValues();
- const beans::NamedValue* pPropertiesIter = aProperties.getConstArray();
- const beans::NamedValue* pPropertiesEnd = pPropertiesIter + aProperties.getLength();
- for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter)
+ FeatureSet aCurrentSet;
+ const ::comphelper::NamedValueCollection aCurrentFeatures( aDriverConfig.getFeatures( *pattern ).getNamedValues() );
+
+ const FeatureMapping* pFeatureMapping = lcl_getFeatureMappings();
+ while ( pFeatureMapping->pAsciiFeatureName )
{
- if ( pPropertiesIter->Name.equalsAscii("GeneratedValues") )
- {
- pPropertiesIter->Value >>= aInit.bGeneratedValues;
- }
- else if ( pPropertiesIter->Name.equalsAscii("UseSQL92NamingConstraints") )
- {
- pPropertiesIter->Value >>= aInit.bUseSQL92NamingConstraints;
- }
- else if ( pPropertiesIter->Name.equalsAscii("AppendTableAliasInSelect") )
- {
- pPropertiesIter->Value >>= aInit.bAppendTableAliasInSelect;
- }
- else if ( pPropertiesIter->Name.equalsAscii("UseKeywordAsBeforeAlias") )
- {
- pPropertiesIter->Value >>= aInit.bUseKeywordAsBeforeAlias;
- }
- else if ( pPropertiesIter->Name.equalsAscii("UseBracketedOuterJoinSyntax") )
- {
- pPropertiesIter->Value >>= aInit.bUseBracketedOuterJoinSyntax;
- }
- else if ( pPropertiesIter->Name.equalsAscii("IgnoreDriverPrivileges") )
- {
- pPropertiesIter->Value >>= aInit.bIgnoreDriverPrivileges;
- }
- else if ( pPropertiesIter->Name.equalsAscii("ParameterNameSubstitution") )
- {
- pPropertiesIter->Value >>= aInit.bParameterNameSubstitution;
- }
- else if ( pPropertiesIter->Name.equalsAscii("DisplayVersionColumns") )
- {
- pPropertiesIter->Value >>= aInit.bDisplayVersionColumns;
- }
- else if ( pPropertiesIter->Name.equalsAscii("UseCatalogInSelect") )
- {
- pPropertiesIter->Value >>= aInit.bUseCatalogInSelect;
- }
- else if ( pPropertiesIter->Name.equalsAscii("UseSchemaInSelect") )
- {
- pPropertiesIter->Value >>= aInit.bUseSchemaInSelect;
- }
- else if ( pPropertiesIter->Name.equalsAscii("UseIndexDirectionKeyword") )
- {
- pPropertiesIter->Value >>= aInit.bUseIndexDirectionKeyword;
- }
- else if ( pPropertiesIter->Name.equalsAscii("UseDOSLineEnds") )
- {
- pPropertiesIter->Value >>= aInit.bUseDOSLineEnds;
- }
- else if ( pPropertiesIter->Name.equalsAscii("BooleanComparisonMode") )
- {
- pPropertiesIter->Value >>= aInit.bBooleanComparisonMode;
- }
- else if ( pPropertiesIter->Name.equalsAscii("FormsCheckRequiredFields") )
- {
- pPropertiesIter->Value >>= aInit.bFormsCheckRequiredFields;
- }
- else if ( pPropertiesIter->Name.equalsAscii("IgnoreCurrency") )
- {
- pPropertiesIter->Value >>= aInit.bIgnoreCurrency;
- }
- else if ( pPropertiesIter->Name.equalsAscii("EscapeDateTime") )
- {
- pPropertiesIter->Value >>= aInit.bEscapeDateTime;
- }
- else if ( pPropertiesIter->Name.equalsAscii("PrimaryKeySupport") )
- {
- pPropertiesIter->Value >>= aInit.bPrimaryKeySupport;
- }
+ if ( aCurrentFeatures.has( pFeatureMapping->pAsciiFeatureName ) )
+ aCurrentSet.put( pFeatureMapping->nItemID );
+ ++pFeatureMapping;
}
- s_aSupport.insert(AdvancedSupport::value_type(*pIter,aInit));
+
+ s_aFeatureSets[ *pattern ] = aCurrentSet;
}
}
- OSL_ENSURE(s_aSupport.find(_sURL) != s_aSupport.end(),"Illegal URL!");
- return s_aSupport[ _sURL ];
+
+ OSL_ENSURE( s_aFeatureSets.find( _rURL ) != s_aFeatureSets.end(), "invalid URL/pattern!" );
+ return s_aFeatureSets[ _rURL ];
}
//--------------------------------------------------------------------
@@ -227,9 +200,9 @@ namespace dbaui
}
//--------------------------------------------------------------------
- const AdvancedSettingsSupport& DataSourceMetaData::getAdvancedSettingsSupport() const
+ const FeatureSet& DataSourceMetaData::getFeatureSet() const
{
- return ::dbaui::getAdvancedSettingsSupport( m_pImpl->getType() );
+ return lcl_getFeatureSet( m_pImpl->getType() );
}
//--------------------------------------------------------------------