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