tdf#150789 - FILEOPEN PPTX: fix text in SmartArt vertically off
[LibreOffice.git] / connectivity / source / drivers / postgresql / pq_sequenceresultset.cxx
blob84db1fa63389c561059ac63f22f2d32f96372a8e
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,
18 * MA 02111-1307 USA
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()
55 // we never close :o)
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 std::vector< OUString >&& colNames,
69 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 ),
73 m_data(std::move(data) ),
74 m_columnNames( std::move(colNames) )
76 if( pVec )
78 m_meta = new SequenceResultSetMetaData( std::vector(*pVec), m_columnNames.size() );
82 SequenceResultSet::~SequenceResultSet()
87 void SequenceResultSet::close( )
89 // a noop
92 Reference< XResultSetMetaData > SAL_CALL SequenceResultSet::getMetaData( )
94 if( ! m_meta.is() )
96 // Oh no, not again
97 throw css::sdbc::SQLException(
98 u"pq_sequenceresultset: no meta supported "_ustr, *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.
102 u"IM001"_ustr, 1, Any() );
104 return m_meta;
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] )
116 return i+1;
119 ::dbtools::throwInvalidColumnException( columnName, *this );
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */