2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-12 22:04:38 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2006-09-17 01:33:50 +00:00
|
|
|
|
2000-10-30 10:00:36 +00:00
|
|
|
|
2012-12-27 14:03:18 +02:00
|
|
|
#ifdef __GNUC__
|
2000-11-14 11:57:56 +00:00
|
|
|
#include <iostream>
|
|
|
|
#endif
|
2014-06-04 15:29:58 +02:00
|
|
|
#include <connectivity/sdbcx/VColumn.hxx>
|
2000-09-18 15:18:56 +00:00
|
|
|
#include "file/FResultSet.hxx"
|
2015-04-19 17:12:43 +01:00
|
|
|
#include "sqlbison.hxx"
|
2000-09-18 15:18:56 +00:00
|
|
|
#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>
|
2014-06-04 15:29:58 +02:00
|
|
|
#include <connectivity/dbconversion.hxx>
|
|
|
|
#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-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>
|
2014-06-04 15:29:58 +02: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"
|
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;
|
|
|
|
|
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;
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString sMessage = aResources.getResourceString(_nErrorId);
|
2008-10-01 12:28:29 +00:00
|
|
|
::dbtools::throwGenericSQLException(sMessage ,_xContext);
|
|
|
|
}
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.drivers.file.ResultSet","com.sun.star.sdbc.ResultSet");
|
2014-02-22 21:20:15 +01:00
|
|
|
|
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)
|
2015-11-10 10:12:07 +01:00
|
|
|
,m_aAssignValues(nullptr)
|
2006-06-20 00:26:07 +00:00
|
|
|
,m_aSkipDeletedSet(this)
|
2015-11-10 10:12:07 +01:00
|
|
|
,m_pFileSet(nullptr)
|
|
|
|
,m_pSortIndex(nullptr)
|
|
|
|
,m_pTable(nullptr)
|
2006-06-20 00:26:07 +00:00
|
|
|
,m_pParseTree(pStmt->getParseTree())
|
2015-11-10 10:12:07 +01:00
|
|
|
,m_pSQLAnalyzer(nullptr)
|
2006-06-20 00:26:07 +00:00
|
|
|
,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)
|
2015-11-10 10:12:07 +01:00
|
|
|
,m_xMetaData(nullptr)
|
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)
|
2009-04-23 10:42:05 +00:00
|
|
|
,m_nColumnCount(0)
|
2014-04-16 09:14:24 +02:00
|
|
|
,m_bWasNull(false)
|
|
|
|
,m_bEOF(false)
|
|
|
|
,m_bLastRecord(false)
|
|
|
|
,m_bInserted(false)
|
|
|
|
,m_bRowUpdated(false)
|
|
|
|
,m_bRowInserted(false)
|
|
|
|
,m_bRowDeleted(false)
|
2001-06-28 11:22:36 +00:00
|
|
|
,m_bShowDeleted(pStmt->getOwnConnection()->showDeleted())
|
2014-04-16 09:14:24 +02:00
|
|
|
,m_bIsCount(false)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2012-09-22 01:51:12 -05:00
|
|
|
osl_atomic_increment( &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();
|
2010-11-25 08:51:07 +01:00
|
|
|
m_aSkipDeletedSet.SetDeletedVisible(m_bShowDeleted);
|
2012-09-22 01:51:12 -05:00
|
|
|
osl_atomic_decrement( &m_refCount );
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
OResultSet::~OResultSet()
|
|
|
|
{
|
2012-09-22 01:51:12 -05:00
|
|
|
osl_atomic_increment( &m_refCount );
|
2001-08-24 05:19:41 +00:00
|
|
|
disposing();
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
void OResultSet::construct()
|
|
|
|
{
|
2014-05-10 23:51:21 +02:00
|
|
|
registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE), PROPERTY_ID_FETCHSIZE, 0,&m_nFetchSize, ::cppu::UnoType<sal_Int32>::get());
|
|
|
|
registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE), PROPERTY_ID_RESULTSETTYPE, PropertyAttribute::READONLY,&m_nResultSetType, ::cppu::UnoType<sal_Int32>::get());
|
|
|
|
registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION), PROPERTY_ID_FETCHDIRECTION, 0,&m_nFetchDirection, ::cppu::UnoType<sal_Int32>::get());
|
|
|
|
registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY), PROPERTY_ID_RESULTSETCONCURRENCY,PropertyAttribute::READONLY,&m_nResultSetConcurrency, ::cppu::UnoType<sal_Int32>::get());
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2015-04-14 12:44:47 +02:00
|
|
|
void 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();
|
2015-11-10 10:12:07 +01:00
|
|
|
m_pParseTree = nullptr;
|
2009-09-08 09:50:48 +00:00
|
|
|
m_xColNames.clear();
|
2015-11-10 10:12:07 +01:00
|
|
|
m_xColumns = nullptr;
|
|
|
|
m_xParamColumns = nullptr;
|
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();
|
2015-11-10 10:12:07 +01:00
|
|
|
m_pTable = nullptr;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2013-12-13 13:10:49 +01:00
|
|
|
|
2015-11-10 10:12:07 +01:00
|
|
|
m_pFileSet = nullptr;
|
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
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException, std::exception)
|
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
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Sequence< Type > SAL_CALL OResultSet::getTypes( ) throw(RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
2014-05-22 23:19:05 +02:00
|
|
|
OTypeCollection aTypes( cppu::UnoType<com::sun::star::beans::XMultiPropertySet>::get(),
|
|
|
|
cppu::UnoType<com::sun::star::beans::XPropertySet>::get(),
|
|
|
|
cppu::UnoType<com::sun::star::beans::XPropertySet>::get());
|
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
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Int32 SAL_CALL OResultSet::findColumn( const OUString& columnName ) throw(SQLException, RuntimeException, std::exception)
|
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)
|
2013-09-11 21:40:41 +01:00
|
|
|
{
|
2001-05-17 05:46:55 +00:00
|
|
|
if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) :
|
|
|
|
columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
|
2013-09-11 21:40:41 +01:00
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
::dbtools::throwInvalidColumnException( columnName, *this );
|
|
|
|
assert(false);
|
|
|
|
return 0; // Never reached
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-07-02 09:24:06 +01:00
|
|
|
const ORowSetValue& OResultSet::getValue(sal_Int32 columnIndex)
|
|
|
|
throw (css::sdbc::SQLException, css::uno::RuntimeException)
|
2001-07-30 07:53:02 +00:00
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
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
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2001-05-23 08:18:28 +00:00
|
|
|
void OResultSet::checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException)
|
|
|
|
{
|
2002-12-10 09:42:15 +00:00
|
|
|
if ( columnIndex <= 0
|
2011-02-18 22:14:33 +01:00
|
|
|
|| columnIndex >= m_nColumnCount )
|
2001-05-23 08:18:28 +00:00
|
|
|
::dbtools::throwInvalidIndexException(*this);
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2015-11-10 10:12:07 +01:00
|
|
|
return nullptr;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2015-11-10 10:12:07 +01:00
|
|
|
return nullptr;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
::com::sun::star::util::Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException, std::exception)
|
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
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2002-01-22 11:49:36 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLException, RuntimeException, std::exception)
|
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;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2015-11-10 10:12:07 +01:00
|
|
|
return nullptr;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2015-11-10 10:12:07 +01:00
|
|
|
return nullptr;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2015-11-10 10:12:07 +01:00
|
|
|
return nullptr;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2015-11-10 10:12:07 +01:00
|
|
|
return nullptr;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex).makeAny();
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
::com::sun::star::util::Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
::com::sun::star::util::DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
return getValue(columnIndex);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeException, std::exception)
|
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
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException, std::exception)
|
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
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException, std::exception)
|
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
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException, std::exception)
|
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();
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException, std::exception)
|
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();
|
2014-04-16 09:14:24 +02:00
|
|
|
m_bEOF = true;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2005-09-23 10:38:50 +00:00
|
|
|
dispose();
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-08-24 05:19:41 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
2015-07-16 13:48:46 +02:00
|
|
|
return m_pTable && m_aSkipDeletedSet.skipDeleted(IResultSetHelper::FIRST,1,true);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException, std::exception)
|
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);
|
2015-07-16 13:48:46 +02:00
|
|
|
return m_pTable && m_aSkipDeletedSet.skipDeleted(IResultSetHelper::LAST,1,true);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-08-24 05:19:41 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
2015-07-16 13:48:46 +02:00
|
|
|
return m_pTable && m_aSkipDeletedSet.skipDeleted(IResultSetHelper::ABSOLUTE1,row,true);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-08-24 05:19:41 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
2015-07-16 13:48:46 +02:00
|
|
|
return m_pTable && m_aSkipDeletedSet.skipDeleted(IResultSetHelper::RELATIVE1,row,true);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-08-24 05:19:41 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
2015-07-16 13:48:46 +02:00
|
|
|
return m_pTable && m_aSkipDeletedSet.skipDeleted(IResultSetHelper::PRIOR,0,true);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
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
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeException, std::exception)
|
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
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException, std::exception)
|
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_bRowInserted;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException, std::exception)
|
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
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException, std::exception)
|
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
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException, std::exception)
|
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);
|
|
|
|
|
2015-07-16 13:48:46 +02:00
|
|
|
return m_pTable && m_aSkipDeletedSet.skipDeleted(IResultSetHelper::NEXT,1,true);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException, std::exception)
|
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;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::cancel( ) throw(RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::clearWarnings( ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Any SAL_CALL OResultSet::getWarnings( ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
return Any();
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
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
|
2015-07-21 15:03:03 +01:00
|
|
|
(void)m_aSkipDeletedSet.skipDeleted(IResultSetHelper::LAST,1,false);
|
2014-04-16 09:14:24 +02:00
|
|
|
m_bRowInserted = m_pTable->InsertRow(*m_aInsertRow, true, m_xColsIdx);
|
2010-10-15 12:10:06 -05:00
|
|
|
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
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
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
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::deleteRow() throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
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
|
|
|
{
|
2014-01-28 19:56:39 +01:00
|
|
|
m_aRow->setDeleted(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
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
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
|
|
|
|
2014-04-16 09:14:24 +02:00
|
|
|
m_bInserted = false;
|
|
|
|
m_bRowUpdated = false;
|
|
|
|
m_bRowInserted = false;
|
|
|
|
m_bRowDeleted = false;
|
2000-09-29 15:02:10 +00:00
|
|
|
|
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
|
|
|
{
|
2014-01-28 19:56:39 +01:00
|
|
|
(*aIter)->setBound(false);
|
2003-09-04 07:25:33 +00:00
|
|
|
(*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
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
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
|
|
|
|
2014-04-16 09:14:24 +02:00
|
|
|
m_bInserted = true;
|
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
|
|
|
{
|
2014-01-28 19:56:39 +01:00
|
|
|
(*aIter)->setBound(false);
|
2003-09-04 07:25:33 +00:00
|
|
|
(*aIter)->setNull();
|
2000-11-15 15:02:00 +00:00
|
|
|
}
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
}
|
2014-02-22 21:20:15 +01: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
|
|
|
{
|
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
|
|
|
|
2014-01-28 19:56:39 +01:00
|
|
|
(m_aInsertRow->get())[columnIndex]->setBound(true);
|
2008-12-30 13:32:01 +00:00
|
|
|
*(m_aInsertRow->get())[columnIndex] = x;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2007-09-26 13:29:00 +00:00
|
|
|
ORowSetValue aEmpty;
|
|
|
|
updateValue(columnIndex,aEmpty);
|
2001-07-30 07:53:02 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2001-07-30 07:53:02 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException, std::exception)
|
2001-07-30 07:53:02 +00:00
|
|
|
{
|
2013-02-04 11:12:57 +01:00
|
|
|
updateValue(columnIndex, static_cast<bool>(x));
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::updateLong( sal_Int32 /*columnIndex*/, sal_Int64 /*x*/ ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2014-07-21 10:40:45 +01:00
|
|
|
::dbtools::throwFeatureNotImplementedSQLException( "XRowUpdate::updateLong", *this );
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const OUString& x ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
updateValue(columnIndex,x);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
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
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
updateBinaryStream(columnIndex,x,length);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException, std::exception)
|
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
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
if (!::dbtools::implUpdateObject(this, columnIndex, x))
|
|
|
|
throw SQLException();
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-07-30 07:53:02 +00:00
|
|
|
if (!::dbtools::implUpdateObject(this, columnIndex, x))
|
|
|
|
throw SQLException();
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
|
|
|
|
{
|
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);
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
IPropertyArrayHelper & OResultSet::getInfoHelper()
|
|
|
|
{
|
2015-04-13 12:35:57 +02:00
|
|
|
return *getArrayHelper();
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-04-16 09:14:24 +02:00
|
|
|
bool OResultSet::ExecuteRow(IResultSetHelper::Movement eFirstCursorPosition,
|
2011-01-07 18:04:22 +01:00
|
|
|
sal_Int32 nFirstOffset,
|
2014-04-16 09:14:24 +02:00
|
|
|
bool bEvaluate,
|
|
|
|
bool bRetrieveData)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
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
|
|
|
|
2011-02-18 21:46:25 +01:00
|
|
|
// For further Fetch-Operations this information may possibly be changed ...
|
2001-10-26 06:45:13 +00:00
|
|
|
IResultSetHelper::Movement eCursorPosition = eFirstCursorPosition;
|
2011-01-07 18:04:22 +01:00
|
|
|
sal_Int32 nOffset = nFirstOffset;
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-03-13 10:59:11 +00:00
|
|
|
if (!m_pTable)
|
2014-04-16 09:14:24 +02:00
|
|
|
return false;
|
2014-03-13 10:59:11 +00:00
|
|
|
|
2010-10-15 12:10:06 -05:00
|
|
|
const OSQLColumns & rTableCols = *(m_pTable->getTableColumns());
|
2014-04-16 09:14:24 +02:00
|
|
|
bool bHasRestriction = m_pSQLAnalyzer->hasRestriction();
|
2000-09-18 15:18:56 +00:00
|
|
|
again:
|
|
|
|
|
2015-09-29 17:46:36 +02:00
|
|
|
// protect from reading over the end when somebody 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
|
|
|
{
|
2014-04-16 09:14:24 +02:00
|
|
|
return false;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2014-04-16 09:14:24 +02:00
|
|
|
return false;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
|
2011-02-18 21:46:25 +01:00
|
|
|
if (!bEvaluate) // If no evaluation runs, then just fill the results-row
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2014-04-16 09:14:24 +02:00
|
|
|
m_pTable->fetchRow(m_aRow,rTableCols, true,bRetrieveData);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-04-16 09:14:24 +02:00
|
|
|
m_pTable->fetchRow(m_aEvaluateRow, rTableCols, true,bRetrieveData || bHasRestriction);
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2010-09-27 15:27:57 +02:00
|
|
|
if ( ( !m_bShowDeleted
|
|
|
|
&& m_aEvaluateRow->isDeleted()
|
|
|
|
)
|
|
|
|
|| ( bHasRestriction
|
|
|
|
&& !m_pSQLAnalyzer->evaluateRestriction()
|
|
|
|
)
|
|
|
|
)
|
2011-02-18 21:46:25 +01:00
|
|
|
{ // Evaluate the next record
|
|
|
|
// delete current row in Keyset
|
2015-06-12 13:28:05 +01:00
|
|
|
if (m_pFileSet.is())
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2011-02-18 22:14:33 +01:00
|
|
|
OSL_ENSURE(eCursorPosition == IResultSetHelper::NEXT, "Falsche CursorPosition!");
|
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::FIRST ||
|
|
|
|
eCursorPosition == IResultSetHelper::NEXT ||
|
2014-09-18 10:04:20 +03:00
|
|
|
eCursorPosition == IResultSetHelper::ABSOLUTE1)
|
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;
|
|
|
|
}
|
2014-09-18 10:04:20 +03:00
|
|
|
else if (eCursorPosition == IResultSetHelper::RELATIVE1)
|
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
|
|
|
|
{
|
2014-04-16 09:14:24 +02:00
|
|
|
return false;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2011-02-18 21:46:25 +01:00
|
|
|
// Try again ...
|
2000-09-18 15:18:56 +00:00
|
|
|
goto again;
|
|
|
|
}
|
|
|
|
}
|
2003-09-04 07:25:33 +00:00
|
|
|
|
2011-02-18 21:46:25 +01:00
|
|
|
// Evaluate may only be set,
|
|
|
|
// if the Keyset will be constructed further
|
2010-09-27 15:27:57 +02:00
|
|
|
if ( ( m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT )
|
|
|
|
&& !isCount()
|
|
|
|
&& bEvaluate
|
|
|
|
)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
if (m_pSortIndex)
|
|
|
|
{
|
2010-09-27 15:27:57 +02:00
|
|
|
OKeyValue* pKeyValue = GetOrderbyKeyValue( m_aSelectRow );
|
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
|
|
|
{
|
2013-04-11 00:21:40 -03:00
|
|
|
sal_uInt32 nBookmarkValue = std::abs((sal_Int32)(m_aEvaluateRow->get())[0]->getValue());
|
2008-12-30 13:32:01 +00:00
|
|
|
m_pFileSet->get().push_back(nBookmarkValue);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_UPDATE)
|
|
|
|
{
|
2014-04-16 09:14:24 +02:00
|
|
|
bool bOK = true;
|
2000-09-18 15:18:56 +00:00
|
|
|
if (bEvaluate)
|
|
|
|
{
|
2011-02-18 21:46:25 +01:00
|
|
|
// read the actual result-row
|
2014-04-16 09:14:24 +02:00
|
|
|
bOK = m_pTable->fetchRow(m_aEvaluateRow, *(m_pTable->getTableColumns()), true,true);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (bOK)
|
|
|
|
{
|
2011-02-18 21:46:25 +01:00
|
|
|
// just give the values to be changed:
|
2010-10-15 12:10:06 -05:00
|
|
|
if(!m_pTable->UpdateRow(*m_aAssignValues,m_aEvaluateRow, m_xColsIdx))
|
2014-04-16 09:14:24 +02:00
|
|
|
return false;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_DELETE)
|
|
|
|
{
|
2014-04-16 09:14:24 +02:00
|
|
|
bool bOK = true;
|
2000-09-18 15:18:56 +00:00
|
|
|
if (bEvaluate)
|
|
|
|
{
|
2014-04-16 09:14:24 +02:00
|
|
|
bOK = m_pTable->fetchRow(m_aEvaluateRow, *(m_pTable->getTableColumns()), 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))
|
2014-04-16 09:14:24 +02:00
|
|
|
return false;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
2014-04-16 09:14:24 +02:00
|
|
|
return true;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-04-16 09:14:24 +02:00
|
|
|
bool OResultSet::Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, bool bRetrieveData)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2011-01-07 18:04:22 +01:00
|
|
|
sal_Int32 nTempPos = m_nRowPos;
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2001-01-09 14:37:39 +00:00
|
|
|
if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT &&
|
|
|
|
!isCount())
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2011-02-18 21:46:25 +01:00
|
|
|
if (!m_pFileSet.is()) //no Index available
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2011-02-18 21:46:25 +01:00
|
|
|
// Normal FETCH
|
2014-04-16 09:14:24 +02: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:
|
2008-12-30 13:32:01 +00:00
|
|
|
m_nRowPos = m_pFileSet->get().size() - 1;
|
2000-09-18 15:18:56 +00:00
|
|
|
break;
|
2014-09-18 10:04:20 +03:00
|
|
|
case IResultSetHelper::RELATIVE1:
|
2000-09-18 15:18:56 +00:00
|
|
|
m_nRowPos += nOffset;
|
|
|
|
break;
|
2014-09-18 10:04:20 +03:00
|
|
|
case IResultSetHelper::ABSOLUTE1:
|
2001-10-26 06:45:13 +00:00
|
|
|
case IResultSetHelper::BOOKMARK:
|
2007-09-26 13:29:00 +00:00
|
|
|
if ( m_nRowPos == (nOffset -1) )
|
2014-04-16 09:14:24 +02:00
|
|
|
return true;
|
2001-08-27 08:13:35 +00:00
|
|
|
m_nRowPos = nOffset -1;
|
2000-09-18 15:18:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// OffRange?
|
2011-02-18 21:46:25 +01:00
|
|
|
// The FileCursor is outside of the valid range, if:
|
2000-09-18 15:18:56 +00:00
|
|
|
// a.) m_nRowPos < 1
|
2011-02-18 21:46:25 +01:00
|
|
|
// b.) a KeySet exists and m_nRowPos > m_pFileSet->size()
|
2011-01-07 18:04:22 +01:00
|
|
|
if (m_nRowPos < 0 || (m_pFileSet->isFrozen() && eCursorPosition != IResultSetHelper::BOOKMARK && m_nRowPos >= (sal_Int32)m_pFileSet->get().size() )) // && m_pFileSet->IsFrozen()
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
goto Error;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-01-07 18:04:22 +01:00
|
|
|
if (m_nRowPos < (sal_Int32)m_pFileSet->get().size())
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2011-02-18 21:46:25 +01:00
|
|
|
// Fetch via Index
|
2014-08-09 13:31:24 +01:00
|
|
|
bool bOK = ExecuteRow(IResultSetHelper::BOOKMARK,(m_pFileSet->get())[m_nRowPos],false,bRetrieveData);
|
|
|
|
if (!bOK)
|
|
|
|
goto Error;
|
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
|
|
|
}
|
2011-02-18 21:46:25 +01:00
|
|
|
else // Index must be further constructed
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2011-02-18 21:46:25 +01:00
|
|
|
// set first on the last known row
|
2013-11-30 11:54:20 +01:00
|
|
|
if (m_pFileSet->get().empty())
|
|
|
|
{
|
2014-09-18 10:04:20 +03:00
|
|
|
m_pTable->seekRow(IResultSetHelper::ABSOLUTE1, 0, m_nFilePos);
|
2013-11-30 11:54:20 +01:00
|
|
|
}
|
|
|
|
else
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2008-12-30 13:32:01 +00:00
|
|
|
m_aFileSetIter = m_pFileSet->get().end()-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
|
|
|
}
|
2014-04-16 09:14:24 +02:00
|
|
|
bool bOK = true;
|
2011-02-18 21:46:25 +01:00
|
|
|
// Determine the number of further Fetches
|
2011-01-07 18:04:22 +01:00
|
|
|
while (bOK && m_nRowPos >= (sal_Int32)m_pFileSet->get().size())
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2015-06-12 13:28:05 +01:00
|
|
|
bOK = ExecuteRow(IResultSetHelper::NEXT,1,true, false);//bRetrieveData);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (bOK)
|
|
|
|
{
|
2011-02-18 21:46:25 +01:00
|
|
|
// read the results again
|
2014-04-16 09:14:24 +02:00
|
|
|
m_pTable->fetchRow(m_aRow, *(m_pTable->getTableColumns()), 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
|
|
|
}
|
2011-02-18 21:46:25 +01:00
|
|
|
else if (!m_pFileSet->isFrozen()) // no valid record found
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
m_pFileSet->setFrozen();
|
|
|
|
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
|
|
|
{
|
2011-02-18 21:46:25 +01:00
|
|
|
// Fetch the COUNT(*)
|
2000-09-18 15:18:56 +00:00
|
|
|
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;
|
2014-09-18 10:04:20 +03:00
|
|
|
case IResultSetHelper::RELATIVE1:
|
2000-09-18 15:18:56 +00:00
|
|
|
m_nRowPos += nOffset;
|
|
|
|
break;
|
2014-09-18 10:04:20 +03:00
|
|
|
case IResultSetHelper::ABSOLUTE1:
|
2001-10-26 06:45:13 +00:00
|
|
|
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
|
|
|
{
|
2011-02-18 21:46:25 +01:00
|
|
|
// put COUNT(*) in result-row
|
|
|
|
// (must be the first and only variable in the row)
|
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);
|
2014-01-28 19:56:39 +01:00
|
|
|
(m_aRow->get())[1]->setBound(true);
|
2008-12-30 13:32:01 +00:00
|
|
|
(m_aSelectRow->get())[1] = (m_aRow->get())[1];
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-04-16 09:14:24 +02:00
|
|
|
m_bEOF = true;
|
2001-01-09 14:37:39 +00:00
|
|
|
m_nRowPos = 1;
|
2014-04-16 09:14:24 +02:00
|
|
|
return false;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2011-02-18 21:46:25 +01:00
|
|
|
// Fetch only possible at SELECT!
|
2014-04-16 09:14:24 +02:00
|
|
|
return false;
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2014-04-16 09:14:24 +02:00
|
|
|
return true;
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
Error:
|
2011-02-18 21:46:25 +01:00
|
|
|
// is the Cursor positioned before the first row
|
|
|
|
// then the position will be maintained
|
2000-09-18 15:18:56 +00:00
|
|
|
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:
|
2014-09-18 10:04:20 +03:00
|
|
|
case IResultSetHelper::ABSOLUTE1:
|
|
|
|
case IResultSetHelper::RELATIVE1:
|
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:
|
2011-02-18 21:46:25 +01:00
|
|
|
m_nRowPos = nTempPos; // last Position
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
2014-04-16 09:14:24 +02:00
|
|
|
return false;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2008-06-06 12:22:12 +00:00
|
|
|
void OResultSet::sortRows()
|
|
|
|
{
|
|
|
|
if (!m_pSQLAnalyzer->hasRestriction() && m_aOrderbyColumnNumber.size() == 1)
|
|
|
|
{
|
2011-02-18 21:46:25 +01:00
|
|
|
// is just one field given for sorting
|
|
|
|
// and this field is indexed, then the Index will be used
|
2008-06-06 12:22:12 +00:00
|
|
|
Reference<XIndexesSupplier> xIndexSup;
|
2014-05-22 23:19:05 +02:00
|
|
|
m_pTable->queryInterface(cppu::UnoType<XIndexesSupplier>::get()) >>= xIndexSup;
|
2011-02-18 22:14:33 +01:00
|
|
|
|
2008-06-06 12:22:12 +00:00
|
|
|
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)
|
|
|
|
{
|
2010-09-27 15:27:57 +02:00
|
|
|
OSL_ENSURE((sal_Int32)m_aSelectRow->get().size() > *aOrderByIter,"Invalid Index");
|
|
|
|
switch ((*(m_aSelectRow->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;
|
|
|
|
|
2011-02-18 21:46:25 +01:00
|
|
|
// Other types aren't implemented (so they are always FALSE)
|
2008-06-06 12:22:12 +00:00
|
|
|
default:
|
|
|
|
eKeyType[i] = SQL_ORDERBYKEY_NONE;
|
2013-06-15 01:56:13 +03:00
|
|
|
SAL_WARN( "connectivity.drivers","OFILECursor::Execute: Datentyp nicht implementiert");
|
2008-06-06 12:22:12 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-01-28 19:56:39 +01:00
|
|
|
(m_aSelectRow->get())[*aOrderByIter]->setBound(true);
|
2008-06-06 12:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_pSortIndex = new OSortIndex(eKeyType,m_aOrderbyAscending);
|
|
|
|
|
2015-08-12 15:09:36 +02:00
|
|
|
while ( ExecuteRow( IResultSetHelper::NEXT, 1, false ) )
|
2008-06-06 12:22:12 +00:00
|
|
|
{
|
2015-06-12 13:28:05 +01:00
|
|
|
m_aSelectRow->get()[0]->setValue( m_aRow->get()[0]->getValue() );
|
|
|
|
if ( m_pSQLAnalyzer->hasFunctions() )
|
|
|
|
m_pSQLAnalyzer->setSelectionEvaluationResult( m_aSelectRow, m_aColMapping );
|
|
|
|
const sal_Int32 nBookmark = (*m_aRow->get().begin())->getValue();
|
|
|
|
ExecuteRow( IResultSetHelper::BOOKMARK, nBookmark, true, false );
|
2008-06-06 12:22:12 +00:00
|
|
|
}
|
|
|
|
|
2011-02-18 21:46:25 +01:00
|
|
|
// create sorted Keyset
|
2015-11-10 10:12:07 +01:00
|
|
|
m_pFileSet = nullptr;
|
2008-06-06 12:22:12 +00:00
|
|
|
m_pFileSet = m_pSortIndex->CreateKeySet();
|
|
|
|
DELETEZ(m_pSortIndex);
|
2011-02-18 21:46:25 +01:00
|
|
|
// now access to a sorted set is possible via Index
|
2008-06-06 12:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-04-16 09:14:24 +02:00
|
|
|
bool OResultSet::OpenImpl()
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
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();
|
2015-06-10 13:51:56 +02:00
|
|
|
if (xTabs.empty() || !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
|
|
|
|
2011-02-18 21:46:25 +01:00
|
|
|
// create new Index:
|
2015-11-10 10:12:07 +01:00
|
|
|
m_pFileSet = nullptr;
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2011-02-18 21:46:25 +01:00
|
|
|
// position at the beginning
|
2000-09-18 15:18:56 +00:00
|
|
|
m_nRowPos = -1;
|
|
|
|
m_nFilePos = 0;
|
|
|
|
m_nRowCountResult = -1;
|
2015-01-05 15:08:22 +01:00
|
|
|
m_pTable->seekRow(IResultSetHelper::ABSOLUTE1, 0, m_nFilePos);
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
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;
|
2011-02-18 21:46:25 +01:00
|
|
|
// for now simply iterate over all rows and
|
|
|
|
// do all actions (or just count)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2014-04-16 09:14:24 +02:00
|
|
|
bool bOK = true;
|
2001-01-09 14:37:39 +00:00
|
|
|
while (bOK)
|
|
|
|
{
|
2015-10-19 17:49:23 +02:00
|
|
|
bOK = ExecuteRow(IResultSetHelper::NEXT);
|
2001-01-09 14:37:39 +00:00
|
|
|
|
|
|
|
if (bOK)
|
|
|
|
{
|
|
|
|
m_nRowCountResult++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-18 21:46:25 +01:00
|
|
|
// save result of COUNT(*) in m_nRowCountResult.
|
|
|
|
// nRowCount (number of Rows in the result) = 1 for this request!
|
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
|
|
|
{
|
2014-04-16 09:14:24 +02:00
|
|
|
bool bDistinct = false;
|
2015-11-10 10:12:07 +01:00
|
|
|
assert(m_pParseTree != nullptr);
|
2001-01-09 14:37:39 +00:00
|
|
|
OSQLParseNode *pDistinct = m_pParseTree->getChild(1);
|
2008-06-06 12:22:12 +00:00
|
|
|
|
2012-01-19 15:25:07 +01:00
|
|
|
assert(m_aOrderbyColumnNumber.size() ==
|
|
|
|
m_aOrderbyAscending.size());
|
2001-01-09 14:37:39 +00:00
|
|
|
if (pDistinct && pDistinct->getTokenID() == SQL_TOKEN_DISTINCT )
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2012-01-19 15:25:07 +01:00
|
|
|
// To eliminate duplicates we need to sort on all columns.
|
|
|
|
// This is not a problem because the SQL spec says that the
|
|
|
|
// order of columns that are not specified in ORDER BY
|
|
|
|
// clause is undefined, so it doesn't hurt to sort on
|
|
|
|
// these; pad the vectors to include them.
|
2015-05-28 16:18:34 +02:00
|
|
|
for (size_t i = 1; // 0: bookmark (see setBoundedColumns)
|
|
|
|
i < m_aColMapping.size(); ++i)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2012-01-19 15:25:07 +01:00
|
|
|
if (::std::find(m_aOrderbyColumnNumber.begin(),
|
|
|
|
m_aOrderbyColumnNumber.end(), i)
|
|
|
|
== m_aOrderbyColumnNumber.end())
|
|
|
|
{
|
|
|
|
m_aOrderbyColumnNumber.push_back(i);
|
2012-01-23 13:42:37 +01:00
|
|
|
// ASC or DESC doesn't matter
|
|
|
|
m_aOrderbyAscending.push_back(SQL_ASC);
|
2012-01-19 15:25:07 +01:00
|
|
|
}
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-04-16 09:14:24 +02:00
|
|
|
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())
|
2011-02-18 21:46:25 +01:00
|
|
|
// now the Keyset can be filled!
|
|
|
|
// But be careful: It is assumed, that the FilePositions will be stored as sequence 1..n
|
2001-01-09 14:37:39 +00:00
|
|
|
{
|
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
|
|
|
|
2011-02-18 21:46:25 +01:00
|
|
|
if(bDistinct && m_pFileSet.is())
|
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
|
2011-01-07 18:04:22 +01:00
|
|
|
sal_Int32 nFound=0;
|
2001-01-09 14:37:39 +00:00
|
|
|
#endif
|
2011-01-07 18:04:22 +01:00
|
|
|
sal_Int32 nPos;
|
|
|
|
sal_Int32 nKey;
|
2008-06-06 12:22:12 +00:00
|
|
|
|
|
|
|
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];
|
2014-04-16 09:14:24 +02:00
|
|
|
ExecuteRow(IResultSetHelper::BOOKMARK,nPos,false);
|
2008-06-06 12:22:12 +00:00
|
|
|
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);
|
|
|
|
}
|
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];
|
2014-04-16 09:14:24 +02:00
|
|
|
ExecuteRow(IResultSetHelper::BOOKMARK,nKey,false);
|
2008-06-06 12:22:12 +00:00
|
|
|
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());
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case SQL_STATEMENT_UPDATE:
|
|
|
|
case SQL_STATEMENT_DELETE:
|
2011-02-18 21:46:25 +01:00
|
|
|
// during processing count the number of processed Rows
|
2000-09-18 15:18:56 +00:00
|
|
|
m_nRowCountResult = 0;
|
2011-02-18 21:46:25 +01:00
|
|
|
// for now simply iterate over all rows and
|
|
|
|
// run the actions (or simply count):
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
|
2014-04-16 09:14:24 +02:00
|
|
|
bool bOK = true;
|
2000-09-18 15:18:56 +00:00
|
|
|
while (bOK)
|
|
|
|
{
|
2015-10-19 17:49:23 +02:00
|
|
|
bOK = ExecuteRow(IResultSetHelper::NEXT);
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
if (bOK)
|
|
|
|
{
|
|
|
|
m_nRowCountResult++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-18 21:46:25 +01:00
|
|
|
// save result of COUNT(*) in nRowCountResult.
|
|
|
|
// nRowCount (number of rows in the result-set) = 1 for this request!
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
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!");
|
2014-04-16 09:14:24 +02:00
|
|
|
if(!m_pTable->InsertRow(*m_aAssignValues, true,m_xColsIdx))
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
m_nFilePos = 0;
|
2014-04-16 09:14:24 +02:00
|
|
|
return false;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_nRowCountResult = 1;
|
|
|
|
break;
|
2006-06-20 00:26:07 +00:00
|
|
|
default:
|
2013-06-15 01:56:13 +03:00
|
|
|
SAL_WARN( "connectivity.drivers", "OResultSet::OpenImpl: unsupported statement type!" );
|
2006-06-20 00:26:07 +00:00
|
|
|
break;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
|
2011-02-18 21:46:25 +01:00
|
|
|
// reset FilePos
|
2000-09-18 15:18:56 +00:00
|
|
|
m_nFilePos = 0;
|
|
|
|
|
2014-04-16 09:14:24 +02:00
|
|
|
return true;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
Sequence< sal_Int8 > OResultSet::getUnoTunnelImplementationId()
|
|
|
|
{
|
2015-11-10 10:12:07 +01:00
|
|
|
static ::cppu::OImplementationId * pId = nullptr;
|
2000-09-18 15:18:56 +00:00
|
|
|
if (! pId)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
|
|
|
|
if (! pId)
|
|
|
|
{
|
|
|
|
static ::cppu::OImplementationId aId;
|
|
|
|
pId = &aId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return pId->getImplementationId();
|
|
|
|
}
|
|
|
|
|
|
|
|
// com::sun::star::lang::XUnoTunnel
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Int64 OResultSet::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException, std::exception)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2012-08-05 19:01:37 +02:00
|
|
|
return (rId.getLength() == 16 && 0 == memcmp(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
|
|
|
}
|
2014-02-22 21:20:15 +01: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,
|
2014-04-16 09:14:24 +02:00
|
|
|
bool _bSetColumnMapping,
|
2001-08-24 05:19:41 +00:00
|
|
|
const Reference<XDatabaseMetaData>& _xMetaData,
|
|
|
|
::std::vector<sal_Int32>& _rColMapping)
|
2001-03-01 10:01:24 +00:00
|
|
|
{
|
2010-11-25 12:43:46 +01:00
|
|
|
::comphelper::UStringMixEqual aCase(_xMetaData->supportsMixedCaseQuotedIdentifiers());
|
2001-03-01 10:01:24 +00:00
|
|
|
|
|
|
|
Reference<XPropertySet> xTableColumn;
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sTableColumnName, sSelectColumnRealName;
|
2001-08-24 05:19:41 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString sName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
|
|
|
|
const OUString sRealName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME);
|
|
|
|
const OUString sType = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE);
|
2001-08-24 05:19:41 +00:00
|
|
|
|
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
|
|
|
|
)
|
|
|
|
{
|
2014-01-28 19:56:39 +01:00
|
|
|
(*aRowIter)->setBound(false);
|
2001-03-01 10:01:24 +00:00
|
|
|
try
|
|
|
|
{
|
2014-04-10 19:59:38 +03:00
|
|
|
// get the table column and its name
|
2001-03-01 10:01:24 +00:00
|
|
|
_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
|
2014-11-12 14:24:10 +05:30
|
|
|
sTableColumnName.clear();
|
2001-03-01 10:01:24 +00:00
|
|
|
|
|
|
|
// 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
|
|
|
|
2014-01-28 19:56:39 +01:00
|
|
|
(*aRowIter)->setBound(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&)
|
|
|
|
{
|
2013-06-15 01:56:13 +03:00
|
|
|
SAL_WARN( "connectivity.drivers","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);
|
2013-04-07 12:06:47 +02:00
|
|
|
Sequence< OUString > aSelectColumns = xNameAccess->getElementNames();
|
2002-12-10 09:42:15 +00:00
|
|
|
|
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;
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString* pBegin = aSelectColumns.getConstArray();
|
|
|
|
const OUString* pEnd = pBegin + aSelectColumns.getLength();
|
2002-12-10 09:42:15 +00:00
|
|
|
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
|
|
|
}
|
2014-02-22 21:20:15 +01: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();
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
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();
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertySetInfo( ) throw(RuntimeException, std::exception)
|
2001-04-30 09:16:19 +00:00
|
|
|
{
|
|
|
|
return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2001-06-27 09:02:11 +00:00
|
|
|
void OResultSet::doTableSpecials(const OSQLTable& _xTable)
|
|
|
|
{
|
2015-01-31 19:04:05 +00:00
|
|
|
Reference<css::lang::XUnoTunnel> xTunnel(_xTable, UNO_QUERY_THROW);
|
|
|
|
m_pTable = reinterpret_cast< OFileTable* >(xTunnel->getSomething(OFileTable::getUnoTunnelImplementationId()));
|
|
|
|
assert(m_pTable);
|
|
|
|
m_pTable->acquire();
|
2001-06-27 09:02:11 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2001-08-09 12:12:51 +00:00
|
|
|
void OResultSet::clearInsertRow()
|
|
|
|
{
|
2014-01-28 19:56:39 +01:00
|
|
|
m_aRow->setDeleted(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);
|
2014-01-28 19:56:39 +01:00
|
|
|
rValue->setModified(false);
|
2007-09-26 13:29:00 +00:00
|
|
|
rValue->setNull();
|
2001-08-09 12:12:51 +00:00
|
|
|
}
|
|
|
|
}
|
2014-02-22 21:20:15 +01: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
|
|
|
{
|
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);
|
2014-01-28 19:56:39 +01:00
|
|
|
(_rRow->get())[0]->setBound(true);
|
|
|
|
::std::for_each(_rRow->get().begin()+1,_rRow->get().end(),TSetRefBound(false));
|
2001-08-24 05:19:41 +00:00
|
|
|
}
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-04-16 09:14:24 +02:00
|
|
|
bool OResultSet::fillIndexValues(const Reference< XColumnsSupplier> &/*_xIndex*/)
|
2001-08-24 05:19:41 +00:00
|
|
|
{
|
2014-04-16 09:14:24 +02:00
|
|
|
return false;
|
2001-08-24 05:19:41 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-04-16 09:14:24 +02:00
|
|
|
bool OResultSet::move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, bool _bRetrieveData)
|
2001-10-26 06:45:13 +00:00
|
|
|
{
|
|
|
|
return Move(_eCursorPosition,_nOffset,_bRetrieveData);
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2001-10-26 06:45:13 +00:00
|
|
|
sal_Int32 OResultSet::getDriverPos() const
|
|
|
|
{
|
2008-12-30 13:32:01 +00:00
|
|
|
return (m_aRow->get())[0]->getValue();
|
2001-10-26 06:45:13 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-04-16 09:14:24 +02:00
|
|
|
bool OResultSet::isRowDeleted() const
|
2001-10-26 06:45:13 +00:00
|
|
|
{
|
|
|
|
return m_aRow->isDeleted();
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OResultSet::disposing( const EventObject& Source ) throw (RuntimeException, std::exception)
|
2001-11-15 14:20:06 +00:00
|
|
|
{
|
|
|
|
Reference<XPropertySet> xProp = m_pTable;
|
|
|
|
if(m_pTable && Source.Source == xProp)
|
|
|
|
{
|
|
|
|
m_pTable->release();
|
2015-11-10 10:12:07 +01:00
|
|
|
m_pTable = nullptr;
|
2001-11-15 14:20:06 +00:00
|
|
|
}
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|