User: hr      
Date: 2007-11-02 11:26:01+0000
Modified:
   dba/connectivity/source/drivers/hsqldb/HTable.cxx

Log:
 INTEGRATION: CWS dba231a_SRC680 (1.11.62); FILE MERGED
 2007/10/04 11:01:19 oj 1.11.62.1: #i81567# first change name before changing 
type

File Changes:

Directory: /dba/connectivity/source/drivers/hsqldb/
===================================================

File [changed]: HTable.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/hsqldb/HTable.cxx?r1=1.11&r2=1.12
Delta lines:  +20 -19
---------------------
--- HTable.cxx  2007-05-10 09:38:15+0000        1.11
+++ HTable.cxx  2007-11-02 11:25:58+0000        1.12
@@ -257,6 +257,23 @@
                
xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT))      
        >>= bOldAutoIncrement;
                
descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT)) 
>>= bAutoIncrement;
 
+        // now we should look if the name of the column changed
+               ::rtl::OUString sNewColumnName;
+               
descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_NAME)) >>= 
sNewColumnName;
+               if ( !sNewColumnName.equalsIgnoreAsciiCase(colName) )
+               {
+                       const ::rtl::OUString sQuote = 
getMetaData()->getIdentifierQuoteString(  );
+
+            ::rtl::OUString sSql = getAlterTableColumnPart();
+                       sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" 
ALTER COLUMN "));
+                       sSql += ::dbtools::quoteName(sQuote,colName);
+
+            sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" RENAME TO 
"));
+            sSql += ::dbtools::quoteName(sQuote,sNewColumnName);
+
+            executeStatement(sSql);
+               }
+
                if  (   nOldType != nNewType
             ||  sOldTypeName != sNewTypeName
                        ||      nOldPrec != nNewPrec
@@ -270,7 +287,7 @@
                        {
                                /// TODO: insert special handling for auto 
increment "IDENTITY" and primary key
                        }
-                       alterColumnType(nNewType,colName,descriptor);
+                       alterColumnType(nNewType,sNewColumnName,descriptor);
                }
 
                // third: check the default values
@@ -282,27 +299,11 @@
                {
                        dropDefaultValue(colName);
                        if(sNewDefault.getLength() && sOldDefault != 
sNewDefault)
-                               alterDefaultValue(sNewDefault,colName);
+                               alterDefaultValue(sNewDefault,sNewColumnName);
                }
                else if(!sOldDefault.getLength() && sNewDefault.getLength())
-                       alterDefaultValue(sNewDefault,colName);
+                       alterDefaultValue(sNewDefault,sNewColumnName);
 
-               // now we should look if the name of the column changed
-               ::rtl::OUString sNewColumnName;
-               
descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_NAME)) >>= 
sNewColumnName;
-               if ( !sNewColumnName.equalsIgnoreAsciiCase(colName) )
-               {
-                       const ::rtl::OUString sQuote = 
getMetaData()->getIdentifierQuoteString(  );
-
-            ::rtl::OUString sSql = getAlterTableColumnPart();
-                       sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" 
ALTER COLUMN "));
-                       sSql += ::dbtools::quoteName(sQuote,colName);
-
-            sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" RENAME TO 
"));
-            sSql += ::dbtools::quoteName(sQuote,sNewColumnName);
-
-            executeStatement(sSql);
-               }
                m_pColumns->refresh();
        }
        else




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to