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 "dbase/DColumns.hxx"
21 : : #include "dbase/DTable.hxx"
22 : : #include "connectivity/sdbcx/VColumn.hxx"
23 : : #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
24 : : #include <comphelper/property.hxx>
25 : :
26 : : using namespace connectivity::dbase;
27 : : using namespace connectivity;
28 : : using namespace ::com::sun::star::uno;
29 : : using namespace ::com::sun::star::beans;
30 : : using namespace ::com::sun::star::lang;
31 : : using namespace ::com::sun::star::sdbcx;
32 : : using namespace ::com::sun::star::sdbc;
33 : : using namespace ::com::sun::star::container;
34 : :
35 : 548 : sdbcx::ObjectType ODbaseColumns::createObject(const ::rtl::OUString& _rName)
36 : : {
37 : :
38 : 548 : ODbaseTable* pTable = (ODbaseTable*)m_pTable;
39 : :
40 [ + - ]: 548 : ::rtl::Reference<OSQLColumns> aCols = pTable->getTableColumns();
41 [ + - ][ + - ]: 548 : OSQLColumns::Vector::const_iterator aIter = find(aCols->get().begin(),aCols->get().end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive()));
[ + - ][ + - ]
42 : :
43 : 548 : sdbcx::ObjectType xRet;
44 [ + - ][ + - ]: 548 : if(aIter != aCols->get().end())
45 [ + - ][ + - ]: 548 : xRet = sdbcx::ObjectType(*aIter,UNO_QUERY);
46 [ + - ]: 548 : return xRet;
47 : : }
48 : :
49 : : // -------------------------------------------------------------------------
50 : 0 : void ODbaseColumns::impl_refresh() throw(RuntimeException)
51 : : {
52 : 0 : m_pTable->refreshColumns();
53 : 0 : }
54 : : // -------------------------------------------------------------------------
55 : 0 : Reference< XPropertySet > ODbaseColumns::createDescriptor()
56 : : {
57 [ # # ][ # # ]: 0 : return new sdbcx::OColumn(isCaseSensitive());
58 : : }
59 : : // -----------------------------------------------------------------------------
60 : : // -------------------------------------------------------------------------
61 : : // XAppend
62 : 0 : sdbcx::ObjectType ODbaseColumns::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
63 : : {
64 [ # # ]: 0 : if ( m_pTable->isNew() )
65 : 0 : return cloneDescriptor( descriptor );
66 : :
67 : 0 : m_pTable->addColumn( descriptor );
68 : 0 : return createObject( _rForName );
69 : : }
70 : : // -----------------------------------------------------------------------------
71 : : // -------------------------------------------------------------------------
72 : : // XDrop
73 : 0 : void ODbaseColumns::dropObject(sal_Int32 _nPos,const ::rtl::OUString /*_sElementName*/)
74 : : {
75 [ # # ]: 0 : if(!m_pTable->isNew())
76 : 0 : m_pTable->dropColumn(_nPos);
77 : 0 : }
78 : : // -----------------------------------------------------------------------------
79 : :
80 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|