1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: VKeyColumn.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_connectivity.hxx"
33 #include "connectivity/sdbcx/VKeyColumn.hxx"
34 #include "TConnection.hxx"
36 using namespace connectivity
;
37 using namespace connectivity::sdbcx
;
38 using namespace ::com::sun::star::beans
;
39 using namespace ::com::sun::star::uno
;
41 // -----------------------------------------------------------------------------
42 ::rtl::OUString SAL_CALL
OKeyColumn::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException
)
45 return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VKeyColumnDescription");
46 return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VKeyColumn");
48 // -----------------------------------------------------------------------------
49 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
OKeyColumn::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException
)
51 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aSupported(1);
53 aSupported
[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.KeyColumnDescription");
55 aSupported
[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.KeyColumn");
59 // -----------------------------------------------------------------------------
60 sal_Bool SAL_CALL
OKeyColumn::supportsService( const ::rtl::OUString
& _rServiceName
) throw(::com::sun::star::uno::RuntimeException
)
62 Sequence
< ::rtl::OUString
> aSupported(getSupportedServiceNames());
63 const ::rtl::OUString
* pSupported
= aSupported
.getConstArray();
64 const ::rtl::OUString
* pEnd
= pSupported
+ aSupported
.getLength();
65 for (;pSupported
!= pEnd
&& !pSupported
->equals(_rServiceName
); ++pSupported
)
68 return pSupported
!= pEnd
;
70 // -------------------------------------------------------------------------
71 OKeyColumn::OKeyColumn(sal_Bool _bCase
) : OColumn(_bCase
)
75 // -------------------------------------------------------------------------
76 OKeyColumn::OKeyColumn( const ::rtl::OUString
& _ReferencedColumn
,
77 const ::rtl::OUString
& _Name
,
78 const ::rtl::OUString
& _TypeName
,
79 const ::rtl::OUString
& _DefaultValue
,
80 sal_Int32 _IsNullable
,
84 sal_Bool _IsAutoIncrement
,
85 sal_Bool _IsRowVersion
,
99 , m_ReferencedColumn(_ReferencedColumn
)
103 // -------------------------------------------------------------------------
104 OKeyColumn::~OKeyColumn()
107 // -----------------------------------------------------------------------------
108 ::cppu::IPropertyArrayHelper
* OKeyColumn::createArrayHelper( sal_Int32
/*_nId*/ ) const
110 return doCreateArrayHelper();
112 // -----------------------------------------------------------------------------
113 ::cppu::IPropertyArrayHelper
& SAL_CALL
OKeyColumn::getInfoHelper()
115 return *OKeyColumn_PROP::getArrayHelper(isNew() ? 1 : 0);
117 // -------------------------------------------------------------------------
118 void OKeyColumn::construct()
120 sal_Int32 nAttrib
= isNew() ? 0 : PropertyAttribute::READONLY
;
121 registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RELATEDCOLUMN
), PROPERTY_ID_RELATEDCOLUMN
, nAttrib
,&m_ReferencedColumn
, ::getCppuType(reinterpret_cast< ::rtl::OUString
*>(NULL
)));
123 // -----------------------------------------------------------------------------