Branch data 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 : : * 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 "CIndexes.hxx"
21 : : #include <com/sun/star/sdbc/XRow.hpp>
22 : : #include <com/sun/star/sdbc/XResultSet.hpp>
23 : : #include <com/sun/star/sdbc/IndexType.hpp>
24 : : #include "dbastrings.hrc"
25 : : #include <connectivity/dbtools.hxx>
26 : : #include <comphelper/extract.hxx>
27 : :
28 : :
29 : : using namespace connectivity;
30 : : using namespace connectivity::sdbcx;
31 : : using namespace ::com::sun::star::uno;
32 : : using namespace ::com::sun::star::beans;
33 : : using namespace ::com::sun::star::sdbcx;
34 : : using namespace ::com::sun::star::sdbc;
35 : : using namespace ::com::sun::star::container;
36 : : using namespace ::com::sun::star::lang;
37 : : using namespace dbaccess;
38 : : using namespace cppu;
39 : :
40 : :
41 : 0 : ObjectType OIndexes::createObject(const ::rtl::OUString& _rName)
42 : : {
43 : 0 : ObjectType xRet;
44 [ # # ][ # # ]: 0 : if ( m_xIndexes.is() && m_xIndexes->hasByName(_rName) )
[ # # ][ # # ]
[ # # ]
45 [ # # ][ # # ]: 0 : xRet.set(m_xIndexes->getByName(_rName),UNO_QUERY);
[ # # ]
46 : : else
47 [ # # ][ # # ]: 0 : xRet = OIndexesHelper::createObject(_rName);
48 : :
49 : 0 : return xRet;
50 : : }
51 : :
52 : 0 : Reference< XPropertySet > OIndexes::createDescriptor()
53 : : {
54 [ # # ]: 0 : Reference<XDataDescriptorFactory> xData( m_xIndexes,UNO_QUERY);
55 [ # # ]: 0 : if(xData.is())
56 [ # # ][ # # ]: 0 : return xData->createDataDescriptor();
57 : : else
58 [ # # ]: 0 : return OIndexesHelper::createDescriptor();
59 : : }
60 : :
61 : : // XAppend
62 : 0 : ObjectType OIndexes::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
63 : : {
64 [ # # ]: 0 : Reference<XAppend> xData( m_xIndexes,UNO_QUERY);
65 [ # # ]: 0 : if ( !xData.is() )
66 [ # # ]: 0 : return OIndexesHelper::appendObject( _rForName, descriptor );
67 : :
68 [ # # ][ # # ]: 0 : xData->appendByDescriptor(descriptor);
69 [ # # ]: 0 : return createObject( _rForName );
70 : : }
71 : :
72 : : // XDrop
73 : 0 : void OIndexes::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName)
74 : : {
75 [ # # ]: 0 : if ( m_xIndexes.is() )
76 : : {
77 [ # # ]: 0 : Reference<XDrop> xData( m_xIndexes,UNO_QUERY);
78 [ # # ]: 0 : if ( xData.is() )
79 [ # # ][ # # ]: 0 : xData->dropByName(_sElementName);
80 : : }
81 : : else
82 [ # # ]: 0 : OIndexesHelper::dropObject(_nPos,_sElementName);
83 : 0 : }
84 : :
85 : 0 : void SAL_CALL OIndexes::disposing(void)
86 : : {
87 [ # # ]: 0 : if ( m_xIndexes.is() )
88 : 0 : clear_NoDispose();
89 : : else
90 : 0 : OIndexesHelper::disposing();
91 : 0 : }
92 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|