User: rt      
Date: 05/10/24 01:20:53

Modified:
 /dba/connectivity/source/drivers/dbase/
  DTable.cxx

Log:
 INTEGRATION: CWS dba201d (1.89.12); FILE MERGED
 2005/10/12 07:40:58 oj 1.89.12.1: #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.90
Delta lines:  +128 -121
-----------------------
--- DTable.cxx  8 Sep 2005 05:40:14 -0000       1.89
+++ DTable.cxx  24 Oct 2005 08:20:50 -0000      1.90
@@ -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]

Reply via email to