diff options
Diffstat (limited to 'connectivity/source/drivers/dbase/DConnection.cxx')
-rw-r--r-- | connectivity/source/drivers/dbase/DConnection.cxx | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/connectivity/source/drivers/dbase/DConnection.cxx b/connectivity/source/drivers/dbase/DConnection.cxx new file mode 100644 index 000000000000..530df50e1674 --- /dev/null +++ b/connectivity/source/drivers/dbase/DConnection.cxx @@ -0,0 +1,135 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_connectivity.hxx" + +#ifndef _CONNECTIVITY_DBASE_OCONNECTION_HXX_ +#include "dbase/DConnection.hxx" +#endif +#include "dbase/DDatabaseMetaData.hxx" +#include "dbase/DCatalog.hxx" +#ifndef _CONNECTIVITY_DBASE_ODRIVER_HXX_ +#include "dbase/DDriver.hxx" +#endif +#include <com/sun/star/lang/DisposedException.hpp> +#include <tools/urlobj.hxx> +#include "dbase/DPreparedStatement.hxx" +#include "dbase/DStatement.hxx" +#include <tools/debug.hxx> +#include <connectivity/dbexception.hxx> + +using namespace connectivity::dbase; +using namespace connectivity::file; + +typedef connectivity::file::OConnection OConnection_BASE; + +//------------------------------------------------------------------------------ +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::lang; + +DBG_NAME(ODbaseConnection) +// -------------------------------------------------------------------------------- +ODbaseConnection::ODbaseConnection(ODriver* _pDriver) : OConnection(_pDriver) +{ + DBG_CTOR(ODbaseConnection,NULL); + m_aFilenameExtension = String::CreateFromAscii("dbf"); +} +//----------------------------------------------------------------------------- +ODbaseConnection::~ODbaseConnection() +{ + DBG_DTOR(ODbaseConnection,NULL); +} + +// XServiceInfo +// -------------------------------------------------------------------------------- +IMPLEMENT_SERVICE_INFO(ODbaseConnection, "com.sun.star.sdbc.drivers.dbase.Connection", "com.sun.star.sdbc.Connection") + +// -------------------------------------------------------------------------------- +Reference< XDatabaseMetaData > SAL_CALL ODbaseConnection::getMetaData( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + + + Reference< XDatabaseMetaData > xMetaData = m_xMetaData; + if(!xMetaData.is()) + { + xMetaData = new ODbaseDatabaseMetaData(this); + m_xMetaData = xMetaData; + } + + return xMetaData; +} +//------------------------------------------------------------------------------ +::com::sun::star::uno::Reference< XTablesSupplier > ODbaseConnection::createCatalog() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + Reference< XTablesSupplier > xTab = m_xCatalog; + if(!xTab.is()) + { + ODbaseCatalog *pCat = new ODbaseCatalog(this); + xTab = pCat; + m_xCatalog = xTab; + } + return xTab; +} +// -------------------------------------------------------------------------------- +Reference< XStatement > SAL_CALL ODbaseConnection::createStatement( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + + + Reference< XStatement > xReturn = new ODbaseStatement(this); + m_aStatements.push_back(WeakReferenceHelper(xReturn)); + return xReturn; +} +// -------------------------------------------------------------------------------- +Reference< XPreparedStatement > SAL_CALL ODbaseConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + + + ODbasePreparedStatement* pStmt = new ODbasePreparedStatement(this); + Reference< XPreparedStatement > xHoldAlive = pStmt; + pStmt->construct(sql); + m_aStatements.push_back(WeakReferenceHelper(*pStmt)); + return pStmt; +} +// -------------------------------------------------------------------------------- +Reference< XPreparedStatement > SAL_CALL ODbaseConnection::prepareCall( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException) +{ + ::dbtools::throwFeatureNotImplementedException( "XConnection::prepareCall", *this ); + return NULL; +} +// ----------------------------------------------------------------------------- + |