LCOV - code coverage report
Current view: top level - connectivity/source/drivers/jdbc - Clob.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 42 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 9 0.0 %
Legend: Lines: hit not hit

          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/Clob.hxx"
      21             : #include "java/tools.hxx"
      22             : #include "java/io/Reader.hxx"
      23             : #include <connectivity/dbexception.hxx>
      24             : 
      25             : using namespace connectivity;
      26             : 
      27             : //************ Class: java.sql.Clob
      28             : 
      29             : 
      30             : jclass java_sql_Clob::theClass = 0;
      31             : 
      32           0 : java_sql_Clob::java_sql_Clob( JNIEnv * pEnv, jobject myObj )
      33           0 :     : java_lang_Object( pEnv, myObj )
      34             : {
      35           0 :     SDBThreadAttach::addRef();
      36           0 : }
      37           0 : java_sql_Clob::~java_sql_Clob()
      38             : {
      39           0 :     SDBThreadAttach::releaseRef();
      40           0 : }
      41             : 
      42           0 : jclass java_sql_Clob::getMyClass() const
      43             : {
      44             :     // the class must be fetched only once, therefore static
      45           0 :     if( !theClass )
      46           0 :         theClass = findMyClass("java/sql/Clob");
      47           0 :     return theClass;
      48             : }
      49             : 
      50           0 : sal_Int64 SAL_CALL java_sql_Clob::length(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
      51             : {
      52           0 :     jlong out(0);
      53           0 :     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
      54             : 
      55             :     {
      56             :         // initialize temporary variable
      57             :         static const char * cSignature = "()J";
      58             :         static const char * cMethodName = "length";
      59             :         // execute Java-Call
      60             :         static jmethodID mID(NULL);
      61           0 :         obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
      62           0 :         out = t.pEnv->CallLongMethod( object, mID );
      63           0 :         ThrowSQLException(t.pEnv,*this);
      64             :     } //t.pEnv
      65           0 :     return (sal_Int64)out;
      66             : }
      67             : 
      68           0 : OUString SAL_CALL java_sql_Clob::getSubString( sal_Int64 pos, sal_Int32 subStringLength ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
      69             : {
      70           0 :     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
      71           0 :     OUString aStr;
      72             :     {
      73             :         // initialize temporary variable
      74             :         static const char * cSignature = "(JI)Ljava/lang/String;";
      75             :         static const char * cMethodName = "getSubString";
      76             :         // execute Java-Call
      77             :         static jmethodID mID(NULL);
      78           0 :         obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
      79           0 :         jstring out = static_cast<jstring>(t.pEnv->CallObjectMethod( object, mID,pos,subStringLength));
      80           0 :         ThrowSQLException(t.pEnv,*this);
      81           0 :         aStr = JavaString2String(t.pEnv,out);
      82             :     } //t.pEnv
      83             :     // WARNING: the caller becomes the owner of the returned pointer
      84           0 :     return  aStr;
      85             : }
      86             : 
      87           0 : ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_Clob::getCharacterStream(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
      88             : {
      89           0 :     SDBThreadAttach t;
      90             :     static jmethodID mID(NULL);
      91           0 :     jobject out = callObjectMethod(t.pEnv,"getCharacterStream","()Ljava/io/Reader;", mID);
      92             : 
      93             :     // WARNING: the caller becomes the owner of the returned pointer
      94           0 :     return out==0 ? 0 : new java_io_Reader( t.pEnv, out );
      95             : }
      96             : 
      97           0 : sal_Int64 SAL_CALL java_sql_Clob::position( const OUString& searchstr, sal_Int32 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
      98             : {
      99           0 :     jlong out(0);
     100           0 :     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
     101             : 
     102             :     {
     103             :         jvalue args[1];
     104             :         // convert Parameter
     105           0 :         args[0].l = convertwchar_tToJavaString(t.pEnv,searchstr);
     106             :         // initialize temporary Variable
     107             :         static const char * cSignature = "(Ljava/lang/String;I)J";
     108             :         static const char * cMethodName = "position";
     109             :         // execute Java-Call
     110             :         static jmethodID mID(NULL);
     111           0 :         obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
     112           0 :         out = t.pEnv->CallLongMethod( object, mID, args[0].l,start );
     113           0 :         ThrowSQLException(t.pEnv,*this);
     114           0 :         t.pEnv->DeleteLocalRef(static_cast<jstring>(args[0].l));
     115             :     } //t.pEnv
     116           0 :     return (sal_Int64)out;
     117             : }
     118             : 
     119           0 : sal_Int64 SAL_CALL java_sql_Clob::positionOfClob( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& /*pattern*/, sal_Int64 /*start*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
     120             : {
     121           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XClob::positionOfClob", *this );
     122             :     // this was put here in CWS warnings01. The previous implementation was defective, as it did ignore
     123             :     // the pattern parameter. Since the effort for proper implementation is rather high - we would need
     124             :     // to translated patter into a byte[] -, we defer this functionality for the moment (hey, it was
     125             :     // unusable, anyway)
     126             :     // 2005-11-15 / #i57457# / frank.schoenheit@sun.com
     127           0 :     return 0;
     128             : }
     129             : 
     130             : 
     131             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11