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 :
24 : using namespace connectivity;
25 : using namespace ::com::sun::star::uno;
26 : using namespace ::com::sun::star::beans;
27 : using namespace ::com::sun::star::sdbc;
28 : using namespace ::com::sun::star::container;
29 : using namespace ::com::sun::star::lang;
30 :
31 :
32 : //************ Class: java.sql.ResultSetMetaData
33 :
34 :
35 : jclass java_sql_ResultSetMetaData::theClass = 0;
36 44 : java_sql_ResultSetMetaData::java_sql_ResultSetMetaData( JNIEnv * pEnv, jobject myObj, const java::sql::ConnectionLog& _rResultSetLogger, java_sql_Connection& _rCon )
37 : :java_lang_Object( pEnv, myObj )
38 : ,m_aLogger( _rResultSetLogger )
39 : ,m_pConnection( &_rCon )
40 44 : ,m_nColumnCount(-1)
41 : {
42 44 : SDBThreadAttach::addRef();
43 44 : }
44 132 : java_sql_ResultSetMetaData::~java_sql_ResultSetMetaData()
45 : {
46 44 : SDBThreadAttach::releaseRef();
47 88 : }
48 :
49 22 : jclass java_sql_ResultSetMetaData::getMyClass() const
50 : {
51 : // The class needs to be fetched just once, that is why it is static
52 22 : if( !theClass )
53 3 : theClass = findMyClass("java/sql/ResultSetMetaData");
54 22 : return theClass;
55 : }
56 :
57 :
58 0 : sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
59 : {
60 : static jmethodID mID(NULL);
61 0 : return callIntMethodWithIntArg_ThrowSQL("getColumnDisplaySize",mID,column);
62 : }
63 :
64 :
65 223 : sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
66 : {
67 : static jmethodID mID(NULL);
68 223 : return callIntMethodWithIntArg_ThrowSQL("getColumnType",mID,column);
69 : }
70 :
71 :
72 1344 : sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException, std::exception)
73 : {
74 1344 : if ( m_nColumnCount == -1 )
75 : {
76 : static jmethodID mID(NULL);
77 44 : m_nColumnCount = callIntMethod_ThrowSQL("getColumnCount", mID);
78 : } // if ( m_nColumnCount == -1 )
79 1344 : return m_nColumnCount;
80 :
81 : }
82 :
83 :
84 0 : sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
85 : {
86 : static jmethodID mID(NULL);
87 0 : return callBooleanMethodWithIntArg( "isCaseSensitive", mID,column );
88 : }
89 :
90 0 : OUString SAL_CALL java_sql_ResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
91 : {
92 : static jmethodID mID(NULL);
93 0 : return callStringMethodWithIntArg("getSchemaName",mID,column);
94 : }
95 :
96 :
97 150 : OUString SAL_CALL java_sql_ResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
98 : {
99 : static jmethodID mID(NULL);
100 150 : return callStringMethodWithIntArg("getColumnName",mID,column);
101 : }
102 :
103 0 : OUString SAL_CALL java_sql_ResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
104 : {
105 : static jmethodID mID(NULL);
106 0 : return callStringMethodWithIntArg("getTableName",mID,column);
107 : }
108 :
109 0 : OUString SAL_CALL java_sql_ResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
110 : {
111 : static jmethodID mID(NULL);
112 0 : return callStringMethodWithIntArg("getCatalogName",mID,column);
113 : }
114 :
115 0 : OUString SAL_CALL java_sql_ResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
116 : {
117 : static jmethodID mID(NULL);
118 0 : return callStringMethodWithIntArg("getColumnTypeName",mID,column);
119 : }
120 :
121 345 : OUString SAL_CALL java_sql_ResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
122 : {
123 : static jmethodID mID(NULL);
124 345 : return callStringMethodWithIntArg("getColumnLabel",mID,column);
125 : }
126 :
127 0 : OUString SAL_CALL java_sql_ResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
128 : {
129 : static jmethodID mID(NULL);
130 0 : return callStringMethodWithIntArg("getColumnClassName",mID,column);
131 : }
132 :
133 :
134 166 : sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
135 : {
136 166 : if ( m_pConnection->isIgnoreCurrencyEnabled() )
137 0 : return sal_False;
138 : static jmethodID mID(NULL);
139 166 : return callBooleanMethodWithIntArg( "isCurrency", mID,column );
140 : }
141 :
142 :
143 43 : sal_Bool SAL_CALL java_sql_ResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
144 : {
145 : static jmethodID mID(NULL);
146 43 : return callBooleanMethodWithIntArg( "isAutoIncrement", mID,column );
147 : }
148 :
149 :
150 :
151 46 : sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
152 : {
153 : static jmethodID mID(NULL);
154 46 : return callBooleanMethodWithIntArg( "isSigned", mID,column );
155 : }
156 :
157 0 : sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
158 : {
159 : static jmethodID mID(NULL);
160 0 : return callIntMethodWithIntArg_ThrowSQL("getPrecision",mID,column);
161 : }
162 :
163 3 : sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
164 : {
165 : static jmethodID mID(NULL);
166 3 : return callIntMethodWithIntArg_ThrowSQL("getScale",mID,column);
167 : }
168 :
169 46 : sal_Int32 SAL_CALL java_sql_ResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
170 : {
171 : static jmethodID mID(NULL);
172 46 : return callIntMethodWithIntArg_ThrowSQL("isNullable",mID,column);
173 : }
174 :
175 :
176 0 : sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
177 : {
178 : static jmethodID mID(NULL);
179 0 : return callBooleanMethodWithIntArg( "isSearchable", mID,column );
180 : }
181 :
182 :
183 0 : sal_Bool SAL_CALL java_sql_ResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
184 : {
185 : static jmethodID mID(NULL);
186 0 : return callBooleanMethodWithIntArg( "isReadOnly", mID,column );
187 : }
188 :
189 :
190 0 : sal_Bool SAL_CALL java_sql_ResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
191 : {
192 : static jmethodID mID(NULL);
193 0 : return callBooleanMethodWithIntArg( "isDefinitelyWritable", mID,column );
194 : }
195 :
196 0 : sal_Bool SAL_CALL java_sql_ResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException, std::exception)
197 : {
198 : static jmethodID mID(NULL);
199 0 : return callBooleanMethodWithIntArg( "isWritable", mID,column );
200 : }
201 :
202 :
203 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|