1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_TOOLS_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_TOOLS_HXX
23 #include <com/sun/star/beans/PropertyValue.hpp>
24 #include <com/sun/star/uno/Sequence.h>
27 #include "java/sql/SQLException.hxx"
28 #include <comphelper/uno3.hxx>
30 #include <com/sun/star/container/XNameAccess.hpp>
31 #include <com/sun/star/io/XInputStream.hpp>
32 #include <com/sun/star/util/Time.hpp>
33 #include <com/sun/star/util/Date.hpp>
34 #include <com/sun/star/util/DateTime.hpp>
37 namespace connectivity
40 jstring
convertwchar_tToJavaString(JNIEnv
*pEnv
,const OUString
& _Temp
);
41 OUString
JavaString2String(JNIEnv
*pEnv
,jstring _Str
);
42 class java_util_Properties
;
44 java_util_Properties
* createStringPropertyArray(const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& info
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
46 template<class T
,class JT
> ::com::sun::star::uno::Sequence
< T
> copyArrayAndDelete(JNIEnv
*pEnv
,jobjectArray _Array
, const T
*, const JT
* )
48 ::com::sun::star::uno::Sequence
< T
> xOut
;
51 jsize nLen
= pEnv
->GetArrayLength(_Array
);
53 for(jsize i
=0;i
<nLen
;++i
)
55 JT
xInfo(pEnv
,pEnv
->GetObjectArrayElement(_Array
,i
));
56 java_lang_Object::ThrowSQLException(pEnv
,NULL
);
57 xOut
.getArray()[i
] = xInfo
;
59 pEnv
->DeleteLocalRef(_Array
);
64 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> Map2XNameAccess(JNIEnv
*pEnv
,jobject _pMap
);
65 jobject
convertTypeMapToJavaMap(JNIEnv
*pEnv
,const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> & _rMap
);
67 /** return if a exception occurred
71 <TRUE/> if the exception should be cleared
73 <TRUE/> if an exception is occurred
75 bool isExceptionOccurred(JNIEnv
*pEnv
,bool _bClear
);
77 jobject
createByteInputStream(const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& x
,sal_Int32 length
);
78 jobject
createCharArrayReader(const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& x
,sal_Int32 length
);
81 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_TOOLS_HXX
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */