Tag: cws_src680_dba201d User: oj Date: 05/10/12 00:41:01 Modified: /dba/connectivity/source/drivers/dbase/ DTable.cxx
Log: #i35859# correct textencoding handling File Changes: Directory: /dba/connectivity/source/drivers/dbase/ ================================================== File [changed]: DTable.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/dbase/DTable.cxx?r1=1.89&r2=1.89.12.1 Delta lines: +132 -125 ----------------------- --- DTable.cxx 8 Sep 2005 05:40:14 -0000 1.89 +++ DTable.cxx 12 Oct 2005 07:40:58 -0000 1.89.12.1 @@ -4,9 +4,9 @@ * * $RCSfile: DTable.cxx,v $ * - * $Revision: 1.89 $ + * $Revision: 1.89.12.1 $ * - * last change: $Author: rt $ $Date: 2005/09/08 05:40:14 $ + * last change: $Author: oj $ $Date: 2005/10/12 07:40:58 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -971,6 +971,8 @@ ::rtl::OUString aName; Reference<XPropertySet> xCol; + try + { for(sal_Int32 i=0;i<xColumns->getCount();++i) { ::cppu::extractInterface(xCol,xColumns->getByIndex(i)); @@ -980,25 +982,17 @@ xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aName; - if (aName.getLength() > nMaxFieldLength) - { - try + ::rtl::OString aCol; + if ( DBTypeConversion::convertUnicodeString( aName, aCol, getConnection()->getTextEncoding() ) > nMaxFieldLength) { - // we have to drop the file because it is corrupted now - DropImpl(); - } - catch(const Exception&) - { - } ::rtl::OUString sMsg = ::rtl::OUString::createFromAscii("Invalid column name length for column: "); sMsg += aName; sMsg += ::rtl::OUString::createFromAscii("!"); throw SQLException(sMsg,*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); } - ByteString aCol(aName.getStr(), getConnection()->getTextEncoding()); - (*m_pFileStream) << aCol.GetBuffer(); - m_pFileStream->Write(aBuffer, 11 - aCol.Len()); + (*m_pFileStream) << aCol.getStr(); + m_pFileStream->Write(aBuffer, 11 - aCol.getLength()); switch (getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) { @@ -1107,6 +1101,19 @@ { m_pFileStream->Seek(0L); (*m_pFileStream) << (BYTE) dBaseIIIMemo; + } // if (bCreateMemo) + } + catch(const Exception& e) + { + try + { + // we have to drop the file because it is corrupted now + DropImpl(); + } + catch(const Exception&) + { + } + throw e; } return TRUE; } @@ -2227,7 +2234,7 @@ { OSL_ASSERT(0); } - } + } // for(sal_uInt32 nRowPos = 0; nRowPos < m_aHeader.db_anz;++nRowPos) } // ----------------------------------------------------------------------------- void ODbaseTable::throwInvalidDbaseFormat() --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
