1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_connectivity.hxx"
26 #include "java/math/BigDecimal.hxx"
27 #include "java/tools.hxx"
28 #include "resource/jdbc_log.hrc"
29 using namespace connectivity;
30 //**************************************************************
31 //************ Class: java.lang.Boolean
32 //**************************************************************
33 
34 jclass java_math_BigDecimal::theClass = 0;
35 
~java_math_BigDecimal()36 java_math_BigDecimal::~java_math_BigDecimal()
37 {}
38 
getMyClass() const39 jclass java_math_BigDecimal::getMyClass() const
40 {
41 	// die Klasse muss nur einmal geholt werden, daher statisch
42 	if( !theClass )
43         theClass = findMyClass("java/math/BigDecimal");
44 	return theClass;
45 }
46 
java_math_BigDecimal(const::rtl::OUString & _par0)47 java_math_BigDecimal::java_math_BigDecimal( const ::rtl::OUString& _par0 ): java_lang_Object( NULL, (jobject)NULL )
48 {
49 	SDBThreadAttach t;
50 	if( !t.pEnv )
51 		return;
52 	// Java-Call fuer den Konstruktor absetzen
53 	// temporaere Variable initialisieren
54 	static const char * cSignature = "(Ljava/lang/String;)V";
55 	jobject tempObj;
56 	static jmethodID mID(NULL);
57     obtainMethodId(t.pEnv, "<init>",cSignature, mID);
58 
59     jstring str = convertwchar_tToJavaString(t.pEnv,_par0.replace(',','.'));
60 	tempObj = t.pEnv->NewObject( getMyClass(), mID, str );
61     t.pEnv->DeleteLocalRef(str);
62 	saveRef( t.pEnv, tempObj );
63 	t.pEnv->DeleteLocalRef( tempObj );
64     ThrowSQLException( t.pEnv, NULL );
65 	// und aufraeumen
66 }
67 
java_math_BigDecimal(const double & _par0)68 java_math_BigDecimal::java_math_BigDecimal( const double& _par0 ): java_lang_Object( NULL, (jobject)NULL )
69 {
70 	SDBThreadAttach t;
71 	if( !t.pEnv )
72 		return;
73 	// Java-Call fuer den Konstruktor absetzen
74 	// temporaere Variable initialisieren
75 	static const char * cSignature = "(D)V";
76 	jobject tempObj;
77 	static jmethodID mID(NULL);
78     obtainMethodId(t.pEnv, "<init>",cSignature, mID);
79 	tempObj = t.pEnv->NewObject( getMyClass(), mID, _par0 );
80 	saveRef( t.pEnv, tempObj );
81 	t.pEnv->DeleteLocalRef( tempObj );
82     ThrowSQLException( t.pEnv, NULL );
83 	// und aufraeumen
84 }
85 
86