38#include <rtl/ustrbuf.hxx>
39#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
40#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
41#include <com/sun/star/sdbc/SQLException.hpp>
42#include <com/sun/star/sdbc/XRow.hpp>
55using com::sun::star::uno::Any;
56using com::sun::star::uno::UNO_QUERY;
59using com::sun::star::container::NoSuchElementException;
61using com::sun::star::sdbc::XRow;
62using com::sun::star::sdbc::XStatement;
63using com::sun::star::sdbc::XResultSet;
68 const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
69 const css::uno::Reference< css::sdbc::XConnection > & origin,
81 osl::MutexGuard guard(
m_xMutex->GetMutex() );
93 sal_Int32 tableIndex = 0;
100 OUString
name = xRow->getString( 1);
101 pUser->setPropertyValue_NoBroadcast_public(
112 catch ( css::sdbc::SQLException & e )
115 throw css::lang::WrappedTargetRuntimeException( e.Message,
124 const css::uno::Reference< css::beans::XPropertySet >& descriptor )
126 osl::MutexGuard guard(
m_xMutex->GetMutex() );
128 OUStringBuffer
update( 128 );
129 update.append(
"CREATE USER " );
131 update.append(
" PASSWORD " );
136 stmt->executeUpdate(
update.makeStringAndClear() );
141 String2IntMap::const_iterator ii =
m_name2index.find( elementName );
144 throw css::container::NoSuchElementException(
145 "User " + elementName +
" is unknown, so it can't be dropped",
154 osl::MutexGuard guard(
m_xMutex->GetMutex() );
157 throw css::lang::IndexOutOfBoundsException(
158 "USERS: Index out of range (allowed 0 to "
159 + OUString::number(
m_values.size() -1 )
160 +
", got " + OUString::number(
index )
170 OUStringBuffer
update( 128 );
171 update.append(
"DROP USER " );
176 stmt->executeUpdate(
update.makeStringAndClear() );
186 const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
187 const css::uno::Reference< css::sdbc::XConnection > & origin,
ConnectionSettings * m_pSettings
void fire(const EventBroadcastHelper &helper)
css::uno::Reference< css::sdbc::XConnection > m_origin
::rtl::Reference< comphelper::RefCountedMutex > m_xMutex
String2IntMap m_name2index
std::vector< css::uno::Any > m_values
virtual ~Users() override
virtual void SAL_CALL refresh() override
virtual void SAL_CALL appendByDescriptor(const css::uno::Reference< css::beans::XPropertySet > &descriptor) override
virtual void SAL_CALL dropByIndex(sal_Int32 index) override
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor() override
virtual void SAL_CALL disposing() override
virtual void SAL_CALL dropByName(const OUString &elementName) override
Users(const ::rtl::Reference< comphelper::RefCountedMutex > &refMutex, const css::uno::Reference< css::sdbc::XConnection > &origin, ConnectionSettings *pSettings)
static css::uno::Reference< css::container::XNameAccess > create(const ::rtl::Reference< comphelper::RefCountedMutex > &refMutex, const css::uno::Reference< css::sdbc::XConnection > &origin, ConnectionSettings *pSettings)
void set(css::uno::UnoInterfaceReference const &value)
class SAL_NO_VTABLE XPropertySet
Any SAL_CALL getCaughtException()
constexpr OUStringLiteral USER
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
void bufferQuoteConstant(OUStringBuffer &buf, std::u16string_view value, ConnectionSettings *settings)
std::unordered_map< OUString, sal_Int32 > String2IntMap
OUString extractStringProperty(const Reference< XPropertySet > &descriptor, const OUString &name)
void bufferQuoteIdentifier(OUStringBuffer &buf, std::u16string_view toQuote, ConnectionSettings *settings)
const sal_Int32 TABLE_INDEX_CATALOG
std::map< OUString, rtl::Reference< Entity > > map