diff options
author | Kurt Zenker <kz@openoffice.org> | 2010-01-15 14:01:24 +0100 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2010-01-15 14:01:24 +0100 |
commit | f438e048e8416950cb10f916d0c3ea31554c24b6 (patch) | |
tree | 3ba78465a9086c12ad3cc606682366881ec4b1b3 /dbaccess/source/ui/misc | |
parent | 66a220af39ab5493dfc660a846c3da78d60839bf (diff) | |
parent | b84930a93b3a360f46ad16ae0ddd6555b3fc6274 (diff) |
CWS-TOOLING: integrate CWS dba33b
Diffstat (limited to 'dbaccess/source/ui/misc')
-rw-r--r-- | dbaccess/source/ui/misc/RowSetDrop.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/UITools.cxx | 12 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WCopyTable.cxx | 40 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/dsmeta.cxx | 177 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/linkeddocuments.cxx | 4 |
5 files changed, 108 insertions, 131 deletions
diff --git a/dbaccess/source/ui/misc/RowSetDrop.cxx b/dbaccess/source/ui/misc/RowSetDrop.cxx index 53b1105c6aba..2c679ba22da8 100644 --- a/dbaccess/source/ui/misc/RowSetDrop.cxx +++ b/dbaccess/source/ui/misc/RowSetDrop.cxx @@ -237,6 +237,12 @@ sal_Bool ORowSetImportExport::insertNewRow() case DataType::VARBINARY: aValue <<= m_xRow->getBytes(*aIter); break; + case DataType::BLOB: + aValue <<= m_xRow->getBlob(*aIter); + break; + case DataType::CLOB: + aValue <<= m_xRow->getClob(*aIter); + break; default: OSL_ENSURE(0,"Unknown type"); } diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 55691d4164ff..8d7e24e2792c 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -803,6 +803,12 @@ void fillTypeInfo( const Reference< ::com::sun::star::sdbc::XConnection>& _rxCo aName = _rsTypeNames.GetToken(TYPE_DATETIME); break; case DataType::BIT: + if ( pInfo->aCreateParams.getLength() ) + { + aName = _rsTypeNames.GetToken(TYPE_BIT); + break; + } + // run through case DataType::BOOLEAN: aName = _rsTypeNames.GetToken(TYPE_BOOL); break; @@ -1155,7 +1161,7 @@ sal_Bool callColumnFormatDialog(Window* _pParent, if (_bHasFormat) { // if the col is bound to a text field we have to disallow all non-text formats - if ((DataType::CHAR == _nDataType) || (DataType::VARCHAR == _nDataType) || (DataType::LONGVARCHAR == _nDataType)) + if ((DataType::CHAR == _nDataType) || (DataType::VARCHAR == _nDataType) || (DataType::LONGVARCHAR == _nDataType) || (DataType::CLOB == _nDataType)) { bText = sal_True; pFormatDescriptor->Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ONE_AREA, sal_True)); @@ -1622,6 +1628,10 @@ TOTypeInfoSP queryTypeInfoByType(sal_Int32 _nDataType,const OTypeInfoMap& _rType if ( pTypeInfo = queryTypeInfoByType(DataType::LONGVARCHAR,_rTypeInfo) ) break; break; + case DataType::LONGVARCHAR: + if ( pTypeInfo = queryTypeInfoByType(DataType::CLOB,_rTypeInfo) ) + break; + break; default: ; } // switch(_nDataType) diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index 1feb51cf49a9..2b664c02f7e2 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -63,6 +63,7 @@ #include <comphelper/extract.hxx> #include <comphelper/types.hxx> #include <connectivity/dbtools.hxx> +#include <connectivity/dbmetadata.hxx> #include <rtl/logfile.hxx> #include <rtl/ustrbuf.hxx> @@ -632,6 +633,22 @@ OCopyTableWizard::OCopyTableWizard( Window * pParent, const ::rtl::OUString& _rD if ( !lcl_sameConnection_throw( _xSourceConnection, m_xDestConnection ) ) bAllowViews = false; + if ( m_bInterConnectionCopy ) + { + Reference< XDatabaseMetaData > xSrcMeta = _xSourceConnection->getMetaData(); + ::rtl::OUString sCatalog; + ::rtl::OUString sSchema; + ::rtl::OUString sTable; + ::dbtools::qualifiedNameComponents( xSrcMeta, + m_sName, + sCatalog, + sSchema, + sTable, + ::dbtools::eInDataManipulation); + + m_sName = ::dbtools::composeTableName(m_xDestConnection->getMetaData(),sCatalog,sSchema,sTable,sal_False,::dbtools::eInTableDefinitions); + } + OCopyTable* pPage1( new OCopyTable( this ) ); pPage1->disallowUseHeaderLine(); if ( !bAllowViews ) @@ -1381,23 +1398,12 @@ Reference< XPropertySet > OCopyTableWizard::createTable() // ----------------------------------------------------------------------------- bool OCopyTableWizard::supportsPrimaryKey( const Reference< XConnection >& _rxConnection ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::supportsPrimaryKey" ); OSL_PRECOND( _rxConnection.is(), "OCopyTableWizard::supportsPrimaryKey: invalid connection!" ); + if ( !_rxConnection.is() ) + return false; - bool bSupports( false ); - if ( _rxConnection.is() ) - { - try - { - Reference< XDatabaseMetaData > xMetaData( _rxConnection->getMetaData(), UNO_QUERY_THROW ); - bSupports = xMetaData->supportsCoreSQLGrammar(); - } - catch(const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - return bSupports; + ::dbtools::DatabaseMetaData aMetaData( _rxConnection ); + return aMetaData.supportsPrimaryKeys(); } // ----------------------------------------------------------------------------- @@ -1591,6 +1597,10 @@ TOTypeInfoSP OCopyTableWizard::convertType(const TOTypeInfoSP& _pType,sal_Bool& if ( supportsType(DataType::LONGVARCHAR,nDefaultType) ) break; break; + case DataType::LONGVARCHAR: + if ( supportsType(DataType::CLOB,nDefaultType) ) + break; + break; default: nDefaultType = DataType::VARCHAR; } diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx index b152f12688e2..7d299c7f5910 100644 --- a/dbaccess/source/ui/misc/dsmeta.cxx +++ b/dbaccess/source/ui/misc/dsmeta.cxx @@ -47,32 +47,6 @@ namespace dbaui using namespace ::com::sun::star; /** === end UNO using === **/ - struct InitAdvanced : public AdvancedSettingsSupport - { - enum Special { All, AllButIgnoreCurrency, None }; - - InitAdvanced( Special _eType ) - :AdvancedSettingsSupport() - { - bGeneratedValues = ( _eType == All ) || ( _eType == AllButIgnoreCurrency ); - bUseSQL92NamingConstraints = ( _eType == All ) || ( _eType == AllButIgnoreCurrency ); - bAppendTableAliasInSelect = ( _eType == All ) || ( _eType == AllButIgnoreCurrency ); - bUseKeywordAsBeforeAlias = ( _eType == All ) || ( _eType == AllButIgnoreCurrency ); - bUseBracketedOuterJoinSyntax = ( _eType == All ) || ( _eType == AllButIgnoreCurrency ); - bIgnoreDriverPrivileges = ( _eType == All ) || ( _eType == AllButIgnoreCurrency ); - bParameterNameSubstitution = ( _eType == All ) || ( _eType == AllButIgnoreCurrency ); - bDisplayVersionColumns = ( _eType == All ) || ( _eType == AllButIgnoreCurrency ); - bUseCatalogInSelect = ( _eType == All ) || ( _eType == AllButIgnoreCurrency ); - bUseSchemaInSelect = ( _eType == All ) || ( _eType == AllButIgnoreCurrency ); - bUseIndexDirectionKeyword = ( _eType == All ) || ( _eType == AllButIgnoreCurrency ); - bUseDOSLineEnds = ( _eType == All ) || ( _eType == AllButIgnoreCurrency ); - bBooleanComparisonMode = ( _eType == All ) || ( _eType == AllButIgnoreCurrency ); - bFormsCheckRequiredFields = ( _eType == All ) || ( _eType == AllButIgnoreCurrency ); - bIgnoreCurrency = ( _eType == All ); - bEscapeDateTime = ( _eType == All ) || ( _eType == AllButIgnoreCurrency ); - } - }; - struct FeatureSupport { // authentication mode of the data source @@ -89,98 +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 + ) { - InitAdvanced aInit(InitAdvanced::None); - 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; - } - } // for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter) - s_aSupport.insert(AdvancedSupport::value_type(*pIter,aInit)); + if ( aCurrentFeatures.has( pFeatureMapping->pAsciiFeatureName ) ) + aCurrentSet.put( pFeatureMapping->nItemID ); + ++pFeatureMapping; + } + + s_aFeatureSets[ *pattern ] = aCurrentSet; } - } // if ( s_aSupport.empty() ) - 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 ]; } //-------------------------------------------------------------------- @@ -208,8 +159,8 @@ namespace dbaui aInit = AuthPwd; } s_aSupport.insert(Supported::value_type(*pIter,aInit)); - } // for(;pIter != pEnd;++pIter) - } // if ( s_aSupport.empty() ) + } + } OSL_ENSURE(s_aSupport.find(_sURL) != s_aSupport.end(),"Illegal URL!"); return s_aSupport[ _sURL ].eAuthentication; } @@ -249,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() ); } //-------------------------------------------------------------------- diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx index a7be84b5e497..13549b72d84c 100644 --- a/dbaccess/source/ui/misc/linkeddocuments.cxx +++ b/dbaccess/source/ui/misc/linkeddocuments.cxx @@ -350,7 +350,7 @@ namespace dbaui //------------------------------------------------------------------ Reference< XComponent > OLinkedDocumentsAccess::newDocument( sal_Int32 _nNewFormId, Reference< XComponent >& _xDefinition, const sal_Int32 _nCommandType, const ::rtl::OUString& _sObjectName ) { - OSL_ENSURE(m_xDocumentContainer.is(), "OLinkedDocumentsAccess::OLinkedDocumentsAccess: invalid document container!"); + OSL_ENSURE(m_xDocumentContainer.is(), "OLinkedDocumentsAccess::newDocument: invalid document container!"); // determine the URL to use for the new document Sequence<sal_Int8> aClassId; switch (_nNewFormId) @@ -373,7 +373,7 @@ namespace dbaui case SID_DB_FORM_NEW_PILOT: default: - OSL_ENSURE(sal_False, "OLinkedDocumentsAccess::newForm: pleas use newFormWithPilot!"); + OSL_ENSURE(sal_False, "OLinkedDocumentsAccess::newDocument: please use newFormWithPilot!"); return Reference< XComponent >(); } |