LibreOffice Module connectivity (master) 1
pq_sequenceresultsetmetadata.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*************************************************************************
3 *
4 * Effective License of whole file:
5 *
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.
9 *
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.
14 *
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
19 *
20 * Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
21 *
22 * The Contents of this file are made available subject to the terms of
23 * the GNU Lesser General Public License Version 2.1
24 *
25 * Copyright: 200? by Sun Microsystems, Inc.
26 *
27 * Contributor(s): Joerg Budischewski
28 *
29 * All parts contributed on or after August 2011:
30 *
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/.
34 *
35 ************************************************************************/
36
38
39#include <com/sun/star/sdbc/SQLException.hpp>
40
41using com::sun::star::uno::Any;
42
43using com::sun::star::sdbc::SQLException;
44
45namespace pq_sdbc_driver
46{
47
49 ColumnMetaDataVector&& metaDataVector,
50 int colCount ) :
51 m_columnData( std::move(metaDataVector) ),
52 m_colCount( colCount )
53{
54}
55
56
57// Methods
59{
60 return m_colCount;
61}
62
64{
65 checkColumnIndex( column );
66 return m_columnData[column-1].isAutoIncrement;
67}
68
70{
71
72 return true; // ??? hmm, numeric types or
73}
74
76{
77 return true; // mmm, what types are not searchable ?
78}
79
81{
82 checkColumnIndex( column );
83 return m_columnData[column-1].isCurrency;
84}
85
86sal_Int32 SequenceResultSetMetaData::isNullable( sal_Int32 column )
87{
88 checkColumnIndex( column );
89 return m_columnData[column-1].isNullable ? 1 : 0;
90}
91
93{
94 return true;
95}
96
97sal_Int32 SequenceResultSetMetaData::getColumnDisplaySize( sal_Int32 /* column */ )
98{
99 return 50;
100}
101
103{
104 checkColumnIndex( column );
105 return m_columnData[column-1].columnName;
106}
107
109{
110 checkColumnIndex( column );
111 return m_columnData[column-1].columnName;
112}
113
115{
116 checkColumnIndex( column );
117 return m_columnData[column-1].schemaTableName;
118}
119
120
121sal_Int32 SequenceResultSetMetaData::getPrecision( sal_Int32 column )
122{
123 checkColumnIndex( column );
124 return m_columnData[column-1].precision;
125}
126
127sal_Int32 SequenceResultSetMetaData::getScale( sal_Int32 column )
128{
129 checkColumnIndex( column );
130 return m_columnData[column-1].scale;
131}
132
133OUString SequenceResultSetMetaData::getTableName( sal_Int32 column )
134{
135 checkColumnIndex( column );
136 return m_columnData[column-1].tableName;
137}
138
139OUString SequenceResultSetMetaData::getCatalogName( sal_Int32 /* column */ )
140{
141 // can do this through XConnection.getCatalog() !
142 return OUString();
143}
144sal_Int32 SequenceResultSetMetaData::getColumnType( sal_Int32 column )
145{
146 checkColumnIndex( column );
147 return m_columnData[column-1].type;
148}
149
151{
152 checkColumnIndex( column );
153 return m_columnData[column-1].typeName;
154}
155
156
158{
159 return false;
160}
161
163{
164 return ! isReadOnly( column ); // what's the sense if this method ?
165}
166
168{
169 return isWritable(column); // uhh, now it becomes really esoteric...
170}
171OUString SequenceResultSetMetaData::getColumnServiceName( sal_Int32 /* column */ )
172{
173 return OUString();
174}
175
177{
178 if( columnIndex < 1 || columnIndex > m_colCount )
179 {
180 throw SQLException(
181 "pq_sequenceresultsetmetadata: index out of range (expected 1 to "
182 + OUString::number( m_colCount )
183 + ", got " + OUString::number( columnIndex ),
184 *this, OUString(), 1, Any() );
185 }
186}
187
188
189}
190
191/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString SAL_CALL getColumnTypeName(sal_Int32 column) override
virtual sal_Bool SAL_CALL isWritable(sal_Int32 column) override
virtual sal_Int32 SAL_CALL isNullable(sal_Int32 column) override
virtual OUString SAL_CALL getColumnServiceName(sal_Int32 column) override
virtual OUString SAL_CALL getColumnLabel(sal_Int32 column) override
virtual sal_Int32 SAL_CALL getColumnCount() override
virtual sal_Int32 SAL_CALL getScale(sal_Int32 column) override
virtual sal_Int32 SAL_CALL getPrecision(sal_Int32 column) override
virtual sal_Bool SAL_CALL isSigned(sal_Int32 column) override
virtual OUString SAL_CALL getCatalogName(sal_Int32 column) override
virtual sal_Bool SAL_CALL isDefinitelyWritable(sal_Int32 column) override
virtual OUString SAL_CALL getTableName(sal_Int32 column) override
virtual sal_Int32 SAL_CALL getColumnDisplaySize(sal_Int32 column) override
virtual sal_Bool SAL_CALL isCurrency(sal_Int32 column) override
virtual OUString SAL_CALL getColumnName(sal_Int32 column) override
virtual sal_Bool SAL_CALL isCaseSensitive(sal_Int32 column) override
virtual sal_Bool SAL_CALL isAutoIncrement(sal_Int32 column) override
virtual OUString SAL_CALL getSchemaName(sal_Int32 column) override
virtual sal_Int32 SAL_CALL getColumnType(sal_Int32 column) override
virtual sal_Bool SAL_CALL isReadOnly(sal_Int32 column) override
SequenceResultSetMetaData(ColumnMetaDataVector &&vec, int colCount)
virtual sal_Bool SAL_CALL isSearchable(sal_Int32 column) override
std::vector< ColumnMetaData > ColumnMetaDataVector
Definition: pq_statics.hxx:88
unsigned char sal_Bool