21#include <com/sun/star/beans/PropertyValue.hpp>
22#include <com/sun/star/sdbc/XConnection.hpp>
28#include <com/sun/star/reflection/ProxyFactory.hpp>
39OConnectionWrapper::OConnectionWrapper()
46 OSL_ENSURE(_rxProxyConnection.is(),
"OConnectionWrapper: Connection must be valid!");
47 osl_atomic_increment( &_rRefCount );
48 if (_rxProxyConnection.is())
52 _rxProxyConnection =
nullptr;
63 osl_atomic_decrement( &_rRefCount );
68 ,oslInterlockedCount& _rRefCount)
70 OSL_ENSURE(_xConnection.is(),
"OConnectionWrapper: Connection must be valid!");
71 osl_atomic_increment( &_rRefCount );
90 osl_atomic_decrement( &_rRefCount );
106OUString SAL_CALL OConnectionWrapper::getImplementationName( )
108 return "com.sun.star.sdbc.drivers.OConnectionWrapper";
112css::uno::Sequence< OUString > SAL_CALL OConnectionWrapper::getSupportedServiceNames( )
120 OUString sConnectionService(
"com.sun.star.sdbc.Connection" );
121 if ( ::comphelper::findValue( aSupported, sConnectionService ) == -1 )
123 sal_Int32 nLen = aSupported.getLength();
124 aSupported.realloc( nLen + 1 );
125 aSupported.getArray()[ nLen ] = sConnectionService;
133sal_Bool SAL_CALL OConnectionWrapper::supportsService(
const OUString& _rServiceName )
147 return ::comphelper::concatSequences(
156 if (comphelper::isUnoTunnelId<OConnectionWrapper>(rId))
173 class TPropertyValueLessFunctor
176 TPropertyValueLessFunctor()
178 bool operator() (
const css::beans::PropertyValue& lhs,
const css::beans::PropertyValue& rhs)
const
180 return lhs.Name.compareToIgnoreAsciiCase(rhs.Name) < 0;
191 ,
const OUString& _rUserName
192 ,
const OUString& _rPassword)
196 sha1.
update(
reinterpret_cast<unsigned char const*
>(_rURL.getStr()), _rURL.getLength() *
sizeof(
sal_Unicode));
197 if ( !_rUserName.isEmpty() )
198 sha1.
update(
reinterpret_cast<unsigned char const*
>(_rUserName.getStr()), _rUserName.getLength() *
sizeof(
sal_Unicode));
199 if ( !_rPassword.isEmpty() )
200 sha1.
update(
reinterpret_cast<unsigned char const*
>(_rPassword.getStr()), _rPassword.getLength() *
sizeof(
sal_Unicode));
202 auto [
begin,
end] = asNonConstRange(_rInfo);
203 std::sort(
begin,
end,TPropertyValueLessFunctor());
205 for (PropertyValue
const & prop : std::as_const(_rInfo))
209 if ( prop.Value >>= sValue )
214 if ( prop.Value >>=
nValue )
215 sValue = OUString::number(
nValue);
219 if ( prop.Value >>=
aSeq )
221 for(OUString
const & s : std::as_const(
aSeq))
222 sha1.
update(
reinterpret_cast<unsigned char const*
>(s.getStr()), s.getLength() *
sizeof(
sal_Unicode));
226 if ( !sValue.isEmpty() )
229 sha1.
update(
reinterpret_cast<unsigned char const*
>(sValue.getStr()), sValue.getLength() *
sizeof(
sal_Unicode));
std::vector< unsigned char > finalize()
void update(const unsigned char *pInput, size_t length)
const css::uno::Sequence< sal_Int8 > & getSeq() const
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &_rType) override
css::uno::Reference< css::lang::XUnoTunnel > m_xUnoTunnel
void setDelegation(css::uno::Reference< css::uno::XAggregation > &_rxProxyConnection, oslInterlockedCount &_rRefCount)
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
static void createUniqueId(const OUString &_rURL, css::uno::Sequence< css::beans::PropertyValue > &_rInfo, sal_uInt8 *_pBuffer, const OUString &_rUserName=OUString(), const OUString &_rPassword=OUString())
method to create unique ids
css::uno::Reference< css::lang::XTypeProvider > m_xTypeProvider
css::uno::Reference< css::lang::XServiceInfo > m_xServiceInfo
css::uno::Reference< css::uno::XAggregation > m_xProxyConnection
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
virtual ~OConnectionWrapper()
css::uno::Reference< css::sdbc::XConnection > m_xConnection
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Sequence< sal_Int8 > aSeq
sal_Int64 getSomething_cast(void *p)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
enumrange< T >::Iterator begin(enumrange< T >)