1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <dbase/DConnection.hxx>
22 #include <dbase/DDatabaseMetaData.hxx>
23 #include <dbase/DCatalog.hxx>
24 #include <dbase/DDriver.hxx>
25 #include <dbase/DPreparedStatement.hxx>
26 #include <dbase/DStatement.hxx>
27 #include <connectivity/dbexception.hxx>
29 using namespace connectivity::dbase
;
30 using namespace connectivity::file
;
32 typedef connectivity::file::OConnection OConnection_BASE
;
35 using namespace ::com::sun::star::uno
;
36 using namespace ::com::sun::star::beans
;
37 using namespace ::com::sun::star::sdbcx
;
38 using namespace ::com::sun::star::sdbc
;
39 using namespace ::com::sun::star::lang
;
41 ODbaseConnection::ODbaseConnection(ODriver
* _pDriver
) : OConnection(_pDriver
)
43 m_aFilenameExtension
= "dbf";
46 ODbaseConnection::~ODbaseConnection()
52 IMPLEMENT_SERVICE_INFO(ODbaseConnection
, "com.sun.star.sdbc.drivers.dbase.Connection", "com.sun.star.sdbc.Connection")
55 Reference
< XDatabaseMetaData
> SAL_CALL
ODbaseConnection::getMetaData( )
57 ::osl::MutexGuard
aGuard( m_aMutex
);
58 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
61 Reference
< XDatabaseMetaData
> xMetaData
= m_xMetaData
;
64 xMetaData
= new ODbaseDatabaseMetaData(this);
65 m_xMetaData
= xMetaData
;
71 css::uno::Reference
< XTablesSupplier
> ODbaseConnection::createCatalog()
73 ::osl::MutexGuard
aGuard( m_aMutex
);
74 Reference
< XTablesSupplier
> xTab
= m_xCatalog
;
77 xTab
= new ODbaseCatalog(this);
83 Reference
< XStatement
> SAL_CALL
ODbaseConnection::createStatement( )
85 ::osl::MutexGuard
aGuard( m_aMutex
);
86 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
89 Reference
< XStatement
> xReturn
= new ODbaseStatement(this);
90 m_aStatements
.push_back(WeakReferenceHelper(xReturn
));
94 Reference
< XPreparedStatement
> SAL_CALL
ODbaseConnection::prepareStatement( const OUString
& sql
)
96 ::osl::MutexGuard
aGuard( m_aMutex
);
97 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
99 rtl::Reference
<ODbasePreparedStatement
> pStmt
= new ODbasePreparedStatement(this);
100 pStmt
->construct(sql
);
101 m_aStatements
.push_back(WeakReferenceHelper(*pStmt
));
105 Reference
< XPreparedStatement
> SAL_CALL
ODbaseConnection::prepareCall( const OUString
& /*sql*/ )
107 ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::prepareCall", *this );
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */