Kaydet (Commit) 4fb371b5 authored tarafından Jens-Heiner Rechtien's avatar Jens-Heiner Rechtien

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
üst a6948707
......@@ -4,9 +4,9 @@
*
* $RCSfile: HTable.cxx,v $
*
* $Revision: 1.11 $
* $Revision: 1.12 $
*
* last change: $Author: kz $ $Date: 2007-05-10 09:38:15 $
* last change: $Author: hr $ $Date: 2007-11-02 11:25:58 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
......@@ -257,6 +257,23 @@ void SAL_CALL OHSQLTable::alterColumnByName( const ::rtl::OUString& colName, con
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 @@ void SAL_CALL OHSQLTable::alterColumnByName( const ::rtl::OUString& colName, con
{
/// 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 @@ void SAL_CALL OHSQLTable::alterColumnByName( const ::rtl::OUString& colName, con
{
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment