summaryrefslogtreecommitdiff
path: root/dbaccess/source/core/api/KeySet.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/core/api/KeySet.cxx')
-rw-r--r--dbaccess/source/core/api/KeySet.cxx264
1 files changed, 231 insertions, 33 deletions
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index f804c1c1cb34..04bef19278b1 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -148,6 +148,134 @@ 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)
// -------------------------------------------------------------------------
@@ -159,6 +287,7 @@ OKeySet::OKeySet(const connectivity::OSQLTable& _xTable,
:m_aParameterValueForCache(_aParameterValueForCache)
,m_pKeyColumnNames(NULL)
,m_pColumnNames(NULL)
+ ,m_pParameterNames(NULL)
,m_pForeignColumnNames(NULL)
,m_xTable(_xTable)
,m_xTableKeys(_xTableKeys)
@@ -188,25 +317,38 @@ OKeySet::~OKeySet()
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)
+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);
+ 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_pForeignColumnNames = new SelectColumnsMetaData(bCase);
+ 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];
+ }
+
::rtl::OUString sCatalog,sSchema,sTable;
@@ -235,6 +377,7 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
::dbaccess::getColumnPositions(xSup->getColumns(),aBestColumnNames,m_sUpdateTableName,(*m_pKeyColumnNames));
::dbaccess::getColumnPositions(xSup->getColumns(),xSourceColumns->getElementNames(),m_sUpdateTableName,(*m_pColumnNames));
+ ::dbaccess::getColumnPositions(xSup->getColumns(),aParameterColumns,m_sUpdateTableName,(*m_pParameterNames));
SelectColumnsMetaData::const_iterator aPosIter = (*m_pKeyColumnNames).begin();
SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end();
@@ -251,7 +394,7 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
// 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,0)));
+ m_aKeyMap.insert(OKeySetMatrix::value_type(0,OKeySetValue(NULL,::std::pair<sal_Int32,Reference<XRow> >(0,NULL))));
m_aKeyIter = m_aKeyMap.begin();
@@ -281,9 +424,10 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
aFilter.append(aAnd);
}
+ 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);
- xAnalyzer->setQuery(m_xComposer->getQuery());
+ xAnalyzer->setElementaryQuery(xSourceComposer->getElementaryQuery());
Reference<XTablesSupplier> xTabSup(xAnalyzer,uno::UNO_QUERY);
Reference<XNameAccess> xSelectTables(xTabSup->getTables(),uno::UNO_QUERY);
const Sequence< ::rtl::OUString> aSeq = xSelectTables->getElementNames();
@@ -320,11 +464,10 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
}
}
} // if ( aSeq.getLength() > 1 ) // special handling for join
- const ::rtl::OUString sOldFilter = xAnalyzer->getFilter();
- if ( sOldFilter.getLength() )
+ if ( i_sRowSetFilter.getLength() )
{
FilterCreator aFilterCreator;
- aFilterCreator.append( sOldFilter );
+ aFilterCreator.append( i_sRowSetFilter );
aFilterCreator.append( aFilter.makeStringAndClear() );
aFilter = aFilterCreator.getComposedAndClear();
}
@@ -587,13 +730,24 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
i = 1;
// first the set values
+ bool bRefetch = true;
aIter = m_pColumnNames->begin();
sal_uInt16 j = 0;
+ Reference<XRow> xRow;
for(;aIter != aEnd;++aIter,++j)
{
sal_Int32 nPos = aIter->second.nPosition;
if((_rInsertRow->get())[nPos].isModified())
{
+ if ( bRefetch )
+ {
+ bRefetch = ::std::find(m_aFilterColumns.begin(),m_aFilterColumns.end(),aIter->first) == m_aFilterColumns.end();
+ if ( !bRefetch )
+ {
+ xRow = new OPrivateRow(_rInsertRow->get());
+ }
+ }
+
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);
@@ -621,10 +775,11 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
m_bUpdated = xPrep->executeUpdate() > 0;
if(m_bUpdated)
{
- m_aKeyIter = m_aKeyMap.find(::comphelper::getINT32((_rInsertRow->get())[0].getAny()));
- OSL_ENSURE(m_aKeyIter != m_aKeyMap.end(),"New inserted row not found!");
- m_aKeyIter->second.second = 2;
- copyRowValue(_rInsertRow,m_aKeyIter->second.first);
+ 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);
}
}
// -------------------------------------------------------------------------
@@ -785,21 +940,47 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
}
if ( m_bInserted )
{
- ORowSetRow aKeyRow = new connectivity::ORowVector< ORowSetValue >((*m_pKeyColumnNames).size());
- copyRowValue(_rInsertRow,aKeyRow);
-
OKeySetMatrix::iterator aKeyIter = m_aKeyMap.end();
--aKeyIter;
- m_aKeyIter = m_aKeyMap.insert(OKeySetMatrix::value_type(aKeyIter->first + 1,OKeySetValue(aKeyRow,1))).first;
+ 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 OKeySet::copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow)
+void OKeySet::copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow,sal_Int32 i_nBookmark)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::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(),"OKeySet::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)
@@ -1149,9 +1330,23 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException)
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 = m_aParameterValueForCache.get().begin();
- connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaEnd = m_aParameterValueForCache.get().end();
+ 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() );
@@ -1202,7 +1397,7 @@ sal_Bool OKeySet::fetchRow()
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,0))).first;
+ 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;
@@ -1361,13 +1556,13 @@ Reference< XArray > SAL_CALL OKeySet::getArray( sal_Int32 columnIndex ) throw(SQ
sal_Bool SAL_CALL OKeySet::rowUpdated( ) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::rowUpdated" );
- return m_aKeyIter != m_aKeyMap.begin() && m_aKeyIter != m_aKeyMap.end() && m_aKeyIter->second.second == 2;
+ return m_aKeyIter != m_aKeyMap.begin() && m_aKeyIter != m_aKeyMap.end() && m_aKeyIter->second.second.first == 2;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OKeySet::rowInserted( ) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::rowInserted" );
- return m_aKeyIter != m_aKeyMap.begin() && m_aKeyIter != m_aKeyMap.end() && m_aKeyIter->second.second == 1;
+ return m_aKeyIter != m_aKeyMap.begin() && m_aKeyIter != m_aKeyMap.end() && m_aKeyIter->second.second.first == 1;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OKeySet::rowDeleted( ) throw(SQLException, RuntimeException)
@@ -1413,20 +1608,22 @@ sal_Bool SAL_CALL OKeySet::rowDeleted( ) throw(SQLException, RuntimeException)
// -----------------------------------------------------------------------------
namespace dbaccess
{
- void getColumnPositions(const Reference<XNameAccess>& _rxQueryColumns,
- const Sequence< ::rtl::OUString>& _aColumnNames,
+
+void getColumnPositions(const Reference<XNameAccess>& _rxQueryColumns,
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rColumnNames,
const ::rtl::OUString& _rsUpdateTableName,
- SelectColumnsMetaData& _rColumnNames)
+ SelectColumnsMetaData& _rColumnAssignments)
+
{
// 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();
+ const ::rtl::OUString* pColumnIter = _rColumnNames.getConstArray();
+ const ::rtl::OUString* pColumnEnd = pColumnIter + _rColumnNames.getLength();
- ::comphelper::UStringMixLess aTmp(_rColumnNames.key_comp());
+ ::comphelper::UStringMixLess aTmp(_rColumnAssignments.key_comp());
::comphelper::UStringMixEqual bCase(static_cast< ::comphelper::UStringMixLess*>(&aTmp)->isCaseSensitive());
for(sal_Int32 nPos = 1;pSelBegin != pSelEnd;++pSelBegin,++nPos)
@@ -1440,7 +1637,7 @@ namespace dbaccess
for(;pColumnIter != pColumnEnd;++pColumnIter)
{
- if(bCase(sRealName,*pColumnIter) && bCase(_rsUpdateTableName,sTableName) && _rColumnNames.find(*pColumnIter) == _rColumnNames.end())
+ if(bCase(sRealName,*pColumnIter) && bCase(_rsUpdateTableName,sTableName) && _rColumnAssignments.find(*pColumnIter) == _rColumnAssignments.end())
{
sal_Int32 nType = 0;
xColumnProp->getPropertyValue(PROPERTY_TYPE) >>= nType;
@@ -1454,11 +1651,11 @@ namespace dbaccess
xColumnProp->getPropertyValue(PROPERTY_ISNULLABLE) >>= bNullable;
- _rColumnNames[sRealName] = SelectColumnDescription( nPos, nType,nScale,bNullable != sdbc::ColumnValue::NO_NULLS, sColumnDefault );
+ _rColumnAssignments[sRealName] = SelectColumnDescription( nPos, nType,nScale,bNullable != sdbc::ColumnValue::NO_NULLS, sColumnDefault );
break;
}
}
- pColumnIter = _aColumnNames.getConstArray();
+ pColumnIter = _rColumnNames.getConstArray();
}
}
}
@@ -1484,3 +1681,4 @@ void OKeySet::impl_convertValue_throw(const ORowSetRow& _rInsertRow,const Select
}
}
// -----------------------------------------------------------------------------
+