Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #ifndef _CONNECTIVITY_ODBC_ORESULTSETMETADATA_HXX_
21 : : #define _CONNECTIVITY_ODBC_ORESULTSETMETADATA_HXX_
22 : :
23 : : #include <com/sun/star/sdbc/XResultSetMetaData.hpp>
24 : : #include <cppuhelper/implbase1.hxx>
25 : : #include "odbc/OFunctions.hxx"
26 : : #include "odbc/odbcbasedllapi.hxx"
27 : : #ifndef _VECTOR_
28 : : #include <vector>
29 : : #endif
30 : : #include "odbc/OConnection.hxx"
31 : :
32 : : namespace connectivity
33 : : {
34 : : namespace odbc
35 : : {
36 : : //**************************************************************
37 : : //************ Class: ResultSetMetaData
38 : : //**************************************************************
39 : : typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> OResultSetMetaData_BASE;
40 : :
41 : : class OOO_DLLPUBLIC_ODBCBASE OResultSetMetaData :
42 : : public OResultSetMetaData_BASE
43 : : {
44 : : protected:
45 : : ::std::vector<sal_Int32> m_vMapping; // when not every column is needed
46 : : ::std::map<sal_Int32,sal_Int32> m_aColumnTypes;
47 : :
48 : : SQLHANDLE m_aStatementHandle;
49 : : OConnection* m_pConnection;
50 : : sal_Int32 m_nColCount;
51 : : sal_Bool m_bUseODBC2Types;
52 : :
53 : : ::rtl::OUString getCharColAttrib(sal_Int32 column,sal_Int32 ident) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
54 : : sal_Int32 getNumColAttrib(sal_Int32 column,sal_Int32 ident) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
55 : : public:
56 : : // A ctor that is needed for returning the object
57 : 0 : OResultSetMetaData(OConnection* _pConnection, SQLHANDLE _pStmt )
58 : : :m_aStatementHandle( _pStmt )
59 : : ,m_pConnection(_pConnection)
60 : : ,m_nColCount(-1)
61 : 0 : ,m_bUseODBC2Types(sal_False)
62 : 0 : {}
63 : 0 : OResultSetMetaData(OConnection* _pConnection, SQLHANDLE _pStmt ,const ::std::vector<sal_Int32> & _vMapping)
64 : : :m_vMapping(_vMapping)
65 : : ,m_aStatementHandle( _pStmt )
66 : : ,m_pConnection(_pConnection)
67 : 0 : ,m_nColCount(_vMapping.size()-1)
68 : 0 : ,m_bUseODBC2Types(sal_False)
69 : 0 : {}
70 : : virtual ~OResultSetMetaData();
71 : :
72 : :
73 : : static SQLLEN getNumColAttrib(OConnection* _pConnection
74 : : ,SQLHANDLE _aStatementHandle
75 : : ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface
76 : : ,sal_Int32 _column
77 : : ,sal_Int32 ident) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
78 : :
79 : : static SQLSMALLINT getColumnODBCType(OConnection* _pConnection
80 : : ,SQLHANDLE _aStatementHandle
81 : : ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface
82 : : ,sal_Int32 column)
83 : : throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
84 : :
85 : 0 : inline oslGenericFunction getOdbcFunction(sal_Int32 _nIndex) const
86 : : {
87 : 0 : return m_pConnection->getOdbcFunction(_nIndex);
88 : : }
89 : : // Avoid ambigous cast error from the compiler.
90 : : inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw()
91 : : { return this; }
92 : :
93 : : virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
94 : : virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
95 : : virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
96 : : virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
97 : : virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
98 : : virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
99 : : virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
100 : : virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
101 : : virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
102 : : virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
103 : : virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
104 : : virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
105 : : virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
106 : : virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
107 : : virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
108 : : virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
109 : : virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
110 : : virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
111 : : virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
112 : : virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
113 : : virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
114 : : };
115 : : }
116 : : }
117 : : #endif // _CONNECTIVITY_ODBC_ORESULTSETMETADATA_HXX_
118 : :
119 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|