nss: upgrade to release 3.73
[LibreOffice.git] / connectivity / source / inc / odbc / OConnection.hxx
blob842ad47c1d107540ed1520f2f59df15b2d760c26
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/CommonTools.hxx>
27 #include <TConnection.hxx>
28 #include <OTypeInfo.hxx>
29 #include <odbc/OTools.hxx>
30 #include <cppuhelper/weakref.hxx>
31 #include <AutoRetrievingBase.hxx>
32 #include <osl/module.h>
33 #include <rtl/ref.hxx>
36 #include <map>
38 namespace connectivity::odbc
40 class ODBCDriver;
42 typedef connectivity::OMetaConnection OConnection_BASE;
43 typedef std::vector< ::connectivity::OTypeInfo> TTypeInfoVector;
45 class OOO_DLLPUBLIC_ODBCBASE OConnection final :
46 public OConnection_BASE,
47 public OAutoRetrievingBase
49 // Data attributes
51 std::map< SQLHANDLE, rtl::Reference<OConnection>> m_aConnections; // holds all connections which are need for several statements
54 OUString m_sUser; // the user name
55 rtl::Reference<ODBCDriver>
56 m_xDriver; // Pointer to the owning
57 // driver object
59 SQLHANDLE m_aConnectionHandle;
60 SQLHANDLE m_pDriverHandleCopy; // performance reason
61 sal_Int32 m_nStatementCount;
62 bool m_bClosed;
63 bool m_bUseCatalog; // should we use the catalog on filebased databases
64 bool m_bUseOldDateFormat;
65 bool m_bIgnoreDriverPrivileges;
66 bool m_bPreventGetVersionColumns; // #i60273#
67 bool m_bReadOnly;
70 SQLRETURN OpenConnection(const OUString& aConnectStr,sal_Int32 nTimeOut, bool bSilent);
72 public:
73 oslGenericFunction getOdbcFunction(ODBC3SQLFunctionId _nIndex) const;
74 /// @throws css::sdbc::SQLException
75 SQLRETURN Construct( const OUString& url,const css::uno::Sequence< css::beans::PropertyValue >& info);
77 OConnection(const SQLHANDLE _pDriverHandle,ODBCDriver* _pDriver);
78 // OConnection(const SQLHANDLE _pConnectionHandle);
79 virtual ~OConnection() override;
81 // OComponentHelper
82 virtual void SAL_CALL disposing() override;
84 // XServiceInfo
85 DECLARE_SERVICE_INFO();
86 // XConnection
87 virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override;
88 virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override;
89 virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override;
90 virtual OUString SAL_CALL nativeSQL( const OUString& sql ) override;
91 virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) override;
92 virtual sal_Bool SAL_CALL getAutoCommit( ) override;
93 virtual void SAL_CALL commit( ) override;
94 virtual void SAL_CALL rollback( ) override;
95 virtual sal_Bool SAL_CALL isClosed( ) override;
96 virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override;
97 virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) override;
98 virtual sal_Bool SAL_CALL isReadOnly( ) override;
99 virtual void SAL_CALL setCatalog( const OUString& catalog ) override;
100 virtual OUString SAL_CALL getCatalog( ) override;
101 virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) override;
102 virtual sal_Int32 SAL_CALL getTransactionIsolation( ) override;
103 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override;
104 virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& typeMap ) override;
105 // XCloseable
106 virtual void SAL_CALL close( ) override;
107 // XWarningsSupplier
108 virtual css::uno::Any SAL_CALL getWarnings( ) override;
109 virtual void SAL_CALL clearWarnings( ) override;
111 SQLHANDLE getConnection() { return m_aConnectionHandle; }
113 // should we use the catalog on filebased databases
114 bool isCatalogUsed() const { return m_bUseCatalog; }
115 bool isIgnoreDriverPrivilegesEnabled() const { return m_bIgnoreDriverPrivileges; }
116 bool preventGetVersionColumns() const { return m_bPreventGetVersionColumns; }
117 bool useOldDateFormat() const { return m_bUseOldDateFormat; }
118 ODBCDriver* getDriver() const { return m_xDriver.get();}
120 SQLHANDLE createStatementHandle();
121 // close and free the handle and set it to SQL_NULLHANDLE
122 void freeStatementHandle(SQLHANDLE& _pHandle);
126 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OCONNECTION_HXX
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */