Line data Source code
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 :
10 : #include "User.hxx"
11 : #include "Users.hxx"
12 :
13 : #include <connectivity/dbtools.hxx>
14 :
15 : #include <com/sun/star/sdbc/XRow.hpp>
16 :
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 ::com::sun::star;
23 : using namespace ::com::sun::star::beans;
24 : using namespace ::com::sun::star::container;
25 : using namespace ::com::sun::star::lang;
26 : using namespace ::com::sun::star::sdbc;
27 : using namespace ::com::sun::star::uno;
28 :
29 :
30 0 : Users::Users(const uno::Reference< XDatabaseMetaData >& rMetaData,
31 : OWeakObject& rParent,
32 : Mutex& rMutex,
33 : TStringVector& rNames) :
34 : OCollection(rParent,
35 : true,
36 : rMutex,
37 : rNames),
38 0 : m_xMetaData(rMetaData)
39 : {
40 0 : }
41 :
42 : //----- OCollection -----------------------------------------------------------
43 0 : void Users::impl_refresh()
44 : throw(RuntimeException)
45 : {
46 : // TODO: IMPLEMENT ME
47 0 : }
48 :
49 0 : ObjectType Users::createObject(const OUString& rName)
50 : {
51 0 : return new User(m_xMetaData->getConnection(), rName);
52 : }
53 :
54 0 : uno::Reference< XPropertySet > Users::createDescriptor()
55 : {
56 : // There is some internal magic so that the same class can be used as either
57 : // a descriptor or as a normal user. See VUser.cxx for the details. In our
58 : // case we just need to ensure we use the correct constructor.
59 0 : return new User(m_xMetaData->getConnection());
60 : }
61 :
62 : //----- XAppend ---------------------------------------------------------------
63 0 : ObjectType Users::appendObject(const OUString& rName,
64 : const uno::Reference< XPropertySet >& rDescriptor)
65 : {
66 : // TODO: set sSql as appropriate
67 : (void) rName;
68 : (void) rDescriptor;
69 0 : OUString sSql;
70 0 : m_xMetaData->getConnection()->createStatement()->execute(sSql);
71 :
72 0 : return createObject(rName);
73 : }
74 :
75 : //----- XDrop -----------------------------------------------------------------
76 0 : void Users::dropObject(sal_Int32 nPosition, const OUString& sName)
77 : {
78 0 : uno::Reference< XPropertySet > xUser(getObject(nPosition));
79 :
80 0 : if (!ODescriptor::isNew(xUser))
81 : {
82 : (void) sName;
83 : // TODO: drop me
84 0 : }
85 0 : }
86 :
87 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|