LibreOffice Module connectivity (master) 1
AConnection.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/sdbcx/XTablesSupplier.hpp>
23#include <com/sun/star/beans/PropertyValue.hpp>
24#include <map>
25#include <string_view>
27#include <OTypeInfo.hxx>
28#include <TConnection.hxx>
29#include <ado/Awrapado.hxx>
30
31namespace connectivity::ado
32{
34 {
35 ::connectivity::OTypeInfo aSimpleType; // the general type info
36 DataTypeEnum eType;
37
38 OUString getDBName() const { return aSimpleType.aTypeName; }
39 };
40
41 class WpADOConnection;
42 class ODriver;
43 class OCatalog;
44 typedef std::multimap<DataTypeEnum, OExtendedTypeInfo*> OTypeInfoMap;
46
47
49 {
50 protected:
51
52 // Data attributes
53
54 OTypeInfoMap m_aTypeInfo; // vector containing an entry
55 // for each row returned by
56 // DatabaseMetaData.getTypeInfo.
57 css::uno::WeakReference< css::sdbcx::XTablesSupplier> m_xCatalog;
59 private:
62 sal_Int32 m_nEngineType;
65
66 protected:
68 void buildTypeInfo();
69 public:
72 OConnection(ODriver* _pDriver);
73 // OConnection(const SQLHANDLE _pConnectionHandle);
74 ~OConnection() override;
75 void construct(std::u16string_view url,const css::uno::Sequence< css::beans::PropertyValue >& info);
76
77 //XUnoTunnel
78 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
79 static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
80 // XServiceInfo
82 // OComponentHelper
83 virtual void SAL_CALL disposing() override;
84
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
111 void setCatalog(const css::uno::WeakReference< css::sdbcx::XTablesSupplier>& _xCat) { m_xCatalog = _xCat; }
112 void setCatalog(OCatalog* _pCatalog) { m_pCatalog = _pCatalog; }
113
114 const OTypeInfoMap* getTypeInfo() const { return &m_aTypeInfo;}
116 {
117 if ( m_xCatalog.get().is() )
118 return m_pCatalog;
119 return nullptr;
120 }
121
122 sal_Int32 getEngineType() const { return m_nEngineType; }
123 ODriver* getDriver() const { return m_pDriver; }
124
125 static const OExtendedTypeInfo* getTypeInfoFromType(const OTypeInfoMap& _rTypeInfo,
126 DataTypeEnum _nType,
127 const OUString& _sTypeName,
128 sal_Int32 _nPrecision,
129 sal_Int32 _nScale,
130 bool& _brForceToType);
131 };
132}
133
134/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_Int32 SAL_CALL getTransactionIsolation() override
virtual void SAL_CALL setCatalog(const OUString &catalog) override
virtual void SAL_CALL setAutoCommit(sal_Bool autoCommit) override
virtual void SAL_CALL setTransactionIsolation(sal_Int32 level) override
virtual void SAL_CALL disposing() override
virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData() override
void construct(std::u16string_view url, const css::uno::Sequence< css::beans::PropertyValue > &info)
virtual void SAL_CALL rollback() override
virtual OUString SAL_CALL nativeSQL(const OUString &sql) override
WpADOConnection & getConnection()
virtual void SAL_CALL close() override
virtual sal_Bool SAL_CALL isClosed() override
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap() override
virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall(const OUString &sql) override
const OTypeInfoMap * getTypeInfo() const
void setCatalog(OCatalog *_pCatalog)
sal_Int32 getEngineType() const
WpADOConnection m_aAdoConnection
Definition: AConnection.hxx:60
static css::uno::Sequence< sal_Int8 > getUnoTunnelId()
css::uno::WeakReference< css::sdbcx::XTablesSupplier > m_xCatalog
Definition: AConnection.hxx:57
virtual void SAL_CALL clearWarnings() override
virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement(const OUString &sql) override
virtual sal_Bool SAL_CALL getAutoCommit() override
virtual void SAL_CALL setReadOnly(sal_Bool readOnly) override
static const OExtendedTypeInfo * getTypeInfoFromType(const OTypeInfoMap &_rTypeInfo, DataTypeEnum _nType, const OUString &_sTypeName, sal_Int32 _nPrecision, sal_Int32 _nScale, bool &_brForceToType)
virtual void SAL_CALL setTypeMap(const css::uno::Reference< css::container::XNameAccess > &typeMap) override
virtual sal_Bool SAL_CALL isReadOnly() override
OConnection(ODriver *_pDriver)
Definition: AConnection.cxx:54
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement() override
virtual OUString SAL_CALL getCatalog() override
virtual css::uno::Any SAL_CALL getWarnings() override
OCatalog * getAdoCatalog() const
void setCatalog(const css::uno::WeakReference< css::sdbcx::XTablesSupplier > &_xCat)
virtual void SAL_CALL commit() override
connectivity::OMetaConnection OConnection_BASE
Definition: AConnection.hxx:45
std::multimap< DataTypeEnum, OExtendedTypeInfo * > OTypeInfoMap
Definition: AConnection.hxx:43
::connectivity::OTypeInfo aSimpleType
Definition: AConnection.hxx:35
unsigned char sal_Bool