[Libreoffice-commits] .: connectivity/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Oct 3 21:31:12 PDT 2012


 connectivity/source/drivers/ado/AStatement.cxx               |   18 -
 connectivity/source/drivers/mork/MDatabaseMetaData.cxx       |    9 
 connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx |    6 
 connectivity/source/drivers/mork/MResultSet.cxx              |  103 -----------
 connectivity/source/drivers/mork/MResultSetMetaData.cxx      |    9 
 connectivity/source/drivers/mork/mork_helper.cxx             |   30 ---
 6 files changed, 175 deletions(-)

New commits:
commit 4fdc50d8662be6d830101d5d2045de8ead780b7b
Author: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
Date:   Mon Oct 1 13:28:58 2012 -0300

    Remove blocks of code that will never execute("#if 0" blocks)
    
    These blocks of code will never execute. So we can safely remove them.
    
    Change-Id: I63de52342ce6435b6e8e19b041e2dae59c681f34
    Signed-off-by: Marcos Paulo de Souza <marcos.souza.org at gmail.com>

diff --git a/connectivity/source/drivers/ado/AStatement.cxx b/connectivity/source/drivers/ado/AStatement.cxx
index 71e9d4d..b76bf81 100644
--- a/connectivity/source/drivers/ado/AStatement.cxx
+++ b/connectivity/source/drivers/ado/AStatement.cxx
@@ -510,20 +510,6 @@ sal_Int32 OStatement_Base::getMaxRows() const throw(SQLException, RuntimeExcepti
 sal_Int32 OStatement_Base::getResultSetConcurrency() const throw(SQLException, RuntimeException)
 {
     return m_eLockType;
-#if 0 // Huh?
-    sal_Int32 nValue=0;
-    switch(m_eLockType)
-    {
-        case adLockReadOnly:
-            nValue = ResultSetConcurrency::READ_ONLY;
-            break;
-        default:
-            nValue = ResultSetConcurrency::UPDATABLE;
-            break;
-    }
-
-    return nValue;
-#endif
 }
 //------------------------------------------------------------------------------
 sal_Int32 OStatement_Base::getResultSetType() const throw(SQLException, RuntimeException)
@@ -633,7 +619,6 @@ void OStatement_Base::setFetchSize(sal_Int32 _par0) throw(SQLException, RuntimeE
 
 
     m_nFetchSize = _par0;
-    //  m_RecordSet.put_CacheSize(_par0);
 }
 //------------------------------------------------------------------------------
 void OStatement_Base::setMaxFieldSize(sal_Int32 /*_par0*/) throw(SQLException, RuntimeException)
@@ -830,6 +815,3 @@ void SAL_CALL OStatement::release() throw()
 {
     return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
 }
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mork/MDatabaseMetaData.cxx b/connectivity/source/drivers/mork/MDatabaseMetaData.cxx
index fce0330..ab6a20f 100644
--- a/connectivity/source/drivers/mork/MDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/mork/MDatabaseMetaData.cxx
@@ -23,14 +23,6 @@
 #include "MorkParser.hxx"
 #include "connectivity/dbtools.hxx"
 
-#if 0
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-#endif
-
 using namespace dbtools;
 using namespace connectivity::mork;
 using namespace connectivity;
@@ -142,7 +134,6 @@ ODatabaseMetaDataResultSet::ORows& SAL_CALL ODatabaseMetaData::getColumnRows(
             {
                 if ( match( columnNamePattern, compare->first, '\0' ) )
                 {
-//                    OSL_TRACE( "\t\t\tColumnName = %s;", OUtoCStr( compare->first ) );
                     SAL_INFO("connectivity.mork", "\t\tColumnNam : " << compare->first);
 
                     // COLUMN_NAME
diff --git a/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx b/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx
index 7a28c45..a22b660 100644
--- a/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx
+++ b/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx
@@ -92,11 +92,6 @@ sal_Bool MDatabaseMetaDataHelper::getTables( OConnection* _pCon,
 
         // return tables to caller
         if (match( tableNamePattern, aTableName, '\0' ))
-#if 0
- &&
-                       0 != ::comphelper::findValue( types, aTableType, sal_True ).getLength() ||
-                       0 != ::comphelper::findValue( types, matchAny, sal_True ).getLength()))
-#endif
     {
             if ( aTableName.isEmpty() ) {
                 aTableName = rtl::OUString::createFromAscii("AddressBook");
@@ -105,7 +100,6 @@ sal_Bool MDatabaseMetaDataHelper::getTables( OConnection* _pCon,
             SAL_INFO("connectivity.mork", "TableName: " << aTableName);
 
             aRow.push_back( new ORowSetValueDecorator( aTableName ) ); // Table name
-//            aRow.push_back( new ORowSetValueDecorator( aTableType ) ); // Table type
             aRow.push_back( new ORowSetValueDecorator( rtl::OUString::createFromAscii("TABLE") ) ); // Table type
             aRow.push_back( ODatabaseMetaDataResultSet::getEmptyValue() ); // Remarks
             aRows.push_back(aRow);
diff --git a/connectivity/source/drivers/mork/MResultSet.cxx b/connectivity/source/drivers/mork/MResultSet.cxx
index 974d703..49ee90a 100644
--- a/connectivity/source/drivers/mork/MResultSet.cxx
+++ b/connectivity/source/drivers/mork/MResultSet.cxx
@@ -1257,13 +1257,6 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep
                     // values.
 
                     OSL_TRACE("Query is to be sorted");
-#if 0
-                    if( ! m_aQueryHelper.queryComplete() )
-                        if ( !m_aQueryHelper.waitForQueryComplete() )
-                        {
-                            m_pStatement->getOwnConnection()->throwSQLException( m_aQueryHelper.getError(), *this );
-                        }
-#endif
 
                     OSL_ENSURE( m_aQueryHelper.queryComplete(), "Query not complete!!");
 
@@ -1553,19 +1546,6 @@ sal_Bool OResultSet::seekRow( eRowPosition pos, sal_Int32 nOffset )
     else    //The requested row has not been retrived until now. We should get the right card for it.
         nCurCard = nCurPos + deletedCount();
 
-    // davido: what is this loop for?
-    // it leads to infinite loop, once nCurCard is greater then nNumberOfRecords
-#if 0
-    while ( nCurCard > nNumberOfRecords ) {
-            m_aQueryHelper.checkRowAvailable( nCurCard );
-            if ( m_aQueryHelper.hadError() )
-            {
-                m_pStatement->getOwnConnection()->throwSQLException( m_aQueryHelper.getError(), *this );
-            }
-            nNumberOfRecords = m_aQueryHelper.getResultCount();
-    }
-#endif
-
     if ( nCurCard > nNumberOfRecords) {
         fillKeySet(nNumberOfRecords);
         m_nRowPos = static_cast<sal_uInt32>(m_pKeySet->get().size() + 1);
@@ -1841,104 +1821,21 @@ void SAL_CALL OResultSet::insertRow(  ) throw(::com::sun::star::sdbc::SQLExcepti
 void SAL_CALL OResultSet::updateRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
 {
     OSL_FAIL( "OResultSet::updateRow(  ) not implemented" );
-#if 0
-    OSL_TRACE("updateRow in, m_nRowPos = %u", m_nRowPos );
-    ResultSetEntryGuard aGuard( *this );
-    impl_ensureKeySet();
-
-    if (!m_nRowPos || m_pKeySet->get().size() < m_nRowPos )
-    {
-        m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_ROW_UPDATE, *this );
-    }
-
-    const sal_Int32 nCurrentCard = getCurrentCardNumber();
-
-    if (!pushCard(nCurrentCard))
-    {
-        m_RowStates = RowStates_Error;
-        m_pStatement->getOwnConnection()->throwSQLException( STR_ROW_CAN_NOT_SAVE, *this );
-    }
-
-    if (!m_aQueryHelper.commitRow(nCurrentCard))
-    {
-        m_RowStates = RowStates_Error;
-        m_nUpdatedRow = 0;
-        m_pStatement->getOwnConnection()->throwSQLException( m_aQueryHelper.getError(), *this );
-    }
-
-    m_nUpdatedRow = 0;
-    fetchCurrentRow();
-    OSL_TRACE("updateRow out, m_nRowPos = %u", m_nRowPos );
-#endif
 }
 // -------------------------------------------------------------------------
 void SAL_CALL OResultSet::deleteRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
 {
     OSL_FAIL( "OResultSet::deleteRow(  ) not implemented" );
-#if 0
-    OSL_TRACE("deleteRow, m_nRowPos = %u", m_nRowPos );
-    ResultSetEntryGuard aGuard( *this );
-    if (rowDeleted())
-        m_pStatement->getOwnConnection()->throwSQLException( STR_ROW_ALREADY_DELETED, *this );
-
-    const sal_Int32 nCurrentRow = getCurrentCardNumber();
-    //fetchRow(nCurrentRow);
-    if (!nCurrentRow)
-        m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
-
-    sal_Bool m_bRowDeleted = ( m_aQueryHelper.deleteRow( nCurrentRow ) > 0 );
-    if (!m_bRowDeleted)
-        m_pStatement->getOwnConnection()->throwSQLException( m_aQueryHelper.getError(), *this );
-
-    m_aQueryHelper.setRowStates(nCurrentRow,RowStates_Deleted);
-    m_pKeySet->get().erase(m_pKeySet->get().begin() + m_nRowPos -1);
-    m_RowStates = RowStates_Deleted;
-    OSL_TRACE("deleteRow out, m_nRowPos = %u", m_nRowPos );
-#endif
 }
 // -------------------------------------------------------------------------
 void SAL_CALL OResultSet::cancelRowUpdates(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
 {
     OSL_FAIL( "OResultSet::cancelRowUpdates(  ) not implemented" );
-#if 0
-    ResultSetEntryGuard aGuard( *this );
-    OSL_TRACE("cancelRowUpdates, m_nRowPos = %u", m_nRowPos );
-    if (fetchRow(getCurrentCardNumber(),sal_True))  //force fetch current row will cause we lose all change to the current row
-        m_pStatement->getOwnConnection()->throwSQLException( STR_CAN_NOT_CANCEL_ROW_UPDATE, *this );
-#endif
 }
 // -------------------------------------------------------------------------
 void SAL_CALL OResultSet::moveToInsertRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
 {
     OSL_FAIL( "OResultSet::moveToInsertRow(  ) not implemented" );
-#if 0
-    OSL_TRACE("moveToInsertRow in, m_nRowPos = %u", m_nRowPos );
-    ResultSetEntryGuard aGuard( *this );
-    m_nOldRowPos = m_nRowPos;
-
-    if (!m_nNewRow) //no new row now, insert one
-    {
-        checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-        checkPendingUpdate();
-        if (rowUpdated())
-        {
-            if (m_nRowPos && !pushCard(getCurrentCardNumber()))
-                throw SQLException();
-        }
-        m_nNewRow = m_aQueryHelper.createNewCard();
-        if (!m_nNewRow)
-            m_pStatement->getOwnConnection()->throwSQLException( STR_CAN_NOT_CREATE_ROW, *this );
-
-        m_RowStates = RowStates_Normal;
-        fillKeySet(m_nNewRow);
-    }
-    else
-        m_nUpdatedRow = 0;
-
-    m_nRowPos = static_cast<sal_uInt32>(m_pKeySet->get().size());
-    fetchCurrentRow();
-    OSL_TRACE("moveToInsertRow out, m_nRowPos = %u", m_nRowPos );
-#endif
 }
 // -------------------------------------------------------------------------
 void SAL_CALL OResultSet::moveToCurrentRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
diff --git a/connectivity/source/drivers/mork/MResultSetMetaData.cxx b/connectivity/source/drivers/mork/MResultSetMetaData.cxx
index 581e930..57f6dea 100644
--- a/connectivity/source/drivers/mork/MResultSetMetaData.cxx
+++ b/connectivity/source/drivers/mork/MResultSetMetaData.cxx
@@ -168,15 +168,6 @@ sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQL
         return sal_False;
     }
 
-#if 0
-    if ( m_pTable->getConnection()->isLDAP() )
-    {
-        const OColumnAlias& aAliases( m_pTable->getConnection()->getColumnAlias() );
-        if ( !aAliases.isColumnSearchable( sColumnName ) )
-            return sal_False;
-    }
-#endif
-
     return sal_True;
 }
 // -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/mork/mork_helper.cxx b/connectivity/source/drivers/mork/mork_helper.cxx
index 74a344f..e0c75c7 100644
--- a/connectivity/source/drivers/mork/mork_helper.cxx
+++ b/connectivity/source/drivers/mork/mork_helper.cxx
@@ -28,36 +28,6 @@ bool openAddressBook(const std::string& path)
             std::string value = mork.getValue( tableIter->first );
             SAL_INFO("connectivity.mork", "table.column : " << column);
             SAL_INFO("connectivity.mork", "table.value : " << value);
-#if 0
-            MorkRowMap *Rows = 0;
-            // Get rows
-            Rows = mork.getRows( defaultScope, &tableIter->second );
-            if ( Rows ) {
-                // Iterate all rows
-                for ( rowIter = Rows->begin(); rowIter != Rows->end(); rowIter++ )
-                {
-                    if ( 0 == rowIter->first ) continue;
-                    RawAbeMap ram;
-                    std::string column;
-                    std::string value;
-                    char buffer[20];
-                    sprintf( buffer, "%d", rowIter->first );
-                    abe.id = std::string( buffer );
-                    // Get cells
-                    for ( MorkCells::iterator cellsIter = rowIter->second.begin();
-                          cellsIter != rowIter->second.end(); cellsIter++ )
-                    {
-                        column = mork.getColumn( cellsIter->first );
-                        value = mork.getValue( cellsIter->second );
-                        ram[ column ] = value;
-                    }
-                    AbeMap::iterator abeIter;
-                    abes_[ rowIter->first ] = abe;
-                    abeIter = abes_.find( rowIter->first );
-                    addEntry( ram, abeIter->second );
-                }
-            }
-#endif
         }
     }
 


More information about the Libreoffice-commits mailing list