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 #include <com/sun/star/sdbc/SQLException.hpp>
45 using com::sun::star::sdbc::XResultSetMetaData
;
47 using com::sun::star::uno::Reference
;
48 using com::sun::star::uno::Any
;
50 namespace pq_sdbc_driver
53 void SequenceResultSet::checkClosed()
59 Any
SequenceResultSet::getValue( sal_Int32 columnIndex
)
61 m_wasNull
= ! m_data
[m_row
][columnIndex
-1 ].hasValue();
62 return m_data
[m_row
][columnIndex
-1 ];
65 SequenceResultSet::SequenceResultSet(
66 const ::rtl::Reference
< comphelper::RefCountedMutex
> & mutex
,
67 const css::uno::Reference
< css::uno::XInterface
> &owner
,
68 const std::vector
< OUString
> &colNames
,
69 const std::vector
< std::vector
< Any
> > &data
,
70 const Reference
< css::script::XTypeConverter
> & tc
,
71 const ColumnMetaDataVector
*pVec
) :
72 BaseResultSet( mutex
, owner
, data
.size(), colNames
.size(), tc
),
74 m_columnNames( colNames
)
78 m_meta
= new SequenceResultSetMetaData( *pVec
, m_columnNames
.size() );
82 SequenceResultSet::~SequenceResultSet()
87 void SequenceResultSet::close( )
92 Reference
< XResultSetMetaData
> SAL_CALL
SequenceResultSet::getMetaData( )
97 throw css::sdbc::SQLException(
98 "pq_sequenceresultset: no meta supported ", *this,
99 // I did not find "IM001" in a specific standard,
100 // but it seems to be used by other systems (such as ODBC)
101 // and some parts of LibreOffice special-case it.
108 sal_Int32 SAL_CALL
SequenceResultSet::findColumn(
109 const OUString
& columnName
)
111 // no need to guard, as all members are readonly !
112 for( int i
= 0 ;i
< m_fieldCount
; i
++ )
114 if( columnName
== m_columnNames
[i
] )
119 ::dbtools::throwInvalidColumnException( columnName
, *this );
121 return 0; // Never reached
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */