User: vg      
Date: 05/02/17 02:14:50

Modified:
 /dba/connectivity/source/commontools/
  dbtools.cxx

Log:
 INTEGRATION: CWS dba23 (1.53.12); FILE MERGED
 2005/01/20 16:49:13 oj 1.53.12.2: #i40648# new datatype BOOLEAN
 2005/01/17 14:57:54 fs 1.53.12.1: #i40463# calcConnection superseded by 
connectRowset, which now also throws a WrappedTargetException

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.53&r2=1.54
Delta lines:  +101 -117
-----------------------
--- dbtools.cxx 5 Jan 2005 11:59:23 -0000       1.53
+++ dbtools.cxx 17 Feb 2005 10:14:47 -0000      1.54
@@ -285,6 +285,7 @@
        switch (_nDataType)
        {
                case DataType::BIT:
+               case DataType::BOOLEAN:
                        nFormat = 
_xTypes->getStandardFormat(NumberFormat::LOGICAL, _rLocale);
                        break;
                case DataType::TINYINT:
@@ -364,30 +365,35 @@
 }
 
 
//------------------------------------------------------------------------------
-Reference< XDataSource> getDataSource(
+Reference< XDataSource> getDataSource_allowException(
                        const ::rtl::OUString& _rsTitleOrPath,
-                       const Reference< XMultiServiceFactory>& _rxFactory)
+                       const Reference< XMultiServiceFactory >& _rxFactory )
 {
-       OSL_ENSURE(_rsTitleOrPath.getLength(), "::getDataSource : invalid arg 
!");
-
-       Reference< XDataSource>  xDatasource;
+       OSL_ENSURE( _rsTitleOrPath.getLength(), "getDataSource_allowException: 
invalid arg !" );
 
-       // is it a favorite title ?
        Reference< XNameAccess> xDatabaseContext(
                _rxFactory->createInstance(
-                       
::rtl::OUString::createFromAscii("com.sun.star.sdb.DatabaseContext")),UNO_QUERY);
+                       ::rtl::OUString::createFromAscii( 
"com.sun.star.sdb.DatabaseContext" ) ),UNO_QUERY );
+    OSL_ENSURE( xDatabaseContext.is(), "getDataSource_allowException: could 
not obtain the database context!" );
 
-       if ( xDatabaseContext.is() )
-       {
+       return Reference< XDataSource >( xDatabaseContext->getByName( 
_rsTitleOrPath ), UNO_QUERY );
+}
+
+//------------------------------------------------------------------------------
+Reference< XDataSource > getDataSource(
+                       const ::rtl::OUString& _rsTitleOrPath,
+                       const Reference< XMultiServiceFactory >& _rxFactory )
+{
+    Reference< XDataSource > xDS;
                try
                {
-                       xDatabaseContext->getByName(_rsTitleOrPath) >>= 
xDatasource;
+        xDS = getDataSource_allowException( _rsTitleOrPath, _rxFactory );
                }
                catch(Exception)
-               {} // no assertion needed
+       {
        }
 
-       return xDatasource;
+    return xDS;
 }
 
 
//------------------------------------------------------------------------------
@@ -397,7 +403,7 @@
                        const ::rtl::OUString& _rsPwd,
                        const Reference< XMultiServiceFactory>& _rxFactory)
 {
-       Reference< XDataSource> xDataSource( getDataSource(_rsTitleOrPath, 
_rxFactory) );
+       Reference< XDataSource> xDataSource( 
getDataSource_allowException(_rsTitleOrPath, _rxFactory) );
        Reference<XConnection> xConnection;
        if (xDataSource.is())
        {
@@ -494,17 +500,8 @@
 }
 
 
//------------------------------------------------------------------------------
-Reference< XConnection> calcConnection(
-                       const Reference< XRowSet>& _rxRowSet,
-                       const Reference< XMultiServiceFactory>& _rxFactory)
-                       throw (SQLException, RuntimeException)
-{
-       return connectRowset( _rxRowSet, _rxFactory, sal_True );
-}
-
-//------------------------------------------------------------------------------
 Reference< XConnection> connectRowset(const Reference< XRowSet>& _rxRowSet, 
const Reference< XMultiServiceFactory>& _rxFactory,
-       sal_Bool _bSetAsActiveConnection )      SAL_THROW ( (SQLException, 
RuntimeException) )
+       sal_Bool _bSetAsActiveConnection )      SAL_THROW ( ( SQLException, 
WrappedTargetException, RuntimeException ) )
 {
        Reference< XConnection> xReturn;
        Reference< XPropertySet> xRowSetProps(_rxRowSet, UNO_QUERY);
@@ -540,7 +537,7 @@
                                {       // the row set has no data source, but 
a connection url set
                                        // -> try to connection with that url
                                        Reference< XDriverManager > 
xDriverManager(
-                                               _rxFactory->createInstance( 
::rtl::OUString::createFromAscii("com.sun.star.sdbc.DriverManager")), 
UNO_QUERY);
+                                               _rxFactory->createInstance( 
::rtl::OUString::createFromAscii("com.sun.star.sdbc.ConnectionPool")), 
UNO_QUERY);
                                        if (xDriverManager.is())
                                        {
                                                ::rtl::OUString sUser, sPwd;
@@ -565,10 +562,6 @@
                        }
 
                        // now if we got a connection, forward it to the row set
-                       // (The row set will take ownership of that conn and 
use it for the next execute.
-                       // If one of the properties affecting the connection 
(DataSource, URL) is set afterwards,
-                       // it will free our connection and build a new one with 
the new parameters on the next execute.
-                       // At least the service descriptions says so :)
                        if (xReturn.is() && _bSetAsActiveConnection)
                        {
                                try
@@ -1215,7 +1208,7 @@
     ::rtl::OUString sStatement;
        try
        {
-               Reference< XConnection> xConn( calcConnection( Reference< 
XRowSet >( _rxRowSet, UNO_QUERY ), _rxFactory ) );
+               Reference< XConnection> xConn( connectRowset( Reference< 
XRowSet >( _rxRowSet, UNO_QUERY ), _rxFactory, sal_True ) );
                if ( xConn.is() )               // implies _rxRowSet.is()
                {
                        // build the statement the row set is based on (can't 
use the ActiveCommand property of the set
@@ -1229,15 +1222,6 @@
             const ::rtl::OUString sPropCommand      = 
OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_COMMAND          );
             const ::rtl::OUString sPropEspaceProc   = 
OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_ESCAPEPROCESSING );
 
-                       // first ensure we have all properties needed
-                       if  (   hasProperty( sPropCommand,      _rxRowSet )
-                &&  hasProperty( sPropCommandType,  _rxRowSet )
-                &&  hasProperty( sPropFilter,       _rxRowSet )
-                &&  hasProperty( sPropOrder,        _rxRowSet )
-                               &&  hasProperty( sPropEspaceProc,   _rxRowSet )
-                &&  hasProperty( sPropApplyFilter,  _rxRowSet )
-                )
-                       {
                 sal_Int32 nCommandType = CommandType::COMMAND;
                 ::rtl::OUString sCommand;
                 sal_Bool bEscapeProcessing = sal_False;
@@ -1329,7 +1313,6 @@
                                                OSL_ENSURE(sal_False, 
"getComposedRowSetStatement: no table, no query, no statement - what else ?!");
                                                break;
                                }
-                       }
 
                        if ( sStatement.getLength() && ( _bUseRowSetFilter || 
_bUseRowSetOrder ) )
                        {
@@ -1968,6 +1951,7 @@
                                }
                                break;
                        case DataType::BIT:
+                       case DataType::BOOLEAN:
                                
_xParams->setBoolean(parameterIndex,::cppu::any2bool(x));
                                break;
                        case DataType::TINYINT:




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to