Bump for 3.6-28
[LibreOffice.git] / connectivity / source / drivers / jdbc / ResultSetMetaData.cxx
bloba75d02b0edcd076fc16c139de8a707bda24dadc0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "java/sql/ResultSetMetaData.hxx"
30 #include "java/sql/Connection.hxx"
31 #include "java/tools.hxx"
32 #include <rtl/logfile.hxx>
34 using namespace connectivity;
35 using namespace ::com::sun::star::uno;
36 using namespace ::com::sun::star::beans;
37 using namespace ::com::sun::star::sdbc;
38 using namespace ::com::sun::star::container;
39 using namespace ::com::sun::star::lang;
41 #define NULLABLE_UNDEFINED 99
42 //**************************************************************
43 //************ Class: java.sql.ResultSetMetaData
44 //**************************************************************
46 jclass java_sql_ResultSetMetaData::theClass = 0;
47 java_sql_ResultSetMetaData::java_sql_ResultSetMetaData( JNIEnv * pEnv, jobject myObj, const java::sql::ConnectionLog& _rResultSetLogger, java_sql_Connection& _rCon )
48 :java_lang_Object( pEnv, myObj )
49 ,m_aLogger( _rResultSetLogger )
50 ,m_pConnection( &_rCon )
51 ,m_nColumnCount(-1)
53 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::java_sql_ResultSetMetaData" );
54 SDBThreadAttach::addRef();
56 java_sql_ResultSetMetaData::~java_sql_ResultSetMetaData()
58 SDBThreadAttach::releaseRef();
61 jclass java_sql_ResultSetMetaData::getMyClass() const
63 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getMyClass" );
64 // The class needs to be fetched just once, that is why it is static
65 if( !theClass )
66 theClass = findMyClass("java/sql/ResultSetMetaData");
67 return theClass;
69 // -------------------------------------------------------------------------
71 sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException)
73 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnDisplaySize" );
74 static jmethodID mID(NULL);
75 return callIntMethodWithIntArg("getColumnDisplaySize",mID,column);
77 // -------------------------------------------------------------------------
79 sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException)
81 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnType" );
82 static jmethodID mID(NULL);
83 return callIntMethodWithIntArg("getColumnType",mID,column);
85 // -------------------------------------------------------------------------
87 sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException)
89 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnCount" );
90 if ( m_nColumnCount == -1 )
92 static jmethodID mID(NULL);
93 m_nColumnCount = callIntMethod("getColumnCount",mID);
94 } // if ( m_nColumnCount == -1 )
95 return m_nColumnCount;
98 // -------------------------------------------------------------------------
100 sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException)
102 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isCaseSensitive" );
103 static jmethodID mID(NULL);
104 return callBooleanMethodWithIntArg( "isCaseSensitive", mID,column );
106 // -------------------------------------------------------------------------
107 ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException)
109 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getSchemaName" );
110 static jmethodID mID(NULL);
111 return callStringMethodWithIntArg("getSchemaName",mID,column);
113 // -------------------------------------------------------------------------
115 ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException)
117 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnName" );
118 static jmethodID mID(NULL);
119 return callStringMethodWithIntArg("getColumnName",mID,column);
121 // -------------------------------------------------------------------------
122 ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException)
124 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getTableName" );
125 static jmethodID mID(NULL);
126 return callStringMethodWithIntArg("getTableName",mID,column);
128 // -------------------------------------------------------------------------
129 ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException)
131 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getCatalogName" );
132 static jmethodID mID(NULL);
133 return callStringMethodWithIntArg("getCatalogName",mID,column);
135 // -------------------------------------------------------------------------
136 ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException)
138 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnTypeName" );
139 static jmethodID mID(NULL);
140 return callStringMethodWithIntArg("getColumnTypeName",mID,column);
142 // -------------------------------------------------------------------------
143 ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException)
145 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnLabel" );
146 static jmethodID mID(NULL);
147 return callStringMethodWithIntArg("getColumnLabel",mID,column);
149 // -------------------------------------------------------------------------
150 ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException)
152 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnServiceName" );
153 static jmethodID mID(NULL);
154 return callStringMethodWithIntArg("getColumnClassName",mID,column);
156 // -------------------------------------------------------------------------
158 sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException)
160 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isCurrency" );
161 if ( m_pConnection->isIgnoreCurrencyEnabled() )
162 return sal_False;
163 static jmethodID mID(NULL);
164 return callBooleanMethodWithIntArg( "isCurrency", mID,column );
166 // -------------------------------------------------------------------------
168 sal_Bool SAL_CALL java_sql_ResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException)
170 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isAutoIncrement" );
171 static jmethodID mID(NULL);
172 return callBooleanMethodWithIntArg( "isAutoIncrement", mID,column );
174 // -------------------------------------------------------------------------
177 sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException)
179 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isSigned" );
180 static jmethodID mID(NULL);
181 return callBooleanMethodWithIntArg( "isSigned", mID,column );
183 // -------------------------------------------------------------------------
184 sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException)
186 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getPrecision" );
187 static jmethodID mID(NULL);
188 return callIntMethodWithIntArg("getPrecision",mID,column);
190 // -------------------------------------------------------------------------
191 sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
193 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getScale" );
194 static jmethodID mID(NULL);
195 return callIntMethodWithIntArg("getScale",mID,column);
197 // -------------------------------------------------------------------------
198 sal_Int32 SAL_CALL java_sql_ResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException)
200 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isNullable" );
201 static jmethodID mID(NULL);
202 return callIntMethodWithIntArg("isNullable",mID,column);
204 // -------------------------------------------------------------------------
206 sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException)
208 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isSearchable" );
209 static jmethodID mID(NULL);
210 return callBooleanMethodWithIntArg( "isSearchable", mID,column );
212 // -------------------------------------------------------------------------
214 sal_Bool SAL_CALL java_sql_ResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException)
216 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isReadOnly" );
217 static jmethodID mID(NULL);
218 return callBooleanMethodWithIntArg( "isReadOnly", mID,column );
220 // -------------------------------------------------------------------------
222 sal_Bool SAL_CALL java_sql_ResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
224 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isDefinitelyWritable" );
225 static jmethodID mID(NULL);
226 return callBooleanMethodWithIntArg( "isDefinitelyWritable", mID,column );
228 // -------------------------------------------------------------------------
229 sal_Bool SAL_CALL java_sql_ResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
231 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isWritable" );
232 static jmethodID mID(NULL);
233 return callBooleanMethodWithIntArg( "isWritable", mID,column );
235 // -------------------------------------------------------------------------
237 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */