summaryrefslogtreecommitdiff
path: root/dbaccess/source/core
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2010-09-22 10:27:02 +0200
committersb <sb@openoffice.org>2010-09-22 10:27:02 +0200
commit0d2be90445192135630ba4ae524473ff7723f857 (patch)
treedc4994a851de2ccf253e55688a84c2d284ef4ea1 /dbaccess/source/core
parent0a0e5930710bd41f30d08ad4ed46aba9b23cd9cc (diff)
parente483a7e493fa7821ce2e9b3bd6d9898dee36a8e2 (diff)
sb129: merged in DEV300_m88
Diffstat (limited to 'dbaccess/source/core')
-rw-r--r--dbaccess/source/core/api/KeySet.cxx44
-rw-r--r--dbaccess/source/core/api/KeySet.hxx1
-rw-r--r--dbaccess/source/core/api/SingleSelectQueryComposer.cxx4
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.cxx17
-rw-r--r--dbaccess/source/core/inc/DatabaseDataProvider.hxx27
-rw-r--r--dbaccess/source/core/misc/DatabaseDataProvider.cxx95
6 files changed, 150 insertions, 38 deletions
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index 3de3133bc..6a7cd4087 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -201,13 +201,6 @@ 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(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
Sequence< ::rtl::OUString> aBestColumnNames;
Reference<XNameAccess> xKeyColumns = getPrimaryKeyColumns_throw(i_aTable);
@@ -216,10 +209,6 @@ void OKeySet::findTableColumnsMatching_throw(const Any& i_aTable
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();
@@ -230,7 +219,26 @@ void OKeySet::findTableColumnsMatching_throw(const Any& i_aTable
Reference<XPropertySet> xPara(xQueryParameters->getByIndex(i),UNO_QUERY_THROW);
xPara->getPropertyValue(PROPERTY_REALNAME) >>= aParameterColumns[i];
}
- ::dbaccess::getColumnPositions(i_xQueryColumns,aParameterColumns,sComposedUpdateTableName,(*m_pParameterNames),true);
+
+ if ( m_sUpdateTableName.getLength() )
+ {
+ ::dbaccess::getColumnPositions(i_xQueryColumns,aBestColumnNames,m_sUpdateTableName,(*m_pKeyColumnNames),true);
+ ::dbaccess::getColumnPositions(i_xQueryColumns,xTblColumns->getElementNames(),m_sUpdateTableName,(*m_pColumnNames),true);
+ ::dbaccess::getColumnPositions(i_xQueryColumns,aParameterColumns,m_sUpdateTableName,(*m_pParameterNames),true);
+ }
+ else
+ {
+ ::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;
+ 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);
+ ::dbaccess::getColumnPositions(i_xQueryColumns,aParameterColumns,sComposedUpdateTableName,(*m_pParameterNames),true);
+ }
SelectColumnsMetaData::const_iterator aPosIter = m_pKeyColumnNames->begin();
SelectColumnsMetaData::const_iterator aPosEnd = m_pKeyColumnNames->end();
@@ -817,10 +825,12 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const ::rtl::OUString
for (;aAutoIter != aAutoEnd; ++aAutoIter)
{
// we will only fetch values which are keycolumns
- if ( m_pKeyColumnNames->find(*aAutoIter) != aEnd )
+ SelectColumnsMetaData::iterator aFind = m_pKeyColumnNames->find(*aAutoIter);
+ if ( aFind != aEnd )
{
sMaxStmt += sMax;
- sMaxStmt += ::dbtools::quoteName( sQuote,*aAutoIter);
+ sMaxStmt += ::dbtools::quoteName( sQuote,aFind->second.sRealName
+);
sMaxStmt += sMaxEnd;
}
}
@@ -831,7 +841,9 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const ::rtl::OUString
::rtl::OUString sStmt = ::rtl::OUString::createFromAscii("SELECT ");
sStmt += sMaxStmt;
sStmt += ::rtl::OUString::createFromAscii("FROM ");
- sStmt += m_aSelectComposedTableName;
+ ::rtl::OUString sCatalog,sSchema,sTable;
+ ::dbtools::qualifiedNameComponents(m_xConnection->getMetaData(),m_sUpdateTableName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation);
+ sStmt += ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable );
try
{
// now fetch the autoincrement values
@@ -1667,7 +1679,7 @@ void OKeySet::impl_convertValue_throw(const ORowSetRow& _rInsertRow,const Select
sal_Int32 nIndex = sValue.indexOf('.');
if ( nIndex != -1 )
{
- aValue = sValue.copy(0,nIndex + (i_aMetaData.nScale > 0 ? i_aMetaData.nScale + 1 : 0));
+ aValue = sValue.copy(0,::std::min(sValue.getLength(),nIndex + (i_aMetaData.nScale > 0 ? i_aMetaData.nScale + 1 : 0)));
}
}
break;
diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx
index ccd5cf0e6..5403a56d6 100644
--- a/dbaccess/source/core/api/KeySet.hxx
+++ b/dbaccess/source/core/api/KeySet.hxx
@@ -112,7 +112,6 @@ namespace dbaccess
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow> m_xRow;
::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer > m_xComposer;
::rtl::OUString m_sUpdateTableName;
- ::rtl::OUString m_aSelectComposedTableName;
::std::vector< ::rtl::OUString > m_aFilterColumns;
sal_Bool m_bRowCountFinal;
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index fc8013413..eea07de9d 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -1266,13 +1266,13 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon
// Feldnamen
sal_uInt16 i;
for (i=0;i< pLhs->count();i++)
- pCondition->getChild(i)->parseNodeToPredicateStr( aName, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
+ pLhs->getChild(i)->parseNodeToPredicateStr( aName, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
// Kriterium
aItem.Handle = pCondition->getChild(1)->getNodeType();
aValue = pCondition->getChild(1)->getTokenValue();
for(i=0;i< pRhs->count();i++)
- pCondition->getChild(i)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
+ pRhs->getChild(i)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
aItem.Name = aName;
aItem.Value <<= aValue;
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index 98c88aaf2..ef8fc20ae 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -1569,16 +1569,7 @@ sal_Bool ODocumentDefinition::saveAs()
Reference<XNameContainer> xNC(pDocuSave->getContent(),UNO_QUERY);
if ( xNC.is() )
{
- if ( m_pImpl->m_aProps.aTitle == pDocuSave->getName() )
- {
- Reference<XEmbedPersist> xPersist(m_xEmbeddedObject,UNO_QUERY);
- if ( xPersist.is() )
- {
- xPersist->storeOwn();
- notifyDataSourceModified();
- }
- }
- else
+ if ( m_pImpl->m_aProps.aTitle != pDocuSave->getName() )
{
try
{
@@ -1618,6 +1609,12 @@ sal_Bool ODocumentDefinition::saveAs()
DBG_UNHANDLED_EXCEPTION();
}
}
+ Reference<XEmbedPersist> xPersist(m_xEmbeddedObject,UNO_QUERY);
+ if ( xPersist.is() )
+ {
+ xPersist->storeOwn();
+ notifyDataSourceModified();
+ }
}
}
}
diff --git a/dbaccess/source/core/inc/DatabaseDataProvider.hxx b/dbaccess/source/core/inc/DatabaseDataProvider.hxx
index ade231e50..dae466e92 100644
--- a/dbaccess/source/core/inc/DatabaseDataProvider.hxx
+++ b/dbaccess/source/core/inc/DatabaseDataProvider.hxx
@@ -33,11 +33,12 @@
#include "com/sun/star/lang/XServiceInfo.hpp"
#include "com/sun/star/chart2/data/XDatabaseDataProvider.hpp"
#include "com/sun/star/chart2/XInternalDataProvider.hpp"
+#include <com/sun/star/chart/XComplexDescriptionAccess.hpp>
#include <com/sun/star/sdbc/XRowSet.hpp>
#include <com/sun/star/sdbc/XParameters.hpp>
#include <com/sun/star/container/XChild.hpp>
-#include "cppuhelper/compbase3.hxx"
+#include "cppuhelper/compbase4.hxx"
#include "cppuhelper/basemutex.hxx"
#include "cppuhelper/propertysetmixin.hxx"
#include <cppuhelper/implementationentry.hxx>
@@ -52,8 +53,9 @@ namespace dbaccess
{
class DatabaseDataSource;
-typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::chart2::data::XDatabaseDataProvider
+typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::chart2::data::XDatabaseDataProvider
, ::com::sun::star::container::XChild
+ , ::com::sun::star::chart::XComplexDescriptionAccess
, ::com::sun::star::lang::XServiceInfo > TDatabaseDataProvider;
class DatabaseDataProvider: private ::cppu::BaseMutex,
@@ -187,6 +189,26 @@ private:
// conatiner::XChild
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+
+ // ____ XComplexDescriptionAccess ____
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL getComplexRowDescriptions() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setComplexRowDescriptions( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aRowDescriptions ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL getComplexColumnDescriptions() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setComplexColumnDescriptions( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aColumnDescriptions ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartDataArray (base of XComplexDescriptionAccess) ____
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > > SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& aData ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getRowDescriptions() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRowDescriptions( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRowDescriptions ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getColumnDescriptions() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setColumnDescriptions( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aColumnDescriptions ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartData (base of XChartDataArray) ____
+ virtual void SAL_CALL addChartDataChangeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeChartDataChangeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener )throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getNotANumber()throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isNotANumber(double nNumber )throw (::com::sun::star::uno::RuntimeException);
private:
DatabaseDataProvider(DatabaseDataProvider &); // not defined
void operator =(DatabaseDataProvider &); // not defined
@@ -229,6 +251,7 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xActiveConnection;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xRowSet;
::com::sun::star::uno::Reference< ::com::sun::star::chart2::XInternalDataProvider > m_xInternal;
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart::XComplexDescriptionAccess > m_xComplexDescriptionAccess;
::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XRangeXMLConversion> m_xRangeConversion;
::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler> m_xHandler;
// the object doin' most of the work - an SDB-rowset
diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
index 1b4ea8f4d..0ede9ff23 100644
--- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx
+++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
@@ -43,6 +43,7 @@
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
+#include <com/sun/star/sdbc/XColumnLocate.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/chart/ChartDataRowSource.hpp>
#include <com/sun/star/chart/XChartDataArray.hpp>
@@ -72,6 +73,7 @@ DatabaseDataProvider::DatabaseDataProvider(uno::Reference< uno::XComponentContex
{
m_xInternal.set( m_xContext->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.chart.InternalDataProvider")),m_xContext ), uno::UNO_QUERY );
m_xRangeConversion.set(m_xInternal,uno::UNO_QUERY);
+ m_xComplexDescriptionAccess.set(m_xInternal,uno::UNO_QUERY);
osl_incrementInterlockedCount( &m_refCount );
{
@@ -315,6 +317,75 @@ uno::Reference< chart2::data::XDataSequence > SAL_CALL DatabaseDataProvider::cre
}
return xData;
}
+
+uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL DatabaseDataProvider::getComplexRowDescriptions() throw (uno::RuntimeException)
+{
+ return m_xComplexDescriptionAccess->getComplexRowDescriptions();
+}
+void SAL_CALL DatabaseDataProvider::setComplexRowDescriptions( const uno::Sequence< uno::Sequence< ::rtl::OUString > >& aRowDescriptions ) throw (uno::RuntimeException)
+{
+ m_xComplexDescriptionAccess->setComplexRowDescriptions(aRowDescriptions);
+}
+uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL DatabaseDataProvider::getComplexColumnDescriptions() throw (uno::RuntimeException)
+{
+ return m_xComplexDescriptionAccess->getComplexColumnDescriptions();
+}
+void SAL_CALL DatabaseDataProvider::setComplexColumnDescriptions( const uno::Sequence< uno::Sequence< rtl::OUString > >& aColumnDescriptions ) throw (uno::RuntimeException)
+{
+ m_xComplexDescriptionAccess->setComplexColumnDescriptions(aColumnDescriptions);
+}
+// ____ XChartDataArray ____
+uno::Sequence< uno::Sequence< double > > SAL_CALL DatabaseDataProvider::getData() throw (uno::RuntimeException)
+{
+ return m_xComplexDescriptionAccess->getData();
+}
+
+void SAL_CALL DatabaseDataProvider::setData( const uno::Sequence< uno::Sequence< double > >& rDataInRows ) throw (uno::RuntimeException)
+{
+ m_xComplexDescriptionAccess->setData(rDataInRows);
+}
+
+void SAL_CALL DatabaseDataProvider::setRowDescriptions( const uno::Sequence< rtl::OUString >& aRowDescriptions ) throw (uno::RuntimeException)
+{
+ m_xComplexDescriptionAccess->setRowDescriptions(aRowDescriptions);
+}
+
+void SAL_CALL DatabaseDataProvider::setColumnDescriptions( const uno::Sequence< rtl::OUString >& aColumnDescriptions ) throw (uno::RuntimeException)
+{
+ m_xComplexDescriptionAccess->setColumnDescriptions(aColumnDescriptions);
+}
+
+uno::Sequence< rtl::OUString > SAL_CALL DatabaseDataProvider::getRowDescriptions() throw (uno::RuntimeException)
+{
+ return m_xComplexDescriptionAccess->getRowDescriptions();
+}
+
+uno::Sequence< rtl::OUString > SAL_CALL DatabaseDataProvider::getColumnDescriptions() throw (uno::RuntimeException)
+{
+ return m_xComplexDescriptionAccess->getColumnDescriptions();
+}
+
+// ____ XChartData (base of XChartDataArray) ____
+void SAL_CALL DatabaseDataProvider::addChartDataChangeEventListener(const uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& x) throw (uno::RuntimeException)
+{
+ m_xComplexDescriptionAccess->addChartDataChangeEventListener(x);
+}
+
+void SAL_CALL DatabaseDataProvider::removeChartDataChangeEventListener(const uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& x) throw (uno::RuntimeException)
+{
+ m_xComplexDescriptionAccess->removeChartDataChangeEventListener(x);
+}
+
+double SAL_CALL DatabaseDataProvider::getNotANumber() throw (uno::RuntimeException)
+{
+ return m_xComplexDescriptionAccess->getNotANumber();
+}
+
+::sal_Bool SAL_CALL DatabaseDataProvider::isNotANumber( double nNumber ) throw (uno::RuntimeException)
+{
+ return m_xComplexDescriptionAccess->isNotANumber(nNumber);
+}
+
// -----------------------------------------------------------------------------
uno::Reference< sheet::XRangeSelection > SAL_CALL DatabaseDataProvider::getRangeSelection() throw (uno::RuntimeException)
@@ -616,26 +687,28 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCat
uno::Reference< sdbc::XResultSet> xRes(m_xRowSet,uno::UNO_QUERY_THROW);
uno::Reference< sdbc::XRow> xRow(m_xRowSet,uno::UNO_QUERY_THROW);
uno::Reference< sdbc::XResultSetMetaData> xResultSetMetaData = uno::Reference< sdbc::XResultSetMetaDataSupplier>(m_xRowSet,uno::UNO_QUERY)->getMetaData();
+ uno::Reference< sdbc::XColumnLocate> xColumnLocate(m_xRowSet,uno::UNO_QUERY_THROW);
::std::vector<sal_Int32> aColumnTypes;
uno::Sequence< uno::Any > aLabelArgs(1);
const sal_Int32 nCount = aColumns.getLength();
if ( nCount )
aColumnTypes.push_back(xResultSetMetaData->getColumnType(1));
- for (sal_Int32 i = 1; i < nCount; ++i)
- {
- aColumnTypes.push_back(xResultSetMetaData->getColumnType(i+1));
- } // for (sal_Int32 i = 1; i < nCount; ++i)
+ ::std::vector< sal_Int32 > aColumnPositions;
const ::rtl::OUString* pIter = aColumns.getConstArray();
const ::rtl::OUString* pEnd = pIter + aColumns.getLength();
for(sal_Int32 k = 0;pIter != pEnd;++pIter,++k)
{
+ aColumnPositions.push_back(xColumnLocate->findColumn(*pIter));
uno::Reference< beans::XPropertySet> xColumn(xColumns->getByName(*pIter),uno::UNO_QUERY);
+ sal_Int32 nType = sdbc::DataType::VARCHAR;
if ( xColumn.is() )
{
m_aNumberFormats.insert( ::std::map< ::rtl::OUString,uno::Any>::value_type(::rtl::OUString::valueOf(k),xColumn->getPropertyValue(PROPERTY_NUMBERFORMAT)));
+ xColumn->getPropertyValue(PROPERTY_TYPE) >>= nType;
}
+ aColumnTypes.push_back(nType);
}
::std::vector< ::rtl::OUString > aRowLabels;
@@ -649,9 +722,17 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCat
aValue.fill(1,aColumnTypes[0],xRow);
aRowLabels.push_back(aValue.getString());
::std::vector< double > aRow;
- for (sal_Int32 j = _bHasCategories ? 2 : 1,i = 0; j <= nCount; ++j,++i)
+ ::std::vector< sal_Int32 >::iterator aColumnPosIter = aColumnPositions.begin();
+ ::std::vector< sal_Int32 >::iterator aColumnPosEnd = aColumnPositions.end();
+ sal_Int32 i = 0;
+ if ( _bHasCategories )
{
- aValue.fill(j,aColumnTypes[j-1],xRow);
+ ++aColumnPosIter;
+ ++i;
+ }
+ for (; aColumnPosIter != aColumnPosEnd; ++aColumnPosIter,++i)
+ {
+ aValue.fill(*aColumnPosIter,aColumnTypes[i],xRow);
if ( aValue.isNull() )
{
double nValue;
@@ -660,7 +741,7 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCat
}
else
aRow.push_back(aValue.getDouble());
- } // for (sal_Int32 j = 2,i = 0; j <= nCount; ++j,++i)
+ }
aDataValues.push_back(aRow);
} // while( xRes->next() && (!m_RowLimit || nRowCount < m_RowLimit) )