20#include <com/sun/star/sdbcx/Privilege.hpp>
21#include <com/sun/star/beans/PropertyAttribute.hpp>
24 Tables* pTables, osl::Mutex& rMutex,
25 const css::uno::Reference<OMetaConnection::XConnection>& rConnection)
26 : OTableHelper(pTables, rConnection, true)
34 Tables* pTables, osl::Mutex& rMutex,
35 const css::uno::Reference<OMetaConnection::XConnection>& rConnection,
const OUString& rCatalog,
36 const OUString& rSchema,
const OUString& rName,
const OUString& rType,
37 const OUString& rDescription)
38 : OTableHelper(pTables, rConnection, true, rName, rType, rDescription, rSchema, rCatalog)
52 m_nPrivileges = css::sdbcx::Privilege::DROP | css::sdbcx::Privilege::REFERENCE
53 | css::sdbcx::Privilege::ALTER | css::sdbcx::Privilege::CREATE
54 | css::sdbcx::Privilege::READ | css::sdbcx::Privilege::DELETE
55 | css::sdbcx::Privilege::UPDATE | css::sdbcx::Privilege::INSERT
56 | css::sdbcx::Privilege::SELECT;
82 const OUString& rColName,
const css::uno::Reference<XPropertySet>& rDescriptor)
84 osl::MutexGuard aGuard(m_rMutex);
85 checkDisposed(WeakComponentImplHelperBase::rBHelper.bDisposed);
87 css::uno::Reference<XPropertySet>
xColumn(m_xColumns->getByName(rColName), css::uno::UNO_QUERY);
90 const bool bNameChanged
91 =
xColumn->getPropertyValue(
"Name") != rDescriptor->getPropertyValue(
"Name");
93 const bool bTypeChanged
94 =
xColumn->getPropertyValue(
"Type") != rDescriptor->getPropertyValue(
"Type");
97 rDescriptor->getPropertyValue(
"TypeName")));
98 const bool bPrecisionChanged
99 =
xColumn->getPropertyValue(
"Precision") != rDescriptor->getPropertyValue(
"Precision");
100 const bool bScaleChanged
101 =
xColumn->getPropertyValue(
"Scale") != rDescriptor->getPropertyValue(
"Scale");
103 const bool bIsNullableChanged
104 =
xColumn->getPropertyValue(
"IsNullable") != rDescriptor->getPropertyValue(
"IsNullable");
106 const bool bIsAutoIncrementChanged =
xColumn->getPropertyValue(
"IsAutoIncrement")
107 != rDescriptor->getPropertyValue(
"IsAutoIncrement");
112 if (bTypeChanged || bTypeNameChanged || bPrecisionChanged || bScaleChanged || bIsNullableChanged
113 || bIsAutoIncrementChanged)
118 OUStringBuffer sSql(300);
119 sSql.append(getAlterTableColumnPart() +
" MODIFY COLUMN `" + rColName +
"` "
123 sSql.append(
" auto_increment");
129 sSql.append(
" NOT NULL");
131 getConnection()->createStatement()->execute(sSql.makeStringAndClear());
136 OUString sNewColName;
137 rDescriptor->getPropertyValue(
"Name") >>= sNewColName;
138 OUString sSql(getAlterTableColumnPart() +
" RENAME COLUMN `" + rColName +
"` TO `"
139 + sNewColName +
"`");
144 m_xColumns->refresh();
148 sal_Int32 index,
const css::uno::Reference<css::beans::XPropertySet>& descriptor)
151 css::uno::Reference<XPropertySet>
xColumn(m_xColumns->getByIndex(
index),
152 css::uno::UNO_QUERY_THROW);
160 return "ALTER TABLE "
162 ::dbtools::EComposeRule::InTableDefinitions);
void registerProperty(const OUString &_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, void *_pPointerToMember, const css::uno::Type &_rMemberType)
virtual ::connectivity::sdbcx::OCollection * createIndexes(const ::std::vector< OUString > &rNames) override
creates the index collection for the table
virtual void SAL_CALL alterColumnByIndex(sal_Int32 index, const css::uno::Reference< css::beans::XPropertySet > &descriptor) override
virtual ::connectivity::sdbcx::OCollection * createKeys(const ::std::vector< OUString > &rNames) override
creates the key collection for the table
OUString getAlterTableColumnPart() const
returns the ALTER TABLE XXX statement
Table(Tables *pTables, ::osl::Mutex &rMutex, const css::uno::Reference< css::sdbc::XConnection > &_xConnection)
virtual ::connectivity::sdbcx::OCollection * createColumns(const ::std::vector< OUString > &rNames) override
creates the column collection for the table
virtual OUString getRenameStart() const override
Returns always "RENAME TABLE " even for views.
virtual void SAL_CALL alterColumnByName(const OUString &rColName, const css::uno::Reference< css::beans::XPropertySet > &rDescriptor) override
See css::sdbcx::ColumnDescriptor for details of rDescriptor.
void construct() override
virtual void construct() override
bool getBOOL(const Any &_rAny)
sal_Int32 getINT32(const Any &_rAny)
OUString getString(const Any &_rAny)
void checkDisposed(bool _bThrow)
#define PROPERTY_ID_PRIVILEGES