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

Generated by: LCOV version 1.10