bump product version to 7.2.5.1
[LibreOffice.git] / connectivity / source / drivers / dbase / DDriver.cxx
blob8eae0013c940688213306190ddbdbd39e9ce8bdd
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 <strings.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 // XServiceInfo
37 OUString SAL_CALL ODriver::getImplementationName( )
39 return "com.sun.star.comp.sdbc.dbase.ODriver";
43 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
44 connectivity_dbase_ODriver(
45 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
47 rtl::Reference<ODriver> ret;
48 try {
49 ret = new ODriver(context);
50 } catch (...) {
52 if (ret)
53 ret->acquire();
54 return static_cast<cppu::OWeakObject*>(ret.get());
58 Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url, const Sequence< PropertyValue >& info )
60 ::osl::MutexGuard aGuard( m_aMutex );
61 if (ODriver_BASE::rBHelper.bDisposed)
62 throw DisposedException();
64 if ( ! acceptsURL(url) )
65 return nullptr;
67 rtl::Reference<ODbaseConnection> pCon = new ODbaseConnection(this);
68 pCon->construct(url,info);
69 m_xConnections.push_back(WeakReferenceHelper(*pCon));
71 return pCon;
74 sal_Bool SAL_CALL ODriver::acceptsURL( const OUString& url )
76 return url.startsWith("sdbc:dbase:");
79 Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const OUString& url, const Sequence< PropertyValue >& /*info*/ )
81 if ( acceptsURL(url) )
83 Sequence< OUString > aBoolean { "0", "1" };
85 return
88 "CharSet"
89 ,"CharSet of the database."
90 ,false
91 ,OUString()
92 ,Sequence< OUString >()
95 "ShowDeleted"
96 ,"Display inactive records."
97 ,false
98 ,"0"
99 ,aBoolean
102 "EnableSQL92Check"
103 ,"Use SQL92 naming constraints."
104 ,false
105 ,"0"
106 ,aBoolean
111 SharedResources aResources;
112 const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
113 ::dbtools::throwGenericSQLException(sMessage ,*this);
114 return Sequence< DriverPropertyInfo >();
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */