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 ::rtl;
23 :
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;
30 :
31 :
32 0 : Users::Users(const uno::Reference< XDatabaseMetaData >& rMetaData,
33 : OWeakObject& rParent,
34 : Mutex& rMutex,
35 : TStringVector& rNames) :
36 : OCollection(rParent,
37 : true,
38 : rMutex,
39 : rNames),
40 0 : m_xMetaData(rMetaData)
41 : {
42 0 : }
43 :
44 : //----- OCollection -----------------------------------------------------------
45 0 : void Users::impl_refresh()
46 : throw(RuntimeException)
47 : {
48 : // TODO: IMPLEMENT ME
49 0 : }
50 :
51 0 : ObjectType Users::createObject(const OUString& rName)
52 : {
53 0 : return new User(m_xMetaData->getConnection(), rName);
54 : }
55 :
56 0 : uno::Reference< XPropertySet > Users::createDescriptor()
57 : {
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 0 : return new User(m_xMetaData->getConnection());
62 : }
63 :
64 : //----- XAppend ---------------------------------------------------------------
65 0 : ObjectType Users::appendObject(const OUString& rName,
66 : const uno::Reference< XPropertySet >& rDescriptor)
67 : {
68 : // TODO: set sSql as appropriate
69 : (void) rName;
70 : (void) rDescriptor;
71 0 : OUString sSql;
72 0 : m_xMetaData->getConnection()->createStatement()->execute(sSql);
73 :
74 0 : return createObject(rName);
75 : }
76 :
77 : //----- XDrop -----------------------------------------------------------------
78 0 : void Users::dropObject(sal_Int32 nPosition, const OUString& sName)
79 : {
80 0 : uno::Reference< XPropertySet > xUser(getObject(nPosition));
81 :
82 0 : if (!ODescriptor::isNew(xUser))
83 : {
84 : (void) sName;
85 : // TODO: drop me
86 0 : }
87 0 : }
88 :
89 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|