bump product version to 5.0.4.1
[LibreOffice.git] / mysqlc / source / mysqlc_driver.hxx
blobf95e914729dce7e3cec075c61affb2173d2f62de
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 ************************************************************************/
27 #ifndef INCLUDED_MYSQLC_SOURCE_MYSQLC_DRIVER_HXX
28 #define INCLUDED_MYSQLC_SOURCE_MYSQLC_DRIVER_HXX
30 #include <config_lgpl.h>
32 #include "mysqlc_connection.hxx"
34 #include <com/sun/star/sdbc/XDriver.hpp>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
38 #include <cppuhelper/compbase2.hxx>
39 #include <cppconn/driver.h>
40 #include <osl/module.h>
42 namespace connectivity
44 namespace mysqlc
46 using ::com::sun::star::sdbc::SQLException;
47 using ::com::sun::star::uno::RuntimeException;
48 using ::com::sun::star::uno::Exception;
49 using ::com::sun::star::uno::Reference;
50 using ::com::sun::star::uno::Sequence;
51 Reference< ::com::sun::star::uno::XInterface > SAL_CALL MysqlCDriver_CreateInstance(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw(Exception);
53 typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::sdbc::XDriver,
54 ::com::sun::star::lang::XServiceInfo > ODriver_BASE;
56 typedef void* (SAL_CALL * OMysqlCConnection_CreateInstanceFunction)(void* _pDriver);
58 class MysqlCDriver : public ODriver_BASE
60 protected:
61 Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
62 ::osl::Mutex m_aMutex; // mutex is need to control member access
63 OWeakRefArray m_xConnections; // vector containing a list
64 // of all the Connection objects
65 // for this Driver
66 #ifndef SYSTEM_MYSQL_CPPCONN
67 #ifdef BUNDLE_MARIADB
68 oslModule m_hCConnModule;
69 bool m_bAttemptedLoadCConn;
70 #endif
71 oslModule m_hCppConnModule;
72 bool m_bAttemptedLoadCppConn;
73 #endif
75 sql::Driver * cppDriver;
77 public:
79 MysqlCDriver(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
81 // OComponentHelper
82 void SAL_CALL disposing() SAL_OVERRIDE;
83 // XInterface
84 static rtl::OUString getImplementationName_Static() throw(RuntimeException);
85 static Sequence< rtl::OUString > getSupportedServiceNames_Static() throw(RuntimeException);
87 // XServiceInfo
88 rtl::OUString SAL_CALL getImplementationName() throw(RuntimeException, std::exception) SAL_OVERRIDE;
89 sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw(RuntimeException, std::exception) SAL_OVERRIDE;
90 Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException, std::exception) SAL_OVERRIDE;
92 // XDriver
93 Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect(const rtl::OUString& url, const Sequence< ::com::sun::star::beans::PropertyValue >& info)
94 throw(SQLException, RuntimeException, std::exception) SAL_OVERRIDE;
96 sal_Bool SAL_CALL acceptsURL(const rtl::OUString& url) throw(SQLException, RuntimeException, std::exception) SAL_OVERRIDE;
97 Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo(const rtl::OUString& url, const Sequence< ::com::sun::star::beans::PropertyValue >& info)
98 throw(SQLException, RuntimeException, std::exception) SAL_OVERRIDE;
100 sal_Int32 SAL_CALL getMajorVersion() throw(RuntimeException, std::exception) SAL_OVERRIDE;
101 sal_Int32 SAL_CALL getMinorVersion() throw(RuntimeException, std::exception) SAL_OVERRIDE;
103 inline Reference< ::com::sun::star::lang::XMultiServiceFactory > getFactory() const { return m_xFactory; }
105 static rtl_TextEncoding getDefaultEncoding() { return RTL_TEXTENCODING_UTF8; }
107 private:
108 void impl_initCppConn_lck_throw();
110 } /* mysqlc */
111 } /* connectivity */
113 #endif // INCLUDED_MYSQLC_SOURCE_MYSQLC_DRIVER_HXX
115 * Local variables:
116 * tab-width: 4
117 * c-basic-offset: 4
118 * End:
119 * vim600: noet sw=4 ts=4 fdm=marker
120 * vim<600: noet sw=4 ts=4
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */