summaryrefslogtreecommitdiff
path: root/dbaccess/source/core/api
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
commit8473229179c9d94720f9822a9a04819d8725b975 (patch)
treeb33aedc91962b7c80bb4a2fa004872d891228ca9 /dbaccess/source/core/api
parent5ca039be5eb5fb9e247798ee1ec42345e055f22a (diff)
dba34d: #i66846# check bookmarable before use statis resultset
Diffstat (limited to 'dbaccess/source/core/api')
-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 68ea76e7244c..0ab902c6a52f 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);