38#include <rtl/ustrbuf.hxx>
43#include <com/sun/star/sdbc/SQLException.hpp>
54using com::sun::star::uno::Any;
55using com::sun::star::uno::Type;
59using com::sun::star::sdbc::XStatement;
60using com::sun::star::sdbc::SQLException;
65View::View( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
67 ConnectionSettings *pSettings)
80 m_xMutex,
m_conn, m_pSettings );
81 pView->copyValuesFrom(
this );
86void View::rename(
const OUString& newName )
88 MutexGuard guard( m_xMutex->GetMutex() );
96 OUString newTableName;
97 OUString newSchemaName;
101 if(
newName.indexOf(
'.' ) >= 0 )
108 newSchemaName = schema;
112 if( schema != newSchemaName )
116 OUStringBuffer buf(128);
117 buf.append(
"ALTER TABLE" );
119 buf.append(
"SET SCHEMA" );
122 statement->executeUpdate( buf.makeStringAndClear() );
123 setPropertyValue_NoBroadcast_public( st.
SCHEMA_NAME,
Any(newSchemaName) );
125 schema = newSchemaName;
127 catch( css::sdbc::SQLException &e )
129 OUString buf( e.Message +
"(NOTE: Only postgresql server >= V8.1 support changing a table's schema)" );
135 if( oldName != newTableName )
137 OUStringBuffer buf(128);
138 buf.append(
"ALTER TABLE" );
140 buf.append(
"RENAME TO" );
143 statement->executeUpdate( buf.makeStringAndClear() );
144 setPropertyValue_NoBroadcast_public( st.
NAME,
Any(newTableName) );
148 if( m_pSettings->views.is() )
150 m_pSettings->pViewsImpl->rename( fullOldName, fullNewName );
158 ReflectionBase::getTypes());
165 return css::uno::Sequence<sal_Int8>();
168Any View::queryInterface(
const Type & reqType )
170 Any ret = ReflectionBase::queryInterface( reqType );
171 if( ! ret.hasValue() )
172 ret = ::cppu::queryInterface(
174 static_cast< css::sdbcx::XRename *
> (
this )
179OUString View::getName( )
187void View::setName(
const OUString& aName )
193ViewDescriptor::ViewDescriptor(
194 const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
199 getStatics().refl.viewDescriptor.serviceNames,
210 pView->copyValuesFrom(
this );
css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
css::uno::Reference< css::sdbc::XConnection > m_conn
::rtl::Reference< comphelper::RefCountedMutex > m_xMutex
ConnectionSettings * m_pSettings
ViewDescriptor(const ::rtl::Reference< comphelper::RefCountedMutex > &refMutex, const css::uno::Reference< css::sdbc::XConnection > &connection, ConnectionSettings *pSettings)
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor() override
View(const ::rtl::Reference< comphelper::RefCountedMutex > &refMutex, const css::uno::Reference< css::sdbc::XConnection > &connection, ConnectionSettings *pSettings)
class SAL_NO_VTABLE XPropertySet
OUString newName(std::u16string_view aNewPrefix, std::u16string_view aOldPrefix, std::u16string_view old_Name)
void bufferQuoteQualifiedIdentifier(OUStringBuffer &buf, std::u16string_view schema, std::u16string_view table, ConnectionSettings *settings)
OUString concatQualified(std::u16string_view a, std::u16string_view b)
OUString extractStringProperty(const Reference< XPropertySet > &descriptor, const OUString &name)
void splitConcatenatedIdentifier(std::u16string_view source, OUString *first, OUString *second)
void disposeNoThrow(const css::uno::Reference< css::uno::XInterface > &r)
void bufferQuoteIdentifier(OUStringBuffer &buf, std::u16string_view toQuote, ConnectionSettings *settings)
rtl::Reference< Connection > m_conn