1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_connectivity.hxx"
26 #include "java/sql/SQLException.hxx"
27 #include "java/tools.hxx"
28
29 using namespace connectivity;
30 using namespace ::com::sun::star::uno;
31 using namespace ::com::sun::star::beans;
32 // using namespace ::com::sun::star::sdbcx;
33 using namespace ::com::sun::star::sdbc;
34 using namespace ::com::sun::star::container;
35 using namespace ::com::sun::star::lang;
36 //**************************************************************
37 //************ Class: java.sql.SQLException
38 //**************************************************************
java_sql_SQLException(const java_sql_SQLException_BASE & _rException,const Reference<XInterface> & _rContext)39 java_sql_SQLException::java_sql_SQLException( const java_sql_SQLException_BASE& _rException,const Reference< XInterface> & _rContext)
40 : starsdbc::SQLException( _rException.getMessage(),
41 _rContext,
42 _rException.getSQLState(),
43 _rException.getErrorCode(),
44 makeAny(_rException.getNextException())
45 )
46 {
47 }
48
java_sql_SQLException_BASE(JNIEnv * pEnv,jobject myObj)49 java_sql_SQLException_BASE::java_sql_SQLException_BASE( JNIEnv * pEnv, jobject myObj ) : java_lang_Exception( pEnv, myObj )
50 {
51 }
52
53 jclass java_sql_SQLException_BASE::theClass = 0;
54
~java_sql_SQLException_BASE()55 java_sql_SQLException_BASE::~java_sql_SQLException_BASE()
56 {}
57
58
getMyClass() const59 jclass java_sql_SQLException_BASE::getMyClass() const
60 {
61 return st_getMyClass();
62 }
st_getMyClass()63 jclass java_sql_SQLException_BASE::st_getMyClass()
64 {
65 // die Klasse muss nur einmal geholt werden, daher statisch
66 if( !theClass )
67 theClass = findMyClass("java/sql/SQLException");
68 return theClass;
69 }
70
getNextException() const71 starsdbc::SQLException java_sql_SQLException_BASE::getNextException() const
72 {
73 SDBThreadAttach t;
74 static jmethodID mID(NULL);
75 jobject out = callObjectMethod(t.pEnv,"getNextException","()Ljava/sql/SQLException;", mID);
76 // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
77 if( out )
78 {
79 java_sql_SQLException_BASE warn_base(t.pEnv,out);
80 return (starsdbc::SQLException)java_sql_SQLException(warn_base,0);
81 }
82
83 return starsdbc::SQLException();
84 }
85
getSQLState() const86 ::rtl::OUString java_sql_SQLException_BASE::getSQLState() const
87 {
88 static jmethodID mID(NULL);
89 return callStringMethod("getSQLState",mID);
90 }
getErrorCode() const91 sal_Int32 java_sql_SQLException_BASE::getErrorCode() const
92 {
93 static jmethodID mID(NULL);
94 return callIntMethod("getErrorCode",mID);
95 }
96
97