1 /*************************************************************************
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * Copyright 2008 by Sun Microsystems, Inc.
5 *
6 * OpenOffice.org - a multi-platform office productivity suite
7 *
8 * $RCSfile: mysqlc_resultsetmetadata.hxx,v $
9 *
10 * $Revision: 1.1.2.4 $
11 *
12 * This file is part of OpenOffice.org.
13 *
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
17 *
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
23 *
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org.  If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
28 ************************************************************************/
29 
30 #ifndef CONNECTIVITY_SRESULSETMETADATA_HXX
31 #define CONNECTIVITY_SRESULSETMETADATA_HXX
32 
33 #include "mysqlc_connection.hxx"
34 
35 #include <com/sun/star/sdbc/XResultSetMetaData.hpp>
36 
37 #include <cppuhelper/implbase1.hxx>
38 #include <preextstl.h>
39 #include <cppconn/resultset_metadata.h>
40 #include <postextstl.h>
41 
42 namespace connectivity
43 {
44 	namespace mysqlc
45 	{
46 		using ::com::sun::star::sdbc::SQLException;
47 		using ::com::sun::star::uno::RuntimeException;
48 		using ::rtl::OUString;
49 		//**************************************************************
50 		//************ Class: ResultSetMetaData
51 		//**************************************************************
52 		typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> OResultSetMetaData_BASE;
53 
54 		class OResultSetMetaData : public OResultSetMetaData_BASE
55 		{
56 			sql::ResultSetMetaData * meta;
57             rtl_TextEncoding        m_encoding;
58 		protected:
59 			virtual ~OResultSetMetaData();
60 		public:
61 			OResultSetMetaData( sql::ResultSetMetaData * _meta, rtl_TextEncoding _encoding )
62                 :meta(_meta)
63                 ,m_encoding( _encoding )
64             {
65             }
66 
67             inline ::rtl::OUString convert( const ::ext_std::string& _string ) const
68             {
69                 return ::rtl::OUString( _string.c_str(), _string.size(), m_encoding );
70             }
71 
72 			/// Avoid ambigous cast error from the compiler.
73 			inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw()
74 			{ return this; }
75 
76 			sal_Int32 SAL_CALL getColumnCount()						throw(SQLException, RuntimeException);
77 
78 			sal_Bool SAL_CALL isAutoIncrement(sal_Int32 column)		throw(SQLException, RuntimeException);
79 
80 			sal_Bool SAL_CALL isCaseSensitive(sal_Int32 column)		throw(SQLException, RuntimeException);
81 
82 			sal_Bool SAL_CALL isSearchable(sal_Int32 column)		throw(SQLException, RuntimeException);
83 
84 			sal_Bool SAL_CALL isCurrency(sal_Int32 column)			throw(SQLException, RuntimeException);
85 
86 			sal_Int32 SAL_CALL isNullable(sal_Int32 column)			throw(SQLException, RuntimeException);
87 
88 			sal_Bool SAL_CALL isSigned(sal_Int32 column)			throw(SQLException, RuntimeException);
89 
90 			sal_Int32 SAL_CALL getColumnDisplaySize(sal_Int32 column)throw(SQLException, RuntimeException);
91 
92 			OUString SAL_CALL getColumnLabel(sal_Int32 column)		throw(SQLException, RuntimeException);
93 
94 			OUString SAL_CALL getColumnName(sal_Int32 column)		throw(SQLException, RuntimeException);
95 
96 			OUString SAL_CALL getSchemaName(sal_Int32 column)		throw(SQLException, RuntimeException);
97 
98 			sal_Int32 SAL_CALL getPrecision(sal_Int32 column)		throw(SQLException, RuntimeException);
99 
100 			sal_Int32 SAL_CALL getScale(sal_Int32 column)			throw(SQLException, RuntimeException);
101 
102 			OUString SAL_CALL getTableName(sal_Int32 column)		throw(SQLException, RuntimeException);
103 
104 			OUString SAL_CALL getCatalogName(sal_Int32 column)		throw(SQLException, RuntimeException);
105 
106 			sal_Int32 SAL_CALL getColumnType(sal_Int32 column)		throw(SQLException, RuntimeException);
107 
108 			OUString SAL_CALL getColumnTypeName(sal_Int32 column) 	throw(SQLException, RuntimeException);
109 
110 			sal_Bool SAL_CALL isReadOnly(sal_Int32 column)			throw(SQLException, RuntimeException);
111 
112 			sal_Bool SAL_CALL isWritable(sal_Int32 column)			throw(SQLException, RuntimeException);
113 
114 			sal_Bool SAL_CALL isDefinitelyWritable(sal_Int32 column)throw(SQLException, RuntimeException);
115 
116 			OUString SAL_CALL getColumnServiceName(sal_Int32 column)throw(SQLException, RuntimeException);
117 
118 			void checkColumnIndex(sal_Int32 columnIndex)			throw (SQLException, RuntimeException);
119 		};
120 	}
121 }
122 
123 #endif // CONNECTIVITY_SRESULSETMETADATA_HXX
124