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/SQLException.hxx"
21 : #include "java/tools.hxx"
22 :
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;
29 :
30 : //************ Class: java.sql.SQLException
31 :
32 0 : java_sql_SQLException::java_sql_SQLException( const java_sql_SQLException_BASE& _rException,const Reference< XInterface> & _rContext)
33 : : css::sdbc::SQLException( _rException.getMessage(),
34 : _rContext,
35 : _rException.getSQLState(),
36 0 : _rException.getErrorCode(),
37 : makeAny(_rException.getNextException())
38 0 : )
39 : {
40 0 : }
41 :
42 1 : java_sql_SQLException_BASE::java_sql_SQLException_BASE( JNIEnv * pEnv, jobject myObj ) : java_lang_Exception( pEnv, myObj )
43 : {
44 1 : }
45 :
46 : jclass java_sql_SQLException_BASE::theClass = 0;
47 :
48 2 : java_sql_SQLException_BASE::~java_sql_SQLException_BASE()
49 2 : {}
50 :
51 :
52 3 : jclass java_sql_SQLException_BASE::getMyClass() const
53 : {
54 3 : return st_getMyClass();
55 : }
56 13 : jclass java_sql_SQLException_BASE::st_getMyClass()
57 : {
58 : // The class needs to be fetched just once, that is why it is static
59 13 : if( !theClass )
60 4 : theClass = findMyClass("java/sql/SQLException");
61 13 : return theClass;
62 : }
63 :
64 0 : css::sdbc::SQLException java_sql_SQLException_BASE::getNextException() const
65 : {
66 0 : SDBThreadAttach t;
67 : static jmethodID mID(NULL);
68 0 : jobject out = callObjectMethod(t.pEnv,"getNextException","()Ljava/sql/SQLException;", mID);
69 : // WARNING: the caller will become the owner of the returned pointers !!!
70 0 : if( out )
71 : {
72 0 : java_sql_SQLException_BASE warn_base(t.pEnv,out);
73 0 : return css::sdbc::SQLException(java_sql_SQLException(warn_base,0));
74 : }
75 :
76 0 : return css::sdbc::SQLException();
77 : }
78 :
79 1 : OUString java_sql_SQLException_BASE::getSQLState() const
80 : {
81 : static jmethodID mID(NULL);
82 1 : return callStringMethod("getSQLState",mID);
83 : }
84 1 : sal_Int32 java_sql_SQLException_BASE::getErrorCode() const
85 : {
86 : static jmethodID mID(NULL);
87 1 : return callIntMethod_ThrowSQL("getErrorCode", mID);
88 : }
89 :
90 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|