LibreOffice Module connectivity (master) 1
MacabTable.cxx
Go to the documentation of this file.
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
21#include "MacabTable.hxx"
22#include "MacabTables.hxx"
23#include "MacabColumns.hxx"
24#include "MacabCatalog.hxx"
25#include <com/sun/star/sdbc/XRow.hpp>
26
27using namespace connectivity::macab;
28using namespace connectivity;
29using namespace ::comphelper;
30using namespace ::com::sun::star::uno;
31using namespace ::com::sun::star::beans;
32using namespace ::com::sun::star::sdbcx;
33using namespace ::com::sun::star::sdbc;
34using namespace ::com::sun::star::container;
35using namespace ::com::sun::star::lang;
36
37
38MacabTable::MacabTable( sdbcx::OCollection* _pTables, MacabConnection* _pConnection)
39 : MacabTable_TYPEDEF(_pTables, true),
40 m_pConnection(_pConnection)
41{
42 construct();
43}
44
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)
59{
60 construct();
61}
62
64{
65 ::std::vector< OUString> aVector;
66
67 if (!isNew())
68 {
69 Reference< XResultSet > xResult = m_pConnection->getMetaData()->getColumns(
70 Any(), m_SchemaName, m_Name, "%");
71
72 if (xResult.is())
73 {
74 Reference< XRow > xRow(xResult, UNO_QUERY);
75 while (xResult->next())
76 aVector.push_back(xRow->getString(4));
77 }
78 }
79
80 if (m_xColumns)
81 m_xColumns->reFill(aVector);
82 else
83 m_xColumns.reset(new MacabColumns(this, m_aMutex, aVector));
84}
85
86/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData() override
MacabConnection * m_pConnection
Definition: MacabTable.hxx:32
MacabTable(sdbcx::OCollection *_pTables, MacabConnection *_pConnection)
Definition: MacabTable.cxx:38
virtual void refreshColumns() override
Definition: MacabTable.cxx:63
std::unique_ptr< OCollection > m_xColumns
Definition: VTable.hxx:77
virtual void construct() override
Definition: VTable.cxx:86
mutable::osl::Mutex m_aMutex
Type
OUString Name