1*9b5730f6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9b5730f6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9b5730f6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9b5730f6SAndrew Rist  * distributed with this work for additional information
6*9b5730f6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9b5730f6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9b5730f6SAndrew Rist  * "License"); you may not use this file except in compliance
9*9b5730f6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9b5730f6SAndrew Rist  *
11*9b5730f6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9b5730f6SAndrew Rist  *
13*9b5730f6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9b5730f6SAndrew Rist  * software distributed under the License is distributed on an
15*9b5730f6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9b5730f6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9b5730f6SAndrew Rist  * specific language governing permissions and limitations
18*9b5730f6SAndrew Rist  * under the License.
19*9b5730f6SAndrew Rist  *
20*9b5730f6SAndrew Rist  *************************************************************/
21*9b5730f6SAndrew Rist 
22*9b5730f6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_connectivity.hxx"
26cdf0e10cSrcweir #include "odbc/OResultSetMetaData.hxx"
27cdf0e10cSrcweir #include "odbc/OTools.hxx"
28cdf0e10cSrcweir #include <rtl/logfile.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir using namespace connectivity::odbc;
31cdf0e10cSrcweir using namespace com::sun::star::uno;
32cdf0e10cSrcweir using namespace com::sun::star::lang;
33cdf0e10cSrcweir using namespace com::sun::star::sdbc;
34cdf0e10cSrcweir 
35cdf0e10cSrcweir // -------------------------------------------------------------------------
~OResultSetMetaData()36cdf0e10cSrcweir OResultSetMetaData::~OResultSetMetaData()
37cdf0e10cSrcweir {
38cdf0e10cSrcweir }
39cdf0e10cSrcweir // -------------------------------------------------------------------------
getCharColAttrib(sal_Int32 _column,sal_Int32 ident)40cdf0e10cSrcweir ::rtl::OUString OResultSetMetaData::getCharColAttrib(sal_Int32 _column,sal_Int32 ident) throw(SQLException, RuntimeException)
41cdf0e10cSrcweir {
42cdf0e10cSrcweir 	sal_Int32 column = _column;
43cdf0e10cSrcweir 	if(_column <(sal_Int32) m_vMapping.size()) // use mapping
44cdf0e10cSrcweir 		column = m_vMapping[_column];
45cdf0e10cSrcweir 
46cdf0e10cSrcweir 	SQLSMALLINT BUFFER_LEN = 128;
47cdf0e10cSrcweir 	char *pName = new char[BUFFER_LEN+1];
48cdf0e10cSrcweir 	SQLSMALLINT nRealLen=0;
49cdf0e10cSrcweir 	SQLRETURN nRet = N3SQLColAttribute(m_aStatementHandle,
50cdf0e10cSrcweir 									(SQLUSMALLINT)column,
51cdf0e10cSrcweir 									(SQLUSMALLINT)ident,
52cdf0e10cSrcweir 									(SQLPOINTER)pName,
53cdf0e10cSrcweir 									BUFFER_LEN,
54cdf0e10cSrcweir 									&nRealLen,
55cdf0e10cSrcweir 									NULL
56cdf0e10cSrcweir 									);
57cdf0e10cSrcweir 	::rtl::OUString sValue;
58cdf0e10cSrcweir 	if ( nRet == SQL_SUCCESS )
59cdf0e10cSrcweir 	{
60cdf0e10cSrcweir 		if ( nRealLen < 0 )
61cdf0e10cSrcweir 			nRealLen = BUFFER_LEN;
62cdf0e10cSrcweir 		sValue = ::rtl::OUString(pName,nRealLen,m_pConnection->getTextEncoding());
63cdf0e10cSrcweir 	}
64cdf0e10cSrcweir 	delete [] pName;
65cdf0e10cSrcweir 	OTools::ThrowException(m_pConnection,nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
66cdf0e10cSrcweir 	if(nRealLen > BUFFER_LEN)
67cdf0e10cSrcweir 	{
68cdf0e10cSrcweir 		pName = new char[nRealLen+1];
69cdf0e10cSrcweir 		nRet = N3SQLColAttribute(m_aStatementHandle,
70cdf0e10cSrcweir 									(SQLUSMALLINT)column,
71cdf0e10cSrcweir 									(SQLUSMALLINT)ident,
72cdf0e10cSrcweir 									(SQLPOINTER)pName,
73cdf0e10cSrcweir 									nRealLen,
74cdf0e10cSrcweir 									&nRealLen,
75cdf0e10cSrcweir 									NULL
76cdf0e10cSrcweir 									);
77cdf0e10cSrcweir 		if ( nRet == SQL_SUCCESS && nRealLen > 0)
78cdf0e10cSrcweir 			sValue = ::rtl::OUString(pName,nRealLen,m_pConnection->getTextEncoding());
79cdf0e10cSrcweir 		delete [] pName;
80cdf0e10cSrcweir 		OTools::ThrowException(m_pConnection,nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
81cdf0e10cSrcweir 	}
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 	return  sValue;
84cdf0e10cSrcweir }
85cdf0e10cSrcweir // -------------------------------------------------------------------------
getNumColAttrib(OConnection * _pConnection,SQLHANDLE _aStatementHandle,const::com::sun::star::uno::Reference<::com::sun::star::uno::XInterface> & _xInterface,sal_Int32 _column,sal_Int32 _ident)86cdf0e10cSrcweir SQLLEN OResultSetMetaData::getNumColAttrib(OConnection* _pConnection
87cdf0e10cSrcweir                                               ,SQLHANDLE _aStatementHandle
88cdf0e10cSrcweir                                               ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface
89cdf0e10cSrcweir                                               ,sal_Int32 _column
90cdf0e10cSrcweir                                               ,sal_Int32 _ident) throw(SQLException, RuntimeException)
91cdf0e10cSrcweir {
92cdf0e10cSrcweir 	SQLLEN nValue=0;
93cdf0e10cSrcweir 	OTools::ThrowException(_pConnection,(*(T3SQLColAttribute)_pConnection->getOdbcFunction(ODBC3SQLColAttribute))(_aStatementHandle,
94cdf0e10cSrcweir 										 (SQLUSMALLINT)_column,
95cdf0e10cSrcweir 										 (SQLUSMALLINT)_ident,
96cdf0e10cSrcweir 										 NULL,
97cdf0e10cSrcweir 										 0,
98cdf0e10cSrcweir 										 NULL,
99cdf0e10cSrcweir 										 &nValue),_aStatementHandle,SQL_HANDLE_STMT,_xInterface);
100cdf0e10cSrcweir 	return nValue;
101cdf0e10cSrcweir }
102cdf0e10cSrcweir // -------------------------------------------------------------------------
getNumColAttrib(sal_Int32 _column,sal_Int32 ident)103cdf0e10cSrcweir sal_Int32 OResultSetMetaData::getNumColAttrib(sal_Int32 _column,sal_Int32 ident) throw(SQLException, RuntimeException)
104cdf0e10cSrcweir {
105cdf0e10cSrcweir 	sal_Int32 column = _column;
106cdf0e10cSrcweir 	if(_column < (sal_Int32)m_vMapping.size()) // use mapping
107cdf0e10cSrcweir 		column = m_vMapping[_column];
108cdf0e10cSrcweir 
109cdf0e10cSrcweir     return getNumColAttrib(m_pConnection,m_aStatementHandle,*this,column,ident);
110cdf0e10cSrcweir }
111cdf0e10cSrcweir // -------------------------------------------------------------------------
getColumnDisplaySize(sal_Int32 column)112cdf0e10cSrcweir sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException)
113cdf0e10cSrcweir {
114cdf0e10cSrcweir 	return getNumColAttrib(column,SQL_DESC_DISPLAY_SIZE);
115cdf0e10cSrcweir }
116cdf0e10cSrcweir // -------------------------------------------------------------------------
getColumnODBCType(OConnection * _pConnection,SQLHANDLE _aStatementHandle,const::com::sun::star::uno::Reference<::com::sun::star::uno::XInterface> & _xInterface,sal_Int32 column)117cdf0e10cSrcweir SQLSMALLINT OResultSetMetaData::getColumnODBCType(OConnection* _pConnection
118cdf0e10cSrcweir                                               ,SQLHANDLE _aStatementHandle
119cdf0e10cSrcweir                                               ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface
120cdf0e10cSrcweir                                               ,sal_Int32 column)
121cdf0e10cSrcweir                                                throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
122cdf0e10cSrcweir {
123cdf0e10cSrcweir     SQLSMALLINT nType = 0;
124cdf0e10cSrcweir     try
125cdf0e10cSrcweir     {
126cdf0e10cSrcweir 	    nType = (SQLSMALLINT)getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column,SQL_DESC_CONCISE_TYPE);
127cdf0e10cSrcweir 	    if(nType == SQL_UNKNOWN_TYPE)
128cdf0e10cSrcweir 		    nType = (SQLSMALLINT)getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column, SQL_DESC_TYPE);
129cdf0e10cSrcweir     }
130cdf0e10cSrcweir     catch(SQLException& ) // in this case we have an odbc 2.0 driver
131cdf0e10cSrcweir     {
132cdf0e10cSrcweir 	    nType = (SQLSMALLINT)getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column,SQL_DESC_CONCISE_TYPE );
133cdf0e10cSrcweir     }
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     return nType;
136cdf0e10cSrcweir }
137cdf0e10cSrcweir // -----------------------------------------------------------------------------
getColumnType(sal_Int32 column)138cdf0e10cSrcweir sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException)
139cdf0e10cSrcweir {
140cdf0e10cSrcweir     ::std::map<sal_Int32,sal_Int32>::iterator aFind = m_aColumnTypes.find(column);
141cdf0e10cSrcweir     if ( aFind == m_aColumnTypes.end() )
142cdf0e10cSrcweir     {
143cdf0e10cSrcweir 	    sal_Int32 nType = 0;
144cdf0e10cSrcweir 	    if(!m_bUseODBC2Types)
145cdf0e10cSrcweir 	    {
146cdf0e10cSrcweir 		    try
147cdf0e10cSrcweir 		    {
148cdf0e10cSrcweir 			    nType = getNumColAttrib(column,SQL_DESC_CONCISE_TYPE);
149cdf0e10cSrcweir 			    if(nType == SQL_UNKNOWN_TYPE)
150cdf0e10cSrcweir 				    nType = getNumColAttrib(column, SQL_DESC_TYPE);
151cdf0e10cSrcweir 			    nType = OTools::MapOdbcType2Jdbc(nType);
152cdf0e10cSrcweir 		    }
153cdf0e10cSrcweir 		    catch(SQLException& ) // in this case we have an odbc 2.0 driver
154cdf0e10cSrcweir 		    {
155cdf0e10cSrcweir 			    m_bUseODBC2Types = sal_True;
156cdf0e10cSrcweir 			    nType = OTools::MapOdbcType2Jdbc(getNumColAttrib(column,SQL_DESC_CONCISE_TYPE ));
157cdf0e10cSrcweir 		    }
158cdf0e10cSrcweir 	    }
159cdf0e10cSrcweir 	    else
160cdf0e10cSrcweir 		    nType = OTools::MapOdbcType2Jdbc(getNumColAttrib(column,SQL_DESC_CONCISE_TYPE ));
161cdf0e10cSrcweir         aFind = m_aColumnTypes.insert(::std::map<sal_Int32,sal_Int32>::value_type(column,nType)).first;
162cdf0e10cSrcweir     }
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 
165cdf0e10cSrcweir 	return aFind->second;
166cdf0e10cSrcweir }
167cdf0e10cSrcweir // -------------------------------------------------------------------------
168cdf0e10cSrcweir 
getColumnCount()169cdf0e10cSrcweir sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount(  ) throw(SQLException, RuntimeException)
170cdf0e10cSrcweir {
171cdf0e10cSrcweir 	if(m_nColCount != -1)
172cdf0e10cSrcweir 		return m_nColCount;
173cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnCount" );
174cdf0e10cSrcweir 	sal_Int16 nNumResultCols=0;
175cdf0e10cSrcweir 	OTools::ThrowException(m_pConnection,N3SQLNumResultCols(m_aStatementHandle,&nNumResultCols),m_aStatementHandle,SQL_HANDLE_STMT,*this);
176cdf0e10cSrcweir 	return m_nColCount = nNumResultCols;
177cdf0e10cSrcweir }
178cdf0e10cSrcweir // -------------------------------------------------------------------------
179cdf0e10cSrcweir 
isCaseSensitive(sal_Int32 column)180cdf0e10cSrcweir sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException)
181cdf0e10cSrcweir {
182cdf0e10cSrcweir 	return getNumColAttrib(column,SQL_DESC_CASE_SENSITIVE) == SQL_TRUE;
183cdf0e10cSrcweir }
184cdf0e10cSrcweir // -------------------------------------------------------------------------
185cdf0e10cSrcweir 
getSchemaName(sal_Int32 column)186cdf0e10cSrcweir ::rtl::OUString SAL_CALL OResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException)
187cdf0e10cSrcweir {
188cdf0e10cSrcweir 	return getCharColAttrib(column,SQL_DESC_SCHEMA_NAME);
189cdf0e10cSrcweir }
190cdf0e10cSrcweir // -------------------------------------------------------------------------
191cdf0e10cSrcweir 
getColumnName(sal_Int32 column)192cdf0e10cSrcweir ::rtl::OUString SAL_CALL OResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException)
193cdf0e10cSrcweir {
194cdf0e10cSrcweir 	return getCharColAttrib(column,SQL_DESC_NAME);
195cdf0e10cSrcweir }
196cdf0e10cSrcweir // -------------------------------------------------------------------------
getTableName(sal_Int32 column)197cdf0e10cSrcweir ::rtl::OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException)
198cdf0e10cSrcweir {
199cdf0e10cSrcweir 	return getCharColAttrib(column,SQL_DESC_TABLE_NAME);
200cdf0e10cSrcweir }
201cdf0e10cSrcweir // -------------------------------------------------------------------------
getCatalogName(sal_Int32 column)202cdf0e10cSrcweir ::rtl::OUString SAL_CALL OResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException)
203cdf0e10cSrcweir {
204cdf0e10cSrcweir 	return getCharColAttrib(column,SQL_DESC_CATALOG_NAME);
205cdf0e10cSrcweir }
206cdf0e10cSrcweir // -------------------------------------------------------------------------
getColumnTypeName(sal_Int32 column)207cdf0e10cSrcweir ::rtl::OUString SAL_CALL OResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException)
208cdf0e10cSrcweir {
209cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnTypeName" );
210cdf0e10cSrcweir 	return getCharColAttrib(column,SQL_DESC_TYPE_NAME);
211cdf0e10cSrcweir }
212cdf0e10cSrcweir // -------------------------------------------------------------------------
getColumnLabel(sal_Int32 column)213cdf0e10cSrcweir ::rtl::OUString SAL_CALL OResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException)
214cdf0e10cSrcweir {
215cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnLabel" );
216cdf0e10cSrcweir 	return getCharColAttrib(column,SQL_DESC_LABEL);
217cdf0e10cSrcweir }
218cdf0e10cSrcweir // -------------------------------------------------------------------------
getColumnServiceName(sal_Int32)219cdf0e10cSrcweir ::rtl::OUString SAL_CALL OResultSetMetaData::getColumnServiceName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
220cdf0e10cSrcweir {
221cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::getColumnServiceName" );
222cdf0e10cSrcweir 	return ::rtl::OUString();
223cdf0e10cSrcweir }
224cdf0e10cSrcweir // -------------------------------------------------------------------------
225cdf0e10cSrcweir 
isCurrency(sal_Int32 column)226cdf0e10cSrcweir sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException)
227cdf0e10cSrcweir {
228cdf0e10cSrcweir 	return getNumColAttrib(column,SQL_DESC_FIXED_PREC_SCALE) == SQL_TRUE;
229cdf0e10cSrcweir }
230cdf0e10cSrcweir // -------------------------------------------------------------------------
231cdf0e10cSrcweir 
isAutoIncrement(sal_Int32 column)232cdf0e10cSrcweir sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException)
233cdf0e10cSrcweir {
234cdf0e10cSrcweir 	return getNumColAttrib(column,SQL_DESC_AUTO_UNIQUE_VALUE) == SQL_TRUE;
235cdf0e10cSrcweir }
236cdf0e10cSrcweir // -------------------------------------------------------------------------
237cdf0e10cSrcweir 
238cdf0e10cSrcweir 
isSigned(sal_Int32 column)239cdf0e10cSrcweir sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException)
240cdf0e10cSrcweir {
241cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::isSigned" );
242cdf0e10cSrcweir 	return getNumColAttrib(column,SQL_DESC_UNSIGNED) == SQL_FALSE;
243cdf0e10cSrcweir }
244cdf0e10cSrcweir // -------------------------------------------------------------------------
getPrecision(sal_Int32 column)245cdf0e10cSrcweir sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException)
246cdf0e10cSrcweir {
247cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::getPrecision" );
248cdf0e10cSrcweir 	sal_Int32 nType = 0;
249cdf0e10cSrcweir 	try
250cdf0e10cSrcweir 	{
251cdf0e10cSrcweir 		nType = getNumColAttrib(column,SQL_DESC_PRECISION);
252cdf0e10cSrcweir 	}
253cdf0e10cSrcweir 	catch(const SQLException& ) // in this case we have an odbc 2.0 driver
254cdf0e10cSrcweir 	{
255cdf0e10cSrcweir 		m_bUseODBC2Types = sal_True;
256cdf0e10cSrcweir 		nType = getNumColAttrib(column,SQL_COLUMN_PRECISION );
257cdf0e10cSrcweir 	}
258cdf0e10cSrcweir 	return nType;
259cdf0e10cSrcweir }
260cdf0e10cSrcweir // -----------------------------------------------------------------------------
getScale(sal_Int32 column)261cdf0e10cSrcweir sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
262cdf0e10cSrcweir {
263cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::getScale" );
264cdf0e10cSrcweir 	sal_Int32 nType = 0;
265cdf0e10cSrcweir 	try
266cdf0e10cSrcweir 	{
267cdf0e10cSrcweir 		nType = getNumColAttrib(column,SQL_DESC_SCALE);
268cdf0e10cSrcweir 	}
269cdf0e10cSrcweir 	catch(const SQLException& ) // in this case we have an odbc 2.0 driver
270cdf0e10cSrcweir 	{
271cdf0e10cSrcweir 		m_bUseODBC2Types = sal_True;
272cdf0e10cSrcweir 		nType = getNumColAttrib(column,SQL_COLUMN_SCALE );
273cdf0e10cSrcweir 	}
274cdf0e10cSrcweir 	return nType;
275cdf0e10cSrcweir }
276cdf0e10cSrcweir // -------------------------------------------------------------------------
277cdf0e10cSrcweir 
isNullable(sal_Int32 column)278cdf0e10cSrcweir sal_Int32 SAL_CALL OResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException)
279cdf0e10cSrcweir {
280cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::isNullable" );
281cdf0e10cSrcweir 	return getNumColAttrib(column,SQL_DESC_NULLABLE);
282cdf0e10cSrcweir }
283cdf0e10cSrcweir // -------------------------------------------------------------------------
284cdf0e10cSrcweir 
isSearchable(sal_Int32 column)285cdf0e10cSrcweir sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException)
286cdf0e10cSrcweir {
287cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::isSearchable" );
288cdf0e10cSrcweir 	return getNumColAttrib(column,SQL_DESC_SEARCHABLE) != SQL_PRED_NONE;
289cdf0e10cSrcweir }
290cdf0e10cSrcweir // -------------------------------------------------------------------------
291cdf0e10cSrcweir 
isReadOnly(sal_Int32 column)292cdf0e10cSrcweir sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException)
293cdf0e10cSrcweir {
294cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::isReadOnly" );
295cdf0e10cSrcweir 	return getNumColAttrib(column,SQL_DESC_UPDATABLE) == SQL_ATTR_READONLY;
296cdf0e10cSrcweir }
297cdf0e10cSrcweir // -------------------------------------------------------------------------
298cdf0e10cSrcweir 
isDefinitelyWritable(sal_Int32 column)299cdf0e10cSrcweir sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
300cdf0e10cSrcweir {
301cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::isDefinitelyWritable" );
302cdf0e10cSrcweir 	return getNumColAttrib(column,SQL_DESC_UPDATABLE) == SQL_ATTR_WRITE;
303cdf0e10cSrcweir ;
304cdf0e10cSrcweir }
305cdf0e10cSrcweir // -------------------------------------------------------------------------
isWritable(sal_Int32 column)306cdf0e10cSrcweir sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
307cdf0e10cSrcweir {
308cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OResultSetMetaData::isWritable" );
309cdf0e10cSrcweir 	return getNumColAttrib(column,SQL_DESC_UPDATABLE) == SQL_ATTR_WRITE;
310cdf0e10cSrcweir }
311cdf0e10cSrcweir // -------------------------------------------------------------------------
312cdf0e10cSrcweir 
313