LCOV - code coverage report
Current view: top level - libreoffice/connectivity/source/inc/odbc - OBoundParam.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 26 0.0 %
Date: 2012-12-27 Functions: 0 8 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             : #ifndef _CONNECTIVITY_OBOUNPARAM_HXX_
      20             : #define _CONNECTIVITY_OBOUNPARAM_HXX_
      21             : 
      22             : #include <com/sun/star/io/XInputStream.hpp>
      23             : #include <com/sun/star/sdbc/DataType.hpp>
      24             : #include "odbc/odbcbasedllapi.hxx"
      25             : 
      26             : namespace connectivity
      27             : {
      28             :     namespace odbc
      29             :     {
      30             :         class OOO_DLLPUBLIC_ODBCBASE OBoundParam
      31             :         {
      32             : 
      33             :         public:
      34           0 :             OBoundParam()
      35             :                 : binaryData(NULL)
      36             :                 , paramInputStreamLen(0)
      37             :                 , sqlType(::com::sun::star::sdbc::DataType::SQLNULL)
      38           0 :                 , outputParameter(false)
      39             :             {
      40           0 :             }
      41           0 :             ~OBoundParam()
      42           0 :             {
      43           0 :                 free(binaryData);
      44           0 :             }
      45             :             //--------------------------------------------------------------------
      46             :             // allocBindDataBuffer
      47             :             // Allocates and returns a new bind data buffer of the specified
      48             :             // length
      49             :             //--------------------------------------------------------------------
      50           0 :             void* allocBindDataBuffer (sal_Int32 bufLen)
      51             :             {
      52             :                 // Reset the input stream and sequence, we are doing a new bind
      53           0 :                 setInputStream (NULL, 0);
      54           0 :                 aSequence.realloc(0);
      55             : 
      56           0 :                 free(binaryData);
      57           0 :                 binaryData = (bufLen > 0) ? malloc(bufLen) : NULL;
      58             : 
      59           0 :                 return binaryData;
      60             :             }
      61             : 
      62             :             //--------------------------------------------------------------------
      63             :             // getBindDataBuffer
      64             :             // Returns the data buffer to be used when binding to a parameter
      65             :             //--------------------------------------------------------------------
      66             :             void* getBindDataBuffer ()
      67             :             {
      68             :                 return binaryData;
      69             :             }
      70             : 
      71             :             //--------------------------------------------------------------------
      72             :             // getBindLengthBuffer
      73             :             // Returns the length buffer to be used when binding to a parameter
      74             :             //--------------------------------------------------------------------
      75           0 :             SQLLEN* getBindLengthBuffer ()
      76             :             {
      77           0 :                 return &paramLength;
      78             :             }
      79             : 
      80             :             //--------------------------------------------------------------------
      81             :             // setInputStream
      82             :             // Sets the input stream for the bound parameter
      83             :             //--------------------------------------------------------------------
      84           0 :             void setInputStream(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& inputStream,
      85             :                                 sal_Int32 len)
      86             :             {
      87           0 :                 paramInputStream = inputStream;
      88           0 :                 paramInputStreamLen = len;
      89           0 :             }
      90             : 
      91           0 :             void setSequence(const ::com::sun::star::uno::Sequence< sal_Int8 >& _aSequence)
      92             :             {
      93           0 :                 aSequence = _aSequence;
      94           0 :             }
      95             : 
      96             :             //--------------------------------------------------------------------
      97             :             // getInputStream
      98             :             // Gets the input stream for the bound parameter
      99             :             //--------------------------------------------------------------------
     100           0 :             ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> getInputStream ()
     101             :             {
     102           0 :                 return paramInputStream;
     103             :             }
     104             : 
     105             :             //--------------------------------------------------------------------
     106             :             // getInputStreamLen
     107             :             // Gets the input stream length for the bound parameter
     108             :             //--------------------------------------------------------------------
     109           0 :             sal_Int32 getInputStreamLen ()
     110             :             {
     111           0 :                 return paramInputStreamLen;
     112             :             }
     113             : 
     114             :             //--------------------------------------------------------------------
     115             :             // setSqlType
     116             :             // Sets the Java sql type used to register an OUT parameter
     117             :             //--------------------------------------------------------------------
     118             : 
     119             :             void setSqlType(sal_Int32 type)
     120             :             {
     121             :                 sqlType = type;
     122             :             }
     123             : 
     124             :             //--------------------------------------------------------------------
     125             :             // getSqlType
     126             :             // Gets the Java sql type used to register an OUT parameter
     127             :             //--------------------------------------------------------------------
     128             : 
     129             :             sal_Int32 getSqlType ()
     130             :             {
     131             :                 return sqlType;
     132             :             }
     133             : 
     134             :             //--------------------------------------------------------------------
     135             :             // setOutputParameter
     136             :             // Sets the flag indicating if this is an OUTPUT parameter
     137             :             //--------------------------------------------------------------------
     138             : 
     139             :             void setOutputParameter (sal_Bool output)
     140             :             {
     141             :                 outputParameter = output;
     142             :             }
     143             : 
     144             :             //--------------------------------------------------------------------
     145             :             // isOutputParameter
     146             :             // Gets the OUTPUT parameter flag
     147             :             //--------------------------------------------------------------------
     148             : 
     149             :             sal_Bool isOutputParameter ()
     150             :             {
     151             :                 return outputParameter;
     152             :             }
     153             : 
     154             :         protected:
     155             :             //====================================================================
     156             :             // Data attributes
     157             :             //====================================================================
     158             : 
     159             :             void  *binaryData;       // Storage area to be used
     160             :                                      // when binding the parameter
     161             : 
     162             :             SQLLEN paramLength;      // Storage area to be used
     163             :                                      // for the bound length of the
     164             :                                      // parameter.  Note that this
     165             :                                      // data is in native format.
     166             : 
     167             :             ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> paramInputStream;
     168             :             ::com::sun::star::uno::Sequence< sal_Int8 > aSequence;
     169             :                                         // When an input stream is
     170             :                                         // bound to a parameter, a
     171             :                                         // reference to the input stream is saved
     172             :                                         // until not needed anymore.
     173             : 
     174             :             sal_Int32 paramInputStreamLen;                // Length of input stream
     175             : 
     176             :             sal_Int32 sqlType;                          // Java SQL type used to
     177             :                                                             // register an OUT parameter
     178             : 
     179             :             sal_Bool outputParameter;   // true for OUTPUT parameters
     180             :         };
     181             :     }
     182             : }
     183             : #endif // _CONNECTIVITY_OBOUNPARAM_HXX_
     184             : 
     185             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10