1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_connectivity.hxx"
30 #include "java/sql/SQLException.hxx"
31 #include "java/tools.hxx"
32 
33 using namespace connectivity;
34 using namespace ::com::sun::star::uno;
35 using namespace ::com::sun::star::beans;
36 //	using namespace ::com::sun::star::sdbcx;
37 using namespace ::com::sun::star::sdbc;
38 using namespace ::com::sun::star::container;
39 using namespace ::com::sun::star::lang;
40 //**************************************************************
41 //************ Class: java.sql.SQLException
42 //**************************************************************
43 java_sql_SQLException::java_sql_SQLException( const java_sql_SQLException_BASE& _rException,const Reference< XInterface> & _rContext)
44 	: starsdbc::SQLException(	_rException.getMessage(),
45 								_rContext,
46 								_rException.getSQLState(),
47 								_rException.getErrorCode(),
48 								makeAny(_rException.getNextException())
49 							)
50 {
51 }
52 
53 java_sql_SQLException_BASE::java_sql_SQLException_BASE( JNIEnv * pEnv, jobject myObj ) : java_lang_Exception( pEnv, myObj )
54 {
55 }
56 
57 jclass java_sql_SQLException_BASE::theClass = 0;
58 
59 java_sql_SQLException_BASE::~java_sql_SQLException_BASE()
60 {}
61 
62 
63 jclass java_sql_SQLException_BASE::getMyClass() const
64 {
65     return st_getMyClass();
66 }
67 jclass java_sql_SQLException_BASE::st_getMyClass()
68 {
69 	// die Klasse muss nur einmal geholt werden, daher statisch
70 	if( !theClass )
71         theClass = findMyClass("java/sql/SQLException");
72 	return theClass;
73 }
74 
75 starsdbc::SQLException java_sql_SQLException_BASE::getNextException()  const
76 {
77 	SDBThreadAttach t;
78     static jmethodID mID(NULL);
79     jobject out = callObjectMethod(t.pEnv,"getNextException","()Ljava/sql/SQLException;", mID);
80 	// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
81 	if( out )
82 	{
83 		java_sql_SQLException_BASE	warn_base(t.pEnv,out);
84 		return (starsdbc::SQLException)java_sql_SQLException(warn_base,0);
85 	}
86 
87 	return starsdbc::SQLException();
88 }
89 
90 ::rtl::OUString java_sql_SQLException_BASE::getSQLState() const
91 {
92     static jmethodID mID(NULL);
93     return callStringMethod("getSQLState",mID);
94 }
95 sal_Int32 java_sql_SQLException_BASE::getErrorCode() const
96 {
97     static jmethodID mID(NULL);
98     return callIntMethod("getErrorCode",mID);
99 }
100 
101