LibreOffice Module connectivity (master) 1
pq_driver.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*************************************************************************
3 *
4 * Effective License of whole file:
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License version 2.1, as published by the Free Software Foundation.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18 * MA 02111-1307 USA
19 *
20 * Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
21 *
22 * The Contents of this file are made available subject to the terms of
23 * the GNU Lesser General Public License Version 2.1
24 *
25 * Copyright: 2000 by Sun Microsystems, Inc.
26 *
27 * Contributor(s): Joerg Budischewski
28 *
29 * All parts contributed on or after August 2011:
30 *
31 * This Source Code Form is subject to the terms of the Mozilla Public
32 * License, v. 2.0. If a copy of the MPL was not distributed with this
33 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
34 *
35 ************************************************************************/
36
38#include <cppuhelper/weak.hxx>
39#include <com/sun/star/lang/XSingleComponentFactory.hpp>
40
41#include "pq_driver.hxx"
42
45using com::sun::star::uno::XInterface;
46using com::sun::star::uno::UNO_QUERY;
47using com::sun::star::uno::XComponentContext;
48using com::sun::star::uno::Any;
49
50using com::sun::star::beans::PropertyValue;
51
52using com::sun::star::sdbc::XConnection;
53using com::sun::star::sdbc::DriverPropertyInfo;
54
55using com::sun::star::sdbcx::XTablesSupplier;
56
57
58namespace pq_sdbc_driver
59{
60
62 const OUString& url,const Sequence< PropertyValue >& info )
63{
64 if( ! acceptsURL( url ) ) // XDriver spec tells me to do so ...
66
67 Sequence< Any > seq{ Any(url), Any(info) };
69 m_smgr->createInstanceWithArgumentsAndContext(
70 "org.openoffice.comp.connectivity.pq.Connection.noext",
71 seq, m_ctx ),
72 UNO_QUERY );
73}
74
75sal_Bool Driver::acceptsURL( const OUString& url )
76{
77 return url.startsWith( "sdbc:postgresql:" );
78}
79
81 const OUString&,const Sequence< PropertyValue >& )
82{
84}
85
87{
88 return PQ_SDBC_MAJOR;
89}
90
91
93{
94 return PQ_SDBC_MINOR;
95}
96
97 // XServiceInfo
99{
100 return "org.openoffice.comp.connectivity.pq.Driver.noext";
101}
102
103sal_Bool Driver::supportsService(const OUString& ServiceName)
104{
106}
107
109{
110 return { "com.sun.star.sdbc.Driver" };
111}
112
113// XComponent
115{
116
117}
118
119
121 const Reference< XConnection >& connection )
122{
123 return Reference< XTablesSupplier >( connection , UNO_QUERY );
124}
125
127 const OUString& url, const Sequence< PropertyValue >& info )
128{
129 return Reference< XTablesSupplier > ( connect( url, info ), UNO_QUERY );
130}
131
132}
133
134extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
136 css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
137{
138 return cppu::acquire(new pq_sdbc_driver::Driver(context));
139}
140
141
142/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL disposing() override
Definition: pq_driver.cxx:114
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: pq_driver.cxx:103
css::uno::Reference< css::lang::XMultiComponentFactory > m_smgr
Definition: pq_driver.hxx:69
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: pq_driver.cxx:108
virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo(const OUString &url, const css::uno::Sequence< css::beans::PropertyValue > &info) override
Definition: pq_driver.cxx:80
virtual sal_Int32 SAL_CALL getMajorVersion() override
Definition: pq_driver.cxx:86
virtual sal_Bool SAL_CALL acceptsURL(const OUString &url) override
Definition: pq_driver.cxx:75
virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL(const OUString &url, const css::uno::Sequence< css::beans::PropertyValue > &info) override
Definition: pq_driver.cxx:126
virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection(const css::uno::Reference< css::sdbc::XConnection > &connection) override
Definition: pq_driver.cxx:120
css::uno::Reference< css::uno::XComponentContext > m_ctx
Definition: pq_driver.hxx:68
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect(const OUString &url, const css::uno::Sequence< css::beans::PropertyValue > &info) override
Definition: pq_driver.cxx:61
virtual sal_Int32 SAL_CALL getMinorVersion() override
Definition: pq_driver.cxx:92
virtual OUString SAL_CALL getImplementationName() override
Definition: pq_driver.cxx:98
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * connectivity_pq_sdbc_driver_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Definition: pq_driver.cxx:135
unsigned char sal_Bool