fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / connectivity / source / drivers / dbase / DDriver.cxx
blob02837f09ef2e5260b250784105e5eec2f10ce72e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "dbase/DDriver.hxx"
21 #include "dbase/DConnection.hxx"
22 #include <com/sun/star/lang/DisposedException.hpp>
23 #include "connectivity/dbexception.hxx"
24 #include "resource/dbase_res.hrc"
26 using namespace connectivity::dbase;
27 using namespace connectivity::file;
28 using namespace ::com::sun::star::uno;
29 using namespace ::com::sun::star::beans;
30 using namespace ::com::sun::star::sdbcx;
31 using namespace ::com::sun::star::sdbc;
32 using namespace ::com::sun::star::lang;
35 // static ServiceInfo
36 //------------------------------------------------------------------------------
37 OUString ODriver::getImplementationName_Static( ) throw(RuntimeException)
39 return OUString("com.sun.star.comp.sdbc.dbase.ODriver");
42 //------------------------------------------------------------------
43 OUString SAL_CALL ODriver::getImplementationName( ) throw(RuntimeException)
45 return getImplementationName_Static();
48 //------------------------------------------------------------------
49 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL connectivity::dbase::ODriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
51 return *(new ODriver(_rxFactory));
53 // --------------------------------------------------------------------------------
54 Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
56 ::osl::MutexGuard aGuard( m_aMutex );
57 if (ODriver_BASE::rBHelper.bDisposed)
58 throw DisposedException();
60 if ( ! acceptsURL(url) )
61 return NULL;
63 ODbaseConnection* pCon = new ODbaseConnection(this);
64 pCon->construct(url,info);
65 Reference< XConnection > xCon = pCon;
66 m_xConnections.push_back(WeakReferenceHelper(*pCon));
68 return xCon;
70 // --------------------------------------------------------------------------------
71 sal_Bool SAL_CALL ODriver::acceptsURL( const OUString& url ) throw(SQLException, RuntimeException)
73 return url.startsWith("sdbc:dbase:");
75 // -----------------------------------------------------------------------------
76 Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException)
78 if ( acceptsURL(url) )
80 ::std::vector< DriverPropertyInfo > aDriverInfo;
82 Sequence< OUString > aBoolean(2);
83 aBoolean[0] = OUString("0");
84 aBoolean[1] = OUString("1");
86 aDriverInfo.push_back(DriverPropertyInfo(
87 OUString("CharSet")
88 ,OUString("CharSet of the database.")
89 ,sal_False
90 ,OUString()
91 ,Sequence< OUString >())
93 aDriverInfo.push_back(DriverPropertyInfo(
94 OUString("ShowDeleted")
95 ,OUString("Display inactive records.")
96 ,sal_False
97 ,OUString("0")
98 ,aBoolean)
100 aDriverInfo.push_back(DriverPropertyInfo(
101 OUString("EnableSQL92Check")
102 ,OUString("Use SQL92 naming constraints.")
103 ,sal_False
104 ,OUString("0")
105 ,aBoolean)
107 return Sequence< DriverPropertyInfo >(&(aDriverInfo[0]),aDriverInfo.size());
110 SharedResources aResources;
111 const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
112 ::dbtools::throwGenericSQLException(sMessage ,*this);
113 return Sequence< DriverPropertyInfo >();
115 // -----------------------------------------------------------------------------
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */