1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCONNECTION_HXX
20 #define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCONNECTION_HXX
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 #include <connectivity/CommonTools.hxx>
27 #include "OTypeInfo.hxx"
28 #include <rtl/ustring.hxx>
29 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
30 #include <com/sun/star/ucb/XDynamicResultSet.hpp>
31 #include <com/sun/star/uno/DeploymentException.hpp>
32 #include <connectivity/sqlparse.hxx>
33 #include <connectivity/sqliterator.hxx>
34 #include "TConnection.hxx"
35 #include "file/filedllapi.hxx"
38 namespace connectivity
42 class ODatabaseMetaData
;
45 class OOO_DLLPUBLIC_FILE OConnection
:
46 public connectivity::OMetaConnection
,
47 public connectivity::OSubComponent
<OConnection
, connectivity::OMetaConnection
>
49 friend class connectivity::OSubComponent
<OConnection
, connectivity::OMetaConnection
>;
55 ::com::sun::star::uno::WeakReference
< ::com::sun::star::sdbcx::XTablesSupplier
> m_xCatalog
;
57 ::com::sun::star::sdbc::SQLWarning m_aLastWarning
; // Last SQLWarning generated by
59 OUString m_aFilenameExtension
;
60 OFileDriver
* m_pDriver
; // Pointer to the owning
62 ::com::sun::star::uno::Reference
< ::com::sun::star::ucb::XDynamicResultSet
> m_xDir
; // directory
63 ::com::sun::star::uno::Reference
< ::com::sun::star::ucb::XContent
> m_xContent
;
69 bool m_bCaseSensitiveExtension
;
71 bool m_bDefaultTextEncoding
;
74 void throwUrlNotValid(const OUString
& _rsUrl
,const OUString
& _rsMessage
);
76 virtual ~OConnection();
79 OConnection(OFileDriver
* _pDriver
);
81 virtual void construct(const OUString
& _rUrl
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& _rInfo
)
82 throw( css::sdbc::SQLException
,
83 css::uno::RuntimeException
,
84 css::uno::DeploymentException
);
87 void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException
);
90 virtual void SAL_CALL
disposing() SAL_OVERRIDE
;
92 virtual void SAL_CALL
release() throw() SAL_OVERRIDE
;
95 DECLARE_SERVICE_INFO();
98 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
, std::exception
) SAL_OVERRIDE
;
99 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XPreparedStatement
> SAL_CALL
prepareStatement( const OUString
& sql
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
100 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XPreparedStatement
> SAL_CALL
prepareCall( const OUString
& sql
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
101 virtual OUString SAL_CALL
nativeSQL( const OUString
& sql
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
102 virtual void SAL_CALL
setAutoCommit( sal_Bool autoCommit
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
103 virtual sal_Bool SAL_CALL
getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
104 virtual void SAL_CALL
commit( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
105 virtual void SAL_CALL
rollback( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
106 virtual sal_Bool SAL_CALL
isClosed( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
107 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
, std::exception
) SAL_OVERRIDE
;
108 virtual void SAL_CALL
setReadOnly( sal_Bool readOnly
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
109 virtual sal_Bool SAL_CALL
isReadOnly( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
110 virtual void SAL_CALL
setCatalog( const OUString
& catalog
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
111 virtual OUString SAL_CALL
getCatalog( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
112 virtual void SAL_CALL
setTransactionIsolation( sal_Int32 level
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
113 virtual sal_Int32 SAL_CALL
getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
114 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
, std::exception
) SAL_OVERRIDE
;
115 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
, std::exception
) SAL_OVERRIDE
;
117 virtual void SAL_CALL
close( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
119 virtual ::com::sun::star::uno::Any SAL_CALL
getWarnings( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
120 virtual void SAL_CALL
clearWarnings( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
122 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
123 static ::com::sun::star::uno::Sequence
< sal_Int8
> getUnoTunnelImplementationId();
125 // no interface methods
126 ::com::sun::star::uno::Reference
< ::com::sun::star::ucb::XDynamicResultSet
> getDir() const;
127 ::com::sun::star::uno::Reference
< ::com::sun::star::ucb::XContent
> getContent() const { return m_xContent
; }
128 // create a catalog or return the catalog already created
129 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbcx::XTablesSupplier
> createCatalog();
131 bool matchesExtension( const OUString
& _rExt
) const;
133 inline const OUString
& getExtension() const { return m_aFilenameExtension
; }
134 inline bool isCaseSensitveExtension() const { return m_bCaseSensitiveExtension
; }
135 inline OFileDriver
* getDriver() const { return m_pDriver
; }
136 inline bool showDeleted() const { return m_bShowDeleted
; }
137 inline bool isCheckEnabled() const { return m_bCheckSQL92
; }
138 inline bool isTextEncodingDefaulted() const { return m_bDefaultTextEncoding
; }
143 friend class ODatabaseMetaData
;
148 void setCaseSensitiveExtension( bool _bIsCS
, GrantAccess
) { m_bCaseSensitiveExtension
= _bIsCS
; }
152 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCONNECTION_HXX
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */