Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "java/sql/ResultSetMetaData.hxx"
21 : #include "java/sql/Connection.hxx"
22 : #include "java/tools.hxx"
23 : #include <rtl/logfile.hxx>
24 :
25 : using namespace connectivity;
26 : using namespace ::com::sun::star::uno;
27 : using namespace ::com::sun::star::beans;
28 : using namespace ::com::sun::star::sdbc;
29 : using namespace ::com::sun::star::container;
30 : using namespace ::com::sun::star::lang;
31 :
32 : #define NULLABLE_UNDEFINED 99
33 : //**************************************************************
34 : //************ Class: java.sql.ResultSetMetaData
35 : //**************************************************************
36 :
37 : jclass java_sql_ResultSetMetaData::theClass = 0;
38 0 : java_sql_ResultSetMetaData::java_sql_ResultSetMetaData( JNIEnv * pEnv, jobject myObj, const java::sql::ConnectionLog& _rResultSetLogger, java_sql_Connection& _rCon )
39 : :java_lang_Object( pEnv, myObj )
40 : ,m_aLogger( _rResultSetLogger )
41 : ,m_pConnection( &_rCon )
42 0 : ,m_nColumnCount(-1)
43 : {
44 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::java_sql_ResultSetMetaData" );
45 0 : SDBThreadAttach::addRef();
46 0 : }
47 0 : java_sql_ResultSetMetaData::~java_sql_ResultSetMetaData()
48 : {
49 0 : SDBThreadAttach::releaseRef();
50 0 : }
51 :
52 0 : jclass java_sql_ResultSetMetaData::getMyClass() const
53 : {
54 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getMyClass" );
55 : // The class needs to be fetched just once, that is why it is static
56 0 : if( !theClass )
57 0 : theClass = findMyClass("java/sql/ResultSetMetaData");
58 0 : return theClass;
59 : }
60 : // -------------------------------------------------------------------------
61 :
62 0 : sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException)
63 : {
64 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnDisplaySize" );
65 : static jmethodID mID(NULL);
66 0 : return callIntMethodWithIntArg("getColumnDisplaySize",mID,column);
67 : }
68 : // -------------------------------------------------------------------------
69 :
70 0 : sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException)
71 : {
72 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnType" );
73 : static jmethodID mID(NULL);
74 0 : return callIntMethodWithIntArg("getColumnType",mID,column);
75 : }
76 : // -------------------------------------------------------------------------
77 :
78 0 : sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException)
79 : {
80 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnCount" );
81 0 : if ( m_nColumnCount == -1 )
82 : {
83 : static jmethodID mID(NULL);
84 0 : m_nColumnCount = callIntMethod("getColumnCount",mID);
85 : } // if ( m_nColumnCount == -1 )
86 0 : return m_nColumnCount;
87 :
88 : }
89 : // -------------------------------------------------------------------------
90 :
91 0 : sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException)
92 : {
93 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isCaseSensitive" );
94 : static jmethodID mID(NULL);
95 0 : return callBooleanMethodWithIntArg( "isCaseSensitive", mID,column );
96 : }
97 : // -------------------------------------------------------------------------
98 0 : ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException)
99 : {
100 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getSchemaName" );
101 : static jmethodID mID(NULL);
102 0 : return callStringMethodWithIntArg("getSchemaName",mID,column);
103 : }
104 : // -------------------------------------------------------------------------
105 :
106 0 : ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException)
107 : {
108 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnName" );
109 : static jmethodID mID(NULL);
110 0 : return callStringMethodWithIntArg("getColumnName",mID,column);
111 : }
112 : // -------------------------------------------------------------------------
113 0 : ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException)
114 : {
115 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getTableName" );
116 : static jmethodID mID(NULL);
117 0 : return callStringMethodWithIntArg("getTableName",mID,column);
118 : }
119 : // -------------------------------------------------------------------------
120 0 : ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException)
121 : {
122 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getCatalogName" );
123 : static jmethodID mID(NULL);
124 0 : return callStringMethodWithIntArg("getCatalogName",mID,column);
125 : }
126 : // -------------------------------------------------------------------------
127 0 : ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException)
128 : {
129 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnTypeName" );
130 : static jmethodID mID(NULL);
131 0 : return callStringMethodWithIntArg("getColumnTypeName",mID,column);
132 : }
133 : // -------------------------------------------------------------------------
134 0 : ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException)
135 : {
136 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnLabel" );
137 : static jmethodID mID(NULL);
138 0 : return callStringMethodWithIntArg("getColumnLabel",mID,column);
139 : }
140 : // -------------------------------------------------------------------------
141 0 : ::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException)
142 : {
143 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getColumnServiceName" );
144 : static jmethodID mID(NULL);
145 0 : return callStringMethodWithIntArg("getColumnClassName",mID,column);
146 : }
147 : // -------------------------------------------------------------------------
148 :
149 0 : sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException)
150 : {
151 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isCurrency" );
152 0 : if ( m_pConnection->isIgnoreCurrencyEnabled() )
153 0 : return sal_False;
154 : static jmethodID mID(NULL);
155 0 : return callBooleanMethodWithIntArg( "isCurrency", mID,column );
156 : }
157 : // -------------------------------------------------------------------------
158 :
159 0 : sal_Bool SAL_CALL java_sql_ResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException)
160 : {
161 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isAutoIncrement" );
162 : static jmethodID mID(NULL);
163 0 : return callBooleanMethodWithIntArg( "isAutoIncrement", mID,column );
164 : }
165 : // -------------------------------------------------------------------------
166 :
167 :
168 0 : sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException)
169 : {
170 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isSigned" );
171 : static jmethodID mID(NULL);
172 0 : return callBooleanMethodWithIntArg( "isSigned", mID,column );
173 : }
174 : // -------------------------------------------------------------------------
175 0 : sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException)
176 : {
177 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getPrecision" );
178 : static jmethodID mID(NULL);
179 0 : return callIntMethodWithIntArg("getPrecision",mID,column);
180 : }
181 : // -------------------------------------------------------------------------
182 0 : sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
183 : {
184 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getScale" );
185 : static jmethodID mID(NULL);
186 0 : return callIntMethodWithIntArg("getScale",mID,column);
187 : }
188 : // -------------------------------------------------------------------------
189 0 : sal_Int32 SAL_CALL java_sql_ResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException)
190 : {
191 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isNullable" );
192 : static jmethodID mID(NULL);
193 0 : return callIntMethodWithIntArg("isNullable",mID,column);
194 : }
195 : // -------------------------------------------------------------------------
196 :
197 0 : sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException)
198 : {
199 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isSearchable" );
200 : static jmethodID mID(NULL);
201 0 : return callBooleanMethodWithIntArg( "isSearchable", mID,column );
202 : }
203 : // -------------------------------------------------------------------------
204 :
205 0 : sal_Bool SAL_CALL java_sql_ResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException)
206 : {
207 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isReadOnly" );
208 : static jmethodID mID(NULL);
209 0 : return callBooleanMethodWithIntArg( "isReadOnly", mID,column );
210 : }
211 : // -------------------------------------------------------------------------
212 :
213 0 : sal_Bool SAL_CALL java_sql_ResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
214 : {
215 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isDefinitelyWritable" );
216 : static jmethodID mID(NULL);
217 0 : return callBooleanMethodWithIntArg( "isDefinitelyWritable", mID,column );
218 : }
219 : // -------------------------------------------------------------------------
220 0 : sal_Bool SAL_CALL java_sql_ResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
221 : {
222 : RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::isWritable" );
223 : static jmethodID mID(NULL);
224 0 : return callBooleanMethodWithIntArg( "isWritable", mID,column );
225 : }
226 : // -------------------------------------------------------------------------
227 :
228 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|