LibreOffice Module connectivity (master) 1
SQLException.cxx
Go to the documentation of this file.
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
21
22using namespace connectivity;
23using namespace ::com::sun::star::uno;
24using namespace ::com::sun::star::sdbc;
25using namespace ::com::sun::star::lang;
26
27//************ Class: java.sql.SQLException
28
29java_sql_SQLException::java_sql_SQLException( const java_sql_SQLException_BASE& _rException,const Reference< XInterface> & _rContext)
30 : css::sdbc::SQLException( _rException.getMessage(),
31 _rContext,
32 _rException.getSQLState(),
33 _rException.getErrorCode(),
34 Any(_rException.getNextException())
35 )
36{
37}
38
40{
41}
42
44
46{}
47
48
50{
51 return st_getMyClass();
52}
54{
55 // The class needs to be fetched just once, that is why it is static
56 if( !theClass )
57 theClass = findMyClass("java/sql/SQLException");
58 return theClass;
59}
60
61css::sdbc::SQLException java_sql_SQLException_BASE::getNextException() const
62{
64 static jmethodID mID(nullptr);
65 jobject out = callObjectMethod(t.pEnv,"getNextException","()Ljava/sql/SQLException;", mID);
66 // WARNING: the caller will become the owner of the returned pointers !!!
67 if( out )
68 {
69 java_sql_SQLException_BASE warn_base(t.pEnv,out);
70 return css::sdbc::SQLException(java_sql_SQLException(warn_base,nullptr));
71 }
72
73 return css::sdbc::SQLException();
74}
75
77{
78 static jmethodID mID(nullptr);
79 return callStringMethod("getSQLState",mID);
80}
82{
83 static jmethodID mID(nullptr);
84 return callIntMethod_ThrowSQL("getErrorCode", mID);
85}
86
87/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XPropertyListType t
jobject callObjectMethod(JNIEnv *pEnv, const char *_pMethodName, const char *_pSignature, jmethodID &_inout_MethodID) const
Definition: Object.cxx:404
sal_Int32 callIntMethod_ThrowSQL(const char *_pMethodName, jmethodID &_inout_MethodID) const
Definition: Object.cxx:286
OUString callStringMethod(const char *_pMethodName, jmethodID &_inout_MethodID) const
Definition: Object.cxx:394
static jclass findMyClass(const char *_pClassName)
Definition: Object.cxx:466
css::sdbc::SQLException getNextException() const
virtual jclass getMyClass() const override
java_sql_SQLException_BASE(JNIEnv *pEnv, jobject myObj)