diff options
author | Ocke.Janssen <Ocke.Janssen@oracle.com> | 2010-11-24 14:23:06 +0100 |
---|---|---|
committer | Ocke.Janssen <Ocke.Janssen@oracle.com> | 2010-11-24 14:23:06 +0100 |
commit | f02f6f9203902f788e2e7e39335b016a4a2fa0f7 (patch) | |
tree | 3b9c4b00e9be64bb769590f36d969b3a6cc14a4f | |
parent | 51f78b61b8f481ed9602394651632926c41b9a0e (diff) |
dba34b: #i111542# fix for max rows
-rw-r--r-- | dbaccess/source/core/api/BookmarkSet.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/api/CacheSet.cxx | 5 | ||||
-rw-r--r-- | dbaccess/source/core/api/CacheSet.hxx | 3 | ||||
-rw-r--r-- | dbaccess/source/core/api/KeySet.cxx | 8 | ||||
-rw-r--r-- | dbaccess/source/core/api/KeySet.hxx | 3 | ||||
-rw-r--r-- | dbaccess/source/core/api/OptimisticSet.cxx | 5 | ||||
-rw-r--r-- | dbaccess/source/core/api/OptimisticSet.hxx | 3 | ||||
-rw-r--r-- | dbaccess/source/core/api/RowSet.cxx | 8 | ||||
-rw-r--r-- | dbaccess/source/core/api/RowSetCache.cxx | 18 | ||||
-rw-r--r-- | dbaccess/source/core/api/RowSetCache.hxx | 5 | ||||
-rw-r--r-- | dbaccess/source/core/api/StaticSet.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/api/StaticSet.hxx | 4 | ||||
-rw-r--r-- | dbaccess/source/core/api/WrappedResultSet.hxx | 2 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ReportController.cxx | 2 |
14 files changed, 40 insertions, 30 deletions
diff --git a/dbaccess/source/core/api/BookmarkSet.hxx b/dbaccess/source/core/api/BookmarkSet.hxx index 18df82653..e1b6566ef 100644 --- a/dbaccess/source/core/api/BookmarkSet.hxx +++ b/dbaccess/source/core/api/BookmarkSet.hxx @@ -44,7 +44,7 @@ namespace dbaccess void updateColumn(sal_Int32 nPos,::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowUpdate > _xParameter,const connectivity::ORowSetValue& _rValue); public: - OBookmarkSet() + OBookmarkSet(sal_Int32 i_nMaxRows) : OCacheSet(i_nMaxRows) {} ~OBookmarkSet() { diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx index 7f53434b3..634927a8b 100644 --- a/dbaccess/source/core/api/CacheSet.cxx +++ b/dbaccess/source/core/api/CacheSet.cxx @@ -106,8 +106,9 @@ using namespace ::osl; DBG_NAME(OCacheSet) // ------------------------------------------------------------------------- -OCacheSet::OCacheSet() - :m_bInserted(sal_False) +OCacheSet::OCacheSet(sal_Int32 i_nMaxRows) + :m_nMaxRows(i_nMaxRows) + ,m_bInserted(sal_False) ,m_bUpdated(sal_False) ,m_bDeleted(sal_False) { diff --git a/dbaccess/source/core/api/CacheSet.hxx b/dbaccess/source/core/api/CacheSet.hxx index 59601137b..729ccf263 100644 --- a/dbaccess/source/core/api/CacheSet.hxx +++ b/dbaccess/source/core/api/CacheSet.hxx @@ -83,11 +83,12 @@ namespace dbaccess ::com::sun::star::uno::Sequence<sal_Int32> m_aColumnTypes; ORowSetRow m_aInsertRow; ::rtl::OUString m_aComposedTableName; + sal_Int32 m_nMaxRows; sal_Bool m_bInserted; sal_Bool m_bUpdated; sal_Bool m_bDeleted; - OCacheSet(); + OCacheSet(sal_Int32 i_nMaxRows); virtual ~OCacheSet(); void setParameter(sal_Int32 nPos diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 322af26a2..20ac339ce 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -153,8 +153,10 @@ OKeySet::OKeySet(const connectivity::OSQLTable& _xTable, const Reference< XIndexAccess>& _xTableKeys, const ::rtl::OUString& _rUpdateTableName, // this can be the alias or the full qualified name const Reference< XSingleSelectQueryAnalyzer >& _xComposer, - const ORowSetValueVector& _aParameterValueForCache) - :m_aParameterValueForCache(_aParameterValueForCache) + const ORowSetValueVector& _aParameterValueForCache, + sal_Int32 i_nMaxRows) + :OCacheSet(i_nMaxRows) + ,m_aParameterValueForCache(_aParameterValueForCache) ,m_pKeyColumnNames(NULL) ,m_pColumnNames(NULL) ,m_pParameterNames(NULL) @@ -1382,7 +1384,7 @@ sal_Bool OKeySet::fetchRow() RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::fetchRow" ); // fetch the next row and append on the keyset sal_Bool bRet = sal_False; - if ( !m_bRowCountFinal ) + if ( !m_bRowCountFinal && (!m_nMaxRows || sal_Int32(m_aKeyMap.size()) < m_nMaxRows) ) bRet = m_xDriverSet->next(); if ( bRet ) { diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx index 072440c69..5a94d1d10 100644 --- a/dbaccess/source/core/api/KeySet.hxx +++ b/dbaccess/source/core/api/KeySet.hxx @@ -159,7 +159,8 @@ namespace dbaccess const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xTableKeys, const ::rtl::OUString& _rUpdateTableName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _xComposer, - const ORowSetValueVector& _aParameterValueForCache); + const ORowSetValueVector& _aParameterValueForCache, + sal_Int32 i_nMaxRows); // 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); diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx index 091ea08af..72ccde61b 100644 --- a/dbaccess/source/core/api/OptimisticSet.cxx +++ b/dbaccess/source/core/api/OptimisticSet.cxx @@ -102,8 +102,9 @@ DBG_NAME(OptimisticSet) OptimisticSet::OptimisticSet(const ::comphelper::ComponentContext& _rContext, const Reference< XConnection>& i_xConnection, const Reference< XSingleSelectQueryAnalyzer >& _xComposer, - const ORowSetValueVector& _aParameterValueForCache) - :OKeySet(NULL,NULL,::rtl::OUString(),_xComposer,_aParameterValueForCache) + const ORowSetValueVector& _aParameterValueForCache, + sal_Int32 i_nMaxRows) + :OKeySet(NULL,NULL,::rtl::OUString(),_xComposer,_aParameterValueForCache,i_nMaxRows) ,m_aSqlParser( _rContext.getLegacyServiceFactory() ) ,m_aSqlIterator( i_xConnection, Reference<XTablesSupplier>(_xComposer,UNO_QUERY)->getTables(), m_aSqlParser, NULL ) ,m_bResultSetChanged(false) diff --git a/dbaccess/source/core/api/OptimisticSet.hxx b/dbaccess/source/core/api/OptimisticSet.hxx index fd1b304a7..cf703da5e 100644 --- a/dbaccess/source/core/api/OptimisticSet.hxx +++ b/dbaccess/source/core/api/OptimisticSet.hxx @@ -79,7 +79,8 @@ namespace dbaccess OptimisticSet(const ::comphelper::ComponentContext& _rContext, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& i_xConnection, const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _xComposer, - const ORowSetValueVector& _aParameterValueForCache); + const ORowSetValueVector& _aParameterValueForCache, + sal_Int32 i_nMaxRows); // 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); diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 1f7c0294f..e7cf0401c 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -348,7 +348,7 @@ void SAL_CALL ORowSet::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const case PROPERTY_ID_FETCHSIZE: if(m_pCache) { - m_pCache->setMaxRowSize(m_nFetchSize); + m_pCache->setFetchSize(m_nFetchSize); fireRowcount(); } break; @@ -1661,6 +1661,8 @@ Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw() try { xStatementProps->setPropertyValue( PROPERTY_USEBOOKMARKS, makeAny( sal_True ) ); + xStatementProps->setPropertyValue( PROPERTY_MAXROWS, makeAny( m_nMaxRows ) ); + setStatementResultSetType( xStatementProps, m_nResultSetType, m_nResultSetConcurrency ); } catch ( const Exception& ) @@ -1817,13 +1819,13 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "frank.schoenheit@sun.com", "ORowSet::execute_NoApprove_NoNewConn: creating cache" ); - m_pCache = new ORowSetCache( xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName, m_bModified, m_bNew,m_aParameterValueForCache,m_aFilter ); + m_pCache = new ORowSetCache( xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName, m_bModified, m_bNew,m_aParameterValueForCache,m_aFilter,m_nMaxRows ); if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY ) { m_nPrivileges = Privilege::SELECT; m_pCache->m_nPrivileges = Privilege::SELECT; } - m_pCache->setMaxRowSize(m_nFetchSize); + m_pCache->setFetchSize(m_nFetchSize); m_aCurrentRow = m_pCache->createIterator(this); m_aOldRow = m_pCache->registerOldRow(); } diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index eda4632f7..e27e76d6f 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -91,7 +91,8 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, sal_Bool& _bModified, sal_Bool& _bNew, const ORowSetValueVector& _aParameterValueForCache, - const ::rtl::OUString& i_sRowSetFilter) + const ::rtl::OUString& i_sRowSetFilter, + sal_Int32 i_nMaxRows) :m_xSet(_xRs) ,m_xMetaData(Reference< XResultSetMetaDataSupplier >(_xRs,UNO_QUERY)->getMetaData()) ,m_aContext( _rContext ) @@ -128,7 +129,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, xUp->cancelRowUpdates(); _xRs->beforeFirst(); m_nPrivileges = Privilege::SELECT|Privilege::DELETE|Privilege::INSERT|Privilege::UPDATE; - m_pCacheSet = new WrappedResultSet(); + m_pCacheSet = new WrappedResultSet(i_nMaxRows); m_xCacheSet = m_pCacheSet; m_pCacheSet->construct(_xRs,i_sRowSetFilter); return; @@ -175,7 +176,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, if ( aTableNames.getLength() > 1 && !_rUpdateTableName.getLength() && bNeedKeySet ) {// here we have a join or union and nobody told us which table to update, so we update them all m_nPrivileges = Privilege::SELECT|Privilege::DELETE|Privilege::INSERT|Privilege::UPDATE; - OptimisticSet* pCursor = new OptimisticSet(m_aContext,xConnection,_xAnalyzer,_aParameterValueForCache); + OptimisticSet* pCursor = new OptimisticSet(m_aContext,xConnection,_xAnalyzer,_aParameterValueForCache,i_nMaxRows); m_pCacheSet = pCursor; m_xCacheSet = m_pCacheSet; try @@ -237,7 +238,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, { try { - m_pCacheSet = new OBookmarkSet(); + m_pCacheSet = new OBookmarkSet(i_nMaxRows); m_xCacheSet = m_pCacheSet; m_pCacheSet->construct(_xRs,i_sRowSetFilter); @@ -271,7 +272,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, // oj removed because keyset uses only the next// || (xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_RESULTSETTYPE) && comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETTYPE)) == ResultSetType::FORWARD_ONLY) if(!bAllKeysFound ) { - m_pCacheSet = new OStaticSet(); + m_pCacheSet = new OStaticSet(i_nMaxRows); m_xCacheSet = m_pCacheSet; m_pCacheSet->construct(_xRs,i_sRowSetFilter); m_nPrivileges = Privilege::SELECT; @@ -308,7 +309,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, } } - OKeySet* pKeySet = new OKeySet(m_aUpdateTable,xUpdateTableKeys,aUpdateTableName ,_xAnalyzer,_aParameterValueForCache); + OKeySet* pKeySet = new OKeySet(m_aUpdateTable,xUpdateTableKeys,aUpdateTableName ,_xAnalyzer,_aParameterValueForCache,i_nMaxRows); try { m_pCacheSet = pKeySet; @@ -335,7 +336,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, if ( m_pCacheSet ) m_pCacheSet = NULL; m_xCacheSet = NULL; - m_pCacheSet = new OStaticSet(); + m_pCacheSet = new OStaticSet(i_nMaxRows); m_xCacheSet = m_pCacheSet; m_pCacheSet->construct(_xRs,i_sRowSetFilter); m_nPrivileges = Privilege::SELECT; @@ -373,9 +374,8 @@ ORowSetCache::~ORowSetCache() } // ------------------------------------------------------------------------- -void ORowSetCache::setMaxRowSize(sal_Int32 _nSize) +void ORowSetCache::setFetchSize(sal_Int32 _nSize) { - if(_nSize == m_nFetchSize) return; diff --git a/dbaccess/source/core/api/RowSetCache.hxx b/dbaccess/source/core/api/RowSetCache.hxx index d7823a90a..065fb2fad 100644 --- a/dbaccess/source/core/api/RowSetCache.hxx +++ b/dbaccess/source/core/api/RowSetCache.hxx @@ -202,7 +202,8 @@ namespace dbaccess sal_Bool& _bModified, sal_Bool& _bNew, const ORowSetValueVector& _aParameterValueForCache, - const ::rtl::OUString& i_sRowSetFilter); + const ::rtl::OUString& i_sRowSetFilter, + sal_Int32 i_nMaxRows); ~ORowSetCache(); @@ -211,7 +212,7 @@ namespace dbaccess ORowSetCacheIterator createIterator(ORowSetBase* _pRowSet); void deleteIterator(const ORowSetBase* _pRowSet); // sets the size of the matrix - void setMaxRowSize(sal_Int32 _nSize); + void setFetchSize(sal_Int32 _nSize); TORowSetOldRowHelperRef registerOldRow(); void deregisterOldRow(const TORowSetOldRowHelperRef& _rRow); diff --git a/dbaccess/source/core/api/StaticSet.cxx b/dbaccess/source/core/api/StaticSet.cxx index 1965791c2..93a2dfdcc 100644 --- a/dbaccess/source/core/api/StaticSet.cxx +++ b/dbaccess/source/core/api/StaticSet.cxx @@ -122,7 +122,7 @@ sal_Bool OStaticSet::fetchRow() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::fetchRow" ); sal_Bool bRet = sal_False; - if ( !m_bEnd ) + if ( !m_bEnd && (!m_nMaxRows || sal_Int32(m_aSet.size()) < m_nMaxRows) ) bRet = m_xDriverSet->next(); if ( bRet ) { diff --git a/dbaccess/source/core/api/StaticSet.hxx b/dbaccess/source/core/api/StaticSet.hxx index 794623c07..82f122086 100644 --- a/dbaccess/source/core/api/StaticSet.hxx +++ b/dbaccess/source/core/api/StaticSet.hxx @@ -44,8 +44,8 @@ namespace dbaccess sal_Bool fetchRow(); void fillAllRows(); public: - OStaticSet() - : m_aSetIter(m_aSet.end()) + OStaticSet(sal_Int32 i_nMaxRows) : OCacheSet(i_nMaxRows) + , m_aSetIter(m_aSet.end()) , m_bEnd(sal_False) { m_aSet.push_back(NULL); // this is the beforefirst record diff --git a/dbaccess/source/core/api/WrappedResultSet.hxx b/dbaccess/source/core/api/WrappedResultSet.hxx index e78e45a14..7b9f17c68 100644 --- a/dbaccess/source/core/api/WrappedResultSet.hxx +++ b/dbaccess/source/core/api/WrappedResultSet.hxx @@ -48,7 +48,7 @@ namespace dbaccess void updateColumn(sal_Int32 nPos,::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowUpdate > _xParameter,const connectivity::ORowSetValue& _rValue); public: - WrappedResultSet() + WrappedResultSet(sal_Int32 i_nMaxRows) : OCacheSet(i_nMaxRows) {} ~WrappedResultSet() { diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index df10b6806..034cc5607 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -163,7 +163,7 @@ #include <ReportControllerObserver.hxx> -#define MAX_ROWS_FOR_PREVIEW 50 +#define MAX_ROWS_FOR_PREVIEW 20 using namespace ::com::sun::star; using namespace uno; |