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