Coverage Report

Created: 2026-07-10 11:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/connectivity/source/drivers/dbase/DDriver.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
#include <dbase/DDriver.hxx>
21
#include <dbase/DConnection.hxx>
22
#include <com/sun/star/lang/DisposedException.hpp>
23
#include <connectivity/dbexception.hxx>
24
#include <strings.hrc>
25
26
using namespace connectivity::dbase;
27
using namespace connectivity::file;
28
using namespace ::com::sun::star::uno;
29
using namespace ::com::sun::star::beans;
30
using namespace ::com::sun::star::sdbcx;
31
using namespace ::com::sun::star::sdbc;
32
using namespace ::com::sun::star::lang;
33
34
35
// XServiceInfo
36
37
OUString SAL_CALL ODriver::getImplementationName(  )
38
0
{
39
0
    return u"com.sun.star.comp.sdbc.dbase.ODriver"_ustr;
40
0
}
41
42
43
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
44
connectivity_dbase_ODriver(
45
    css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
46
1
{
47
1
    rtl::Reference<ODriver> ret;
48
1
    try {
49
1
        ret = new ODriver(context);
50
1
    } catch (...) {
51
0
    }
52
1
    if (ret)
53
1
        ret->acquire();
54
1
    return getXWeak(ret.get());
55
1
}
56
57
58
Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url, const Sequence< PropertyValue >& info )
59
10.3k
{
60
10.3k
    ::osl::MutexGuard aGuard( m_aMutex );
61
10.3k
    if (ODriver_BASE::rBHelper.bDisposed)
62
0
        throw DisposedException();
63
64
10.3k
    if ( ! acceptsURL(url) )
65
0
        return nullptr;
66
67
10.3k
    rtl::Reference<ODbaseConnection> pCon = new ODbaseConnection(this);
68
10.3k
    pCon->construct(url,info);
69
10.3k
    m_xConnections.push_back(pCon.get());
70
71
10.3k
    return pCon;
72
10.3k
}
73
74
sal_Bool SAL_CALL ODriver::acceptsURL( const OUString& url )
75
20.6k
{
76
20.6k
    return url.startsWith("sdbc:dbase:");
77
20.6k
}
78
79
Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const OUString& url, const Sequence< PropertyValue >& /*info*/ )
80
0
{
81
0
    if ( acceptsURL(url) )
82
0
    {
83
0
        Sequence< OUString > aBoolean { u"0"_ustr, u"1"_ustr };
84
85
0
        return
86
0
        {
87
0
            {
88
0
                u"CharSet"_ustr
89
0
                ,u"CharSet of the database."_ustr
90
0
                ,false
91
0
                ,OUString()
92
0
                ,Sequence< OUString >()
93
0
            },
94
0
            {
95
0
                u"ShowDeleted"_ustr
96
0
                ,u"Display inactive records."_ustr
97
0
                ,false
98
0
                ,u"0"_ustr
99
0
                ,aBoolean
100
0
            },
101
0
            {
102
0
                u"EnableSQL92Check"_ustr
103
0
                ,u"Use SQL92 naming constraints."_ustr
104
0
                ,false
105
0
                ,u"0"_ustr
106
0
                ,aBoolean
107
0
            }
108
0
        };
109
0
    }
110
111
0
    SharedResources aResources;
112
0
    const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
113
0
    ::dbtools::throwGenericSQLException(sMessage ,*this);
114
0
}
115
116
117
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */