tdf#150789 - FILEOPEN PPTX: fix text in SmartArt vertically off
[LibreOffice.git] / connectivity / source / drivers / jdbc / Array.cxx
blobd03b019283d206add4d65a5980d54e64a3ff3044
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/Array.hxx>
21 #include <java/tools.hxx>
22 #include <osl/diagnose.h>
24 using namespace connectivity;
26 //************ Class: java.sql.Array
29 jclass java_sql_Array::theClass = nullptr;
31 java_sql_Array::~java_sql_Array()
34 jclass java_sql_Array::getMyClass() const
36 // the class must be fetched once, therefore it's static
37 if( !theClass )
38 theClass = findMyClass("java/sql/Array");
40 return theClass;
43 OUString SAL_CALL java_sql_Array::getBaseTypeName( )
45 static jmethodID mID(nullptr);
46 return callStringMethod("getBaseTypeName",mID);
49 sal_Int32 SAL_CALL java_sql_Array::getBaseType( )
51 static jmethodID mID(nullptr);
52 return callIntMethod_ThrowSQL("getBaseType", mID);
55 css::uno::Sequence< css::uno::Any > SAL_CALL java_sql_Array::getArray( const css::uno::Reference< css::container::XNameAccess >& typeMap )
57 SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java environment has been deleted!");
59 jobject obj = convertTypeMapToJavaMap(typeMap);
60 static const char * const cSignature = "(Ljava/util/Map;)[Ljava/lang/Object;";
61 static const char * const cMethodName = "getArray";
62 static jmethodID mID(nullptr);
63 obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
64 // submit Java-Call
65 t.pEnv->CallObjectMethod( object, mID, obj);
66 ThrowSQLException(t.pEnv,*this);
67 // and clean up
68 t.pEnv->DeleteLocalRef(obj);
69 } //t.pEnv
70 return css::uno::Sequence< css::uno::Any >();
73 css::uno::Sequence< css::uno::Any > SAL_CALL java_sql_Array::getArrayAtIndex( sal_Int32 index, sal_Int32 count, const css::uno::Reference< css::container::XNameAccess >& typeMap )
75 SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java environment has been deleted!");
77 jobject obj = convertTypeMapToJavaMap(typeMap);
78 static const char * const cSignature = "(IILjava/util/Map;)[Ljava/lang/Object;";
79 static const char * const cMethodName = "getArray";
80 // submit Java-Call
81 static jmethodID mID(nullptr);
82 obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
83 t.pEnv->CallObjectMethod( object, mID, index,count,obj);
84 ThrowSQLException(t.pEnv,*this);
85 // and clean up
86 t.pEnv->DeleteLocalRef(obj);
88 return css::uno::Sequence< css::uno::Any >();
91 css::uno::Reference< css::sdbc::XResultSet > SAL_CALL java_sql_Array::getResultSet( const css::uno::Reference< css::container::XNameAccess >& typeMap )
93 SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java environment has been deleted!");
95 // convert Parameter
96 jobject obj = convertTypeMapToJavaMap(typeMap);
97 // initialize temporary variable
98 static const char * const cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;";
99 static const char * const cMethodName = "getResultSet";
100 // submit Java-Call
101 static jmethodID mID(nullptr);
102 obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
103 t.pEnv->CallObjectMethod( object, mID, obj);
104 ThrowSQLException(t.pEnv,*this);
105 // and cleanup
106 t.pEnv->DeleteLocalRef(obj);
108 return nullptr;
111 css::uno::Reference< css::sdbc::XResultSet > SAL_CALL java_sql_Array::getResultSetAtIndex( sal_Int32 index, sal_Int32 count, const css::uno::Reference< css::container::XNameAccess >& typeMap )
113 SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java environment has been deleted!");
115 // convert parameter
116 jobject obj = convertTypeMapToJavaMap(typeMap);
117 // initialize temporary variable
118 static const char * const cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;";
119 static const char * const cMethodName = "getResultSetAtIndex";
120 // submit Java-Call
121 static jmethodID mID(nullptr);
122 obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
123 t.pEnv->CallObjectMethod( object, mID, index,count,obj);
124 ThrowSQLException(t.pEnv,*this);
125 // and cleanup
126 t.pEnv->DeleteLocalRef(obj);
128 return nullptr;
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */