LibreOffice Module connectivity (master) 1
OConnection.hxx
Go to the documentation of this file.
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#pragma once
20
21#include <com/sun/star/sdbc/SQLWarning.hpp>
22#include <com/sun/star/beans/PropertyValue.hpp>
23#include <connectivity/odbc.hxx>
26#include <TConnection.hxx>
27#include <OTypeInfo.hxx>
28#include <odbc/OTools.hxx>
31#include <osl/module.h>
32#include <rtl/ref.hxx>
33
34
35#include <map>
36
37namespace connectivity::odbc
38 {
39 class ODBCDriver;
40
42 typedef std::vector< ::connectivity::OTypeInfo> TTypeInfoVector;
43
45 public OConnection_BASE,
47 {
48 // Data attributes
49
50 std::map< SQLHANDLE, rtl::Reference<OConnection>> m_aConnections; // holds all connections which are need for several statements
51
52
53 OUString m_sUser; // the user name
55 m_xDriver; // Pointer to the owning
56 // driver object
57
59 SQLHANDLE m_pDriverHandleCopy; // performance reason
62 bool m_bUseCatalog; // should we use the catalog on filebased databases
67
68
69 SQLRETURN OpenConnection(const OUString& aConnectStr,sal_Int32 nTimeOut, bool bSilent);
70
71 public:
72 oslGenericFunction getOdbcFunction(ODBC3SQLFunctionId _nIndex) const;
74 SQLRETURN Construct( const OUString& url,const css::uno::Sequence< css::beans::PropertyValue >& info);
75
76 OConnection(const SQLHANDLE _pDriverHandle,ODBCDriver* _pDriver);
77 // OConnection(const SQLHANDLE _pConnectionHandle);
78 virtual ~OConnection() override;
79
80 // OComponentHelper
81 virtual void SAL_CALL disposing() override;
82
83 // XServiceInfo
85 // XConnection
86 virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override;
87 virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override;
88 virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override;
89 virtual OUString SAL_CALL nativeSQL( const OUString& sql ) override;
90 virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) override;
91 virtual sal_Bool SAL_CALL getAutoCommit( ) override;
92 virtual void SAL_CALL commit( ) override;
93 virtual void SAL_CALL rollback( ) override;
94 virtual sal_Bool SAL_CALL isClosed( ) override;
95 virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override;
96 virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) override;
97 virtual sal_Bool SAL_CALL isReadOnly( ) override;
98 virtual void SAL_CALL setCatalog( const OUString& catalog ) override;
99 virtual OUString SAL_CALL getCatalog( ) override;
100 virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) override;
101 virtual sal_Int32 SAL_CALL getTransactionIsolation( ) override;
102 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override;
103 virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& typeMap ) override;
104 // XCloseable
105 virtual void SAL_CALL close( ) override;
106 // XWarningsSupplier
107 virtual css::uno::Any SAL_CALL getWarnings( ) override;
108 virtual void SAL_CALL clearWarnings( ) override;
109
110 SQLHANDLE getConnection() { return m_aConnectionHandle; }
111
112 // should we use the catalog on filebased databases
113 bool isCatalogUsed() const { return m_bUseCatalog; }
114 bool isIgnoreDriverPrivilegesEnabled() const { return m_bIgnoreDriverPrivileges; }
115 bool preventGetVersionColumns() const { return m_bPreventGetVersionColumns; }
116 bool useOldDateFormat() const { return m_bUseOldDateFormat; }
117 ODBCDriver* getDriver() const { return m_xDriver.get();}
118
119 SQLHANDLE createStatementHandle();
120 // close and free the handle and set it to SQL_NULLHANDLE
121 void freeStatementHandle(SQLHANDLE& _pHandle);
122 };
123
124}
125
126/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ODBC3SQLFunctionId
Definition: OTools.hxx:33
virtual void SAL_CALL setTypeMap(const css::uno::Reference< css::container::XNameAccess > &typeMap) override
ODBCDriver * getDriver() const
bool isIgnoreDriverPrivilegesEnabled() const
std::map< SQLHANDLE, rtl::Reference< OConnection > > m_aConnections
Definition: OConnection.hxx:50
rtl::Reference< ODBCDriver > m_xDriver
Definition: OConnection.hxx:55
bool close
connectivity::OMetaConnection OConnection_BASE
Definition: OConnection.hxx:39
std::vector< ::connectivity::OTypeInfo > TTypeInfoVector
Definition: OConnection.hxx:42
#define OOO_DLLPUBLIC_ODBCBASE
unsigned char sal_Bool