1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <java/sql/ResultSetMetaData.hxx>
21 #include <java/sql/Connection.hxx>
23 using namespace connectivity
;
24 using namespace ::com::sun::star::sdbc
;
25 using namespace ::com::sun::star::lang
;
28 //************ Class: java.sql.ResultSetMetaData
31 jclass
java_sql_ResultSetMetaData::theClass
= nullptr;
32 java_sql_ResultSetMetaData::java_sql_ResultSetMetaData( JNIEnv
* pEnv
, jobject myObj
, java_sql_Connection
& _rCon
)
33 :java_lang_Object( pEnv
, myObj
)
34 ,m_pConnection( &_rCon
)
37 SDBThreadAttach::addRef();
39 java_sql_ResultSetMetaData::~java_sql_ResultSetMetaData()
41 SDBThreadAttach::releaseRef();
44 jclass
java_sql_ResultSetMetaData::getMyClass() const
46 // The class needs to be fetched just once, that is why it is static
48 theClass
= findMyClass("java/sql/ResultSetMetaData");
53 sal_Int32 SAL_CALL
java_sql_ResultSetMetaData::getColumnDisplaySize( sal_Int32 column
)
55 static jmethodID
mID(nullptr);
56 return callIntMethodWithIntArg_ThrowSQL("getColumnDisplaySize",mID
,column
);
60 sal_Int32 SAL_CALL
java_sql_ResultSetMetaData::getColumnType( sal_Int32 column
)
62 static jmethodID
mID(nullptr);
63 return callIntMethodWithIntArg_ThrowSQL("getColumnType",mID
,column
);
67 sal_Int32 SAL_CALL
java_sql_ResultSetMetaData::getColumnCount( )
69 if ( m_nColumnCount
== -1 )
71 static jmethodID
mID(nullptr);
72 m_nColumnCount
= callIntMethod_ThrowSQL("getColumnCount", mID
);
73 } // if ( m_nColumnCount == -1 )
74 return m_nColumnCount
;
79 sal_Bool SAL_CALL
java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column
)
81 static jmethodID
mID(nullptr);
82 return callBooleanMethodWithIntArg( "isCaseSensitive", mID
,column
);
85 OUString SAL_CALL
java_sql_ResultSetMetaData::getSchemaName( sal_Int32 column
)
87 static jmethodID
mID(nullptr);
88 return callStringMethodWithIntArg("getSchemaName",mID
,column
);
92 OUString SAL_CALL
java_sql_ResultSetMetaData::getColumnName( sal_Int32 column
)
94 static jmethodID
mID(nullptr);
95 return callStringMethodWithIntArg("getColumnName",mID
,column
);
98 OUString SAL_CALL
java_sql_ResultSetMetaData::getTableName( sal_Int32 column
)
100 static jmethodID
mID(nullptr);
101 return callStringMethodWithIntArg("getTableName",mID
,column
);
104 OUString SAL_CALL
java_sql_ResultSetMetaData::getCatalogName( sal_Int32 column
)
106 static jmethodID
mID(nullptr);
107 return callStringMethodWithIntArg("getCatalogName",mID
,column
);
110 OUString SAL_CALL
java_sql_ResultSetMetaData::getColumnTypeName( sal_Int32 column
)
112 static jmethodID
mID(nullptr);
113 return callStringMethodWithIntArg("getColumnTypeName",mID
,column
);
116 OUString SAL_CALL
java_sql_ResultSetMetaData::getColumnLabel( sal_Int32 column
)
118 static jmethodID
mID(nullptr);
119 return callStringMethodWithIntArg("getColumnLabel",mID
,column
);
122 OUString SAL_CALL
java_sql_ResultSetMetaData::getColumnServiceName( sal_Int32 column
)
124 static jmethodID
mID(nullptr);
125 return callStringMethodWithIntArg("getColumnClassName",mID
,column
);
129 sal_Bool SAL_CALL
java_sql_ResultSetMetaData::isCurrency( sal_Int32 column
)
131 if ( m_pConnection
->isIgnoreCurrencyEnabled() )
133 static jmethodID
mID(nullptr);
134 return callBooleanMethodWithIntArg( "isCurrency", mID
,column
);
138 sal_Bool SAL_CALL
java_sql_ResultSetMetaData::isAutoIncrement( sal_Int32 column
)
140 static jmethodID
mID(nullptr);
141 return callBooleanMethodWithIntArg( "isAutoIncrement", mID
,column
);
145 sal_Bool SAL_CALL
java_sql_ResultSetMetaData::isSigned( sal_Int32 column
)
147 static jmethodID
mID(nullptr);
148 return callBooleanMethodWithIntArg( "isSigned", mID
,column
);
151 sal_Int32 SAL_CALL
java_sql_ResultSetMetaData::getPrecision( sal_Int32 column
)
153 static jmethodID
mID(nullptr);
154 return callIntMethodWithIntArg_ThrowSQL("getPrecision",mID
,column
);
157 sal_Int32 SAL_CALL
java_sql_ResultSetMetaData::getScale( sal_Int32 column
)
159 static jmethodID
mID(nullptr);
160 return callIntMethodWithIntArg_ThrowSQL("getScale",mID
,column
);
163 sal_Int32 SAL_CALL
java_sql_ResultSetMetaData::isNullable( sal_Int32 column
)
165 static jmethodID
mID(nullptr);
166 return callIntMethodWithIntArg_ThrowSQL("isNullable",mID
,column
);
170 sal_Bool SAL_CALL
java_sql_ResultSetMetaData::isSearchable( sal_Int32 column
)
172 static jmethodID
mID(nullptr);
173 return callBooleanMethodWithIntArg( "isSearchable", mID
,column
);
177 sal_Bool SAL_CALL
java_sql_ResultSetMetaData::isReadOnly( sal_Int32 column
)
179 static jmethodID
mID(nullptr);
180 return callBooleanMethodWithIntArg( "isReadOnly", mID
,column
);
184 sal_Bool SAL_CALL
java_sql_ResultSetMetaData::isDefinitelyWritable( sal_Int32 column
)
186 static jmethodID
mID(nullptr);
187 return callBooleanMethodWithIntArg( "isDefinitelyWritable", mID
,column
);
190 sal_Bool SAL_CALL
java_sql_ResultSetMetaData::isWritable( sal_Int32 column
)
192 static jmethodID
mID(nullptr);
193 return callBooleanMethodWithIntArg( "isWritable", mID
,column
);
197 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */