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 "mysqlc_connection.hxx"
32 #include <com/sun/star/sdbc/XDriver.hpp>
33 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <cppuhelper/compbase2.hxx>
36 #include <cppconn/driver.h>
37 #include <osl/module.h>
39 namespace connectivity
43 using ::rtl::OUString
;
44 using ::com::sun::star::sdbc::SQLException
;
45 using ::com::sun::star::uno::RuntimeException
;
46 using ::com::sun::star::uno::Exception
;
47 using ::com::sun::star::uno::Reference
;
48 using ::com::sun::star::uno::Sequence
;
49 Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
MysqlCDriver_CreateInstance(const Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxFactory
) throw(Exception
);
51 typedef ::cppu::WeakComponentImplHelper2
< ::com::sun::star::sdbc::XDriver
,
52 ::com::sun::star::lang::XServiceInfo
> ODriver_BASE
;
54 typedef void* (SAL_CALL
* OMysqlCConnection_CreateInstanceFunction
)(void* _pDriver
);
56 class MysqlCDriver
: public ODriver_BASE
59 Reference
< ::com::sun::star::lang::XMultiServiceFactory
> m_xFactory
;
60 ::osl::Mutex m_aMutex
; // mutex is need to control member access
61 OWeakRefArray m_xConnections
; // vector containing a list
62 // of all the Connection objects
64 #ifndef SYSTEM_MYSQL_CPPCONN
65 oslModule m_hCppConnModule
;
66 bool m_bAttemptedLoadCppConn
;
69 sql::Driver
* cppDriver
;
73 MysqlCDriver(const Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxFactory
);
76 void SAL_CALL
disposing(void);
78 static OUString
getImplementationName_Static() throw(RuntimeException
);
79 static Sequence
< OUString
> getSupportedServiceNames_Static() throw(RuntimeException
);
82 OUString SAL_CALL
getImplementationName() throw(RuntimeException
);
83 sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw(RuntimeException
);
84 Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw(RuntimeException
);
87 Reference
< ::com::sun::star::sdbc::XConnection
> SAL_CALL
connect(const OUString
& url
, const Sequence
< ::com::sun::star::beans::PropertyValue
>& info
)
88 throw(SQLException
, RuntimeException
);
90 sal_Bool SAL_CALL
acceptsURL(const OUString
& url
) throw(SQLException
, RuntimeException
);
91 Sequence
< ::com::sun::star::sdbc::DriverPropertyInfo
> SAL_CALL
getPropertyInfo(const OUString
& url
, const Sequence
< ::com::sun::star::beans::PropertyValue
>& info
)
92 throw(SQLException
, RuntimeException
);
94 sal_Int32 SAL_CALL
getMajorVersion() throw(RuntimeException
);
95 sal_Int32 SAL_CALL
getMinorVersion() throw(RuntimeException
);
97 inline Reference
< ::com::sun::star::lang::XMultiServiceFactory
> getFactory() const { return m_xFactory
; }
99 rtl_TextEncoding
getDefaultEncoding() { return RTL_TEXTENCODING_UTF8
; }
102 void impl_initCppConn_lck_throw();
107 #endif // MYSQLC_SDRIVER_HXX
113 * vim600: noet sw=4 ts=4 fdm=marker
114 * vim<600: noet sw=4 ts=4
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */