LibreOffice Module connectivity (master) 1
NTables.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#include "NTables.hxx"
21#include <com/sun/star/sdbc/XRow.hpp>
22#include <com/sun/star/sdbc/XResultSet.hpp>
23#include "NCatalog.hxx"
24#include <comphelper/types.hxx>
25#include "NTable.hxx"
26using namespace ::comphelper;
27
28using namespace ::cppu;
29using namespace connectivity::evoab;
30using namespace connectivity::sdbcx;
31using namespace ::com::sun::star::uno;
32using namespace ::com::sun::star::beans;
33using namespace ::com::sun::star::sdbcx;
34using namespace ::com::sun::star::sdbc;
35using namespace ::com::sun::star::container;
36using namespace ::com::sun::star::lang;
37using namespace dbtools;
38
39ObjectType OEvoabTables::createObject(const OUString& aName)
40{
41 Sequence< OUString > aTypes { "TABLE" };
42
43 Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),"%",aName,aTypes);
44
45 ObjectType xRet;
46 if(xResult.is())
47 {
48 Reference< XRow > xRow(xResult,UNO_QUERY);
49 if(xResult->next()) // there can be only one table with this name
50 {
51 xRet = new OEvoabTable(
52 this,
53 static_cast<OEvoabCatalog&>(m_rParent).getConnection(),
54 aName,
55 xRow->getString(4),
56 xRow->getString(5),
57 "",
58 "");
59 }
60 }
61
62 ::comphelper::disposeComponent(xResult);
63
64 return xRet;
65}
66
68{
69 static_cast<OEvoabCatalog&>(m_rParent).refreshTables();
70}
71
73{
74 m_xMetaData.clear();
76}
77
78
79/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void impl_refresh() override
Definition: NTables.cxx:67
css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData
Definition: NTables.hxx:29
virtual void disposing() override
Definition: NTables.cxx:72
::cppu::OWeakObject & m_rParent
Definition: VCollection.hxx:97
OUString aName
css::uno::Reference< css::beans::XPropertySet > ObjectType
Definition: VCollection.hxx:59
Reference< XConnection > getConnection(const Reference< XRowSet > &_rxRowSet)
Definition: dbtools.cxx:348
const SvXMLTokenMapEntry aTypes[]