LibreOffice Module connectivity (master) 1
pq_resultsetmetadata.hxx
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: 2000 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
37#pragma once
38#include <vector>
39
40#include "pq_connection.hxx"
41
42#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
43#include <com/sun/star/beans/XPropertySet.hpp>
44
46
47namespace pq_sdbc_driver
48{
49
50struct ColDesc
51{
52 OUString name;
53 sal_Int32 precision;
54 sal_Int32 scale;
55 sal_Int32 displaySize;
57 OUString typeName;
58 sal_Int32 type;
59};
60
61class ResultSet;
62
64 public ::cppu::WeakImplHelper< css::sdbc::XResultSetMetaData >
65{
68 css::uno::Reference< css::sdbc::XResultSet > m_origin;
69 css::uno::Reference< css::beans::XPropertySet > m_table;
70 OUString m_tableName;
71 OUString m_schemaName;
72 std::vector< ColDesc > m_colDesc;
74
77
78 sal_Int32 m_colCount;
79
82 void checkColumnIndex( sal_Int32 columnIndex );
83 void checkTable();
84 void checkForTypes();
85 css::uno::Reference< css::beans::XPropertySet > getColumnByIndex( int index );
86
87 sal_Int32 getIntColumnProperty( const OUString & name, int index, int def );
88 bool getBoolColumnProperty( const OUString & name, int index, bool def );
89
90public:
93 css::uno::Reference< css::sdbc::XResultSet > origin,
94 ResultSet *pResultSet,
95 ConnectionSettings **pSettings,
96 PGresult const *pResult,
97 OUString schemaName,
98 OUString tableName );
99
100public:
101 // Methods
102 virtual sal_Int32 SAL_CALL getColumnCount( ) override;
103 virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) override;
104 virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) override;
105 virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) override;
106 virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) override;
107 virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) override;
108 virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) override;
109 virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) override;
110 virtual OUString SAL_CALL getColumnLabel( sal_Int32 column ) override;
111 virtual OUString SAL_CALL getColumnName( sal_Int32 column ) override;
112 virtual OUString SAL_CALL getSchemaName( sal_Int32 column ) override;
113 virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) override;
114 virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) override;
115 virtual OUString SAL_CALL getTableName( sal_Int32 column ) override;
116 virtual OUString SAL_CALL getCatalogName( sal_Int32 column ) override;
117 virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) override;
118 virtual OUString SAL_CALL getColumnTypeName( sal_Int32 column ) override;
119 virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) override;
120 virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) override;
121 virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) override;
122 virtual OUString SAL_CALL getColumnServiceName( sal_Int32 column ) override;
123};
124
125}
126
127/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::beans::XPropertySet > getColumnByIndex(int index)
virtual sal_Bool SAL_CALL isDefinitelyWritable(sal_Int32 column) override
virtual sal_Bool SAL_CALL isSearchable(sal_Int32 column) override
virtual sal_Bool SAL_CALL isAutoIncrement(sal_Int32 column) override
ResultSetMetaData(::rtl::Reference< comphelper::RefCountedMutex > reMutex, css::uno::Reference< css::sdbc::XResultSet > origin, ResultSet *pResultSet, ConnectionSettings **pSettings, PGresult const *pResult, OUString schemaName, OUString tableName)
css::uno::Reference< css::beans::XPropertySet > m_table
virtual OUString SAL_CALL getColumnTypeName(sal_Int32 column) override
virtual sal_Bool SAL_CALL isSigned(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_Int32 SAL_CALL getColumnCount() override
css::uno::Reference< css::sdbc::XResultSet > m_origin
virtual OUString SAL_CALL getCatalogName(sal_Int32 column) override
virtual sal_Bool SAL_CALL isWritable(sal_Int32 column) override
virtual sal_Bool SAL_CALL isCaseSensitive(sal_Int32 column) override
sal_Int32 getIntColumnProperty(const OUString &name, int index, int def)
::rtl::Reference< comphelper::RefCountedMutex > m_xMutex
virtual sal_Int32 SAL_CALL getColumnDisplaySize(sal_Int32 column) override
virtual sal_Bool SAL_CALL isCurrency(sal_Int32 column) override
bool getBoolColumnProperty(const OUString &name, int index, bool def)
virtual sal_Bool SAL_CALL isReadOnly(sal_Int32 column) override
virtual sal_Int32 SAL_CALL isNullable(sal_Int32 column) override
virtual OUString SAL_CALL getTableName(sal_Int32 column) override
virtual sal_Int32 SAL_CALL getScale(sal_Int32 column) override
void checkColumnIndex(sal_Int32 columnIndex)
virtual sal_Int32 SAL_CALL getPrecision(sal_Int32 column) override
virtual OUString SAL_CALL getColumnServiceName(sal_Int32 column) override
virtual OUString SAL_CALL getColumnName(sal_Int32 column) override
virtual OUString SAL_CALL getColumnLabel(sal_Int32 column) override
OUString name
Definition: pq_statics.cxx:74
const char * tableName
Definition: pq_statics.cxx:57
unsigned char sal_Bool