Line data Source code
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_WARNINGSCONTAINER_HXX
21 : #define INCLUDED_CONNECTIVITY_WARNINGSCONTAINER_HXX
22 :
23 : #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
24 : #include <com/sun/star/sdb/SQLContext.hpp>
25 :
26 : #include <connectivity/dbtoolsdllapi.hxx>
27 :
28 :
29 : namespace dbtools
30 : {
31 :
32 : /** helper class for implementing XWarningsSupplier, which mixes own warnings with
33 : warnings obtained from an external instance
34 : */
35 13971 : class OOO_DLLPUBLIC_DBTOOLS WarningsContainer
36 : {
37 : private:
38 : css::uno::Reference< css::sdbc::XWarningsSupplier > m_xExternalWarnings;
39 : css::uno::Any m_aOwnWarnings;
40 :
41 : public:
42 410 : WarningsContainer() {}
43 13566 : WarningsContainer( const css::uno::Reference< css::sdbc::XWarningsSupplier >& _rxExternalWarnings )
44 13566 : :m_xExternalWarnings( _rxExternalWarnings ) {}
45 :
46 754 : void setExternalWarnings( const css::uno::Reference< css::sdbc::XWarningsSupplier >& _rxExternalWarnings )
47 : {
48 754 : m_xExternalWarnings = _rxExternalWarnings;
49 754 : }
50 :
51 : // convenience
52 : /** appends an SQLWarning instance to the chain
53 : @param _rWarning
54 : the warning message
55 : @param _pAsciiSQLState
56 : the SQLState of the warning
57 : @param _rxContext
58 : the context of the warning
59 : */
60 : void appendWarning(
61 : const OUString& _rWarning,
62 : const sal_Char* _pAsciiSQLState,
63 : const css::uno::Reference< css::uno::XInterface >& _rxContext );
64 :
65 : void appendWarning(const css::sdbc::SQLException& _rWarning);
66 : void appendWarning(const css::sdbc::SQLWarning& _rWarning);
67 : void appendWarning(const css::sdb::SQLContext& _rContext);
68 :
69 : // XWarningsSupplier equivalents
70 : css::uno::Any SAL_CALL getWarnings( ) const;
71 : void SAL_CALL clearWarnings( );
72 : };
73 :
74 :
75 : } // namespace dbtools
76 :
77 :
78 : #endif // INCLUDED_CONNECTIVITY_WARNINGSCONTAINER_HXX
79 :
80 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|