Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/connectivity/source/drivers/dbase/DConnection.cxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
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/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
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 .
18
 */
19
20
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>
28
29
using namespace connectivity::dbase;
30
using namespace connectivity::file;
31
32
typedef connectivity::file::OConnection  OConnection_BASE;
33
34
35
using namespace ::com::sun::star::uno;
36
using namespace ::com::sun::star::sdbcx;
37
using namespace ::com::sun::star::sdbc;
38
39
9.16k
ODbaseConnection::ODbaseConnection(ODriver* _pDriver) : OConnection(_pDriver)
40
9.16k
{
41
9.16k
    m_aFilenameExtension = "dbf";
42
9.16k
}
43
44
ODbaseConnection::~ODbaseConnection()
45
9.16k
{
46
9.16k
}
47
48
// XServiceInfo
49
50
IMPLEMENT_SERVICE_INFO(ODbaseConnection, u"com.sun.star.sdbc.drivers.dbase.Connection"_ustr, u"com.sun.star.sdbc.Connection"_ustr)
51
52
53
Reference< XDatabaseMetaData > SAL_CALL ODbaseConnection::getMetaData(  )
54
777k
{
55
777k
    ::osl::MutexGuard aGuard( m_aMutex );
56
777k
    checkDisposed(OConnection_BASE::rBHelper.bDisposed);
57
58
59
777k
    Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
60
777k
    if(!xMetaData.is())
61
18.3k
    {
62
18.3k
        xMetaData = new ODbaseDatabaseMetaData(this);
63
18.3k
        m_xMetaData = xMetaData;
64
18.3k
    }
65
66
777k
    return xMetaData;
67
777k
}
68
69
css::uno::Reference< XTablesSupplier > ODbaseConnection::createCatalog()
70
36.0k
{
71
36.0k
    ::osl::MutexGuard aGuard( m_aMutex );
72
36.0k
    rtl::Reference< connectivity::sdbcx::OCatalog > xTab = m_xCatalog;
73
36.0k
    if(!xTab.is())
74
36.0k
    {
75
36.0k
        xTab = new ODbaseCatalog(this);
76
36.0k
        m_xCatalog = xTab.get();
77
36.0k
    }
78
36.0k
    return xTab;
79
36.0k
}
80
81
Reference< XStatement > SAL_CALL ODbaseConnection::createStatement(  )
82
8.95k
{
83
8.95k
    ::osl::MutexGuard aGuard( m_aMutex );
84
8.95k
    checkDisposed(OConnection_BASE::rBHelper.bDisposed);
85
86
87
8.95k
    Reference< XStatement > xReturn = new ODbaseStatement(this);
88
8.95k
    m_aStatements.push_back(WeakReferenceHelper(xReturn));
89
8.95k
    return xReturn;
90
8.95k
}
91
92
Reference< XPreparedStatement > SAL_CALL ODbaseConnection::prepareStatement( const OUString& sql )
93
17.9k
{
94
17.9k
    ::osl::MutexGuard aGuard( m_aMutex );
95
17.9k
    checkDisposed(OConnection_BASE::rBHelper.bDisposed);
96
97
17.9k
    rtl::Reference<ODbasePreparedStatement> pStmt = new ODbasePreparedStatement(this);
98
17.9k
    pStmt->construct(sql);
99
17.9k
    m_aStatements.push_back(WeakReferenceHelper(*pStmt));
100
17.9k
    return pStmt;
101
17.9k
}
102
103
Reference< XPreparedStatement > SAL_CALL ODbaseConnection::prepareCall( const OUString& /*sql*/ )
104
0
{
105
0
    ::dbtools::throwFeatureNotImplementedSQLException( u"XConnection::prepareCall"_ustr, *this );
106
0
}
107
108
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */