From e2d40ddc8a12c8c0b3c1c96e221e1ada409ab092 Mon Sep 17 00:00:00 2001 From: Ocke Janssen Date: Mon, 27 Nov 2000 07:00:26 +0000 Subject: new parameter in fetchRow --- connectivity/source/drivers/dbase/DTable.cxx | 30 +++++++++++++++++++++------- connectivity/source/inc/file/FTable.hxx | 6 +++--- connectivity/source/inc/flat/ETable.hxx | 6 +++--- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index c588d68a129a..291188c856ed 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DTable.cxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * - * last change: $Author: oj $ $Date: 2000-11-17 07:37:01 $ + * last change: $Author: oj $ $Date: 2000-11-27 08:00:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -264,6 +264,9 @@ void ODbaseTable::fillColumns() getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); Reference< XPropertySet> xCol = pColumn; m_aColumns->push_back(xCol); + m_aTypes.push_back(eType); + m_aPrecisions.push_back(nPrecision); + m_aScales.push_back(aDBFColumn.db_dez); } } // ------------------------------------------------------------------------- @@ -646,7 +649,7 @@ End: return sal_True; } //------------------------------------------------------------------ -sal_Bool ODbaseTable::fetchRow(file::OValueRow _rRow,const OSQLColumns & _rCols, sal_Bool bRetrieveData) +sal_Bool ODbaseTable::fetchRow(file::OValueRow _rRow,const OSQLColumns & _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData) { // Einlesen der Daten BOOL bIsCurRecordDeleted = ((char)m_pBuffer[0] == '*') ? TRUE : sal_False; @@ -672,13 +675,25 @@ sal_Bool ODbaseTable::fetchRow(file::OValueRow _rRow,const OSQLColumns & _rCols, // Laengen je nach Datentyp: // nyi: eine zentrale Funktion, die die Laenge liefert! sal_Int32 nLen; - xColumn->getPropertyValue(PROPERTY_PRECISION) >>= nLen; - sal_Int32 nType = getINT32(xColumn->getPropertyValue(PROPERTY_TYPE)); + sal_Int32 nType; + if(_bUseTableDefs) + { + nLen = m_aPrecisions[(_rCols.end()-aIter)-1]; + nType = m_aTypes[(_rCols.end()-aIter)-1]; + } + else + { + xColumn->getPropertyValue(PROPERTY_PRECISION) >>= nLen; + xColumn->getPropertyValue(PROPERTY_TYPE) >>= nType; + } switch(nType) { case DataType::DATE: nLen = 8; break; case DataType::DECIMAL: - nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,getINT32(xColumn->getPropertyValue(PROPERTY_SCALE))); + if(_bUseTableDefs) + nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,m_aScales[(_rCols.end()-aIter)-1]); + else + nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,getINT32(xColumn->getPropertyValue(PROPERTY_SCALE))); break; // das Vorzeichen und das Komma case DataType::BIT: nLen = 1; break; case DataType::LONGVARCHAR: nLen = 10; break; @@ -1350,7 +1365,7 @@ BOOL ODbaseTable::DeleteRow(const OSQLColumns& _rCols) OValueRow aRow = new OValueVector(_rCols.size()); - if (!fetchRow(aRow,_rCols,TRUE)) + if (!fetchRow(aRow,_rCols,TRUE,TRUE)) return sal_False; Reference xCol; @@ -1837,3 +1852,4 @@ BOOL ODbaseTable::WriteBuffer() return m_pFileStream->Write((char*) m_pBuffer, m_aHeader.db_slng) > 0; } // ----------------------------------------------------------------------------- + diff --git a/connectivity/source/inc/file/FTable.hxx b/connectivity/source/inc/file/FTable.hxx index 82b0fe9e1700..4bc5851a4be2 100644 --- a/connectivity/source/inc/file/FTable.hxx +++ b/connectivity/source/inc/file/FTable.hxx @@ -2,9 +2,9 @@ * * $RCSfile: FTable.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2000-11-16 10:45:43 $ + * last change: $Author: oj $ $Date: 2000-11-27 08:00:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -135,7 +135,7 @@ namespace connectivity virtual sal_Int32 getCurrentLastPos() const {return -1;} virtual sal_Bool seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) = 0; - virtual sal_Bool fetchRow(OValueRow _rRow,const OSQLColumns& _rCols, sal_Bool bRetrieveData) = 0; + virtual sal_Bool fetchRow(OValueRow _rRow,const OSQLColumns& _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData) = 0; ::vos::ORef getTableColumns() const {return m_aColumns;} virtual BOOL InsertRow(OValueVector& rRow, BOOL bFlush,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols) diff --git a/connectivity/source/inc/flat/ETable.hxx b/connectivity/source/inc/flat/ETable.hxx index 9aef12a99ce2..13cc6cc31dbd 100644 --- a/connectivity/source/inc/flat/ETable.hxx +++ b/connectivity/source/inc/flat/ETable.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ETable.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2000-11-03 13:54:02 $ + * last change: $Author: oj $ $Date: 2000-11-27 07:59:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -136,7 +136,7 @@ namespace connectivity ); virtual sal_Bool seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos); - virtual sal_Bool fetchRow(file::OValueRow _rRow,const OSQLColumns& _rCols, sal_Bool bRetrieveData); + virtual sal_Bool fetchRow(file::OValueRow _rRow,const OSQLColumns& _rCols, sal_Bool bIsTable,sal_Bool bRetrieveData); virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); //XTypeProvider -- cgit