LCOV - code coverage report
Current view: top level - connectivity/source/drivers/firebird - Util.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 2 2 100.0 %
Date: 2014-11-03 Functions: 1 1 100.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             : 
      10             : #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_UTIL_HXX
      11             : #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_UTIL_HXX
      12             : 
      13             : #include <ibase.h>
      14             : 
      15             : #include <rtl/ustring.hxx>
      16             : 
      17             : #include <com/sun/star/sdbc/DataType.hpp>
      18             : #include <com/sun/star/sdbc/SQLException.hpp>
      19             : 
      20             : namespace connectivity
      21             : {
      22             :     namespace firebird
      23             :     {
      24             : 
      25             :         /**
      26             :          * Make sure an identifier is safe to use within the databse. Currently
      27             :          * firebird seems to return identifiers with 93 character (instead of
      28             :          * 31), whereby the name is simply padded with trailing whitespace.
      29             :          * This removes all trailing whitespace (i.e. if necessary so that
      30             :          * the length is below 31 characters). Firebird automatically compensates
      31             :          * for such shorter strings, however any trailing padding makes the gui
      32             :          * editing of such names harder, hence we remove all trailing whitespace.
      33             :          */
      34             :         OUString sanitizeIdentifier(const OUString& rIdentifier);
      35             : 
      36          48 :         inline bool IndicatesError(const ISC_STATUS_ARRAY& rStatusVector)
      37             :         {
      38          48 :             return rStatusVector[0]==1 && rStatusVector[1]; // indicates error;
      39             :         }
      40             : 
      41             :         OUString StatusVectorToString(const ISC_STATUS_ARRAY& rStatusVector,
      42             :                                     const OUString& rCause);
      43             : 
      44             :         /**
      45             :          * Evaluate a firebird status vector and throw exceptions as necessary.
      46             :          * The content of the status vector is included in the thrown exception.
      47             :          */
      48             :         void evaluateStatusVector(const ISC_STATUS_ARRAY& rStatusVector,
      49             :                                   const ::rtl::OUString& aCause,
      50             :                                   const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext)
      51             :                 throw (::com::sun::star::sdbc::SQLException);
      52             : 
      53             :         sal_Int32 getColumnTypeFromFBType(short aType);
      54             :         ::rtl::OUString getColumnTypeNameFromFBType(short aType);
      55             : 
      56             :         /**
      57             :          * Internally (i.e. in RDB$FIELD_TYPE) firebird stores the data type
      58             :          * for a column as defined in blr_*, however in the firebird
      59             :          * api the SQL_* types are used, hence we need to be able to convert
      60             :          * between the two when retrieving column metadata.
      61             :          */
      62             :         short getFBTypeFromBlrType(short blrType);
      63             : 
      64             :         void mallocSQLVAR(XSQLDA* pSqlda);
      65             : 
      66             :         void freeSQLVAR(XSQLDA* pSqlda);
      67             :     }
      68             : }
      69             : #endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_UTIL_HXX
      70             : 
      71             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10