LibreOffice Module connectivity (master) 1
AUsers.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <ado/AUsers.hxx>
21#include <ado/AUser.hxx>
22#include <ado/ATable.hxx>
23#include <ado/AConnection.hxx>
24#include <com/sun/star/sdbc/XRow.hpp>
25#include <com/sun/star/sdbc/XResultSet.hpp>
28#include <comphelper/types.hxx>
30#include <systools/win32/oleauto.hxx>
31#include <strings.hrc>
32
33using namespace comphelper;
34using namespace connectivity;
35using namespace connectivity::ado;
36using namespace com::sun::star::uno;
37using namespace com::sun::star::lang;
38using namespace com::sun::star::beans;
39using namespace com::sun::star::sdbc;
40using namespace com::sun::star::container;
41
42sdbcx::ObjectType OUsers::createObject(const OUString& _rName)
43{
44 return new OAdoUser(m_pCatalog,isCaseSensitive(),_rName);
45}
46
48{
50}
51
53{
55}
56
57// XAppend
58sdbcx::ObjectType OUsers::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
59{
60 OUserExtend* pUser = dynamic_cast<OUserExtend*>( descriptor.get() );
61 if ( pUser == nullptr )
62 m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_USER_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
63
64 ADOUsers* pUsers = m_aCollection;
65 pUsers->Append(OLEVariant(pUser->getImpl()), sal::systools::BStr(pUser->getPassword()));
66
67 return createObject( _rForName );
68}
69
70// XDrop
71void OUsers::dropObject(sal_Int32 /*_nPos*/,const OUString& _sElementName)
72{
73 m_aCollection.Delete(_sElementName);
74}
75
76
77/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void throwGenericSQLException(TranslateId pErrorResourceId, const css::uno::Reference< css::uno::XInterface > &_xContext)
Definition: TConnection.cxx:74
WpADOUser getImpl() const
Definition: AUser.hxx:59
OConnection * getConnection() const
Definition: ACatalog.hxx:43
OUString getPassword() const
Definition: AUser.hxx:79
virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override
Definition: AUsers.cxx:52
virtual void dropObject(sal_Int32 _nPos, const OUString &_sElementName) override
Definition: AUsers.cxx:71
virtual sdbcx::ObjectType appendObject(const OUString &_rForName, const css::uno::Reference< css::beans::XPropertySet > &descriptor) override
appends an object described by a descriptor, under a given name
WpADOUsers m_aCollection
Definition: AUsers.hxx:31
virtual sdbcx::ObjectType createObject(const OUString &_rName) override
Definition: AUsers.cxx:42
virtual void impl_refresh() override
Definition: AUsers.cxx:47
bool Append(const WrapT &aWrapT)
Definition: Aolewrap.hxx:160
bool Delete(const OUString &sName)
Definition: Aolewrap.hxx:165
css::uno::Reference< css::beans::XPropertySet > ObjectType
Definition: VCollection.hxx:59