2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 15:18:56 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 08:02:15 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-10 08:02:15 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-10 08:02:15 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-10 08:02:15 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-10 08:02:15 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-10 08:02:15 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
2006-09-17 01:33:50 +00:00
|
|
|
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_connectivity.hxx"
|
2000-10-30 10:00:36 +00:00
|
|
|
#include <limits> // included here to prevent problems if compiling with C52
|
|
|
|
|
2000-11-17 10:25:24 +00:00
|
|
|
#ifdef GCC
|
2000-11-14 11:57:56 +00:00
|
|
|
#include <iostream>
|
|
|
|
#endif
|
2000-10-05 13:40:11 +00:00
|
|
|
#include "connectivity/sdbcx/VColumn.hxx"
|
2000-09-18 15:18:56 +00:00
|
|
|
#include "file/FResultSet.hxx"
|
|
|
|
#include "file/FResultSetMetaData.hxx"
|
|
|
|
#include <com/sun/star/sdbc/DataType.hpp>
|
|
|
|
#include <com/sun/star/sdbc/ColumnValue.hpp>
|
2000-10-09 11:34:19 +00:00
|
|
|
#include <comphelper/property.hxx>
|
2000-09-18 15:18:56 +00:00
|
|
|
#include <com/sun/star/lang/DisposedException.hpp>
|
|
|
|
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
|
|
|
#include <com/sun/star/container/XIndexAccess.hpp>
|
2000-10-09 11:34:19 +00:00
|
|
|
#include <comphelper/sequence.hxx>
|
2000-09-18 15:18:56 +00:00
|
|
|
#include <cppuhelper/typeprovider.hxx>
|
2000-12-14 12:17:53 +00:00
|
|
|
#include "connectivity/dbconversion.hxx"
|
2001-07-30 07:53:02 +00:00
|
|
|
#include "connectivity/dbtools.hxx"
|
2000-11-03 13:21:22 +00:00
|
|
|
#include <cppuhelper/propshlp.hxx>
|
2000-09-18 15:18:56 +00:00
|
|
|
#include <iterator>
|
2000-10-19 10:56:36 +00:00
|
|
|
#include <tools/debug.hxx>
|
2000-11-20 08:57:42 +00:00
|
|
|
#include <com/sun/star/sdbc/ResultSetType.hpp>
|
|
|
|
#include <com/sun/star/sdbc/FetchDirection.hpp>
|
|
|
|
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
|
2001-05-07 09:37:54 +00:00
|
|
|
#include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
|
2000-11-20 08:57:42 +00:00
|
|
|
|
2000-11-14 11:57:56 +00:00
|
|
|
#include <algorithm>
|
2001-03-15 08:02:28 +00:00
|
|
|
#include <comphelper/extract.hxx>
|
2001-04-02 08:18:37 +00:00
|
|
|
#include "connectivity/dbexception.hxx"
|
2001-05-18 07:51:34 +00:00
|
|
|
#include <comphelper/types.hxx>
|
2008-10-01 12:28:29 +00:00
|
|
|
#include "resource/file_res.hrc"
|
|
|
|
#include "resource/sharedresources.hxx"
|
2009-04-23 10:42:05 +00:00
|
|
|
#include <rtl/logfile.hxx>
|
2001-02-13 14:02:28 +00:00
|
|
|
|
2001-08-24 05:19:41 +00:00
|
|
|
|
2001-05-18 07:51:34 +00:00
|
|
|
using namespace ::comphelper;
|
2000-09-18 15:18:56 +00:00
|
|
|
using namespace connectivity;
|
|
|
|
using namespace connectivity::file;
|
2001-05-18 07:51:34 +00:00
|
|
|
using namespace ::cppu;
|
2001-05-14 10:55:19 +00:00
|
|
|
using namespace dbtools;
|
2000-09-18 15:18:56 +00:00
|
|
|
using namespace com::sun::star::uno;
|
|
|
|
using namespace com::sun::star::lang;
|
|
|
|
using namespace com::sun::star::beans;
|
|
|
|
using namespace com::sun::star::sdbc;
|
|
|
|
using namespace com::sun::star::sdbcx;
|
|
|
|
using namespace com::sun::star::container;
|
|
|
|
|
|
|
|
// Maximale Anzahl von Rows, die mit ORDER BY sortiert durchlaufen werden koennen:
|
|
|
|
#if defined (WIN)
|
|
|
|
#define MAX_KEYSET_SIZE 0x3ff0 // Etwas weniger als ein Segment, damit
|
|
|
|
// noch Platz fuer Memory Debug-Informationen
|
|
|
|
#else
|
|
|
|
#define MAX_KEYSET_SIZE 0x40000 // 256K
|
|
|
|
#endif
|
2008-10-01 12:28:29 +00:00
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
void lcl_throwError(sal_uInt16 _nErrorId,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xContext)
|
|
|
|
{
|
|
|
|
::connectivity::SharedResources aResources;
|
|
|
|
const ::rtl::OUString sMessage = aResources.getResourceString(_nErrorId);
|
|
|
|
::dbtools::throwGenericSQLException(sMessage ,_xContext);
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 15:18:56 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.drivers.file.ResultSet","com.sun.star.sdbc.ResultSet");
|
2002-01-16 07:44:56 +00:00
|
|
|
DBG_NAME( file_OResultSet )
|
2000-09-18 15:18:56 +00:00
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
OResultSet::OResultSet(OStatement_Base* pStmt,OSQLParseTreeIterator& _aSQLIterator) : OResultSet_BASE(m_aMutex)
|
2000-10-05 07:38:52 +00:00
|
|
|
,::comphelper::OPropertyContainer(OResultSet_BASE::rBHelper)
|
2006-06-20 00:26:07 +00:00
|
|
|
,m_aAssignValues(NULL)
|
|
|
|
,m_pEvaluationKeySet(NULL)
|
|
|
|
,m_aSkipDeletedSet(this)
|
|
|
|
,m_pFileSet(NULL)
|
|
|
|
,m_pSortIndex(NULL)
|
|
|
|
,m_pTable(NULL)
|
|
|
|
,m_pParseTree(pStmt->getParseTree())
|
|
|
|
,m_pSQLAnalyzer(NULL)
|
|
|
|
,m_aSQLIterator(_aSQLIterator)
|
|
|
|
,m_nFetchSize(0)
|
|
|
|
,m_nResultSetType(ResultSetType::SCROLL_INSENSITIVE)
|
|
|
|
,m_nFetchDirection(FetchDirection::FORWARD)
|
|
|
|
,m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE)
|
2004-08-02 16:02:55 +00:00
|
|
|
,m_xStatement(*pStmt)
|
2000-09-18 15:18:56 +00:00
|
|
|
,m_xMetaData(NULL)
|
2006-06-20 00:26:07 +00:00
|
|
|
,m_xDBMetaData(pStmt->getOwnConnection()->getMetaData())
|
|
|
|
,m_nTextEncoding(pStmt->getOwnConnection()->getTextEncoding())
|
|
|
|
,m_nRowPos(-1)
|
2000-09-18 15:18:56 +00:00
|
|
|
,m_nFilePos(0)
|
|
|
|
,m_nLastVisitedPos(-1)
|
2006-06-20 00:26:07 +00:00
|
|
|
,m_nRowCountResult(-1)
|
|
|
|
,m_nCurrentPosition(0)
|
2009-04-23 10:42:05 +00:00
|
|
|
,m_nColumnCount(0)
|
2006-06-20 00:26:07 +00:00
|
|
|
,m_bWasNull(sal_False)
|
|
|
|
,m_bEOF(sal_False)
|
|
|
|
,m_bLastRecord(sal_False)
|
2000-09-29 15:02:10 +00:00
|
|
|
,m_bInserted(sal_False)
|
|
|
|
,m_bRowUpdated(sal_False)
|
|
|
|
,m_bRowInserted(sal_False)
|
|
|
|
,m_bRowDeleted(sal_False)
|
2001-06-28 11:22:36 +00:00
|
|
|
,m_bShowDeleted(pStmt->getOwnConnection()->showDeleted())
|
2009-04-23 10:42:05 +00:00
|
|
|
,m_bIsCount(sal_False)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::OResultSet" );
|
2002-01-16 07:44:56 +00:00
|
|
|
DBG_CTOR( file_OResultSet, NULL );
|
2000-09-18 15:18:56 +00:00
|
|
|
osl_incrementInterlockedCount( &m_refCount );
|
2009-04-23 10:42:05 +00:00
|
|
|
m_bIsCount = (m_pParseTree &&
|
|
|
|
m_pParseTree->count() > 2 &&
|
|
|
|
SQL_ISRULE(m_pParseTree->getChild(2),scalar_exp_commalist) &&
|
|
|
|
SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0),derived_column) &&
|
|
|
|
SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0)->getChild(0),general_set_fct) &&
|
|
|
|
m_pParseTree->getChild(2)->getChild(0)->getChild(0)->count() == 4
|
|
|
|
);
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2001-01-09 14:37:39 +00:00
|
|
|
m_nResultSetConcurrency = isCount() ? ResultSetConcurrency::READ_ONLY : ResultSetConcurrency::UPDATABLE;
|
2000-09-18 15:18:56 +00:00
|
|
|
construct();
|
2009-02-13 07:10:18 +00:00
|
|
|
m_aSkipDeletedSet.SetDeleted(m_bShowDeleted);
|
2000-09-18 15:18:56 +00:00
|
|
|
osl_decrementInterlockedCount( &m_refCount );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
OResultSet::~OResultSet()
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::~OResultSet" );
|
2001-08-24 05:19:41 +00:00
|
|
|
osl_incrementInterlockedCount( &m_refCount );
|
|
|
|
disposing();
|
2002-01-16 07:44:56 +00:00
|
|
|
DBG_DTOR( file_OResultSet, NULL );
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void OResultSet::construct()
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::construct" );
|
2001-05-14 10:55:19 +00:00
|
|
|
registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE), PROPERTY_ID_FETCHSIZE, 0,&m_nFetchSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL)));
|
|
|
|
registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE), PROPERTY_ID_RESULTSETTYPE, PropertyAttribute::READONLY,&m_nResultSetType, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL)));
|
|
|
|
registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION), PROPERTY_ID_FETCHDIRECTION, 0,&m_nFetchDirection, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL)));
|
|
|
|
registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY), PROPERTY_ID_RESULTSETCONCURRENCY,PropertyAttribute::READONLY,&m_nResultSetConcurrency, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL)));
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void OResultSet::disposing(void)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::disposing" );
|
2000-09-18 15:18:56 +00:00
|
|
|
OPropertySetHelper::disposing();
|
|
|
|
|
|
|
|
::osl::MutexGuard aGuard(m_aMutex);
|
2009-09-08 09:50:48 +00:00
|
|
|
m_xStatement.clear();
|
|
|
|
m_xMetaData.clear();
|
2000-09-18 15:18:56 +00:00
|
|
|
m_pParseTree = NULL;
|
2009-09-08 09:50:48 +00:00
|
|
|
m_xColNames.clear();
|
|
|
|
m_xColumns = NULL;
|
2000-11-03 13:21:22 +00:00
|
|
|
m_xParamColumns = NULL;
|
2009-09-08 09:50:48 +00:00
|
|
|
m_xColsIdx.clear();
|
2000-11-03 13:21:22 +00:00
|
|
|
|
2005-09-23 10:38:50 +00:00
|
|
|
Reference<XComponent> xComp = m_pTable;
|
|
|
|
if ( xComp.is() )
|
|
|
|
xComp->removeEventListener(this);
|
2000-09-18 15:18:56 +00:00
|
|
|
if(m_pTable)
|
|
|
|
{
|
|
|
|
m_pTable->release();
|
|
|
|
m_pTable = NULL;
|
|
|
|
}
|
2001-08-24 05:19:41 +00:00
|
|
|
clear();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OResultSet::clear()
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::clear" );
|
2001-08-29 11:21:08 +00:00
|
|
|
m_pFileSet = NULL;
|
2000-09-18 15:18:56 +00:00
|
|
|
DELETEZ(m_pSortIndex);
|
|
|
|
|
2010-10-15 12:10:06 -05:00
|
|
|
if(m_aInsertRow.is())
|
2008-12-30 13:32:01 +00:00
|
|
|
m_aInsertRow->get().clear();
|
2001-05-10 13:31:14 +00:00
|
|
|
|
2001-10-26 06:45:13 +00:00
|
|
|
m_aSkipDeletedSet.clear();
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
//RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::queryInterface" );
|
2000-09-18 15:18:56 +00:00
|
|
|
Any aRet = OPropertySetHelper::queryInterface(rType);
|
2001-08-24 05:19:41 +00:00
|
|
|
return aRet.hasValue() ? aRet : OResultSet_BASE::queryInterface(rType);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
2001-06-27 09:02:11 +00:00
|
|
|
Sequence< Type > SAL_CALL OResultSet::getTypes( ) throw(RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
//RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getTypes" );
|
2000-09-18 15:18:56 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
2001-06-27 09:02:11 +00:00
|
|
|
OTypeCollection aTypes( ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ),
|
|
|
|
::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet > *)0 ),
|
|
|
|
::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet > *)0 ));
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2000-10-09 11:34:19 +00:00
|
|
|
return ::comphelper::concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes());
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::findColumn" );
|
2000-09-18 15:18:56 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
Reference< XResultSetMetaData > xMeta = getMetaData();
|
|
|
|
sal_Int32 nLen = xMeta->getColumnCount();
|
|
|
|
sal_Int32 i = 1;
|
|
|
|
for(;i<=nLen;++i)
|
2001-05-17 05:46:55 +00:00
|
|
|
if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) :
|
|
|
|
columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
|
2000-09-18 15:18:56 +00:00
|
|
|
break;
|
|
|
|
return i;
|
|
|
|
}
|
2001-05-23 08:18:28 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
2001-07-30 07:53:02 +00:00
|
|
|
const ORowSetValue& OResultSet::getValue(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getValue" );
|
2001-07-30 07:53:02 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2003-09-04 07:25:33 +00:00
|
|
|
//columnIndex = mapColumn(columnIndex);
|
2001-07-30 07:53:02 +00:00
|
|
|
checkIndex(columnIndex );
|
|
|
|
|
2002-12-10 09:42:15 +00:00
|
|
|
|
2008-12-30 13:32:01 +00:00
|
|
|
m_bWasNull = (m_aSelectRow->get())[columnIndex]->getValue().isNull();
|
|
|
|
return *(m_aSelectRow->get())[columnIndex];
|
2001-07-30 07:53:02 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2001-05-23 08:18:28 +00:00
|
|
|
void OResultSet::checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
//RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::checkIndex" );
|
2002-12-10 09:42:15 +00:00
|
|
|
if ( columnIndex <= 0
|
2003-03-19 15:38:50 +00:00
|
|
|
// || columnIndex > (sal_Int32)m_xColumns->size()
|
2009-04-23 10:42:05 +00:00
|
|
|
|| columnIndex >= m_nColumnCount )
|
2001-05-23 08:18:28 +00:00
|
|
|
::dbtools::throwInvalidIndexException(*this);
|
|
|
|
}
|
2000-09-18 15:18:56 +00:00
|
|
|
// -------------------------------------------------------------------------
|
2006-06-20 00:26:07 +00:00
|
|
|
Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getBinaryStream" );
|
2000-09-18 15:18:56 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
2006-06-20 00:26:07 +00:00
|
|
|
Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getCharacterStream" );
|
2000-09-18 15:18:56 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getBoolean" );
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getByte" );
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getBytes" );
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
::com::sun::star::util::Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getDate" );
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getDouble" );
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getFloat" );
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getInt" );
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getRow" );
|
2000-09-18 15:18:56 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2001-08-27 08:13:35 +00:00
|
|
|
OSL_ENSURE((m_bShowDeleted || !m_aRow->isDeleted()),"getRow called for deleted row");
|
|
|
|
|
2008-12-30 13:32:01 +00:00
|
|
|
return m_aSkipDeletedSet.getMappedPosition((m_aRow->get())[0]->getValue());
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getLong" );
|
2002-01-22 11:49:36 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getMetaData" );
|
2000-09-18 15:18:56 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
if(!m_xMetaData.is())
|
2000-11-20 08:57:42 +00:00
|
|
|
m_xMetaData = new OResultSetMetaData(m_xColumns,m_aSQLIterator.getTables().begin()->first,m_pTable);
|
2000-09-18 15:18:56 +00:00
|
|
|
return m_xMetaData;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
2006-06-20 00:26:07 +00:00
|
|
|
Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getArray" );
|
2000-09-18 15:18:56 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
2006-06-20 00:26:07 +00:00
|
|
|
Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getClob" );
|
2000-09-18 15:18:56 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
2006-06-20 00:26:07 +00:00
|
|
|
Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getBlob" );
|
2000-09-18 15:18:56 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
2006-06-20 00:26:07 +00:00
|
|
|
Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getRef" );
|
2000-09-18 15:18:56 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
2006-06-20 00:26:07 +00:00
|
|
|
Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getObject" );
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex).makeAny();
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getShort" );
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
//RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getString" );
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
::com::sun::star::util::Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getTime" );
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
::com::sun::star::util::DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getTimestamp" );
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isAfterLast" );
|
2000-09-18 15:18:56 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2008-12-30 13:32:01 +00:00
|
|
|
return m_nRowPos == sal_Int32(m_pFileSet->get().size());
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isFirst" );
|
2000-09-18 15:18:56 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2001-04-04 13:26:18 +00:00
|
|
|
return m_nRowPos == 0;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isLast" );
|
2000-09-18 15:18:56 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2008-12-30 13:32:01 +00:00
|
|
|
return m_nRowPos == sal_Int32(m_pFileSet->get().size() - 1);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::beforeFirst" );
|
2000-09-18 15:18:56 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
if(first())
|
|
|
|
previous();
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::afterLast" );
|
2000-09-18 15:18:56 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
if(last())
|
|
|
|
next();
|
|
|
|
m_bEOF = sal_True;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::close" );
|
2005-09-23 10:38:50 +00:00
|
|
|
dispose();
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::first" );
|
2001-08-24 05:19:41 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
2001-11-15 14:20:06 +00:00
|
|
|
return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::FIRST,1,sal_True) : sal_False;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::last" );
|
2000-09-18 15:18:56 +00:00
|
|
|
// here I know definitely that I stand on the last record
|
2001-08-24 05:19:41 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
2001-11-15 14:20:06 +00:00
|
|
|
return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::LAST,1,sal_True) : sal_False;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::absolute" );
|
2001-08-24 05:19:41 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
2001-11-15 14:20:06 +00:00
|
|
|
return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::ABSOLUTE,row,sal_True) : sal_False;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::relative" );
|
2001-08-24 05:19:41 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
2001-11-15 14:20:06 +00:00
|
|
|
return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::RELATIVE,row,sal_True) : sal_False;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::previous" );
|
2001-08-24 05:19:41 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
2001-11-15 14:20:06 +00:00
|
|
|
return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::PRIOR,0,sal_True) : sal_False;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getStatement" );
|
2000-09-29 15:02:10 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2000-09-29 15:02:10 +00:00
|
|
|
|
2004-08-02 16:02:55 +00:00
|
|
|
return m_xStatement;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::rowDeleted" );
|
2000-09-18 15:18:56 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2000-09-29 15:02:10 +00:00
|
|
|
return m_bRowDeleted;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException)
|
|
|
|
{ ::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2000-09-29 15:02:10 +00:00
|
|
|
return m_bRowInserted;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::rowInserted" );
|
2000-09-18 15:18:56 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2000-09-29 15:02:10 +00:00
|
|
|
return m_bRowUpdated;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isBeforeFirst" );
|
2000-09-18 15:18:56 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2001-04-04 13:26:18 +00:00
|
|
|
return m_nRowPos == -1;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool OResultSet::evaluate()
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::evaluate" );
|
2001-05-07 09:37:54 +00:00
|
|
|
OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::evaluate: Analyzer isn't set!");
|
2000-09-18 15:18:56 +00:00
|
|
|
sal_Bool bRet = sal_True;
|
2001-05-07 09:37:54 +00:00
|
|
|
while(!m_pSQLAnalyzer->evaluateRestriction())
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
if(m_pEvaluationKeySet)
|
|
|
|
{
|
|
|
|
if(m_aEvaluateIter == m_pEvaluationKeySet->end())
|
|
|
|
return sal_False;
|
2001-10-26 06:45:13 +00:00
|
|
|
bRet = m_pTable->seekRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),m_nRowPos);
|
2000-09-18 15:18:56 +00:00
|
|
|
++m_aEvaluateIter;
|
|
|
|
}
|
|
|
|
else
|
2001-10-26 06:45:13 +00:00
|
|
|
bRet = m_pTable->seekRow(IResultSetHelper::NEXT,1,m_nRowPos);
|
2000-09-18 15:18:56 +00:00
|
|
|
if(bRet)
|
|
|
|
{
|
|
|
|
if(m_pEvaluationKeySet)
|
|
|
|
{
|
2010-10-15 12:10:06 -05:00
|
|
|
bRet = m_pTable->fetchRow(m_aEvaluateRow,*(m_pTable->getTableColumns()),sal_True,sal_True);
|
2000-09-18 15:18:56 +00:00
|
|
|
evaluate();
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
2010-10-15 12:10:06 -05:00
|
|
|
bRet = m_pTable->fetchRow(m_aRow,*m_xColumns,sal_False,sal_True);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::next" );
|
2000-09-18 15:18:56 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2001-10-26 06:45:13 +00:00
|
|
|
return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::NEXT,1,sal_True) : sal_False;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
//RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::wasNull" );
|
2000-09-18 15:18:56 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
return m_bWasNull;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::cancel( ) throw(RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::cancel" );
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::clearWarnings( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::clearWarnings" );
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
Any SAL_CALL OResultSet::getWarnings( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getWarnings" );
|
2000-09-18 15:18:56 +00:00
|
|
|
return Any();
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::insertRow" );
|
2000-09-29 15:02:10 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2000-09-29 15:02:10 +00:00
|
|
|
|
2001-11-15 14:20:06 +00:00
|
|
|
if(!m_bInserted || !m_pTable)
|
2001-05-17 05:46:55 +00:00
|
|
|
throwFunctionSequenceException(*this);
|
2000-09-29 15:02:10 +00:00
|
|
|
|
2001-03-02 12:45:45 +00:00
|
|
|
// we know that we append new rows at the end
|
|
|
|
// so we have to know where the end is
|
2001-10-26 06:45:13 +00:00
|
|
|
m_aSkipDeletedSet.skipDeleted(IResultSetHelper::LAST,1,sal_False);
|
2010-10-15 12:10:06 -05:00
|
|
|
m_bRowInserted = m_pTable->InsertRow(*m_aInsertRow, TRUE, m_xColsIdx);
|
|
|
|
if(m_bRowInserted && m_pFileSet.is())
|
2000-09-29 15:02:10 +00:00
|
|
|
{
|
2008-12-30 13:32:01 +00:00
|
|
|
sal_Int32 nPos = (m_aInsertRow->get())[0]->getValue();
|
|
|
|
m_pFileSet->get().push_back(nPos);
|
|
|
|
*(m_aInsertRow->get())[0] = sal_Int32(m_pFileSet->get().size());
|
2001-08-09 12:12:51 +00:00
|
|
|
clearInsertRow();
|
2001-08-10 07:11:09 +00:00
|
|
|
|
2008-12-30 13:32:01 +00:00
|
|
|
m_aSkipDeletedSet.insertNewPosition((m_aRow->get())[0]->getValue());
|
2000-09-29 15:02:10 +00:00
|
|
|
}
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateRow" );
|
2001-05-10 13:31:14 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2001-11-15 14:20:06 +00:00
|
|
|
if(!m_pTable || m_pTable->isReadOnly())
|
2008-10-01 12:28:29 +00:00
|
|
|
lcl_throwError(STR_TABLE_READONLY,*this);
|
|
|
|
|
2010-10-15 12:10:06 -05:00
|
|
|
m_bRowUpdated = m_pTable->UpdateRow(*m_aInsertRow, m_aRow,m_xColsIdx);
|
2008-12-30 13:32:01 +00:00
|
|
|
*(m_aInsertRow->get())[0] = (sal_Int32)(m_aRow->get())[0]->getValue();
|
2001-01-22 06:17:49 +00:00
|
|
|
|
2001-08-09 12:12:51 +00:00
|
|
|
clearInsertRow();
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
2001-05-10 13:31:14 +00:00
|
|
|
void SAL_CALL OResultSet::deleteRow() throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::deleteRow" );
|
2001-05-10 13:31:14 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2001-05-10 13:31:14 +00:00
|
|
|
|
2001-11-15 14:20:06 +00:00
|
|
|
if(!m_pTable || m_pTable->isReadOnly())
|
2008-10-01 12:28:29 +00:00
|
|
|
lcl_throwError(STR_TABLE_READONLY,*this);
|
2001-06-28 11:22:36 +00:00
|
|
|
if (m_bShowDeleted)
|
2008-10-01 12:28:29 +00:00
|
|
|
lcl_throwError(STR_DELETE_ROW,*this);
|
2001-06-28 11:22:36 +00:00
|
|
|
if(m_aRow->isDeleted())
|
2008-10-01 12:28:29 +00:00
|
|
|
lcl_throwError(STR_ROW_ALREADY_DELETED,*this);
|
2001-06-28 11:22:36 +00:00
|
|
|
|
2008-12-30 13:32:01 +00:00
|
|
|
sal_Int32 nPos = (sal_Int32)(m_aRow->get())[0]->getValue();
|
2010-10-15 12:10:06 -05:00
|
|
|
m_bRowDeleted = m_pTable->DeleteRow(*m_xColumns);
|
|
|
|
if(m_bRowDeleted && m_pFileSet.is())
|
2000-09-29 15:02:10 +00:00
|
|
|
{
|
|
|
|
m_aRow->setDeleted(sal_True);
|
2001-05-10 13:31:14 +00:00
|
|
|
// don't touch the m_pFileSet member here
|
2001-10-26 06:45:13 +00:00
|
|
|
m_aSkipDeletedSet.deletePosition(nPos);
|
2000-09-29 15:02:10 +00:00
|
|
|
}
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::cancelRowUpdates" );
|
2000-09-29 15:02:10 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2000-09-29 15:02:10 +00:00
|
|
|
|
|
|
|
m_bInserted = sal_False;
|
|
|
|
m_bRowUpdated = sal_False;
|
|
|
|
m_bRowInserted = sal_False;
|
|
|
|
m_bRowDeleted = sal_False;
|
|
|
|
|
2010-10-15 12:10:06 -05:00
|
|
|
if(m_aInsertRow.is())
|
2000-09-29 15:02:10 +00:00
|
|
|
{
|
2008-12-30 13:32:01 +00:00
|
|
|
OValueRefVector::Vector::iterator aIter = m_aInsertRow->get().begin()+1;
|
|
|
|
for(;aIter != m_aInsertRow->get().end();++aIter)
|
2000-11-15 15:02:00 +00:00
|
|
|
{
|
2003-09-04 07:25:33 +00:00
|
|
|
(*aIter)->setBound(sal_False);
|
|
|
|
(*aIter)->setNull();
|
2000-11-15 15:02:00 +00:00
|
|
|
}
|
2000-09-29 15:02:10 +00:00
|
|
|
}
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::moveToInsertRow" );
|
2000-09-29 15:02:10 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2001-11-15 14:20:06 +00:00
|
|
|
if(!m_pTable || m_pTable->isReadOnly())
|
2008-10-01 12:28:29 +00:00
|
|
|
lcl_throwError(STR_TABLE_READONLY,*this);
|
2000-09-29 15:02:10 +00:00
|
|
|
|
|
|
|
m_bInserted = sal_True;
|
|
|
|
|
2008-12-30 13:32:01 +00:00
|
|
|
OValueRefVector::Vector::iterator aIter = m_aInsertRow->get().begin()+1;
|
|
|
|
for(;aIter != m_aInsertRow->get().end();++aIter)
|
2000-11-15 15:02:00 +00:00
|
|
|
{
|
2003-09-04 07:25:33 +00:00
|
|
|
(*aIter)->setBound(sal_False);
|
|
|
|
(*aIter)->setNull();
|
2000-11-15 15:02:00 +00:00
|
|
|
}
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::moveToCurrentRow" );
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
2001-07-30 07:53:02 +00:00
|
|
|
void OResultSet::updateValue(sal_Int32 columnIndex ,const ORowSetValue& x) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateValue" );
|
2000-09-29 15:02:10 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2002-12-10 09:42:15 +00:00
|
|
|
checkIndex(columnIndex );
|
2004-06-01 09:06:48 +00:00
|
|
|
columnIndex = mapColumn(columnIndex);
|
2002-12-10 09:42:15 +00:00
|
|
|
|
2008-12-30 13:32:01 +00:00
|
|
|
(m_aInsertRow->get())[columnIndex]->setBound(sal_True);
|
|
|
|
*(m_aInsertRow->get())[columnIndex] = x;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2001-07-30 07:53:02 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2001-07-30 07:53:02 +00:00
|
|
|
void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateNull" );
|
2007-09-26 13:29:00 +00:00
|
|
|
ORowSetValue aEmpty;
|
|
|
|
updateValue(columnIndex,aEmpty);
|
2001-07-30 07:53:02 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateBoolean" );
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateByte" );
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateShort" );
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateInt" );
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
2006-06-20 00:26:07 +00:00
|
|
|
void SAL_CALL OResultSet::updateLong( sal_Int32 /*columnIndex*/, sal_Int64 /*x*/ ) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateLong" );
|
2006-06-20 00:26:07 +00:00
|
|
|
::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateLong", *this );
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateFloat" );
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateDouble" );
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateString" );
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateBytes" );
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateDate" );
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateTime" );
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateTimestamp" );
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateBinaryStream" );
|
2000-09-29 15:02:10 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2001-04-02 08:18:37 +00:00
|
|
|
if(!x.is())
|
2001-04-19 06:14:49 +00:00
|
|
|
::dbtools::throwFunctionSequenceException(*this);
|
2000-09-29 15:02:10 +00:00
|
|
|
|
2000-11-15 15:02:00 +00:00
|
|
|
Sequence<sal_Int8> aSeq;
|
2008-12-01 12:31:27 +00:00
|
|
|
x->readBytes(aSeq,length);
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,aSeq);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateCharacterStream" );
|
2001-07-30 07:53:02 +00:00
|
|
|
updateBinaryStream(columnIndex,x,length);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::refreshRow" );
|
2000-09-18 15:18:56 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2001-05-17 05:46:55 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateObject" );
|
2001-07-30 07:53:02 +00:00
|
|
|
if (!::dbtools::implUpdateObject(this, columnIndex, x))
|
|
|
|
throw SQLException();
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
2006-06-20 00:26:07 +00:00
|
|
|
void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateNumericObject" );
|
2001-07-30 07:53:02 +00:00
|
|
|
if (!::dbtools::implUpdateObject(this, columnIndex, x))
|
|
|
|
throw SQLException();
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
//RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::createArrayHelper" );
|
2000-09-29 15:02:10 +00:00
|
|
|
Sequence< Property > aProps;
|
2000-09-18 15:18:56 +00:00
|
|
|
describeProperties(aProps);
|
|
|
|
return new ::cppu::OPropertyArrayHelper(aProps);
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
IPropertyArrayHelper & OResultSet::getInfoHelper()
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
//RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getInfoHelper" );
|
2000-09-18 15:18:56 +00:00
|
|
|
return *const_cast<OResultSet*>(this)->getArrayHelper();
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
2001-10-26 06:45:13 +00:00
|
|
|
BOOL OResultSet::ExecuteRow(IResultSetHelper::Movement eFirstCursorPosition,
|
2000-09-18 15:18:56 +00:00
|
|
|
INT32 nFirstOffset,
|
|
|
|
BOOL bEvaluate,
|
|
|
|
BOOL bRetrieveData)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::ExecuteRow" );
|
2001-05-07 09:37:54 +00:00
|
|
|
OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::ExecuteRow: Analyzer isn't set!");
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
// Fuer weitere Fetch-Operationen werden diese Angaben ggf. veraendert ...
|
2001-10-26 06:45:13 +00:00
|
|
|
IResultSetHelper::Movement eCursorPosition = eFirstCursorPosition;
|
2000-09-18 15:18:56 +00:00
|
|
|
INT32 nOffset = nFirstOffset;
|
|
|
|
|
2010-10-15 12:10:06 -05:00
|
|
|
const OSQLColumns & rTableCols = *(m_pTable->getTableColumns());
|
2007-09-26 13:29:00 +00:00
|
|
|
BOOL bHasRestriction = m_pSQLAnalyzer->hasRestriction();
|
2000-09-18 15:18:56 +00:00
|
|
|
again:
|
|
|
|
|
|
|
|
// protect from reading over the end when someboby is inserting while we are reading
|
|
|
|
// this method works only for dBase at the moment !!!!
|
2001-10-26 06:45:13 +00:00
|
|
|
if (eCursorPosition == IResultSetHelper::NEXT && m_nFilePos == m_nLastVisitedPos)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
|
2001-11-15 14:20:06 +00:00
|
|
|
if (!m_pTable || !m_pTable->seekRow(eCursorPosition, nOffset, m_nFilePos))
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!bEvaluate) // Laeuft keine Auswertung, dann nur Ergebniszeile fuellen
|
|
|
|
{
|
2007-09-26 13:29:00 +00:00
|
|
|
m_pTable->fetchRow(m_aRow,rTableCols, sal_True,bRetrieveData);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-09-26 13:29:00 +00:00
|
|
|
m_pTable->fetchRow(m_aEvaluateRow, rTableCols, sal_True,bRetrieveData || bHasRestriction);
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2007-09-26 13:29:00 +00:00
|
|
|
if ( (!m_bShowDeleted && m_aEvaluateRow->isDeleted())
|
|
|
|
|| (bHasRestriction && //!bShowDeleted && m_aEvaluateRow->isDeleted() ||// keine Anzeige von geloeschten Saetzen
|
|
|
|
!m_pSQLAnalyzer->evaluateRestriction())) // Auswerten der Bedingungen
|
2000-09-18 15:18:56 +00:00
|
|
|
{ // naechsten Satz auswerten
|
|
|
|
// aktuelle Zeile loeschen im Keyset
|
|
|
|
if (m_pEvaluationKeySet)
|
|
|
|
{
|
|
|
|
++m_aEvaluateIter;
|
|
|
|
if (m_pEvaluationKeySet->end() != m_aEvaluateIter)
|
|
|
|
nOffset = (*m_aEvaluateIter);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
}
|
2010-10-15 12:10:06 -05:00
|
|
|
else if (m_pFileSet.is())
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-02-21 09:06:46 +00:00
|
|
|
OSL_ENSURE(//!m_pFileSet->IsFrozen() &&
|
2001-10-26 06:45:13 +00:00
|
|
|
eCursorPosition == IResultSetHelper::NEXT, "Falsche CursorPosition!");
|
|
|
|
eCursorPosition = IResultSetHelper::NEXT;
|
2000-09-18 15:18:56 +00:00
|
|
|
nOffset = 1;
|
|
|
|
}
|
2001-10-26 06:45:13 +00:00
|
|
|
else if (eCursorPosition == IResultSetHelper::FIRST ||
|
|
|
|
eCursorPosition == IResultSetHelper::NEXT ||
|
|
|
|
eCursorPosition == IResultSetHelper::ABSOLUTE)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-10-26 06:45:13 +00:00
|
|
|
eCursorPosition = IResultSetHelper::NEXT;
|
2000-09-18 15:18:56 +00:00
|
|
|
nOffset = 1;
|
|
|
|
}
|
2001-10-26 06:45:13 +00:00
|
|
|
else if (eCursorPosition == IResultSetHelper::LAST ||
|
|
|
|
eCursorPosition == IResultSetHelper::PRIOR)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-10-26 06:45:13 +00:00
|
|
|
eCursorPosition = IResultSetHelper::PRIOR;
|
2000-09-18 15:18:56 +00:00
|
|
|
nOffset = 1;
|
|
|
|
}
|
2001-10-26 06:45:13 +00:00
|
|
|
else if (eCursorPosition == IResultSetHelper::RELATIVE)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-10-26 06:45:13 +00:00
|
|
|
eCursorPosition = (nOffset >= 0) ? IResultSetHelper::NEXT : IResultSetHelper::PRIOR;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// aStatus.Set(SQL_STAT_NO_DATA_FOUND);
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
// Nochmal probieren ...
|
|
|
|
goto again;
|
|
|
|
}
|
|
|
|
}
|
2003-09-04 07:25:33 +00:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
// Evaluate darf nur gesetzt sein,
|
|
|
|
// wenn der Keyset weiter aufgebaut werden soll
|
2001-01-09 14:37:39 +00:00
|
|
|
if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT && !isCount() &&
|
2010-10-15 12:10:06 -05:00
|
|
|
(m_pFileSet.is() || m_pSortIndex) && bEvaluate)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
if (m_pSortIndex)
|
|
|
|
{
|
2001-08-29 11:21:08 +00:00
|
|
|
OKeyValue* pKeyValue = GetOrderbyKeyValue(m_aEvaluateRow);
|
2001-10-30 13:23:24 +00:00
|
|
|
m_pSortIndex->AddKeyValue(pKeyValue);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2010-10-15 12:10:06 -05:00
|
|
|
else if (m_pFileSet.is())
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-02-21 09:06:46 +00:00
|
|
|
// OSL_ENSURE(!m_pFileSet->IsFrozen() , "Falsche CursorPosition!");
|
2008-12-30 13:32:01 +00:00
|
|
|
sal_uInt32 nBookmarkValue = Abs((sal_Int32)(m_aEvaluateRow->get())[0]->getValue());
|
|
|
|
m_pFileSet->get().push_back(nBookmarkValue);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_UPDATE)
|
|
|
|
{
|
|
|
|
sal_Bool bOK = sal_True;
|
|
|
|
if (bEvaluate)
|
|
|
|
{
|
|
|
|
// jetzt die eigentliche Ergebniszeile Lesen
|
2010-10-15 12:10:06 -05:00
|
|
|
bOK = m_pTable->fetchRow(m_aEvaluateRow, *(m_pTable->getTableColumns()), sal_True,TRUE);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (bOK)
|
|
|
|
{
|
|
|
|
// Nur die zu aendernden Werte uebergeben:
|
2010-10-15 12:10:06 -05:00
|
|
|
if(!m_pTable->UpdateRow(*m_aAssignValues,m_aEvaluateRow, m_xColsIdx))
|
2000-09-18 15:18:56 +00:00
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_DELETE)
|
|
|
|
{
|
|
|
|
sal_Bool bOK = sal_True;
|
|
|
|
if (bEvaluate)
|
|
|
|
{
|
2010-10-15 12:10:06 -05:00
|
|
|
bOK = m_pTable->fetchRow(m_aEvaluateRow, *(m_pTable->getTableColumns()), sal_True,TRUE);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
if (bOK)
|
|
|
|
{
|
2010-10-15 12:10:06 -05:00
|
|
|
if(!m_pTable->DeleteRow(*m_xColumns))
|
2000-09-18 15:18:56 +00:00
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return sal_True;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
2001-10-26 06:45:13 +00:00
|
|
|
BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 nOffset, BOOL bRetrieveData)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::Move" );
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2000-09-29 15:02:10 +00:00
|
|
|
//IgnoreDeletedRows:
|
|
|
|
//
|
2000-09-18 15:18:56 +00:00
|
|
|
INT32 nTempPos = m_nRowPos;
|
|
|
|
|
2001-01-09 14:37:39 +00:00
|
|
|
if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT &&
|
|
|
|
!isCount())
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2010-10-15 12:10:06 -05:00
|
|
|
if (!m_pFileSet.is()) // kein Index verfuegbar
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
// Normales FETCH
|
2006-06-20 00:26:07 +00:00
|
|
|
ExecuteRow(eCursorPosition,nOffset,FALSE,bRetrieveData);
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2001-05-10 13:31:14 +00:00
|
|
|
// now set the bookmark for outside this is the logical pos and not the file pos
|
2008-12-30 13:32:01 +00:00
|
|
|
*(*m_aRow->get().begin()) = sal_Int32(m_nRowPos + 1);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch(eCursorPosition)
|
|
|
|
{
|
2001-10-26 06:45:13 +00:00
|
|
|
case IResultSetHelper::NEXT:
|
2001-08-27 08:13:35 +00:00
|
|
|
++m_nRowPos;
|
2000-09-18 15:18:56 +00:00
|
|
|
break;
|
2001-10-26 06:45:13 +00:00
|
|
|
case IResultSetHelper::PRIOR:
|
2000-09-18 15:18:56 +00:00
|
|
|
if (m_nRowPos >= 0)
|
2001-08-27 08:13:35 +00:00
|
|
|
--m_nRowPos;
|
2000-09-18 15:18:56 +00:00
|
|
|
break;
|
2001-10-26 06:45:13 +00:00
|
|
|
case IResultSetHelper::FIRST:
|
2000-09-18 15:18:56 +00:00
|
|
|
m_nRowPos = 0;
|
|
|
|
break;
|
2001-10-26 06:45:13 +00:00
|
|
|
case IResultSetHelper::LAST:
|
2005-02-16 16:25:50 +00:00
|
|
|
// OSL_ENSURE(IsRowCountFinal(), "Fehler im Keyset!"); // muss eingefroren sein, sonst Fehler beim SQLCursor
|
2008-12-30 13:32:01 +00:00
|
|
|
m_nRowPos = m_pFileSet->get().size() - 1;
|
2000-09-18 15:18:56 +00:00
|
|
|
break;
|
2001-10-26 06:45:13 +00:00
|
|
|
case IResultSetHelper::RELATIVE:
|
2000-09-18 15:18:56 +00:00
|
|
|
m_nRowPos += nOffset;
|
|
|
|
break;
|
2001-10-26 06:45:13 +00:00
|
|
|
case IResultSetHelper::ABSOLUTE:
|
|
|
|
case IResultSetHelper::BOOKMARK:
|
2007-09-26 13:29:00 +00:00
|
|
|
if ( m_nRowPos == (nOffset -1) )
|
|
|
|
return sal_True;
|
2001-08-27 08:13:35 +00:00
|
|
|
m_nRowPos = nOffset -1;
|
2000-09-18 15:18:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// OffRange?
|
2005-02-16 16:25:50 +00:00
|
|
|
// Der FileCursor ist ausserhalb des gueltigen Bereichs, wenn
|
2000-09-18 15:18:56 +00:00
|
|
|
// a.) m_nRowPos < 1
|
|
|
|
// b.) Ein KeySet besteht und m_nRowPos > m_pFileSet->size()
|
2008-12-30 13:32:01 +00:00
|
|
|
if (m_nRowPos < 0 || (m_pFileSet->isFrozen() && eCursorPosition != IResultSetHelper::BOOKMARK && m_nRowPos >= (INT32)m_pFileSet->get().size() )) // && m_pFileSet->IsFrozen()
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
// aStatus.Set(SQL_STAT_NO_DATA_FOUND);
|
|
|
|
goto Error;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-12-30 13:32:01 +00:00
|
|
|
if (m_nRowPos < (INT32)m_pFileSet->get().size())
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
// Fetch ueber Index
|
2008-12-30 13:32:01 +00:00
|
|
|
ExecuteRow(IResultSetHelper::BOOKMARK,(m_pFileSet->get())[m_nRowPos],FALSE,bRetrieveData);
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
// now set the bookmark for outside
|
2008-12-30 13:32:01 +00:00
|
|
|
*(*m_aRow->get().begin()) = sal_Int32(m_nRowPos + 1);
|
2007-09-26 13:29:00 +00:00
|
|
|
if ( (bRetrieveData || m_pSQLAnalyzer->hasRestriction()) && m_pSQLAnalyzer->hasFunctions() )
|
|
|
|
{
|
|
|
|
m_pSQLAnalyzer->setSelectionEvaluationResult(m_aSelectRow,m_aColMapping);
|
|
|
|
}
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2005-02-16 16:25:50 +00:00
|
|
|
else // Index muss weiter aufgebaut werden
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
// Zunaechst auf die letzte bekannte Zeile setzen
|
2008-12-30 13:32:01 +00:00
|
|
|
if (!m_pFileSet->get().empty())
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2008-12-30 13:32:01 +00:00
|
|
|
m_aFileSetIter = m_pFileSet->get().end()-1;
|
2000-09-18 15:18:56 +00:00
|
|
|
// m_pFileSet->SeekPos(m_pFileSet->size()-1);
|
2001-10-26 06:45:13 +00:00
|
|
|
m_pTable->seekRow(IResultSetHelper::BOOKMARK, *m_aFileSetIter, m_nFilePos);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
sal_Bool bOK = sal_True;
|
|
|
|
// Ermitteln der Anzahl weiterer Fetches
|
2008-12-30 13:32:01 +00:00
|
|
|
while (bOK && m_nRowPos >= (INT32)m_pFileSet->get().size())
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
if (m_pEvaluationKeySet)
|
|
|
|
{
|
|
|
|
if (m_nRowPos >= (INT32)m_pEvaluationKeySet->size())
|
|
|
|
return sal_False;
|
|
|
|
// aStatus.Set(SQL_STAT_NO_DATA_FOUND);
|
|
|
|
else if (m_nRowPos == 0)
|
|
|
|
{
|
|
|
|
m_aEvaluateIter = m_pEvaluationKeySet->begin();
|
2006-06-20 00:26:07 +00:00
|
|
|
bOK = ExecuteRow(IResultSetHelper::BOOKMARK,*m_aEvaluateIter,TRUE, bRetrieveData);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
++m_aEvaluateIter;
|
2006-06-20 00:26:07 +00:00
|
|
|
bOK = ExecuteRow(IResultSetHelper::BOOKMARK,*m_aEvaluateIter,TRUE, bRetrieveData);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2006-06-20 00:26:07 +00:00
|
|
|
bOK = ExecuteRow(IResultSetHelper::NEXT,1,TRUE, FALSE);//bRetrieveData);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (bOK)
|
|
|
|
{
|
|
|
|
// jetzt nochmal die Ergebnisse lesen
|
2010-10-15 12:10:06 -05:00
|
|
|
m_pTable->fetchRow(m_aRow, *(m_pTable->getTableColumns()), sal_True,bRetrieveData);
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
// now set the bookmark for outside
|
2008-12-30 13:32:01 +00:00
|
|
|
*(*m_aRow->get().begin()) = sal_Int32(m_nRowPos + 1);
|
2007-09-26 13:29:00 +00:00
|
|
|
|
|
|
|
if ( (bRetrieveData || m_pSQLAnalyzer->hasRestriction()) && m_pSQLAnalyzer->hasFunctions() )
|
|
|
|
{
|
|
|
|
m_pSQLAnalyzer->setSelectionEvaluationResult(m_aSelectRow,m_aColMapping);
|
|
|
|
}
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
else if (!m_pFileSet->isFrozen()) // keinen gueltigen Satz gefunden
|
|
|
|
{
|
|
|
|
//m_pFileSet->Freeze();
|
|
|
|
m_pFileSet->setFrozen();
|
|
|
|
|
2001-08-24 05:19:41 +00:00
|
|
|
// DELETEZ(m_pEvaluationKeySet);
|
|
|
|
m_pEvaluationKeySet = NULL;
|
2000-09-18 15:18:56 +00:00
|
|
|
// aStatus.Set(SQL_STAT_NO_DATA_FOUND);
|
|
|
|
goto Error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-01-09 14:37:39 +00:00
|
|
|
else if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT && isCount())
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
// Fetch des COUNT(*)
|
|
|
|
switch (eCursorPosition)
|
|
|
|
{
|
2001-10-26 06:45:13 +00:00
|
|
|
case IResultSetHelper::NEXT:
|
2001-08-27 08:13:35 +00:00
|
|
|
++m_nRowPos;
|
2000-09-18 15:18:56 +00:00
|
|
|
break;
|
2001-10-26 06:45:13 +00:00
|
|
|
case IResultSetHelper::PRIOR:
|
2001-08-27 08:13:35 +00:00
|
|
|
--m_nRowPos;
|
2000-09-18 15:18:56 +00:00
|
|
|
break;
|
2001-10-26 06:45:13 +00:00
|
|
|
case IResultSetHelper::FIRST:
|
2000-09-18 15:18:56 +00:00
|
|
|
m_nRowPos = 0;
|
|
|
|
break;
|
2001-10-26 06:45:13 +00:00
|
|
|
case IResultSetHelper::LAST:
|
2000-09-18 15:18:56 +00:00
|
|
|
m_nRowPos = 0;
|
|
|
|
break;
|
2001-10-26 06:45:13 +00:00
|
|
|
case IResultSetHelper::RELATIVE:
|
2000-09-18 15:18:56 +00:00
|
|
|
m_nRowPos += nOffset;
|
|
|
|
break;
|
2001-10-26 06:45:13 +00:00
|
|
|
case IResultSetHelper::ABSOLUTE:
|
|
|
|
case IResultSetHelper::BOOKMARK:
|
2000-09-18 15:18:56 +00:00
|
|
|
m_nRowPos = nOffset - 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-07-07 09:07:34 +02:00
|
|
|
if ( m_nRowPos < 0 )
|
|
|
|
goto Error;
|
|
|
|
else if (m_nRowPos == 0)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
// COUNT(*) in Ergebnisrow packen
|
|
|
|
// (muss die erste und einzige Variable in der Row sein)
|
2008-12-30 13:32:01 +00:00
|
|
|
if (m_aRow->get().size() >= 2)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2008-12-30 13:32:01 +00:00
|
|
|
*(m_aRow->get())[1] = m_nRowCountResult;
|
|
|
|
*(m_aRow->get())[0] = sal_Int32(1);
|
|
|
|
(m_aRow->get())[1]->setBound(sal_True);
|
|
|
|
(m_aSelectRow->get())[1] = (m_aRow->get())[1];
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-01-09 14:37:39 +00:00
|
|
|
m_bEOF = sal_True;
|
|
|
|
m_nRowPos = 1;
|
|
|
|
return sal_False;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
// Fetch nur bei SELECT moeglich!
|
|
|
|
return sal_False;
|
|
|
|
|
|
|
|
return sal_True;
|
|
|
|
|
|
|
|
Error:
|
|
|
|
// steht der Cursor vor dem ersten Satz
|
|
|
|
// dann wird die position beibehalten
|
|
|
|
if (nTempPos == -1)
|
|
|
|
m_nRowPos = nTempPos;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch(eCursorPosition)
|
|
|
|
{
|
2001-10-26 06:45:13 +00:00
|
|
|
case IResultSetHelper::PRIOR:
|
|
|
|
case IResultSetHelper::FIRST:
|
2000-09-18 15:18:56 +00:00
|
|
|
m_nRowPos = -1;
|
|
|
|
break;
|
2001-10-26 06:45:13 +00:00
|
|
|
case IResultSetHelper::LAST:
|
|
|
|
case IResultSetHelper::NEXT:
|
|
|
|
case IResultSetHelper::ABSOLUTE:
|
|
|
|
case IResultSetHelper::RELATIVE:
|
2000-09-18 15:18:56 +00:00
|
|
|
if (nOffset > 0)
|
2010-10-15 12:10:06 -05:00
|
|
|
m_nRowPos = m_pFileSet.is() ? (sal_Int32)m_pFileSet->get().size() : -1;
|
2000-09-18 15:18:56 +00:00
|
|
|
else if (nOffset < 0)
|
|
|
|
m_nRowPos = -1;
|
|
|
|
break;
|
2001-10-26 06:45:13 +00:00
|
|
|
case IResultSetHelper::BOOKMARK:
|
2000-09-18 15:18:56 +00:00
|
|
|
m_nRowPos = nTempPos; // vorherige Position
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// delete pGuard;
|
2005-02-16 16:25:50 +00:00
|
|
|
// rMode = (!bShowDeleted && aStatus.IsSuccessful() && m_aRow->isDeleted()) ? // keine Anzeige von geloeschten Saetzen
|
2000-09-18 15:18:56 +00:00
|
|
|
// OCursor::SQL_MOD_INVALID : OCursor::SQL_MOD_NONE;
|
|
|
|
return sal_False;
|
|
|
|
}
|
2008-06-06 12:22:12 +00:00
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void OResultSet::sortRows()
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::sortRows" );
|
2008-06-06 12:22:12 +00:00
|
|
|
if (!m_pSQLAnalyzer->hasRestriction() && m_aOrderbyColumnNumber.size() == 1)
|
|
|
|
{
|
|
|
|
// Ist nur ein Feld fuer die Sortierung angegeben
|
|
|
|
// Und diese Feld ist indiziert, dann den Index ausnutzen
|
|
|
|
Reference<XIndexesSupplier> xIndexSup;
|
|
|
|
m_pTable->queryInterface(::getCppuType((const Reference<XIndexesSupplier>*)0)) >>= xIndexSup;
|
|
|
|
// Reference<XIndexesSupplier> xIndexSup(m_pTable,UNO_QUERY);
|
|
|
|
Reference<XIndexAccess> xIndexes;
|
|
|
|
if(xIndexSup.is())
|
|
|
|
{
|
|
|
|
xIndexes.set(xIndexSup->getIndexes(),UNO_QUERY);
|
|
|
|
Reference<XPropertySet> xColProp;
|
|
|
|
if(m_aOrderbyColumnNumber[0] < xIndexes->getCount())
|
|
|
|
{
|
|
|
|
xColProp.set(xIndexes->getByIndex(m_aOrderbyColumnNumber[0]),UNO_QUERY);
|
|
|
|
// iterate through the indexes to find the matching column
|
|
|
|
const sal_Int32 nCount = xIndexes->getCount();
|
|
|
|
for(sal_Int32 i=0; i < nCount;++i)
|
|
|
|
{
|
|
|
|
Reference<XColumnsSupplier> xIndex(xIndexes->getByIndex(i),UNO_QUERY);
|
|
|
|
Reference<XNameAccess> xIndexCols = xIndex->getColumns();
|
|
|
|
if(xIndexCols->hasByName(comphelper::getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)))))
|
|
|
|
{
|
|
|
|
m_pFileSet = new OKeySet();
|
|
|
|
|
|
|
|
if(fillIndexValues(xIndex))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OSortIndex::TKeyTypeVector eKeyType(m_aOrderbyColumnNumber.size());
|
|
|
|
::std::vector<sal_Int32>::iterator aOrderByIter = m_aOrderbyColumnNumber.begin();
|
|
|
|
for (::std::vector<sal_Int16>::size_type i=0;aOrderByIter != m_aOrderbyColumnNumber.end(); ++aOrderByIter,++i)
|
|
|
|
{
|
2008-12-30 13:32:01 +00:00
|
|
|
OSL_ENSURE((sal_Int32)m_aRow->get().size() > *aOrderByIter,"Invalid Index");
|
|
|
|
switch ((*(m_aRow->get().begin()+*aOrderByIter))->getValue().getTypeKind())
|
2008-06-06 12:22:12 +00:00
|
|
|
{
|
CWS-TOOLING: integrate CWS dba32e
2009-08-10 13:16:25 +0200 fs r274805 : #i84390# typo corrected
2009-08-10 13:04:28 +0200 fs r274804 : #i103741# properly terminate the last token in a string with a 0 byte
2009-07-24 08:54:05 +0200 msc r274286 : #103219# changed long name
2009-07-24 08:42:28 +0200 msc r274285 : #i79649# changed behaviour of the wizard
2009-07-22 14:17:49 +0200 oj r274238 : GrabFocus
2009-07-22 13:38:01 +0200 oj r274232 : #i102934# mixed up
2009-07-22 13:37:16 +0200 oj r274231 : #i102934# mixed up
2009-07-21 12:30:36 +0200 oj r274176 : crash when using distinct
2009-07-21 10:03:44 +0200 oj r274163 : set last char to 0
2009-07-21 09:31:22 +0200 oj r274161 : mediatype corrected
2009-07-20 11:45:33 +0200 fs r274118 : typo in formatting string
2009-07-20 11:40:39 +0200 fs r274117 : removed unused include
2009-07-20 11:40:01 +0200 fs r274116 : class name corrected
2009-07-16 13:41:45 +0200 oj r274046 : i101587 wrong check for embeddeddatabase url in confguration, have to check path
2009-07-16 13:12:05 +0200 tbo r274044 : #i103219# adjust declarion to new hid.lst
2009-07-16 12:43:48 +0200 oj r274041 : #i102497# check also fot longvarchar
2009-07-16 12:15:41 +0200 oj r274039 : #i103030# handle type description and exceptions as well
2009-07-16 11:14:26 +0200 fs r274035 : let SVN ignore output paths
2009-07-16 09:23:43 +0200 fs r274030 : TransforFormComponentProperties: no need to check for attribute equality
2009-07-10 14:16:23 +0200 oj r273892 : CWS-TOOLING: rebase CWS dba32e to trunk@273858 (milestone: DEV300:m52)
2009-07-01 21:41:50 +0200 fs r273614 : #i10000#
2009-07-01 15:01:10 +0200 fs r273589 : Input required doesn't make sense at all in XML form documents
2009-07-01 12:10:31 +0200 fs r273562 : updated
2009-07-01 11:46:12 +0200 fs r273560 : #i103219# add about 100 missing long names
2009-07-01 10:11:41 +0200 fs r273551 : moved from socket/port usage to pipe/name usage, which is more common nowadays
2009-07-01 09:50:03 +0200 fs r273549 : removed obsolete (empty) folder
2009-07-01 09:47:35 +0200 fs r273548 : copied the code for the Accessibility Workbench herein, formerly located in the old CVS repository, at gsl/awb
2009-06-30 10:07:47 +0200 fs r273493 : merging latest changes from CWS dba32d
2009-06-29 20:46:31 +0200 fs r273482 : #i103138# Rectangle conversions
2009-06-29 10:01:13 +0200 fs r273453 : #i103138#
refactored the code for positioning/zooming the control
Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to
take an additional ViewTransformation parameter, describing the transformation to obtain the actual
control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter.
This has become necessary since during painting, the device which we created our control for might not necessarily
have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size,
this would lead to wrong results.
Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation
to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier
time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken.
Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ...
I consider it broken, since:
- we need the map mode to obtain the proper zoom level, which is to be forwarded to the control
- there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works
fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears).
It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand
one has no possibility to obtain the current zoom by other means.
Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls
have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used,
which means the controls have a zoom of "1:1" set, which is wrong here.
2009-06-29 09:52:13 +0200 fs r273452 : during #i103138#: belongsToDevice is unused nowadays
2009-06-24 12:40:06 +0200 fs r273329 : #i102888# #i102899#
2009-06-24 12:10:29 +0200 oj r273327 : #i103030# some code changes
2009-06-24 09:44:14 +0200 oj r273311 : #i103030# some code changes
2009-06-24 09:24:42 +0200 oj r273309 : #i103030# add log
2009-06-24 09:03:29 +0200 fs r273308 : if a col's table name is schema.table, properly quote all parts
2009-06-24 08:56:06 +0200 oj r273307 : #i102691# changed string
2009-06-23 13:31:43 +0200 oj r273280 : #i102479# fix date, time and datetime
2009-06-23 12:51:28 +0200 oj r273277 : #i103020# clear old expression when updating to avoid dead pointers in treelist userdata
2009-06-23 12:17:16 +0200 oj r273275 : #i103030# add LogBridge
2009-06-23 11:53:10 +0200 oj r273272 : shawdowed var resolved
2009-06-23 11:48:49 +0200 oj r273270 : #i103030# add :log to uno env if var UNO_ENV_LOG is set
2009-06-23 11:47:47 +0200 oj r273269 : #i103030# add LogBridge
2009-06-23 11:47:11 +0200 oj r273268 : #i103030# add LogBridge
2009-06-23 08:05:08 +0200 oj r273253 : #i102934# add key for collapsing
2009-06-22 13:21:33 +0200 fs r273225 : merging latest changes from CWS dba32d
2009-06-22 13:15:22 +0200 fs r273221 : why restrict to 12 entries?
2009-06-22 08:12:21 +0200 oj r273196 : #i102655# choosen > chosen typo fixed
2009-06-22 08:08:04 +0200 oj r273195 : #i102657# typo fix
2009-06-22 08:06:28 +0200 oj r273194 : #i102934# expanding and collasping of section
2009-06-22 08:05:52 +0200 oj r273193 : #i102930# set focus in treelistbox
2009-06-22 08:04:56 +0200 oj r273192 : #i102929# enable tabstop
2009-06-19 13:18:26 +0200 oj r273157 : remove unused param
2009-06-19 10:07:05 +0200 oj r273149 : CWS-TOOLING: rebase CWS dba32e to trunk@272827 (milestone: DEV300:m50)
2009-06-19 07:32:40 +0200 oj r273146 : merge from dba32d to dba32e
2009-06-19 07:22:56 +0200 oj r273145 : merge from dba32d to dba32e
2009-06-19 07:22:33 +0200 oj r273144 : merge from dba32d to dba32e
2009-06-18 14:09:34 +0200 fs r273116 : merging the latest changes from CWS dba32d (up to revision 273108) herein, which effectively is a rebase to DEV300.m50
2009-06-18 08:50:35 +0200 oj r273098 : #i102894# fix for new line in text
2009-06-18 08:28:48 +0200 oj r273097 : #i102892# check any
2009-06-18 08:21:34 +0200 oj r273096 : check if error is valid
2009-06-16 13:49:28 +0200 fs r273019 : why make a drop down control by default? The form control factory in SVX does this better those days ...
2009-06-10 09:53:20 +0200 oj r272797 : add lic text
2009-06-10 09:48:55 +0200 oj r272796 : test added for i101618
2009-06-09 14:57:39 +0200 oj r272771 : #i101618# access database document only when script container is needed
2009-06-09 12:42:25 +0200 oj r272765 : #i102497# check type property
2009-06-09 12:32:49 +0200 oj r272764 : adjust test cases
2009-06-09 12:31:58 +0200 oj r272763 : adjust test cases
2009-06-09 12:31:22 +0200 oj r272762 : adjust test cases
2009-06-09 11:35:42 +0200 oj r272761 : check if error is valid
2009-06-09 11:29:42 +0200 oj r272760 : #i102497# longvarchar was missing
2009-06-08 14:52:49 +0200 fs r272733 : #i102564# when setting a new field, also set m_nFieldType
2009-06-08 13:51:20 +0200 oj r272730 : add tests
2009-06-05 14:38:01 +0200 oj r272686 : add dep
2009-06-05 14:35:00 +0200 oj r272684 : add new tests
2009-06-05 13:41:18 +0200 oj r272681 : code clean ups
2009-06-05 12:40:51 +0200 oj r272678 : code cleanup
2009-06-05 12:02:57 +0200 oj r272677 : code cleanup
2009-06-05 10:42:38 +0200 oj r272670 : #i49320# impl export of single rows and as RTF and HTML
2009-06-03 14:30:37 +0200 oj r272576 : #i79649# check if file matches filter wildcard
2009-06-03 13:41:57 +0200 oj r272560 : #i102470# impl not b like 'c'
2009-08-26 10:09:17 +00:00
|
|
|
case DataType::CHAR:
|
2008-06-06 12:22:12 +00:00
|
|
|
case DataType::VARCHAR:
|
CWS-TOOLING: integrate CWS dba32e
2009-08-10 13:16:25 +0200 fs r274805 : #i84390# typo corrected
2009-08-10 13:04:28 +0200 fs r274804 : #i103741# properly terminate the last token in a string with a 0 byte
2009-07-24 08:54:05 +0200 msc r274286 : #103219# changed long name
2009-07-24 08:42:28 +0200 msc r274285 : #i79649# changed behaviour of the wizard
2009-07-22 14:17:49 +0200 oj r274238 : GrabFocus
2009-07-22 13:38:01 +0200 oj r274232 : #i102934# mixed up
2009-07-22 13:37:16 +0200 oj r274231 : #i102934# mixed up
2009-07-21 12:30:36 +0200 oj r274176 : crash when using distinct
2009-07-21 10:03:44 +0200 oj r274163 : set last char to 0
2009-07-21 09:31:22 +0200 oj r274161 : mediatype corrected
2009-07-20 11:45:33 +0200 fs r274118 : typo in formatting string
2009-07-20 11:40:39 +0200 fs r274117 : removed unused include
2009-07-20 11:40:01 +0200 fs r274116 : class name corrected
2009-07-16 13:41:45 +0200 oj r274046 : i101587 wrong check for embeddeddatabase url in confguration, have to check path
2009-07-16 13:12:05 +0200 tbo r274044 : #i103219# adjust declarion to new hid.lst
2009-07-16 12:43:48 +0200 oj r274041 : #i102497# check also fot longvarchar
2009-07-16 12:15:41 +0200 oj r274039 : #i103030# handle type description and exceptions as well
2009-07-16 11:14:26 +0200 fs r274035 : let SVN ignore output paths
2009-07-16 09:23:43 +0200 fs r274030 : TransforFormComponentProperties: no need to check for attribute equality
2009-07-10 14:16:23 +0200 oj r273892 : CWS-TOOLING: rebase CWS dba32e to trunk@273858 (milestone: DEV300:m52)
2009-07-01 21:41:50 +0200 fs r273614 : #i10000#
2009-07-01 15:01:10 +0200 fs r273589 : Input required doesn't make sense at all in XML form documents
2009-07-01 12:10:31 +0200 fs r273562 : updated
2009-07-01 11:46:12 +0200 fs r273560 : #i103219# add about 100 missing long names
2009-07-01 10:11:41 +0200 fs r273551 : moved from socket/port usage to pipe/name usage, which is more common nowadays
2009-07-01 09:50:03 +0200 fs r273549 : removed obsolete (empty) folder
2009-07-01 09:47:35 +0200 fs r273548 : copied the code for the Accessibility Workbench herein, formerly located in the old CVS repository, at gsl/awb
2009-06-30 10:07:47 +0200 fs r273493 : merging latest changes from CWS dba32d
2009-06-29 20:46:31 +0200 fs r273482 : #i103138# Rectangle conversions
2009-06-29 10:01:13 +0200 fs r273453 : #i103138#
refactored the code for positioning/zooming the control
Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to
take an additional ViewTransformation parameter, describing the transformation to obtain the actual
control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter.
This has become necessary since during painting, the device which we created our control for might not necessarily
have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size,
this would lead to wrong results.
Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation
to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier
time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken.
Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ...
I consider it broken, since:
- we need the map mode to obtain the proper zoom level, which is to be forwarded to the control
- there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works
fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears).
It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand
one has no possibility to obtain the current zoom by other means.
Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls
have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used,
which means the controls have a zoom of "1:1" set, which is wrong here.
2009-06-29 09:52:13 +0200 fs r273452 : during #i103138#: belongsToDevice is unused nowadays
2009-06-24 12:40:06 +0200 fs r273329 : #i102888# #i102899#
2009-06-24 12:10:29 +0200 oj r273327 : #i103030# some code changes
2009-06-24 09:44:14 +0200 oj r273311 : #i103030# some code changes
2009-06-24 09:24:42 +0200 oj r273309 : #i103030# add log
2009-06-24 09:03:29 +0200 fs r273308 : if a col's table name is schema.table, properly quote all parts
2009-06-24 08:56:06 +0200 oj r273307 : #i102691# changed string
2009-06-23 13:31:43 +0200 oj r273280 : #i102479# fix date, time and datetime
2009-06-23 12:51:28 +0200 oj r273277 : #i103020# clear old expression when updating to avoid dead pointers in treelist userdata
2009-06-23 12:17:16 +0200 oj r273275 : #i103030# add LogBridge
2009-06-23 11:53:10 +0200 oj r273272 : shawdowed var resolved
2009-06-23 11:48:49 +0200 oj r273270 : #i103030# add :log to uno env if var UNO_ENV_LOG is set
2009-06-23 11:47:47 +0200 oj r273269 : #i103030# add LogBridge
2009-06-23 11:47:11 +0200 oj r273268 : #i103030# add LogBridge
2009-06-23 08:05:08 +0200 oj r273253 : #i102934# add key for collapsing
2009-06-22 13:21:33 +0200 fs r273225 : merging latest changes from CWS dba32d
2009-06-22 13:15:22 +0200 fs r273221 : why restrict to 12 entries?
2009-06-22 08:12:21 +0200 oj r273196 : #i102655# choosen > chosen typo fixed
2009-06-22 08:08:04 +0200 oj r273195 : #i102657# typo fix
2009-06-22 08:06:28 +0200 oj r273194 : #i102934# expanding and collasping of section
2009-06-22 08:05:52 +0200 oj r273193 : #i102930# set focus in treelistbox
2009-06-22 08:04:56 +0200 oj r273192 : #i102929# enable tabstop
2009-06-19 13:18:26 +0200 oj r273157 : remove unused param
2009-06-19 10:07:05 +0200 oj r273149 : CWS-TOOLING: rebase CWS dba32e to trunk@272827 (milestone: DEV300:m50)
2009-06-19 07:32:40 +0200 oj r273146 : merge from dba32d to dba32e
2009-06-19 07:22:56 +0200 oj r273145 : merge from dba32d to dba32e
2009-06-19 07:22:33 +0200 oj r273144 : merge from dba32d to dba32e
2009-06-18 14:09:34 +0200 fs r273116 : merging the latest changes from CWS dba32d (up to revision 273108) herein, which effectively is a rebase to DEV300.m50
2009-06-18 08:50:35 +0200 oj r273098 : #i102894# fix for new line in text
2009-06-18 08:28:48 +0200 oj r273097 : #i102892# check any
2009-06-18 08:21:34 +0200 oj r273096 : check if error is valid
2009-06-16 13:49:28 +0200 fs r273019 : why make a drop down control by default? The form control factory in SVX does this better those days ...
2009-06-10 09:53:20 +0200 oj r272797 : add lic text
2009-06-10 09:48:55 +0200 oj r272796 : test added for i101618
2009-06-09 14:57:39 +0200 oj r272771 : #i101618# access database document only when script container is needed
2009-06-09 12:42:25 +0200 oj r272765 : #i102497# check type property
2009-06-09 12:32:49 +0200 oj r272764 : adjust test cases
2009-06-09 12:31:58 +0200 oj r272763 : adjust test cases
2009-06-09 12:31:22 +0200 oj r272762 : adjust test cases
2009-06-09 11:35:42 +0200 oj r272761 : check if error is valid
2009-06-09 11:29:42 +0200 oj r272760 : #i102497# longvarchar was missing
2009-06-08 14:52:49 +0200 fs r272733 : #i102564# when setting a new field, also set m_nFieldType
2009-06-08 13:51:20 +0200 oj r272730 : add tests
2009-06-05 14:38:01 +0200 oj r272686 : add dep
2009-06-05 14:35:00 +0200 oj r272684 : add new tests
2009-06-05 13:41:18 +0200 oj r272681 : code clean ups
2009-06-05 12:40:51 +0200 oj r272678 : code cleanup
2009-06-05 12:02:57 +0200 oj r272677 : code cleanup
2009-06-05 10:42:38 +0200 oj r272670 : #i49320# impl export of single rows and as RTF and HTML
2009-06-03 14:30:37 +0200 oj r272576 : #i79649# check if file matches filter wildcard
2009-06-03 13:41:57 +0200 oj r272560 : #i102470# impl not b like 'c'
2009-08-26 10:09:17 +00:00
|
|
|
case DataType::LONGVARCHAR:
|
2008-06-06 12:22:12 +00:00
|
|
|
eKeyType[i] = SQL_ORDERBYKEY_STRING;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DataType::OTHER:
|
|
|
|
case DataType::TINYINT:
|
|
|
|
case DataType::SMALLINT:
|
|
|
|
case DataType::INTEGER:
|
|
|
|
case DataType::DECIMAL:
|
|
|
|
case DataType::NUMERIC:
|
|
|
|
case DataType::REAL:
|
|
|
|
case DataType::DOUBLE:
|
|
|
|
case DataType::DATE:
|
|
|
|
case DataType::TIME:
|
|
|
|
case DataType::TIMESTAMP:
|
|
|
|
case DataType::BIT:
|
|
|
|
eKeyType[i] = SQL_ORDERBYKEY_DOUBLE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
// Andere Typen sind nicht implementiert (und damit immer FALSE)
|
|
|
|
default:
|
|
|
|
eKeyType[i] = SQL_ORDERBYKEY_NONE;
|
|
|
|
OSL_ASSERT("OFILECursor::Execute: Datentyp nicht implementiert");
|
|
|
|
break;
|
|
|
|
}
|
2008-12-30 13:32:01 +00:00
|
|
|
(m_aEvaluateRow->get())[*aOrderByIter]->setBound(sal_True);
|
2008-06-06 12:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_pSortIndex = new OSortIndex(eKeyType,m_aOrderbyAscending);
|
|
|
|
|
|
|
|
if (m_pEvaluationKeySet)
|
|
|
|
{
|
|
|
|
m_aEvaluateIter = m_pEvaluationKeySet->begin();
|
|
|
|
|
|
|
|
while (m_aEvaluateIter != m_pEvaluationKeySet->end())
|
|
|
|
{
|
|
|
|
ExecuteRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),TRUE);
|
|
|
|
++m_aEvaluateIter;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while (ExecuteRow(IResultSetHelper::NEXT,1,TRUE))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Sortiertes Keyset erzeugen
|
|
|
|
// DELETEZ(m_pEvaluationKeySet);
|
|
|
|
m_pEvaluationKeySet = NULL;
|
|
|
|
m_pFileSet = NULL;
|
|
|
|
m_pFileSet = m_pSortIndex->CreateKeySet();
|
|
|
|
// if(!bDistinct)
|
|
|
|
// SetRowCount(pFileSet->count());
|
|
|
|
DELETEZ(m_pSortIndex);
|
|
|
|
// Nun kann ueber den Index sortiert zugegriffen werden.
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
BOOL OResultSet::OpenImpl()
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::OpenImpl" );
|
2001-08-24 05:19:41 +00:00
|
|
|
OSL_ENSURE(m_pSQLAnalyzer,"No analyzer set with setSqlAnalyzer!");
|
|
|
|
if(!m_pTable)
|
|
|
|
{
|
|
|
|
const OSQLTables& xTabs = m_aSQLIterator.getTables();
|
|
|
|
if ((xTabs.begin() == xTabs.end()) || !xTabs.begin()->second.is())
|
2008-10-01 12:28:29 +00:00
|
|
|
lcl_throwError(STR_QUERY_TOO_COMPLEX,*this);
|
|
|
|
|
2006-07-10 13:26:49 +00:00
|
|
|
if ( xTabs.size() > 1 || m_aSQLIterator.hasErrors() )
|
2008-10-01 12:28:29 +00:00
|
|
|
lcl_throwError(STR_QUERY_MORE_TABLES,*this);
|
2001-08-24 05:19:41 +00:00
|
|
|
|
|
|
|
OSQLTable xTable = xTabs.begin()->second;
|
|
|
|
m_xColumns = m_aSQLIterator.getSelectColumns();
|
|
|
|
|
|
|
|
m_xColNames = xTable->getColumns();
|
2007-09-26 13:29:00 +00:00
|
|
|
m_xColsIdx.set(m_xColNames,UNO_QUERY);
|
2001-08-24 05:19:41 +00:00
|
|
|
doTableSpecials(xTable);
|
2001-11-15 14:20:06 +00:00
|
|
|
Reference<XComponent> xComp(xTable,UNO_QUERY);
|
|
|
|
if(xComp.is())
|
|
|
|
xComp->addEventListener(this);
|
2001-08-24 05:19:41 +00:00
|
|
|
}
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2001-09-19 10:03:04 +00:00
|
|
|
m_pTable->refreshHeader();
|
|
|
|
|
2001-08-24 05:19:41 +00:00
|
|
|
sal_Int32 nColumnCount = m_xColsIdx->getCount();
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2001-08-24 05:19:41 +00:00
|
|
|
initializeRow(m_aRow,nColumnCount);
|
|
|
|
initializeRow(m_aEvaluateRow,nColumnCount);
|
|
|
|
initializeRow(m_aInsertRow,nColumnCount);
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2001-06-27 09:02:11 +00:00
|
|
|
|
2001-04-12 11:40:19 +00:00
|
|
|
m_nResultSetConcurrency = (m_pTable->isReadOnly() || isCount()) ? ResultSetConcurrency::READ_ONLY : ResultSetConcurrency::UPDATABLE;
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
// Neuen Index aufbauen:
|
2001-08-29 11:21:08 +00:00
|
|
|
m_pFileSet = NULL;
|
2001-08-24 05:19:41 +00:00
|
|
|
// DELETEZ(m_pEvaluationKeySet);
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
// An den Anfang positionieren
|
|
|
|
m_nRowPos = -1;
|
|
|
|
m_nFilePos = 0;
|
|
|
|
m_nRowCountResult = -1;
|
|
|
|
|
|
|
|
m_nLastVisitedPos = m_pTable->getCurrentLastPos();
|
|
|
|
|
|
|
|
switch(m_aSQLIterator.getStatementType())
|
|
|
|
{
|
|
|
|
case SQL_STATEMENT_SELECT:
|
|
|
|
{
|
2001-01-09 14:37:39 +00:00
|
|
|
if(isCount())
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2008-12-30 13:32:01 +00:00
|
|
|
if(m_xColumns->get().size() > 1)
|
2008-10-01 12:28:29 +00:00
|
|
|
lcl_throwError(STR_QUERY_COMPLEX_COUNT,*this);
|
|
|
|
|
2001-01-09 14:37:39 +00:00
|
|
|
m_nRowCountResult = 0;
|
|
|
|
// Vorlaeufig einfach ueber alle Datensaetze iterieren und
|
|
|
|
// dabei die Aktionen bearbeiten (bzw. einfach nur zaehlen):
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-01-09 14:37:39 +00:00
|
|
|
sal_Bool bOK = sal_True;
|
|
|
|
if (m_pEvaluationKeySet)
|
|
|
|
{
|
|
|
|
m_aEvaluateIter = m_pEvaluationKeySet->begin();
|
|
|
|
bOK = m_aEvaluateIter == m_pEvaluationKeySet->end();
|
|
|
|
|
|
|
|
}
|
|
|
|
while (bOK)
|
|
|
|
{
|
|
|
|
if (m_pEvaluationKeySet)
|
2006-06-20 00:26:07 +00:00
|
|
|
ExecuteRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),TRUE);
|
2001-01-09 14:37:39 +00:00
|
|
|
else
|
2006-06-20 00:26:07 +00:00
|
|
|
bOK = ExecuteRow(IResultSetHelper::NEXT,1,TRUE);
|
2001-01-09 14:37:39 +00:00
|
|
|
|
|
|
|
if (bOK)
|
|
|
|
{
|
|
|
|
m_nRowCountResult++;
|
|
|
|
if(m_pEvaluationKeySet)
|
|
|
|
{
|
|
|
|
++m_aEvaluateIter;
|
|
|
|
bOK = m_aEvaluateIter == m_pEvaluationKeySet->end();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ergebnis von COUNT(*) in m_nRowCountResult merken.
|
|
|
|
// nRowCount, also die Anzahl der Rows in der Ergebnismenge, ist bei dieser
|
|
|
|
// Anfrage = 1!
|
2001-08-24 05:19:41 +00:00
|
|
|
m_pEvaluationKeySet = NULL;
|
|
|
|
// DELETEZ(m_pEvaluationKeySet);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
2001-01-09 14:37:39 +00:00
|
|
|
else
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-01-09 14:37:39 +00:00
|
|
|
BOOL bDistinct = FALSE;
|
|
|
|
BOOL bWasSorted = FALSE;
|
|
|
|
OSQLParseNode *pDistinct = m_pParseTree->getChild(1);
|
2008-06-06 12:22:12 +00:00
|
|
|
::std::vector<sal_Int32> aOrderbyColumnNumberSave;
|
|
|
|
::std::vector<TAscendingOrder> aOrderbyAscendingSave;
|
|
|
|
|
2001-01-09 14:37:39 +00:00
|
|
|
if (pDistinct && pDistinct->getTokenID() == SQL_TOKEN_DISTINCT )
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2008-06-06 12:22:12 +00:00
|
|
|
// Sort on all columns, saving original order for later
|
|
|
|
if(IsSorted())
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2008-06-06 12:22:12 +00:00
|
|
|
aOrderbyColumnNumberSave = m_aOrderbyColumnNumber;// .assign(m_aOrderbyColumnNumber.begin(), m_aOrderbyColumnNumber.end());
|
CWS-TOOLING: integrate CWS dba32e
2009-08-10 13:16:25 +0200 fs r274805 : #i84390# typo corrected
2009-08-10 13:04:28 +0200 fs r274804 : #i103741# properly terminate the last token in a string with a 0 byte
2009-07-24 08:54:05 +0200 msc r274286 : #103219# changed long name
2009-07-24 08:42:28 +0200 msc r274285 : #i79649# changed behaviour of the wizard
2009-07-22 14:17:49 +0200 oj r274238 : GrabFocus
2009-07-22 13:38:01 +0200 oj r274232 : #i102934# mixed up
2009-07-22 13:37:16 +0200 oj r274231 : #i102934# mixed up
2009-07-21 12:30:36 +0200 oj r274176 : crash when using distinct
2009-07-21 10:03:44 +0200 oj r274163 : set last char to 0
2009-07-21 09:31:22 +0200 oj r274161 : mediatype corrected
2009-07-20 11:45:33 +0200 fs r274118 : typo in formatting string
2009-07-20 11:40:39 +0200 fs r274117 : removed unused include
2009-07-20 11:40:01 +0200 fs r274116 : class name corrected
2009-07-16 13:41:45 +0200 oj r274046 : i101587 wrong check for embeddeddatabase url in confguration, have to check path
2009-07-16 13:12:05 +0200 tbo r274044 : #i103219# adjust declarion to new hid.lst
2009-07-16 12:43:48 +0200 oj r274041 : #i102497# check also fot longvarchar
2009-07-16 12:15:41 +0200 oj r274039 : #i103030# handle type description and exceptions as well
2009-07-16 11:14:26 +0200 fs r274035 : let SVN ignore output paths
2009-07-16 09:23:43 +0200 fs r274030 : TransforFormComponentProperties: no need to check for attribute equality
2009-07-10 14:16:23 +0200 oj r273892 : CWS-TOOLING: rebase CWS dba32e to trunk@273858 (milestone: DEV300:m52)
2009-07-01 21:41:50 +0200 fs r273614 : #i10000#
2009-07-01 15:01:10 +0200 fs r273589 : Input required doesn't make sense at all in XML form documents
2009-07-01 12:10:31 +0200 fs r273562 : updated
2009-07-01 11:46:12 +0200 fs r273560 : #i103219# add about 100 missing long names
2009-07-01 10:11:41 +0200 fs r273551 : moved from socket/port usage to pipe/name usage, which is more common nowadays
2009-07-01 09:50:03 +0200 fs r273549 : removed obsolete (empty) folder
2009-07-01 09:47:35 +0200 fs r273548 : copied the code for the Accessibility Workbench herein, formerly located in the old CVS repository, at gsl/awb
2009-06-30 10:07:47 +0200 fs r273493 : merging latest changes from CWS dba32d
2009-06-29 20:46:31 +0200 fs r273482 : #i103138# Rectangle conversions
2009-06-29 10:01:13 +0200 fs r273453 : #i103138#
refactored the code for positioning/zooming the control
Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to
take an additional ViewTransformation parameter, describing the transformation to obtain the actual
control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter.
This has become necessary since during painting, the device which we created our control for might not necessarily
have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size,
this would lead to wrong results.
Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation
to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier
time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken.
Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ...
I consider it broken, since:
- we need the map mode to obtain the proper zoom level, which is to be forwarded to the control
- there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works
fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears).
It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand
one has no possibility to obtain the current zoom by other means.
Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls
have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used,
which means the controls have a zoom of "1:1" set, which is wrong here.
2009-06-29 09:52:13 +0200 fs r273452 : during #i103138#: belongsToDevice is unused nowadays
2009-06-24 12:40:06 +0200 fs r273329 : #i102888# #i102899#
2009-06-24 12:10:29 +0200 oj r273327 : #i103030# some code changes
2009-06-24 09:44:14 +0200 oj r273311 : #i103030# some code changes
2009-06-24 09:24:42 +0200 oj r273309 : #i103030# add log
2009-06-24 09:03:29 +0200 fs r273308 : if a col's table name is schema.table, properly quote all parts
2009-06-24 08:56:06 +0200 oj r273307 : #i102691# changed string
2009-06-23 13:31:43 +0200 oj r273280 : #i102479# fix date, time and datetime
2009-06-23 12:51:28 +0200 oj r273277 : #i103020# clear old expression when updating to avoid dead pointers in treelist userdata
2009-06-23 12:17:16 +0200 oj r273275 : #i103030# add LogBridge
2009-06-23 11:53:10 +0200 oj r273272 : shawdowed var resolved
2009-06-23 11:48:49 +0200 oj r273270 : #i103030# add :log to uno env if var UNO_ENV_LOG is set
2009-06-23 11:47:47 +0200 oj r273269 : #i103030# add LogBridge
2009-06-23 11:47:11 +0200 oj r273268 : #i103030# add LogBridge
2009-06-23 08:05:08 +0200 oj r273253 : #i102934# add key for collapsing
2009-06-22 13:21:33 +0200 fs r273225 : merging latest changes from CWS dba32d
2009-06-22 13:15:22 +0200 fs r273221 : why restrict to 12 entries?
2009-06-22 08:12:21 +0200 oj r273196 : #i102655# choosen > chosen typo fixed
2009-06-22 08:08:04 +0200 oj r273195 : #i102657# typo fix
2009-06-22 08:06:28 +0200 oj r273194 : #i102934# expanding and collasping of section
2009-06-22 08:05:52 +0200 oj r273193 : #i102930# set focus in treelistbox
2009-06-22 08:04:56 +0200 oj r273192 : #i102929# enable tabstop
2009-06-19 13:18:26 +0200 oj r273157 : remove unused param
2009-06-19 10:07:05 +0200 oj r273149 : CWS-TOOLING: rebase CWS dba32e to trunk@272827 (milestone: DEV300:m50)
2009-06-19 07:32:40 +0200 oj r273146 : merge from dba32d to dba32e
2009-06-19 07:22:56 +0200 oj r273145 : merge from dba32d to dba32e
2009-06-19 07:22:33 +0200 oj r273144 : merge from dba32d to dba32e
2009-06-18 14:09:34 +0200 fs r273116 : merging the latest changes from CWS dba32d (up to revision 273108) herein, which effectively is a rebase to DEV300.m50
2009-06-18 08:50:35 +0200 oj r273098 : #i102894# fix for new line in text
2009-06-18 08:28:48 +0200 oj r273097 : #i102892# check any
2009-06-18 08:21:34 +0200 oj r273096 : check if error is valid
2009-06-16 13:49:28 +0200 fs r273019 : why make a drop down control by default? The form control factory in SVX does this better those days ...
2009-06-10 09:53:20 +0200 oj r272797 : add lic text
2009-06-10 09:48:55 +0200 oj r272796 : test added for i101618
2009-06-09 14:57:39 +0200 oj r272771 : #i101618# access database document only when script container is needed
2009-06-09 12:42:25 +0200 oj r272765 : #i102497# check type property
2009-06-09 12:32:49 +0200 oj r272764 : adjust test cases
2009-06-09 12:31:58 +0200 oj r272763 : adjust test cases
2009-06-09 12:31:22 +0200 oj r272762 : adjust test cases
2009-06-09 11:35:42 +0200 oj r272761 : check if error is valid
2009-06-09 11:29:42 +0200 oj r272760 : #i102497# longvarchar was missing
2009-06-08 14:52:49 +0200 fs r272733 : #i102564# when setting a new field, also set m_nFieldType
2009-06-08 13:51:20 +0200 oj r272730 : add tests
2009-06-05 14:38:01 +0200 oj r272686 : add dep
2009-06-05 14:35:00 +0200 oj r272684 : add new tests
2009-06-05 13:41:18 +0200 oj r272681 : code clean ups
2009-06-05 12:40:51 +0200 oj r272678 : code cleanup
2009-06-05 12:02:57 +0200 oj r272677 : code cleanup
2009-06-05 10:42:38 +0200 oj r272670 : #i49320# impl export of single rows and as RTF and HTML
2009-06-03 14:30:37 +0200 oj r272576 : #i79649# check if file matches filter wildcard
2009-06-03 13:41:57 +0200 oj r272560 : #i102470# impl not b like 'c'
2009-08-26 10:09:17 +00:00
|
|
|
m_aOrderbyColumnNumber.clear();
|
2008-06-06 12:22:12 +00:00
|
|
|
aOrderbyAscendingSave.assign(m_aOrderbyAscending.begin(), m_aOrderbyAscending.end());
|
2001-01-09 14:37:39 +00:00
|
|
|
bWasSorted = TRUE;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2008-06-06 12:22:12 +00:00
|
|
|
|
|
|
|
// the first column is the bookmark column
|
|
|
|
::std::vector<sal_Int32>::iterator aColStart = (m_aColMapping.begin()+1);
|
|
|
|
::std::copy(aColStart, m_aColMapping.end(),::std::back_inserter(m_aOrderbyColumnNumber));
|
|
|
|
// m_aOrderbyColumnNumber.assign(aColStart, m_aColMapping.end());
|
|
|
|
m_aOrderbyAscending.assign(m_aColMapping.size()-1, SQL_ASC);
|
|
|
|
bDistinct = TRUE;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
|
2001-01-09 14:37:39 +00:00
|
|
|
if (IsSorted())
|
2008-06-06 12:22:12 +00:00
|
|
|
sortRows();
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2010-10-15 12:10:06 -05:00
|
|
|
if (!m_pFileSet.is())
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-01-09 14:37:39 +00:00
|
|
|
m_pFileSet = new OKeySet();
|
|
|
|
|
2001-05-07 09:37:54 +00:00
|
|
|
if (!m_pSQLAnalyzer->hasRestriction())
|
2001-01-09 14:37:39 +00:00
|
|
|
// jetzt kann das Keyset schon gefuellt werden!
|
|
|
|
// Aber Achtung: es wird davon ausgegangen, das die FilePositionen als Folge 1..n
|
|
|
|
// abgelegt werden!
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
if ( m_nLastVisitedPos > 0)
|
|
|
|
m_pFileSet->get().reserve( m_nLastVisitedPos );
|
|
|
|
for (sal_Int32 i = 0; i < m_nLastVisitedPos; i++)
|
2008-12-30 13:32:01 +00:00
|
|
|
m_pFileSet->get().push_back(i + 1);
|
2001-01-09 14:37:39 +00:00
|
|
|
}
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2010-10-15 12:10:06 -05:00
|
|
|
OSL_ENSURE(m_pFileSet.is(),"Kein KeySet vorhanden! :-(");
|
2008-06-06 12:22:12 +00:00
|
|
|
|
2010-10-15 12:10:06 -05:00
|
|
|
if(bDistinct && m_pFileSet.is()) // sicher ist sicher
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2008-12-30 13:32:01 +00:00
|
|
|
OValueRow aSearchRow = new OValueVector(m_aRow->get().size());
|
|
|
|
OValueRefVector::Vector::iterator aRowIter = m_aRow->get().begin();
|
|
|
|
OValueVector::Vector::iterator aSearchIter = aSearchRow->get().begin();
|
2001-02-14 06:22:50 +00:00
|
|
|
for ( ++aRowIter,++aSearchIter; // the first column is the bookmark column
|
2008-12-30 13:32:01 +00:00
|
|
|
aRowIter != m_aRow->get().end();
|
2001-02-14 06:22:50 +00:00
|
|
|
++aRowIter,++aSearchIter)
|
2008-12-30 13:32:01 +00:00
|
|
|
aSearchIter->setBound((*aRowIter)->isBound());
|
2001-08-24 05:19:41 +00:00
|
|
|
|
2008-12-30 13:32:01 +00:00
|
|
|
size_t nMaxRow = m_pFileSet->get().size();
|
2008-06-06 12:22:12 +00:00
|
|
|
|
2001-01-09 14:37:39 +00:00
|
|
|
if (nMaxRow)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2003-04-15 16:36:55 +00:00
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
2001-01-09 14:37:39 +00:00
|
|
|
INT32 nFound=0;
|
|
|
|
#endif
|
2008-06-06 12:22:12 +00:00
|
|
|
INT32 nPos;
|
|
|
|
INT32 nKey;
|
|
|
|
|
|
|
|
for( size_t j = nMaxRow-1; j > 0; --j)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2008-12-30 13:32:01 +00:00
|
|
|
nPos = (m_pFileSet->get())[j];
|
2008-06-06 12:22:12 +00:00
|
|
|
ExecuteRow(IResultSetHelper::BOOKMARK,nPos,FALSE);
|
|
|
|
m_pSQLAnalyzer->setSelectionEvaluationResult(m_aSelectRow,m_aColMapping);
|
|
|
|
{ // copy row values
|
2008-12-30 13:32:01 +00:00
|
|
|
OValueRefVector::Vector::iterator copyFrom = m_aSelectRow->get().begin();
|
|
|
|
OValueVector::Vector::iterator copyTo = aSearchRow->get().begin();
|
2008-06-06 12:22:12 +00:00
|
|
|
for ( ++copyFrom,++copyTo; // the first column is the bookmark column
|
2008-12-30 13:32:01 +00:00
|
|
|
copyFrom != m_aSelectRow->get().end();
|
2008-06-06 12:22:12 +00:00
|
|
|
++copyFrom,++copyTo)
|
|
|
|
*copyTo = *(*copyFrom);
|
|
|
|
// *aSearchRow = *m_aRow;
|
|
|
|
}
|
2006-06-20 00:26:07 +00:00
|
|
|
|
2008-06-06 12:22:12 +00:00
|
|
|
// compare with next row
|
2008-12-30 13:32:01 +00:00
|
|
|
nKey = (m_pFileSet->get())[j-1];
|
2008-06-06 12:22:12 +00:00
|
|
|
ExecuteRow(IResultSetHelper::BOOKMARK,nKey,FALSE);
|
|
|
|
m_pSQLAnalyzer->setSelectionEvaluationResult(m_aSelectRow,m_aColMapping);
|
2008-12-30 13:32:01 +00:00
|
|
|
OValueRefVector::Vector::iterator loopInRow = m_aSelectRow->get().begin();
|
|
|
|
OValueVector::Vector::iterator existentInSearchRow = aSearchRow->get().begin();
|
2008-06-06 12:22:12 +00:00
|
|
|
for ( ++loopInRow,++existentInSearchRow; // the first column is the bookmark column
|
2008-12-30 13:32:01 +00:00
|
|
|
loopInRow != m_aSelectRow->get().end();
|
2008-06-06 12:22:12 +00:00
|
|
|
++loopInRow,++existentInSearchRow)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2008-06-06 12:22:12 +00:00
|
|
|
if ( (*loopInRow)->isBound() && !( *(*loopInRow) == *existentInSearchRow) )
|
|
|
|
break;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2008-06-06 12:22:12 +00:00
|
|
|
|
2008-12-30 13:32:01 +00:00
|
|
|
if(loopInRow == m_aSelectRow->get().end())
|
|
|
|
(m_pFileSet->get())[j] = 0; // Rows match -- Mark for deletion by setting key to 0
|
2003-04-15 16:36:55 +00:00
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
2001-01-09 14:37:39 +00:00
|
|
|
else
|
|
|
|
nFound++;
|
|
|
|
#endif
|
|
|
|
}
|
2001-08-13 06:36:59 +00:00
|
|
|
|
2008-12-30 13:32:01 +00:00
|
|
|
m_pFileSet->get().erase(::std::remove_if(m_pFileSet->get().begin(),m_pFileSet->get().end(),
|
2001-08-13 06:36:59 +00:00
|
|
|
::std::bind2nd(::std::equal_to<sal_Int32>(),0))
|
2008-12-30 13:32:01 +00:00
|
|
|
,m_pFileSet->get().end());
|
2001-08-13 06:36:59 +00:00
|
|
|
|
2008-06-06 12:22:12 +00:00
|
|
|
if (bWasSorted)
|
|
|
|
{
|
|
|
|
// Re-sort on original requested order
|
|
|
|
m_aOrderbyColumnNumber = aOrderbyColumnNumberSave;
|
|
|
|
m_aOrderbyAscending.assign(aOrderbyAscendingSave.begin(), aOrderbyAscendingSave.end());
|
|
|
|
|
2008-12-30 13:32:01 +00:00
|
|
|
TIntVector aEvaluationKeySet(m_pFileSet->get());
|
2008-06-06 12:22:12 +00:00
|
|
|
m_pEvaluationKeySet = &aEvaluationKeySet;
|
|
|
|
sortRows();
|
|
|
|
}
|
|
|
|
else
|
2001-01-09 14:37:39 +00:00
|
|
|
{
|
2001-08-29 11:21:08 +00:00
|
|
|
m_aOrderbyColumnNumber.clear();
|
|
|
|
m_aOrderbyAscending.clear();
|
2008-12-30 13:32:01 +00:00
|
|
|
::std::sort(m_pFileSet->get().begin(),m_pFileSet->get().end());
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
2001-01-09 14:37:39 +00:00
|
|
|
// SetRowCount(m_pFileSet->count());
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case SQL_STATEMENT_UPDATE:
|
|
|
|
case SQL_STATEMENT_DELETE:
|
|
|
|
// waehrend der Bearbeitung die Anzahl der bearbeiteten Rows zaehlen:
|
|
|
|
m_nRowCountResult = 0;
|
|
|
|
// Vorlaeufig einfach ueber alle Datensaetze iterieren und
|
|
|
|
// dabei die Aktionen bearbeiten (bzw. einfach nur zaehlen):
|
|
|
|
{
|
|
|
|
|
|
|
|
sal_Bool bOK = sal_True;
|
|
|
|
if (m_pEvaluationKeySet)
|
|
|
|
{
|
|
|
|
m_aEvaluateIter = m_pEvaluationKeySet->begin();
|
|
|
|
bOK = m_aEvaluateIter == m_pEvaluationKeySet->end();
|
|
|
|
|
|
|
|
}
|
|
|
|
while (bOK)
|
|
|
|
{
|
|
|
|
if (m_pEvaluationKeySet)
|
2006-06-20 00:26:07 +00:00
|
|
|
ExecuteRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),TRUE);
|
2000-09-18 15:18:56 +00:00
|
|
|
else
|
2006-06-20 00:26:07 +00:00
|
|
|
bOK = ExecuteRow(IResultSetHelper::NEXT,1,TRUE);
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
if (bOK)
|
|
|
|
{
|
|
|
|
m_nRowCountResult++;
|
|
|
|
if(m_pEvaluationKeySet)
|
|
|
|
{
|
|
|
|
++m_aEvaluateIter;
|
|
|
|
bOK = m_aEvaluateIter == m_pEvaluationKeySet->end();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ergebnis von COUNT(*) in nRowCountResult merken.
|
|
|
|
// nRowCount, also die Anzahl der Rows in der Ergebnismenge, ist bei dieser
|
|
|
|
// Anfrage = 1!
|
2001-08-24 05:19:41 +00:00
|
|
|
// DELETEZ(m_pEvaluationKeySet);
|
|
|
|
m_pEvaluationKeySet = NULL;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// SetRowCount(1);
|
|
|
|
break;
|
|
|
|
case SQL_STATEMENT_INSERT:
|
|
|
|
m_nRowCountResult = 0;
|
|
|
|
|
2010-10-15 12:10:06 -05:00
|
|
|
OSL_ENSURE(m_aAssignValues.is(),"No assign values set!");
|
|
|
|
if(!m_pTable->InsertRow(*m_aAssignValues, TRUE,m_xColsIdx))
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
m_nFilePos = 0;
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_nRowCountResult = 1;
|
|
|
|
break;
|
2006-06-20 00:26:07 +00:00
|
|
|
default:
|
|
|
|
OSL_ENSURE( false, "OResultSet::OpenImpl: unsupported statement type!" );
|
|
|
|
break;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// FilePos zuruecksetzen
|
|
|
|
m_nFilePos = 0;
|
|
|
|
|
|
|
|
return sal_True;
|
|
|
|
}
|
|
|
|
//--------------------------------------------------------------------------
|
|
|
|
Sequence< sal_Int8 > OResultSet::getUnoTunnelImplementationId()
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getUnoTunnelImplementationId" );
|
2000-09-18 15:18:56 +00:00
|
|
|
static ::cppu::OImplementationId * pId = 0;
|
|
|
|
if (! pId)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
|
|
|
|
if (! pId)
|
|
|
|
{
|
|
|
|
static ::cppu::OImplementationId aId;
|
|
|
|
pId = &aId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return pId->getImplementationId();
|
|
|
|
}
|
|
|
|
|
|
|
|
// com::sun::star::lang::XUnoTunnel
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
sal_Int64 OResultSet::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getSomething" );
|
2001-08-24 05:19:41 +00:00
|
|
|
return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
|
2006-06-20 00:26:07 +00:00
|
|
|
? reinterpret_cast< sal_Int64 >( this )
|
|
|
|
: 0;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2001-01-09 14:37:39 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
2003-09-04 07:25:33 +00:00
|
|
|
void OResultSet::setBoundedColumns(const OValueRefRow& _rRow,
|
|
|
|
const OValueRefRow& _rSelectRow,
|
2010-10-15 12:10:06 -05:00
|
|
|
const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns,
|
2001-03-01 10:01:24 +00:00
|
|
|
const Reference<XIndexAccess>& _xNames,
|
2001-08-24 05:19:41 +00:00
|
|
|
sal_Bool _bSetColumnMapping,
|
|
|
|
const Reference<XDatabaseMetaData>& _xMetaData,
|
|
|
|
::std::vector<sal_Int32>& _rColMapping)
|
2001-03-01 10:01:24 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::setBoundedColumns" );
|
2001-08-24 05:19:41 +00:00
|
|
|
::comphelper::UStringMixEqual aCase(_xMetaData->storesMixedCaseQuotedIdentifiers());
|
2001-03-01 10:01:24 +00:00
|
|
|
|
|
|
|
Reference<XPropertySet> xTableColumn;
|
|
|
|
::rtl::OUString sTableColumnName, sSelectColumnRealName;
|
2001-08-24 05:19:41 +00:00
|
|
|
|
|
|
|
const ::rtl::OUString sName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
|
|
|
|
const ::rtl::OUString sRealName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME);
|
|
|
|
const ::rtl::OUString sType = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE);
|
|
|
|
|
2008-12-30 13:32:01 +00:00
|
|
|
typedef ::std::map<OSQLColumns::Vector::iterator,sal_Bool> IterMap;
|
2002-07-26 08:09:41 +00:00
|
|
|
IterMap aSelectIters;
|
2008-12-30 13:32:01 +00:00
|
|
|
OValueRefVector::Vector::iterator aRowIter = _rRow->get().begin()+1;
|
2001-03-01 10:01:24 +00:00
|
|
|
for (sal_Int32 i=0; // the first column is the bookmark column
|
2008-12-30 13:32:01 +00:00
|
|
|
aRowIter != _rRow->get().end();
|
2001-03-01 10:01:24 +00:00
|
|
|
++i, ++aRowIter
|
|
|
|
)
|
|
|
|
{
|
2003-09-04 07:25:33 +00:00
|
|
|
(*aRowIter)->setBound(sal_False);
|
2001-03-01 10:01:24 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
// get the table column and it's name
|
|
|
|
_xNames->getByIndex(i) >>= xTableColumn;
|
2003-09-04 07:25:33 +00:00
|
|
|
OSL_ENSURE(xTableColumn.is(), "OResultSet::setBoundedColumns: invalid table column!");
|
2001-03-01 10:01:24 +00:00
|
|
|
if (xTableColumn.is())
|
2001-08-24 05:19:41 +00:00
|
|
|
xTableColumn->getPropertyValue(sName) >>= sTableColumnName;
|
2001-03-01 10:01:24 +00:00
|
|
|
else
|
|
|
|
sTableColumnName = ::rtl::OUString();
|
|
|
|
|
|
|
|
// look if we have such a select column
|
|
|
|
// TODO: would like to have a O(log n) search here ...
|
2008-12-30 13:32:01 +00:00
|
|
|
for ( OSQLColumns::Vector::iterator aIter = _rxColumns->get().begin();
|
|
|
|
aIter != _rxColumns->get().end();
|
2001-03-01 10:01:24 +00:00
|
|
|
++aIter
|
|
|
|
)
|
|
|
|
{
|
2001-08-24 05:19:41 +00:00
|
|
|
if((*aIter)->getPropertySetInfo()->hasPropertyByName(sRealName))
|
|
|
|
(*aIter)->getPropertyValue(sRealName) >>= sSelectColumnRealName;
|
2001-03-01 10:01:24 +00:00
|
|
|
else
|
2001-08-24 05:19:41 +00:00
|
|
|
(*aIter)->getPropertyValue(sName) >>= sSelectColumnRealName;
|
2001-03-01 10:01:24 +00:00
|
|
|
|
2003-09-04 07:25:33 +00:00
|
|
|
if ( aCase(sTableColumnName, sSelectColumnRealName) && !(*aRowIter)->isBound() && aSelectIters.end() == aSelectIters.find(aIter) )
|
2001-03-01 10:01:24 +00:00
|
|
|
{
|
2002-07-26 08:09:41 +00:00
|
|
|
aSelectIters.insert(IterMap::value_type(aIter,sal_True));
|
2001-03-01 10:01:24 +00:00
|
|
|
if(_bSetColumnMapping)
|
|
|
|
{
|
2008-12-30 13:32:01 +00:00
|
|
|
sal_Int32 nSelectColumnPos = aIter - _rxColumns->get().begin() + 1;
|
2001-03-01 10:01:24 +00:00
|
|
|
// the getXXX methods are 1-based ...
|
|
|
|
sal_Int32 nTableColumnPos = i + 1;
|
|
|
|
// get first table column is the bookmark column ...
|
2001-08-24 05:19:41 +00:00
|
|
|
_rColMapping[nSelectColumnPos] = nTableColumnPos;
|
2008-12-30 13:32:01 +00:00
|
|
|
(_rSelectRow->get())[nSelectColumnPos] = *aRowIter;
|
2001-03-01 10:01:24 +00:00
|
|
|
}
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2003-09-04 07:25:33 +00:00
|
|
|
(*aRowIter)->setBound(sal_True);
|
2001-03-01 10:01:24 +00:00
|
|
|
sal_Int32 nType = DataType::OTHER;
|
|
|
|
if (xTableColumn.is())
|
2001-08-24 05:19:41 +00:00
|
|
|
xTableColumn->getPropertyValue(sType) >>= nType;
|
2003-09-04 07:25:33 +00:00
|
|
|
(*aRowIter)->setTypeKind(nType);
|
2002-07-26 08:09:41 +00:00
|
|
|
|
|
|
|
break;
|
2001-03-01 10:01:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception&)
|
|
|
|
{
|
2003-09-04 07:25:33 +00:00
|
|
|
OSL_ENSURE(sal_False, "OResultSet::setBoundedColumns: caught an Exception!");
|
2001-03-01 10:01:24 +00:00
|
|
|
}
|
|
|
|
}
|
2002-12-10 09:42:15 +00:00
|
|
|
// in this case we got more select columns as columns exist in the table
|
|
|
|
if ( _bSetColumnMapping && aSelectIters.size() != _rColMapping.size() )
|
|
|
|
{
|
|
|
|
Reference<XNameAccess> xNameAccess(_xNames,UNO_QUERY);
|
|
|
|
Sequence< ::rtl::OUString > aSelectColumns = xNameAccess->getElementNames();
|
|
|
|
|
2008-12-30 13:32:01 +00:00
|
|
|
for ( OSQLColumns::Vector::iterator aIter = _rxColumns->get().begin();
|
|
|
|
aIter != _rxColumns->get().end();
|
2002-12-10 09:42:15 +00:00
|
|
|
++aIter
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if ( aSelectIters.end() == aSelectIters.find(aIter) )
|
|
|
|
{
|
|
|
|
if ( (*aIter)->getPropertySetInfo()->hasPropertyByName(sRealName) )
|
|
|
|
(*aIter)->getPropertyValue(sRealName) >>= sSelectColumnRealName;
|
|
|
|
else
|
|
|
|
(*aIter)->getPropertyValue(sName) >>= sSelectColumnRealName;
|
|
|
|
|
|
|
|
if ( xNameAccess->hasByName( sSelectColumnRealName ) )
|
|
|
|
{
|
|
|
|
aSelectIters.insert(IterMap::value_type(aIter,sal_True));
|
2008-12-30 13:32:01 +00:00
|
|
|
sal_Int32 nSelectColumnPos = aIter - _rxColumns->get().begin() + 1;
|
2002-12-10 09:42:15 +00:00
|
|
|
const ::rtl::OUString* pBegin = aSelectColumns.getConstArray();
|
|
|
|
const ::rtl::OUString* pEnd = pBegin + aSelectColumns.getLength();
|
|
|
|
for(sal_Int32 i=0;pBegin != pEnd;++pBegin,++i)
|
|
|
|
{
|
|
|
|
if ( aCase(*pBegin, sSelectColumnRealName) )
|
|
|
|
{
|
|
|
|
// the getXXX methods are 1-based ...
|
|
|
|
sal_Int32 nTableColumnPos = i + 1;
|
|
|
|
// get first table column is the bookmark column ...
|
|
|
|
_rColMapping[nSelectColumnPos] = nTableColumnPos;
|
2008-12-30 13:32:01 +00:00
|
|
|
(_rSelectRow->get())[nSelectColumnPos] = (_rRow->get())[nTableColumnPos];
|
2002-12-10 09:42:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-03-01 10:01:24 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2001-10-17 16:11:11 +00:00
|
|
|
void SAL_CALL OResultSet::acquire() throw()
|
2001-04-30 09:16:19 +00:00
|
|
|
{
|
|
|
|
OResultSet_BASE::acquire();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2001-10-17 16:11:11 +00:00
|
|
|
void SAL_CALL OResultSet::release() throw()
|
2001-04-30 09:16:19 +00:00
|
|
|
{
|
|
|
|
OResultSet_BASE::release();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2001-06-27 09:02:11 +00:00
|
|
|
Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertySetInfo( ) throw(RuntimeException)
|
2001-04-30 09:16:19 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
//RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getPropertySetInfo" );
|
2001-04-30 09:16:19 +00:00
|
|
|
return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2001-06-27 09:02:11 +00:00
|
|
|
void OResultSet::doTableSpecials(const OSQLTable& _xTable)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::doTableSpecials" );
|
2001-06-27 09:02:11 +00:00
|
|
|
Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(_xTable,UNO_QUERY);
|
|
|
|
if(xTunnel.is())
|
|
|
|
{
|
2006-06-20 00:26:07 +00:00
|
|
|
m_pTable = reinterpret_cast< OFileTable* >( xTunnel->getSomething(OFileTable::getUnoTunnelImplementationId()) );
|
2001-06-27 09:02:11 +00:00
|
|
|
if(m_pTable)
|
|
|
|
m_pTable->acquire();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2001-08-09 12:12:51 +00:00
|
|
|
void OResultSet::clearInsertRow()
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::clearInsertRow" );
|
2001-08-10 07:11:09 +00:00
|
|
|
m_aRow->setDeleted(sal_False); // set to false here because this is the new row
|
2008-12-30 13:32:01 +00:00
|
|
|
OValueRefVector::Vector::iterator aIter = m_aInsertRow->get().begin();
|
|
|
|
const OValueRefVector::Vector::iterator aEnd = m_aInsertRow->get().end();
|
2007-09-26 13:29:00 +00:00
|
|
|
for(sal_Int32 nPos = 0;aIter != aEnd;++aIter,++nPos)
|
2001-08-09 12:12:51 +00:00
|
|
|
{
|
2007-09-26 13:29:00 +00:00
|
|
|
ORowSetValueDecoratorRef& rValue = (*aIter);
|
|
|
|
if ( rValue->isBound() )
|
2001-08-09 12:12:51 +00:00
|
|
|
{
|
2008-12-30 13:32:01 +00:00
|
|
|
(m_aRow->get())[nPos]->setValue( (*aIter)->getValue() );
|
2001-08-09 12:12:51 +00:00
|
|
|
}
|
2007-09-26 13:29:00 +00:00
|
|
|
rValue->setBound(nPos == 0);
|
|
|
|
rValue->setModified(sal_False);
|
|
|
|
rValue->setNull();
|
2001-08-09 12:12:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2003-09-04 07:25:33 +00:00
|
|
|
void OResultSet::initializeRow(OValueRefRow& _rRow,sal_Int32 _nColumnCount)
|
2001-08-24 05:19:41 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::initializeRow" );
|
2010-10-15 12:10:06 -05:00
|
|
|
if(!_rRow.is())
|
2001-08-24 05:19:41 +00:00
|
|
|
{
|
2003-09-04 07:25:33 +00:00
|
|
|
_rRow = new OValueRefVector(_nColumnCount);
|
2008-12-30 13:32:01 +00:00
|
|
|
(_rRow->get())[0]->setBound(sal_True);
|
|
|
|
::std::for_each(_rRow->get().begin()+1,_rRow->get().end(),TSetRefBound(sal_False));
|
2001-08-24 05:19:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2006-06-20 00:26:07 +00:00
|
|
|
sal_Bool OResultSet::fillIndexValues(const Reference< XColumnsSupplier> &/*_xIndex*/)
|
2001-08-24 05:19:41 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::fillIndexValues" );
|
2001-08-24 05:19:41 +00:00
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2001-10-26 06:45:13 +00:00
|
|
|
sal_Bool OResultSet::move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::move" );
|
2001-10-26 06:45:13 +00:00
|
|
|
return Move(_eCursorPosition,_nOffset,_bRetrieveData);
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
sal_Int32 OResultSet::getDriverPos() const
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getDriverPos" );
|
2008-12-30 13:32:01 +00:00
|
|
|
return (m_aRow->get())[0]->getValue();
|
2001-10-26 06:45:13 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
sal_Bool OResultSet::deletedVisible() const
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::deletedVisible" );
|
2001-10-26 06:45:13 +00:00
|
|
|
return m_bShowDeleted;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
sal_Bool OResultSet::isRowDeleted() const
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isRowDeleted" );
|
2001-10-26 06:45:13 +00:00
|
|
|
return m_aRow->isDeleted();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2001-11-15 14:20:06 +00:00
|
|
|
void SAL_CALL OResultSet::disposing( const EventObject& Source ) throw (RuntimeException)
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::disposing" );
|
2001-11-15 14:20:06 +00:00
|
|
|
// Reference<XInterface> xInt = m_pTable;
|
|
|
|
Reference<XPropertySet> xProp = m_pTable;
|
|
|
|
if(m_pTable && Source.Source == xProp)
|
|
|
|
{
|
|
|
|
m_pTable->release();
|
|
|
|
m_pTable = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2010-10-12 15:53:47 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|