update emoji autocorrect entries from po-files
[LibreOffice.git] / connectivity / source / inc / odbc / OConnection.hxx
blobdbf8f3772d852db61a4e5a03e12abd1965889a02
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_ODBC_OCONNECTION_HXX
20 #define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OCONNECTION_HXX
22 #include <com/sun/star/sdbc/SQLWarning.hpp>
23 #include <com/sun/star/beans/PropertyValue.hpp>
24 #include <connectivity/odbc.hxx>
25 #include "odbc/odbcbasedllapi.hxx"
26 #include <connectivity/OSubComponent.hxx>
27 #include <connectivity/CommonTools.hxx>
28 #include "TConnection.hxx"
29 #include "OTypeInfo.hxx"
30 #include <cppuhelper/weakref.hxx>
31 #include "AutoRetrievingBase.hxx"
32 #include <osl/module.h>
35 #include <map>
37 namespace connectivity
39 namespace odbc
41 class ODBCDriver;
43 typedef connectivity::OMetaConnection OConnection_BASE;
44 typedef ::std::vector< ::connectivity::OTypeInfo> TTypeInfoVector;
46 class OOO_DLLPUBLIC_ODBCBASE OConnection :
47 public OConnection_BASE,
48 public connectivity::OSubComponent<OConnection, OConnection_BASE>,
49 public OAutoRetrievingBase
51 friend class connectivity::OSubComponent<OConnection, OConnection_BASE>;
53 protected:
55 // Data attributes
57 ::std::map< SQLHANDLE,OConnection*> m_aConnections; // holds all connectionas which are need for serveral statements
58 TTypeInfoVector m_aTypeInfo; // vector containing an entry
59 // for each row returned by
60 // DatabaseMetaData.getTypeInfo.
63 ::com::sun::star::sdbc::SQLWarning m_aLastWarning; // Last SQLWarning generated by
64 // an operation
65 OUString m_sUser; // the user name
66 ODBCDriver* m_pDriver; // Pointer to the owning
67 // driver object
69 SQLHANDLE m_aConnectionHandle;
70 SQLHANDLE m_pDriverHandleCopy; // performance reason
71 sal_Int32 m_nStatementCount;
72 bool m_bClosed;
73 bool m_bUseCatalog; // should we use the catalog on filebased databases
74 bool m_bUseOldDateFormat;
75 bool m_bParameterSubstitution;
76 bool m_bIgnoreDriverPrivileges;
77 bool m_bPreventGetVersionColumns; // #i60273#
78 bool m_bReadOnly;
81 SQLRETURN OpenConnection(const OUString& aConnectStr,sal_Int32 nTimeOut, bool bSilent);
83 OConnection* cloneConnection(); // creates a new connection
85 public:
86 oslGenericFunction getOdbcFunction(sal_Int32 _nIndex) const;
87 SQLRETURN Construct( const OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info) throw(::com::sun::star::sdbc::SQLException);
89 OConnection(const SQLHANDLE _pDriverHandle,ODBCDriver* _pDriver);
90 // OConnection(const SQLHANDLE _pConnectionHandle);
91 virtual ~OConnection();
93 void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException);
95 // OComponentHelper
96 virtual void SAL_CALL disposing() SAL_OVERRIDE;
97 // XInterface
98 virtual void SAL_CALL release() throw() SAL_OVERRIDE;
100 // XServiceInfo
101 DECLARE_SERVICE_INFO();
102 // XConnection
103 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;
104 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;
105 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;
106 virtual OUString SAL_CALL nativeSQL( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
107 virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
108 virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
110 virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
111 virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
112 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;
113 virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
114 virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
115 virtual void SAL_CALL setCatalog( const OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
116 virtual OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
117 virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
118 virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
119 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;
120 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;
121 // XCloseable
122 virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 // XWarningsSupplier
124 virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
125 virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
127 SQLHANDLE getConnection() { return m_aConnectionHandle; }
129 // should we use the catalog on filebased databases
130 inline bool isCatalogUsed() const { return m_bUseCatalog; }
131 inline bool isParameterSubstitutionEnabled() const { return m_bParameterSubstitution; }
132 inline bool isIgnoreDriverPrivilegesEnabled() const { return m_bIgnoreDriverPrivileges; }
133 inline bool preventGetVersionColumns() const { return m_bPreventGetVersionColumns; }
134 inline bool useOldDateFormat() const { return m_bUseOldDateFormat; }
135 inline SQLHANDLE getDriverHandle() const { return m_pDriverHandleCopy;}
136 inline ODBCDriver* getDriver() const { return m_pDriver;}
137 inline OUString getUserName() const { return m_sUser; }
139 SQLHANDLE createStatementHandle();
140 // close and free the handle and set it to SQL_NULLHANDLE
141 void freeStatementHandle(SQLHANDLE& _pHandle);
143 const TTypeInfoVector& getTypeInfo() const { return m_aTypeInfo; }
147 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OCONNECTION_HXX
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */