2010-10-12 15:59:03 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-14 17:39:53 +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 05:31:05 +00:00
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
#include "CacheSet.hxx"
|
2004-06-01 09:08:20 +00:00
|
|
|
#include "core_resource.hxx"
|
|
|
|
#include "core_resource.hrc"
|
2000-09-18 23:16:46 +00:00
|
|
|
#include <com/sun/star/sdbcx/CompareBookmark.hpp>
|
|
|
|
#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
|
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
|
|
|
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
|
|
|
|
#include <com/sun/star/sdbc/XPreparedStatement.hpp>
|
2009-04-23 10:42:05 +00:00
|
|
|
#include <com/sun/star/sdbc/ColumnValue.hpp>
|
2000-09-18 23:16:46 +00:00
|
|
|
#include <com/sun/star/sdbc/XParameters.hpp>
|
2000-10-25 06:32:52 +00:00
|
|
|
#include "dbastrings.hrc"
|
2000-09-18 23:16:46 +00:00
|
|
|
#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
|
|
|
|
#include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
|
2004-03-15 14:45:30 +00:00
|
|
|
|
|
|
|
#include <limits>
|
|
|
|
|
2000-10-25 06:32:52 +00:00
|
|
|
#include <connectivity/dbtools.hxx>
|
2000-11-29 09:23:32 +00:00
|
|
|
#include <com/sun/star/sdbcx/KeyType.hpp>
|
2001-03-15 07:29:16 +00:00
|
|
|
#include <comphelper/extract.hxx>
|
2001-04-02 10:24:49 +00:00
|
|
|
#include <com/sun/star/io/XInputStream.hpp>
|
2001-05-18 10:48:25 +00:00
|
|
|
#include <comphelper/types.hxx>
|
2005-09-23 11:01:45 +00:00
|
|
|
#include <tools/debug.hxx>
|
2009-07-03 12:24:35 +00:00
|
|
|
#include <rtl/ustrbuf.hxx>
|
2001-05-18 10:48:25 +00:00
|
|
|
|
|
|
|
using namespace comphelper;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
using namespace dbaccess;
|
2000-10-25 06:32:52 +00:00
|
|
|
using namespace dbtools;
|
2000-09-18 23:16:46 +00:00
|
|
|
using namespace connectivity;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
using namespace ::com::sun::star::sdbc;
|
|
|
|
using namespace ::com::sun::star::sdbcx;
|
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
using namespace ::com::sun::star::lang;
|
2001-04-02 10:24:49 +00:00
|
|
|
using namespace ::com::sun::star::io;
|
2000-09-18 23:16:46 +00:00
|
|
|
using namespace ::osl;
|
|
|
|
|
2005-09-23 11:01:45 +00:00
|
|
|
DBG_NAME(OCacheSet)
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2010-11-24 14:23:06 +01:00
|
|
|
OCacheSet::OCacheSet(sal_Int32 i_nMaxRows)
|
|
|
|
:m_nMaxRows(i_nMaxRows)
|
|
|
|
,m_bInserted(sal_False)
|
2005-09-23 11:01:45 +00:00
|
|
|
,m_bUpdated(sal_False)
|
|
|
|
,m_bDeleted(sal_False)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::OCacheSet" );
|
2005-09-23 11:01:45 +00:00
|
|
|
DBG_CTOR(OCacheSet,NULL);
|
|
|
|
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString OCacheSet::getIdentifierQuoteString() const
|
2003-12-01 09:18:00 +00:00
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getIdentifierQuoteString" );
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sQuote;
|
2003-12-01 09:18:00 +00:00
|
|
|
Reference<XDatabaseMetaData> xMeta;
|
|
|
|
if ( m_xConnection.is() && (xMeta = m_xConnection->getMetaData()).is() )
|
|
|
|
sQuote = xMeta->getIdentifierQuoteString();
|
|
|
|
return sQuote;
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2013-12-12 20:13:40 +01:00
|
|
|
void OCacheSet::construct( const Reference< XResultSet>& _xDriverSet,const OUString &i_sRowSetFilter)
|
2001-10-30 13:22:10 +00:00
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::construct" );
|
2001-10-30 13:22:10 +00:00
|
|
|
OSL_ENSURE(_xDriverSet.is(),"Invalid resultSet");
|
2013-12-12 20:13:40 +01:00
|
|
|
|
|
|
|
m_sRowSetFilter = i_sRowSetFilter;
|
|
|
|
|
2001-10-30 13:22:10 +00:00
|
|
|
if(_xDriverSet.is())
|
|
|
|
{
|
|
|
|
m_xDriverSet = _xDriverSet;
|
2004-08-02 13:59:33 +00:00
|
|
|
m_xDriverRow.set(_xDriverSet,UNO_QUERY);
|
2001-10-30 13:22:10 +00:00
|
|
|
m_xSetMetaData = Reference<XResultSetMetaDataSupplier>(_xDriverSet,UNO_QUERY)->getMetaData();
|
2004-03-02 11:40:41 +00:00
|
|
|
if ( m_xSetMetaData.is() )
|
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
const sal_Int32 nCount = m_xSetMetaData->getColumnCount();
|
|
|
|
m_aNullable.realloc(nCount);
|
2004-03-02 11:40:41 +00:00
|
|
|
m_aSignedFlags.realloc(nCount);
|
2009-04-23 10:42:05 +00:00
|
|
|
m_aColumnTypes.realloc(nCount);
|
|
|
|
sal_Bool* pNullableIter = m_aNullable.getArray();
|
|
|
|
sal_Bool* pSignedIter = m_aSignedFlags.getArray();
|
|
|
|
sal_Int32* pColumnIter = m_aColumnTypes.getArray();
|
|
|
|
for (sal_Int32 i=1; i <= nCount; ++i,++pSignedIter,++pColumnIter,++pNullableIter)
|
2004-03-02 11:40:41 +00:00
|
|
|
{
|
2009-04-23 10:42:05 +00:00
|
|
|
*pNullableIter = m_xSetMetaData->isNullable(i) != ColumnValue::NO_NULLS;
|
|
|
|
*pSignedIter = m_xSetMetaData->isSigned(i);
|
|
|
|
*pColumnIter = m_xSetMetaData->getColumnType(i);
|
2004-03-02 11:40:41 +00:00
|
|
|
}
|
|
|
|
}
|
2001-10-30 13:22:10 +00:00
|
|
|
Reference< XStatement> xStmt(m_xDriverSet->getStatement(),UNO_QUERY);
|
|
|
|
if(xStmt.is())
|
|
|
|
m_xConnection = xStmt->getConnection();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Reference< XPreparedStatement> xPrepStmt(m_xDriverSet->getStatement(),UNO_QUERY);
|
2003-12-01 09:18:00 +00:00
|
|
|
if ( xPrepStmt.is() )
|
|
|
|
m_xConnection = xPrepStmt->getConnection();
|
2001-10-30 13:22:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2000-11-03 13:32:31 +00:00
|
|
|
OCacheSet::~OCacheSet()
|
|
|
|
{
|
2000-12-12 11:15:41 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
m_xDriverSet = NULL;
|
|
|
|
m_xDriverRow = NULL;
|
|
|
|
m_xSetMetaData = NULL;
|
|
|
|
m_xConnection = NULL;
|
|
|
|
}
|
|
|
|
catch(Exception&)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_WARN("dbaccess", "Exception occurred");
|
2000-12-12 11:15:41 +00:00
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_WARN("dbaccess", "Unknown Exception occurred");
|
2000-12-12 11:15:41 +00:00
|
|
|
}
|
2005-09-23 11:01:45 +00:00
|
|
|
|
|
|
|
DBG_DTOR(OCacheSet,NULL);
|
2000-11-03 13:32:31 +00:00
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
void OCacheSet::fillTableName(const Reference<XPropertySet>& _xTable) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::fillTableName" );
|
2001-01-22 06:38:24 +00:00
|
|
|
OSL_ENSURE(_xTable.is(),"OCacheSet::fillTableName: PropertySet is empty!");
|
2011-12-19 18:10:37 -02:00
|
|
|
if(m_aComposedTableName.isEmpty() && _xTable.is() )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
Reference<XDatabaseMetaData> xMeta(m_xConnection->getMetaData());
|
2006-07-10 14:01:35 +00:00
|
|
|
m_aComposedTableName = composeTableName(xMeta
|
2001-05-18 10:48:25 +00:00
|
|
|
,comphelper::getString(_xTable->getPropertyValue(PROPERTY_CATALOGNAME))
|
|
|
|
,comphelper::getString(_xTable->getPropertyValue(PROPERTY_SCHEMANAME))
|
|
|
|
,comphelper::getString(_xTable->getPropertyValue(PROPERTY_NAME))
|
2002-10-07 12:09:48 +00:00
|
|
|
,sal_True
|
|
|
|
,::dbtools::eInDataManipulation);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
void SAL_CALL OCacheSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::insertRow" );
|
2000-09-18 23:16:46 +00:00
|
|
|
Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
|
|
|
|
fillTableName(xSet);
|
|
|
|
|
2013-02-28 18:06:50 +01:00
|
|
|
OUStringBuffer aSql("INSERT INTO " + m_aComposedTableName + " ( ");
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
// set values and column names
|
2013-04-07 12:06:47 +02:00
|
|
|
OUStringBuffer aValues(" VALUES ( ");
|
|
|
|
static OUString aPara("?,");
|
|
|
|
OUString aQuote = getIdentifierQuoteString();
|
|
|
|
static OUString aComma(",");
|
2000-09-18 23:16:46 +00:00
|
|
|
sal_Int32 i = 1;
|
2008-12-30 13:32:01 +00:00
|
|
|
ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rInsertRow->get().begin()+1;
|
2009-07-03 12:24:35 +00:00
|
|
|
connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->get().end();
|
|
|
|
for(; aIter != aEnd;++aIter)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-01-15 22:40:04 -02:00
|
|
|
aSql.append(::dbtools::quoteName( aQuote,m_xSetMetaData->getColumnName(i++)) + aComma);
|
2009-07-03 12:24:35 +00:00
|
|
|
aValues.append(aPara);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2011-11-26 00:48:17 -05:00
|
|
|
aSql[aSql.getLength() - 1] = ')';
|
|
|
|
aValues[aValues.getLength() - 1] = ')';
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2009-07-03 12:24:35 +00:00
|
|
|
aSql.append(aValues.makeStringAndClear());
|
2000-09-18 23:16:46 +00:00
|
|
|
// now create end execute the prepared statement
|
2000-11-30 14:58:20 +00:00
|
|
|
{
|
2009-07-03 12:24:35 +00:00
|
|
|
Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
|
2001-01-22 06:38:24 +00:00
|
|
|
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
|
|
|
|
i = 1;
|
2009-07-03 12:24:35 +00:00
|
|
|
for(aIter = _rInsertRow->get().begin()+1; aIter != aEnd;++aIter,++i)
|
2001-01-22 06:38:24 +00:00
|
|
|
{
|
|
|
|
if(aIter->isNull())
|
|
|
|
xParameter->setNull(i,aIter->getTypeKind());
|
|
|
|
else
|
2008-01-30 07:27:56 +00:00
|
|
|
setParameter(i,xParameter,*aIter,m_xSetMetaData->getColumnType(i),m_xSetMetaData->getScale(i));
|
2001-01-22 06:38:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_bInserted = xPrep->executeUpdate() > 0;
|
2000-11-30 14:58:20 +00:00
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2000-09-29 14:23:36 +00:00
|
|
|
// TODO set the bookmark in the insert row
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2004-03-15 14:45:30 +00:00
|
|
|
void OCacheSet::fillParameters( const ORowSetRow& _rRow
|
|
|
|
,const connectivity::OSQLTable& _xTable
|
2013-04-07 12:06:47 +02:00
|
|
|
,OUStringBuffer& _sCondition
|
|
|
|
,OUStringBuffer& _sParameter
|
2004-03-15 14:45:30 +00:00
|
|
|
,::std::list< sal_Int32>& _rOrgValues)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::fillParameters" );
|
2010-11-09 22:15:21 +00:00
|
|
|
// use keys and indexes for exact positioning
|
2000-09-18 23:16:46 +00:00
|
|
|
// first the keys
|
2010-02-15 09:53:53 +01:00
|
|
|
Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
|
|
|
|
const Reference<XNameAccess> xPrimaryKeyColumns = getPrimaryKeyColumns_throw(xSet);
|
2000-09-18 23:16:46 +00:00
|
|
|
// second the indexes
|
|
|
|
Reference<XIndexesSupplier> xIndexSup(_xTable,UNO_QUERY);
|
|
|
|
Reference<XIndexAccess> xIndexes;
|
|
|
|
if(xIndexSup.is())
|
2004-08-02 13:59:33 +00:00
|
|
|
xIndexes.set(xIndexSup->getIndexes(),UNO_QUERY);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
// Reference<XColumnsSupplier>
|
|
|
|
Reference<XPropertySet> xIndexColsSup;
|
|
|
|
Reference<XNameAccess> xIndexColumns;
|
|
|
|
::std::vector< Reference<XNameAccess> > aAllIndexColumns;
|
2004-03-15 14:45:30 +00:00
|
|
|
if(xIndexes.is())
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-03-15 14:45:30 +00:00
|
|
|
for(sal_Int32 j=0;j<xIndexes->getCount();++j)
|
|
|
|
{
|
2010-02-15 09:53:53 +01:00
|
|
|
xIndexColsSup.set(xIndexes->getByIndex(j),UNO_QUERY);
|
2004-03-15 14:45:30 +00:00
|
|
|
if( xIndexColsSup.is()
|
|
|
|
&& comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISUNIQUE))
|
|
|
|
&& !comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISPRIMARYKEYINDEX))
|
|
|
|
)
|
|
|
|
aAllIndexColumns.push_back(Reference<XColumnsSupplier>(xIndexColsSup,UNO_QUERY)->getColumns());
|
|
|
|
}
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aColumnName;
|
2004-03-15 14:45:30 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
static OUString aPara("?,");
|
|
|
|
static OUString aAnd(" AND ");
|
2004-03-15 14:45:30 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aQuote = getIdentifierQuoteString();
|
2004-03-15 14:45:30 +00:00
|
|
|
|
2013-12-20 11:25:37 +01:00
|
|
|
sal_Int32 nCheckCount = 1; // index for the original values
|
2004-03-15 14:45:30 +00:00
|
|
|
sal_Int32 i = 1;
|
2009-07-03 12:24:35 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sIsNull(" IS NULL");
|
|
|
|
OUString sParam(" = ?");
|
2008-12-30 13:32:01 +00:00
|
|
|
ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rRow->get().begin()+1;
|
|
|
|
ORowVector< ORowSetValue >::Vector::const_iterator aEnd = _rRow->get().end()+1;
|
2004-03-15 14:45:30 +00:00
|
|
|
for(; aIter != aEnd;++aIter,++nCheckCount,++i)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2000-12-01 12:04:36 +00:00
|
|
|
aColumnName = m_xSetMetaData->getColumnName(i);
|
2010-02-15 09:53:53 +01:00
|
|
|
if(xPrimaryKeyColumns.is() && xPrimaryKeyColumns->hasByName(aColumnName))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2009-07-03 12:24:35 +00:00
|
|
|
_sCondition.append(::dbtools::quoteName( aQuote,aColumnName));
|
2000-12-01 12:04:36 +00:00
|
|
|
if(aIter->isNull())
|
2009-07-03 12:24:35 +00:00
|
|
|
_sCondition.append(sIsNull);
|
2000-12-01 12:04:36 +00:00
|
|
|
else
|
2009-07-03 12:24:35 +00:00
|
|
|
_sCondition.append(sParam);
|
|
|
|
_sCondition.append(aAnd);
|
2004-03-15 14:45:30 +00:00
|
|
|
_rOrgValues.push_back(nCheckCount);
|
2000-12-01 12:04:36 +00:00
|
|
|
|
2010-11-09 22:15:21 +00:00
|
|
|
}
|
2009-07-03 12:24:35 +00:00
|
|
|
::std::vector< Reference<XNameAccess> >::const_iterator aIndexEnd = aAllIndexColumns.end();
|
2000-12-01 12:04:36 +00:00
|
|
|
for( ::std::vector< Reference<XNameAccess> >::const_iterator aIndexIter = aAllIndexColumns.begin();
|
2009-07-03 12:24:35 +00:00
|
|
|
aIndexIter != aIndexEnd;++aIndexIter)
|
2000-12-01 12:04:36 +00:00
|
|
|
{
|
|
|
|
if((*aIndexIter)->hasByName(aColumnName))
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2009-07-03 12:24:35 +00:00
|
|
|
_sCondition.append(::dbtools::quoteName( aQuote,aColumnName));
|
2000-09-18 23:16:46 +00:00
|
|
|
if(aIter->isNull())
|
2009-07-03 12:24:35 +00:00
|
|
|
_sCondition.append(sIsNull);
|
2000-09-18 23:16:46 +00:00
|
|
|
else
|
2009-07-03 12:24:35 +00:00
|
|
|
_sCondition.append(sParam);
|
|
|
|
_sCondition.append(aAnd);
|
2004-03-15 14:45:30 +00:00
|
|
|
_rOrgValues.push_back(nCheckCount);
|
2000-12-01 12:04:36 +00:00
|
|
|
break;
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2000-12-01 12:04:36 +00:00
|
|
|
}
|
|
|
|
if(aIter->isModified())
|
|
|
|
{
|
2013-01-15 22:40:04 -02:00
|
|
|
_sParameter.append(::dbtools::quoteName( aQuote,aColumnName) + aPara);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
2004-03-15 14:45:30 +00:00
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2013-12-20 11:25:37 +01:00
|
|
|
void SAL_CALL OCacheSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOriginalRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException)
|
2004-03-15 14:45:30 +00:00
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::updateRow" );
|
2004-03-15 14:45:30 +00:00
|
|
|
Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
|
|
|
|
fillTableName(xSet);
|
|
|
|
|
2013-01-15 22:40:04 -02:00
|
|
|
OUStringBuffer aSql("UPDATE " + m_aComposedTableName + " SET ");
|
2004-03-15 14:45:30 +00:00
|
|
|
// list all cloumns that should be set
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUStringBuffer aCondition;
|
2004-03-15 14:45:30 +00:00
|
|
|
::std::list< sal_Int32> aOrgValues;
|
2004-08-02 13:59:33 +00:00
|
|
|
fillParameters(_rInsertRow,_xTable,aCondition,aSql,aOrgValues);
|
2011-11-26 00:48:17 -05:00
|
|
|
aSql[aSql.getLength() - 1] = ' ';
|
2013-03-09 21:47:17 +01:00
|
|
|
if ( !aCondition.isEmpty() )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2009-07-03 12:24:35 +00:00
|
|
|
aCondition.setLength(aCondition.getLength()-5);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2013-01-15 22:40:04 -02:00
|
|
|
aSql.append(" WHERE " + aCondition.makeStringAndClear());
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
else
|
2006-07-10 14:01:35 +00:00
|
|
|
::dbtools::throwSQLException(
|
|
|
|
DBACORE_RESSTRING( RID_STR_NO_UPDATE_MISSING_CONDITION ), SQL_GENERAL_ERROR, *this );
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
// now create end execute the prepared statement
|
2009-07-03 12:24:35 +00:00
|
|
|
Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
|
2000-09-18 23:16:46 +00:00
|
|
|
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
|
2004-03-15 14:45:30 +00:00
|
|
|
sal_Int32 i = 1;
|
2009-07-03 12:24:35 +00:00
|
|
|
connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->get().end();
|
|
|
|
for(ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rInsertRow->get().begin()+1; aIter != aEnd;++aIter)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2000-12-01 12:04:36 +00:00
|
|
|
if(aIter->isModified())
|
2008-01-30 07:27:56 +00:00
|
|
|
{
|
|
|
|
setParameter(i,xParameter,*aIter,m_xSetMetaData->getColumnType(i),m_xSetMetaData->getScale(i));
|
|
|
|
++i;
|
|
|
|
}
|
2010-11-09 22:15:21 +00:00
|
|
|
}
|
2009-07-03 12:24:35 +00:00
|
|
|
::std::list< sal_Int32>::const_iterator aOrgValueEnd = aOrgValues.end();
|
|
|
|
for(::std::list< sal_Int32>::const_iterator aOrgValue = aOrgValues.begin(); aOrgValue != aOrgValueEnd;++aOrgValue,++i)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-12-20 11:25:37 +01:00
|
|
|
setParameter(i,xParameter,(_rOriginalRow->get())[*aOrgValue],m_xSetMetaData->getColumnType(i),m_xSetMetaData->getScale(i));
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_bUpdated = xPrep->executeUpdate() > 0;
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
void SAL_CALL OCacheSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::deleteRow" );
|
2000-09-18 23:16:46 +00:00
|
|
|
Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
|
|
|
|
fillTableName(xSet);
|
|
|
|
|
2013-01-15 22:40:04 -02:00
|
|
|
OUStringBuffer aSql("DELETE FROM " + m_aComposedTableName + " WHERE ");
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2010-11-09 22:15:21 +00:00
|
|
|
// use keys and indexes for exact positioning
|
2004-08-02 13:59:33 +00:00
|
|
|
// first the keys
|
2010-02-15 09:53:53 +01:00
|
|
|
const Reference<XNameAccess> xPrimaryKeyColumns = getPrimaryKeyColumns_throw(xSet);
|
2004-08-02 13:59:33 +00:00
|
|
|
// second the indexes
|
|
|
|
Reference<XIndexesSupplier> xIndexSup(_xTable,UNO_QUERY);
|
|
|
|
Reference<XIndexAccess> xIndexes;
|
|
|
|
if(xIndexSup.is())
|
|
|
|
xIndexes.set(xIndexSup->getIndexes(),UNO_QUERY);
|
|
|
|
|
|
|
|
// Reference<XColumnsSupplier>
|
|
|
|
Reference<XPropertySet> xIndexColsSup;
|
|
|
|
Reference<XNameAccess> xIndexColumns;
|
|
|
|
::std::vector< Reference<XNameAccess> > aAllIndexColumns;
|
|
|
|
if(xIndexes.is())
|
|
|
|
{
|
|
|
|
for(sal_Int32 j=0;j<xIndexes->getCount();++j)
|
|
|
|
{
|
2008-01-30 07:27:56 +00:00
|
|
|
xIndexColsSup.set(xIndexes->getByIndex(j),UNO_QUERY);
|
2004-08-02 13:59:33 +00:00
|
|
|
if( xIndexColsSup.is()
|
|
|
|
&& comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISUNIQUE))
|
|
|
|
&& !comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISPRIMARYKEYINDEX))
|
|
|
|
)
|
|
|
|
aAllIndexColumns.push_back(Reference<XColumnsSupplier>(xIndexColsSup,UNO_QUERY)->getColumns());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUStringBuffer aColumnName;
|
2000-09-18 23:16:46 +00:00
|
|
|
::std::list< sal_Int32> aOrgValues;
|
2004-08-02 13:59:33 +00:00
|
|
|
fillParameters(_rDeleteRow,_xTable,aSql,aColumnName,aOrgValues);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2009-07-03 12:24:35 +00:00
|
|
|
aSql.setLength(aSql.getLength()-5);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2010-11-09 22:15:21 +00:00
|
|
|
// now create and execute the prepared statement
|
2009-07-03 12:24:35 +00:00
|
|
|
Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
|
2000-09-18 23:16:46 +00:00
|
|
|
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
|
2006-06-20 01:34:29 +00:00
|
|
|
sal_Int32 i = 1;
|
2009-07-03 12:24:35 +00:00
|
|
|
::std::list< sal_Int32>::const_iterator aOrgValueEnd = aOrgValues.end();
|
|
|
|
for(::std::list< sal_Int32>::const_iterator j = aOrgValues.begin(); j != aOrgValueEnd;++j,++i)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2008-12-30 13:32:01 +00:00
|
|
|
setParameter(i,xParameter,(_rDeleteRow->get())[*j],m_xSetMetaData->getColumnType(i),m_xSetMetaData->getScale(i));
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_bDeleted = xPrep->executeUpdate() > 0;
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2004-03-15 14:45:30 +00:00
|
|
|
void OCacheSet::setParameter(sal_Int32 nPos
|
2008-06-06 12:57:33 +00:00
|
|
|
,const Reference< XParameters >& _xParameter
|
2004-03-15 14:45:30 +00:00
|
|
|
,const ORowSetValue& _rValue
|
2008-01-30 07:27:56 +00:00
|
|
|
,sal_Int32 _nType
|
2010-02-15 09:53:53 +01:00
|
|
|
,sal_Int32 _nScale) const
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::setParameter" );
|
2003-03-19 16:57:12 +00:00
|
|
|
sal_Int32 nType = ( _nType != DataType::OTHER ) ? _nType : _rValue.getTypeKind();
|
2009-11-11 14:16:42 +01:00
|
|
|
::dbtools::setObjectWithInfo(_xParameter,nPos,_rValue,nType,_nScale);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2000-11-14 12:28:20 +00:00
|
|
|
void OCacheSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::fillValueRow" );
|
2006-06-20 01:34:29 +00:00
|
|
|
Any aBookmark = getBookmark();
|
2000-11-14 12:28:20 +00:00
|
|
|
if(!aBookmark.hasValue())
|
|
|
|
aBookmark = makeAny(_nPosition);
|
2006-06-20 01:34:29 +00:00
|
|
|
|
2008-12-30 13:32:01 +00:00
|
|
|
connectivity::ORowVector< ORowSetValue >::Vector::iterator aIter = _rRow->get().begin();
|
2009-04-23 10:42:05 +00:00
|
|
|
connectivity::ORowVector< ORowSetValue >::Vector::iterator aEnd = _rRow->get().end();
|
2000-11-14 12:28:20 +00:00
|
|
|
(*aIter) = aBookmark;
|
|
|
|
++aIter;
|
2009-04-23 10:42:05 +00:00
|
|
|
for(sal_Int32 i=1;aIter != aEnd;++aIter,++i)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-03-02 11:40:41 +00:00
|
|
|
aIter->setSigned(m_aSignedFlags[i-1]);
|
2012-01-16 19:38:01 +01:00
|
|
|
aIter->fill(i, m_aColumnTypes[i-1], this);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
sal_Bool SAL_CALL OCacheSet::wasNull( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::wasNull" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->wasNull();
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString SAL_CALL OCacheSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
2001-10-26 06:50:50 +00:00
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getString" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->getString(columnIndex);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
sal_Bool SAL_CALL OCacheSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getBoolean" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->getBoolean(columnIndex);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
sal_Int8 SAL_CALL OCacheSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getByte" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->getByte(columnIndex);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
sal_Int16 SAL_CALL OCacheSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getShort" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->getShort(columnIndex);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
sal_Int32 SAL_CALL OCacheSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getInt" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->getInt(columnIndex);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
sal_Int64 SAL_CALL OCacheSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getLong" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->getLong(columnIndex);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
float SAL_CALL OCacheSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getFloat" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->getFloat(columnIndex);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
double SAL_CALL OCacheSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getDouble" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->getDouble(columnIndex);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
Sequence< sal_Int8 > SAL_CALL OCacheSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getBytes" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->getBytes(columnIndex);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
::com::sun::star::util::Date SAL_CALL OCacheSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getDate" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->getDate(columnIndex);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
::com::sun::star::util::Time SAL_CALL OCacheSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getTime" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->getTime(columnIndex);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
::com::sun::star::util::DateTime SAL_CALL OCacheSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getTimestamp" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->getTimestamp(columnIndex);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCacheSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getBinaryStream" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->getBinaryStream(columnIndex);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCacheSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getCharacterStream" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->getCharacterStream(columnIndex);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
Any SAL_CALL OCacheSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getObject" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->getObject(columnIndex,typeMap);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
Reference< XRef > SAL_CALL OCacheSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getRef" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->getRef(columnIndex);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
Reference< XBlob > SAL_CALL OCacheSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getBlob" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->getBlob(columnIndex);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
Reference< XClob > SAL_CALL OCacheSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getClob" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->getClob(columnIndex);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
Reference< XArray > SAL_CALL OCacheSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getArray" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverRow->getArray(columnIndex);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
// XResultSet
|
|
|
|
sal_Bool SAL_CALL OCacheSet::next( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::next" );
|
2001-10-26 06:50:50 +00:00
|
|
|
m_bInserted = m_bUpdated = m_bDeleted = sal_False;
|
|
|
|
return m_xDriverSet->next();
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
sal_Bool SAL_CALL OCacheSet::isBeforeFirst( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::isBeforeFirst" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverSet->isBeforeFirst();
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
sal_Bool SAL_CALL OCacheSet::isAfterLast( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::isAfterLast" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverSet->isAfterLast();
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
sal_Bool SAL_CALL OCacheSet::isFirst( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::isFirst" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverSet->isFirst();
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
sal_Bool SAL_CALL OCacheSet::isLast( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::isLast" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverSet->isLast();
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
void SAL_CALL OCacheSet::beforeFirst( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::beforeFirst" );
|
2001-10-26 06:50:50 +00:00
|
|
|
m_bInserted = m_bUpdated = m_bDeleted = sal_False;
|
|
|
|
m_xDriverSet->beforeFirst();
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
void SAL_CALL OCacheSet::afterLast( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::afterLast" );
|
2001-10-26 06:50:50 +00:00
|
|
|
m_bInserted = m_bUpdated = m_bDeleted = sal_False;
|
|
|
|
m_xDriverSet->afterLast();
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
sal_Bool SAL_CALL OCacheSet::first( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::first" );
|
2001-10-26 06:50:50 +00:00
|
|
|
m_bInserted = m_bUpdated = m_bDeleted = sal_False;
|
|
|
|
return m_xDriverSet->first();
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
sal_Bool SAL_CALL OCacheSet::last( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::last" );
|
2001-10-26 06:50:50 +00:00
|
|
|
m_bInserted = m_bUpdated = m_bDeleted = sal_False;
|
|
|
|
return m_xDriverSet->last();
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
sal_Int32 SAL_CALL OCacheSet::getRow( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getRow" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverSet->getRow();
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
sal_Bool SAL_CALL OCacheSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::absolute" );
|
2001-10-26 06:50:50 +00:00
|
|
|
m_bInserted = m_bUpdated = m_bDeleted = sal_False;
|
|
|
|
return m_xDriverSet->absolute(row);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
sal_Bool SAL_CALL OCacheSet::relative( sal_Int32 rows ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::relative" );
|
2001-10-26 06:50:50 +00:00
|
|
|
m_bInserted = m_bUpdated = m_bDeleted = sal_False;
|
|
|
|
return m_xDriverSet->relative(rows);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
sal_Bool SAL_CALL OCacheSet::previous( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::previous" );
|
2001-10-26 06:50:50 +00:00
|
|
|
m_bInserted = m_bUpdated = m_bDeleted = sal_False;
|
|
|
|
return m_xDriverSet->previous();
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2010-12-02 13:16:48 +01:00
|
|
|
sal_Bool OCacheSet::last_checked( sal_Bool /*i_bFetchRow*/)
|
|
|
|
{
|
|
|
|
return last();
|
|
|
|
}
|
2011-04-22 15:07:40 +02:00
|
|
|
|
2010-12-02 13:16:48 +01:00
|
|
|
sal_Bool OCacheSet::previous_checked( sal_Bool /*i_bFetchRow*/ )
|
|
|
|
{
|
|
|
|
return previous();
|
|
|
|
}
|
2011-04-22 15:07:40 +02:00
|
|
|
|
2010-12-02 13:16:48 +01:00
|
|
|
sal_Bool OCacheSet::absolute_checked( sal_Int32 row,sal_Bool /*i_bFetchRow*/ )
|
|
|
|
{
|
|
|
|
return absolute(row);
|
|
|
|
}
|
2011-04-22 15:07:40 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
void SAL_CALL OCacheSet::refreshRow( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::refreshRow" );
|
2001-10-26 06:50:50 +00:00
|
|
|
m_xDriverSet->refreshRow();
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
sal_Bool SAL_CALL OCacheSet::rowUpdated( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::rowUpdated" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverSet->rowUpdated();
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
sal_Bool SAL_CALL OCacheSet::rowInserted( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::rowInserted" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverSet->rowInserted();
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
sal_Bool SAL_CALL OCacheSet::rowDeleted( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::rowDeleted" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverSet->rowDeleted();
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2001-10-26 06:50:50 +00:00
|
|
|
Reference< XInterface > SAL_CALL OCacheSet::getStatement( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-29 17:38:04 +03:00
|
|
|
SAL_INFO("dbaccess", "OCacheSet::getStatement" );
|
2001-10-26 06:50:50 +00:00
|
|
|
return m_xDriverSet->getStatement();
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2010-02-15 09:53:53 +01:00
|
|
|
bool OCacheSet::isResultSetChanged() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2010-02-15 09:53:53 +01:00
|
|
|
void OCacheSet::mergeColumnValues(sal_Int32 i_nColumnIndex,ORowSetValueVector::Vector& /*io_aInsertRow*/,ORowSetValueVector::Vector& /*io_aRow*/,::std::vector<sal_Int32>& o_aChangedColumns)
|
|
|
|
{
|
|
|
|
o_aChangedColumns.push_back(i_nColumnIndex);
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2010-02-15 09:53:53 +01:00
|
|
|
bool OCacheSet::columnValuesUpdated(ORowSetValueVector::Vector& /*io_aCachedRow*/,const ORowSetValueVector::Vector& /*io_aRow*/)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2010-02-15 09:53:53 +01:00
|
|
|
bool OCacheSet::updateColumnValues(const ORowSetValueVector::Vector& /*io_aCachedRow*/,ORowSetValueVector::Vector& /*io_aRow*/,const ::std::vector<sal_Int32>& /*i_aChangedColumns*/)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2010-10-12 22:40:56 +02:00
|
|
|
|
2010-02-15 09:53:53 +01:00
|
|
|
void OCacheSet::fillMissingValues(ORowSetValueVector::Vector& /*io_aRow*/) const
|
|
|
|
{
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2010-10-12 15:59:03 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|