summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorOcke Janssen [oj] <Ocke.Janssen@sun.com>2010-07-08 12:21:55 +0200
committerOcke Janssen [oj] <Ocke.Janssen@sun.com>2010-07-08 12:21:55 +0200
commit42584318cc4a396d31d980504397f3f8b9814a45 (patch)
tree859667bfa9a346ff91358401fdfb5a71f1deaf6c /dbaccess
parentf550379188d5f14e87e5452e79fa64d0c9cf0cd3 (diff)
dba33g: #i111205# handle filter for key and update and insert row
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/api/KeySet.cxx523
-rw-r--r--dbaccess/source/core/api/KeySet.hxx24
-rw-r--r--dbaccess/source/core/api/OptimisticSet.cxx940
-rw-r--r--dbaccess/source/core/api/OptimisticSet.hxx95
-rw-r--r--dbaccess/source/core/api/makefile.mk1
5 files changed, 278 insertions, 1305 deletions
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index 08c782f05656..2580733deba5 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -53,9 +53,6 @@
#ifndef _COM_SUN_STAR_SDBC_XGENERATEDRESULTSET_HPP_
#include <com/sun/star/sdbc/XGeneratedResultSet.hpp>
#endif
-#ifndef _COM_SUN_STAR_SDB_XSINGLESELECTQUERYCOMPOSER_HPP_
-#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
-#endif
#ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_
#include <com/sun/star/sdbc/XColumnLocate.hpp>
#endif
@@ -112,6 +109,7 @@
#endif
#include <string.h>
#include <rtl/logfile.hxx>
+#include "PrivateRow.hxx"
using namespace dbaccess;
using namespace ::connectivity;
@@ -148,134 +146,6 @@ namespace
}
}
}
- class OPrivateRow : public ::cppu::WeakImplHelper1<XRow>
- {
- ORowSetValueVector::Vector m_aRow;
- sal_Int32 m_nPos;
- public:
- OPrivateRow(const ORowSetValueVector::Vector& i_aRow) : m_aRow(i_aRow),m_nPos(0)
- {
- }
- virtual ::sal_Bool SAL_CALL wasNull( ) throw (SQLException, RuntimeException);
- virtual ::rtl::OUString SAL_CALL getString( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual ::sal_Bool SAL_CALL getBoolean( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual ::sal_Int8 SAL_CALL getByte( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual ::sal_Int16 SAL_CALL getShort( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual ::sal_Int32 SAL_CALL getInt( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual ::sal_Int64 SAL_CALL getLong( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual float SAL_CALL getFloat( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual double SAL_CALL getDouble( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual Sequence< ::sal_Int8 > SAL_CALL getBytes( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual ::com::sun::star::util::Date SAL_CALL getDate( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual ::com::sun::star::util::Time SAL_CALL getTime( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual Any SAL_CALL getObject( ::sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw (SQLException, RuntimeException);
- virtual Reference< XRef > SAL_CALL getRef( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual Reference< XBlob > SAL_CALL getBlob( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual Reference< XClob > SAL_CALL getClob( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- virtual Reference< XArray > SAL_CALL getArray( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException);
- };
- ::sal_Bool SAL_CALL OPrivateRow::wasNull( ) throw (SQLException, RuntimeException)
- {
- return m_aRow[m_nPos].isNull();
- }
- ::rtl::OUString SAL_CALL OPrivateRow::getString( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- ::sal_Bool SAL_CALL OPrivateRow::getBoolean( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- ::sal_Int8 SAL_CALL OPrivateRow::getByte( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- ::sal_Int16 SAL_CALL OPrivateRow::getShort( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- ::sal_Int32 SAL_CALL OPrivateRow::getInt( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- ::sal_Int64 SAL_CALL OPrivateRow::getLong( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- float SAL_CALL OPrivateRow::getFloat( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- double SAL_CALL OPrivateRow::getDouble( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- Sequence< ::sal_Int8 > SAL_CALL OPrivateRow::getBytes( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- ::com::sun::star::util::Date SAL_CALL OPrivateRow::getDate( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- ::com::sun::star::util::Time SAL_CALL OPrivateRow::getTime( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- ::com::sun::star::util::DateTime SAL_CALL OPrivateRow::getTimestamp( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos];
- }
- Reference< ::com::sun::star::io::XInputStream > SAL_CALL OPrivateRow::getBinaryStream( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return Reference< ::com::sun::star::io::XInputStream >(m_aRow[m_nPos].makeAny(),UNO_QUERY);
- }
- Reference< ::com::sun::star::io::XInputStream > SAL_CALL OPrivateRow::getCharacterStream( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return Reference< ::com::sun::star::io::XInputStream >(m_aRow[m_nPos].makeAny(),UNO_QUERY);
- }
- Any SAL_CALL OPrivateRow::getObject( ::sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return m_aRow[m_nPos].makeAny();
- }
- Reference< XRef > SAL_CALL OPrivateRow::getRef( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return Reference< XRef >(m_aRow[m_nPos].makeAny(),UNO_QUERY);
- }
- Reference< XBlob > SAL_CALL OPrivateRow::getBlob( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return Reference< XBlob >(m_aRow[m_nPos].makeAny(),UNO_QUERY);
- }
- Reference< XClob > SAL_CALL OPrivateRow::getClob( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return Reference< XClob >(m_aRow[m_nPos].makeAny(),UNO_QUERY);
- }
- Reference< XArray > SAL_CALL OPrivateRow::getArray( ::sal_Int32 columnIndex ) throw (SQLException, RuntimeException)
- {
- m_nPos = columnIndex;
- return Reference< XArray >(m_aRow[m_nPos].makeAny(),UNO_QUERY);
- }
}
DBG_NAME(OKeySet)
// -------------------------------------------------------------------------
@@ -315,117 +185,106 @@ OKeySet::~OKeySet()
OSL_ENSURE(0,"Unknown Exception occured");
}
m_xComposer = NULL;
- delete m_pKeyColumnNames;
- delete m_pColumnNames;
- delete m_pParameterNames;
- delete m_pForeignColumnNames;
DBG_DTOR(OKeySet,NULL);
}
-// -----------------------------------------------------------------------------
-void OKeySet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter)
+void OKeySet::initColumns()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::construct" );
- OCacheSet::construct(_xDriverSet,i_sRowSetFilter);
-
Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
bool bCase = (xMeta.is() && xMeta->storesMixedCaseQuotedIdentifiers()) ? true : false;
- m_pKeyColumnNames = new SelectColumnsMetaData(bCase);
- m_pColumnNames = new SelectColumnsMetaData(bCase);
- m_pParameterNames = new SelectColumnsMetaData(bCase);
- m_pForeignColumnNames = new SelectColumnsMetaData(bCase);
-
- Reference<XNameAccess> xKeyColumns = getKeyColumns();
- Reference<XColumnsSupplier> xSup(m_xComposer,UNO_QUERY);
- Reference<XNameAccess> xSourceColumns = m_xTable->getColumns();
- // locate parameter in select columns
- Reference<XParametersSupplier> xParaSup(m_xComposer,UNO_QUERY);
- Reference<XIndexAccess> xQueryParameters = xParaSup->getParameters();
- const sal_Int32 nParaCount = xQueryParameters->getCount();
- Sequence< ::rtl::OUString> aParameterColumns(nParaCount);
- for(sal_Int32 i = 0; i< nParaCount;++i)
- {
- Reference<XPropertySet> xPara(xQueryParameters->getByIndex(i),UNO_QUERY_THROW);
- xPara->getPropertyValue(PROPERTY_REALNAME) >>= aParameterColumns[i];
- }
-
+ m_pKeyColumnNames.reset( new SelectColumnsMetaData(bCase) );
+ m_pColumnNames.reset( new SelectColumnsMetaData(bCase) );
+ m_pParameterNames.reset( new SelectColumnsMetaData(bCase) );
+ m_pForeignColumnNames.reset( new SelectColumnsMetaData(bCase) );
+}
+void OKeySet::findTableColumnsMatching_throw(const Any& i_aTable
+ ,const Reference<XDatabaseMetaData>& i_xMeta
+ ,const Reference<XNameAccess>& i_xQueryColumns)
+{
::rtl::OUString sCatalog,sSchema,sTable;
-
- Reference<XPropertySet> xTableProp(m_xTable,UNO_QUERY);
+ Reference<XPropertySet> xTableProp(i_aTable,UNO_QUERY);
Any aCatalog = xTableProp->getPropertyValue(PROPERTY_CATALOGNAME);
aCatalog >>= sCatalog;
xTableProp->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema;
xTableProp->getPropertyValue(PROPERTY_NAME) >>= sTable;
- ::std::vector< ::rtl::OUString> aBestRowColumnNames;
- /* doesn't work with hsqldb
- Reference<XResultSet> xBestRes(xMeta->getBestRowIdentifier(aCatalog,sSchema,sTable,0,sal_False));
- Reference<XRow> xBestRow(xBestRes,uno::UNO_QUERY);
- while ( xBestRes->next() )
- {
- aBestRowColumnNames.push_back(xBestRow->getString(2));
- }
- */
+ // first ask the database itself for the best columns which can be used
Sequence< ::rtl::OUString> aBestColumnNames;
- if ( !aBestRowColumnNames.empty() )
+ Reference<XNameAccess> xKeyColumns = getPrimaryKeyColumns_throw(i_aTable);
+ if ( xKeyColumns.is() )
+ aBestColumnNames = xKeyColumns->getElementNames();
- {
- aBestColumnNames = Sequence< ::rtl::OUString>(&aBestRowColumnNames[0],aBestRowColumnNames.size());
- ::dbaccess::getColumnPositions(xSup->getColumns(),aBestColumnNames,m_sUpdateTableName,(*m_pKeyColumnNames));
- }
+ const Reference<XColumnsSupplier> xTblColSup(i_aTable,UNO_QUERY_THROW);
+ const Reference<XNameAccess> xTblColumns = xTblColSup->getColumns();
+ const ::rtl::OUString sComposedUpdateTableName = dbtools::composeTableName( i_xMeta, sCatalog, sSchema, sTable, sal_False, ::dbtools::eInDataManipulation );
+ ::dbaccess::getColumnPositions(i_xQueryColumns,aBestColumnNames,sComposedUpdateTableName,(*m_pKeyColumnNames),true);
+ ::dbaccess::getColumnPositions(i_xQueryColumns,xTblColumns->getElementNames(),sComposedUpdateTableName,(*m_pColumnNames),true);
- if (m_pKeyColumnNames->empty() && xKeyColumns.is())
+ // locate parameter in select columns
+ Reference<XParametersSupplier> xParaSup(m_xComposer,UNO_QUERY);
+ Reference<XIndexAccess> xQueryParameters = xParaSup->getParameters();
+ const sal_Int32 nParaCount = xQueryParameters->getCount();
+ Sequence< ::rtl::OUString> aParameterColumns(nParaCount);
+ for(sal_Int32 i = 0; i< nParaCount;++i)
{
- aBestColumnNames = xKeyColumns->getElementNames();
- ::dbaccess::getColumnPositions(xSup->getColumns(),aBestColumnNames,m_sUpdateTableName,(*m_pKeyColumnNames));
+ Reference<XPropertySet> xPara(xQueryParameters->getByIndex(i),UNO_QUERY_THROW);
+ xPara->getPropertyValue(PROPERTY_REALNAME) >>= aParameterColumns[i];
}
- ::dbaccess::getColumnPositions(xSup->getColumns(),xSourceColumns->getElementNames(),m_sUpdateTableName,(*m_pColumnNames));
- ::dbaccess::getColumnPositions(xSup->getColumns(),aParameterColumns,m_sUpdateTableName,(*m_pParameterNames));
+ ::dbaccess::getColumnPositions(i_xQueryColumns,aParameterColumns,sComposedUpdateTableName,(*m_pParameterNames),true);
- SelectColumnsMetaData::const_iterator aPosIter = (*m_pKeyColumnNames).begin();
- SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end();
+ SelectColumnsMetaData::const_iterator aPosIter = m_pKeyColumnNames->begin();
+ SelectColumnsMetaData::const_iterator aPosEnd = m_pKeyColumnNames->end();
for(;aPosIter != aPosEnd;++aPosIter)
{
- if(xSourceColumns->hasByName(aPosIter->first))
+ if ( xTblColumns->hasByName(aPosIter->second.sRealName) )
{
- Reference<XPropertySet> xProp(xSourceColumns->getByName(aPosIter->first),UNO_QUERY);
- sal_Bool bAuto = sal_Bool();
+ Reference<XPropertySet> xProp(xTblColumns->getByName(aPosIter->second.sRealName),UNO_QUERY);
+ sal_Bool bAuto = sal_False;
if( (xProp->getPropertyValue(PROPERTY_ISAUTOINCREMENT) >>= bAuto) && bAuto)
m_aAutoColumns.push_back(aPosIter->first);
}
}
-
- // the first row is empty because it's now easier for us to distinguish when we are beforefirst or first
- // without extra varaible to be set
- m_aKeyMap.insert(OKeySetMatrix::value_type(0,OKeySetValue(NULL,::std::pair<sal_Int32,Reference<XRow> >(0,NULL))));
-
- m_aKeyIter = m_aKeyMap.begin();
-
+}
+::rtl::OUStringBuffer OKeySet::createKeyFilter()
+{
static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND ");
- Reference<XDatabaseMetaData> xMetaData = m_xConnection->getMetaData();
const ::rtl::OUString aQuote = getIdentifierQuoteString();
- m_aSelectComposedTableName = getComposedTableName(sCatalog,sSchema,sTable);
-
- ::rtl::OUString sComposedName;
- sCatalog = sSchema = sTable = ::rtl::OUString();
- ::dbtools::qualifiedNameComponents(xMetaData,m_sUpdateTableName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation);
- sComposedName = ::dbtools::composeTableName( xMetaData, sCatalog, sSchema, sTable, sal_True, ::dbtools::eInDataManipulation );
-
::rtl::OUStringBuffer aFilter;
static ::rtl::OUString s_sDot(RTL_CONSTASCII_USTRINGPARAM("."));
static ::rtl::OUString s_sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?"));
// create the where clause
- aPosEnd = (*m_pKeyColumnNames).end();
- for(aPosIter = (*m_pKeyColumnNames).begin();aPosIter != aPosEnd;)
+ SelectColumnsMetaData::iterator aPosEnd = m_pKeyColumnNames->end();
+ for(SelectColumnsMetaData::iterator aPosIter = m_pKeyColumnNames->begin();aPosIter != aPosEnd;)
{
- aFilter.append(sComposedName);
+ aFilter.append(::dbtools::quoteName( aQuote,aPosIter->second.sTableName));
aFilter.append(s_sDot);
- aFilter.append(::dbtools::quoteName( aQuote,aPosIter->first));
+ aFilter.append(::dbtools::quoteName( aQuote,aPosIter->second.sRealName));
aFilter.append(s_sParam);
++aPosIter;
if(aPosIter != aPosEnd)
aFilter.append(aAnd);
}
+ return aFilter;
+}
+// -----------------------------------------------------------------------------
+void OKeySet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::construct" );
+ OCacheSet::construct(_xDriverSet,i_sRowSetFilter);
+ initColumns();
+
+ Reference<XNameAccess> xKeyColumns = getKeyColumns();
+ Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
+ Reference<XColumnsSupplier> xQueryColSup(m_xComposer,UNO_QUERY);
+ const Reference<XNameAccess> xQueryColumns = xQueryColSup->getColumns();
+ findTableColumnsMatching_throw(makeAny(m_xTable),xMeta,xQueryColumns);
+
+ // the first row is empty because it's now easier for us to distinguish when we are beforefirst or first
+ // without extra varaible to be set
+ m_aKeyMap.insert(OKeySetMatrix::value_type(0,OKeySetValue(NULL,::std::pair<sal_Int32,Reference<XRow> >(0,NULL))));
+ m_aKeyIter = m_aKeyMap.begin();
+
+ ::rtl::OUStringBuffer aFilter = createKeyFilter();
Reference< XSingleSelectQueryComposer> xSourceComposer(m_xComposer,UNO_QUERY);
Reference< XMultiServiceFactory > xFactory(m_xConnection, UNO_QUERY_THROW);
@@ -436,6 +295,10 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::O
const Sequence< ::rtl::OUString> aSeq = xSelectTables->getElementNames();
if ( aSeq.getLength() > 1 ) // special handling for join
{
+ static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND ");
+ const ::rtl::OUString aQuote = getIdentifierQuoteString();
+ static ::rtl::OUString s_sDot(RTL_CONSTASCII_USTRINGPARAM("."));
+ static ::rtl::OUString s_sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?"));
const ::rtl::OUString* pIter = aSeq.getConstArray();
const ::rtl::OUString* pEnd = pIter + aSeq.getLength();
for(;pIter != pEnd;++pIter)
@@ -444,13 +307,12 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::O
{
connectivity::OSQLTable xSelColSup(xSelectTables->getByName(*pIter),uno::UNO_QUERY);
Reference<XPropertySet> xProp(xSelColSup,uno::UNO_QUERY);
- ::rtl::OUString sSelectTableName = ::dbtools::composeTableName( xMetaData, xProp, ::dbtools::eInDataManipulation, false, false, false );
- Reference<XNameAccess > xSelectColumns = xSup->getColumns();
+ ::rtl::OUString sSelectTableName = ::dbtools::composeTableName( xMeta, xProp, ::dbtools::eInDataManipulation, false, false, false );
- ::dbaccess::getColumnPositions(xSelectColumns,xSelColSup->getColumns()->getElementNames(),sSelectTableName,(*m_pForeignColumnNames));
+ ::dbaccess::getColumnPositions(xQueryColumns,xSelColSup->getColumns()->getElementNames(),sSelectTableName,(*m_pForeignColumnNames));
- aPosEnd = (*m_pForeignColumnNames).end();
- for(aPosIter = (*m_pForeignColumnNames).begin();aPosIter != aPosEnd;++aPosIter)
+ SelectColumnsMetaData::iterator aPosEnd = (*m_pForeignColumnNames).end();
+ for(SelectColumnsMetaData::iterator aPosIter = (*m_pForeignColumnNames).begin();aPosIter != aPosEnd;++aPosIter)
{
// look for columns not in the source columns to use them as filter as well
// if ( !xSourceColumns->hasByName(aPosIter->first) )
@@ -459,7 +321,7 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::O
aFilter.append(aAnd);
aFilter.append(::dbtools::quoteName( aQuote,sSelectTableName));
aFilter.append(s_sDot);
- aFilter.append(::dbtools::quoteName( aQuote,aPosIter->first));
+ aFilter.append(::dbtools::quoteName( aQuote,aPosIter->second.sRealName));
aFilter.append(s_sParam);
}
}
@@ -467,17 +329,40 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::O
}
}
} // if ( aSeq.getLength() > 1 ) // special handling for join
-
- if ( i_sRowSetFilter.getLength() )
+ executeStatement(aFilter,i_sRowSetFilter,xAnalyzer);
+}
+void OKeySet::executeStatement(::rtl::OUStringBuffer& io_aFilter,const ::rtl::OUString& i_sRowSetFilter,Reference<XSingleSelectQueryComposer>& io_xAnalyzer)
+{
+ bool bFilterSet = i_sRowSetFilter.getLength() != 0;
+ if ( bFilterSet )
{
FilterCreator aFilterCreator;
aFilterCreator.append( i_sRowSetFilter );
- aFilterCreator.append( aFilter.makeStringAndClear() );
- aFilter = aFilterCreator.getComposedAndClear();
+ aFilterCreator.append( io_aFilter.makeStringAndClear() );
+ io_aFilter = aFilterCreator.getComposedAndClear();
}
- xAnalyzer->setFilter(aFilter.makeStringAndClear());
- m_xStatement = m_xConnection->prepareStatement(xAnalyzer->getQueryWithSubstitution());
- ::comphelper::disposeComponent(xAnalyzer);
+ io_xAnalyzer->setFilter(io_aFilter.makeStringAndClear());
+ if ( bFilterSet )
+ {
+ Sequence< Sequence< PropertyValue > > aFilter2 = io_xAnalyzer->getStructuredFilter();
+ const Sequence< PropertyValue >* pOr = aFilter2.getConstArray();
+ const Sequence< PropertyValue >* pOrEnd = pOr + aFilter2.getLength();
+ for(;pOr != pOrEnd;++pOr)
+ {
+ const PropertyValue* pAnd = pOr->getConstArray();
+ const PropertyValue* pAndEnd = pAnd + pOr->getLength();
+ for(;pAnd != pAndEnd;++pAnd)
+ {
+ ::rtl::OUString sValue;
+ if ( !(pAnd->Value >>= sValue) || !(sValue.equalsAscii("?") || sValue.matchAsciiL(":",1,0)) )
+ { // we have a criteria which has to be taken into account for updates
+ m_aFilterColumns.push_back(pAnd->Name);
+ }
+ }
+ }
+ }
+ m_xStatement = m_xConnection->prepareStatement(io_xAnalyzer->getQueryWithSubstitution());
+ ::comphelper::disposeComponent(io_xAnalyzer);
}
// -------------------------------------------------------------------------
Any SAL_CALL OKeySet::getBookmark() throw(SQLException, RuntimeException)
@@ -560,7 +445,7 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows
SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end();
for(;aIter != aPosEnd;++aIter)
{
- aCondition.append(::dbtools::quoteName( aQuote,aIter->first));
+ aCondition.append(::dbtools::quoteName( aQuote,aIter->second.sRealName));
aCondition.append(aEqual);
aCondition.append(aAnd);
}
@@ -665,7 +550,7 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
//if(xKeyColumns.is() && xKeyColumns->hasByName(aIter->first))
if ( m_pKeyColumnNames->find(aIter->first) != m_pKeyColumnNames->end() )
{
- sKeyCondition.append(::dbtools::quoteName( aQuote,aIter->first));
+ sKeyCondition.append(::dbtools::quoteName( aQuote,aIter->second.sRealName));
if((_rOrginalRow->get())[aIter->second.nPosition].isNull())
sKeyCondition.append(sIsNull);
else
@@ -680,7 +565,7 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
{
if((*aIndexIter)->hasByName(aIter->first))
{
- sIndexCondition.append(::dbtools::quoteName( aQuote,aIter->first));
+ sIndexCondition.append(::dbtools::quoteName( aQuote,aIter->second.sRealName));
if((_rOrginalRow->get())[aIter->second.nPosition].isNull())
sIndexCondition.append(sIsNull);
else
@@ -695,7 +580,7 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
}
if((_rInsertRow->get())[aIter->second.nPosition].isModified())
{
- aSql.append(::dbtools::quoteName( aQuote,aIter->first));
+ aSql.append(::dbtools::quoteName( aQuote,aIter->second.sRealName));
aSql.append(aPara);
}
}
@@ -729,62 +614,74 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_CONDITION_FOR_PK ), SQL_GENERAL_ERROR, m_xConnection );
// now create end execute the prepared statement
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
+
+ ::rtl::OUString sEmpty;
+ executeUpdate(_rInsertRow ,_rOrginalRow,aSql.makeStringAndClear(),sEmpty,aIndexColumnPositions);
+}
+// -----------------------------------------------------------------------------
+void OKeySet::executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName,const ::std::vector<sal_Int32>& _aIndexColumnPositions)
+{
+ // now create end execute the prepared statement
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(i_sSQL));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
- i = 1;
- // first the set values
bool bRefetch = true;
- aIter = m_pColumnNames->begin();
- sal_uInt16 j = 0;
Reference<XRow> xRow;
+ sal_Int32 i = 1;
+ // first the set values
+ SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin();
+ SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end();
+ sal_uInt16 j = 0;
for(;aIter != aEnd;++aIter,++j)
{
- sal_Int32 nPos = aIter->second.nPosition;
- if((_rInsertRow->get())[nPos].isModified())
+ if ( !i_sTableName.getLength() || aIter->second.sTableName == i_sTableName )
{
- if ( bRefetch )
+ sal_Int32 nPos = aIter->second.nPosition;
+ if((_rInsertRow->get())[nPos].isModified())
{
- bRefetch = ::std::find(m_aFilterColumns.begin(),m_aFilterColumns.end(),aIter->first) == m_aFilterColumns.end();
- if ( !bRefetch )
+ if ( bRefetch )
{
- xRow = new OPrivateRow(_rInsertRow->get());
+ bRefetch = ::std::find(m_aFilterColumns.begin(),m_aFilterColumns.end(),aIter->second.sRealName) == m_aFilterColumns.end();
}
+ impl_convertValue_throw(_rInsertRow,aIter->second);
+ (_rInsertRow->get())[nPos].setSigned((_rOrginalRow->get())[nPos].isSigned());
+ setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aIter->second.nType,aIter->second.nScale);
}
-
- impl_convertValue_throw(_rInsertRow,aIter->second);
- (_rInsertRow->get())[nPos].setSigned((_rOrginalRow->get())[nPos].isSigned());
- setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aIter->second.nType,aIter->second.nScale);
}
}
// and then the values of the where condition
- aIter = (*m_pKeyColumnNames).begin();
- aEnd = (*m_pKeyColumnNames).end();
+ aIter = m_pKeyColumnNames->begin();
+ aEnd = m_pKeyColumnNames->end();
j = 0;
- for(;aIter != aEnd;++aIter,++i,++j)
+ for(;aIter != aEnd;++aIter,++j)
{
- setParameter(i,xParameter,(_rOrginalRow->get())[aIter->second.nPosition],aIter->second.nType,aIter->second.nScale);
+ if ( !i_sTableName.getLength() || aIter->second.sTableName == i_sTableName )
+ {
+ setParameter(i++,xParameter,(_rOrginalRow->get())[aIter->second.nPosition],aIter->second.nType,aIter->second.nScale);
+ }
}
-
- // now we have to set the index values
- ::std::vector<sal_Int32>::iterator aIdxColIter = aIndexColumnPositions.begin();
- ::std::vector<sal_Int32>::iterator aIdxColEnd = aIndexColumnPositions.end();
- j = 0;
- aIter = m_pColumnNames->begin();
- for(;aIdxColIter != aIdxColEnd;++aIdxColIter,++i,++j,++aIter)
+ if ( !_aIndexColumnPositions.empty() )
{
- setParameter(i,xParameter,(_rOrginalRow->get())[*aIdxColIter],(_rOrginalRow->get())[*aIdxColIter].getTypeKind(),aIter->second.nScale);
+ // now we have to set the index values
+ ::std::vector<sal_Int32>::const_iterator aIdxColIter = _aIndexColumnPositions.begin();
+ ::std::vector<sal_Int32>::const_iterator aIdxColEnd = _aIndexColumnPositions.end();
+ j = 0;
+ aIter = m_pColumnNames->begin();
+ for(;aIdxColIter != aIdxColEnd;++aIdxColIter,++i,++j,++aIter)
+ {
+ setParameter(i,xParameter,(_rOrginalRow->get())[*aIdxColIter],(_rOrginalRow->get())[*aIdxColIter].getTypeKind(),aIter->second.nScale);
+ }
}
-
- m_bUpdated = xPrep->executeUpdate() > 0;
+ const sal_Int32 nRowsUpdated = xPrep->executeUpdate();
+ m_bUpdated = nRowsUpdated > 0;
if(m_bUpdated)
{
const sal_Int32 nBookmark = ::comphelper::getINT32((_rInsertRow->get())[0].getAny());
m_aKeyIter = m_aKeyMap.find(nBookmark);
m_aKeyIter->second.second.first = 2;
m_aKeyIter->second.second.second = xRow;
-
copyRowValue(_rInsertRow,m_aKeyIter->second.first,nBookmark);
+ tryRefetch(_rInsertRow,bRefetch);
}
}
// -------------------------------------------------------------------------
@@ -806,12 +703,17 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin();
SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end();
sal_Int32 j = 1;
+ bool bRefetch = true;
sal_Bool bModified = sal_False;
for(;aIter != aEnd;++aIter,++j)
{
if((_rInsertRow->get())[aIter->second.nPosition].isModified())
{
- aSql.append(::dbtools::quoteName( aQuote,aIter->first));
+ if ( bRefetch )
+ {
+ bRefetch = ::std::find(m_aFilterColumns.begin(),m_aFilterColumns.end(),aIter->second.sRealName) == m_aFilterColumns.end();
+ }
+ aSql.append(::dbtools::quoteName( aQuote,aIter->second.sRealName));
aSql.append(aComma);
aValues.append(aPara);
bModified = sal_True;
@@ -824,22 +726,33 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
aValues.setCharAt(aValues.getLength()-1,')');
aSql.append(aValues.makeStringAndClear());
// now create,fill and execute the prepared statement
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
+ ::rtl::OUString sEmpty;
+ executeInsert(_rInsertRow,aSql.makeStringAndClear(),sEmpty,bRefetch);
+}
+// -------------------------------------------------------------------------
+void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName,bool bRefetch )
+{
+ // now create,fill and execute the prepared statement
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(i_sSQL));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
- aIter = m_pColumnNames->begin();
+ SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin();
+ SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end();
for(sal_Int32 i = 1;aIter != aEnd;++aIter)
{
- const sal_Int32 nPos = aIter->second.nPosition;
- if((_rInsertRow->get())[nPos].isModified())
+ if ( !i_sTableName.getLength() || aIter->second.sTableName == i_sTableName )
{
- if((_rInsertRow->get())[nPos].isNull())
- xParameter->setNull(i++,(_rInsertRow->get())[nPos].getTypeKind());
- else
+ const sal_Int32 nPos = aIter->second.nPosition;
+ if((_rInsertRow->get())[nPos].isModified())
{
- impl_convertValue_throw(_rInsertRow,aIter->second);
- (_rInsertRow->get())[nPos].setSigned(m_aSignedFlags[nPos-1]);
- setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aIter->second.nType,aIter->second.nScale);
+ if((_rInsertRow->get())[nPos].isNull())
+ xParameter->setNull(i++,(_rInsertRow->get())[nPos].getTypeKind());
+ else
+ {
+ impl_convertValue_throw(_rInsertRow,aIter->second);
+ (_rInsertRow->get())[nPos].setSigned(m_aSignedFlags[nPos-1]);
+ setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aIter->second.nType,aIter->second.nScale);
+ }
}
}
}
@@ -890,7 +803,7 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
::comphelper::disposeComponent(xPrep);
- if ( !bAutoValuesFetched && m_bInserted )
+ if ( !i_sTableName.getLength() && !bAutoValuesFetched && m_bInserted )
{
// first check if all key column values were set
const ::rtl::OUString sMax(RTL_CONSTASCII_USTRINGPARAM(" MAX("));
@@ -947,13 +860,67 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
{
OKeySetMatrix::iterator aKeyIter = m_aKeyMap.end();
--aKeyIter;
- ORowSetRow aKeyRow = new connectivity::ORowVector< ORowSetValue >((*m_pKeyColumnNames).size());
+ ORowSetRow aKeyRow = new connectivity::ORowVector< ORowSetValue >(m_pKeyColumnNames->size());
copyRowValue(_rInsertRow,aKeyRow,aKeyIter->first + 1);
-
m_aKeyIter = m_aKeyMap.insert(OKeySetMatrix::value_type(aKeyIter->first + 1,OKeySetValue(aKeyRow,::std::pair<sal_Int32,Reference<XRow> >(1,NULL)))).first;
// now we set the bookmark for this row
(_rInsertRow->get())[0] = makeAny((sal_Int32)m_aKeyIter->first);
+ tryRefetch(_rInsertRow,bRefetch);
+ }
+}
+void OKeySet::tryRefetch(const ORowSetRow& _rInsertRow,bool bRefetch)
+{
+ if ( bRefetch )
+ {
+ // we just areassign the base members
+ try
+ {
+ Reference< XParameters > xParameter(m_xStatement,UNO_QUERY);
+ OSL_ENSURE(xParameter.is(),"No Parameter interface!");
+ xParameter->clearParameters();
+
+ sal_Int32 nPos=1;
+ connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaIter;
+ connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaEnd;
+ OUpdatedParameter::iterator aUpdateFind = m_aUpdatedParameter.find(m_aKeyIter->first);
+ if ( aUpdateFind == m_aUpdatedParameter.end() )
+ {
+ aParaIter = m_aParameterValueForCache.get().begin();
+ aParaEnd = m_aParameterValueForCache.get().end();
+ }
+ else
+ {
+ aParaIter = aUpdateFind->second.get().begin();
+ aParaEnd = aUpdateFind->second.get().end();
+ }
+
+ for(++aParaIter;aParaIter != aParaEnd;++aParaIter,++nPos)
+ {
+ ::dbtools::setObjectWithInfo( xParameter, nPos, aParaIter->makeAny(), aParaIter->getTypeKind() );
+ }
+ connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aIter2 = m_aKeyIter->second.first->get().begin();
+ SelectColumnsMetaData::const_iterator aPosIter = (*m_pKeyColumnNames).begin();
+ SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end();
+ for(;aPosIter != aPosEnd;++aPosIter,++aIter2,++nPos)
+ setParameter(nPos,xParameter,*aIter2,aPosIter->second.nType,aPosIter->second.nScale);
+ aPosIter = (*m_pForeignColumnNames).begin();
+ aPosEnd = (*m_pForeignColumnNames).end();
+ for(;aPosIter != aPosEnd;++aPosIter,++aIter2,++nPos)
+ setParameter(nPos,xParameter,*aIter2,aPosIter->second.nType,aPosIter->second.nScale);
+
+ m_xSet = m_xStatement->executeQuery();
+ OSL_ENSURE(m_xSet.is(),"No resultset form statement!");
+ bRefetch = m_xSet->next();
+ }
+ catch(Exception)
+ {
+ bRefetch = false;
+ }
+ }
+ if ( !bRefetch )
+ {
+ m_aKeyIter->second.second.second = new OPrivateRow(_rInsertRow->get());
}
}
// -----------------------------------------------------------------------------
@@ -992,6 +959,7 @@ void OKeySet::copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow,sa
for(;aPosIter != aPosEnd;++aPosIter,++aIter)
{
*aIter = (_rInsertRow->get())[aPosIter->second.nPosition];
+ impl_convertValue_throw(_rKeyRow,aPosIter->second);
aIter->setTypeKind(aPosIter->second.nType);
}
}
@@ -1033,7 +1001,7 @@ void SAL_CALL OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivit
{
if ( m_pKeyColumnNames->find(aIter->first) != m_pKeyColumnNames->end() )
{
- aSql.append(::dbtools::quoteName( aQuote,aIter->first));
+ aSql.append(::dbtools::quoteName( aQuote,aIter->second.sRealName));
if((_rDeleteRow->get())[aIter->second.nPosition].isNull())
{
OSL_ENSURE(0,"can a primary key be null");
@@ -1051,7 +1019,7 @@ void SAL_CALL OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivit
{
if((*aIndexIter)->hasByName(aIter->first))
{
- sIndexCondition.append(::dbtools::quoteName( aQuote,aIter->first));
+ sIndexCondition.append(::dbtools::quoteName( aQuote,aIter->second.sRealName));
if((_rDeleteRow->get())[aIter->second.nPosition].isNull())
sIndexCondition.append(::rtl::OUString::createFromAscii(" IS NULL"));
else
@@ -1215,8 +1183,8 @@ void SAL_CALL OKeySet::beforeFirst( ) throw(SQLException, RuntimeException)
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::beforeFirst" );
m_bInserted = m_bUpdated = m_bDeleted = sal_False;
m_aKeyIter = m_aKeyMap.begin();
- m_xSet = NULL;
- ::comphelper::disposeComponent(m_xRow);
+ m_xRow = NULL;
+ ::comphelper::disposeComponent(m_xSet);
}
// -----------------------------------------------------------------------------
void SAL_CALL OKeySet::afterLast( ) throw(SQLException, RuntimeException)
@@ -1225,8 +1193,8 @@ void SAL_CALL OKeySet::afterLast( ) throw(SQLException, RuntimeException)
m_bInserted = m_bUpdated = m_bDeleted = sal_False;
fillAllRows();
m_aKeyIter = m_aKeyMap.end();
- m_xSet = NULL;
- ::comphelper::disposeComponent(m_xRow);
+ m_xRow = NULL;
+ ::comphelper::disposeComponent(m_xSet);
}
// -----------------------------------------------------------------------------
sal_Bool SAL_CALL OKeySet::first( ) throw(SQLException, RuntimeException)
@@ -1330,8 +1298,14 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException)
if(isBeforeFirst() || isAfterLast() || !m_xStatement.is())
return;
- m_xSet = NULL;
- ::comphelper::disposeComponent(m_xRow);
+ m_xRow = NULL;
+ ::comphelper::disposeComponent(m_xSet);
+
+ if ( m_aKeyIter->second.second.second.is() )
+ {
+ m_xRow = m_aKeyIter->second.second.second;
+ return;
+ }
// we just areassign the base members
Reference< XParameters > xParameter(m_xStatement,UNO_QUERY);
OSL_ENSURE(xParameter.is(),"No Parameter interface!");
@@ -1343,7 +1317,6 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException)
OUpdatedParameter::iterator aUpdateFind = m_aUpdatedParameter.find(m_aKeyIter->first);
if ( aUpdateFind == m_aUpdatedParameter.end() )
{
-
aParaIter = m_aParameterValueForCache.get().begin();
aParaEnd = m_aParameterValueForCache.get().end();
}
@@ -1357,6 +1330,8 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException)
{
::dbtools::setObjectWithInfo( xParameter, nPos, aParaIter->makeAny(), aParaIter->getTypeKind() );
}
+
+ // now set the primary key column values
connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aIter = m_aKeyIter->second.first->get().begin();
SelectColumnsMetaData::const_iterator aPosIter = (*m_pKeyColumnNames).begin();
SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end();
diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx
index bf4b2e6dd786..694593e6c608 100644
--- a/dbaccess/source/core/api/KeySet.hxx
+++ b/dbaccess/source/core/api/KeySet.hxx
@@ -35,14 +35,14 @@
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
#include <cppuhelper/implbase1.hxx>
#endif
+#include <memory>
#include <map>
#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
#include <com/sun/star/lang/XUnoTunnel.hpp>
#endif
-#ifndef _COM_SUN_STAR_SDB_XSINGLESELECTQUERYANALYZER_HPP_
#include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp>
-#endif
+#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
#ifndef _COMPHELPER_STLTYPES_HXX_
#include <comphelper/stl_types.hxx>
#endif
@@ -93,6 +93,7 @@ namespace dbaccess
// is used when the source supports keys
class OKeySet : public OCacheSet
{
+ protected:
OKeySetMatrix m_aKeyMap;
OKeySetMatrix::iterator m_aKeyIter;
@@ -100,10 +101,10 @@ namespace dbaccess
OUpdatedParameter m_aUpdatedParameter; // contains all parameter which have been updated and are needed for refetching
ORowSetValueVector m_aParameterValueForCache;
- SelectColumnsMetaData* m_pKeyColumnNames; // contains all key column names
- SelectColumnsMetaData* m_pColumnNames; // contains all column names
- SelectColumnsMetaData* m_pParameterNames; // contains all parameter names
- SelectColumnsMetaData* m_pForeignColumnNames; // contains all column names of the rest
+ ::std::auto_ptr<SelectColumnsMetaData> m_pKeyColumnNames; // contains all key column names
+ ::std::auto_ptr<SelectColumnsMetaData> m_pColumnNames; // contains all column names
+ ::std::auto_ptr<SelectColumnsMetaData> m_pParameterNames; // contains all parameter names
+ ::std::auto_ptr<SelectColumnsMetaData> m_pForeignColumnNames; // contains all column names of the rest
connectivity::OSQLTable m_xTable; // reference to our table
::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> m_xTableKeys;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement> m_xStatement;
@@ -141,7 +142,16 @@ namespace dbaccess
sal_Bool fetchRow();
void impl_convertValue_throw(const ORowSetRow& _rInsertRow,const SelectColumnDescription& i_aMetaData);
- protected:
+ void initColumns();
+ void findTableColumnsMatching_throw( const ::com::sun::star::uno::Any& i_aTable
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& i_xMeta
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& i_xQueryColumns);
+ ::rtl::OUStringBuffer createKeyFilter();
+ void tryRefetch(const ORowSetRow& _rInsertRow,bool bRefetch);
+ void executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName,const ::std::vector<sal_Int32>& _aIndexColumnPositions = ::std::vector<sal_Int32>());
+ void executeInsert( const ORowSetRow& _rInsertRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName = ::rtl::OUString(),bool bRefetch = false);
+ void executeStatement(::rtl::OUStringBuffer& io_aFilter,const ::rtl::OUString& i_sRowSetFilter,::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer>& io_xAnalyzer);
+
virtual ~OKeySet();
public:
OKeySet(const connectivity::OSQLTable& _xTable,
diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx
index 09a763d08c71..2a9ac96ce82b 100644
--- a/dbaccess/source/core/api/OptimisticSet.cxx
+++ b/dbaccess/source/core/api/OptimisticSet.cxx
@@ -84,23 +84,6 @@ using namespace ::osl;
DECLARE_STL_USTRINGACCESS_MAP(::rtl::OUStringBuffer,TSQLStatements);
namespace
{
- void lcl_fillIndexColumns(const Reference<XIndexAccess>& _xIndexes, ::std::vector< Reference<XNameAccess> >& _rAllIndexColumns)
- {
- if ( _xIndexes.is() )
- {
- Reference<XPropertySet> xIndexColsSup;
- sal_Int32 nCount = _xIndexes->getCount();
- for(sal_Int32 j = 0 ; j < nCount ; ++j)
- {
- xIndexColsSup.set(_xIndexes->getByIndex(j),UNO_QUERY);
- if( xIndexColsSup.is()
- && comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISUNIQUE))
- && !comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISPRIMARYKEYINDEX))
- )
- _rAllIndexColumns.push_back(Reference<XColumnsSupplier>(xIndexColsSup,UNO_QUERY)->getColumns());
- }
- }
- }
void lcl_fillKeyCondition(const ::rtl::OUString& i_sTableName,const ::rtl::OUString& i_sQuotedColumnName,const ORowSetValue& i_aValue,TSQLStatements& io_aKeyConditions)
{
::rtl::OUStringBuffer& rKeyCondition = io_aKeyConditions[i_sTableName];
@@ -120,14 +103,9 @@ OptimisticSet::OptimisticSet(const ::comphelper::ComponentContext& _rContext,
const Reference< XConnection>& i_xConnection,
const Reference< XSingleSelectQueryAnalyzer >& _xComposer,
const ORowSetValueVector& _aParameterValueForCache)
- :m_aSqlParser( _rContext.getLegacyServiceFactory() )
+ :OKeySet(NULL,NULL,::rtl::OUString(),_xComposer,_aParameterValueForCache)
+ ,m_aSqlParser( _rContext.getLegacyServiceFactory() )
,m_aSqlIterator( i_xConnection, Reference<XTablesSupplier>(_xComposer,UNO_QUERY)->getTables(), m_aSqlParser, NULL )
- ,m_aParameterValueForCache(_aParameterValueForCache)
- ,m_pKeyColumnNames(NULL)
- ,m_pColumnNames(NULL)
- ,m_pParameterNames(NULL)
- ,m_xComposer(_xComposer)
- ,m_bRowCountFinal(sal_False)
,m_bResultSetChanged(false)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::OptimisticSet" );
@@ -136,20 +114,6 @@ OptimisticSet::OptimisticSet(const ::comphelper::ComponentContext& _rContext,
// -----------------------------------------------------------------------------
OptimisticSet::~OptimisticSet()
{
- try
- {
- ::comphelper::disposeComponent(m_xStatement);
- }
- catch(Exception&)
- {
- m_xStatement.clear();
- }
- catch(...)
- {
- OSL_ENSURE(0,"Unknown Exception occured");
- }
- m_xComposer.clear();
-
DBG_DTOR(OptimisticSet,NULL);
}
// -----------------------------------------------------------------------------
@@ -157,14 +121,9 @@ void OptimisticSet::construct(const Reference< XResultSet>& _xDriverSet,const ::
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::construct" );
OCacheSet::construct(_xDriverSet,i_sRowSetFilter);
+ initColumns();
Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
- bool bCase = (xMeta.is() && xMeta->storesMixedCaseQuotedIdentifiers()) ? true : false;
-
- m_pKeyColumnNames.reset( new SelectColumnsMetaData(bCase) );
- m_pColumnNames.reset( new SelectColumnsMetaData(bCase) );
- m_pParameterNames.reset( new SelectColumnsMetaData(bCase) );
-
Reference<XColumnsSupplier> xQueryColSup(m_xComposer,UNO_QUERY);
const Reference<XNameAccess> xQueryColumns = xQueryColSup->getColumns();
const Reference<XTablesSupplier> xTabSup(m_xComposer,UNO_QUERY);
@@ -182,29 +141,13 @@ void OptimisticSet::construct(const Reference< XResultSet>& _xDriverSet,const ::
m_aKeyMap.insert(OKeySetMatrix::value_type(0,OKeySetValue(NULL,::std::pair<sal_Int32,Reference<XRow> >(0,NULL))));
m_aKeyIter = m_aKeyMap.begin();
- static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND ");
- const ::rtl::OUString aQuote = getIdentifierQuoteString();
- ::rtl::OUStringBuffer aFilter;
- static ::rtl::OUString s_sDot(RTL_CONSTASCII_USTRINGPARAM("."));
- static ::rtl::OUString s_sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?"));
- // create the where clause
- SelectColumnsMetaData::iterator aPosEnd = m_pKeyColumnNames->end();
- for(SelectColumnsMetaData::iterator aPosIter = m_pKeyColumnNames->begin();aPosIter != aPosEnd;)
- {
- aFilter.append(::dbtools::quoteName( aQuote,aPosIter->second.sTableName));
- aFilter.append(s_sDot);
- aFilter.append(::dbtools::quoteName( aQuote,aPosIter->second.sRealName));
- aFilter.append(s_sParam);
- ++aPosIter;
- if(aPosIter != aPosEnd)
- aFilter.append(aAnd);
- }
+ ::rtl::OUStringBuffer aFilter = createKeyFilter();
+ Reference< XSingleSelectQueryComposer> xSourceComposer(m_xComposer,UNO_QUERY);
Reference< XMultiServiceFactory > xFactory(m_xConnection, UNO_QUERY_THROW);
Reference<XSingleSelectQueryComposer> xAnalyzer(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY);
- Reference<XSingleSelectQueryComposer> xComp2(m_xComposer,UNO_QUERY_THROW);
- ::rtl::OUString sQuery = xComp2->getQuery();
- xAnalyzer->setQuery(sQuery);
+ ::rtl::OUString sQuery = xSourceComposer->getQuery();
+ xAnalyzer->setElementaryQuery(xSourceComposer->getElementaryQuery());
// check for joins
::rtl::OUString aErrorMsg;
::std::auto_ptr<OSQLParseNode> pStatementNode( m_aSqlParser.parseTree( aErrorMsg, sQuery ) );
@@ -227,58 +170,6 @@ void OptimisticSet::construct(const Reference< XResultSet>& _xDriverSet,const ::
::comphelper::disposeComponent(xAnalyzer);
}
// -------------------------------------------------------------------------
-Any SAL_CALL OptimisticSet::getBookmark() throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getBookmark" );
- OSL_ENSURE(m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin(),
- "getBookmark is only possible when we stand on a valid row!");
- return makeAny(m_aKeyIter->first);
-}
-
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::moveToBookmark" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
- m_aKeyIter = m_aKeyMap.find(::comphelper::getINT32(bookmark));
- return m_aKeyIter != m_aKeyMap.end();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::moveRelativeToBookmark" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
- m_aKeyIter = m_aKeyMap.find(::comphelper::getINT32(bookmark));
- if(m_aKeyIter != m_aKeyMap.end())
- {
- relative(rows);
- }
-
- return !isBeforeFirst() && !isAfterLast();
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OptimisticSet::compareBookmarks( const Any& _first, const Any& _second ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::compareBookmarks" );
- sal_Int32 nFirst = 0, nSecond = 0;
- _first >>= nFirst;
- _second >>= nSecond;
-
- return (nFirst != nSecond) ? CompareBookmark::NOT_EQUAL : CompareBookmark::EQUAL;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::hasOrderedBookmarks( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::hasOrderedBookmarks" );
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OptimisticSet::hashBookmark( const Any& bookmark ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::hashBookmark" );
- return ::comphelper::getINT32(bookmark);
-}
-// -------------------------------------------------------------------------
// ::com::sun::star::sdbcx::XDeleteRows
Sequence< sal_Int32 > SAL_CALL OptimisticSet::deleteRows( const Sequence< Any >& /*rows*/ ,const connectivity::OSQLTable& /*_xTable*/) throw(SQLException, RuntimeException)
{
@@ -485,202 +376,6 @@ void SAL_CALL OptimisticSet::insertRow( const ORowSetRow& _rInsertRow,const conn
}
}
// -------------------------------------------------------------------------
-void OptimisticSet::executeInsert( const ORowSetRow& _rInsertRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName )
-{
- // now create,fill and execute the prepared statement
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(i_sSQL));
- Reference< XParameters > xParameter(xPrep,UNO_QUERY);
-
- SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin();
- SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end();
- for(sal_Int32 i = 1;aIter != aEnd;++aIter)
- {
- if ( aIter->second.sTableName == i_sTableName )
- {
- const sal_Int32 nPos = aIter->second.nPosition;
- if((_rInsertRow->get())[nPos].isModified())
- {
- if((_rInsertRow->get())[nPos].isNull())
- xParameter->setNull(i++,(_rInsertRow->get())[nPos].getTypeKind());
- else
- {
- impl_convertValue_throw(_rInsertRow,aIter->second);
- (_rInsertRow->get())[nPos].setSigned(m_aSignedFlags[nPos-1]);
- setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aIter->second.nType,aIter->second.nScale);
- }
- }
- }
- }
-
- m_bInserted = xPrep->executeUpdate() > 0;
- sal_Bool bAutoValuesFetched = sal_False;
- if ( m_bInserted )
- {
- // first insert the default values into the insertrow
- aIter = m_pColumnNames->begin();
- for(;aIter != aEnd;++aIter)
- {
- if ( !(_rInsertRow->get())[aIter->second.nPosition].isModified() )
- (_rInsertRow->get())[aIter->second.nPosition] = aIter->second.sDefaultValue;
- }
- try
- {
- Reference< XGeneratedResultSet > xGRes(xPrep, UNO_QUERY);
- if ( xGRes.is() )
- {
- Reference< XResultSet > xRes = xGRes->getGeneratedValues();
- Reference< XRow > xRow(xRes,UNO_QUERY);
- if ( xRow.is() && xRes->next() )
- {
- Reference< XResultSetMetaDataSupplier > xMdSup(xRes,UNO_QUERY);
- Reference< XResultSetMetaData > xMd = xMdSup->getMetaData();
- sal_Int32 nColumnCount = xMd->getColumnCount();
- ::std::vector< ::rtl::OUString >::iterator aAutoIter = m_aAutoColumns.begin();
- ::std::vector< ::rtl::OUString >::iterator aAutoEnd = m_aAutoColumns.end();
- for (sal_Int32 i = 1;aAutoIter != aAutoEnd && i <= nColumnCount; ++aAutoIter,++i)
- {
-#if OSL_DEBUG_LEVEL > 1
- ::rtl::OUString sColumnName( xMd->getColumnName(i) );
-#endif
- SelectColumnsMetaData::iterator aFind = m_pKeyColumnNames->find(*aAutoIter);
- if ( aFind != m_pKeyColumnNames->end() )
- (_rInsertRow->get())[aFind->second.nPosition].fill(i,aFind->second.nType,aFind->second.bNullable,xRow);
- }
- bAutoValuesFetched = sal_True;
- }
- }
- }
- catch(Exception&)
- {
- OSL_ENSURE(0,"Could not execute GeneratedKeys() stmt");
- }
- }
-
- ::comphelper::disposeComponent(xPrep);
-/*
- if ( !bAutoValuesFetched && m_bInserted )
- {
- // first check if all key column values were set
- const ::rtl::OUString sMax(RTL_CONSTASCII_USTRINGPARAM(" MAX("));
- const ::rtl::OUString sMaxEnd(RTL_CONSTASCII_USTRINGPARAM("),"));
- const ::rtl::OUString sQuote = getIdentifierQuoteString();
- ::rtl::OUString sMaxStmt;
- aEnd = m_pKeyColumnNames->end();
- ::std::vector< ::rtl::OUString >::iterator aAutoIter = m_aAutoColumns.begin();
- ::std::vector< ::rtl::OUString >::iterator aAutoEnd = m_aAutoColumns.end();
- for (;aAutoIter != aAutoEnd; ++aAutoIter)
- {
- // we will only fetch values which are keycolumns
- if ( m_pKeyColumnNames->find(*aAutoIter) != aEnd )
- {
- sMaxStmt += sMax;
- sMaxStmt += ::dbtools::quoteName( sQuote,*aAutoIter);
- sMaxStmt += sMaxEnd;
- }
- }
-
- if(sMaxStmt.getLength())
- {
- sMaxStmt = sMaxStmt.replaceAt(sMaxStmt.getLength()-1,1,::rtl::OUString::createFromAscii(" "));
- ::rtl::OUString sStmt = ::rtl::OUString::createFromAscii("SELECT ");
- sStmt += sMaxStmt;
- sStmt += ::rtl::OUString::createFromAscii("FROM ");
- sStmt += m_aSelectComposedTableName;
- try
- {
- // now fetch the autoincrement values
- Reference<XStatement> xStatement = m_xConnection->createStatement();
- Reference<XResultSet> xRes = xStatement->executeQuery(sStmt);
- Reference<XRow> xRow(xRes,UNO_QUERY);
- if(xRow.is() && xRes->next())
- {
- aAutoIter = m_aAutoColumns.begin();
- for (sal_Int32 i=1;aAutoIter != aAutoEnd; ++aAutoIter,++i)
- {
- // we will only fetch values which are keycolumns
- SelectColumnsMetaData::iterator aFind = m_pKeyColumnNames->find(*aAutoIter);
- if ( aFind != aEnd )
- (_rInsertRow->get())[aFind->second.nPosition].fill(i,aFind->second.nType,aFind->second.bNullable,xRow);
- }
- }
- ::comphelper::disposeComponent(xStatement);
- }
- catch(SQLException&)
- {
- OSL_ENSURE(0,"Could not fetch with MAX() ");
- }
- }
- }
- */
- if ( m_bInserted )
- {
- OKeySetMatrix::iterator aKeyIter = m_aKeyMap.end();
- --aKeyIter;
- ORowSetRow aKeyRow = new connectivity::ORowVector< ORowSetValue >(m_pKeyColumnNames->size());
- copyRowValue(_rInsertRow,aKeyRow,aKeyIter->first + 1);
-
- m_aKeyIter = m_aKeyMap.insert(OKeySetMatrix::value_type(aKeyIter->first + 1,OKeySetValue(aKeyRow,::std::pair<sal_Int32,Reference<XRow> >(1,NULL)))).first;
- // now we set the bookmark for this row
- (_rInsertRow->get())[0] = makeAny((sal_Int32)m_aKeyIter->first);
- }
-}
-// -----------------------------------------------------------------------------
-void OptimisticSet::copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow,sal_Int32 i_nBookmark)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::copyRowValue" );
- connectivity::ORowVector< ORowSetValue >::Vector::iterator aIter = _rKeyRow->get().begin();
-
- // check the if the parameter values have been changed
- OSL_ENSURE((m_aParameterValueForCache.get().size()-1) == m_pParameterNames->size(),"OptimisticSet::copyRowValue: Parameter values and names differ!");
- connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaValuesIter = m_aParameterValueForCache.get().begin() +1;
-
- bool bChanged = false;
- SelectColumnsMetaData::const_iterator aParaIter = (*m_pParameterNames).begin();
- SelectColumnsMetaData::const_iterator aParaEnd = (*m_pParameterNames).end();
- for(sal_Int32 i = 1;aParaIter != aParaEnd;++aParaIter,++aParaValuesIter,++i)
- {
- ORowSetValue aValue(*aParaValuesIter);
- aValue.setSigned(m_aSignedFlags[aParaIter->second.nPosition]);
- if ( (_rInsertRow->get())[aParaIter->second.nPosition] != aValue )
- {
- ORowSetValueVector aCopy(m_aParameterValueForCache);
- (aCopy.get())[i] = (_rInsertRow->get())[aParaIter->second.nPosition];
- m_aUpdatedParameter[i_nBookmark] = aCopy;
- bChanged = true;
- }
- }
- if ( !bChanged )
- {
- m_aUpdatedParameter.erase(i_nBookmark);
- }
-
- // update the key values
- SelectColumnsMetaData::const_iterator aPosIter = m_pKeyColumnNames->begin();
- SelectColumnsMetaData::const_iterator aPosEnd = m_pKeyColumnNames->end();
- for(;aPosIter != aPosEnd;++aPosIter,++aIter)
- {
- ORowSetValue aValue((_rInsertRow->get())[aPosIter->second.nPosition]);
- switch(aPosIter->second.nType)
- {
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- {
- ::rtl::OUString sValue = aValue.getString();
- sal_Int32 nIndex = sValue.indexOf('.');
- if ( nIndex != -1 )
- {
- aValue = sValue.copy(0,nIndex + (aPosIter->second.nScale > 0 ? aPosIter->second.nScale + 1 : 0));
- }
- }
- break;
- default:
- break;
- }
- *aIter = aValue;
- aIter->setTypeKind(aPosIter->second.nType);
- }
-}
-// -------------------------------------------------------------------------
void SAL_CALL OptimisticSet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException)
{
::rtl::OUString sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?"));
@@ -754,432 +449,6 @@ void OptimisticSet::executeDelete(const ORowSetRow& _rDeleteRow,const ::rtl::OUS
m_bDeleted = sal_True;
}
}
-// -------------------------------------------------------------------------
-void SAL_CALL OptimisticSet::cancelRowUpdates( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::cancelRowUpdates" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OptimisticSet::moveToInsertRow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::moveToInsertRow" );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OptimisticSet::moveToCurrentRow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::moveToCurrentRow" );
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::next( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::next" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
-
- if(isAfterLast())
- return sal_False;
- if(!m_bRowCountFinal) // not yet all records fetched
- {
- ++m_aKeyIter; // this is possible because we stand on begin() and this is the "beforefirst" row
- if(m_aKeyIter == m_aKeyMap.end() && !fetchRow())
- m_aKeyIter = m_aKeyMap.end();
- }
- else if(!isAfterLast())
- ++m_aKeyIter;
-
- refreshRow();
- return !isAfterLast();
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::isBeforeFirst( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::isBeforeFirst" );
- return m_aKeyIter == m_aKeyMap.begin();
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::isAfterLast( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::isAfterLast" );
- return m_bRowCountFinal && m_aKeyIter == m_aKeyMap.end();
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::isFirst( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::isFirst" );
- OKeySetMatrix::iterator aTemp = m_aKeyMap.begin();
- ++aTemp;
- return m_aKeyIter == aTemp && m_aKeyIter != m_aKeyMap.end();
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::isLast( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::isLast" );
- if(!m_bRowCountFinal)
- return sal_False;
-
- OKeySetMatrix::iterator aTemp = m_aKeyMap.end();
- --aTemp;
- return m_aKeyIter == aTemp;
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OptimisticSet::beforeFirst( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::beforeFirst" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
- m_aKeyIter = m_aKeyMap.begin();
- m_xSet = NULL;
- ::comphelper::disposeComponent(m_xRow);
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OptimisticSet::afterLast( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::afterLast" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
- fillAllRows();
- m_aKeyIter = m_aKeyMap.end();
- m_xSet = NULL;
- ::comphelper::disposeComponent(m_xRow);
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::first( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::first" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
- m_aKeyIter = m_aKeyMap.begin();
- ++m_aKeyIter;
- if(m_aKeyIter == m_aKeyMap.end() && !fetchRow())
- m_aKeyIter = m_aKeyMap.end();
-
- refreshRow();
- return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin();
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::last( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::last" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
- fillAllRows();
-
- m_aKeyIter = m_aKeyMap.end();
- --m_aKeyIter;
- refreshRow();
- return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin();
-}
-// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL OptimisticSet::getRow( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getRow" );
- OSL_ENSURE(!isAfterLast(),"getRow is not allowed when afterlast record!");
- OSL_ENSURE(!isBeforeFirst(),"getRow is not allowed when beforefirst record!");
-
- return ::std::distance(m_aKeyMap.begin(),m_aKeyIter);
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::absolute" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
- OSL_ENSURE(row,"absolute(0) isn't allowed!");
- if(row < 0)
- {
- if(!m_bRowCountFinal)
- fillAllRows();
-
- for(;row < 0 && m_aKeyIter != m_aKeyMap.begin();++row)
- m_aKeyIter--;
- }
- else
- {
- if(row >= (sal_Int32)m_aKeyMap.size())
- {
- if(!m_bRowCountFinal)
- {
- sal_Bool bNext = sal_True;
- for(sal_Int32 i=m_aKeyMap.size()-1;i < row && bNext;++i)
- bNext = fetchRow();
- }
- else
- m_aKeyIter = m_aKeyMap.end();
- }
- else
- {
- m_aKeyIter = m_aKeyMap.begin();
- for(;row > 0 && m_aKeyIter != m_aKeyMap.end();--row)
- ++m_aKeyIter;
- }
- }
- refreshRow();
-
- return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin();
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::relative( sal_Int32 rows ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::relative" );
- if(!rows)
- {
- refreshRow();
- return sal_True;
- }
- return absolute(getRow()+rows);
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::previous( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::previous" );
- m_bInserted = m_bUpdated = m_bDeleted = sal_False;
- if(m_aKeyIter != m_aKeyMap.begin())
- {
- --m_aKeyIter;
- refreshRow();
- }
- return m_aKeyIter != m_aKeyMap.begin();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OptimisticSet::refreshRow() throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::refreshRow" );
- if(isBeforeFirst() || isAfterLast() || !m_xStatement.is())
- return;
-
- m_xSet.clear();
- ::comphelper::disposeComponent(m_xRow);
- // we just reassign the base members
- Reference< XParameters > xParameter(m_xStatement,UNO_QUERY);
- OSL_ENSURE(xParameter.is(),"No Parameter interface!");
- xParameter->clearParameters();
-
- sal_Int32 nPos=1;
- connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaIter;
- connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaEnd;
- OUpdatedParameter::iterator aUpdateFind = m_aUpdatedParameter.find(m_aKeyIter->first);
- if ( aUpdateFind == m_aUpdatedParameter.end() )
- {
- aParaIter = m_aParameterValueForCache.get().begin();
- aParaEnd = m_aParameterValueForCache.get().end();
- }
- else
- {
- aParaIter = aUpdateFind->second.get().begin();
- aParaEnd = aUpdateFind->second.get().end();
- }
-
- // first put the parameters set by the outer rowset
- for(++aParaIter;aParaIter != aParaEnd;++aParaIter,++nPos)
- {
- ::dbtools::setObjectWithInfo( xParameter, nPos, aParaIter->makeAny(), aParaIter->getTypeKind() );
- }
-
- // now set the primary key column values
- connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aIter = m_aKeyIter->second.first->get().begin();
- SelectColumnsMetaData::const_iterator aPosIter = m_pKeyColumnNames->begin();
- SelectColumnsMetaData::const_iterator aPosEnd = m_pKeyColumnNames->end();
- for(;aPosIter != aPosEnd;++aPosIter,++aIter,++nPos)
- setParameter(nPos,xParameter,*aIter,aPosIter->second.nType,aPosIter->second.nScale);
-
- m_xSet = m_xStatement->executeQuery();
- OSL_ENSURE(m_xSet.is(),"No resultset form statement!");
- sal_Bool bOK = m_xSet->next();
- if ( !bOK )
- m_aKeyIter = m_aKeyMap.end();
- m_xRow.set(m_xSet,UNO_QUERY);
- OSL_ENSURE(m_xRow.is(),"No row form statement!");
-}
-// -----------------------------------------------------------------------------
-sal_Bool OptimisticSet::fetchRow()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::fetchRow" );
- // fetch the next row and append on the OptimisticSet
- sal_Bool bRet = sal_False;
- if ( !m_bRowCountFinal )
- bRet = m_xDriverSet->next();
- if ( bRet )
- {
- ORowSetRow aKeyRow = new connectivity::ORowVector< ORowSetValue >(m_pKeyColumnNames->size());
- connectivity::ORowVector< ORowSetValue >::Vector::iterator aIter = aKeyRow->get().begin();
- // first fetch the values needed for the key column
- SelectColumnsMetaData::const_iterator aPosIter = m_pKeyColumnNames->begin();
- SelectColumnsMetaData::const_iterator aPosEnd = m_pKeyColumnNames->end();
- for(;aPosIter != aPosEnd;++aPosIter,++aIter)
- {
- const SelectColumnDescription& rColDesc = aPosIter->second;
- aIter->fill(rColDesc.nPosition,rColDesc.nType,rColDesc.bNullable,m_xDriverRow);
- }
- m_aKeyIter = m_aKeyMap.insert(OKeySetMatrix::value_type(m_aKeyMap.rbegin()->first+1,OKeySetValue(aKeyRow,::std::pair<sal_Int32,Reference<XRow> >(0,NULL)))).first;
- }
- else
- m_bRowCountFinal = sal_True;
- return bRet;
-}
-// -------------------------------------------------------------------------
-void OptimisticSet::fillAllRows()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::fillAllRows" );
- if(!m_bRowCountFinal)
- {
- while(fetchRow())
- ;
- }
-}
-// XRow
-sal_Bool SAL_CALL OptimisticSet::wasNull( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::wasNull" );
- return m_xRow->wasNull();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OptimisticSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getString" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getString(columnIndex);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getBoolean" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getBoolean(columnIndex);
-}
-// -------------------------------------------------------------------------
-sal_Int8 SAL_CALL OptimisticSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getByte" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getByte(columnIndex);
-}
-// -------------------------------------------------------------------------
-sal_Int16 SAL_CALL OptimisticSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getShort" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getShort(columnIndex);
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OptimisticSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getInt" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getInt(columnIndex);
-}
-// -------------------------------------------------------------------------
-sal_Int64 SAL_CALL OptimisticSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getLong" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getLong(columnIndex);
-}
-// -------------------------------------------------------------------------
-float SAL_CALL OptimisticSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getFloat" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getFloat(columnIndex);
-}
-// -------------------------------------------------------------------------
-double SAL_CALL OptimisticSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getDouble" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getDouble(columnIndex);
-}
-// -------------------------------------------------------------------------
-Sequence< sal_Int8 > SAL_CALL OptimisticSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getBytes" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getBytes(columnIndex);
-}
-// -------------------------------------------------------------------------
-::com::sun::star::util::Date SAL_CALL OptimisticSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getDate" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getDate(columnIndex);
-}
-// -------------------------------------------------------------------------
-::com::sun::star::util::Time SAL_CALL OptimisticSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getTime" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getTime(columnIndex);
-}
-// -------------------------------------------------------------------------
-::com::sun::star::util::DateTime SAL_CALL OptimisticSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getTimestamp" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getTimestamp(columnIndex);
-}
-// -------------------------------------------------------------------------
-Reference< ::com::sun::star::io::XInputStream > SAL_CALL OptimisticSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getBinaryStream" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getBinaryStream(columnIndex);
-}
-// -------------------------------------------------------------------------
-Reference< ::com::sun::star::io::XInputStream > SAL_CALL OptimisticSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getCharacterStream" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getCharacterStream(columnIndex);
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OptimisticSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getObject" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getObject(columnIndex,typeMap);
-}
-// -------------------------------------------------------------------------
-Reference< XRef > SAL_CALL OptimisticSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getRef" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getRef(columnIndex);
-}
-// -------------------------------------------------------------------------
-Reference< XBlob > SAL_CALL OptimisticSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getBlob" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getBlob(columnIndex);
-}
-// -------------------------------------------------------------------------
-Reference< XClob > SAL_CALL OptimisticSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getClob" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getClob(columnIndex);
-}
-// -------------------------------------------------------------------------
-Reference< XArray > SAL_CALL OptimisticSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::getArray" );
- OSL_ENSURE(m_xRow.is(),"m_xRow is null!");
- return m_xRow->getArray(columnIndex);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::rowUpdated( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::rowUpdated" );
- return m_aKeyIter != m_aKeyMap.begin() && m_aKeyIter != m_aKeyMap.end() && m_aKeyIter->second.second.first == 2;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::rowInserted( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::rowInserted" );
- return m_aKeyIter != m_aKeyMap.begin() && m_aKeyIter != m_aKeyMap.end() && m_aKeyIter->second.second.first == 1;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OptimisticSet::rowDeleted( ) throw(SQLException, RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OptimisticSet::rowDeleted" );
- sal_Bool bDeleted = m_bDeleted;
- m_bDeleted = sal_False;
- return bDeleted;
-}
// -----------------------------------------------------------------------------
::rtl::OUString OptimisticSet::getComposedTableName(const ::rtl::OUString& /*_sCatalog*/,
const ::rtl::OUString& /*_sSchema*/,
@@ -1215,201 +484,6 @@ sal_Bool SAL_CALL OptimisticSet::rowDeleted( ) throw(SQLException, RuntimeExcep
return aComposedName;
}
// -----------------------------------------------------------------------------
-/*
-namespace dbaccess
-{
- void getColumnPositions(const Reference<XNameAccess>& _rxQueryColumns,
- const Sequence< ::rtl::OUString>& _aColumnNames,
- const ::rtl::OUString& _rsUpdateTableName,
- SelectColumnsMetaData& _rColumnNames)
- {
- // get the real name of the columns
- Sequence< ::rtl::OUString> aSelNames(_rxQueryColumns->getElementNames());
- const ::rtl::OUString* pSelBegin = aSelNames.getConstArray();
- const ::rtl::OUString* pSelEnd = pSelBegin + aSelNames.getLength();
-
- const ::rtl::OUString* pColumnIter = _aColumnNames.getConstArray();
- const ::rtl::OUString* pColumnEnd = pColumnIter + _aColumnNames.getLength();
-
- ::comphelper::UStringMixLess aTmp(_rColumnNames.key_comp());
- ::comphelper::UStringMixEqual bCase(static_cast< ::comphelper::UStringMixLess*>(&aTmp)->isCaseSensitive());
-
- for(sal_Int32 nPos = 1;pSelBegin != pSelEnd;++pSelBegin,++nPos)
- {
- Reference<XPropertySet> xColumnProp(_rxQueryColumns->getByName(*pSelBegin),UNO_QUERY);
- ::rtl::OUString sRealName,sTableName;
- OSL_ENSURE(xColumnProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_REALNAME),"Property REALNAME not available!");
- OSL_ENSURE(xColumnProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_TABLENAME),"Property TABLENAME not available!");
- xColumnProp->getPropertyValue(PROPERTY_REALNAME) >>= sRealName;
- xColumnProp->getPropertyValue(PROPERTY_TABLENAME) >>= sTableName;
-
- for(;pColumnIter != pColumnEnd;++pColumnIter)
- {
- if(bCase(sRealName,*pColumnIter) && bCase(_rsUpdateTableName,sTableName) && _rColumnNames.find(*pColumnIter) == _rColumnNames.end())
- {
- sal_Int32 nType = 0;
- xColumnProp->getPropertyValue(PROPERTY_TYPE) >>= nType;
- sal_Int32 nScale = 0;
- xColumnProp->getPropertyValue(PROPERTY_SCALE) >>= nScale;
- ::rtl::OUString sColumnDefault;
- if ( xColumnProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_DEFAULTVALUE) )
- xColumnProp->getPropertyValue(PROPERTY_DEFAULTVALUE) >>= sColumnDefault;
-
- sal_Int32 bNullable = sal_False;
- xColumnProp->getPropertyValue(PROPERTY_ISNULLABLE) >>= bNullable;
-
-
- _rColumnNames[sRealName] = SelectColumnDescription( nPos, nType,nScale,bNullable != sdbc::ColumnValue::NO_NULLS, sColumnDefault );
- break;
- }
- }
- pColumnIter = _aColumnNames.getConstArray();
- }
- }
-}
-*/
-// -----------------------------------------------------------------------------
-void OptimisticSet::impl_convertValue_throw(const ORowSetRow& _rInsertRow,const SelectColumnDescription& i_aMetaData)
-{
- ORowSetValue& aValue((_rInsertRow->get())[i_aMetaData.nPosition]);
- switch(i_aMetaData.nType)
- {
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- {
- ::rtl::OUString sValue = aValue.getString();
- sal_Int32 nIndex = sValue.indexOf('.');
- if ( nIndex != -1 )
- {
- aValue = sValue.copy(0,nIndex + (i_aMetaData.nScale > 0 ? i_aMetaData.nScale + 1 : 0));
- }
- }
- break;
- default:
- break;
- }
-}
-// -----------------------------------------------------------------------------
-void OptimisticSet::findTableColumnsMatching_throw(const Any& i_aTable
- ,const Reference<XDatabaseMetaData>& i_xMeta
- ,const Reference<XNameAccess>& i_xQueryColumns)
-{
- ::rtl::OUString sCatalog,sSchema,sTable;
- Reference<XPropertySet> xTableProp(i_aTable,UNO_QUERY);
- Any aCatalog = xTableProp->getPropertyValue(PROPERTY_CATALOGNAME);
- aCatalog >>= sCatalog;
- xTableProp->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema;
- xTableProp->getPropertyValue(PROPERTY_NAME) >>= sTable;
-
- // first ask the database itself for the best columns which can be used
- ::std::vector< ::rtl::OUString> aBestRowColumnNames;
- /*
- Reference<XResultSet> xBestRes(i_xMeta->getBestRowIdentifier(aCatalog,sSchema,sTable,0,sal_False));
- Reference<XRow> xBestRow(xBestRes,uno::UNO_QUERY);
- while ( xBestRes->next() )
- {
- aBestRowColumnNames.push_back(xBestRow->getString(2));
- }
- */
- Sequence< ::rtl::OUString> aBestColumnNames;
- if ( aBestRowColumnNames.empty() )
- {
- Reference<XNameAccess> xKeyColumns = getPrimaryKeyColumns_throw(i_aTable);
- if ( xKeyColumns.is() )
- aBestColumnNames = xKeyColumns->getElementNames();
- }
- else
- aBestColumnNames = Sequence< ::rtl::OUString>(&aBestRowColumnNames[0],aBestRowColumnNames.size());
-
- const Reference<XColumnsSupplier> xTblColSup(i_aTable,UNO_QUERY_THROW);
- const Reference<XNameAccess> xTblColumns = xTblColSup->getColumns();
- const ::rtl::OUString sComposedUpdateTableName = dbtools::composeTableName( i_xMeta, sCatalog, sSchema, sTable, sal_False, ::dbtools::eInDataManipulation );
- ::dbaccess::getColumnPositions(i_xQueryColumns,aBestColumnNames,sComposedUpdateTableName,(*m_pKeyColumnNames),true);
- ::dbaccess::getColumnPositions(i_xQueryColumns,xTblColumns->getElementNames(),sComposedUpdateTableName,(*m_pColumnNames),true);
-
- // locate parameter in select columns
- Reference<XParametersSupplier> xParaSup(m_xComposer,UNO_QUERY);
- Reference<XIndexAccess> xQueryParameters = xParaSup->getParameters();
- const sal_Int32 nParaCount = xQueryParameters->getCount();
- Sequence< ::rtl::OUString> aParameterColumns(nParaCount);
- for(sal_Int32 i = 0; i< nParaCount;++i)
- {
- Reference<XPropertySet> xPara(xQueryParameters->getByIndex(i),UNO_QUERY_THROW);
- xPara->getPropertyValue(PROPERTY_REALNAME) >>= aParameterColumns[i];
- }
- ::dbaccess::getColumnPositions(i_xQueryColumns,aParameterColumns,sComposedUpdateTableName,(*m_pParameterNames),true);
-
- SelectColumnsMetaData::const_iterator aPosIter = m_pKeyColumnNames->begin();
- SelectColumnsMetaData::const_iterator aPosEnd = m_pKeyColumnNames->end();
- for(;aPosIter != aPosEnd;++aPosIter)
- {
- if ( xTblColumns->hasByName(aPosIter->second.sRealName) )
- {
- Reference<XPropertySet> xProp(xTblColumns->getByName(aPosIter->second.sRealName),UNO_QUERY);
- sal_Bool bAuto = sal_False;
- if( (xProp->getPropertyValue(PROPERTY_ISAUTOINCREMENT) >>= bAuto) && bAuto)
- m_aAutoColumns.push_back(aPosIter->first);
- }
- }
-}
-// -----------------------------------------------------------------------------
-void OptimisticSet::executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName)
-{
- // now create end execute the prepared statement
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(i_sSQL));
- Reference< XParameters > xParameter(xPrep,UNO_QUERY);
-
- sal_Int32 i = 1;
- // first the set values
- SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin();
- SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end();
- sal_uInt16 j = 0;
- for(;aIter != aEnd;++aIter,++j)
- {
- if ( aIter->second.sTableName == i_sTableName )
- {
- sal_Int32 nPos = aIter->second.nPosition;
- if((_rInsertRow->get())[nPos].isModified())
- {
- impl_convertValue_throw(_rInsertRow,aIter->second);
- (_rInsertRow->get())[nPos].setSigned((_rOrginalRow->get())[nPos].isSigned());
- setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aIter->second.nType,aIter->second.nScale);
- }
- }
- }
- // and then the values of the where condition
- aIter = m_pKeyColumnNames->begin();
- aEnd = m_pKeyColumnNames->end();
- j = 0;
- for(;aIter != aEnd;++aIter,++j)
- {
- if ( aIter->second.sTableName == i_sTableName )
- {
- setParameter(i++,xParameter,(_rOrginalRow->get())[aIter->second.nPosition],aIter->second.nType,aIter->second.nScale);
- }
- }
-/*
- // now we have to set the index values
- ::std::vector<sal_Int32>::iterator aIdxColIter = aIndexColumnPositions.begin();
- ::std::vector<sal_Int32>::iterator aIdxColEnd = aIndexColumnPositions.end();
- j = 0;
- aIter = m_pColumnNames->begin();
- for(;aIdxColIter != aIdxColEnd;++aIdxColIter,++i,++j,++aIter)
- {
- setParameter(i,xParameter,(_rOrginalRow->get())[*aIdxColIter],(_rOrginalRow->get())[*aIdxColIter].getTypeKind(),aIter->second.nScale);
- }
-*/
- const sal_Int32 nRowsUpdated = xPrep->executeUpdate();
- m_bUpdated = nRowsUpdated > 0;
- if(m_bUpdated)
- {
- const sal_Int32 nBookmark = ::comphelper::getINT32((_rInsertRow->get())[0].getAny());
- m_aKeyIter = m_aKeyMap.find(nBookmark);
- m_aKeyIter->second.second.first = 2;
- copyRowValue(_rInsertRow,m_aKeyIter->second.first,nBookmark);
- }
-}
-// -----------------------------------------------------------------------------
void OptimisticSet::fillJoinedColumns_throw(const ::std::vector< TNodePair >& i_aJoinColumns)
{
::std::vector< TNodePair >::const_iterator aIter = i_aJoinColumns.begin();
diff --git a/dbaccess/source/core/api/OptimisticSet.hxx b/dbaccess/source/core/api/OptimisticSet.hxx
index a3683aab0d12..ba0a04c8b773 100644
--- a/dbaccess/source/core/api/OptimisticSet.hxx
+++ b/dbaccess/source/core/api/OptimisticSet.hxx
@@ -31,11 +31,9 @@
#ifndef DBACCESS_CORE_API_OPTIMISTICSET_HXX
#define DBACCESS_CORE_API_OPTIMISTICSET_HXX
-#include "CacheSet.hxx"
#include "KeySet.hxx"
#include <cppuhelper/implbase1.hxx>
-#include <map>
-#include <memory>
+
#include <connectivity/sqlparse.hxx>
#include <connectivity/sqliterator.hxx>
@@ -47,29 +45,15 @@
namespace dbaccess
{
// is used when the source supports keys
- class OptimisticSet : public OCacheSet
+ class OptimisticSet : public OKeySet
{
::connectivity::OSQLParser m_aSqlParser;
::connectivity::OSQLParseTreeIterator m_aSqlIterator;
- OKeySetMatrix m_aKeyMap;
- OKeySetMatrix::iterator m_aKeyIter;
- ::std::vector< ::rtl::OUString > m_aAutoColumns; // contains all columns which are autoincrement ones
::std::map<sal_Int32,sal_Int32> m_aJoinedColumns;
::std::map<sal_Int32,sal_Int32> m_aJoinedKeyColumns;
- OUpdatedParameter m_aUpdatedParameter; // contains all parameter which have been updated and are needed for refetching
- ORowSetValueVector m_aParameterValueForCache;
- ::std::auto_ptr<SelectColumnsMetaData> m_pKeyColumnNames; // contains all key column names
- ::std::auto_ptr<SelectColumnsMetaData> m_pColumnNames; // contains all column names
- ::std::auto_ptr<SelectColumnsMetaData> m_pParameterNames; // contains all parameter names
- connectivity::OSQLTable m_xTable; // reference to our table
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement> m_xStatement;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> m_xSet;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow> m_xRow;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer > m_xComposer;
-
- sal_Bool m_bRowCountFinal;
+
mutable bool m_bResultSetChanged;
/**
@@ -84,23 +68,8 @@ namespace dbaccess
const ::rtl::OUString& _sSchema,
const ::rtl::OUString& _sTable);
- /** copies the values from the insert row into the key row
- *
- * \param _rInsertRow the row which was inserted
- * \param _rKeyRow The current key row of the row set.
- + \param i_nBookmark The bookmark is used to update the parameter
- */
- void copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow,sal_Int32 i_nBookmark);
-
- void fillAllRows();
- sal_Bool fetchRow();
-
void impl_convertValue_throw(const ORowSetRow& _rInsertRow,const SelectColumnDescription& i_aMetaData);
- void findTableColumnsMatching_throw( const ::com::sun::star::uno::Any& i_aTable
- ,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& i_xMeta
- ,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& i_xQueryColumns);
- void executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName);
- void executeInsert( const ORowSetRow& _rInsertRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName);
+
void executeDelete(const ORowSetRow& _rDeleteRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName);
void fillJoinedColumns_throw(const ::std::vector< ::connectivity::TNodePair>& i_aJoinColumns);
void fillJoinedColumns_throw(const ::rtl::OUString& i_sLeftColumn,const ::rtl::OUString& i_sRightColumn);
@@ -115,59 +84,6 @@ namespace dbaccess
// late ctor which can throw exceptions
virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter);
- // ::com::sun::star::sdbc::XRow
- virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
-
- virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // ::com::sun::star::sdbc::XResultSet
- virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // ::com::sun::star::sdbcx::XRowLocate
- virtual ::com::sun::star::uno::Any SAL_CALL getBookmark() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // -------------------------------------------------------------------------
- virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // -------------------------------------------------------------------------
- virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // -------------------------------------------------------------------------
- virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // -------------------------------------------------------------------------
- virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // -------------------------------------------------------------------------
- virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
// -------------------------------------------------------------------------
// ::com::sun::star::sdbcx::XDeleteRows
virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows ,const connectivity::OSQLTable& _xTable) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
@@ -175,9 +91,6 @@ namespace dbaccess
virtual void SAL_CALL updateRow(const ORowSetRow& _rInsertRow,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& _xTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL deleteRow(const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
// CacheSet
virtual bool isResultSetChanged() const;
diff --git a/dbaccess/source/core/api/makefile.mk b/dbaccess/source/core/api/makefile.mk
index 7af260080803..9a4dc9d8ec52 100644
--- a/dbaccess/source/core/api/makefile.mk
+++ b/dbaccess/source/core/api/makefile.mk
@@ -73,6 +73,7 @@ SLOFILES= \
$(SLO)$/View.obj \
$(SLO)$/WrappedResultSet.obj \
$(SLO)$/OptimisticSet.obj \
+ $(SLO)$/PrivateRow.obj \
$(SLO)$/columnsettings.obj
# --- Targets ----------------------------------