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/DIndexColumns.hxx"
21 : : #include "dbase/DTable.hxx"
22 : : #include "connectivity/sdbcx/VIndexColumn.hxx"
23 : : #include <comphelper/types.hxx>
24 : : #include <comphelper/property.hxx>
25 : : #include <connectivity/dbexception.hxx>
26 : :
27 : : using namespace ::comphelper;
28 : :
29 : : using namespace connectivity::dbase;
30 : : using namespace connectivity;
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 : :
37 : :
38 : 0 : sdbcx::ObjectType ODbaseIndexColumns::createObject(const ::rtl::OUString& _rName)
39 : : {
40 : 0 : const ODbaseTable* pTable = m_pIndex->getTable();
41 : :
42 [ # # ]: 0 : ::rtl::Reference<OSQLColumns> aCols = pTable->getTableColumns();
43 [ # # ][ # # ]: 0 : OSQLColumns::Vector::const_iterator aIter = find(aCols->get().begin(),aCols->get().end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive()));
[ # # ][ # # ]
44 : :
45 : 0 : Reference< XPropertySet > xCol;
46 [ # # ][ # # ]: 0 : if(aIter != aCols->get().end())
47 [ # # ]: 0 : xCol = *aIter;
48 : :
49 [ # # ]: 0 : if(!xCol.is())
50 : 0 : return sdbcx::ObjectType();
51 : :
52 : : sdbcx::ObjectType xRet = new sdbcx::OIndexColumn(sal_True,_rName
53 [ # # ][ # # ]: 0 : ,getString(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))
54 : : ,::rtl::OUString()
55 [ # # ][ # # ]: 0 : ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)))
[ # # ][ # # ]
56 [ # # ][ # # ]: 0 : ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))
[ # # ][ # # ]
57 [ # # ][ # # ]: 0 : ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))
[ # # ][ # # ]
58 [ # # ][ # # ]: 0 : ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))
[ # # ][ # # ]
59 : : ,sal_False
60 : : ,sal_False
61 : : ,sal_False
62 [ # # ][ # # ]: 0 : ,pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers());
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
63 : :
64 [ # # ]: 0 : return xRet;
65 : : }
66 : :
67 : : // -------------------------------------------------------------------------
68 : 0 : void ODbaseIndexColumns::impl_refresh() throw(RuntimeException)
69 : : {
70 : 0 : m_pIndex->refreshColumns();
71 : 0 : }
72 : : // -------------------------------------------------------------------------
73 : 0 : Reference< XPropertySet > ODbaseIndexColumns::createDescriptor()
74 : : {
75 [ # # ][ # # ]: 0 : return new sdbcx::OIndexColumn(m_pIndex->getTable()->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers());
[ # # ][ # # ]
[ # # ]
76 : : }
77 : : // -------------------------------------------------------------------------
78 : 0 : sdbcx::ObjectType ODbaseIndexColumns::appendObject( const ::rtl::OUString& /*_rForName*/, const Reference< XPropertySet >& descriptor )
79 : : {
80 : 0 : return cloneDescriptor( descriptor );
81 : : }
82 : : // -----------------------------------------------------------------------------
83 : :
84 : :
85 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|