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 "java/sql/ResultSetMetaData.hxx"
27cdf0e10cSrcweir #include "java/sql/Connection.hxx"
28cdf0e10cSrcweir #include "java/tools.hxx"
29cdf0e10cSrcweir #include <rtl/logfile.hxx>
30cdf0e10cSrcweir
31cdf0e10cSrcweir using namespace connectivity;
32cdf0e10cSrcweir using namespace ::com::sun::star::uno;
33cdf0e10cSrcweir using namespace ::com::sun::star::beans;
34cdf0e10cSrcweir // using namespace ::com::sun::star::sdbcx;
35cdf0e10cSrcweir using namespace ::com::sun::star::sdbc;
36cdf0e10cSrcweir using namespace ::com::sun::star::container;
37cdf0e10cSrcweir using namespace ::com::sun::star::lang;
38cdf0e10cSrcweir
39cdf0e10cSrcweir #define NULLABLE_UNDEFINED 99
40cdf0e10cSrcweir //**************************************************************
41cdf0e10cSrcweir //************ Class: java.sql.ResultSetMetaData
42cdf0e10cSrcweir //**************************************************************
43cdf0e10cSrcweir
44cdf0e10cSrcweir jclass java_sql_ResultSetMetaData::theClass = 0;
java_sql_ResultSetMetaData(JNIEnv * pEnv,jobject myObj,const java::sql::ConnectionLog & _rResultSetLogger,java_sql_Connection & _rCon)45cdf0e10cSrcweir java_sql_ResultSetMetaData::java_sql_ResultSetMetaData( JNIEnv * pEnv, jobject myObj, const java::sql::ConnectionLog& _rResultSetLogger, java_sql_Connection& _rCon )
46cdf0e10cSrcweir :java_lang_Object( pEnv, myObj )
47cdf0e10cSrcweir ,m_aLogger( _rResultSetLogger )
48cdf0e10cSrcweir ,m_pConnection( &_rCon )
49cdf0e10cSrcweir ,m_nColumnCount(-1)
50cdf0e10cSrcweir {
51cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::java_sql_ResultSetMetaData" );
52cdf0e10cSrcweir SDBThreadAttach::addRef();
53cdf0e10cSrcweir }
~java_sql_ResultSetMetaData()54cdf0e10cSrcweir java_sql_ResultSetMetaData::~java_sql_ResultSetMetaData()
55cdf0e10cSrcweir {
56cdf0e10cSrcweir SDBThreadAttach::releaseRef();
57cdf0e10cSrcweir }
58cdf0e10cSrcweir
getMyClass() const59cdf0e10cSrcweir jclass java_sql_ResultSetMetaData::getMyClass() const
60cdf0e10cSrcweir {
61cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getMyClass" );
62cdf0e10cSrcweir // die Klasse muss nur einmal geholt werden, daher statisch
63cdf0e10cSrcweir if( !theClass )
64cdf0e10cSrcweir theClass = findMyClass("java/sql/ResultSetMetaData");
65cdf0e10cSrcweir return theClass;
66cdf0e10cSrcweir }
67cdf0e10cSrcweir // -------------------------------------------------------------------------
68cdf0e10cSrcweir
getColumnDisplaySize(sal_Int32 column)69cdf0e10cSrcweir sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException)
70cdf0e10cSrcweir {
71cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnDisplaySize" );
72cdf0e10cSrcweir static jmethodID mID(NULL);
73cdf0e10cSrcweir return callIntMethodWithIntArg("getColumnDisplaySize",mID,column);
74cdf0e10cSrcweir }
75cdf0e10cSrcweir // -------------------------------------------------------------------------
76cdf0e10cSrcweir
getColumnType(sal_Int32 column)77cdf0e10cSrcweir sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException)
78cdf0e10cSrcweir {
79cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnType" );
80cdf0e10cSrcweir static jmethodID mID(NULL);
81cdf0e10cSrcweir return callIntMethodWithIntArg("getColumnType",mID,column);
82cdf0e10cSrcweir }
83cdf0e10cSrcweir // -------------------------------------------------------------------------
84cdf0e10cSrcweir
getColumnCount()85cdf0e10cSrcweir sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException)
86cdf0e10cSrcweir {
87cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnCount" );
88cdf0e10cSrcweir if ( m_nColumnCount == -1 )
89cdf0e10cSrcweir {
90cdf0e10cSrcweir static jmethodID mID(NULL);
91cdf0e10cSrcweir m_nColumnCount = callIntMethod("getColumnCount",mID);
92cdf0e10cSrcweir } // if ( m_nColumnCount == -1 )
93cdf0e10cSrcweir return m_nColumnCount;
94cdf0e10cSrcweir
95cdf0e10cSrcweir }
96cdf0e10cSrcweir // -------------------------------------------------------------------------
97cdf0e10cSrcweir
isCaseSensitive(sal_Int32 column)98cdf0e10cSrcweir sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException)
99cdf0e10cSrcweir {
100cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isCaseSensitive" );
101cdf0e10cSrcweir static jmethodID mID(NULL);
102cdf0e10cSrcweir return callBooleanMethodWithIntArg( "isCaseSensitive", mID,column );
103cdf0e10cSrcweir }
104cdf0e10cSrcweir // -------------------------------------------------------------------------
getSchemaName(sal_Int32 column)105cdf0e10cSrcweir ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException)
106cdf0e10cSrcweir {
107cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getSchemaName" );
108cdf0e10cSrcweir static jmethodID mID(NULL);
109cdf0e10cSrcweir return callStringMethodWithIntArg("getSchemaName",mID,column);
110cdf0e10cSrcweir }
111cdf0e10cSrcweir // -------------------------------------------------------------------------
112cdf0e10cSrcweir
getColumnName(sal_Int32 column)113cdf0e10cSrcweir ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException)
114cdf0e10cSrcweir {
115cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnName" );
116cdf0e10cSrcweir static jmethodID mID(NULL);
117cdf0e10cSrcweir return callStringMethodWithIntArg("getColumnName",mID,column);
118cdf0e10cSrcweir }
119cdf0e10cSrcweir // -------------------------------------------------------------------------
getTableName(sal_Int32 column)120cdf0e10cSrcweir ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException)
121cdf0e10cSrcweir {
122cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getTableName" );
123cdf0e10cSrcweir static jmethodID mID(NULL);
124cdf0e10cSrcweir return callStringMethodWithIntArg("getTableName",mID,column);
125cdf0e10cSrcweir }
126cdf0e10cSrcweir // -------------------------------------------------------------------------
getCatalogName(sal_Int32 column)127cdf0e10cSrcweir ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException)
128cdf0e10cSrcweir {
129cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getCatalogName" );
130cdf0e10cSrcweir static jmethodID mID(NULL);
131cdf0e10cSrcweir return callStringMethodWithIntArg("getCatalogName",mID,column);
132cdf0e10cSrcweir }
133cdf0e10cSrcweir // -------------------------------------------------------------------------
getColumnTypeName(sal_Int32 column)134cdf0e10cSrcweir ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException)
135cdf0e10cSrcweir {
136cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnTypeName" );
137cdf0e10cSrcweir static jmethodID mID(NULL);
138cdf0e10cSrcweir return callStringMethodWithIntArg("getColumnTypeName",mID,column);
139cdf0e10cSrcweir }
140cdf0e10cSrcweir // -------------------------------------------------------------------------
getColumnLabel(sal_Int32 column)141cdf0e10cSrcweir ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException)
142cdf0e10cSrcweir {
143cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnLabel" );
144cdf0e10cSrcweir static jmethodID mID(NULL);
145cdf0e10cSrcweir return callStringMethodWithIntArg("getColumnLabel",mID,column);
146cdf0e10cSrcweir }
147cdf0e10cSrcweir // -------------------------------------------------------------------------
getColumnServiceName(sal_Int32 column)148cdf0e10cSrcweir ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException)
149cdf0e10cSrcweir {
150cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnServiceName" );
151cdf0e10cSrcweir static jmethodID mID(NULL);
152cdf0e10cSrcweir return callStringMethodWithIntArg("getColumnClassName",mID,column);
153cdf0e10cSrcweir }
154cdf0e10cSrcweir // -------------------------------------------------------------------------
155cdf0e10cSrcweir
isCurrency(sal_Int32 column)156cdf0e10cSrcweir sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException)
157cdf0e10cSrcweir {
158cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isCurrency" );
159cdf0e10cSrcweir if ( m_pConnection->isIgnoreCurrencyEnabled() )
160cdf0e10cSrcweir return sal_False;
161cdf0e10cSrcweir static jmethodID mID(NULL);
162cdf0e10cSrcweir return callBooleanMethodWithIntArg( "isCurrency", mID,column );
163cdf0e10cSrcweir }
164cdf0e10cSrcweir // -------------------------------------------------------------------------
165cdf0e10cSrcweir
isAutoIncrement(sal_Int32 column)166cdf0e10cSrcweir sal_Bool SAL_CALL java_sql_ResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException)
167cdf0e10cSrcweir {
168cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isAutoIncrement" );
169cdf0e10cSrcweir static jmethodID mID(NULL);
170cdf0e10cSrcweir return callBooleanMethodWithIntArg( "isAutoIncrement", mID,column );
171cdf0e10cSrcweir }
172cdf0e10cSrcweir // -------------------------------------------------------------------------
173cdf0e10cSrcweir
174cdf0e10cSrcweir
isSigned(sal_Int32 column)175cdf0e10cSrcweir sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException)
176cdf0e10cSrcweir {
177cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isSigned" );
178cdf0e10cSrcweir static jmethodID mID(NULL);
179cdf0e10cSrcweir return callBooleanMethodWithIntArg( "isSigned", mID,column );
180cdf0e10cSrcweir }
181cdf0e10cSrcweir // -------------------------------------------------------------------------
getPrecision(sal_Int32 column)182cdf0e10cSrcweir sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException)
183cdf0e10cSrcweir {
184cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getPrecision" );
185cdf0e10cSrcweir static jmethodID mID(NULL);
186cdf0e10cSrcweir return callIntMethodWithIntArg("getPrecision",mID,column);
187cdf0e10cSrcweir }
188cdf0e10cSrcweir // -------------------------------------------------------------------------
getScale(sal_Int32 column)189cdf0e10cSrcweir sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
190cdf0e10cSrcweir {
191cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getScale" );
192cdf0e10cSrcweir static jmethodID mID(NULL);
193cdf0e10cSrcweir return callIntMethodWithIntArg("getScale",mID,column);
194cdf0e10cSrcweir }
195cdf0e10cSrcweir // -------------------------------------------------------------------------
isNullable(sal_Int32 column)196cdf0e10cSrcweir sal_Int32 SAL_CALL java_sql_ResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException)
197cdf0e10cSrcweir {
198cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isNullable" );
199cdf0e10cSrcweir static jmethodID mID(NULL);
200cdf0e10cSrcweir return callIntMethodWithIntArg("isNullable",mID,column);
201cdf0e10cSrcweir }
202cdf0e10cSrcweir // -------------------------------------------------------------------------
203cdf0e10cSrcweir
isSearchable(sal_Int32 column)204cdf0e10cSrcweir sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException)
205cdf0e10cSrcweir {
206cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isSearchable" );
207cdf0e10cSrcweir static jmethodID mID(NULL);
208cdf0e10cSrcweir return callBooleanMethodWithIntArg( "isSearchable", mID,column );
209cdf0e10cSrcweir }
210cdf0e10cSrcweir // -------------------------------------------------------------------------
211cdf0e10cSrcweir
isReadOnly(sal_Int32 column)212cdf0e10cSrcweir sal_Bool SAL_CALL java_sql_ResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException)
213cdf0e10cSrcweir {
214cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isReadOnly" );
215cdf0e10cSrcweir static jmethodID mID(NULL);
216cdf0e10cSrcweir return callBooleanMethodWithIntArg( "isReadOnly", mID,column );
217cdf0e10cSrcweir }
218cdf0e10cSrcweir // -------------------------------------------------------------------------
219cdf0e10cSrcweir
isDefinitelyWritable(sal_Int32 column)220cdf0e10cSrcweir sal_Bool SAL_CALL java_sql_ResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
221cdf0e10cSrcweir {
222cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isDefinitelyWritable" );
223cdf0e10cSrcweir static jmethodID mID(NULL);
224cdf0e10cSrcweir return callBooleanMethodWithIntArg( "isDefinitelyWritable", mID,column );
225cdf0e10cSrcweir }
226cdf0e10cSrcweir // -------------------------------------------------------------------------
isWritable(sal_Int32 column)227cdf0e10cSrcweir sal_Bool SAL_CALL java_sql_ResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
228cdf0e10cSrcweir {
229cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isWritable" );
230cdf0e10cSrcweir static jmethodID mID(NULL);
231cdf0e10cSrcweir return callBooleanMethodWithIntArg( "isWritable", mID,column );
232cdf0e10cSrcweir }
233cdf0e10cSrcweir // -------------------------------------------------------------------------
234cdf0e10cSrcweir
235