LibreOffice Module connectivity (master) 1
AKey.cxx
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
20#include <ado/AKey.hxx>
21#include <com/sun/star/sdbc/XRow.hpp>
22#include <com/sun/star/sdbc/XResultSet.hpp>
24#include <ado/AColumns.hxx>
25#include <ado/AConnection.hxx>
26
27using namespace connectivity::ado;
28using namespace com::sun::star::uno;
29using namespace com::sun::star::lang;
30using namespace com::sun::star::beans;
31using namespace com::sun::star::sdbc;
32using namespace com::sun::star::sdbcx;
33
34
35OAdoKey::OAdoKey(bool _bCase,OConnection* _pConnection, ADOKey* _pKey)
36 : OKey_ADO(_bCase)
37 ,m_pConnection(_pConnection)
38{
39 construct();
40 m_aKey.set(_pKey);
42}
43
44OAdoKey::OAdoKey(bool _bCase,OConnection* _pConnection)
45 : OKey_ADO(_bCase)
46 ,m_pConnection(_pConnection)
47{
48 construct();
49 m_aKey.Create();
50}
51
53{
54 ::std::vector< OUString> aVector;
55
56 WpADOColumns aColumns;
57 if ( m_aKey.IsValid() )
58 {
59 aColumns = m_aKey.get_Columns();
60 aColumns.fillElementNames(aVector);
61 }
62
63 if(m_pColumns)
64 m_pColumns->reFill(aVector);
65 else
66 m_pColumns.reset(new OColumns(*this, m_aMutex, aVector, aColumns, isCaseSensitive(), m_pConnection));
67}
68
69void OAdoKey::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)
70{
71 if(m_aKey.IsValid())
72 {
73 switch(nHandle)
74 {
76 {
77 OUString aVal;
78 rValue >>= aVal;
79 m_aKey.put_Name(aVal);
81 }
82 break;
84 {
85 sal_Int32 nVal=0;
86 rValue >>= nVal;
89 }
90 break;
92 {
93 OUString aVal;
94 rValue >>= aVal;
97 }
98 break;
100 {
101 sal_Int32 nVal=0;
102 rValue >>= nVal;
105 }
106 break;
108 {
109 sal_Int32 nVal=0;
110 rValue >>= nVal;
113 }
114 break;
115 }
116 }
118}
119
120/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
static void ThrowException(ADOConnection *_pAdoCon, const css::uno::Reference< css::uno::XInterface > &_xInterface)
Definition: ADriver.cxx:207
static RuleEnum Map2Rule(sal_Int32 _eNum)
virtual void refreshColumns() override
Definition: AKey.cxx:52
static KeyTypeEnum Map2KeyRule(sal_Int32 _eNum)
OConnection * m_pConnection
Definition: AKey.hxx:34
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
Definition: AKey.cxx:69
OAdoKey(bool _bCase, OConnection *_pConnection, ADOKey *_pKey)
Definition: AKey.cxx:35
WpADOConnection & getConnection()
void put_Type(const KeyTypeEnum &_eNum)
Definition: Awrapado.cxx:1115
void put_DeleteRule(const RuleEnum &_eNum)
Definition: Awrapado.cxx:1144
void put_Name(std::u16string_view _rName)
Definition: Awrapado.cxx:1100
WpADOColumns get_Columns() const
Definition: Awrapado.cxx:1164
void put_UpdateRule(const RuleEnum &_eNum)
Definition: Awrapado.cxx:1158
void put_RelatedTable(std::u16string_view _rName)
Definition: Awrapado.cxx:1129
void fillElementNames(::std::vector< OUString > &_rVector)
Definition: Aolewrap.hxx:129
virtual void construct() override
Definition: VKey.cxx:111
std::unique_ptr< OCollection > m_pColumns
Definition: VKey.hxx:70
mutable::osl::Mutex m_aMutex
#define PROPERTY_ID_NAME
Definition: propertyids.hxx:50
#define PROPERTY_ID_REFERENCEDTABLE
Definition: propertyids.hxx:61
#define PROPERTY_ID_TYPE
Definition: propertyids.hxx:51
#define PROPERTY_ID_DELETERULE
Definition: propertyids.hxx:63
#define PROPERTY_ID_UPDATERULE
Definition: propertyids.hxx:62
sal_Int32 nHandle