1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: CIndexes.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
33 #ifndef DBACCESS_INDEXES_HXX_
34 #include "CIndexes.hxx"
36 #ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
37 #include <com/sun/star/sdbc/XRow.hpp>
39 #ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
40 #include <com/sun/star/sdbc/XResultSet.hpp>
42 #ifndef _COM_SUN_STAR_SDBC_INDEXTYPE_HPP_
43 #include <com/sun/star/sdbc/IndexType.hpp>
45 #ifndef DBACCESS_SHARED_DBASTRINGS_HRC
46 #include "dbastrings.hrc"
48 #ifndef _CONNECTIVITY_DBTOOLS_HXX_
49 #include <connectivity/dbtools.hxx>
51 #ifndef _COMPHELPER_EXTRACT_HXX_
52 #include <comphelper/extract.hxx>
54 #ifndef _TOOLS_DEBUG_HXX
55 #include <tools/debug.hxx>
59 using namespace connectivity
;
60 using namespace connectivity::sdbcx
;
61 using namespace ::com::sun::star::uno
;
62 using namespace ::com::sun::star::beans
;
63 using namespace ::com::sun::star::sdbcx
;
64 using namespace ::com::sun::star::sdbc
;
65 using namespace ::com::sun::star::container
;
66 using namespace ::com::sun::star::lang
;
67 using namespace dbaccess
;
71 ObjectType
OIndexes::createObject(const ::rtl::OUString
& _rName
)
74 if ( m_xIndexes
.is() && m_xIndexes
->hasByName(_rName
) )
75 xRet
.set(m_xIndexes
->getByName(_rName
),UNO_QUERY
);
77 xRet
= OIndexesHelper::createObject(_rName
);
81 // -------------------------------------------------------------------------
82 Reference
< XPropertySet
> OIndexes::createDescriptor()
84 Reference
<XDataDescriptorFactory
> xData( m_xIndexes
,UNO_QUERY
);
86 return xData
->createDataDescriptor();
88 return OIndexesHelper::createDescriptor();
90 // -------------------------------------------------------------------------
92 ObjectType
OIndexes::appendObject( const ::rtl::OUString
& _rForName
, const Reference
< XPropertySet
>& descriptor
)
94 Reference
<XAppend
> xData( m_xIndexes
,UNO_QUERY
);
96 return OIndexesHelper::appendObject( _rForName
, descriptor
);
98 xData
->appendByDescriptor(descriptor
);
99 return createObject( _rForName
);
101 // -------------------------------------------------------------------------
103 void OIndexes::dropObject(sal_Int32 _nPos
,const ::rtl::OUString _sElementName
)
105 if ( m_xIndexes
.is() )
107 Reference
<XDrop
> xData( m_xIndexes
,UNO_QUERY
);
109 xData
->dropByName(_sElementName
);
112 OIndexesHelper::dropObject(_nPos
,_sElementName
);
114 // -------------------------------------------------------------------------
115 void SAL_CALL
OIndexes::disposing(void)
117 if ( m_xIndexes
.is() )
120 OIndexesHelper::disposing();
122 // -----------------------------------------------------------------------------