1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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 .
19 #ifndef INCLUDED_MYSQLC_SOURCE_MYSQLC_DRIVER_HXX
20 #define INCLUDED_MYSQLC_SOURCE_MYSQLC_DRIVER_HXX
22 #include "mysqlc_connection.hxx"
24 #include <com/sun/star/sdbc/XDriver.hpp>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
28 #include <cppuhelper/compbase2.hxx>
29 #include <osl/module.h>
31 namespace connectivity::mysqlc
33 using css::sdbc::SQLException
;
34 using css::uno::Exception
;
35 using css::uno::Reference
;
36 using css::uno::RuntimeException
;
37 using css::uno::Sequence
;
39 Reference
<css::uno::XInterface
>
40 MysqlCDriver_CreateInstance(const Reference
<css::lang::XMultiServiceFactory
>& _rxFactory
);
42 typedef ::cppu::WeakComponentImplHelper2
<css::sdbc::XDriver
, css::lang::XServiceInfo
> ODriver_BASE
;
44 typedef void* (*OMysqlCConnection_CreateInstanceFunction
)(void* _pDriver
);
46 class MysqlCDriver
: public ODriver_BASE
49 Reference
<css::lang::XMultiServiceFactory
> m_xFactory
;
50 ::osl::Mutex m_aMutex
; // mutex is need to control member access
51 OWeakRefArray m_xConnections
; // vector containing a list
52 // of all the Connection objects
55 oslModule m_hCConnModule
;
56 bool m_bAttemptedLoadCConn
;
59 explicit MysqlCDriver(const Reference
<css::lang::XMultiServiceFactory
>& _rxFactory
);
62 void SAL_CALL
disposing() override
;
64 static OUString
getImplementationName_Static();
65 static Sequence
<OUString
> getSupportedServiceNames_Static();
68 OUString SAL_CALL
getImplementationName() override
;
69 sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
70 Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
;
73 Reference
<css::sdbc::XConnection
> SAL_CALL
74 connect(const OUString
& url
, const Sequence
<css::beans::PropertyValue
>& info
) override
;
76 sal_Bool SAL_CALL
acceptsURL(const OUString
& url
) override
;
77 Sequence
<css::sdbc::DriverPropertyInfo
> SAL_CALL
78 getPropertyInfo(const OUString
& url
, const Sequence
<css::beans::PropertyValue
>& info
) override
;
80 sal_Int32 SAL_CALL
getMajorVersion() override
;
81 sal_Int32 SAL_CALL
getMinorVersion() override
;
83 const Reference
<css::lang::XMultiServiceFactory
>& getFactory() const { return m_xFactory
; }
85 static rtl_TextEncoding
getDefaultEncoding() { return RTL_TEXTENCODING_UTF8
; }
88 } /* connectivity::mysqlc */
90 #endif // INCLUDED_MYSQLC_SOURCE_MYSQLC_DRIVER_HXX
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */