LCOV - code coverage report
Current view: top level - connectivity/source/drivers/jdbc - ConnectionLog.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 11 23 47.8 %
Date: 2015-06-13 12:38:46 Functions: 4 7 57.1 %
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             : 
      21             : #include "java/sql/ConnectionLog.hxx"
      22             : 
      23             : #include <com/sun/star/util/Date.hpp>
      24             : #include <com/sun/star/util/Time.hpp>
      25             : #include <com/sun/star/util/DateTime.hpp>
      26             : 
      27             : #include <stdio.h>
      28             : 
      29             : 
      30             : namespace connectivity { namespace java { namespace sql {
      31             : 
      32             : 
      33             :     using ::com::sun::star::uno::Reference;
      34             :     using ::com::sun::star::uno::XComponentContext;
      35             : 
      36             : 
      37             :     namespace
      38             :     {
      39       13989 :         sal_Int32 lcl_getFreeID( ConnectionLog::ObjectType _eType )
      40             :         {
      41             :             static oslInterlockedCount s_nCounts[ ConnectionLog::ObjectTypeCount ] = { 0, 0 };
      42       13989 :             return osl_atomic_increment( s_nCounts + _eType );
      43             :         }
      44             :     }
      45             : 
      46           9 :     ConnectionLog::ConnectionLog( const ::comphelper::ResourceBasedEventLogger& _rDriverLog )
      47             :         :ConnectionLog_Base( _rDriverLog )
      48           9 :         ,m_nObjectID( lcl_getFreeID( CONNECTION ) )
      49             :     {
      50           9 :     }
      51             : 
      52             : 
      53          53 :     ConnectionLog::ConnectionLog( const ConnectionLog& _rSourceLog )
      54             :         :ConnectionLog_Base( _rSourceLog )
      55          53 :         ,m_nObjectID( _rSourceLog.m_nObjectID )
      56             :     {
      57          53 :     }
      58             : 
      59             : 
      60       13980 :     ConnectionLog::ConnectionLog( const ConnectionLog& _rSourceLog, ConnectionLog::ObjectType _eType )
      61             :         :ConnectionLog_Base( _rSourceLog )
      62       13980 :         ,m_nObjectID( lcl_getFreeID( _eType ) )
      63             :     {
      64       13980 :     }
      65             : 
      66             : 
      67             : } } } // namespace connectivity::java::sql
      68             : 
      69             : 
      70             : 
      71             : namespace comphelper { namespace log { namespace convert
      72             : {
      73             : 
      74             : 
      75             :     using ::com::sun::star::uno::Reference;
      76             :     using ::com::sun::star::uno::XComponentContext;
      77             :     using ::com::sun::star::util::Date;
      78             :     using ::com::sun::star::util::Time;
      79             :     using ::com::sun::star::util::DateTime;
      80             : 
      81             : 
      82           0 :     OUString convertLogArgToString( const Date& _rDate )
      83             :     {
      84             :         char buffer[ 30 ];
      85           0 :         const size_t buffer_size = sizeof( buffer );
      86             :         snprintf( buffer, buffer_size, "%04i-%02i-%02i",
      87           0 :             (int)_rDate.Year, (int)_rDate.Month, (int)_rDate.Day );
      88           0 :         return OUString::createFromAscii( buffer );
      89             :     }
      90             : 
      91             : 
      92           0 :     OUString convertLogArgToString( const css::util::Time& _rTime )
      93             :     {
      94             :         char buffer[ 30 ];
      95           0 :         const size_t buffer_size = sizeof( buffer );
      96             :         snprintf( buffer, buffer_size, "%02i:%02i:%02i.%09i",
      97           0 :             (int)_rTime.Hours, (int)_rTime.Minutes, (int)_rTime.Seconds, (int)_rTime.NanoSeconds );
      98           0 :         return OUString::createFromAscii( buffer );
      99             :     }
     100             : 
     101             : 
     102           0 :     OUString convertLogArgToString( const DateTime& _rDateTime )
     103             :     {
     104             :         char buffer[ 30 ];
     105           0 :         const size_t buffer_size = sizeof( buffer );
     106             :         snprintf( buffer, buffer_size, "%04i-%02i-%02i %02i:%02i:%02i.%09i",
     107             :             (int)_rDateTime.Year, (int)_rDateTime.Month, (int)_rDateTime.Day,
     108           0 :             (int)_rDateTime.Hours, (int)_rDateTime.Minutes, (int)_rDateTime.Seconds, (int)_rDateTime.NanoSeconds );
     109           0 :         return OUString::createFromAscii( buffer );
     110             :     }
     111             : 
     112             : 
     113             : } } }   // comphelper::log::convert
     114             : 
     115             : 
     116             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11