Update ooo320-m1
[ooovba.git] / connectivity / source / drivers / adabas / BResultSetMetaData.cxx
blob210ec76b56ae33484d74ca8f074d722e3bcab6cb
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: BResultSetMetaData.cxx,v $
10 * $Revision: 1.11 $
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"
34 #ifndef _CONNECTIVITY_ADABAS_BRESULTSETMETADATA_HXX_
35 #include "adabas/BResultSetMetaData.hxx"
36 #endif
37 #include "adabas/BCatalog.hxx"
38 #include <com/sun/star/sdbc/DataType.hpp>
39 #include <com/sun/star/sdbc/XRow.hpp>
41 using namespace com::sun::star::sdbc;
42 using namespace com::sun::star::uno;
43 using namespace connectivity::adabas;
44 using namespace connectivity;
46 OAdabasResultSetMetaData::OAdabasResultSetMetaData(odbc::OConnection* _pConnection, SQLHANDLE _pStmt,const ::vos::ORef<OSQLColumns>& _rSelectColumns )
47 : OAdabasResultSetMetaData_BASE(_pConnection,_pStmt)
48 ,m_aSelectColumns(_rSelectColumns)
51 // -------------------------------------------------------------------------
52 OAdabasResultSetMetaData::~OAdabasResultSetMetaData()
55 // -----------------------------------------------------------------------------
56 sal_Int32 SAL_CALL OAdabasResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException)
58 sal_Int32 nType = OAdabasResultSetMetaData_BASE::getColumnType( column);
59 // special handling for float values which could be doubles
60 ::rtl::OUString sTypeName;
61 OAdabasCatalog::correctColumnProperties(getPrecision(column),nType,sTypeName);
63 return nType;
65 // -----------------------------------------------------------------------------
66 sal_Int32 SAL_CALL OAdabasResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException)
68 sal_Int32 nValue = 0;
69 sal_Bool bFound = sal_False;
70 if ( m_aSelectColumns.isValid() && column > 0 && column <= (sal_Int32)m_aSelectColumns->get().size() )
71 bFound = (m_aSelectColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)) >>= nValue;
73 if ( !bFound )
74 nValue = getNumColAttrib(column,SQL_DESC_NULLABLE);
75 return nValue;
77 // -------------------------------------------------------------------------
78 sal_Bool SAL_CALL OAdabasResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException)
80 if ( m_aSelectColumns.isValid() && column > 0 && column <= (sal_Int32)m_aSelectColumns->get().size() )
82 sal_Bool bAutoIncrement = sal_False;
83 (m_aSelectColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT)) >>= bAutoIncrement;
84 return bAutoIncrement;
87 return getNumColAttrib(column,SQL_DESC_AUTO_UNIQUE_VALUE) == SQL_TRUE;
89 // -------------------------------------------------------------------------