Update ooo320-m1
[ooovba.git] / connectivity / source / drivers / jdbc / ResultSetMetaData.cxx
blob6db88459b018bab8bee86767aa4f934808160b62
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ResultSetMetaData.cxx,v $
10 * $Revision: 1.13 $
12 * This file is part of OpenOffice.org.
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.
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).
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.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_connectivity.hxx"
33 #include "java/sql/ResultSetMetaData.hxx"
34 #include "java/sql/Connection.hxx"
35 #include "java/tools.hxx"
36 #include <rtl/logfile.hxx>
38 using namespace connectivity;
39 using namespace ::com::sun::star::uno;
40 using namespace ::com::sun::star::beans;
41 // using namespace ::com::sun::star::sdbcx;
42 using namespace ::com::sun::star::sdbc;
43 using namespace ::com::sun::star::container;
44 using namespace ::com::sun::star::lang;
46 #define NULLABLE_UNDEFINED 99
47 //**************************************************************
48 //************ Class: java.sql.ResultSetMetaData
49 //**************************************************************
51 jclass java_sql_ResultSetMetaData::theClass = 0;
52 java_sql_ResultSetMetaData::java_sql_ResultSetMetaData( JNIEnv * pEnv, jobject myObj, const java::sql::ConnectionLog& _rResultSetLogger, java_sql_Connection& _rCon )
53 :java_lang_Object( pEnv, myObj )
54 ,m_aLogger( _rResultSetLogger )
55 ,m_pConnection( &_rCon )
56 ,m_nColumnCount(-1)
58 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::java_sql_ResultSetMetaData" );
59 SDBThreadAttach::addRef();
61 java_sql_ResultSetMetaData::~java_sql_ResultSetMetaData()
63 SDBThreadAttach::releaseRef();
66 jclass java_sql_ResultSetMetaData::getMyClass() const
68 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getMyClass" );
69 // die Klasse muss nur einmal geholt werden, daher statisch
70 if( !theClass )
71 theClass = findMyClass("java/sql/ResultSetMetaData");
72 return theClass;
74 // -------------------------------------------------------------------------
76 sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException)
78 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnDisplaySize" );
79 static jmethodID mID(NULL);
80 return callIntMethodWithIntArg("getColumnDisplaySize",mID,column);
82 // -------------------------------------------------------------------------
84 sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException)
86 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnType" );
87 static jmethodID mID(NULL);
88 return callIntMethodWithIntArg("getColumnType",mID,column);
90 // -------------------------------------------------------------------------
92 sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException)
94 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnCount" );
95 if ( m_nColumnCount == -1 )
97 static jmethodID mID(NULL);
98 m_nColumnCount = callIntMethod("getColumnCount",mID);
99 } // if ( m_nColumnCount == -1 )
100 return m_nColumnCount;
103 // -------------------------------------------------------------------------
105 sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException)
107 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isCaseSensitive" );
108 static jmethodID mID(NULL);
109 return callBooleanMethodWithIntArg( "isCaseSensitive", mID,column );
111 // -------------------------------------------------------------------------
112 ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException)
114 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getSchemaName" );
115 static jmethodID mID(NULL);
116 return callStringMethodWithIntArg("getSchemaName",mID,column);
118 // -------------------------------------------------------------------------
120 ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException)
122 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnName" );
123 static jmethodID mID(NULL);
124 return callStringMethodWithIntArg("getColumnName",mID,column);
126 // -------------------------------------------------------------------------
127 ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException)
129 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getTableName" );
130 static jmethodID mID(NULL);
131 return callStringMethodWithIntArg("getTableName",mID,column);
133 // -------------------------------------------------------------------------
134 ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException)
136 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getCatalogName" );
137 static jmethodID mID(NULL);
138 return callStringMethodWithIntArg("getCatalogName",mID,column);
140 // -------------------------------------------------------------------------
141 ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException)
143 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnTypeName" );
144 static jmethodID mID(NULL);
145 return callStringMethodWithIntArg("getColumnTypeName",mID,column);
147 // -------------------------------------------------------------------------
148 ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException)
150 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnLabel" );
151 static jmethodID mID(NULL);
152 return callStringMethodWithIntArg("getColumnLabel",mID,column);
154 // -------------------------------------------------------------------------
155 ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException)
157 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnServiceName" );
158 static jmethodID mID(NULL);
159 return callStringMethodWithIntArg("getColumnClassName",mID,column);
161 // -------------------------------------------------------------------------
163 sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException)
165 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isCurrency" );
166 if ( m_pConnection->isIgnoreCurrencyEnabled() )
167 return sal_False;
168 static jmethodID mID(NULL);
169 return callBooleanMethodWithIntArg( "isCurrency", mID,column );
171 // -------------------------------------------------------------------------
173 sal_Bool SAL_CALL java_sql_ResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException)
175 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isAutoIncrement" );
176 static jmethodID mID(NULL);
177 return callBooleanMethodWithIntArg( "isAutoIncrement", mID,column );
179 // -------------------------------------------------------------------------
182 sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException)
184 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isSigned" );
185 static jmethodID mID(NULL);
186 return callBooleanMethodWithIntArg( "isSigned", mID,column );
188 // -------------------------------------------------------------------------
189 sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException)
191 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getPrecision" );
192 static jmethodID mID(NULL);
193 return callIntMethodWithIntArg("getPrecision",mID,column);
195 // -------------------------------------------------------------------------
196 sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
198 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getScale" );
199 static jmethodID mID(NULL);
200 return callIntMethodWithIntArg("getScale",mID,column);
202 // -------------------------------------------------------------------------
203 sal_Int32 SAL_CALL java_sql_ResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException)
205 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isNullable" );
206 static jmethodID mID(NULL);
207 return callIntMethodWithIntArg("isNullable",mID,column);
209 // -------------------------------------------------------------------------
211 sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException)
213 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isSearchable" );
214 static jmethodID mID(NULL);
215 return callBooleanMethodWithIntArg( "isSearchable", mID,column );
217 // -------------------------------------------------------------------------
219 sal_Bool SAL_CALL java_sql_ResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException)
221 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isReadOnly" );
222 static jmethodID mID(NULL);
223 return callBooleanMethodWithIntArg( "isReadOnly", mID,column );
225 // -------------------------------------------------------------------------
227 sal_Bool SAL_CALL java_sql_ResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
229 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isDefinitelyWritable" );
230 static jmethodID mID(NULL);
231 return callBooleanMethodWithIntArg( "isDefinitelyWritable", mID,column );
233 // -------------------------------------------------------------------------
234 sal_Bool SAL_CALL java_sql_ResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
236 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isWritable" );
237 static jmethodID mID(NULL);
238 return callBooleanMethodWithIntArg( "isWritable", mID,column );
240 // -------------------------------------------------------------------------