User: kz Date: 05/01/21 09:12:48 Modified: /dba/dbaccess/source/ui/dlg/ DbAdminImpl.cxx
Log: INTEGRATION: CWS dba22 (1.6.4); FILE MERGED 2005/01/06 12:42:48 oj 1.6.4.2: #i39321# extend createConnection to return a pair now 2005/01/06 10:35:58 oj 1.6.4.1: #i39504# check database Item as well as url File Changes: Directory: /dba/dbaccess/source/ui/dlg/ ======================================= File [changed]: DbAdminImpl.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/dlg/DbAdminImpl.cxx?r1=1.6&r2=1.7 Delta lines: +30 -28 --------------------- --- DbAdminImpl.cxx 22 Nov 2004 15:03:52 -0000 1.6 +++ DbAdminImpl.cxx 21 Jan 2005 17:12:45 -0000 1.7 @@ -384,12 +384,10 @@ m_pItemSetHelper->getWriteOutputSet()->ClearItem(DSID_PASSWORD); } // ----------------------------------------------------------------------------- -Reference<XConnection> ODbDataSourceAdministrationHelper::createConnection() +::std::pair< Reference<XConnection>,sal_Bool> ODbDataSourceAdministrationHelper::createConnection() { - Reference<XConnection> xConnection; -// // if (bValid) - { // get the current table list from the connection for the current settings - // the PropertyValues for the current dialog settings + ::std::pair< Reference<XConnection>,sal_Bool> aRet; + aRet.second = sal_False; Sequence< PropertyValue > aConnectionParams; if ( getCurrentSettings(aConnectionParams) ) { @@ -399,7 +397,8 @@ try { WaitObject aWaitCursor(m_pParent); - xConnection = getDriver()->connect(getConnectionURL(), aConnectionParams); + aRet.first = getDriver()->connect(getConnectionURL(), aConnectionParams); + aRet.second = sal_True; } catch (SQLContext& e) { aErrorInfo = SQLExceptionInfo(e); } catch (SQLWarning& e) { aErrorInfo = SQLExceptionInfo(e); } @@ -407,11 +406,10 @@ showError(aErrorInfo,m_pParent,getORB()); } - } - if(xConnection.is()) + if ( aRet.first.is() ) successfullyConnected();// notify the admindlg to save the password - return xConnection; + return aRet; } // ----------------------------------------------------------------------------- Reference< XDriver > ODbDataSourceAdministrationHelper::getDriver() @@ -545,6 +543,7 @@ sDatabaseName = pCollection->cutPrefix( pUrlItem->GetValue() ); // TODO: what's that? Why is the database name transported via the URL Item? // Huh? Anybody there? + // OJ: It is needed when the connection properties are changed. There the URL is used for every type. if ( sDatabaseName.Len() ) { @@ -557,13 +556,16 @@ { SFX_ITEMSET_GET(*m_pItemSetHelper->getOutputSet(), pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True); SFX_ITEMSET_GET(*m_pItemSetHelper->getOutputSet(), pPortNumber, SfxInt32Item, DSID_ORACLE_PORTNUMBER, sal_True); + SFX_ITEMSET_GET(*m_pItemSetHelper->getOutputSet(), pDatabaseName, SfxStringItem, DSID_DATABASENAME, sal_True); sNewUrl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("@")); sNewUrl += lcl_createHostWithPort(pHostName,pPortNumber); - String sUrl = pCollection->cutPrefix(pUrlItem->GetValue()); - if ( sUrl.Len() ) + String sDatabaseName = pDatabaseName ? pDatabaseName->GetValue() : String(); + if ( !sDatabaseName.Len() && pUrlItem ) + sDatabaseName = pCollection->cutPrefix( pUrlItem->GetValue() ); + if ( sDatabaseName.Len() ) { sNewUrl += String::CreateFromAscii(":"); - sNewUrl += sUrl; + sNewUrl += sDatabaseName; } } break; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
