Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi,

I've removed some lines of commented code in

libs-core/connectivity/source/drivers/file/
 FResultSet.cxx
 FStatement.cxx
 fanalyzer.cxx
 fcomp.cxx

For fcomp.cxx I'm not sure if line 82 "// inline OCursor..." might be removed as well.

There were some calls of RTL_LOGFILE_CONTEXT_AUTHOR commented but the majority wasn't. Can the commented calls be removed or should every method have it's call of RTL_LOGFILE_CONTEXT_AUTHOR?

Changes are under LGPLv3+ / MPL

Christina Rossmanith
From 168b632e60a41ec3600101fac36c13cdf1d45d8b Mon Sep 17 00:00:00 2001
From: Christina Rossmanith <ChrRossmanith@web.de>
Date: Fri, 18 Feb 2011 22:14:33 +0100
Subject: [PATCH] Removed commented code

---
 connectivity/source/drivers/file/FResultSet.cxx |   39 +++-------------------
 connectivity/source/drivers/file/FStatement.cxx |   32 +-----------------
 connectivity/source/drivers/file/fanalyzer.cxx  |    1 -
 connectivity/source/drivers/file/fcomp.cxx      |    1 -
 4 files changed, 8 insertions(+), 65 deletions(-)

diff --git a/connectivity/source/drivers/file/FResultSet.cxx 
b/connectivity/source/drivers/file/FResultSet.cxx
index 3045ec2..8d12ecc 100644
--- a/connectivity/source/drivers/file/FResultSet.cxx
+++ b/connectivity/source/drivers/file/FResultSet.cxx
@@ -245,7 +245,6 @@ const ORowSetValue& OResultSet::getValue(sal_Int32 columnIndex ) throw(::com::su
     ::osl::MutexGuard aGuard( m_aMutex );
     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
 
-    //columnIndex = mapColumn(columnIndex);
     checkIndex(columnIndex );
 
 
@@ -257,8 +256,7 @@ void OResultSet::checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc
 {
     //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", 
"OResultSet::checkIndex" );
     if (   columnIndex <= 0
-        //     || columnIndex > (sal_Int32)m_xColumns->size()
-           || columnIndex >= m_nColumnCount )
+            || columnIndex >= m_nColumnCount )
         ::dbtools::throwInvalidIndexException(*this);
 }
 // -------------------------------------------------------------------------
@@ -943,7 +941,7 @@ again:
         m_pTable->fetchRow(m_aEvaluateRow, rTableCols, sal_True,bRetrieveData || bHasRestriction);
 
         if (    (!m_bShowDeleted && m_aEvaluateRow->isDeleted()) 
-            ||  (bHasRestriction && //!bShowDeleted && m_aEvaluateRow->isDeleted() ||// no display 
of deleted records
+            ||  (bHasRestriction &&
                    !m_pSQLAnalyzer->evaluateRestriction()))
         {                                                                                          
     // Evaluate the next record
             // delete current row in Keyset
@@ -959,8 +957,7 @@ again:
             }
             else if (m_pFileSet.is())
             {
-                OSL_ENSURE(//!m_pFileSet->IsFrozen() &&
-                            eCursorPosition == IResultSetHelper::NEXT, "Falsche CursorPosition!");
+                OSL_ENSURE(eCursorPosition == IResultSetHelper::NEXT, "Falsche CursorPosition!");
                 eCursorPosition = IResultSetHelper::NEXT;
                 nOffset = 1;
             }
@@ -983,7 +980,6 @@ again:
             }
             else
             {
-                //     aStatus.Set(SQL_STAT_NO_DATA_FOUND);
                 return sal_False;
             }
             // Try again ...
@@ -1003,7 +999,6 @@ again:
         }
         else if (m_pFileSet.is())
         {
-            // OSL_ENSURE(!m_pFileSet->IsFrozen() , "Falsche CursorPosition!");
             sal_uInt32 nBookmarkValue = Abs((sal_Int32)(m_aEvaluateRow->get())[0]->getValue());
             m_pFileSet->get().push_back(nBookmarkValue);
         }
@@ -1075,7 +1070,6 @@ BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 
nOffset,
                     m_nRowPos = 0;
                     break;
                 case IResultSetHelper::LAST:
-                    //  OSL_ENSURE(IsRowCountFinal(), "Error in Keyset!"); // must be frozen, 
otherwise error at SQLCursor
                     m_nRowPos = m_pFileSet->get().size() - 1;
                     break;
                 case IResultSetHelper::RELATIVE:
@@ -1093,9 +1087,8 @@ BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 
nOffset,
             // The FileCursor is outside of the valid range, if:
             // a.) m_nRowPos < 1
             // b.) a KeySet exists and m_nRowPos > m_pFileSet->size()
-            if (m_nRowPos < 0 || (m_pFileSet->isFrozen() && eCursorPosition != 
IResultSetHelper::BOOKMARK && m_nRowPos >= (INT32)m_pFileSet->get().size() )) // && 
m_pFileSet->IsFrozen()
+            if (m_nRowPos < 0 || (m_pFileSet->isFrozen() && eCursorPosition != 
IResultSetHelper::BOOKMARK && m_nRowPos >= (INT32)m_pFileSet->get().size() ))
             {
-                //     aStatus.Set(SQL_STAT_NO_DATA_FOUND);
                 goto Error;
             }
             else
@@ -1118,7 +1111,6 @@ BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 
nOffset,
                     if (!m_pFileSet->get().empty())
                     {
                         m_aFileSetIter = m_pFileSet->get().end()-1;
-                        //     m_pFileSet->SeekPos(m_pFileSet->size()-1);
                         m_pTable->seekRow(IResultSetHelper::BOOKMARK, *m_aFileSetIter, m_nFilePos);
                     }
                     sal_Bool bOK = sal_True;
@@ -1129,7 +1121,6 @@ BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 
nOffset,
                         {
                             if (m_nRowPos >= (INT32)m_pEvaluationKeySet->size())
                                 return sal_False;
-                                //     aStatus.Set(SQL_STAT_NO_DATA_FOUND);
                             else if (m_nRowPos == 0)
                             {
                                 m_aEvaluateIter = m_pEvaluationKeySet->begin();
@@ -1160,12 +1151,8 @@ BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 
nOffset,
                     }
                     else if (!m_pFileSet->isFrozen())                                  // no valid 
record found
                     {
-                        //m_pFileSet->Freeze();
                         m_pFileSet->setFrozen();
-
-                        //     DELETEZ(m_pEvaluationKeySet);
                         m_pEvaluationKeySet = NULL;
-                        //     aStatus.Set(SQL_STAT_NO_DATA_FOUND);
                         goto Error;
                     }
                 }
@@ -1251,9 +1238,6 @@ Error:
                 m_nRowPos = nTempPos;   // last Position
         }
     }
-    // delete pGuard;
-    //  rMode = (!bShowDeleted && aStatus.IsSuccessful() && m_aRow->isDeleted()) ?  // no display 
of deleted records
-                //     OCursor::SQL_MOD_INVALID : OCursor::SQL_MOD_NONE;
     return sal_False;
 }
 // -------------------------------------------------------------------------
@@ -1266,7 +1250,7 @@ void OResultSet::sortRows()
         // and this field is indexed, then the Index will be used
         Reference<XIndexesSupplier> xIndexSup;
         m_pTable->queryInterface(::getCppuType((const Reference<XIndexesSupplier>*)0)) >>= 
xIndexSup;
-        //     Reference<XIndexesSupplier> xIndexSup(m_pTable,UNO_QUERY);
+
         Reference<XIndexAccess> xIndexes;
         if(xIndexSup.is())
         {
@@ -1350,12 +1334,9 @@ void OResultSet::sortRows()
     }
     
     // create sorted Keyset
-    // DELETEZ(m_pEvaluationKeySet);
     m_pEvaluationKeySet = NULL;
     m_pFileSet = NULL;
     m_pFileSet = m_pSortIndex->CreateKeySet();
-    // if(!bDistinct)
-        //     SetRowCount(pFileSet->count());
     DELETEZ(m_pSortIndex);
     // now access to a sorted set is possible via Index
 }
@@ -1399,7 +1380,6 @@ BOOL OResultSet::OpenImpl()
 
     // create new Index:
     m_pFileSet = NULL;
-    // DELETEZ(m_pEvaluationKeySet);
 
     // position at the beginning
     m_nRowPos = -1;
@@ -1449,7 +1429,6 @@ BOOL OResultSet::OpenImpl()
                     // save result of COUNT(*) in m_nRowCountResult.
                     // nRowCount (number of Rows in the result) = 1 for this request!
                     m_pEvaluationKeySet = NULL;
-                    // DELETEZ(m_pEvaluationKeySet);
                 }
             }
             else
@@ -1465,7 +1444,7 @@ BOOL OResultSet::OpenImpl()
                     // Sort on all columns, saving original order for later
                     if(IsSorted())
                     {
-                        aOrderbyColumnNumberSave = m_aOrderbyColumnNumber;// 
.assign(m_aOrderbyColumnNumber.begin(), m_aOrderbyColumnNumber.end());
+                        aOrderbyColumnNumberSave = m_aOrderbyColumnNumber;
                         m_aOrderbyColumnNumber.clear();
                         aOrderbyAscendingSave.assign(m_aOrderbyAscending.begin(), 
m_aOrderbyAscending.end());
                         bWasSorted = TRUE;
@@ -1474,7 +1453,6 @@ BOOL OResultSet::OpenImpl()
                     // the first column is the bookmark column
                     ::std::vector<sal_Int32>::iterator aColStart = (m_aColMapping.begin()+1);
                     ::std::copy(aColStart, 
m_aColMapping.end(),::std::back_inserter(m_aOrderbyColumnNumber));
-//                                     m_aOrderbyColumnNumber.assign(aColStart, 
m_aColMapping.end());
                     m_aOrderbyAscending.assign(m_aColMapping.size()-1, SQL_ASC);
                     bDistinct = TRUE;
                 }
@@ -1530,7 +1508,6 @@ BOOL OResultSet::OpenImpl()
                                         copyFrom != m_aSelectRow->get().end();
                                         ++copyFrom,++copyTo)
                                             *copyTo = *(*copyFrom);
-                                // *aSearchRow = *m_aRow;
                             }
 
                             // compare with next row
@@ -1576,7 +1553,6 @@ BOOL OResultSet::OpenImpl()
                             ::std::sort(m_pFileSet->get().begin(),m_pFileSet->get().end());
                         }
                     }
-                    // SetRowCount(m_pFileSet->count());
                 }
             }
         }      break;
@@ -1616,10 +1592,8 @@ BOOL OResultSet::OpenImpl()
 
                 // save result of COUNT(*) in nRowCountResult.
                 // nRowCount (number of rows in the result-set) = 1 for this request!
-                //     DELETEZ(m_pEvaluationKeySet);
                 m_pEvaluationKeySet = NULL;
             }
-            // SetRowCount(1);
             break;
         case SQL_STATEMENT_INSERT:
             m_nRowCountResult = 0;
@@ -1880,7 +1854,6 @@ sal_Bool OResultSet::isRowDeleted() const
 void SAL_CALL OResultSet::disposing( const EventObject& Source ) throw (RuntimeException)
 {
     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::disposing" );
-    // Reference<XInterface> xInt = m_pTable;
     Reference<XPropertySet> xProp = m_pTable;
     if(m_pTable && Source.Source == xProp)
     {
diff --git a/connectivity/source/drivers/file/FStatement.cxx 
b/connectivity/source/drivers/file/FStatement.cxx
index 617a224..161e210 100644
--- a/connectivity/source/drivers/file/FStatement.cxx
+++ b/connectivity/source/drivers/file/FStatement.cxx
@@ -430,20 +430,10 @@ void OStatement_Base::setOrderbyColumn(   OSQLParseNode* pColumnRef,
         aColumnName = pColumnRef->getChild(0)->getTokenValue();
     else if (pColumnRef->count() == 3)
     {
-        // Just the Table Range-variable may appear here:
-//             if (!(pColumnRef->getChild(0)->getTokenValue() == aTableRange))
-//             {
-//                     aStatus.Set(SQL_STAT_ERROR,
-//                                             String::CreateFromAscii("S1000"),
-//                                             
aStatus.CreateErrorMessage(String(SdbResId(STR_STAT_INVALID_RANGE_VAR))),
-//                                             0, String() );
-            // return;
-        //     }
         pColumnRef->getChild(2)->parseNodeToStr( aColumnName, getOwnConnection(), NULL, sal_False, 
sal_False );
     }
     else
     {
-        //     aStatus.SetStatementTooComplex();
         throw SQLException();
     }
 
@@ -655,7 +645,7 @@ void OStatement_Base::GetAssignValues()
 
         OSL_ENSURE(pValuesOrQuerySpec->count() == 4,"OResultSet: pValuesOrQuerySpec->count() != 
4");
 
-        // Liste of values
+        // List of values
         OSQLParseNode * pInsertAtomCommalist = pValuesOrQuerySpec->getChild(2);
         OSL_ENSURE(pInsertAtomCommalist != NULL,"OResultSet: pInsertAtomCommalist darf nicht NULL 
sein!");
         OSL_ENSURE(pInsertAtomCommalist->count() > 0,"OResultSet: pInsertAtomCommalist <= 0");
@@ -720,7 +710,6 @@ void OStatement_Base::GetAssignValues()
             OSL_ENSURE(pComp->getNodeType() == SQL_NODE_EQUAL,"OResultSet: pComp->getNodeType() != 
SQL_NODE_COMPARISON");
             if (pComp->getTokenValue().toChar() != '=')
             {
-                //     aStatus.SetInvalidStatement();
                 throwFunctionSequenceException(*this);
             }
 
@@ -757,7 +746,6 @@ void OStatement_Base::ParseAssignValues(const ::std::vector< String>& aColumnNam
         parseParamterElem(aColumnName,pRow_Value_Constructor_Elem);
     else
     {
-        //     aStatus.SetStatementTooComplex();
         throwFunctionSequenceException(*this);
     }
 }
@@ -776,15 +764,9 @@ void OStatement_Base::SetAssignValue(const String& aColumnName,
     if (!xCol.is())
     {
         // This Column doesn't exist!
-//             aStatus.Set(SQL_STAT_ERROR,
-//                                     String::CreateFromAscii("S0022"),
-//                                     
aStatus.CreateErrorMessage(String(SdbResId(STR_STAT_COLUMN_NOT_FOUND))),
-//                                     0, String() );
         throwFunctionSequenceException(*this);
     }
 
-    // tie Value to the Row with values that shall be assigned:
-    // const ODbVariantRef& xValue = (*aAssignValues)[pFileColumn->GetId()];
 
     // Everything tested and we have the names of the Column.
     // Now allocate one Value, set the value and tie the value to the Row.
@@ -810,7 +792,6 @@ void OStatement_Base::SetAssignValue(const String& aColumnName,
                         *(m_aAssignValues->get())[nId] = sal_False;
                     else
                     {
-                        //     aStatus.Set(SQL_STAT_ERROR);    // nyi: more accurate!
                         throwFunctionSequenceException(*this);
                     }
                 }
@@ -826,16 +807,7 @@ void OStatement_Base::SetAssignValue(const String& aColumnName,
             case DataType::TIME:
             case DataType::TIMESTAMP:
             {
-                *(m_aAssignValues->get())[nId] = ORowSetValue(aValue); // .ToDouble
-//                             try
-//                             {
-//                                     double n = xValue->toDouble();
-//                                     xValue->setDouble(n);
-//                             }
-//                             catch ( ... )
-//                             {
-//                                     aStatus.SetDriverNotCapableError();
-//                             }
+                *(m_aAssignValues->get())[nId] = ORowSetValue(aValue);
             }  break;
             default:
                 throwFunctionSequenceException(*this);
diff --git a/connectivity/source/drivers/file/fanalyzer.cxx 
b/connectivity/source/drivers/file/fanalyzer.cxx
index 32a0228..ef73134 100644
--- a/connectivity/source/drivers/file/fanalyzer.cxx
+++ b/connectivity/source/drivers/file/fanalyzer.cxx
@@ -254,7 +254,6 @@ void OSQLAnalyzer::describeParam(::rtl::Reference<OSQLColumns> rParameterColumns
         OSL_ENSURE(0,"Illegal here!");
 
     rParameterColumns = aNewParamColumns;
-    // m_aCompiler->setParameterColumns(rParameterColumns);
 }
 
 // -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx
index 9b79545..7570d7a 100644
--- a/connectivity/source/drivers/file/fcomp.cxx
+++ b/connectivity/source/drivers/file/fcomp.cxx
@@ -58,7 +58,6 @@ using namespace ::com::sun::star::util;
 DBG_NAME(OPredicateCompiler)
 //------------------------------------------------------------------
 OPredicateCompiler::OPredicateCompiler(OSQLAnalyzer* pAnalyzer)//,OCursor& rCurs)
-                     //        : m_rCursor(rCurs)
                      : m_pAnalyzer(pAnalyzer)
                      , m_nParamCounter(0)
                      , m_bORCondition(FALSE)
-- 
1.7.0.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.