1*079eb577SAndrew Rist /************************************************************** 2*079eb577SAndrew Rist * 3*079eb577SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*079eb577SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*079eb577SAndrew Rist * distributed with this work for additional information 6*079eb577SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*079eb577SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*079eb577SAndrew Rist * "License"); you may not use this file except in compliance 9*079eb577SAndrew Rist * with the License. You may obtain a copy of the License at 10*079eb577SAndrew Rist * 11*079eb577SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*079eb577SAndrew Rist * 13*079eb577SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*079eb577SAndrew Rist * software distributed under the License is distributed on an 15*079eb577SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*079eb577SAndrew Rist * KIND, either express or implied. See the License for the 17*079eb577SAndrew Rist * specific language governing permissions and limitations 18*079eb577SAndrew Rist * under the License. 19*079eb577SAndrew Rist * 20*079eb577SAndrew Rist *************************************************************/ 21cdf0e10cSrcweir 22cdf0e10cSrcweir #ifndef MYSQLC_SDRIVER_HXX 23cdf0e10cSrcweir #define MYSQLC_SDRIVER_HXX 24cdf0e10cSrcweir 25cdf0e10cSrcweir #include "mysqlc_connection.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/sdbc/XDriver.hpp> 28cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include <cppuhelper/compbase2.hxx> 31cdf0e10cSrcweir #include <preextstl.h> 32cdf0e10cSrcweir #include <cppconn/driver.h> 33cdf0e10cSrcweir #include <postextstl.h> 34cdf0e10cSrcweir #include <osl/module.h> 35cdf0e10cSrcweir 36cdf0e10cSrcweir namespace connectivity 37cdf0e10cSrcweir { 38cdf0e10cSrcweir namespace mysqlc 39cdf0e10cSrcweir { 40cdf0e10cSrcweir using ::rtl::OUString; 41cdf0e10cSrcweir using ::com::sun::star::sdbc::SQLException; 42cdf0e10cSrcweir using ::com::sun::star::uno::RuntimeException; 43cdf0e10cSrcweir using ::com::sun::star::uno::Exception; 44cdf0e10cSrcweir using ::com::sun::star::uno::Reference; 45cdf0e10cSrcweir using ::com::sun::star::uno::Sequence; 46cdf0e10cSrcweir Reference< ::com::sun::star::uno::XInterface > SAL_CALL MysqlCDriver_CreateInstance(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw(Exception); 47cdf0e10cSrcweir 48cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::sdbc::XDriver, 49cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo > ODriver_BASE; 50cdf0e10cSrcweir 51cdf0e10cSrcweir typedef void* (SAL_CALL * OMysqlCConnection_CreateInstanceFunction)(void* _pDriver); 52cdf0e10cSrcweir 53cdf0e10cSrcweir class MysqlCDriver : public ODriver_BASE 54cdf0e10cSrcweir { 55cdf0e10cSrcweir protected: 56cdf0e10cSrcweir Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; 57cdf0e10cSrcweir ::osl::Mutex m_aMutex; // mutex is need to control member access 58cdf0e10cSrcweir OWeakRefArray m_xConnections; // vector containing a list 59cdf0e10cSrcweir // of all the Connection objects 60cdf0e10cSrcweir // for this Driver 61cdf0e10cSrcweir 62cdf0e10cSrcweir sql::Driver * cppDriver; 63cdf0e10cSrcweir 64cdf0e10cSrcweir public: 65cdf0e10cSrcweir 66cdf0e10cSrcweir MysqlCDriver(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); 67cdf0e10cSrcweir 68cdf0e10cSrcweir // OComponentHelper 69cdf0e10cSrcweir void SAL_CALL disposing(void); 70cdf0e10cSrcweir // XInterface 71cdf0e10cSrcweir static OUString getImplementationName_Static() throw(RuntimeException); 72cdf0e10cSrcweir static Sequence< OUString > getSupportedServiceNames_Static() throw(RuntimeException); 73cdf0e10cSrcweir 74cdf0e10cSrcweir // XServiceInfo 75cdf0e10cSrcweir OUString SAL_CALL getImplementationName() throw(RuntimeException); 76cdf0e10cSrcweir sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(RuntimeException); 77cdf0e10cSrcweir Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException); 78cdf0e10cSrcweir 79cdf0e10cSrcweir // XDriver 80cdf0e10cSrcweir Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect(const OUString& url, const Sequence< ::com::sun::star::beans::PropertyValue >& info) 81cdf0e10cSrcweir throw(SQLException, RuntimeException); 82cdf0e10cSrcweir 83cdf0e10cSrcweir sal_Bool SAL_CALL acceptsURL(const OUString& url) throw(SQLException, RuntimeException); 84cdf0e10cSrcweir Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo(const OUString& url, const Sequence< ::com::sun::star::beans::PropertyValue >& info) 85cdf0e10cSrcweir throw(SQLException, RuntimeException); 86cdf0e10cSrcweir 87cdf0e10cSrcweir sal_Int32 SAL_CALL getMajorVersion() throw(RuntimeException); 88cdf0e10cSrcweir sal_Int32 SAL_CALL getMinorVersion() throw(RuntimeException); 89cdf0e10cSrcweir getFactory() const90cdf0e10cSrcweir inline Reference< ::com::sun::star::lang::XMultiServiceFactory > getFactory() const { return m_xFactory; } 91cdf0e10cSrcweir getDefaultEncoding()92cdf0e10cSrcweir rtl_TextEncoding getDefaultEncoding() { return RTL_TEXTENCODING_UTF8; } 93cdf0e10cSrcweir 94cdf0e10cSrcweir private: 95cdf0e10cSrcweir void impl_initCppConn_lck_throw(); 96cdf0e10cSrcweir }; 97cdf0e10cSrcweir } /* mysqlc */ 98cdf0e10cSrcweir } /* connectivity */ 99cdf0e10cSrcweir 100cdf0e10cSrcweir #endif // MYSQLC_SDRIVER_HXX 101cdf0e10cSrcweir /* 102cdf0e10cSrcweir * Local variables: 103cdf0e10cSrcweir * tab-width: 4 104cdf0e10cSrcweir * c-basic-offset: 4 105cdf0e10cSrcweir * End: 106cdf0e10cSrcweir * vim600: noet sw=4 ts=4 fdm=marker 107cdf0e10cSrcweir * vim<600: noet sw=4 ts=4 108cdf0e10cSrcweir */ 109