LCOV - code coverage report
Current view: top level - connectivity/source/drivers/jdbc - Clob.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 42 0.0 %
Date: 2014-04-14 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             :     SAL_INFO( "connectivity.drivers", "jdbc Ocke.Janssen@sun.com java_sql_Clob::length" );
      53           0 :     jlong out(0);
      54           0 :     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
      55             : 
      56             :     {
      57             :         // initialize temporary variable
      58             :         static const char * cSignature = "()J";
      59             :         static const char * cMethodName = "length";
      60             :         // execute Java-Call
      61             :         static jmethodID mID(NULL);
      62           0 :         obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
      63           0 :         out = t.pEnv->CallLongMethod( object, mID );
      64           0 :         ThrowSQLException(t.pEnv,*this);
      65             :     } //t.pEnv
      66           0 :     return (sal_Int64)out;
      67             : }
      68             : 
      69           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)
      70             : {
      71             :     SAL_INFO( "connectivity.drivers", "jdbc Ocke.Janssen@sun.com java_sql_Clob::getSubString" );
      72           0 :     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
      73           0 :     OUString aStr;
      74             :     {
      75             :         // initialize temporary variable
      76             :         static const char * cSignature = "(JI)Ljava/lang/String;";
      77             :         static const char * cMethodName = "getSubString";
      78             :         // execute Java-Call
      79             :         static jmethodID mID(NULL);
      80           0 :         obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
      81           0 :         jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID,pos,subStringLength);
      82           0 :         ThrowSQLException(t.pEnv,*this);
      83           0 :         aStr = JavaString2String(t.pEnv,out);
      84             :     } //t.pEnv
      85             :     // WARNING: the caller becomes the owner of the returned pointer
      86           0 :     return  aStr;
      87             : }
      88             : 
      89           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)
      90             : {
      91             :     SAL_INFO( "connectivity.drivers", "jdbc Ocke.Janssen@sun.com java_sql_Clob::getCharacterStream" );
      92           0 :     SDBThreadAttach t;
      93             :     static jmethodID mID(NULL);
      94           0 :     jobject out = callObjectMethod(t.pEnv,"getCharacterStream","()Ljava/io/Reader;", mID);
      95             : 
      96             :     // WARNING: the caller becomes the owner of the returned pointer
      97           0 :     return out==0 ? 0 : new java_io_Reader( t.pEnv, out );
      98             : }
      99             : 
     100           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)
     101             : {
     102             :     SAL_INFO( "connectivity.drivers", "jdbc Ocke.Janssen@sun.com java_sql_Clob::position" );
     103           0 :     jlong out(0);
     104           0 :     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
     105             : 
     106             :     {
     107             :         jvalue args[1];
     108             :         // convert Parameter
     109           0 :         args[0].l = convertwchar_tToJavaString(t.pEnv,searchstr);
     110             :         // initialize temporary Variable
     111             :         static const char * cSignature = "(Ljava/lang/String;I)J";
     112             :         static const char * cMethodName = "position";
     113             :         // execute Java-Call
     114             :         static jmethodID mID(NULL);
     115           0 :         obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
     116           0 :         out = t.pEnv->CallLongMethod( object, mID, args[0].l,start );
     117           0 :         ThrowSQLException(t.pEnv,*this);
     118           0 :         t.pEnv->DeleteLocalRef((jstring)args[0].l);
     119             :     } //t.pEnv
     120           0 :     return (sal_Int64)out;
     121             : }
     122             : 
     123           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)
     124             : {
     125             :     SAL_INFO( "connectivity.drivers", "jdbc Ocke.Janssen@sun.com java_sql_Clob::positionOfClob" );
     126           0 :     ::dbtools::throwFeatureNotImplementedException( "XClob::positionOfClob", *this );
     127             :     // this was put here in CWS warnings01. The previous implementation was defective, as it did ignore
     128             :     // the pattern parameter. Since the effort for proper implementation is rather high - we would need
     129             :     // to translated patter into a byte[] -, we defer this functionality for the moment (hey, it was
     130             :     // unusable, anyway)
     131             :     // 2005-11-15 / #i57457# / frank.schoenheit@sun.com
     132           0 :     return 0;
     133             : }
     134             : 
     135             : 
     136             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10