/************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the 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 #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; } // -----------------------------------------------------------------------------