/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * 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 * * for a copy of the LGPLv3 License. * ************************************************************************/ #include "dbase/DConnection.hxx" #include "dbase/DDatabaseMetaData.hxx" #include "dbase/DCatalog.hxx" #include "dbase/DDriver.hxx" #include #include #include "dbase/DPreparedStatement.hxx" #include "dbase/DStatement.hxx" #include #include 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; } // ----------------------------------------------------------------------------- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */