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: 200? 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 ************************************************************************/
37 #include "pq_sequenceresultsetmetadata.hxx"
39 #include <com/sun/star/sdbc/SQLException.hpp>
41 using com::sun::star::uno::Any
;
43 using com::sun::star::sdbc::SQLException
;
45 namespace pq_sdbc_driver
48 SequenceResultSetMetaData::SequenceResultSetMetaData(
49 ColumnMetaDataVector
&& metaDataVector
,
51 m_columnData( std::move(metaDataVector
) ),
52 m_colCount( colCount
)
58 sal_Int32
SequenceResultSetMetaData::getColumnCount( )
63 sal_Bool
SequenceResultSetMetaData::isAutoIncrement( sal_Int32 column
)
65 checkColumnIndex( column
);
66 return m_columnData
[column
-1].isAutoIncrement
;
69 sal_Bool
SequenceResultSetMetaData::isCaseSensitive( sal_Int32
/* column */ )
72 return true; // ??? hmm, numeric types or
75 sal_Bool
SequenceResultSetMetaData::isSearchable( sal_Int32
/* column */ )
77 return true; // mmm, what types are not searchable ?
80 sal_Bool
SequenceResultSetMetaData::isCurrency( sal_Int32 column
)
82 checkColumnIndex( column
);
83 return m_columnData
[column
-1].isCurrency
;
86 sal_Int32
SequenceResultSetMetaData::isNullable( sal_Int32 column
)
88 checkColumnIndex( column
);
89 return m_columnData
[column
-1].isNullable
? 1 : 0;
92 sal_Bool
SequenceResultSetMetaData::isSigned( sal_Int32
/* column */ )
97 sal_Int32
SequenceResultSetMetaData::getColumnDisplaySize( sal_Int32
/* column */ )
102 OUString
SequenceResultSetMetaData::getColumnLabel( sal_Int32 column
)
104 checkColumnIndex( column
);
105 return m_columnData
[column
-1].columnName
;
108 OUString
SequenceResultSetMetaData::getColumnName( sal_Int32 column
)
110 checkColumnIndex( column
);
111 return m_columnData
[column
-1].columnName
;
114 OUString
SequenceResultSetMetaData::getSchemaName( sal_Int32 column
)
116 checkColumnIndex( column
);
117 return m_columnData
[column
-1].schemaTableName
;
121 sal_Int32
SequenceResultSetMetaData::getPrecision( sal_Int32 column
)
123 checkColumnIndex( column
);
124 return m_columnData
[column
-1].precision
;
127 sal_Int32
SequenceResultSetMetaData::getScale( sal_Int32 column
)
129 checkColumnIndex( column
);
130 return m_columnData
[column
-1].scale
;
133 OUString
SequenceResultSetMetaData::getTableName( sal_Int32 column
)
135 checkColumnIndex( column
);
136 return m_columnData
[column
-1].tableName
;
139 OUString
SequenceResultSetMetaData::getCatalogName( sal_Int32
/* column */ )
141 // can do this through XConnection.getCatalog() !
144 sal_Int32
SequenceResultSetMetaData::getColumnType( sal_Int32 column
)
146 checkColumnIndex( column
);
147 return m_columnData
[column
-1].type
;
150 OUString
SequenceResultSetMetaData::getColumnTypeName( sal_Int32 column
)
152 checkColumnIndex( column
);
153 return m_columnData
[column
-1].typeName
;
157 sal_Bool
SequenceResultSetMetaData::isReadOnly( sal_Int32
/* column */ )
162 sal_Bool
SequenceResultSetMetaData::isWritable( sal_Int32 column
)
164 return ! isReadOnly( column
); // what's the sense if this method ?
167 sal_Bool
SequenceResultSetMetaData::isDefinitelyWritable( sal_Int32 column
)
169 return isWritable(column
); // uhh, now it becomes really esoteric...
171 OUString
SequenceResultSetMetaData::getColumnServiceName( sal_Int32
/* column */ )
176 void SequenceResultSetMetaData::checkColumnIndex(sal_Int32 columnIndex
)
178 if( columnIndex
< 1 || columnIndex
> m_colCount
)
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() );
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */