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/Array.hxx"
21 : #include "java/tools.hxx"
22 : #include "java/sql/ResultSet.hxx"
23 :
24 : using namespace connectivity;
25 :
26 : //************ Class: java.sql.Array
27 :
28 :
29 : jclass java_sql_Array::theClass = 0;
30 :
31 0 : java_sql_Array::~java_sql_Array()
32 0 : {}
33 :
34 0 : jclass java_sql_Array::getMyClass() const
35 : {
36 : // the class must be fetched once, therefore its static
37 0 : if( !theClass )
38 0 : theClass = findMyClass("java/sql/Array");
39 :
40 0 : return theClass;
41 : }
42 :
43 0 : OUString SAL_CALL java_sql_Array::getBaseTypeName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
44 : {
45 : static jmethodID mID(NULL);
46 0 : return callStringMethod("getBaseTypeName",mID);
47 : }
48 :
49 0 : sal_Int32 SAL_CALL java_sql_Array::getBaseType( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
50 : {
51 : static jmethodID mID(NULL);
52 0 : return callIntMethod("getBaseType",mID);
53 : }
54 :
55 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL java_sql_Array::getArray( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
56 : {
57 0 : SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
58 : {
59 0 : jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap);
60 : static const char * cSignature = "(Ljava/util/Map;)[Ljava/lang/Object;";
61 : static const char * cMethodName = "getArray";
62 : static jmethodID mID(NULL);
63 0 : obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
64 : // submit Java-Call
65 0 : t.pEnv->CallObjectMethod( object, mID, obj);
66 0 : ThrowSQLException(t.pEnv,*this);
67 : // and clean up
68 0 : t.pEnv->DeleteLocalRef(obj);
69 : } //t.pEnv
70 0 : return ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >();
71 : }
72 :
73 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL java_sql_Array::getArrayAtIndex( sal_Int32 index, sal_Int32 count, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
74 : {
75 0 : SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
76 : {
77 0 : jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap);
78 : static const char * cSignature = "(IILjava/util/Map;)[Ljava/lang/Object;";
79 : static const char * cMethodName = "getArray";
80 : // submit Java-Call
81 : static jmethodID mID(NULL);
82 0 : obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
83 0 : t.pEnv->CallObjectMethod( object, mID, index,count,obj);
84 0 : ThrowSQLException(t.pEnv,*this);
85 : // and clean up
86 0 : t.pEnv->DeleteLocalRef(obj);
87 : }
88 0 : return ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >();
89 : }
90 :
91 0 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_Array::getResultSet( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
92 : {
93 0 : SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
94 : {
95 : // convert Parameter
96 0 : jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap);
97 : // initialize temporary variable
98 : static const char * cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;";
99 : static const char * cMethodName = "getResultSet";
100 : // submit Java-Call
101 : static jmethodID mID(NULL);
102 0 : obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
103 0 : t.pEnv->CallObjectMethod( object, mID, obj);
104 0 : ThrowSQLException(t.pEnv,*this);
105 : // and cleanup
106 0 : t.pEnv->DeleteLocalRef(obj);
107 : }
108 0 : return NULL;
109 : }
110 :
111 0 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_Array::getResultSetAtIndex( sal_Int32 index, sal_Int32 count, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
112 : {
113 0 : SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
114 : {
115 : // convert parameter
116 0 : jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap);
117 : // initialize temporary variable
118 : static const char * cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;";
119 : static const char * cMethodName = "getResultSetAtIndex";
120 : // submit Java-Call
121 : static jmethodID mID(NULL);
122 0 : obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
123 0 : t.pEnv->CallObjectMethod( object, mID, index,count,obj);
124 0 : ThrowSQLException(t.pEnv,*this);
125 : // and cleanup
126 0 : t.pEnv->DeleteLocalRef(obj);
127 : }
128 0 : return NULL;
129 : }
130 :
131 :
132 :
133 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|