diff options
author | Ocke Janssen <oj@openoffice.org> | 2001-03-01 09:56:00 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2001-03-01 09:56:00 +0000 |
commit | b589515bb3c4fa1250d69a4f985d01e4b112b19b (patch) | |
tree | 72c6309a1e615cf558a4dceb39045539be70400d /connectivity/source | |
parent | 7cbeb1ea9ecdb80a9b9606189a23018f0d924a85 (diff) |
error msg inserted
Diffstat (limited to 'connectivity/source')
-rw-r--r-- | connectivity/source/drivers/dbase/DTable.cxx | 92 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/DTables.cxx | 13 | ||||
-rw-r--r-- | connectivity/source/inc/dbase/DTable.hxx | 5 |
3 files changed, 46 insertions, 64 deletions
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 4312519507ca..9747525d9035 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.30 $ + * $Revision: 1.31 $ * - * last change: $Author: oj $ $Date: 2001-03-01 10:49:49 $ + * last change: $Author: oj $ $Date: 2001-03-01 10:54:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -165,7 +165,6 @@ void ODbaseTable::readHeader() ((m_aHeader.db_kopf - 1) / 32 - 1) <= 0) // anzahl felder { // no dbase file - m_bValid = sal_False; ::rtl::OUString sMessage = ::rtl::OUString::createFromAscii("[StarOffice Base dbase] The file '"); sMessage += getEntry(); sMessage += ::rtl::OUString::createFromAscii(" is an invalid (or unrecognized) dBase file."); @@ -186,7 +185,6 @@ void ODbaseTable::readHeader() case dBaseIIIMemo: case dBaseIVMemo: case FoxProMemo: - m_bValid = sal_True; m_pFileStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); break; default: @@ -288,7 +286,6 @@ ODbaseTable::ODbaseTable(ODbaseConnection* _pConnection) :ODbaseTable_BASE(_pConnection) ,m_pMemoStream(NULL) ,m_bWriteableMemo(sal_False) - ,m_bValid(sal_False) { // initialize the header m_aHeader.db_typ = dBaseIII; @@ -310,7 +307,6 @@ ODbaseTable::ODbaseTable(ODbaseConnection* _pConnection, _CatalogName) ,m_pMemoStream(NULL) ,m_bWriteableMemo(sal_False) - ,m_bValid(sal_False) { } // ----------------------------------------------------------------------------- @@ -339,58 +335,54 @@ void ODbaseTable::construct() if(m_pFileStream) { readHeader(); - if(isValid()) + if (HasMemoFields()) { + // Memo-Dateinamen bilden (.DBT): + // nyi: Unschoen fuer Unix und Mac! - if (HasMemoFields()) - { - // Memo-Dateinamen bilden (.DBT): - // nyi: Unschoen fuer Unix und Mac! + if (m_aHeader.db_typ == FoxProMemo) // foxpro uses another extension + aURL.SetExtension(String::CreateFromAscii("fpt")); + else + aURL.SetExtension(String::CreateFromAscii("dbt")); + + // Wenn die Memodatei nicht gefunden wird, werden die Daten trotzdem angezeigt + // allerdings koennen keine Updates durchgefuehrt werden + // jedoch die Operation wird ausgefuehrt + m_pMemoStream = ::utl::UcbStreamHelper::CreateStream( aURL.GetURLNoPass(), STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE); + if (!(m_bWriteableMemo = (NULL != m_pMemoStream))) + m_pMemoStream = ::utl::UcbStreamHelper::CreateStream( aURL.GetURLNoPass(), STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYNONE ); + if (m_pMemoStream) + ReadMemoHeader(); + } + fillColumns(); - if (m_aHeader.db_typ == FoxProMemo) // foxpro uses another extension - aURL.SetExtension(String::CreateFromAscii("fpt")); - else - aURL.SetExtension(String::CreateFromAscii("dbt")); - - // Wenn die Memodatei nicht gefunden wird, werden die Daten trotzdem angezeigt - // allerdings koennen keine Updates durchgefuehrt werden - // jedoch die Operation wird ausgefuehrt - m_pMemoStream = ::utl::UcbStreamHelper::CreateStream( aURL.GetURLNoPass(), STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE); - if (!(m_bWriteableMemo = (NULL != m_pMemoStream))) - m_pMemoStream = ::utl::UcbStreamHelper::CreateStream( aURL.GetURLNoPass(), STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYNONE ); - if (m_pMemoStream) - ReadMemoHeader(); - } - fillColumns(); + m_pFileStream->Seek(STREAM_SEEK_TO_END); + UINT32 nFileSize = m_pFileStream->Tell(); + m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN); - m_pFileStream->Seek(STREAM_SEEK_TO_END); - UINT32 nFileSize = m_pFileStream->Tell(); - m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN); + // Buffersize abhaengig von der Filegroesse + m_pFileStream->SetBufferSize(nFileSize > 1000000 ? 32768 : + nFileSize > 100000 ? 16384 : + nFileSize > 10000 ? 4096 : 1024); - // Buffersize abhaengig von der Filegroesse - m_pFileStream->SetBufferSize(nFileSize > 1000000 ? 32768 : - nFileSize > 100000 ? 16384 : - nFileSize > 10000 ? 4096 : 1024); + if (m_pMemoStream) + { + // Puffer genau auf Laenge eines Satzes stellen + m_pMemoStream->Seek(STREAM_SEEK_TO_END); + nFileSize = m_pMemoStream->Tell(); + m_pMemoStream->Seek(STREAM_SEEK_TO_BEGIN); - if (m_pMemoStream) - { - // Puffer genau auf Laenge eines Satzes stellen - m_pMemoStream->Seek(STREAM_SEEK_TO_END); - nFileSize = m_pMemoStream->Tell(); - m_pMemoStream->Seek(STREAM_SEEK_TO_BEGIN); - - // Buffersize abhaengig von der Filegroesse - m_pMemoStream->SetBufferSize(nFileSize > 1000000 ? 32768 : - nFileSize > 100000 ? 16384 : - nFileSize > 10000 ? 4096 : - m_aMemoHeader.db_size); - } + // Buffersize abhaengig von der Filegroesse + m_pMemoStream->SetBufferSize(nFileSize > 1000000 ? 32768 : + nFileSize > 100000 ? 16384 : + nFileSize > 10000 ? 4096 : + m_aMemoHeader.db_size); + } - AllocBuffer(); + AllocBuffer(); - refreshColumns(); - refreshIndexes(); - } + refreshColumns(); + refreshIndexes(); } } //------------------------------------------------------------------ diff --git a/connectivity/source/drivers/dbase/DTables.cxx b/connectivity/source/drivers/dbase/DTables.cxx index 248ec810ebb9..88e788fad3fe 100644 --- a/connectivity/source/drivers/dbase/DTables.cxx +++ b/connectivity/source/drivers/dbase/DTables.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DTables.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: fs $ $Date: 2001-02-28 09:15:30 $ + * last change: $Author: oj $ $Date: 2001-03-01 10:56:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -119,15 +119,6 @@ Reference< XNamed > ODbaseTables::createObject(const ::rtl::OUString& _rName) Reference< XNamed > xRet = pRet; pRet->construct(); - if(!pRet->isValid()) - { - ::comphelper::disposeComponent(xRet); - String sMessage = pRet->getInvalidityMessage(); - if (!sMessage.Len()) - sMessage = String::CreateFromAscii("Invalid DBase file found!"); - throw SQLException(sMessage, m_rParent, _rName, 1000, Any()); - } - return xRet; } // ------------------------------------------------------------------------- diff --git a/connectivity/source/inc/dbase/DTable.hxx b/connectivity/source/inc/dbase/DTable.hxx index 7ea8cf5d827b..3fcd61d85466 100644 --- a/connectivity/source/inc/dbase/DTable.hxx +++ b/connectivity/source/inc/dbase/DTable.hxx @@ -2,9 +2,9 @@ * * $RCSfile: DTable.hxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: oj $ $Date: 2001-03-01 10:52:13 $ + * last change: $Author: oj $ $Date: 2001-03-01 10:54:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -187,7 +187,6 @@ namespace connectivity BOOL DropImpl(); BOOL CreateImpl(); String getEntry(); - String getInvalidityMessage() const { return m_sInvalidityMessage; } virtual BOOL InsertRow(file::OValueVector& rRow, BOOL bFlush,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); virtual BOOL DeleteRow(const OSQLColumns& _rCols); |