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::sdbcx
;
37 using namespace ::com::sun::star::sdbc
;
39 ODbaseConnection::ODbaseConnection(ODriver
* _pDriver
) : OConnection(_pDriver
)
41 m_aFilenameExtension
= "dbf";
44 ODbaseConnection::~ODbaseConnection()
50 IMPLEMENT_SERVICE_INFO(ODbaseConnection
, u
"com.sun.star.sdbc.drivers.dbase.Connection"_ustr
, u
"com.sun.star.sdbc.Connection"_ustr
)
53 Reference
< XDatabaseMetaData
> SAL_CALL
ODbaseConnection::getMetaData( )
55 ::osl::MutexGuard
aGuard( m_aMutex
);
56 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
59 Reference
< XDatabaseMetaData
> xMetaData
= m_xMetaData
;
62 xMetaData
= new ODbaseDatabaseMetaData(this);
63 m_xMetaData
= xMetaData
;
69 css::uno::Reference
< XTablesSupplier
> ODbaseConnection::createCatalog()
71 ::osl::MutexGuard
aGuard( m_aMutex
);
72 rtl::Reference
< connectivity::sdbcx::OCatalog
> xTab
= m_xCatalog
;
75 xTab
= new ODbaseCatalog(this);
76 m_xCatalog
= xTab
.get();
81 Reference
< XStatement
> SAL_CALL
ODbaseConnection::createStatement( )
83 ::osl::MutexGuard
aGuard( m_aMutex
);
84 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
87 Reference
< XStatement
> xReturn
= new ODbaseStatement(this);
88 m_aStatements
.push_back(WeakReferenceHelper(xReturn
));
92 Reference
< XPreparedStatement
> SAL_CALL
ODbaseConnection::prepareStatement( const OUString
& sql
)
94 ::osl::MutexGuard
aGuard( m_aMutex
);
95 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
97 rtl::Reference
<ODbasePreparedStatement
> pStmt
= new ODbasePreparedStatement(this);
98 pStmt
->construct(sql
);
99 m_aStatements
.push_back(WeakReferenceHelper(*pStmt
));
103 Reference
< XPreparedStatement
> SAL_CALL
ODbaseConnection::prepareCall( const OUString
& /*sql*/ )
105 ::dbtools::throwFeatureNotImplementedSQLException( u
"XConnection::prepareCall"_ustr
, *this );
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */