2011-11-17 21:29:14 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2011-08-02 16:10:00 +02:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2011-11-21 11:29:03 +01:00
|
|
|
* Effective License of whole file:
|
2011-08-02 16:10:00 +02:00
|
|
|
*
|
2011-11-21 11:29:03 +01:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2011-08-02 16:10:00 +02:00
|
|
|
*
|
2011-11-21 11:29:03 +01:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2011-08-02 16:10:00 +02:00
|
|
|
*
|
2011-11-21 11:29:03 +01:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2011-08-02 16:10:00 +02:00
|
|
|
*
|
2011-11-21 11:29:03 +01:00
|
|
|
* Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
|
2011-08-02 16:10:00 +02:00
|
|
|
*
|
2011-11-21 11:29:03 +01:00
|
|
|
* The Contents of this file are made available subject to the terms of
|
|
|
|
* the GNU Lesser General Public License Version 2.1
|
2011-08-02 16:10:00 +02:00
|
|
|
*
|
2011-11-21 11:29:03 +01:00
|
|
|
* Copyright: 2000 by Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* Contributor(s): Joerg Budischewski
|
|
|
|
*
|
|
|
|
* All parts contributed on or after August 2011:
|
|
|
|
*
|
2013-04-24 17:14:03 +01:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2011-08-02 16:10:00 +02:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2013-10-09 08:34:12 -03:00
|
|
|
#include <cppuhelper/supportsservice.hxx>
|
2020-10-02 14:28:41 +02:00
|
|
|
#include <cppuhelper/weak.hxx>
|
2018-08-18 18:24:16 +02:00
|
|
|
#include <com/sun/star/lang/XSingleComponentFactory.hpp>
|
2011-08-02 16:10:00 +02:00
|
|
|
|
|
|
|
#include "pq_driver.hxx"
|
|
|
|
|
|
|
|
using osl::MutexGuard;
|
|
|
|
|
|
|
|
using com::sun::star::lang::XSingleComponentFactory;
|
|
|
|
using com::sun::star::lang::XServiceInfo;
|
|
|
|
using com::sun::star::lang::XComponent;
|
|
|
|
|
|
|
|
using com::sun::star::uno::Sequence;
|
|
|
|
using com::sun::star::uno::Reference;
|
|
|
|
using com::sun::star::uno::XInterface;
|
|
|
|
using com::sun::star::uno::UNO_QUERY;
|
|
|
|
using com::sun::star::uno::XComponentContext;
|
|
|
|
using com::sun::star::uno::Any;
|
|
|
|
|
|
|
|
using com::sun::star::beans::PropertyValue;
|
|
|
|
|
|
|
|
using com::sun::star::sdbc::XConnection;
|
|
|
|
using com::sun::star::sdbc::DriverPropertyInfo;
|
|
|
|
|
|
|
|
using com::sun::star::sdbcx::XTablesSupplier;
|
|
|
|
|
|
|
|
|
|
|
|
namespace pq_sdbc_driver
|
|
|
|
{
|
|
|
|
|
|
|
|
Reference< XConnection > Driver::connect(
|
|
|
|
const OUString& url,const Sequence< PropertyValue >& info )
|
|
|
|
{
|
|
|
|
if( ! acceptsURL( url ) ) // XDriver spec tells me to do so ...
|
|
|
|
return Reference< XConnection > ();
|
|
|
|
|
2021-10-28 21:15:12 +03:00
|
|
|
Sequence< Any > seq{ Any(url), Any(info) };
|
2011-08-02 16:10:00 +02:00
|
|
|
return Reference< XConnection> (
|
|
|
|
m_smgr->createInstanceWithArgumentsAndContext(
|
2015-10-30 08:40:11 +02:00
|
|
|
"org.openoffice.comp.connectivity.pq.Connection.noext",
|
2011-08-02 16:10:00 +02:00
|
|
|
seq, m_ctx ),
|
|
|
|
UNO_QUERY );
|
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
sal_Bool Driver::acceptsURL( const OUString& url )
|
2011-08-02 16:10:00 +02:00
|
|
|
{
|
2013-11-20 13:46:07 +02:00
|
|
|
return url.startsWith( "sdbc:postgresql:" );
|
2011-08-02 16:10:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Sequence< DriverPropertyInfo > Driver::getPropertyInfo(
|
2017-07-02 22:34:08 +02:00
|
|
|
const OUString&,const Sequence< PropertyValue >& )
|
2011-08-02 16:10:00 +02:00
|
|
|
{
|
|
|
|
return Sequence< DriverPropertyInfo > ();
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int32 Driver::getMajorVersion( )
|
2011-08-02 16:10:00 +02:00
|
|
|
{
|
|
|
|
return PQ_SDBC_MAJOR;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int32 Driver::getMinorVersion( )
|
2011-08-02 16:10:00 +02:00
|
|
|
{
|
|
|
|
return PQ_SDBC_MINOR;
|
|
|
|
}
|
|
|
|
|
|
|
|
// XServiceInfo
|
|
|
|
OUString SAL_CALL Driver::getImplementationName()
|
|
|
|
{
|
2020-07-13 15:17:55 +02:00
|
|
|
return "org.openoffice.comp.connectivity.pq.Driver.noext";
|
2011-08-02 16:10:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool Driver::supportsService(const OUString& ServiceName)
|
|
|
|
{
|
2013-10-09 08:34:12 -03:00
|
|
|
return cppu::supportsService(this, ServiceName);
|
2011-08-02 16:10:00 +02:00
|
|
|
}
|
|
|
|
|
2015-04-14 12:44:47 +02:00
|
|
|
Sequence< OUString > Driver::getSupportedServiceNames()
|
2011-08-02 16:10:00 +02:00
|
|
|
{
|
2020-07-13 15:17:55 +02:00
|
|
|
return { "com.sun.star.sdbc.Driver" };
|
2011-08-02 16:10:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// XComponent
|
|
|
|
void Driver::disposing()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Reference< XTablesSupplier > Driver::getDataDefinitionByConnection(
|
|
|
|
const Reference< XConnection >& connection )
|
|
|
|
{
|
|
|
|
return Reference< XTablesSupplier >( connection , UNO_QUERY );
|
|
|
|
}
|
|
|
|
|
|
|
|
Reference< XTablesSupplier > Driver::getDataDefinitionByURL(
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& url, const Sequence< PropertyValue >& info )
|
2011-08-02 16:10:00 +02:00
|
|
|
{
|
|
|
|
return Reference< XTablesSupplier > ( connect( url, info ), UNO_QUERY );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-07-13 15:17:55 +02:00
|
|
|
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
|
|
|
connectivity_pq_sdbc_driver_get_implementation(
|
|
|
|
css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
|
2011-08-02 16:10:00 +02:00
|
|
|
{
|
2021-03-10 09:41:13 +03:00
|
|
|
return cppu::acquire(new pq_sdbc_driver::Driver(context));
|
2011-08-02 16:10:00 +02:00
|
|
|
}
|
|
|
|
|
2014-02-18 12:11:15 +00:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|