Update ooo320-m1
[ooovba.git] / connectivity / source / drivers / postgresql / pq_resultsetmetadata.hxx
blob56d787c3b44e9102d841390b34ca5f78d6d87785
1 /*************************************************************************
3 * $RCSfile: pq_resultsetmetadata.hxx,v $
5 * $Revision: 1.1.2.3 $
7 * last change: $Author: jbu $ $Date: 2006/05/01 19:19:07 $
9 * The Contents of this file are made available subject to the terms of
10 * either of the following licenses
12 * - GNU Lesser General Public License Version 2.1
13 * - Sun Industry Standards Source License Version 1.1
15 * Sun Microsystems Inc., October, 2000
17 * GNU Lesser General Public License Version 2.1
18 * =============================================
19 * Copyright 2000 by Sun Microsystems, Inc.
20 * 901 San Antonio Road, Palo Alto, CA 94303, USA
22 * This library is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU Lesser General Public
24 * License version 2.1, as published by the Free Software Foundation.
26 * This library is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 * Lesser General Public License for more details.
31 * You should have received a copy of the GNU Lesser General Public
32 * License along with this library; if not, write to the Free Software
33 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
34 * MA 02111-1307 USA
37 * Sun Industry Standards Source License Version 1.1
38 * =================================================
39 * The contents of this file are subject to the Sun Industry Standards
40 * Source License Version 1.1 (the "License"); You may not use this file
41 * except in compliance with the License. You may obtain a copy of the
42 * License at http://www.openoffice.org/license.html.
44 * Software provided under this License is provided on an "AS IS" basis,
45 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
46 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
47 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
48 * See the License for the specific provisions governing your rights and
49 * obligations concerning the Software.
51 * The Initial Developer of the Original Code is: Joerg Budischewski
53 * Copyright: 2000 by Sun Microsystems, Inc.
55 * All Rights Reserved.
57 * Contributor(s): Joerg Budischewski
60 ************************************************************************/
61 #ifndef _PQ_RESULTSETMETADATA_HXX_
62 #define _PQ_RESULTSETMETADATA_HXX_
63 #include <vector>
65 #include "pq_connection.hxx"
67 #include <com/sun/star/sdbc/XResultSetMetaData.hpp>
68 #include <com/sun/star/beans/XPropertySet.hpp>
70 #include <cppuhelper/implbase1.hxx>
72 namespace pq_sdbc_driver
75 struct ColDesc
77 rtl::OUString name;
78 sal_Int32 precision;
79 sal_Int32 scale;
80 sal_Int32 displaySize;
81 Oid typeOid;
82 rtl::OUString typeName;
83 sal_Int32 type;
86 class ResultSet;
88 typedef std::vector< ColDesc, Allocator< ColDesc > > ColDescVector;
91 class ResultSetMetaData :
92 public ::cppu::WeakImplHelper1 < com::sun::star::sdbc::XResultSetMetaData >
94 ::rtl::Reference< RefCountedMutex > m_refMutex;
95 ConnectionSettings **m_ppSettings;
96 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > m_origin;
97 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_table;
98 ::rtl::OUString m_tableName;
99 ::rtl::OUString m_schemaName;
100 ColDescVector m_colDesc;
101 ResultSet *m_pResultSet;
103 bool m_checkedForTable;
104 bool m_checkedForTypes;
106 sal_Int32 m_colCount;
108 void checkClosed()
109 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
110 void checkColumnIndex( sal_Int32 columnIndex )
111 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
112 void checkTable();
113 void checkForTypes();
114 com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > getColumnByIndex( int index );
116 sal_Int32 getIntColumnProperty( const rtl::OUString & name, int index, int def );
117 sal_Bool getBoolColumnProperty( const rtl::OUString & name, int index, sal_Bool def );
119 public:
120 ResultSetMetaData(
121 const ::rtl::Reference< RefCountedMutex > & reMutex,
122 const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XResultSet > & origin,
123 ResultSet *pResultSet,
124 ConnectionSettings **pSettings,
125 PGresult *pResult,
126 const rtl::OUString &schemaName,
127 const rtl::OUString &tableName );
129 public:
130 // Methods
131 virtual sal_Int32 SAL_CALL getColumnCount( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
132 virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
133 virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
134 virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
135 virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
136 virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
137 virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
138 virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
139 virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
140 virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
141 virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
142 virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
143 virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
144 virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
145 virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
146 virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
147 virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
148 virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
149 virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
150 virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
151 virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
156 #endif