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>
40 #include <rtl/ustrbuf.hxx>
42 using com::sun::star::uno::Any
;
44 using com::sun::star::sdbc::SQLException
;
46 namespace pq_sdbc_driver
49 SequenceResultSetMetaData::SequenceResultSetMetaData(
50 const ColumnMetaDataVector
&metaDataVector
,
52 m_columnData( metaDataVector
),
53 m_colCount( colCount
)
59 sal_Int32
SequenceResultSetMetaData::getColumnCount( )
64 sal_Bool
SequenceResultSetMetaData::isAutoIncrement( sal_Int32 column
)
66 checkColumnIndex( column
);
67 return m_columnData
[column
-1].isAutoIncrement
;
70 sal_Bool
SequenceResultSetMetaData::isCaseSensitive( sal_Int32
/* column */ )
73 return true; // ??? hmm, numeric types or
76 sal_Bool
SequenceResultSetMetaData::isSearchable( sal_Int32
/* column */ )
78 return true; // mmm, what types are not searchable ?
81 sal_Bool
SequenceResultSetMetaData::isCurrency( sal_Int32 column
)
83 checkColumnIndex( column
);
84 return m_columnData
[column
-1].isCurrency
;
87 sal_Int32
SequenceResultSetMetaData::isNullable( sal_Int32 column
)
89 checkColumnIndex( column
);
90 return m_columnData
[column
-1].isNullable
? 1 : 0;
93 sal_Bool
SequenceResultSetMetaData::isSigned( sal_Int32
/* column */ )
98 sal_Int32
SequenceResultSetMetaData::getColumnDisplaySize( sal_Int32
/* column */ )
103 OUString
SequenceResultSetMetaData::getColumnLabel( sal_Int32 column
)
105 checkColumnIndex( column
);
106 return m_columnData
[column
-1].columnName
;
109 OUString
SequenceResultSetMetaData::getColumnName( sal_Int32 column
)
111 checkColumnIndex( column
);
112 return m_columnData
[column
-1].columnName
;
115 OUString
SequenceResultSetMetaData::getSchemaName( sal_Int32 column
)
117 checkColumnIndex( column
);
118 return m_columnData
[column
-1].schemaTableName
;
122 sal_Int32
SequenceResultSetMetaData::getPrecision( sal_Int32 column
)
124 checkColumnIndex( column
);
125 return m_columnData
[column
-1].precision
;
128 sal_Int32
SequenceResultSetMetaData::getScale( sal_Int32 column
)
130 checkColumnIndex( column
);
131 return m_columnData
[column
-1].scale
;
134 OUString
SequenceResultSetMetaData::getTableName( sal_Int32 column
)
136 checkColumnIndex( column
);
137 return m_columnData
[column
-1].tableName
;
140 OUString
SequenceResultSetMetaData::getCatalogName( sal_Int32
/* column */ )
142 // can do this through XConnection.getCatalog() !
145 sal_Int32
SequenceResultSetMetaData::getColumnType( sal_Int32 column
)
147 checkColumnIndex( column
);
148 return m_columnData
[column
-1].type
;
151 OUString
SequenceResultSetMetaData::getColumnTypeName( sal_Int32 column
)
153 checkColumnIndex( column
);
154 return m_columnData
[column
-1].typeName
;
158 sal_Bool
SequenceResultSetMetaData::isReadOnly( sal_Int32
/* column */ )
163 sal_Bool
SequenceResultSetMetaData::isWritable( sal_Int32 column
)
165 return ! isReadOnly( column
); // what's the sense if this method ?
168 sal_Bool
SequenceResultSetMetaData::isDefinitelyWritable( sal_Int32 column
)
170 return isWritable(column
); // uhh, now it becomes really esoteric ....
172 OUString
SequenceResultSetMetaData::getColumnServiceName( sal_Int32
/* column */ )
177 void SequenceResultSetMetaData::checkColumnIndex(sal_Int32 columnIndex
)
179 if( columnIndex
< 1 || columnIndex
> m_colCount
)
182 "pq_sequenceresultsetmetadata: index out of range (expected 1 to "
183 + OUString::number( m_colCount
)
184 + ", got " + OUString::number( columnIndex
),
185 *this, OUString(), 1, Any() );
192 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */