LibreOffice Module connectivity (master) 1
sqlerror.hxx
Go to the documentation of this file.
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#ifndef INCLUDED_CONNECTIVITY_SQLERROR_HXX
21#define INCLUDED_CONNECTIVITY_SQLERROR_HXX
22
23#include <com/sun/star/sdbc/SQLException.hpp>
25#include <optional>
26#include <memory>
27
28namespace connectivity
29{
30
31
32 //= ErrorCondition
33
38 typedef ::sal_Int32 ErrorCode;
39
42 typedef ::sal_Int32 ErrorCondition;
43
44
45 //= SQLError
46
47 class SQLError_Impl;
48
59 {
60 public:
61 SQLError();
62 ~SQLError();
63
82 OUString getErrorMessage(
83 const ErrorCondition _eCondition
84 ) const;
85
92 static ErrorCode
93 getErrorCode( const ErrorCondition _eCondition );
94
104 static const OUString&
105 getMessagePrefix();
106
107
139 const ErrorCondition _eCondition,
140 const css::uno::Reference< css::uno::XInterface >& _rxContext,
141 const std::optional<OUString>& _rParamValue1 = std::nullopt,
142 const std::optional<OUString>& _rParamValue2 = std::nullopt,
143 const std::optional<OUString>& _rParamValue3 = std::nullopt
144 ) const;
145
161 void raiseException(
162 const ErrorCondition _eCondition
163 ) const;
164
186 void raiseTypedException(
187 const ErrorCondition _eCondition,
188 const css::uno::Reference< css::uno::XInterface >& _rxContext,
189 const css::uno::Type& _rExceptionType
190 ) const;
191
220 css::sdbc::SQLException
221 getSQLException(
222 const ErrorCondition _eCondition,
223 const css::uno::Reference< css::uno::XInterface >& _rxContext,
224 const std::optional<OUString>& _rParamValue1 = std::nullopt,
225 const std::optional<OUString>& _rParamValue2 = std::nullopt,
226 const std::optional<OUString>& _rParamValue3 = std::nullopt
227 ) const;
228
229 private:
230 std::shared_ptr< SQLError_Impl > m_pImpl;
231 };
232
233
234} // namespace connectivity
235
236
237#endif // INCLUDED_CONNECTIVITY_SQLERROR_HXX
238
239/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
a class which provides helpers for working with SQLErrors
Definition: sqlerror.hxx:59
std::shared_ptr< SQLError_Impl > m_pImpl
Definition: sqlerror.hxx:230
void raiseException(const ErrorCondition _eCondition, const css::uno::Reference< css::uno::XInterface > &_rxContext, const std::optional< OUString > &_rParamValue1=std::nullopt, const std::optional< OUString > &_rParamValue2=std::nullopt, const std::optional< OUString > &_rParamValue3=std::nullopt) const
throws an SQLException describing the given error condition
#define OOO_DLLPUBLIC_DBTOOLS
void raiseException(uno_Any *any, uno_Mapping *mapping)
::sal_Int32 ErrorCondition
error condition values as defined in css::sdb::ErrorCondition
Definition: sqlerror.hxx:42
::sal_Int32 ErrorCode
the type of error codes to be used in SQLExceptions
Definition: sqlerror.hxx:38