1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
13 #include <connectivity/dbtools.hxx>
15 #include <com/sun/star/sdbc/XRow.hpp>
17 using namespace ::connectivity
;
18 using namespace ::connectivity::firebird
;
19 using namespace ::connectivity::sdbcx
;
20 using namespace ::cppu
;
21 using namespace ::osl
;
22 using namespace ::rtl
;
24 using namespace ::com::sun::star
;
25 using namespace ::com::sun::star::beans
;
26 using namespace ::com::sun::star::container
;
27 using namespace ::com::sun::star::lang
;
28 using namespace ::com::sun::star::sdbc
;
29 using namespace ::com::sun::star::uno
;
32 Users::Users(const uno::Reference
< XDatabaseMetaData
>& rMetaData
,
35 TStringVector
& rNames
) :
40 m_xMetaData(rMetaData
)
44 //----- OCollection -----------------------------------------------------------
45 void Users::impl_refresh()
46 throw(RuntimeException
)
51 ObjectType
Users::createObject(const OUString
& rName
)
53 return new User(m_xMetaData
->getConnection(), rName
);
56 uno::Reference
< XPropertySet
> Users::createDescriptor()
58 // There is some internal magic so that the same class can be used as either
59 // a descriptor or as a normal user. See VUser.cxx for the details. In our
60 // case we just need to ensure we use the correct constructor.
61 return new User(m_xMetaData
->getConnection());
64 //----- XAppend ---------------------------------------------------------------
65 ObjectType
Users::appendObject(const OUString
& rName
,
66 const uno::Reference
< XPropertySet
>& rDescriptor
)
68 // TODO: set sSql as appropriate
72 m_xMetaData
->getConnection()->createStatement()->execute(sSql
);
74 return createObject(rName
);
77 //----- XDrop -----------------------------------------------------------------
78 void Users::dropObject(sal_Int32 nPosition
, const OUString
& sName
)
80 uno::Reference
< XPropertySet
> xUser(getObject(nPosition
));
82 if (!ODescriptor::isNew(xUser
))
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */