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::uno
;
25 using namespace ::com::sun::star::beans
;
26 using namespace ::com::sun::star::sdbc
;
27 using namespace ::com::sun::star::container
;
28 using namespace ::com::sun::star::lang
;
31 //************ Class: java.sql.ResultSetMetaData
34 jclass
java_sql_ResultSetMetaData::theClass
= nullptr;
35 java_sql_ResultSetMetaData::java_sql_ResultSetMetaData( JNIEnv
* pEnv
, jobject myObj
, java_sql_Connection
& _rCon
)
36 :java_lang_Object( pEnv
, myObj
)
37 ,m_pConnection( &_rCon
)
40 SDBThreadAttach::addRef();
42 java_sql_ResultSetMetaData::~java_sql_ResultSetMetaData()
44 SDBThreadAttach::releaseRef();
47 jclass
java_sql_ResultSetMetaData::getMyClass() const
49 // The class needs to be fetched just once, that is why it is static
51 theClass
= findMyClass("java/sql/ResultSetMetaData");
56 sal_Int32 SAL_CALL
java_sql_ResultSetMetaData::getColumnDisplaySize( sal_Int32 column
)
58 static jmethodID
mID(nullptr);
59 return callIntMethodWithIntArg_ThrowSQL("getColumnDisplaySize",mID
,column
);
63 sal_Int32 SAL_CALL
java_sql_ResultSetMetaData::getColumnType( sal_Int32 column
)
65 static jmethodID
mID(nullptr);
66 return callIntMethodWithIntArg_ThrowSQL("getColumnType",mID
,column
);
70 sal_Int32 SAL_CALL
java_sql_ResultSetMetaData::getColumnCount( )
72 if ( m_nColumnCount
== -1 )
74 static jmethodID
mID(nullptr);
75 m_nColumnCount
= callIntMethod_ThrowSQL("getColumnCount", mID
);
76 } // if ( m_nColumnCount == -1 )
77 return m_nColumnCount
;
82 sal_Bool SAL_CALL
java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column
)
84 static jmethodID
mID(nullptr);
85 return callBooleanMethodWithIntArg( "isCaseSensitive", mID
,column
);
88 OUString SAL_CALL
java_sql_ResultSetMetaData::getSchemaName( sal_Int32 column
)
90 static jmethodID
mID(nullptr);
91 return callStringMethodWithIntArg("getSchemaName",mID
,column
);
95 OUString SAL_CALL
java_sql_ResultSetMetaData::getColumnName( sal_Int32 column
)
97 static jmethodID
mID(nullptr);
98 return callStringMethodWithIntArg("getColumnName",mID
,column
);
101 OUString SAL_CALL
java_sql_ResultSetMetaData::getTableName( sal_Int32 column
)
103 static jmethodID
mID(nullptr);
104 return callStringMethodWithIntArg("getTableName",mID
,column
);
107 OUString SAL_CALL
java_sql_ResultSetMetaData::getCatalogName( sal_Int32 column
)
109 static jmethodID
mID(nullptr);
110 return callStringMethodWithIntArg("getCatalogName",mID
,column
);
113 OUString SAL_CALL
java_sql_ResultSetMetaData::getColumnTypeName( sal_Int32 column
)
115 static jmethodID
mID(nullptr);
116 return callStringMethodWithIntArg("getColumnTypeName",mID
,column
);
119 OUString SAL_CALL
java_sql_ResultSetMetaData::getColumnLabel( sal_Int32 column
)
121 static jmethodID
mID(nullptr);
122 return callStringMethodWithIntArg("getColumnLabel",mID
,column
);
125 OUString SAL_CALL
java_sql_ResultSetMetaData::getColumnServiceName( sal_Int32 column
)
127 static jmethodID
mID(nullptr);
128 return callStringMethodWithIntArg("getColumnClassName",mID
,column
);
132 sal_Bool SAL_CALL
java_sql_ResultSetMetaData::isCurrency( sal_Int32 column
)
134 if ( m_pConnection
->isIgnoreCurrencyEnabled() )
136 static jmethodID
mID(nullptr);
137 return callBooleanMethodWithIntArg( "isCurrency", mID
,column
);
141 sal_Bool SAL_CALL
java_sql_ResultSetMetaData::isAutoIncrement( sal_Int32 column
)
143 static jmethodID
mID(nullptr);
144 return callBooleanMethodWithIntArg( "isAutoIncrement", mID
,column
);
148 sal_Bool SAL_CALL
java_sql_ResultSetMetaData::isSigned( sal_Int32 column
)
150 static jmethodID
mID(nullptr);
151 return callBooleanMethodWithIntArg( "isSigned", mID
,column
);
154 sal_Int32 SAL_CALL
java_sql_ResultSetMetaData::getPrecision( sal_Int32 column
)
156 static jmethodID
mID(nullptr);
157 return callIntMethodWithIntArg_ThrowSQL("getPrecision",mID
,column
);
160 sal_Int32 SAL_CALL
java_sql_ResultSetMetaData::getScale( sal_Int32 column
)
162 static jmethodID
mID(nullptr);
163 return callIntMethodWithIntArg_ThrowSQL("getScale",mID
,column
);
166 sal_Int32 SAL_CALL
java_sql_ResultSetMetaData::isNullable( sal_Int32 column
)
168 static jmethodID
mID(nullptr);
169 return callIntMethodWithIntArg_ThrowSQL("isNullable",mID
,column
);
173 sal_Bool SAL_CALL
java_sql_ResultSetMetaData::isSearchable( sal_Int32 column
)
175 static jmethodID
mID(nullptr);
176 return callBooleanMethodWithIntArg( "isSearchable", mID
,column
);
180 sal_Bool SAL_CALL
java_sql_ResultSetMetaData::isReadOnly( sal_Int32 column
)
182 static jmethodID
mID(nullptr);
183 return callBooleanMethodWithIntArg( "isReadOnly", mID
,column
);
187 sal_Bool SAL_CALL
java_sql_ResultSetMetaData::isDefinitelyWritable( sal_Int32 column
)
189 static jmethodID
mID(nullptr);
190 return callBooleanMethodWithIntArg( "isDefinitelyWritable", mID
,column
);
193 sal_Bool SAL_CALL
java_sql_ResultSetMetaData::isWritable( sal_Int32 column
)
195 static jmethodID
mID(nullptr);
196 return callBooleanMethodWithIntArg( "isWritable", mID
,column
);
200 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */