Use correct object
[LibreOffice.git] / connectivity / source / drivers / macab / MacabTable.cxx
blob1628cd297bfd0d4820f1451caa2abef6fb5e6ab3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include "MacabTable.hxx"
22 #include "MacabTables.hxx"
23 #include "MacabColumns.hxx"
24 #include "MacabCatalog.hxx"
25 #include <com/sun/star/sdbc/XRow.hpp>
27 using namespace connectivity::macab;
28 using namespace connectivity;
29 using namespace ::comphelper;
30 using namespace ::com::sun::star::uno;
31 using namespace ::com::sun::star::beans;
32 using namespace ::com::sun::star::sdbcx;
33 using namespace ::com::sun::star::sdbc;
34 using namespace ::com::sun::star::container;
35 using namespace ::com::sun::star::lang;
38 MacabTable::MacabTable( sdbcx::OCollection* _pTables, MacabConnection* _pConnection)
39 : MacabTable_TYPEDEF(_pTables, true),
40 m_pConnection(_pConnection)
42 construct();
45 MacabTable::MacabTable( sdbcx::OCollection* _pTables,
46 MacabConnection* _pConnection,
47 const OUString& Name,
48 const OUString& Type,
49 const OUString& Description ,
50 const OUString& SchemaName,
51 const OUString& CatalogName
52 ) : MacabTable_TYPEDEF(_pTables,true,
53 Name,
54 Type,
55 Description,
56 SchemaName,
57 CatalogName),
58 m_pConnection(_pConnection)
60 construct();
63 void MacabTable::refreshColumns()
65 ::std::vector< OUString> aVector;
67 if (!isNew())
69 Reference< XResultSet > xResult = m_pConnection->getMetaData()->getColumns(
70 Any(), m_SchemaName, m_Name, "%");
72 if (xResult.is())
74 Reference< XRow > xRow(xResult, UNO_QUERY);
75 while (xResult->next())
76 aVector.push_back(xRow->getString(4));
80 if (m_xColumns)
81 m_xColumns->reFill(aVector);
82 else
83 m_xColumns.reset(new MacabColumns(this, m_aMutex, aVector));
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */