LibreOffice Module connectivity (master) 1
DConnection.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 <dbase/DConnection.hxx>
23#include <dbase/DCatalog.hxx>
24#include <dbase/DDriver.hxx>
26#include <dbase/DStatement.hxx>
28
29using namespace connectivity::dbase;
30using namespace connectivity::file;
31
33
34
35using namespace ::com::sun::star::uno;
36using namespace ::com::sun::star::beans;
37using namespace ::com::sun::star::sdbcx;
38using namespace ::com::sun::star::sdbc;
39using namespace ::com::sun::star::lang;
40
41ODbaseConnection::ODbaseConnection(ODriver* _pDriver) : OConnection(_pDriver)
42{
44}
45
47{
48}
49
50// XServiceInfo
51
52IMPLEMENT_SERVICE_INFO(ODbaseConnection, "com.sun.star.sdbc.drivers.dbase.Connection", "com.sun.star.sdbc.Connection")
53
54
55Reference< XDatabaseMetaData > SAL_CALL ODbaseConnection::getMetaData( )
56{
57 ::osl::MutexGuard aGuard( m_aMutex );
58 checkDisposed(OConnection_BASE::rBHelper.bDisposed);
59
60
61 Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
62 if(!xMetaData.is())
63 {
64 xMetaData = new ODbaseDatabaseMetaData(this);
65 m_xMetaData = xMetaData;
66 }
67
68 return xMetaData;
69}
70
71css::uno::Reference< XTablesSupplier > ODbaseConnection::createCatalog()
72{
73 ::osl::MutexGuard aGuard( m_aMutex );
75 if(!xTab.is())
76 {
77 xTab = new ODbaseCatalog(this);
78 m_xCatalog = xTab;
79 }
80 return xTab;
81}
82
84{
85 ::osl::MutexGuard aGuard( m_aMutex );
86 checkDisposed(OConnection_BASE::rBHelper.bDisposed);
87
88
89 Reference< XStatement > xReturn = new ODbaseStatement(this);
90 m_aStatements.push_back(WeakReferenceHelper(xReturn));
91 return xReturn;
92}
93
95{
96 ::osl::MutexGuard aGuard( m_aMutex );
97 checkDisposed(OConnection_BASE::rBHelper.bDisposed);
98
100 pStmt->construct(sql);
101 m_aStatements.push_back(WeakReferenceHelper(*pStmt));
102 return pStmt;
103}
104
106{
107 ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::prepareCall", *this );
108 return nullptr;
109}
110
111
112/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define IMPLEMENT_SERVICE_INFO(classname, implasciiname, serviceasciiname)
connectivity::file::OConnection OConnection_BASE
Definition: DConnection.cxx:32
connectivity::OWeakRefArray m_aStatements
Definition: TConnection.hxx:47
virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall(const OUString &sql) override
virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement(const OUString &sql) override
Definition: DConnection.cxx:94
virtual css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog() override
Definition: DConnection.cxx:71
virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement() override
Definition: DConnection.cxx:83
css::uno::WeakReference< css::sdbcx::XTablesSupplier > m_xCatalog
Definition: FConnection.hxx:41
std::mutex m_aMutex
void checkDisposed(bool _bThrow)
Definition: dbtools.cxx:1951
void throwFeatureNotImplementedSQLException(const OUString &_rFeatureName, const Reference< XInterface > &_rxContext, const Any &_rNextException)