bump product version to 4.1.6.2
[LibreOffice.git] / mysqlc / source / mysqlc_driver.hxx
blobd63ed055e6f08df35b1c5e10029fc05316ea52a9
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 MYSQLC_SDRIVER_HXX
28 #define MYSQLC_SDRIVER_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>
37 #include <cppuhelper/compbase2.hxx>
38 #include <cppconn/driver.h>
39 #include <osl/module.h>
41 namespace connectivity
43 namespace mysqlc
45 using ::com::sun::star::sdbc::SQLException;
46 using ::com::sun::star::uno::RuntimeException;
47 using ::com::sun::star::uno::Exception;
48 using ::com::sun::star::uno::Reference;
49 using ::com::sun::star::uno::Sequence;
50 Reference< ::com::sun::star::uno::XInterface > SAL_CALL MysqlCDriver_CreateInstance(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw(Exception);
52 typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::sdbc::XDriver,
53 ::com::sun::star::lang::XServiceInfo > ODriver_BASE;
55 typedef void* (SAL_CALL * OMysqlCConnection_CreateInstanceFunction)(void* _pDriver);
57 class MysqlCDriver : public ODriver_BASE
59 protected:
60 Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
61 ::osl::Mutex m_aMutex; // mutex is need to control member access
62 OWeakRefArray m_xConnections; // vector containing a list
63 // of all the Connection objects
64 // for this Driver
65 #ifndef SYSTEM_MYSQL_CPPCONN
66 #ifdef BUNDLE_MARIADB
67 oslModule m_hCConnModule;
68 bool m_bAttemptedLoadCConn;
69 #endif
70 oslModule m_hCppConnModule;
71 bool m_bAttemptedLoadCppConn;
72 #endif
74 sql::Driver * cppDriver;
76 public:
78 MysqlCDriver(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
80 // OComponentHelper
81 void SAL_CALL disposing(void);
82 // XInterface
83 static OUString getImplementationName_Static() throw(RuntimeException);
84 static Sequence< OUString > getSupportedServiceNames_Static() throw(RuntimeException);
86 // XServiceInfo
87 OUString SAL_CALL getImplementationName() throw(RuntimeException);
88 sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(RuntimeException);
89 Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
91 // XDriver
92 Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect(const OUString& url, const Sequence< ::com::sun::star::beans::PropertyValue >& info)
93 throw(SQLException, RuntimeException);
95 sal_Bool SAL_CALL acceptsURL(const OUString& url) throw(SQLException, RuntimeException);
96 Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo(const OUString& url, const Sequence< ::com::sun::star::beans::PropertyValue >& info)
97 throw(SQLException, RuntimeException);
99 sal_Int32 SAL_CALL getMajorVersion() throw(RuntimeException);
100 sal_Int32 SAL_CALL getMinorVersion() throw(RuntimeException);
102 inline Reference< ::com::sun::star::lang::XMultiServiceFactory > getFactory() const { return m_xFactory; }
104 rtl_TextEncoding getDefaultEncoding() { return RTL_TEXTENCODING_UTF8; }
106 private:
107 void impl_initCppConn_lck_throw();
109 } /* mysqlc */
110 } /* connectivity */
112 #endif // MYSQLC_SDRIVER_HXX
114 * Local variables:
115 * tab-width: 4
116 * c-basic-offset: 4
117 * End:
118 * vim600: noet sw=4 ts=4 fdm=marker
119 * vim<600: noet sw=4 ts=4
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */