LCOV - code coverage report
Current view: top level - connectivity/source/drivers/postgresql - pq_tools.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 4 0.0 %
Date: 2014-11-03 Functions: 0 3 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             :  *
       4             :  *  Effective License of whole file:
       5             :  *
       6             :  *    This library is free software; you can redistribute it and/or
       7             :  *    modify it under the terms of the GNU Lesser General Public
       8             :  *    License version 2.1, as published by the Free Software Foundation.
       9             :  *
      10             :  *    This library is distributed in the hope that it will be useful,
      11             :  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
      12             :  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      13             :  *    Lesser General Public License for more details.
      14             :  *
      15             :  *    You should have received a copy of the GNU Lesser General Public
      16             :  *    License along with this library; if not, write to the Free Software
      17             :  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
      18             :  *    MA  02111-1307  USA
      19             :  *
      20             :  *  Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
      21             :  *
      22             :  *    The Contents of this file are made available subject to the terms of
      23             :  *    the GNU Lesser General Public License Version 2.1
      24             :  *
      25             :  *    Copyright: 2000 by Sun Microsystems, Inc.
      26             :  *
      27             :  *    Contributor(s): Joerg Budischewski
      28             :  *
      29             :  *  All parts contributed on or after August 2011:
      30             :  *
      31             :  *    This Source Code Form is subject to the terms of the Mozilla Public
      32             :  *    License, v. 2.0. If a copy of the MPL was not distributed with this
      33             :  *    file, You can obtain one at http://mozilla.org/MPL/2.0/.
      34             :  *
      35             :  ************************************************************************/
      36             : 
      37             : #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_TOOLS_HXX
      38             : #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_TOOLS_HXX
      39             : 
      40             : #include <com/sun/star/beans/XPropertySet.hpp>
      41             : #include <com/sun/star/sdbc/XParameters.hpp>
      42             : #include <com/sun/star/util/Date.hpp>
      43             : #include <com/sun/star/util/Time.hpp>
      44             : #include <com/sun/star/util/DateTime.hpp>
      45             : 
      46             : #include <rtl/ustrbuf.hxx>
      47             : #include <rtl/string.hxx>
      48             : 
      49             : #include "pq_connection.hxx"
      50             : namespace pq_sdbc_driver
      51             : {
      52             : bool isWhitespace( sal_Unicode c );
      53             : 
      54             : OUString concatQualified( const OUString & a, const OUString &b);
      55             : 
      56             : OString OUStringToOString( const OUString& str, ConnectionSettings *settings);
      57             : 
      58             : void bufferQuoteConstant( OUStringBuffer & buf, const OUString & str, ConnectionSettings *settings );
      59             : void bufferQuoteAnyConstant( OUStringBuffer & buf, const com::sun::star::uno::Any &val, ConnectionSettings *settings );
      60             : 
      61             : void bufferEscapeConstant( OUStringBuffer & buf, const OUString & str, ConnectionSettings *settings );
      62             : 
      63             : OUString sqltype2string(
      64             :     const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > & column );
      65             : 
      66             : 
      67             : void bufferQuoteQualifiedIdentifier(
      68             :     OUStringBuffer & buf, const OUString &schema, const OUString &name, ConnectionSettings *settings );
      69             : 
      70             : void bufferQuoteQualifiedIdentifier(
      71             :     OUStringBuffer & buf,
      72             :     const OUString &schema,
      73             :     const OUString &name,
      74             :     const OUString &col,
      75             :     ConnectionSettings *settings );
      76             : 
      77             : void bufferQuoteIdentifier( OUStringBuffer & buf, const OUString &toQuote, ConnectionSettings *settings );
      78             : void bufferKey2TableConstraint(
      79             :     OUStringBuffer &buf,
      80             :     const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > &key,
      81             :     ConnectionSettings *settings  );
      82             : 
      83             : OUString extractStringProperty(
      84             :     const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > & descriptor,
      85             :     const OUString &name );
      86             : 
      87             : sal_Int32 extractIntProperty(
      88             :     const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > & descriptor,
      89             :     const OUString &name );
      90             : 
      91             : bool extractBoolProperty(
      92             :     const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > & descriptor,
      93             :     const OUString &name );
      94             : 
      95             : void disposeNoThrow( const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > & r );
      96             : void disposeObject( const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > & r );
      97             : 
      98             : OUString extractTableFromInsert( const OUString & sql );
      99             : OString extractSingleTableFromSelect( const OStringVector &vec );
     100             : 
     101             : void tokenizeSQL( const OString & sql, OStringVector &vec  );
     102             : void splitSQL( const OString & sql, OStringVector &vec  );
     103             : com::sun::star::uno::Sequence< sal_Int32 > parseIntArray( const OUString & str );
     104             : com::sun::star::uno::Sequence< com::sun::star::uno::Any > parseArray( const OUString & str )
     105             :     throw( com::sun::star::sdbc::SQLException );
     106             : 
     107             : OUString array2String( const com::sun::star::uno::Sequence< com::sun::star::uno::Any > &seq );
     108             : 
     109             : com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > extractConnectionFromStatement(
     110             :     const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > & stmt );
     111             : 
     112             : void splitConcatenatedIdentifier( const OUString & source, OUString *first, OUString *second);
     113             : 
     114             : 
     115             : void fillAttnum2attnameMap(
     116             :     Int2StringMap &map,
     117             :     const com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > &conn,
     118             :     const OUString &schema,
     119             :     const OUString &table );
     120             : 
     121             : com::sun::star::uno::Sequence< sal_Int32 > string2intarray( const OUString & str );
     122             : 
     123             : com::sun::star::uno::Sequence< OUString > convertMappedIntArray2StringArray(
     124             :     const Int2StringMap &map, const com::sun::star::uno::Sequence< sal_Int32> &source );
     125             : 
     126             : typedef ::boost::unordered_map
     127             : <
     128             :     OString,
     129             :     OString,
     130             :     OStringHash,
     131             :     ::std::equal_to< OString >
     132             : > String2StringMap;
     133             : 
     134             : OUString querySingleValue(
     135             :     const com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > &connection,
     136             :     const OUString &query );
     137             : 
     138             : void extractNameValuePairsFromInsert( String2StringMap & map, const OString & lastQuery );
     139             : sal_Int32 typeNameToDataType( const OUString &typeName, const OUString &typtype );
     140             : 
     141             : // copied from connectivity/source/dbtools, can't use the function directly
     142             : bool implSetObject(     const com::sun::star::uno::Reference< com::sun::star::sdbc::XParameters >& _rxParameters,
     143             :                     const sal_Int32 _nColumnIndex, const com::sun::star::uno::Any& _rValue);
     144             : 
     145             : class DisposeGuard
     146             : {
     147             :     com::sun::star::uno::Reference< com::sun::star::uno::XInterface > d;
     148             : public:
     149             :     DisposeGuard(const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > & r );
     150             :     ~DisposeGuard();
     151             : 
     152             : };
     153             : 
     154             : class TransactionGuard
     155             : {
     156             :     com::sun::star::uno::Reference< com::sun::star::sdbc::XStatement > m_stmt;
     157             :     bool m_commited;
     158             : public:
     159             :     /// takes over ownership of given statemet
     160             :     TransactionGuard( const com::sun::star::uno::Reference< com::sun::star::sdbc::XStatement > &stmt );
     161             :     ~TransactionGuard( );
     162             : 
     163             :     void commit();
     164             :     void executeUpdate( const OUString & sql );
     165             : };
     166             : 
     167           0 : template < typename T > com::sun::star::uno::Sequence<T> sequence_of_vector ( const std::vector<T> &vec )
     168             : {
     169           0 :     if ( vec.empty() )
     170           0 :         return com::sun::star::uno::Sequence<T>();
     171             :     else
     172           0 :         return com::sun::star::uno::Sequence<T>( &vec[0], vec.size());
     173             : }
     174             : 
     175             : }
     176             : 
     177             : #endif
     178             : 
     179             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10