1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * Effective License of whole file:
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License version 2.1, as published by the Free Software Foundation.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
22 * The Contents of this file are made available subject to the terms of
23 * the GNU Lesser General Public License Version 2.1
25 * Copyright: 2000 by Sun Microsystems, Inc.
27 * Contributor(s): Joerg Budischewski
29 * All parts contributed on or after August 2011:
31 * This Source Code Form is subject to the terms of the Mozilla Public
32 * License, v. 2.0. If a copy of the MPL was not distributed with this
33 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
35 ************************************************************************/
38 #include "pq_sequenceresultset.hxx"
39 #include "pq_sequenceresultsetmetadata.hxx"
41 #include <connectivity/dbexception.hxx>
43 using com::sun::star::sdbc::XResultSetMetaData
;
45 using com::sun::star::uno::Sequence
;
46 using com::sun::star::uno::Reference
;
47 using com::sun::star::uno::Any
;
49 namespace pq_sdbc_driver
52 void SequenceResultSet::checkClosed()
53 throw ( com::sun::star::sdbc::SQLException
,
54 com::sun::star::uno::RuntimeException
)
60 Any
SequenceResultSet::getValue( sal_Int32 columnIndex
)
62 m_wasNull
= ! m_data
[m_row
][columnIndex
-1 ].hasValue();
63 return m_data
[m_row
][columnIndex
-1 ];
66 SequenceResultSet::SequenceResultSet(
67 const ::rtl::Reference
< RefCountedMutex
> & mutex
,
68 const com::sun::star::uno::Reference
< com::sun::star::uno::XInterface
> &owner
,
69 const Sequence
< OUString
> &colNames
,
70 const Sequence
< Sequence
< Any
> > &data
,
71 const Reference
< com::sun::star::script::XTypeConverter
> & tc
,
72 const ColumnMetaDataVector
*pVec
) :
73 BaseResultSet( mutex
, owner
, data
.getLength(), colNames
.getLength(),tc
),
75 m_columnNames( colNames
)
79 m_meta
= new SequenceResultSetMetaData( mutex
, *pVec
, m_columnNames
.getLength() );
83 SequenceResultSet::~SequenceResultSet()
88 void SequenceResultSet::close( )
89 throw (::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
)
94 Reference
< XResultSetMetaData
> SAL_CALL
SequenceResultSet::getMetaData( )
95 throw (::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
)
100 throw ::com::sun::star::sdbc::SQLException(
101 "pq_sequenceresultset: no meta supported ", *this,
102 // I did not find "IM001" in a specific standard,
103 // but it seems to be used by other systems (such as ODBC)
104 // and some parts of LibreOffice special-case it.
105 OUString( "IM001" ), 1, Any() );
111 sal_Int32 SAL_CALL
SequenceResultSet::findColumn(
112 const OUString
& columnName
)
113 throw (::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
, std::exception
)
115 // no need to guard, as all members are readonly !
116 for( int i
= 0 ;i
< m_fieldCount
; i
++ )
118 if( columnName
== m_columnNames
[i
] )
123 ::dbtools::throwInvalidColumnException( columnName
, *this );
125 return 0; // Never reached
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */