summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOcke Janssen [oj] <Ocke.Janssen@oracle.com>2011-03-18 09:31:06 +0100
committerOcke Janssen [oj] <Ocke.Janssen@oracle.com>2011-03-18 09:31:06 +0100
commit4de1caf7b1695196257db2ff52343daf466ac0eb (patch)
tree87a5784d0e83ad3a16d3467a0c25a73d3e7a89fb
parent0807459050ba5ed7566c986370433ca0ade11a92 (diff)
dba34d: #i66846# check bookmarable before use statis resultset
-rw-r--r--dbaccess/source/core/api/RowSetCache.cxx18
1 files changed, 13 insertions, 5 deletions
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index 83df97390..43b2f580e 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -118,10 +118,11 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
// first try if the result can be used to do inserts and updates
Reference< XPropertySet> xProp(_xRs,UNO_QUERY);
Reference< XPropertySetInfo > xPropInfo = xProp->getPropertySetInfo();
+ sal_Bool bBookmarkable = sal_False;
try
{
Reference< XResultSetUpdate> xUp(_xRs,UNO_QUERY_THROW);
- sal_Bool bBookmarkable = xPropInfo->hasPropertyByName(PROPERTY_ISBOOKMARKABLE) &&
+ bBookmarkable = xPropInfo->hasPropertyByName(PROPERTY_ISBOOKMARKABLE) &&
any2bool(xProp->getPropertyValue(PROPERTY_ISBOOKMARKABLE)) && Reference< XRowLocate >(_xRs, UNO_QUERY).is();
if ( bBookmarkable )
{
@@ -154,10 +155,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
sal_Bool bAllKeysFound = sal_False;
sal_Int32 nTablesCount = 0;
-
- sal_Bool bNeedKeySet = !(xPropInfo->hasPropertyByName(PROPERTY_ISBOOKMARKABLE) &&
- any2bool(xProp->getPropertyValue(PROPERTY_ISBOOKMARKABLE)) && Reference< XRowLocate >(_xRs, UNO_QUERY).is() );
- bNeedKeySet = bNeedKeySet || (xPropInfo->hasPropertyByName(PROPERTY_RESULTSETCONCURRENCY) &&
+ sal_Bool bNeedKeySet = !bBookmarkable || (xPropInfo->hasPropertyByName(PROPERTY_RESULTSETCONCURRENCY) &&
::comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETCONCURRENCY)) == ResultSetConcurrency::READ_ONLY);
Reference< XIndexAccess> xUpdateTableKeys;
@@ -280,6 +278,16 @@ 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 )
{
+ if ( bBookmarkable )
+ {
+ // here I know that we have a read only bookmarable cursor
+ _xRs->beforeFirst();
+ m_nPrivileges = Privilege::SELECT;
+ m_pCacheSet = new WrappedResultSet(i_nMaxRows);
+ m_xCacheSet = m_pCacheSet;
+ m_pCacheSet->construct(_xRs,i_sRowSetFilter);
+ return;
+ }
m_pCacheSet = new OStaticSet(i_nMaxRows);
m_xCacheSet = m_pCacheSet;
m_pCacheSet->construct(_xRs,i_sRowSetFilter);