Tag: cws_src680_dba201b User: fs Date: 05/07/21 07:20:58 Modified: /dba/connectivity/source/commontools/ dbtools.cxx
Log: slight syntax changes to the recently introduced SharedUNOComponent for better readability of client code File Changes: Directory: /dba/connectivity/source/commontools/ ================================================ File [changed]: dbtools.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/commontools/dbtools.cxx?r1=1.55.54.2&r2=1.55.54.3 Delta lines: +14 -16 --------------------- --- dbtools.cxx 21 Jul 2005 12:00:33 -0000 1.55.54.2 +++ dbtools.cxx 21 Jul 2005 14:20:54 -0000 1.55.54.3 @@ -2,9 +2,9 @@ * * $RCSfile: dbtools.cxx,v $ * - * $Revision: 1.55.54.2 $ + * $Revision: 1.55.54.3 $ * - * last change: $Author: fs $ $Date: 2005/07/21 12:00:33 $ + * last change: $Author: fs $ $Date: 2005/07/21 14:20:54 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -515,7 +515,7 @@ if ( !xRowSetProps.is() ) break; - // 1. àlready connected? + // 1. already connected? Reference< XConnection > xExistingConn( xRowSetProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ActiveConnection" ) ) ), UNO_QUERY ); @@ -533,7 +533,7 @@ // no auto disposer needed, since we did not create the connection } - xConnection = SharedConnection( xExistingConn, false ); + xConnection.reset( xExistingConn, SharedConnection::NoTakeOwnership ); break; } @@ -544,6 +544,8 @@ xRowSetProps->getPropertyValue(::rtl::OUString::createFromAscii("DataSourceName")) >>= sDataSourceName; ::rtl::OUString sURL; xRowSetProps->getPropertyValue(::rtl::OUString::createFromAscii("URL")) >>= sURL; + + Reference< XConnection > xPureConnection; if (sDataSourceName.getLength()) { // the row set's data source property is set // -> try to connect, get user and pwd setting for that @@ -554,10 +556,7 @@ if (hasProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD), xRowSetProps)) xRowSetProps->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD)) >>= sPwd; - xConnection = SharedConnection( - getConnection_allowException( sDataSourceName, sUser, sPwd, _rxFactory ), - true /* take ownership */ - ); + xPureConnection = getConnection_allowException( sDataSourceName, sUser, sPwd, _rxFactory ); } else if (sURL.getLength()) { // the row set has no data source, but a connection url set @@ -578,19 +577,18 @@ aInfo.getArray()[0].Value <<= sUser; aInfo.getArray()[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("password")); aInfo.getArray()[1].Value <<= sPwd; - xConnection = SharedConnection( - xDriverManager->getConnectionWithInfo( sURL, aInfo ), - !_bAttachAutoDisposer /* take ownership if and only if we're not going to auto-dispose the connection */ - ); + xPureConnection = xDriverManager->getConnectionWithInfo( sURL, aInfo ); } else // just use the url - xConnection = SharedConnection( - xDriverManager->getConnection( sURL ), - !_bAttachAutoDisposer /* take ownership if and only if we're not going to auto-dispose the connection */ - ); + xPureConnection = xDriverManager->getConnection( sURL ); } } + xConnection.reset( + xPureConnection, + _bAttachAutoDisposer ? SharedConnection::NoTakeOwnership : SharedConnection::TakeOwnership + /* take ownership if and only if we're *not* going to auto-dispose the connection */ + ); // now if we created a connection, forward it to the row set if ( xConnection.is() && _bSetAsActiveConnection ) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
