/src/libreoffice/connectivity/source/inc/file/FConnection.hxx
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 | | #pragma once |
20 | | |
21 | | #include <com/sun/star/ucb/XContent.hpp> |
22 | | #include <com/sun/star/beans/PropertyValue.hpp> |
23 | | #include <connectivity/CommonTools.hxx> |
24 | | #include <rtl/ustring.hxx> |
25 | | #include <com/sun/star/sdbcx/XTablesSupplier.hpp> |
26 | | #include <com/sun/star/ucb/XDynamicResultSet.hpp> |
27 | | #include <TConnection.hxx> |
28 | | #include <file/filedllapi.hxx> |
29 | | #include <unotools/weakref.hxx> |
30 | | |
31 | | namespace connectivity::sdbcx { class OCatalog; } |
32 | | |
33 | | namespace connectivity::file |
34 | | { |
35 | | class OFileDriver; |
36 | | |
37 | | class OOO_DLLPUBLIC_FILE OConnection : public connectivity::OMetaConnection |
38 | | { |
39 | | protected: |
40 | | |
41 | | // Data attributes |
42 | | |
43 | | unotools::WeakReference< ::connectivity::sdbcx::OCatalog > m_xCatalog; |
44 | | |
45 | | OUString m_aFilenameExtension; |
46 | | OFileDriver* m_pDriver; // Pointer to the owning |
47 | | // driver object |
48 | | css::uno::Reference< css::ucb::XDynamicResultSet > m_xDir; // directory |
49 | | css::uno::Reference< css::ucb::XContent> m_xContent; |
50 | | |
51 | | bool m_bAutoCommit; |
52 | | bool m_bReadOnly; |
53 | | bool m_bShowDeleted; |
54 | | bool m_bCaseSensitiveExtension; |
55 | | bool m_bCheckSQL92; |
56 | | bool m_bDefaultTextEncoding; |
57 | | |
58 | | |
59 | | void throwUrlNotValid(const OUString & _rsUrl,const OUString & _rsMessage); |
60 | | |
61 | | virtual ~OConnection() override; |
62 | | public: |
63 | | |
64 | | OConnection(OFileDriver* _pDriver); |
65 | | |
66 | | /// @throws css::sdbc::SQLException |
67 | | /// @throws css::uno::RuntimeException |
68 | | /// @throws css::uno::DeploymentException |
69 | | virtual void construct(const OUString& _rUrl, const css::uno::Sequence< css::beans::PropertyValue >& _rInfo ); |
70 | | |
71 | | // OComponentHelper |
72 | | virtual void SAL_CALL disposing() override; |
73 | | |
74 | | // XServiceInfo |
75 | | DECLARE_SERVICE_INFO(); |
76 | | |
77 | | // XConnection |
78 | | virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; |
79 | | virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; |
80 | | virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; |
81 | | virtual OUString SAL_CALL nativeSQL( const OUString& sql ) override; |
82 | | virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) override; |
83 | | virtual sal_Bool SAL_CALL getAutoCommit( ) override; |
84 | | virtual void SAL_CALL commit( ) override; |
85 | | virtual void SAL_CALL rollback( ) override; |
86 | | virtual sal_Bool SAL_CALL isClosed( ) override final; |
87 | | virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; |
88 | | virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) override; |
89 | | virtual sal_Bool SAL_CALL isReadOnly( ) override; |
90 | | virtual void SAL_CALL setCatalog( const OUString& catalog ) override; |
91 | | virtual OUString SAL_CALL getCatalog( ) override; |
92 | | virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) override; |
93 | | virtual sal_Int32 SAL_CALL getTransactionIsolation( ) override; |
94 | | virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override; |
95 | | virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; |
96 | | // XCloseable |
97 | | virtual void SAL_CALL close( ) override final; |
98 | | // XWarningsSupplier |
99 | | virtual css::uno::Any SAL_CALL getWarnings( ) override; |
100 | | virtual void SAL_CALL clearWarnings( ) override; |
101 | | //XUnoTunnel |
102 | | virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; |
103 | | static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); |
104 | | |
105 | | // no interface methods |
106 | | css::uno::Reference< css::ucb::XDynamicResultSet > getDir() const; |
107 | 0 | const css::uno::Reference< css::ucb::XContent>& getContent() const { return m_xContent; } |
108 | | // create a catalog or return the catalog already created |
109 | | virtual css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog(); |
110 | | |
111 | | bool matchesExtension( const OUString& _rExt ) const; |
112 | | |
113 | 0 | const OUString& getExtension() const { return m_aFilenameExtension; } |
114 | 0 | bool isCaseSensitiveExtension() const { return m_bCaseSensitiveExtension; } |
115 | 0 | OFileDriver* getDriver() const { return m_pDriver; } |
116 | 0 | bool showDeleted() const { return m_bShowDeleted; } |
117 | 0 | bool isCheckEnabled() const { return m_bCheckSQL92; } |
118 | 0 | bool isTextEncodingDefaulted() const { return m_bDefaultTextEncoding; } |
119 | | |
120 | | public: |
121 | | struct GrantAccess |
122 | | { |
123 | | friend class ODatabaseMetaData; |
124 | | private: |
125 | 0 | GrantAccess() { } |
126 | | }; |
127 | | |
128 | 0 | void setCaseSensitiveExtension( bool _bIsCS, GrantAccess ) { m_bCaseSensitiveExtension = _bIsCS; } |
129 | | }; |
130 | | |
131 | | } |
132 | | |
133 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |