bump product version to 6.3.0.0.beta1
[LibreOffice.git] / connectivity / source / drivers / ado / AKey.cxx
blob25ffeb6eece68bbd67e2648d2549c8d8e82f7d1b
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 .
20 #include <ado/AKey.hxx>
21 #include <com/sun/star/sdbc/XRow.hpp>
22 #include <com/sun/star/sdbc/XResultSet.hpp>
23 #include <cppuhelper/typeprovider.hxx>
24 #include <ado/AColumns.hxx>
25 #include <ado/AConnection.hxx>
27 using namespace connectivity::ado;
28 using namespace com::sun::star::uno;
29 using namespace com::sun::star::lang;
30 using namespace com::sun::star::beans;
31 using namespace com::sun::star::sdbc;
32 using namespace com::sun::star::sdbcx;
35 OAdoKey::OAdoKey(bool _bCase,OConnection* _pConnection, ADOKey* _pKey)
36 : OKey_ADO(_bCase)
37 ,m_pConnection(_pConnection)
39 construct();
40 m_aKey = WpADOKey(_pKey);
41 fillPropertyValues();
44 OAdoKey::OAdoKey(bool _bCase,OConnection* _pConnection)
45 : OKey_ADO(_bCase)
46 ,m_pConnection(_pConnection)
48 construct();
49 m_aKey.Create();
52 void OAdoKey::refreshColumns()
54 ::std::vector< OUString> aVector;
56 WpADOColumns aColumns;
57 if ( m_aKey.IsValid() )
59 aColumns = m_aKey.get_Columns();
60 aColumns.fillElementNames(aVector);
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));
69 Sequence< sal_Int8 > OAdoKey::getUnoTunnelImplementationId()
71 static ::cppu::OImplementationId implId;
73 return implId.getImplementationId();
76 // css::lang::XUnoTunnel
78 sal_Int64 OAdoKey::getSomething( const Sequence< sal_Int8 > & rId )
80 return (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
81 ? reinterpret_cast< sal_Int64 >( this )
82 : OKey_ADO::getSomething(rId);
85 void OAdoKey::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)
87 if(m_aKey.IsValid())
89 switch(nHandle)
91 case PROPERTY_ID_NAME:
93 OUString aVal;
94 rValue >>= aVal;
95 m_aKey.put_Name(aVal);
96 ADOS::ThrowException(*m_pConnection->getConnection(),*this);
98 break;
99 case PROPERTY_ID_TYPE:
101 sal_Int32 nVal=0;
102 rValue >>= nVal;
103 m_aKey.put_Type(Map2KeyRule(nVal));
104 ADOS::ThrowException(*m_pConnection->getConnection(),*this);
106 break;
107 case PROPERTY_ID_REFERENCEDTABLE:
109 OUString aVal;
110 rValue >>= aVal;
111 m_aKey.put_RelatedTable(aVal);
112 ADOS::ThrowException(*m_pConnection->getConnection(),*this);
114 break;
115 case PROPERTY_ID_UPDATERULE:
117 sal_Int32 nVal=0;
118 rValue >>= nVal;
119 m_aKey.put_UpdateRule(Map2Rule(nVal));
120 ADOS::ThrowException(*m_pConnection->getConnection(),*this);
122 break;
123 case PROPERTY_ID_DELETERULE:
125 sal_Int32 nVal=0;
126 rValue >>= nVal;
127 m_aKey.put_DeleteRule(Map2Rule(nVal));
128 ADOS::ThrowException(*m_pConnection->getConnection(),*this);
130 break;
133 OKey_ADO::setFastPropertyValue_NoBroadcast(nHandle,rValue);
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */