1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _CONNECTIVITY_DATABASEMETADATARESULTSETMETADATA_HXX_
25 #define _CONNECTIVITY_DATABASEMETADATARESULTSETMETADATA_HXX_
26 
27 #include <com/sun/star/sdbc/XResultSetMetaData.hpp>
28 #include <cppuhelper/implbase1.hxx>
29 #ifndef _VECTOR_
30 #include <vector>
31 #endif
32 #include "FDatabaseMetaDataResultSet.hxx"
33 #include "OColumn.hxx"
34 #include "connectivity/StdTypeDefs.hxx"
35 #include "connectivity/dbtoolsdllapi.hxx"
36 
37 namespace connectivity
38 {
39 	//**************************************************************
40 	//************ Class: ODatabaseMetaDataResultSetMetaData
41 	//**************************************************************
42     typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData>   ODatabaseMetaResultSetMetaData_BASE;
43 
44 	class OOO_DLLPUBLIC_DBTOOLS ODatabaseMetaDataResultSetMetaData :	public 	ODatabaseMetaResultSetMetaData_BASE
45 	{
46 		TIntVector									m_vMapping; // when not every column is needed
47 		::std::map<sal_Int32,connectivity::OColumn>	m_mColumns;
48 		::std::map<sal_Int32,connectivity::OColumn>::const_iterator m_mColumnsIter;
49 
50 		sal_Int32									m_nColCount;
51 	protected:
52 		virtual ~ODatabaseMetaDataResultSetMetaData();
53 	public:
54 		// ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
ODatabaseMetaDataResultSetMetaData()55 		ODatabaseMetaDataResultSetMetaData( )
56 				:	m_nColCount(0)
57 		{
58 		}
59 		/// Avoid ambigous cast error from the compiler.
operator ::com::sun::star::uno::Reference<::com::sun::star::sdbc::XResultSetMetaData>()60         inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw()
61 		{ return this; }
62 
63         virtual sal_Int32 SAL_CALL getColumnCount(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
64         virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
65         virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
66         virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
67         virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
68         virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
69         virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
70         virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
71         virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
72         virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
73         virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
74         virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
75 		virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
76         virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
77         virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
78         virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
79         virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
80         virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
81         virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
82         virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
83         virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
84 
85 		// methods to set the right column mapping
86 		void setColumnPrivilegesMap();
87 		void setColumnMap();
88 		void setColumnsMap();
89 		void setTableNameMap();
90 		void setTablesMap();
91 		void setProcedureColumnsMap();
92 		void setPrimaryKeysMap();
93 		void setIndexInfoMap();
94 		void setTablePrivilegesMap();
95 		void setCrossReferenceMap();
96 		void setTypeInfoMap();
97 		void setProcedureNameMap();
98 		void setProceduresMap();
99 		void setTableTypes();
setBestRowIdentifierMap()100 		void setBestRowIdentifierMap() { setVersionColumnsMap();}
101 		void setVersionColumnsMap();
setExportedKeysMap()102 		void setExportedKeysMap() { setCrossReferenceMap(); }
setImportedKeysMap()103 		void setImportedKeysMap() { setCrossReferenceMap(); }
104 		void setCatalogsMap();
105 		void setSchemasMap();
106 	};
107 }
108 #endif // _CONNECTIVITY_FILE_ADATABASEMETARESULTSETMETADATA_HXX_
109 
110 
111