LCOV - code coverage report
Current view: top level - connectivity/source/drivers/postgresql - pq_updateableresultset.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 267 0.0 %
Date: 2014-04-14 Functions: 0 31 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: 200? 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             : #include <rtl/ustrbuf.hxx>
      38             : #include <rtl/strbuf.hxx>
      39             : 
      40             : #include <cppuhelper/queryinterface.hxx>
      41             : #include <cppuhelper/typeprovider.hxx>
      42             : 
      43             : #include <com/sun/star/sdbc/XGeneratedResultSet.hpp>
      44             : 
      45             : #include "pq_updateableresultset.hxx"
      46             : #include "pq_resultsetmetadata.hxx"
      47             : #include "pq_tools.hxx"
      48             : #include "pq_statics.hxx"
      49             : 
      50             : #include <string.h>
      51             : 
      52             : #include <connectivity/dbconversion.hxx>
      53             : 
      54             : using osl::MutexGuard;
      55             : 
      56             : 
      57             : using com::sun::star::uno::Reference;
      58             : using com::sun::star::uno::makeAny;
      59             : using com::sun::star::uno::Sequence;
      60             : using com::sun::star::uno::UNO_QUERY;
      61             : using com::sun::star::uno::Any;
      62             : using com::sun::star::uno::Type;
      63             : using com::sun::star::uno::RuntimeException;
      64             : 
      65             : using com::sun::star::sdbc::XGeneratedResultSet;
      66             : using com::sun::star::sdbc::XResultSetMetaDataSupplier;
      67             : using com::sun::star::sdbc::SQLException;
      68             : using com::sun::star::sdbc::XResultSet;
      69             : using com::sun::star::sdbc::XCloseable;
      70             : using com::sun::star::sdbc::XColumnLocate;
      71             : using com::sun::star::sdbc::XResultSetUpdate;
      72             : using com::sun::star::sdbc::XRowUpdate;
      73             : using com::sun::star::sdbc::XRow;
      74             : using com::sun::star::sdbc::XStatement;
      75             : 
      76             : using com::sun::star::beans::XFastPropertySet;
      77             : using com::sun::star::beans::XPropertySet;
      78             : using com::sun::star::beans::XMultiPropertySet;
      79             : 
      80             : using namespace dbtools;
      81             : 
      82             : namespace pq_sdbc_driver
      83             : {
      84             : 
      85             : 
      86           0 : com::sun::star::uno::Reference< com::sun::star::sdbc::XCloseable > UpdateableResultSet::createFromPGResultSet(
      87             :     const ::rtl::Reference< RefCountedMutex > & mutex,
      88             :     const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > &owner,
      89             :     ConnectionSettings **ppSettings,
      90             :     PGresult *result,
      91             :     const OUString &schema,
      92             :     const OUString &table,
      93             :     const com::sun::star::uno::Sequence< OUString > &primaryKey )
      94             : {
      95           0 :     ConnectionSettings *pSettings = *ppSettings;
      96           0 :     sal_Int32 columnCount = PQnfields( result );
      97           0 :     sal_Int32 rowCount = PQntuples( result );
      98           0 :     Sequence< OUString > columnNames( columnCount );
      99           0 :     for( int i = 0 ; i < columnCount ; i ++ )
     100             :     {
     101           0 :         char * name = PQfname( result, i );
     102           0 :         columnNames[i] = OUString( name, strlen(name), pSettings->encoding );
     103             :     }
     104           0 :     Sequence< Sequence< Any > > data( rowCount );
     105             : 
     106             :     // copy all the data into unicode strings (also binaries, as we yet
     107             :     // don't know, what a binary is and what not!)
     108           0 :     for( int row = 0 ; row < rowCount ; row ++ )
     109             :     {
     110           0 :         Sequence< Any > aRow( columnCount );
     111           0 :         for( int col = 0 ; col < columnCount ; col ++ )
     112             :         {
     113           0 :             if( ! PQgetisnull( result, row, col ) )
     114             :             {
     115           0 :                 char * val = PQgetvalue( result, row, col );
     116             : 
     117           0 :                 aRow[col] = makeAny(
     118           0 :                     OUString( val, strlen( val ) , (*ppSettings)->encoding ) );
     119             :             }
     120             :         }
     121           0 :         data[row] = aRow;
     122           0 :     }
     123             : 
     124             :     UpdateableResultSet *pRS =  new UpdateableResultSet(
     125           0 :         mutex, owner, columnNames, data, ppSettings, schema, table , primaryKey );
     126             : 
     127           0 :     Reference <XCloseable > ret = pRS; // give it an refcount
     128             : 
     129           0 :     pRS->m_meta = new ResultSetMetaData( mutex, pRS,0, ppSettings, result, schema, table );
     130             : 
     131           0 :     PQclear( result ); // we don't need it anymore
     132             : 
     133           0 :     return ret;
     134             : }
     135             : 
     136           0 : com::sun::star::uno::Any  UpdateableResultSet::queryInterface(
     137             :     const com::sun::star::uno::Type & reqType )
     138             :     throw (com::sun::star::uno::RuntimeException, std::exception)
     139             : {
     140           0 :     Any ret = SequenceResultSet::queryInterface( reqType );
     141           0 :     if( ! ret.hasValue() )
     142           0 :         ret = ::cppu::queryInterface(
     143             :             reqType,
     144             :             static_cast< XResultSetUpdate * > ( this ),
     145           0 :             static_cast< XRowUpdate * > ( this ) );
     146           0 :     return ret;
     147             : }
     148             : 
     149             : 
     150           0 : com::sun::star::uno::Sequence< com::sun::star::uno::Type > UpdateableResultSet::getTypes()
     151             :         throw( com::sun::star::uno::RuntimeException, std::exception )
     152             : {
     153             :     static cppu::OTypeCollection *pCollection;
     154           0 :     if( ! pCollection )
     155             :     {
     156           0 :         MutexGuard guard( osl::Mutex::getGlobalMutex() );
     157           0 :         if( !pCollection )
     158             :         {
     159             :             static cppu::OTypeCollection collection(
     160           0 :                 getCppuType( (Reference< XResultSetUpdate> *) 0 ),
     161           0 :                 getCppuType( (Reference< XRowUpdate> *) 0 ),
     162           0 :                 SequenceResultSet::getTypes());
     163           0 :             pCollection = &collection;
     164           0 :         }
     165             :     }
     166           0 :     return pCollection->getTypes();
     167             : 
     168             : }
     169             : 
     170           0 : com::sun::star::uno::Sequence< sal_Int8> UpdateableResultSet::getImplementationId()
     171             :         throw( com::sun::star::uno::RuntimeException, std::exception )
     172             : {
     173           0 :     return css::uno::Sequence<sal_Int8>();
     174             : }
     175             : 
     176           0 : OUString UpdateableResultSet::buildWhereClause()
     177             : {
     178           0 :     OUString ret;
     179           0 :     if( m_primaryKey.getLength() )
     180             :     {
     181           0 :         OUStringBuffer buf( 128 );
     182           0 :         buf.append( " WHERE " );
     183           0 :         for( int i = 0 ; i < m_primaryKey.getLength() ; i ++ )
     184             :         {
     185           0 :             if( i > 0 )
     186           0 :                 buf.append( " AND " );
     187           0 :             sal_Int32 index = findColumn( m_primaryKey[i] );
     188           0 :             bufferQuoteIdentifier( buf, m_primaryKey[i], *m_ppSettings );
     189           0 :             buf.append( " = " );
     190           0 :             bufferQuoteConstant( buf, getString( index ), *m_ppSettings );
     191             :         }
     192           0 :         ret = buf.makeStringAndClear();
     193             :     }
     194           0 :     return ret;
     195             : }
     196             : 
     197             : 
     198           0 : void UpdateableResultSet::insertRow(  ) throw (SQLException, RuntimeException, std::exception)
     199             : {
     200           0 :     MutexGuard guard( m_refMutex->mutex );
     201           0 :     if( isLog( *m_ppSettings, LogLevel::INFO ) )
     202             :     {
     203           0 :         log( *m_ppSettings, LogLevel::INFO,"UpdateableResultSet::insertRow got called"  );
     204             :     }
     205           0 :     if( ! m_insertRow )
     206             :         throw SQLException(
     207             :             "pq_resultset.insertRow: moveToInsertRow has not been called !",
     208           0 :             *this, OUString(), 1, Any() );
     209             : 
     210           0 :     OUStringBuffer buf( 128 );
     211           0 :     buf.append( "INSERT INTO " );
     212           0 :     bufferQuoteQualifiedIdentifier( buf, m_schema, m_table, *m_ppSettings );
     213           0 :     buf.append( " ( " );
     214             : 
     215           0 :     int columns = 0;
     216           0 :     for( UpdateableFieldVector::size_type i = 0 ; i < m_updateableField.size() ; i++ )
     217             :     {
     218           0 :         if( m_updateableField[i].isTouched )
     219             :         {
     220           0 :             if( columns > 0 )
     221           0 :                 buf.append( ", " );
     222           0 :             columns ++;
     223           0 :             bufferQuoteIdentifier( buf, m_columnNames[i], *m_ppSettings);
     224             :         }
     225             :     }
     226           0 :     buf.append( " ) VALUES ( " );
     227             : 
     228           0 :     columns = 0;
     229           0 :     for( UpdateableFieldVector::size_type i = 0 ; i < m_updateableField.size() ; i ++ )
     230             :     {
     231           0 :         if( m_updateableField[i].isTouched )
     232             :         {
     233           0 :             if( columns > 0 )
     234           0 :                 buf.append( " , " );
     235           0 :             columns ++;
     236           0 :             bufferQuoteAnyConstant( buf, m_updateableField[i].value, *m_ppSettings );
     237             : 
     238             : //             OUString val;
     239             : //             m_updateableField[i].value >>= val;
     240             : //             buf.append( val );
     241             : //                 OStringToOUString(val, (*m_ppSettings)->encoding ) );
     242             :         }
     243             :     }
     244             : 
     245           0 :     buf.append( " )" );
     246             : 
     247             :     Reference< XStatement > stmt =
     248           0 :         extractConnectionFromStatement(m_owner)->createStatement();
     249           0 :     DisposeGuard dispGuard( stmt );
     250           0 :     stmt->executeUpdate( buf.makeStringAndClear() );
     251             : 
     252             :     // reflect the changes !
     253           0 :     m_rowCount ++;
     254           0 :     m_data.realloc( m_rowCount );
     255           0 :     m_data[m_rowCount-1] = Sequence< Any > ( m_fieldCount );
     256           0 :     Reference< XGeneratedResultSet > result( stmt, UNO_QUERY );
     257           0 :     if( result.is() )
     258             :     {
     259           0 :         Reference< XResultSet > rs = result->getGeneratedValues();
     260           0 :         if( rs.is() && rs->next() )
     261             :         {
     262           0 :             Reference< XColumnLocate > columnLocate( rs, UNO_QUERY );
     263           0 :             Reference< XRow> xRow ( rs, UNO_QUERY );
     264           0 :             for( int i = 0 ; i < m_fieldCount ; i++ )
     265             :             {
     266           0 :                 int field = columnLocate->findColumn( m_columnNames[i] );
     267           0 :                 if( field >= 1 )
     268             :                 {
     269           0 :                     m_data[m_rowCount-1][i] <<=  xRow->getString( field );
     270             : //                     printf( "adding %s %s\n" ,
     271             : //                             OUStringToOString( m_columnNames[i], RTL_TEXTENCODING_ASCII_US).getStr(),
     272             : //                             OUStringToOString( xRow->getString( field ), RTL_TEXTENCODING_ASCII_US).getStr() );
     273             : 
     274             :                 }
     275           0 :             }
     276             :         }
     277             :         else
     278             :         {
     279             :             // do the best we can ( DEFAULT and AUTO increment values fail ! )
     280           0 :             for( int i = 0 ; i < m_fieldCount ; i ++ )
     281             :             {
     282           0 :                 if( m_updateableField[i].isTouched )
     283           0 :                     m_data[m_rowCount-1][i] = m_updateableField[i].value;
     284             :             }
     285           0 :         }
     286             :     }
     287             : 
     288             :     // cleanup
     289           0 :     m_updateableField = UpdateableFieldVector();
     290           0 : }
     291             : 
     292           0 : void UpdateableResultSet::updateRow(  ) throw (SQLException, RuntimeException, std::exception)
     293             : {
     294           0 :     MutexGuard guard( m_refMutex->mutex );
     295           0 :     if( isLog( *m_ppSettings, LogLevel::INFO ) )
     296             :     {
     297           0 :         log( *m_ppSettings, LogLevel::INFO,"UpdateableResultSet::updateRow got called"  );
     298             :     }
     299           0 :     if( m_insertRow )
     300             :         throw SQLException(
     301             :             "pq_resultset.updateRow: moveToCurrentRow has not been called !",
     302           0 :             *this, OUString(), 1, Any() );
     303             : 
     304           0 :     OUStringBuffer buf( 128 );
     305           0 :     buf.append( "UPDATE " );
     306           0 :     bufferQuoteQualifiedIdentifier( buf, m_schema, m_table, *m_ppSettings );
     307           0 :     buf.append( "SET " );
     308             : 
     309           0 :     int columns = 0;
     310           0 :     for( UpdateableFieldVector::size_type i = 0; i < m_updateableField.size() ; i ++ )
     311             :     {
     312           0 :         if( m_updateableField[i].isTouched )
     313             :         {
     314           0 :             if( columns > 0 )
     315           0 :                 buf.append( ", " );
     316           0 :             columns ++;
     317             : 
     318           0 :             buf.append( m_columnNames[i] );
     319           0 :             buf.append( " = " );
     320           0 :             bufferQuoteAnyConstant( buf, m_updateableField[i].value, *m_ppSettings );
     321             : //             OUString val;
     322             : //             m_updateableField[i].value >>= val;
     323             : //             bufferQuoteConstant( buf, val ):
     324             : //             buf.append( val );
     325             :         }
     326             :     }
     327           0 :     buf.append( buildWhereClause() );
     328             : 
     329           0 :     Reference< XStatement > stmt = extractConnectionFromStatement(m_owner)->createStatement();
     330           0 :     DisposeGuard dispGuard( stmt );
     331           0 :     stmt->executeUpdate( buf.makeStringAndClear() );
     332             : 
     333             :     // reflect the changes !
     334           0 :     for( int i = 0 ; i < m_fieldCount ; i ++ )
     335             :     {
     336           0 :         if( m_updateableField[i].isTouched  )
     337           0 :             m_data[m_row][i] = m_updateableField[i].value;
     338             :     }
     339           0 :     m_updateableField = UpdateableFieldVector();
     340           0 : }
     341             : 
     342           0 : void UpdateableResultSet::deleteRow(  ) throw (SQLException, RuntimeException, std::exception)
     343             : {
     344           0 :     if( isLog( *m_ppSettings, LogLevel::INFO ) )
     345             :     {
     346           0 :         log( *m_ppSettings, LogLevel::INFO,"UpdateableResultSet::deleteRow got called"  );
     347             :     }
     348           0 :     if( m_insertRow )
     349             :         throw SQLException(
     350             :             "pq_resultset.deleteRow: deleteRow cannot be called when on insert row !",
     351           0 :             *this, OUString(), 1, Any() );
     352             : 
     353           0 :     if( m_row < 0 || m_row >= m_rowCount )
     354             :     {
     355           0 :         OUStringBuffer buf( 128 );
     356           0 :         buf.appendAscii( "deleteRow cannot be called on invalid row (" );
     357           0 :         buf.append( m_row );
     358           0 :         buf.appendAscii( ")" );
     359           0 :         throw SQLException( buf.makeStringAndClear() , *this, OUString(), 0, Any() );
     360             :     }
     361             : 
     362           0 :     Reference< XStatement > stmt = extractConnectionFromStatement(m_owner)->createStatement();
     363           0 :     DisposeGuard dispGuard( stmt );
     364           0 :     OUStringBuffer buf( 128 );
     365           0 :     buf.appendAscii( "DELETE FROM " );
     366           0 :     bufferQuoteQualifiedIdentifier( buf, m_schema, m_table, *m_ppSettings );
     367           0 :     buf.appendAscii( " " );
     368           0 :     buf.append( buildWhereClause() );
     369             : 
     370           0 :     stmt->executeUpdate( buf.makeStringAndClear() );
     371             : 
     372             :     // reflect the changes !
     373           0 :     for( int i = m_row + 1; i < m_row ; i ++ )
     374             :     {
     375           0 :         m_data[i-1] = m_data[i];
     376             :     }
     377           0 :     m_rowCount --;
     378           0 :     m_data.realloc( m_rowCount );
     379           0 :  }
     380             : 
     381           0 : void UpdateableResultSet::cancelRowUpdates(  ) throw (SQLException, RuntimeException, std::exception)
     382             : {
     383           0 :     MutexGuard guard( m_refMutex->mutex );
     384           0 :     m_updateableField = UpdateableFieldVector();
     385           0 : }
     386             : 
     387           0 : void UpdateableResultSet::moveToInsertRow(  ) throw (SQLException, RuntimeException, std::exception)
     388             : {
     389           0 :     m_insertRow = true;
     390           0 : }
     391             : 
     392           0 : void UpdateableResultSet::moveToCurrentRow(  ) throw (SQLException, RuntimeException, std::exception)
     393             : {
     394           0 :     m_insertRow = false;
     395           0 : }
     396             : 
     397           0 : void UpdateableResultSet::checkUpdate( sal_Int32 columnIndex)
     398             : {
     399           0 :     checkColumnIndex( columnIndex );
     400           0 :     if( m_updateableField.empty() )
     401           0 :         m_updateableField = UpdateableFieldVector( m_fieldCount );
     402           0 :     m_updateableField[columnIndex-1].isTouched = true;
     403           0 : }
     404             : 
     405           0 : void UpdateableResultSet::updateNull( sal_Int32 columnIndex ) throw (SQLException, RuntimeException, std::exception)
     406             : {
     407           0 :     MutexGuard guard( m_refMutex->mutex );
     408           0 :     checkClosed();
     409           0 :     checkUpdate( columnIndex );
     410           0 :     m_updateableField[columnIndex-1].value = Any();
     411           0 : }
     412             : 
     413           0 : void UpdateableResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw (SQLException, RuntimeException, std::exception)
     414             : {
     415           0 :     MutexGuard guard( m_refMutex->mutex );
     416           0 :     checkClosed();
     417           0 :     checkUpdate( columnIndex );
     418             : 
     419           0 :     Statics &st = getStatics();
     420           0 :     m_updateableField[columnIndex-1].value <<=  ( x ? st.TRUE : st.FALSE );
     421             : 
     422           0 : }
     423             : 
     424           0 : void UpdateableResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw (SQLException, RuntimeException, std::exception)
     425             : {
     426           0 :     updateInt(columnIndex,x);
     427           0 : }
     428             : 
     429           0 : void UpdateableResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw (SQLException, RuntimeException, std::exception)
     430             : {
     431           0 :     updateInt( columnIndex, x );
     432           0 : }
     433             : 
     434           0 : void UpdateableResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw (SQLException, RuntimeException, std::exception)
     435             : {
     436           0 :     updateLong( columnIndex, x );
     437             : //     MutexGuard guard( m_refMutex->mutex );
     438             : //     checkClosed();
     439             : //     checkUpdate( columnIndex );
     440             : 
     441             : //     m_updateableField[columnIndex-1].value <<= OUString::valueOf( x );
     442             : 
     443           0 : }
     444             : 
     445           0 : void UpdateableResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw (SQLException, RuntimeException, std::exception)
     446             : {
     447           0 :     MutexGuard guard( m_refMutex->mutex );
     448           0 :     checkClosed();
     449           0 :     checkUpdate( columnIndex );
     450             : 
     451             : //     OStringBuffer buf( 20 );
     452             : //     buf.append( "'" );
     453             : //     buf.append( (sal_Int64) x );
     454             : //     buf.append( "'" );
     455           0 :     m_updateableField[columnIndex-1].value <<= OUString::number( x );
     456           0 : }
     457             : 
     458           0 : void UpdateableResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw (SQLException, RuntimeException, std::exception)
     459             : {
     460             : 
     461           0 :     MutexGuard guard( m_refMutex->mutex );
     462           0 :     checkClosed();
     463           0 :     checkUpdate( columnIndex );
     464             : 
     465           0 :     m_updateableField[columnIndex-1].value <<= OUString::number( x );
     466           0 : }
     467             : 
     468           0 : void UpdateableResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw (SQLException, RuntimeException, std::exception)
     469             : {
     470           0 :     MutexGuard guard( m_refMutex->mutex );
     471           0 :     checkClosed();
     472           0 :     checkUpdate( columnIndex );
     473             : 
     474           0 :     m_updateableField[columnIndex-1].value <<= OUString::number( x );
     475           0 : }
     476             : 
     477           0 : void UpdateableResultSet::updateString( sal_Int32 columnIndex, const OUString& x ) throw (SQLException, RuntimeException, std::exception)
     478             : {
     479           0 :     MutexGuard guard( m_refMutex->mutex );
     480           0 :     checkClosed();
     481           0 :     checkUpdate( columnIndex );
     482             : 
     483           0 :     m_updateableField[columnIndex-1].value <<= x;
     484           0 : }
     485             : 
     486           0 : void UpdateableResultSet::updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw (SQLException, RuntimeException, std::exception)
     487             : {
     488           0 :     MutexGuard guard( m_refMutex->mutex );
     489           0 :     checkClosed();
     490           0 :     checkUpdate( columnIndex );
     491             : 
     492             :     size_t len;
     493             :     unsigned char * escapedString =
     494           0 :         PQescapeBytea( (unsigned char *)x.getConstArray(), x.getLength(), &len);
     495           0 :     if( ! escapedString )
     496             :     {
     497             :         throw SQLException(
     498             :             "pq_preparedstatement.setBytes: Error during converting bytesequence to an SQL conform string",
     499           0 :             *this, OUString(), 1, Any() );
     500             :     }
     501             : //     buf.append( (const sal_Char *)escapedString, len -1 );
     502             : 
     503           0 :     m_updateableField[columnIndex-1].value <<=
     504           0 :         OUString( (sal_Char*) escapedString, len, RTL_TEXTENCODING_ASCII_US );
     505           0 :     free( escapedString );
     506           0 : }
     507             : 
     508           0 : void UpdateableResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw (SQLException, RuntimeException, std::exception)
     509             : {
     510           0 :     updateString( columnIndex, DBTypeConversion::toDateString( x ) );
     511           0 : }
     512             : 
     513           0 : void UpdateableResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw (SQLException, RuntimeException, std::exception)
     514             : {
     515           0 :     updateString( columnIndex, DBTypeConversion::toTimeString( x ) );
     516           0 : }
     517             : 
     518           0 : void UpdateableResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw (SQLException, RuntimeException, std::exception)
     519             : {
     520           0 :     updateString( columnIndex, DBTypeConversion::toDateTimeString( x ) );
     521           0 : }
     522             : 
     523           0 : void UpdateableResultSet::updateBinaryStream( sal_Int32 /* columnIndex */, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& /* x */, sal_Int32 /* length */ ) throw (SQLException, RuntimeException, std::exception)
     524             : {
     525           0 : }
     526             : 
     527           0 : void UpdateableResultSet::updateCharacterStream( sal_Int32 /* columnIndex */, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& /* x */, sal_Int32 /* length */ ) throw (SQLException, RuntimeException, std::exception)
     528             : {
     529           0 : }
     530             : 
     531           0 : void UpdateableResultSet::updateObject( sal_Int32 /* columnIndex */, const ::com::sun::star::uno::Any& /* x */ ) throw (SQLException, RuntimeException, std::exception)
     532             : {
     533           0 : }
     534             : 
     535           0 : void UpdateableResultSet::updateNumericObject( sal_Int32 /* columnIndex */, const ::com::sun::star::uno::Any& /* x */, sal_Int32 /* scale */ ) throw (SQLException, RuntimeException, std::exception)
     536             : {
     537           0 : }
     538             : 
     539             : 
     540           0 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > UpdateableResultSet::getMetaData(  )
     541             :     throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
     542             : {
     543           0 :     return m_meta;
     544             : }
     545             : 
     546           0 : Sequence< Type > UpdateableResultSet::getStaticTypes( bool updateable )
     547             :     throw( com::sun::star::uno::RuntimeException )
     548             : {
     549           0 :     if( updateable )
     550             :     {
     551             :         cppu::OTypeCollection collection(
     552           0 :             getCppuType( (Reference< XResultSetUpdate> *) 0 ),
     553           0 :             getCppuType( (Reference< XRowUpdate> *) 0 ),
     554             : //             getCppuType( (Reference< com::sun::star::sdbcx::XRowLocate > *) 0 ),
     555           0 :             getStaticTypes( false /* updateable */ ) );
     556           0 :         return collection.getTypes();
     557             :     }
     558             :     else
     559             :     {
     560             :         cppu::OTypeCollection collection(
     561           0 :             getCppuType( (Reference< XResultSet> *) 0 ),
     562           0 :             getCppuType( (Reference< XResultSetMetaDataSupplier> *) 0 ),
     563           0 :             getCppuType( (Reference< XRow> *) 0 ),
     564           0 :             getCppuType( (Reference< XColumnLocate> *) 0 ),
     565           0 :             getCppuType( (Reference< XCloseable> *) 0 ),
     566           0 :             getCppuType( (Reference< XPropertySet >*) 0 ),
     567           0 :             getCppuType( (Reference< XFastPropertySet > *) 0 ),
     568           0 :             getCppuType( (Reference< XMultiPropertySet > *) 0 ),
     569           0 :             getCppuType( (const Reference< com::sun::star::lang::XComponent > *)0 ),  // OComponentHelper
     570           0 :             getCppuType( (const Reference< com::sun::star::lang::XTypeProvider > *)0 ),
     571           0 :             getCppuType( (const Reference< com::sun::star::uno::XAggregation > *)0 ),
     572           0 :             getCppuType( (const Reference< com::sun::star::uno::XWeak > *)0 ) );
     573           0 :         return collection.getTypes();
     574             :     }
     575             : }
     576             : 
     577             : }
     578             : 
     579             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10