Update ooo320-m1
[ooovba.git] / connectivity / source / inc / file / FConnection.hxx
blob774979e898aa9e5c2d053e306682ab6b03c41ae4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: FConnection.hxx,v $
10 * $Revision: 1.24 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _CONNECTIVITY_FILE_OCONNECTION_HXX_
31 #define _CONNECTIVITY_FILE_OCONNECTION_HXX_
33 #include <com/sun/star/ucb/XContent.hpp>
34 #include <com/sun/star/sdbc/SQLWarning.hpp>
35 #include <com/sun/star/beans/PropertyValue.hpp>
36 #include "OSubComponent.hxx"
37 #ifndef _MAP_
38 #include <map>
39 #endif
40 #include "connectivity/CommonTools.hxx"
41 #include "OTypeInfo.hxx"
42 #include <tools/string.hxx>
43 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
44 #include <com/sun/star/ucb/XDynamicResultSet.hpp>
45 #include "connectivity/sqlparse.hxx"
46 #include "connectivity/sqliterator.hxx"
47 #include "TConnection.hxx"
48 #include "file/filedllapi.hxx"
50 namespace connectivity
52 namespace file
55 class OStatement_Base;
56 class ODatabaseMetaData;
57 class OFileDriver;
59 class OOO_DLLPUBLIC_FILE OConnection :
60 public connectivity::OMetaConnection,
61 public connectivity::OSubComponent<OConnection, connectivity::OMetaConnection>
63 friend class connectivity::OSubComponent<OConnection, connectivity::OMetaConnection>;
65 protected:
66 //====================================================================
67 // Data attributes
68 //====================================================================
69 ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbcx::XTablesSupplier> m_xCatalog;
71 ::com::sun::star::sdbc::SQLWarning m_aLastWarning; // Last SQLWarning generated by
73 String m_aFilenameExtension;
74 OFileDriver* m_pDriver; // Pointer to the owning
75 // driver object
76 ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet > m_xDir; // directory
77 ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent> m_xContent;
79 sal_Bool m_bClosed;
80 sal_Bool m_bAutoCommit;
81 sal_Bool m_bReadOnly;
82 sal_Bool m_bShowDeleted;
83 sal_Bool m_bCaseSensitiveExtension;
84 sal_Bool m_bCheckSQL92;
85 bool m_bDefaultTextEncoding;
88 void throwUrlNotValid(const ::rtl::OUString & _rsUrl,const ::rtl::OUString & _rsMessage);
90 virtual ~OConnection();
91 public:
93 OConnection(OFileDriver* _pDriver);
95 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);
97 void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException);
99 // OComponentHelper
100 virtual void SAL_CALL disposing(void);
101 // XInterface
102 virtual void SAL_CALL release() throw();
104 // XServiceInfo
105 DECLARE_SERVICE_INFO();
107 // XConnection
108 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);
109 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);
110 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);
111 virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
112 virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
113 virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
114 virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
115 virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
116 virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
117 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);
118 virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
119 virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
120 virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
121 virtual ::rtl::OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
122 virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
123 virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
124 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);
125 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);
126 // XCloseable
127 virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
128 // XWarningsSupplier
129 virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
130 virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
131 //XUnoTunnel
132 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (::com::sun::star::uno::RuntimeException);
133 static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
135 // no interface methods
136 ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet > getDir() const;
137 ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent> getContent() const { return m_xContent; }
138 // create a catalog or return the catalog already created
139 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > createCatalog();
141 sal_Bool matchesExtension( const String& _rExt ) const;
143 inline const String& getExtension() const { return m_aFilenameExtension; }
144 inline sal_Bool isCaseSensitveExtension() const { return m_bCaseSensitiveExtension; }
145 inline OFileDriver* getDriver() const { return m_pDriver; }
146 inline sal_Bool showDeleted() const { return m_bShowDeleted; }
147 inline sal_Bool isCheckEnabled() const { return m_bCheckSQL92; }
148 inline bool isTextEncodingDefaulted() const { return m_bDefaultTextEncoding; }
150 public:
151 struct GrantAccess
153 friend class ODatabaseMetaData;
154 private:
155 GrantAccess() { }
158 void setCaseSensitiveExtension( sal_Bool _bIsCS, GrantAccess ) { m_bCaseSensitiveExtension = _bIsCS; }
162 #endif // _CONNECTIVITY_FILE_OCONNECTION_HXX_