diff options
Diffstat (limited to 'dbaccess/source')
40 files changed, 706 insertions, 277 deletions
diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx index ca3c4d13b..39121e0c2 100644 --- a/dbaccess/source/core/api/CacheSet.cxx +++ b/dbaccess/source/core/api/CacheSet.cxx @@ -640,6 +640,21 @@ sal_Bool SAL_CALL OCacheSet::previous( ) throw(SQLException, RuntimeException) return m_xDriverSet->previous(); } +sal_Bool OCacheSet::last_checked( sal_Bool /*i_bFetchRow*/) +{ + return last(); +} + +sal_Bool OCacheSet::previous_checked( sal_Bool /*i_bFetchRow*/ ) +{ + return previous(); +} + +sal_Bool OCacheSet::absolute_checked( sal_Int32 row,sal_Bool /*i_bFetchRow*/ ) +{ + return absolute(row); +} + void SAL_CALL OCacheSet::refreshRow( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::refreshRow" ); diff --git a/dbaccess/source/core/api/CacheSet.hxx b/dbaccess/source/core/api/CacheSet.hxx index 5e2138aa6..9fab5c212 100644 --- a/dbaccess/source/core/api/CacheSet.hxx +++ b/dbaccess/source/core/api/CacheSet.hxx @@ -153,6 +153,9 @@ namespace dbaccess virtual bool columnValuesUpdated(ORowSetValueVector::Vector& o_aCachedRow,const ORowSetValueVector::Vector& i_aRow); virtual bool updateColumnValues(const ORowSetValueVector::Vector& io_aCachedRow,ORowSetValueVector::Vector& io_aRow,const ::std::vector<sal_Int32>& i_aChangedColumns); virtual void fillMissingValues(ORowSetValueVector::Vector& io_aRow) const; + virtual sal_Bool previous_checked( sal_Bool i_bFetchRow ); + virtual sal_Bool absolute_checked( sal_Int32 row,sal_Bool i_bFetchRow ); + virtual sal_Bool last_checked( sal_Bool i_bFetchRow); }; } #endif //DBACCESS_CORE_API_CACHESET_HXX diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 6ec44dcc3..eda1e4231 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -105,7 +105,8 @@ OKeySet::OKeySet(const connectivity::OSQLTable& _xTable, const ::rtl::OUString& _rUpdateTableName, // this can be the alias or the full qualified name const Reference< XSingleSelectQueryAnalyzer >& _xComposer, const ORowSetValueVector& _aParameterValueForCache, - sal_Int32 i_nMaxRows) + sal_Int32 i_nMaxRows, + sal_Int32& o_nRowCount) :OCacheSet(i_nMaxRows) ,m_aParameterValueForCache(_aParameterValueForCache) ,m_pKeyColumnNames(NULL) @@ -116,6 +117,7 @@ OKeySet::OKeySet(const connectivity::OSQLTable& _xTable, ,m_xTableKeys(_xTableKeys) ,m_xComposer(_xComposer) ,m_sUpdateTableName(_rUpdateTableName) + ,m_rRowCount(o_nRowCount) ,m_bRowCountFinal(sal_False) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::OKeySet" ); @@ -1112,6 +1114,12 @@ sal_Bool SAL_CALL OKeySet::next( ) throw(SQLException, RuntimeException) ++m_aKeyIter; // this is possible because we stand on begin() and this is the "beforefirst" row if(m_aKeyIter == m_aKeyMap.end() && !fetchRow()) m_aKeyIter = m_aKeyMap.end(); + else + { + //m_aKeyIter->second.second.second = new OPrivateRow(_rInsertRow->get()); + m_xRow.set(m_xDriverRow,UNO_QUERY_THROW); + return !isAfterLast(); + } } else if(!isAfterLast()) ++m_aKeyIter; @@ -1178,20 +1186,26 @@ sal_Bool SAL_CALL OKeySet::first( ) throw(SQLException, RuntimeException) ++m_aKeyIter; if(m_aKeyIter == m_aKeyMap.end() && !fetchRow()) m_aKeyIter = m_aKeyMap.end(); - - refreshRow(); + else + refreshRow(); return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin(); } sal_Bool SAL_CALL OKeySet::last( ) throw(SQLException, RuntimeException) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::last" ); + return last_checked(sal_True); +} + +sal_Bool OKeySet::last_checked( sal_Bool i_bFetchRow) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::last_checked" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; fillAllRows(); m_aKeyIter = m_aKeyMap.end(); --m_aKeyIter; - refreshRow(); + if ( i_bFetchRow ) + refreshRow(); return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin(); } @@ -1206,6 +1220,10 @@ sal_Int32 SAL_CALL OKeySet::getRow( ) throw(SQLException, RuntimeException) sal_Bool SAL_CALL OKeySet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) { + return absolute_checked(row,sal_True); +} +sal_Bool OKeySet::absolute_checked( sal_Int32 row,sal_Bool i_bFetchRow ) +{ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::absolute" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; OSL_ENSURE(row,"absolute(0) isn't allowed!"); @@ -1226,6 +1244,11 @@ sal_Bool SAL_CALL OKeySet::absolute( sal_Int32 row ) throw(SQLException, Runtime sal_Bool bNext = sal_True; for(sal_Int32 i=m_aKeyMap.size()-1;i < row && bNext;++i) bNext = fetchRow(); + if ( bNext ) + { + m_xRow.set(m_xDriverRow,UNO_QUERY_THROW); + return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin(); + } } else m_aKeyIter = m_aKeyMap.end(); @@ -1237,7 +1260,8 @@ sal_Bool SAL_CALL OKeySet::absolute( sal_Int32 row ) throw(SQLException, Runtime ++m_aKeyIter; } } - refreshRow(); + if ( i_bFetchRow ) + refreshRow(); return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin(); } @@ -1253,18 +1277,24 @@ sal_Bool SAL_CALL OKeySet::relative( sal_Int32 rows ) throw(SQLException, Runtim return absolute(getRow()+rows); } -sal_Bool SAL_CALL OKeySet::previous( ) throw(SQLException, RuntimeException) +sal_Bool OKeySet::previous_checked( sal_Bool i_bFetchRow ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::previous" ); m_bInserted = m_bUpdated = m_bDeleted = sal_False; if(m_aKeyIter != m_aKeyMap.begin()) { --m_aKeyIter; - refreshRow(); + if ( i_bFetchRow ) + refreshRow(); } return m_aKeyIter != m_aKeyMap.begin(); } +sal_Bool SAL_CALL OKeySet::previous( ) throw(SQLException, RuntimeException) +{ + return previous_checked(sal_True); +} +// ----------------------------------------------------------------------------- void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::refreshRow" ); @@ -1319,9 +1349,18 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException) OSL_ENSURE(m_xSet.is(),"No resultset form statement!"); sal_Bool bOK = m_xSet->next(); if ( !bOK ) - m_aKeyIter = m_aKeyMap.end(); - m_xRow.set(m_xSet,UNO_QUERY); - OSL_ENSURE(m_xRow.is(),"No row form statement!"); + { + OKeySetMatrix::iterator aTemp = m_aKeyIter; + ++m_aKeyIter; + m_aKeyMap.erase(aTemp); + --m_rRowCount; + refreshRow(); + } + else + { + m_xRow.set(m_xSet,UNO_QUERY); + OSL_ENSURE(m_xRow.is(),"No row form statement!"); + } } sal_Bool OKeySet::fetchRow() diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx index 826ec1ab7..99326960c 100644 --- a/dbaccess/source/core/api/KeySet.hxx +++ b/dbaccess/source/core/api/KeySet.hxx @@ -104,6 +104,7 @@ namespace dbaccess ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer > m_xComposer; ::rtl::OUString m_sUpdateTableName; ::std::vector< ::rtl::OUString > m_aFilterColumns; + sal_Int32& m_rRowCount; sal_Bool m_bRowCountFinal; @@ -151,7 +152,8 @@ namespace dbaccess const ::rtl::OUString& _rUpdateTableName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _xComposer, const ORowSetValueVector& _aParameterValueForCache, - sal_Int32 i_nMaxRows); + sal_Int32 i_nMaxRows, + sal_Int32& o_nRowCount); // 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); @@ -219,6 +221,11 @@ namespace dbaccess virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + + virtual sal_Bool previous_checked( sal_Bool i_bFetchRow ); + virtual sal_Bool absolute_checked( sal_Int32 row,sal_Bool i_bFetchRow ); + virtual sal_Bool last_checked( sal_Bool i_bFetchRow); }; } #endif // DBACCESS_CORE_API_KEYSET_HXX diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx index 38dba0ece..8e8fc2386 100644 --- a/dbaccess/source/core/api/OptimisticSet.cxx +++ b/dbaccess/source/core/api/OptimisticSet.cxx @@ -102,8 +102,9 @@ OptimisticSet::OptimisticSet(const ::comphelper::ComponentContext& _rContext, const Reference< XConnection>& i_xConnection, const Reference< XSingleSelectQueryAnalyzer >& _xComposer, const ORowSetValueVector& _aParameterValueForCache, - sal_Int32 i_nMaxRows) - :OKeySet(NULL,NULL,::rtl::OUString(),_xComposer,_aParameterValueForCache,i_nMaxRows) + sal_Int32 i_nMaxRows, + sal_Int32& o_nRowCount) + :OKeySet(NULL,NULL,::rtl::OUString(),_xComposer,_aParameterValueForCache,i_nMaxRows,o_nRowCount) ,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 bcada376a..b9b8fbe11 100644 --- a/dbaccess/source/core/api/OptimisticSet.hxx +++ b/dbaccess/source/core/api/OptimisticSet.hxx @@ -77,7 +77,8 @@ namespace dbaccess 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, - sal_Int32 i_nMaxRows); + sal_Int32 i_nMaxRows, + sal_Int32& o_nRowCount); // 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 724df9f4a..3825516e4 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -599,6 +599,7 @@ void ORowSet::freeResources( bool _bComplete ) m_bAfterLast = sal_False; m_bNew = sal_False; m_bModified = sal_False; + m_bIsInsertRow = sal_False; m_bLastKnownRowCountFinal = sal_False; m_nLastKnownRowCount = 0; if ( m_aOldRow.is() ) @@ -708,6 +709,7 @@ void ORowSet::updateValue(sal_Int32 columnIndex,const ORowSetValue& x) ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get()); ORowSetNotifier aNotify(this,rRow); m_pCache->updateValue(columnIndex,x,rRow,aNotify.getChangedColumns()); + m_bModified = m_bModified || !aNotify.getChangedColumns().empty(); aNotify.firePropertyChange(); } @@ -723,6 +725,7 @@ void SAL_CALL ORowSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, R ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get()); ORowSetNotifier aNotify(this,rRow); m_pCache->updateNull(columnIndex,rRow,aNotify.getChangedColumns()); + m_bModified = m_bModified || !aNotify.getChangedColumns().empty(); aNotify.firePropertyChange(); } @@ -810,6 +813,7 @@ void SAL_CALL ORowSet::updateCharacterStream( sal_Int32 columnIndex, const Refer ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get()); ORowSetNotifier aNotify(this,rRow); m_pCache->updateCharacterStream(columnIndex,x,length,rRow,aNotify.getChangedColumns()); + m_bModified = m_bModified || !aNotify.getChangedColumns().empty(); aNotify.firePropertyChange(); } @@ -853,6 +857,7 @@ void SAL_CALL ORowSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get()); ORowSetNotifier aNotify(this,rRow); m_pCache->updateObject(columnIndex,aNewValue,rRow,aNotify.getChangedColumns()); + m_bModified = m_bModified || !aNotify.getChangedColumns().empty(); aNotify.firePropertyChange(); } } @@ -866,6 +871,7 @@ void SAL_CALL ORowSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get()); ORowSetNotifier aNotify(this,rRow); m_pCache->updateNumericObject(columnIndex,x,scale,rRow,aNotify.getChangedColumns()); + m_bModified = m_bModified || !aNotify.getChangedColumns().empty(); aNotify.firePropertyChange(); } @@ -882,52 +888,49 @@ void SAL_CALL ORowSet::insertRow( ) throw(SQLException, RuntimeException) if(!m_pCache || !m_bNew || !m_bModified || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY) throwFunctionSequenceException(*this); - if(m_bModified) - { - // remember old value for fire - sal_Bool bOld = m_bNew; + // remember old value for fire + sal_Bool bOld = m_bNew; - ORowSetRow aOldValues; - if ( !m_aCurrentRow.isNull() ) - aOldValues = new ORowSetValueVector( *(*m_aCurrentRow)); - Sequence<Any> aChangedBookmarks; - RowsChangeEvent aEvt(*this,RowChangeAction::INSERT,1,aChangedBookmarks); - notifyAllListenersRowBeforeChange(aGuard,aEvt); + ORowSetRow aOldValues; + if ( !m_aCurrentRow.isNull() ) + aOldValues = new ORowSetValueVector( *(*m_aCurrentRow)); + Sequence<Any> aChangedBookmarks; + RowsChangeEvent aEvt(*this,RowChangeAction::INSERT,1,aChangedBookmarks); + notifyAllListenersRowBeforeChange(aGuard,aEvt); - ::std::vector< Any > aBookmarks; - sal_Bool bInserted = m_pCache->insertRow(aBookmarks); + ::std::vector< Any > aBookmarks; + sal_Bool bInserted = m_pCache->insertRow(aBookmarks); - // make sure that our row is set to the new inserted row before clearing the insert flags in the cache - m_pCache->resetInsertRow(bInserted); + // make sure that our row is set to the new inserted row before clearing the insert flags in the cache + m_pCache->resetInsertRow(bInserted); - // notification order - // - column values - setCurrentRow( sal_False, sal_True, aOldValues, aGuard ); // we don't move here + // notification order + // - column values + setCurrentRow( sal_False, sal_True, aOldValues, aGuard ); // we don't move here - // read-only flag restored - impl_restoreDataColumnsWriteable_throw(); + // read-only flag restored + impl_restoreDataColumnsWriteable_throw(); - // - rowChanged - notifyAllListenersRowChanged(aGuard,aEvt); + // - rowChanged + notifyAllListenersRowChanged(aGuard,aEvt); - if ( !aBookmarks.empty() ) - { - RowsChangeEvent aUpEvt(*this,RowChangeAction::UPDATE,aBookmarks.size(),Sequence<Any>(&(*aBookmarks.begin()),aBookmarks.size())); - notifyAllListenersRowChanged(aGuard,aUpEvt); - } + if ( !aBookmarks.empty() ) + { + RowsChangeEvent aUpEvt(*this,RowChangeAction::UPDATE,aBookmarks.size(),Sequence<Any>(&(*aBookmarks.begin()),aBookmarks.size())); + notifyAllListenersRowChanged(aGuard,aUpEvt); + } - // - IsModified - if(!m_bModified) - fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True); - OSL_ENSURE( !m_bModified, "ORowSet::insertRow: just updated, but _still_ modified?" ); + // - IsModified + if(!m_bModified) + fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True); + OSL_ENSURE( !m_bModified, "ORowSet::insertRow: just updated, but _still_ modified?" ); - // - IsNew - if(m_bNew != bOld) - fireProperty(PROPERTY_ID_ISNEW,m_bNew,bOld); + // - IsNew + if(m_bNew != bOld) + fireProperty(PROPERTY_ID_ISNEW,m_bNew,bOld); - // - RowCount/IsRowCountFinal - fireRowcount(); - } + // - RowCount/IsRowCountFinal + fireRowcount(); } sal_Int32 SAL_CALL ORowSet::getRow( ) throw(SQLException, RuntimeException) @@ -936,7 +939,7 @@ sal_Int32 SAL_CALL ORowSet::getRow( ) throw(SQLException, RuntimeException) checkCache(); // check if we are inserting a row - return (m_pCache && ( m_pCache->m_bNew || m_bModified )) ? 0 : ORowSetBase::getRow(); + return (m_pCache && isInsertRow()) ? 0 : ORowSetBase::getRow(); } void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException) @@ -1074,6 +1077,7 @@ void ORowSet::implCancelRowUpdates( sal_Bool _bNotifyModified ) SAL_THROW( ( SQL m_aBookmark = m_pCache->getBookmark(); m_aCurrentRow = m_pCache->m_aMatrixIter; + m_bIsInsertRow = sal_False; m_aCurrentRow.setBookmark(m_aBookmark); // notification order @@ -1206,6 +1210,7 @@ void SAL_CALL ORowSet::moveToInsertRow( ) throw(SQLException, RuntimeException) m_pCache->moveToInsertRow(); m_aCurrentRow = m_pCache->m_aInsertRow; + m_bIsInsertRow = sal_True; // set read-only flag to false impl_setDataColumnsWriteable_throw(); @@ -1809,6 +1814,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi } m_pCache->setFetchSize(m_nFetchSize); m_aCurrentRow = m_pCache->createIterator(this); + m_bIsInsertRow = sal_False; m_aOldRow = m_pCache->registerOldRow(); } @@ -2646,6 +2652,7 @@ void ORowSet::doCancelModification( ) m_pCache->cancelRowModification(); } m_bModified = sal_False; + m_bIsInsertRow = sal_False; } sal_Bool ORowSet::isModification( ) @@ -2670,14 +2677,12 @@ sal_Bool ORowSet::isPropertyChangeNotificationEnabled() const void ORowSet::checkUpdateIterator() { - if(!m_bModified && !m_bNew) + if(!m_bIsInsertRow) { m_pCache->setUpdateIterator(m_aCurrentRow); m_aCurrentRow = m_pCache->m_aInsertRow; - m_bModified = sal_True; + m_bIsInsertRow = sal_True; } - else if ( m_bNew ) // here we are modifying a value - m_bModified = sal_True; } void ORowSet::checkUpdateConditions(sal_Int32 columnIndex) diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx index 0011e231b..81fbd93ea 100644 --- a/dbaccess/source/core/api/RowSetBase.cxx +++ b/dbaccess/source/core/api/RowSetBase.cxx @@ -111,6 +111,7 @@ ORowSetBase::ORowSetBase( const ::comphelper::ComponentContext& _rContext, ::cpp ,m_bIgnoreResult(sal_False) ,m_bBeforeFirst(sal_True) // changed from sal_False ,m_bAfterLast(sal_False) + ,m_bIsInsertRow(sal_False) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::ORowSetBase" ); DBG_CTOR(ORowSetBase,NULL); @@ -255,6 +256,7 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex) // currentrow is null when the clone moves the window positionCache( MOVE_NONE_REFRESH_ONLY ); m_aCurrentRow = m_pCache->m_aMatrixIter; + m_bIsInsertRow = sal_False; OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getValue: we don't stand on a valid row! Row is null."); bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->is() ); @@ -396,6 +398,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSetBase::getBinaryS { positionCache( MOVE_NONE_REFRESH_ONLY ); m_aCurrentRow = m_pCache->m_aMatrixIter; + m_bIsInsertRow = sal_False; OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getBinaryStream: we don't stand on a valid row! Row is null."); bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->is() ); @@ -1114,6 +1117,7 @@ void ORowSetBase::setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const OR m_aBookmark = m_pCache->getBookmark(); OSL_ENSURE(m_aBookmark.hasValue(),"Bookmark has no value!"); m_aCurrentRow = m_pCache->m_aMatrixIter; + m_bIsInsertRow = sal_False; OSL_ENSURE(!m_aCurrentRow.isNull(),"CurrentRow is null!"); m_aCurrentRow.setBookmark(m_aBookmark); OSL_ENSURE(!m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd(),"Position of matrix iterator isn't valid!"); @@ -1129,6 +1133,7 @@ void ORowSetBase::setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const OR #endif OSL_ENSURE(nOldRow == nNewRow,"Old position is not equal to new postion"); m_aCurrentRow = m_pCache->m_aMatrixIter; + m_bIsInsertRow = sal_False; OSL_ENSURE(!m_aCurrentRow.isNull(),"CurrentRow is nul after positionCache!"); #if OSL_DEBUG_LEVEL > 0 ORowSetRow rRow = (*m_aCurrentRow); @@ -1139,6 +1144,7 @@ void ORowSetBase::setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const OR { positionCache( MOVE_NONE_REFRESH_ONLY ); m_aCurrentRow = m_pCache->m_aMatrixIter; + m_bIsInsertRow = sal_False; OSL_ENSURE(!m_aCurrentRow.isNull(),"CurrentRow is nul after positionCache!"); } } @@ -1569,7 +1575,8 @@ void ORowSetNotifier::firePropertyChange() { m_pRowSet->firePropertyChange((*aIter)-1 ,m_pImpl->aRow[(*aIter)-1], ORowSetBase::GrantNotifierAccess()); } - m_pRowSet->fireProperty(PROPERTY_ID_ISMODIFIED,sal_True,sal_False, ORowSetBase::GrantNotifierAccess()); + if ( !m_pImpl->aChangedColumns.empty() ) + m_pRowSet->fireProperty(PROPERTY_ID_ISMODIFIED,sal_True,sal_False, ORowSetBase::GrantNotifierAccess()); } } } // namespace dbaccess diff --git a/dbaccess/source/core/api/RowSetBase.hxx b/dbaccess/source/core/api/RowSetBase.hxx index 516d46112..5b1f0d08e 100644 --- a/dbaccess/source/core/api/RowSetBase.hxx +++ b/dbaccess/source/core/api/RowSetBase.hxx @@ -117,6 +117,7 @@ namespace dbaccess sal_Bool m_bIgnoreResult ; sal_Bool m_bBeforeFirst : 1; sal_Bool m_bAfterLast : 1; + sal_Bool m_bIsInsertRow : 1; protected: ORowSetBase( @@ -345,7 +346,7 @@ namespace dbaccess inline sal_Bool isModification( const GrantNotifierAccess& ) { return isModification(); } inline sal_Bool isModified( const GrantNotifierAccess& ) { return isModified(); } inline sal_Bool isNew( const GrantNotifierAccess& ) { return isNew(); } - inline sal_Bool isInsertRow() { return isNew() || isModified(); } + inline sal_Bool isInsertRow() { return m_bIsInsertRow; } // isNew() || isModified(); } inline void fireProperty( sal_Int32 _nProperty, sal_Bool _bNew, sal_Bool _bOld, const GrantNotifierAccess& ) { fireProperty( _nProperty, _bNew, _bOld ); diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index 4fba5f490..364bfbfb5 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -115,12 +115,13 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, DBG_CTOR(ORowSetCache,NULL); // 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); - Reference< XPropertySet> xProp(_xRs,UNO_QUERY); - Reference< XPropertySetInfo > xPropInfo = xProp->getPropertySetInfo(); - 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 ) { @@ -138,17 +139,22 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, { (void)ex; } - _xRs->beforeFirst(); + try + { + if ( xPropInfo->hasPropertyByName(PROPERTY_RESULTSETTYPE) && + ::comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETTYPE)) != ResultSetType::FORWARD_ONLY) + _xRs->beforeFirst(); + } + catch(const SQLException& e) + { + (void)e; + } // check if all keys of the updateable table are fetched sal_Bool bAllKeysFound = sal_False; sal_Int32 nTablesCount = 0; - Reference< XPropertySet> xProp(_xRs,UNO_QUERY); - Reference< XPropertySetInfo > xPropInfo = xProp->getPropertySetInfo(); - 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; @@ -175,7 +181,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,i_nMaxRows); + OptimisticSet* pCursor = new OptimisticSet(m_aContext,xConnection,_xAnalyzer,_aParameterValueForCache,i_nMaxRows,m_nRowCount); m_pCacheSet = pCursor; m_xCacheSet = m_pCacheSet; try @@ -267,6 +273,16 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, 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); @@ -304,7 +320,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, } } - OKeySet* pKeySet = new OKeySet(m_aUpdateTable,xUpdateTableKeys,aUpdateTableName ,_xAnalyzer,_aParameterValueForCache,i_nMaxRows); + OKeySet* pKeySet = new OKeySet(m_aUpdateTable,xUpdateTableKeys,aUpdateTableName ,_xAnalyzer,_aParameterValueForCache,i_nMaxRows,m_nRowCount); try { m_pCacheSet = pKeySet; @@ -434,6 +450,13 @@ void ORowSetCache::setFetchSize(sal_Int32 _nSize) m_nStartPos = 0; m_nEndPos = _nSize; } + else if (m_nStartPos < m_nPosition && m_nPosition < m_nEndPos) + { + sal_Int32 nNewSt = -1; + fillMatrix(nNewSt,_nSize+1); + m_nStartPos = 0; + m_nEndPos = _nSize; + } } // XResultSetMetaDataSupplier @@ -538,13 +561,16 @@ void ORowSetCache::updateNull(sal_Int32 columnIndex,ORowSetValueVector::Vector& checkUpdateConditions(columnIndex); ORowSetValueVector::Vector& rInsert = ((*m_aInsertRow)->get()); - rInsert[columnIndex].setBound(sal_True); - rInsert[columnIndex].setNull(); - rInsert[columnIndex].setModified(); - io_aRow[columnIndex].setNull(); + if ( !rInsert[columnIndex].isNull() ) + { + rInsert[columnIndex].setBound(sal_True); + rInsert[columnIndex].setNull(); + rInsert[columnIndex].setModified(); + io_aRow[columnIndex].setNull(); - m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns); - impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); + m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns); + impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); + } } void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x @@ -555,13 +581,16 @@ void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x checkUpdateConditions(columnIndex); ORowSetValueVector::Vector& rInsert = ((*m_aInsertRow)->get()); - rInsert[columnIndex].setBound(sal_True); - rInsert[columnIndex] = x; - rInsert[columnIndex].setModified(); - io_aRow[columnIndex] = rInsert[columnIndex]; + if ( rInsert[columnIndex] != x ) + { + rInsert[columnIndex].setBound(sal_True); + rInsert[columnIndex] = x; + rInsert[columnIndex].setModified(); + io_aRow[columnIndex] = rInsert[columnIndex]; - m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns); - impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); + m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns); + impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); + } } void ORowSetCache::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x @@ -593,13 +622,18 @@ void ORowSetCache::updateObject( sal_Int32 columnIndex, const Any& x checkUpdateConditions(columnIndex); ORowSetValueVector::Vector& rInsert = ((*m_aInsertRow)->get()); - rInsert[columnIndex].setBound(sal_True); - rInsert[columnIndex] = x; - rInsert[columnIndex].setModified(); - io_aRow[columnIndex] = rInsert[columnIndex]; + ORowSetValue aTemp; + aTemp.fill(x); + if ( rInsert[columnIndex] != aTemp ) + { + rInsert[columnIndex].setBound(sal_True); + rInsert[columnIndex] = aTemp; + rInsert[columnIndex].setModified(); + io_aRow[columnIndex] = rInsert[columnIndex]; - m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns); - impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); + m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns); + impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); + } } void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ @@ -610,13 +644,18 @@ void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal checkUpdateConditions(columnIndex); ORowSetValueVector::Vector& rInsert = ((*m_aInsertRow)->get()); - rInsert[columnIndex].setBound(sal_True); - rInsert[columnIndex] = x; - rInsert[columnIndex].setModified(); - io_aRow[columnIndex] = rInsert[columnIndex]; + ORowSetValue aTemp; + aTemp.fill(x); + if ( rInsert[columnIndex] != aTemp ) + { + rInsert[columnIndex].setBound(sal_True); + rInsert[columnIndex] = aTemp; + rInsert[columnIndex].setModified(); + io_aRow[columnIndex] = rInsert[columnIndex]; - m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns); - impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); + m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns); + impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns); + } } // XResultSet @@ -644,8 +683,6 @@ sal_Bool ORowSetCache::next( ) sal_Bool ORowSetCache::isBeforeFirst( ) { - // return !m_nPosition; - return m_bBeforeFirst; } @@ -687,7 +724,7 @@ sal_Bool ORowSetCache::afterLast( ) if(!m_bRowCountFinal) { - m_pCacheSet->last(); + m_pCacheSet->last_checked(sal_False); m_bRowCountFinal = sal_True; m_nRowCount = m_pCacheSet->getRow();// + 1 removed } @@ -703,10 +740,22 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos { OSL_ENSURE(_nNewStartPos != _nNewEndPos,"ORowSetCache::fillMatrix: StartPos and EndPos can not be equal!"); // fill the whole window with new data - ORowSetMatrix::iterator aIter = m_pMatrix->begin(); - sal_Bool bCheck = m_pCacheSet->absolute(_nNewStartPos); // -1 no need to + ORowSetMatrix::iterator aIter; + sal_Int32 i; + sal_Bool bCheck; + if ( _nNewStartPos == -1 ) + { + aIter = m_pMatrix->begin() + m_nEndPos; + i = m_nEndPos+1; + } + else + { + aIter = m_pMatrix->begin(); + i = _nNewStartPos; + } + bCheck = m_pCacheSet->absolute(i); // -1 no need to + - sal_Int32 i=_nNewStartPos; for(;i<_nNewEndPos;++i,++aIter) { if(bCheck) @@ -714,13 +763,15 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos if(!aIter->is()) *aIter = new ORowSetValueVector(m_xMetaData->getColumnCount()); m_pCacheSet->fillValueRow(*aIter,i); + if(!m_bRowCountFinal) + ++m_nRowCount; } else { // there are no more rows found so we can fetch some before start if(!m_bRowCountFinal) { - if(m_pCacheSet->previous()) // because we stand after the last row + if(m_pCacheSet->previous_checked(sal_False)) // because we stand after the last row m_nRowCount = m_pCacheSet->getRow(); // here we have the row count if(!m_nRowCount) m_nRowCount = i-1; // it can be that getRow return zero @@ -749,15 +800,17 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos } break; } - bCheck = m_pCacheSet->next(); + if ( i < (_nNewEndPos-1) ) + bCheck = m_pCacheSet->next(); } - // we have to read one row forward to enshure that we know when we are on last row + // we have to read one row forward to ensure that we know when we are on last row // but only when we don't know it already + /* if(!m_bRowCountFinal) { if(!m_pCacheSet->next()) { - if(m_pCacheSet->previous()) // because we stand after the last row + if(m_pCacheSet->previous_checked(sal_False)) // because we stand after the last row m_nRowCount = m_pCacheSet->getRow(); // here we have the row count m_bRowCountFinal = sal_True; } @@ -765,6 +818,7 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos m_nRowCount = std::max(i,m_nRowCount); } + */ return bCheck; } @@ -899,19 +953,16 @@ sal_Bool ORowSetCache::moveWindow() // but only when we don't know it already if ( !m_bRowCountFinal ) { - bOk = m_pCacheSet->absolute( m_nPosition + 1 ); + bOk = m_pCacheSet->absolute_checked( m_nPosition + 1,sal_False ); if ( bOk ) m_nRowCount = std::max(sal_Int32(m_nPosition+1),m_nRowCount); } } - if(!bOk) + if(!bOk && !m_bRowCountFinal) { - if(!m_bRowCountFinal) - { - // because we stand after the last row - m_nRowCount = m_pCacheSet->previous() ? m_pCacheSet->getRow() : 0;// + 1 removed - m_bRowCountFinal = sal_True; - } + // because we stand after the last row + m_nRowCount = m_pCacheSet->previous_checked(sal_False) ? m_pCacheSet->getRow() : 0;// + 1 removed + m_bRowCountFinal = sal_True; } } } @@ -942,7 +993,7 @@ sal_Bool ORowSetCache::moveWindow() // now I can say how many rows we have if(!bOk) { - m_pCacheSet->previous(); // because we stand after the last row + m_pCacheSet->previous_checked(sal_False); // because we stand after the last row m_nRowCount = nPos; // here we have the row count m_bRowCountFinal = sal_True; } @@ -959,7 +1010,7 @@ sal_Bool ORowSetCache::moveWindow() if ( !m_bRowCountFinal ) { - m_pCacheSet->previous(); // because we stand after the last row + m_pCacheSet->previous_checked(sal_False); // because we stand after the last row m_nRowCount = std::max(m_nRowCount,--nPos); // here we have the row count OSL_ENSURE(nPos == m_pCacheSet->getRow(),"nPos isn't valid!"); m_bRowCountFinal = sal_True; @@ -975,7 +1026,7 @@ sal_Bool ORowSetCache::moveWindow() aIter = m_pMatrix->begin(); nPos = m_nStartPos; - bCheck = m_pCacheSet->absolute(m_nStartPos); + bCheck = m_pCacheSet->absolute_checked(m_nStartPos,sal_False); for(; !aIter->is() && bCheck;++aIter) { OSL_ENSURE(aIter != m_pMatrix->end(),"Invalid iterator"); diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index 16a01c9f0..518a41912 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -59,6 +59,7 @@ #include <comphelper/sequence.hxx> #include <comphelper/types.hxx> #include <cppuhelper/typeprovider.hxx> +#include <connectivity/predicateinput.hxx> #include <rtl/logfile.hxx> #include <unotools/syslocale.hxx> #include <tools/debug.hxx> @@ -1216,16 +1217,12 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon ::rtl::OUString aValue; ::rtl::OUString aColumnName; - pCondition->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) ); + pCondition->getChild(2)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) ); pCondition->getChild(0)->parseNodeToPredicateStr( aColumnName, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep .toChar() ) ); - // don't display the column name - aValue = aValue.copy(aColumnName.getLength()); - aValue.trim(); - aItem.Name = getColumnName(pCondition->getChild(0),_rIterator); aItem.Value <<= aValue; - aItem.Handle = pCondition->getNodeType(); + aItem.Handle = getPredicateType(pCondition->getChild(1)); rFilter.push_back(aItem); } else // kann sich nur um einen Expr. Ausdruck handeln @@ -1242,7 +1239,7 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon pLhs->getChild(i)->parseNodeToPredicateStr( aName, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) ); // Kriterium - aItem.Handle = pCondition->getChild(1)->getNodeType(); + aItem.Handle = getPredicateType(pCondition->getChild(1)); aValue = pCondition->getChild(1)->getTokenValue(); for(i=0;i< pRhs->count();i++) pRhs->getChild(i)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) ); @@ -1483,7 +1480,7 @@ Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getOrderColumns( namespace { - ::rtl::OUString lcl_getCondition(const Sequence< Sequence< PropertyValue > >& filter ) + ::rtl::OUString lcl_getCondition(const Sequence< Sequence< PropertyValue > >& filter,const OPredicateInputController& i_aPredicateInputController,const Reference< XNameAccess >& i_xSelectColumns) { ::rtl::OUStringBuffer sRet; const Sequence< PropertyValue >* pOrIter = filter.getConstArray(); @@ -1500,6 +1497,15 @@ namespace sRet.append(pAndIter->Name); ::rtl::OUString sValue; pAndIter->Value >>= sValue; + if ( i_xSelectColumns.is() && i_xSelectColumns->hasByName(pAndIter->Name) ) + { + Reference<XPropertySet> xColumn(i_xSelectColumns->getByName(pAndIter->Name),UNO_QUERY); + sValue = i_aPredicateInputController.getPredicateValue(sValue,xColumn,sal_True); + } + else + { + sValue = i_aPredicateInputController.getPredicateValue(pAndIter->Name,sValue,sal_True); + } lcl_addFilterCriteria_throw(pAndIter->Handle,sValue,sRet); ++pAndIter; if ( pAndIter != pAndEnd ) @@ -1518,13 +1524,15 @@ namespace void SAL_CALL OSingleSelectQueryComposer::setStructuredFilter( const Sequence< Sequence< PropertyValue > >& filter ) throw (SQLException, ::com::sun::star::lang::IllegalArgumentException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setStructuredFilter" ); - setFilter(lcl_getCondition(filter)); + OPredicateInputController aPredicateInput(m_aContext.getLegacyServiceFactory(),m_xConnection); + setFilter(lcl_getCondition(filter,aPredicateInput,getColumns())); } void SAL_CALL OSingleSelectQueryComposer::setStructuredHavingClause( const Sequence< Sequence< PropertyValue > >& filter ) throw (SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setStructuredHavingClause" ); - setHavingClause(lcl_getCondition(filter)); + OPredicateInputController aPredicateInput(m_aContext.getLegacyServiceFactory(),m_xConnection); + setHavingClause(lcl_getCondition(filter,aPredicateInput,getColumns())); } void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropertySet >& column, sal_Bool andCriteria ,::std::mem_fun1_t<bool,OSingleSelectQueryComposer,::rtl::OUString>& _aSetFunctor,sal_Int32 filterOperator) diff --git a/dbaccess/source/core/dataaccess/SharedConnection.cxx b/dbaccess/source/core/dataaccess/SharedConnection.cxx index f40bdc952..7f2cad014 100644 --- a/dbaccess/source/core/dataaccess/SharedConnection.cxx +++ b/dbaccess/source/core/dataaccess/SharedConnection.cxx @@ -118,6 +118,8 @@ void SAL_CALL OSharedConnection::rollback( ) throw(SQLException, RuntimeExcepti sal_Bool SAL_CALL OSharedConnection::isClosed( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xConnection.is() ) + return sal_True; return m_xConnection->isClosed(); } diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index 1cabbf2c3..334d97135 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -200,7 +200,7 @@ void SAL_CALL FlushNotificationAdapter::disposing( const EventObject& Source ) t if ( xListener.is() ) xListener->disposing( Source ); - impl_dispose( false ); + impl_dispose( true ); } OAuthenticationContinuation::OAuthenticationContinuation() diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx index 4073cb3ba..cf011efbc 100644 --- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx +++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/sdb/XCompletedExecution.hpp> #include <com/sun/star/sdb/CommandType.hpp> +#include <com/sun/star/sdbc/DataType.hpp> #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> @@ -51,6 +52,7 @@ #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/chart/ChartDataRowSource.hpp> #include <com/sun/star/chart/XChartDataArray.hpp> +#include <com/sun/star/chart/XDateCategories.hpp> #include <vector> #include <list> diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 91fc1ab6c..01a4a0d34 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -33,6 +33,7 @@ #include "dbustrings.hrc" #include "advancedsettingsdlg.hxx" #include "subcomponentmanager.hxx" +#include "closeveto.hxx" /** === begin UNO includes === **/ #include <com/sun/star/beans/NamedValue.hpp> @@ -1301,8 +1302,8 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa ::comphelper::NamedValueCollection aCreationArgs; aCreationArgs.put( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, ID_NEW_VIEW_DESIGN == _nId ); - Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); - Reference< XComponent > xComponent( aDesigner.createNew( xDataSource, aCreationArgs ), UNO_QUERY ); + const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); + const Reference< XComponent > xComponent( aDesigner.createNew( xDataSource, aCreationArgs ), UNO_QUERY ); onDocumentOpened( ::rtl::OUString(), E_QUERY, E_OPEN_DESIGN, xComponent, NULL ); } } @@ -1353,8 +1354,8 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa { RelationDesigner aDesigner( getORB(), this, m_aCurrentFrame.getFrame() ); - Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); - Reference< XComponent > xComponent( aDesigner.createNew( xDataSource ), UNO_QUERY ); + const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); + const Reference< XComponent > xComponent( aDesigner.createNew( xDataSource ), UNO_QUERY ); onDocumentOpened( ::rtl::OUString(), SID_DB_APP_DSRELDESIGN, E_OPEN_DESIGN, xComponent, NULL ); } } @@ -1950,6 +1951,9 @@ IMPL_LINK( OApplicationController, OnCreateWithPilot, void*, _pType ) // ----------------------------------------------------------------------------- void OApplicationController::newElementWithPilot( ElementType _eType ) { + CloseVeto aKeepDoc( getFrame() ); + // prevent the document being closed while the wizard is open + OSL_ENSURE( getContainer(), "OApplicationController::newElementWithPilot: without a view?" ); switch ( _eType ) @@ -2708,61 +2712,83 @@ void SAL_CALL OApplicationController::attachFrame( const Reference< XFrame > & i sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > & _rxModel) throw( RuntimeException ) { ::osl::MutexGuard aGuard( getMutex() ); - Reference< XOfficeDatabaseDocument > xOfficeDoc( _rxModel, UNO_QUERY ); - if ( !xOfficeDoc.is() && _rxModel.is() ) + const Reference< XOfficeDatabaseDocument > xOfficeDoc( _rxModel, UNO_QUERY ); + const Reference< XModifiable > xDocModify( _rxModel, UNO_QUERY ); + if ( ( !xOfficeDoc.is() || !xDocModify.is() ) && _rxModel.is() ) { OSL_FAIL( "OApplicationController::attachModel: invalid model!" ); return sal_False; } - OSL_ENSURE( !( m_xModel.is() && ( m_xModel != _rxModel ) ), - "OApplicationController::attachModel: missing implementation: setting a new model while we have another one!" ); - // at least: remove as property change listener from the old model/data source + if ( m_xModel.is() && ( m_xModel != _rxModel ) && ( _rxModel.is() ) ) + { + OSL_ENSURE( false, "OApplicationController::attachModel: missing implementation: setting a new model while we have another one!" ); + // we'd need to completely update our view here, close sub components, and the like + return sal_False; + } + + const ::rtl::OUString aPropertyNames[] = + { + PROPERTY_URL, PROPERTY_USER + }; + + // disconnect from old model + try + { + if ( m_xDataSource.is() ) + { + for ( size_t i=0; i < sizeof( aPropertyNames ) / sizeof( aPropertyNames[0] ); ++i ) + { + m_xDataSource->removePropertyChangeListener( aPropertyNames[i], this ); + } + } + + Reference< XModifyBroadcaster > xBroadcaster( m_xModel, UNO_QUERY ); + if ( xBroadcaster.is() ) + xBroadcaster->removeModifyListener( this ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } m_xModel = _rxModel; - if ( m_xModel.is() ) + m_xDocumentModify = xDocModify; + m_xDataSource.set( xOfficeDoc.is() ? xOfficeDoc->getDataSource() : Reference< XDataSource >(), UNO_QUERY ); + + // connect to new model + try { - m_xDocumentModify.set( m_xModel, UNO_QUERY_THROW ); + if ( m_xDataSource.is() ) + { + for ( size_t i=0; i < sizeof( aPropertyNames ) / sizeof( aPropertyNames[0] ); ++i ) + { + m_xDataSource->addPropertyChangeListener( aPropertyNames[i], this ); + } + } + + Reference< XModifyBroadcaster > xBroadcaster( m_xModel, UNO_QUERY_THROW ); + xBroadcaster->addModifyListener( this ); + } - else + catch( const Exception& ) { - m_xDocumentModify.clear(); + DBG_UNHANDLED_EXCEPTION(); } - m_xDataSource.set(xOfficeDoc.is() ? xOfficeDoc->getDataSource() : Reference<XDataSource>(),UNO_QUERY); + // initial preview mode if ( m_xDataSource.is() ) { try { - m_xDataSource->addPropertyChangeListener(PROPERTY_INFO, this); - m_xDataSource->addPropertyChangeListener(PROPERTY_URL, this); - m_xDataSource->addPropertyChangeListener(PROPERTY_ISPASSWORDREQUIRED, this); - m_xDataSource->addPropertyChangeListener(PROPERTY_LAYOUTINFORMATION, this); - m_xDataSource->addPropertyChangeListener(PROPERTY_SUPPRESSVERSIONCL, this); - m_xDataSource->addPropertyChangeListener(PROPERTY_TABLEFILTER, this); - m_xDataSource->addPropertyChangeListener(PROPERTY_TABLETYPEFILTER, this); - m_xDataSource->addPropertyChangeListener(PROPERTY_USER, this); // to get the 'modified' for the data source - Reference< XModifyBroadcaster > xBroadcaster(m_xModel, UNO_QUERY); - if ( xBroadcaster.is() ) - xBroadcaster->addModifyListener(static_cast<XModifyListener*>(this)); - - Sequence<PropertyValue> aFields; - m_xDataSource->getPropertyValue(PROPERTY_LAYOUTINFORMATION) >>= aFields; - PropertyValue *pIter = aFields.getArray(); - PropertyValue *pEnd = pIter + aFields.getLength(); - for (; pIter != pEnd && pIter->Name != INFO_PREVIEW; ++pIter) - ; - - if ( pIter != pEnd ) + ::comphelper::NamedValueCollection aLayoutInfo( m_xDataSource->getPropertyValue( PROPERTY_LAYOUTINFORMATION ) ); + if ( aLayoutInfo.has( (rtl::OUString)INFO_PREVIEW ) ) { - sal_Int32 nValue = 0; - pIter->Value >>= nValue; - m_ePreviewMode = static_cast<PreviewMode>(nValue); + const sal_Int32 nPreviewMode( aLayoutInfo.getOrDefault( (rtl::OUString)INFO_PREVIEW, (sal_Int32)0 ) ); + m_ePreviewMode = static_cast< PreviewMode >( nPreviewMode ); if ( getView() ) - { - getContainer()->switchPreview(m_ePreviewMode); - } + getContainer()->switchPreview( m_ePreviewMode ); } } catch( const Exception& ) diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index a313570dc..077394437 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -658,7 +658,6 @@ void OApplicationController::askToReconnect() void OApplicationController::onDocumentOpened( const ::rtl::OUString& _rName, const sal_Int32 _nType, const ElementOpenMode _eMode, const Reference< XComponent >& _xDocument, const Reference< XComponent >& _rxDefinition ) { - OSL_PRECOND( _xDocument.is(), "OApplicationController::onDocumentOpened: illegal document!" ); if ( !_xDocument.is() ) return; diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx index 37a2368bd..21fe3cab5 100644 --- a/dbaccess/source/ui/app/AppDetailView.cxx +++ b/dbaccess/source/ui/app/AppDetailView.cxx @@ -54,6 +54,7 @@ #include <algorithm> #include "dbtreelistbox.hxx" #include "IApplicationController.hxx" +#include "imageprovider.hxx" using namespace ::dbaui; using namespace ::com::sun::star::uno; @@ -90,6 +91,7 @@ OCreationList::OCreationList( OTasksWindow& _rParent ) SetSpaceBetweenEntries(nSize); SetSelectionMode( NO_SELECTION ); SetExtendedWinBits( EWB_NO_AUTO_CURENTRY ); + SetNodeDefaultImages( ); EnableEntryMnemonics(); } // ----------------------------------------------------------------------------- @@ -367,6 +369,12 @@ OTasksWindow::OTasksWindow(Window* _pParent,OApplicationDetailView* _pDetailView m_aHelpText.SetHelpId(HID_APP_HELP_TEXT); m_aDescription.SetHelpId(HID_APP_DESCRIPTION_TEXT); m_aDescription.SetText(ModuleRes(STR_DESCRIPTION)); + + ImageProvider aImageProvider; + Image aFolderImage = aImageProvider.getFolderImage( DatabaseObject::FORM ); + m_aCreation.SetDefaultCollapsedEntryBmp( aFolderImage ); + m_aCreation.SetDefaultExpandedEntryBmp( aFolderImage ); + ImplInitSettings(sal_True,sal_True,sal_True); } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/app/app.src b/dbaccess/source/ui/app/app.src index 647d85a31..92c0e3ebc 100644 --- a/dbaccess/source/ui/app/app.src +++ b/dbaccess/source/ui/app/app.src @@ -261,19 +261,19 @@ Menu RID_MENU_APP_EDIT MenuItem { Identifier = SID_DB_APP_DSPROPS; - Text[ en-US ] = "Properties"; + Text[ en-US ] = "Properties..."; Command = ".uno:DBDSProperties"; }; MenuItem { Identifier = SID_DB_APP_DSCONNECTION_TYPE; - Text[ en-US ] = "Connection Type"; + Text[ en-US ] = "Connection Type..."; Command = ".uno:DBDSConnectionType"; }; MenuItem { Identifier = SID_DB_APP_DSADVANCED_SETTINGS; - Text[ en-US ] = "Advanced Settings"; + Text[ en-US ] = "Advanced Settings..."; Command = ".uno:DBDSAdvancedSettings"; }; }; diff --git a/dbaccess/source/ui/app/closeveto.cxx b/dbaccess/source/ui/app/closeveto.cxx new file mode 100644 index 000000000..558df26b6 --- /dev/null +++ b/dbaccess/source/ui/app/closeveto.cxx @@ -0,0 +1,180 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_dbaccess.hxx" + +#include "closeveto.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/util/XCloseable.hpp> +/** === end UNO includes === **/ + +#include <cppuhelper/implbase1.hxx> +#include <rtl/ref.hxx> +#include <tools/diagnose_ex.h> + +//...................................................................................................................... +namespace dbaui +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::util::XCloseable; + using ::com::sun::star::util::XCloseListener; + using ::com::sun::star::util::CloseVetoException; + using ::com::sun::star::lang::EventObject; + /** === end UNO using === **/ + + //================================================================================================================== + //= CloseListener_Impl + //================================================================================================================== + typedef ::cppu::WeakImplHelper1 < XCloseListener + > CloseListener_Base; + class DBACCESS_DLLPRIVATE CloseListener_Impl : public CloseListener_Base + { + public: + CloseListener_Impl() + :m_bHasOwnership( false ) + { + } + + // XCloseListener + virtual void SAL_CALL queryClosing( const EventObject& Source, ::sal_Bool GetsOwnership ) throw (CloseVetoException, RuntimeException); + virtual void SAL_CALL notifyClosing( const EventObject& Source ) throw (RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const EventObject& Source) throw (RuntimeException); + + bool hasOwnership() const { return m_bHasOwnership; } + + protected: + ~CloseListener_Impl() + { + } + + private: + bool m_bHasOwnership; + }; + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL CloseListener_Impl::queryClosing( const EventObject& i_source, ::sal_Bool i_deliverOwnership ) throw (CloseVetoException, RuntimeException) + { + (void)i_source; + + if ( !m_bHasOwnership ) + m_bHasOwnership = i_deliverOwnership; + + throw CloseVetoException(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL CloseListener_Impl::notifyClosing( const EventObject& i_source ) throw (RuntimeException) + { + (void)i_source; + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL CloseListener_Impl::disposing( const EventObject& i_source ) throw (RuntimeException) + { + (void)i_source; + } + + //================================================================================================================== + //= CloseVeto_Data + //================================================================================================================== + struct DBACCESS_DLLPRIVATE CloseVeto_Data + { + Reference< XCloseable > xCloseable; + ::rtl::Reference< CloseListener_Impl > pListener; + }; + + //================================================================================================================== + //= operations + //================================================================================================================== + namespace + { + //-------------------------------------------------------------------------------------------------------------- + void lcl_init( CloseVeto_Data& i_data, const Reference< XInterface >& i_closeable ) + { + i_data.xCloseable.set( i_closeable, UNO_QUERY ); + ENSURE_OR_RETURN_VOID( i_data.xCloseable.is(), "CloseVeto: the component is not closeable!" ); + + i_data.pListener = new CloseListener_Impl; + i_data.xCloseable->addCloseListener( i_data.pListener.get() ); + } + + //-------------------------------------------------------------------------------------------------------------- + void lcl_deinit( CloseVeto_Data& i_data ) + { + if ( !i_data.xCloseable.is() ) + return; + + i_data.xCloseable->removeCloseListener( i_data.pListener.get() ); + if ( i_data.pListener->hasOwnership() ) + { + try + { + i_data.xCloseable->close( sal_True ); + } + catch( const CloseVetoException& ) { } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + } + } + + //================================================================================================================== + //= CloseVeto + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + CloseVeto::CloseVeto( const Reference< XInterface >& i_closeable ) + :m_pData( new CloseVeto_Data ) + { + lcl_init( *m_pData, i_closeable ); + } + + //------------------------------------------------------------------------------------------------------------------ + CloseVeto::~CloseVeto() + { + lcl_deinit( *m_pData ); + } + +//...................................................................................................................... +} // namespace dbaui +//...................................................................................................................... diff --git a/dbaccess/source/ui/app/closeveto.hxx b/dbaccess/source/ui/app/closeveto.hxx new file mode 100644 index 000000000..f7e1c8364 --- /dev/null +++ b/dbaccess/source/ui/app/closeveto.hxx @@ -0,0 +1,67 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef DBACCESS_CLOSEVETO_HXX +#define DBACCESS_CLOSEVETO_HXX + +#include "dbaccessdllapi.h" + +/** === begin UNO includes === **/ +#include <com/sun/star/uno/XInterface.hpp> +/** === end UNO includes === **/ + +#include <boost/scoped_ptr.hpp> + +//...................................................................................................................... +namespace dbaui +{ +//...................................................................................................................... + + //================================================================================================================== + //= CloseVeto + //================================================================================================================== + struct CloseVeto_Data; + /** will add a XCloseListener to a given component, and veto its closing as long as the <code>CloseVeto</code> + instance is alive. + + If closing has been requested and vetoed while the <code>CloseVeto</code> instance is alive, and the ownership + went to the <code>CloseVeto</code> instance, then it will close the component in its dtor. + */ + class DBACCESS_DLLPRIVATE CloseVeto + { + public: + CloseVeto( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_closeable ); + ~CloseVeto(); + + private: + ::boost::scoped_ptr< CloseVeto_Data > m_pData; + }; + +//...................................................................................................................... +} // namespace dbaui +//...................................................................................................................... + +#endif // DBACCESS_CLOSEVETO_HXX diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index 68d618e49..fab11234a 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -738,7 +738,7 @@ sal_Bool SbaXDataBrowserController::reloadForm( const Reference< XLoadable >& _r const Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); if (::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING))) xFormSet->getPropertyValue(PROPERTY_SINGLESELECTQUERYCOMPOSER) >>= m_xParser; - +#if 0 { const Reference< XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY ); const Reference< XSingleSelectQueryAnalyzer > xAnalyzer( xRowSetProps->getPropertyValue( PROPERTY_SINGLESELECTQUERYCOMPOSER ), UNO_QUERY ); @@ -758,15 +758,23 @@ sal_Bool SbaXDataBrowserController::reloadForm( const Reference< XLoadable >& _r } } } +#endif Reference< XWarningsSupplier > xWarnings( _rxLoadable, UNO_QUERY ); if ( xWarnings.is() ) { - SQLExceptionInfo aInfo( xWarnings->getWarnings() ); - if ( aInfo.isValid() ) + try + { + SQLExceptionInfo aInfo( xWarnings->getWarnings() ); + if ( aInfo.isValid() ) + { + showError( aInfo ); + impl_checkForCannotSelectUnfiltered( aInfo ); + } + } + catch(const SQLException& e) { - showError( aInfo ); - impl_checkForCannotSelectUnfiltered( aInfo ); + (void)e; } } diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index 1602758bb..28fa67f6f 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -896,6 +896,9 @@ void OGenericUnoController::disposing() m_xMasterDispatcher = NULL; m_xSlaveDispatcher = NULL; m_xServiceFactory = NULL; + m_xTitleHelper.clear(); + m_xUrlTransformer.clear(); + m_aInitParameters.clear(); } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 9f2d455a4..e8d78b42a 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -470,7 +470,7 @@ void SbaTableQueryBrowser::impl_sanitizeRowSetClauses_nothrow() // check if the order columns apply to tables which really exist in the statement const Reference< XIndexAccess > xOrderColumns( xComposer->getOrderColumns(), UNO_SET_THROW ); const sal_Int32 nOrderColumns( xOrderColumns->getCount() ); - bool invalidColumn = false; + bool invalidColumn = nOrderColumns == 0; for ( sal_Int32 c=0; ( c < nOrderColumns ) && !invalidColumn; ++c ) { const Reference< XPropertySet > xOrderColumn( xOrderColumns->getByIndex(c), UNO_QUERY_THROW ); @@ -2697,6 +2697,8 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry ) sStatus.SearchAndReplaceAscii("$name$", aName); BrowserViewStatusDisplay aShowStatus(static_cast<UnoDataBrowserView*>(getView()), sStatus); + + sal_Bool bEscapeProcessing = sal_True; if(xNameAccess.is() && xNameAccess->hasByName(sSimpleName)) { DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(_pEntry->GetUserData()); @@ -2707,38 +2709,42 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry ) { pData->xObjectProperties = pData->xObjectProperties.query( xObject ); // if the query contains a parameterized statement and preview is enabled we won't get any data. - if ( m_bPreview && nCommandType == CommandType::QUERY && xObject.is() ) + if ( nCommandType == CommandType::QUERY && xObject.is() ) { - ::rtl::OUString sSql; Reference<XPropertySet> xObjectProps(xObject,UNO_QUERY); - xObjectProps->getPropertyValue(PROPERTY_COMMAND) >>= sSql; - Reference< XMultiServiceFactory > xFactory( pConData->xConnection, UNO_QUERY ); - if (xFactory.is()) + xObjectProps->getPropertyValue(PROPERTY_ESCAPE_PROCESSING) >>= bEscapeProcessing; + if ( m_bPreview ) { - try + ::rtl::OUString sSql; + xObjectProps->getPropertyValue(PROPERTY_COMMAND) >>= sSql; + Reference< XMultiServiceFactory > xFactory( pConData->xConnection, UNO_QUERY ); + if (xFactory.is()) { - Reference<XSingleSelectQueryAnalyzer> xAnalyzer(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY); - if ( xAnalyzer.is() ) + try { - xAnalyzer->setQuery(sSql); - Reference<XParametersSupplier> xParSup(xAnalyzer,UNO_QUERY); - if ( xParSup->getParameters()->getCount() > 0 ) + Reference<XSingleSelectQueryAnalyzer> xAnalyzer(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY); + if ( xAnalyzer.is() ) { - String sFilter = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" WHERE ")); - sFilter = sFilter + xAnalyzer->getFilter(); - String sReplace(sSql); - sReplace.SearchAndReplace(sFilter,String()); - xAnalyzer->setQuery(sReplace); - Reference<XSingleSelectQueryComposer> xComposer(xAnalyzer,UNO_QUERY); - xComposer->setFilter(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0=1"))); - aName = xAnalyzer->getQuery(); - nCommandType = CommandType::COMMAND; + xAnalyzer->setQuery(sSql); + Reference<XParametersSupplier> xParSup(xAnalyzer,UNO_QUERY); + if ( xParSup->getParameters()->getCount() > 0 ) + { + String sFilter = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" WHERE ")); + sFilter = sFilter + xAnalyzer->getFilter(); + String sReplace(sSql); + sReplace.SearchAndReplace(sFilter,String()); + xAnalyzer->setQuery(sReplace); + Reference<XSingleSelectQueryComposer> xComposer(xAnalyzer,UNO_QUERY); + xComposer->setFilter(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0=1"))); + aName = xAnalyzer->getQuery(); + nCommandType = CommandType::COMMAND; + } } } - } - catch (Exception&) - { - DBG_UNHANDLED_EXCEPTION(); + catch (Exception&) + { + DBG_UNHANDLED_EXCEPTION(); + } } } } @@ -2747,7 +2753,7 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry ) } String sDataSourceName( getDataSourceAcessor( pConnection ) ); - bSuccess = implLoadAnything( sDataSourceName, aName, nCommandType, sal_True, pConData->xConnection ); + bSuccess = implLoadAnything( sDataSourceName, aName, nCommandType, bEscapeProcessing, pConData->xConnection ); if ( !bSuccess ) { // clean up criticalFail(); diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx index f5fc78b6d..671f909c9 100644 --- a/dbaccess/source/ui/control/FieldDescControl.cxx +++ b/dbaccess/source/ui/control/FieldDescControl.cxx @@ -1680,35 +1680,7 @@ void OFieldDescControl::SaveData( OFieldDescription* pFieldDescr ) } if ( sDefault.getLength() ) - { - sal_uInt32 nFormatKey; - try - { - if ( isTextFormat(pFieldDescr,nFormatKey) || pBoolDefault ) - { - pFieldDescr->SetControlDefault(makeAny(sDefault)); - } - else - { - try - { - double nValue = GetFormatter()->convertStringToNumber(nFormatKey,sDefault); - nValue = checkDoubleForDateFormat(nValue,nFormatKey,GetFormatter()); - pFieldDescr->SetControlDefault(makeAny(nValue)); - } - catch(const Exception&) - { - if ( sDefault.getLength() ) - pFieldDescr->SetControlDefault(makeAny(sDefault)); - else - pFieldDescr->SetControlDefault(Any()); - } - } - } - catch(const Exception&) - { - } - } + pFieldDescr->SetControlDefault(makeAny(sDefault)); else pFieldDescr->SetControlDefault(Any()); diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index b14f4783f..9a08090ff 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -208,6 +208,8 @@ ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper(const Refer m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_DOSLINEENDS, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PreferDosLikeLineEnds" ) ) ) ); m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_CONN_SOCKET, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LocalSocket" ) ) ) ); m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_NAMED_PIPE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NamedPipe" ) ) ) ); + m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_RESPECTRESULTSETTYPE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RespectDriverResultSetType" ) ) ) ); + m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_MAX_ROW_SCAN, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxRowScan" ) ) ) ); // special settings for adabas m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_CONN_SHUTSERVICE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShutdownDatabase")))); diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx index 1bb172e00..6fa8b0f49 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.cxx +++ b/dbaccess/source/ui/dlg/advancedsettings.cxx @@ -96,6 +96,7 @@ namespace dbaui ,m_pIgnoreCurrency(NULL) ,m_pEscapeDateTime(NULL) ,m_pPrimaryKeySupport(NULL) + ,m_pRespectDriverResultSetType(NULL) ,m_pBooleanComparisonModeLabel( NULL ) ,m_pBooleanComparisonMode( NULL ) ,m_pMaxRowScanLabel( NULL ) @@ -207,6 +208,7 @@ namespace dbaui DELETEZ( m_pIgnoreCurrency ); DELETEZ( m_pEscapeDateTime ); DELETEZ( m_pPrimaryKeySupport ); + DELETEZ( m_pRespectDriverResultSetType ); DELETEZ( m_pBooleanComparisonModeLabel ); DELETEZ( m_pBooleanComparisonMode ); DELETEZ( m_pMaxRowScanLabel ); @@ -220,21 +222,22 @@ namespace dbaui // for easier maintainance, write the table in this form, then copy it to m_aBooleanSettings BooleanSettingDesc aSettings[] = { - { &m_pIsSQL92Check, CB_SQL92CHECK, DSID_SQL92CHECK, false }, - { &m_pAppendTableAlias, CB_APPENDTABLEALIAS, DSID_APPEND_TABLE_ALIAS, false }, - { &m_pAsBeforeCorrelationName, CB_AS_BEFORE_CORR_NAME, DSID_AS_BEFORE_CORRNAME, false }, - { &m_pEnableOuterJoin, CB_ENABLEOUTERJOIN, DSID_ENABLEOUTERJOIN, false }, - { &m_pIgnoreDriverPrivileges, CB_IGNOREDRIVER_PRIV, DSID_IGNOREDRIVER_PRIV, false }, - { &m_pParameterSubstitution, CB_PARAMETERNAMESUBST, DSID_PARAMETERNAMESUBST, false }, - { &m_pSuppressVersionColumn, CB_SUPPRESVERSIONCL, DSID_SUPPRESSVERSIONCL, true }, - { &m_pCatalog, CB_CATALOG, DSID_CATALOG, false }, - { &m_pSchema, CB_SCHEMA, DSID_SCHEMA, false }, - { &m_pIndexAppendix, CB_IGNOREINDEXAPPENDIX, DSID_INDEXAPPENDIX, false }, - { &m_pDosLineEnds, CB_DOSLINEENDS, DSID_DOSLINEENDS, false }, - { &m_pCheckRequiredFields, CB_CHECK_REQUIRED, DSID_CHECK_REQUIRED_FIELDS, false }, - { &m_pIgnoreCurrency, CB_IGNORECURRENCY, DSID_IGNORECURRENCY, false }, - { &m_pEscapeDateTime, CB_ESCAPE_DATETIME, DSID_ESCAPE_DATETIME, false }, - { &m_pPrimaryKeySupport, CB_PRIMARY_KEY_SUPPORT, DSID_PRIMARY_KEY_SUPPORT, false }, + { &m_pIsSQL92Check, CB_SQL92CHECK, DSID_SQL92CHECK, false }, + { &m_pAppendTableAlias, CB_APPENDTABLEALIAS, DSID_APPEND_TABLE_ALIAS, false }, + { &m_pAsBeforeCorrelationName, CB_AS_BEFORE_CORR_NAME, DSID_AS_BEFORE_CORRNAME, false }, + { &m_pEnableOuterJoin, CB_ENABLEOUTERJOIN, DSID_ENABLEOUTERJOIN, false }, + { &m_pIgnoreDriverPrivileges, CB_IGNOREDRIVER_PRIV, DSID_IGNOREDRIVER_PRIV, false }, + { &m_pParameterSubstitution, CB_PARAMETERNAMESUBST, DSID_PARAMETERNAMESUBST, false }, + { &m_pSuppressVersionColumn, CB_SUPPRESVERSIONCL, DSID_SUPPRESSVERSIONCL, true }, + { &m_pCatalog, CB_CATALOG, DSID_CATALOG, false }, + { &m_pSchema, CB_SCHEMA, DSID_SCHEMA, false }, + { &m_pIndexAppendix, CB_IGNOREINDEXAPPENDIX, DSID_INDEXAPPENDIX, false }, + { &m_pDosLineEnds, CB_DOSLINEENDS, DSID_DOSLINEENDS, false }, + { &m_pCheckRequiredFields, CB_CHECK_REQUIRED, DSID_CHECK_REQUIRED_FIELDS, false }, + { &m_pIgnoreCurrency, CB_IGNORECURRENCY, DSID_IGNORECURRENCY, false }, + { &m_pEscapeDateTime, CB_ESCAPE_DATETIME, DSID_ESCAPE_DATETIME, false }, + { &m_pPrimaryKeySupport, CB_PRIMARY_KEY_SUPPORT, DSID_PRIMARY_KEY_SUPPORT, false }, + { &m_pRespectDriverResultSetType, CB_RESPECTRESULTSETTYPE,DSID_RESPECTRESULTSETTYPE, false }, { NULL, 0, 0, false } }; diff --git a/dbaccess/source/ui/dlg/advancedsettings.hrc b/dbaccess/source/ui/dlg/advancedsettings.hrc index 320683897..389afea6a 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.hrc +++ b/dbaccess/source/ui/dlg/advancedsettings.hrc @@ -62,6 +62,7 @@ #define CB_IGNORECURRENCY 14 #define CB_ESCAPE_DATETIME 15 #define CB_PRIMARY_KEY_SUPPORT 16 +#define CB_RESPECTRESULTSETTYPE 17 #define ET_AUTOINCREMENTVALUE 1 #define ET_RETRIEVE_AUTO 2 diff --git a/dbaccess/source/ui/dlg/advancedsettings.hxx b/dbaccess/source/ui/dlg/advancedsettings.hxx index 342247ecb..e5e9cfcf9 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.hxx +++ b/dbaccess/source/ui/dlg/advancedsettings.hxx @@ -74,6 +74,7 @@ namespace dbaui CheckBox* m_pIgnoreCurrency; CheckBox* m_pEscapeDateTime; CheckBox* m_pPrimaryKeySupport; + CheckBox* m_pRespectDriverResultSetType; FixedText* m_pBooleanComparisonModeLabel; ListBox* m_pBooleanComparisonMode; diff --git a/dbaccess/source/ui/dlg/advancedsettings.src b/dbaccess/source/ui/dlg/advancedsettings.src index afff07fc7..360bde979 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.src +++ b/dbaccess/source/ui/dlg/advancedsettings.src @@ -217,6 +217,16 @@ Text [ en-US ] = "Supports primary keys"; \ }; +#define AUTO_RESPECTRESULTSETTYPE(AUTO_Y) \ + CheckBox CB_RESPECTRESULTSETTYPE \ + { \ + Pos = MAP_APPFONT ( 6 , AUTO_Y ) ; \ + Size = MAP_APPFONT ( ADVANCED_PAGE_X - 12 , CHECKBOX_HEIGHT ) ; \ + TabStop = TRUE ; \ + HelpId = HID_DSADMIN_RESPECTRESULTSETTYPE; \ + Text [ en-US ] = "Respect the result set type from the database driver"; \ + }; + //------------------------------------------------------------------------- @@ -351,8 +361,9 @@ TabPage PAGE_ADVANCED_SETTINGS_SPECIAL AUTO_IGNORECURRENCY( 13*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 12*CHECKBOX_HEIGHT + RELATED_CONTROLS ) AUTO_ESCAPE_DATETIME( 14*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 14*CHECKBOX_HEIGHT + RELATED_CONTROLS ) AUTO_PRIMARY_KEY_SUPPORT( 15*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 15*CHECKBOX_HEIGHT + RELATED_CONTROLS ) - AUTO_BOOLEANCOMPARISON( 16*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 14*CHECKBOX_HEIGHT + RELATED_CONTROLS + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 ) - AUTO_MAXROWSCAN( 17*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 14*CHECKBOX_HEIGHT + RELATED_CONTROLS + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 ) + AUTO_RESPECTRESULTSETTYPE( 16*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 16*CHECKBOX_HEIGHT + RELATED_CONTROLS ) + AUTO_BOOLEANCOMPARISON( 17*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 15*CHECKBOX_HEIGHT + RELATED_CONTROLS + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 ) + AUTO_MAXROWSCAN( 18*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 15*CHECKBOX_HEIGHT + RELATED_CONTROLS + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 ) }; //------------------------------------------------------------------------- @@ -382,5 +393,5 @@ TabDialog DLG_DATABASE_ADVANCED Text [ en-US ] = "Special Settings"; }; - Text [ en-US ] = "Advanced Properties" ; + Text [ en-US ] = "Advanced Settings" ; }; diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx index 90d679328..0b4f5e6e8 100644 --- a/dbaccess/source/ui/dlg/dbadmin.cxx +++ b/dbaccess/source/ui/dlg/dbadmin.cxx @@ -410,6 +410,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp *pCounter++ = new SfxStringItem(DSID_NAMED_PIPE, String()); *pCounter++ = new OptionalBoolItem( DSID_PRIMARY_KEY_SUPPORT ); *pCounter++ = new SfxInt32Item(DSID_MAX_ROW_SCAN, 100); + *pCounter++ = new SfxBoolItem( DSID_RESPECTRESULTSETTYPE,sal_False ); // create the pool static SfxItemInfo const aItemInfos[DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1] = @@ -473,6 +474,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp {0,0}, {0,0}, {0,0}, + {0,0}, {0,0} }; diff --git a/dbaccess/source/ui/inc/dbu_qry.hrc b/dbaccess/source/ui/inc/dbu_qry.hrc index 04b2daa5d..e64a360dd 100644 --- a/dbaccess/source/ui/inc/dbu_qry.hrc +++ b/dbaccess/source/ui/inc/dbu_qry.hrc @@ -56,8 +56,8 @@ #define STR_QUERY_NOTABLE RID_STR_QRY_START + 21 #define STR_QRY_ORDERBY_UNRELATED RID_STR_QRY_START + 22 #define STR_QUERY_HANDLETEXT RID_STR_QRY_START + 23 -#define STR_QUERY_FALSE RID_STR_QRY_START + 24 -#define STR_QUERY_TRUE RID_STR_QRY_START + 25 +// free +// free #define STR_QRY_TOO_MANY_COLUMNS RID_STR_QRY_START + 26 #define STR_SVT_SQL_SYNTAX_ERROR RID_STR_QRY_START + 27 #define STR_QUERYDESIGN_NO_VIEW_SUPPORT RID_STR_QRY_START + 28 diff --git a/dbaccess/source/ui/inc/dsitems.hxx b/dbaccess/source/ui/inc/dsitems.hxx index 99cc689a2..425d04a2f 100644 --- a/dbaccess/source/ui/inc/dsitems.hxx +++ b/dbaccess/source/ui/inc/dsitems.hxx @@ -94,6 +94,7 @@ typedef sal_Int32 ItemID; #define DSID_NAMED_PIPE 58 #define DSID_PRIMARY_KEY_SUPPORT 59 #define DSID_MAX_ROW_SCAN 60 +#define DSID_RESPECTRESULTSETTYPE 61 // don't forget to adjust DSID_LAST_ITEM_ID below! @@ -101,7 +102,7 @@ typedef sal_Int32 ItemID; //= item range. Adjust this if you introduce new items above #define DSID_FIRST_ITEM_ID DSID_NAME -#define DSID_LAST_ITEM_ID DSID_MAX_ROW_SCAN +#define DSID_LAST_ITEM_ID DSID_RESPECTRESULTSETTYPE #endif // _DBAUI_DATASOURCEITEMS_HXX_ diff --git a/dbaccess/source/ui/inc/dsmeta.hxx b/dbaccess/source/ui/inc/dsmeta.hxx index 67c17ff68..6d2ed5ed3 100644 --- a/dbaccess/source/ui/inc/dsmeta.hxx +++ b/dbaccess/source/ui/inc/dsmeta.hxx @@ -134,6 +134,7 @@ namespace dbaui || has( DSID_ESCAPE_DATETIME ) || has( DSID_PRIMARY_KEY_SUPPORT ) || has( DSID_MAX_ROW_SCAN ) + || has( DSID_RESPECTRESULTSETTYPE ) ; } diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index 2ab18233e..155d34905 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -446,7 +446,8 @@ sal_Int16 ODatabaseExport::CheckString(const String& aCheckToken, sal_Int16 _nOl if ( eNumLang != LANGUAGE_NONE ) { nFormatKey = m_pFormatter->GetFormatForLanguageIfBuiltIn( nFormatKey, eNumLang ); - m_pFormatter->IsNumberFormat( m_sTextToken, nFormatKey, fOutNumber ); + if ( !m_pFormatter->IsNumberFormat( m_sTextToken, nFormatKey, fOutNumber ) ) + return NumberFormat::TEXT; } Reference<XPropertySet> xProp = xFormats->getByKey(nFormatKey); xProp->getPropertyValue(PROPERTY_TYPE) >>= nNumberFormat; diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx index bc47936e7..e78f15bd5 100644 --- a/dbaccess/source/ui/misc/databaseobjectview.cxx +++ b/dbaccess/source/ui/misc/databaseobjectview.cxx @@ -163,9 +163,6 @@ namespace dbaui 0, i_rDispatchArgs.getPropertyValues() ); - - if ( !xReturn.is() ) - xReturn.set( m_xFrameLoader, UNO_QUERY ); } catch( const Exception& ) { diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx index 35f68b0e0..56bdf3802 100644 --- a/dbaccess/source/ui/misc/dsmeta.cxx +++ b/dbaccess/source/ui/misc/dsmeta.cxx @@ -94,6 +94,7 @@ namespace dbaui { DSID_IGNORECURRENCY, "IgnoreCurrency" }, { DSID_ESCAPE_DATETIME, "EscapeDateTime" }, { DSID_PRIMARY_KEY_SUPPORT, "PrimaryKeySupport" }, + { DSID_RESPECTRESULTSETTYPE, "RespectDriverResultSetType" }, { DSID_MAX_ROW_SCAN, "MaxRowScan" }, { 0, NULL } }; diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index be5658044..18bca373f 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -1982,6 +1982,13 @@ namespace break; } + const OSQLParseNode* pTableExp = pParseTree->getChild(3); + if ( pTableExp->getChild(6)->count() > 0 || pTableExp->getChild(7)->count() > 0 || pTableExp->getChild(8)->count() > 0) + { + eErrorCode = eStatementTooComplex; + break; + } + Reference< XConnection> xConnection = rController.getConnection(); if ( !xConnection.is() ) { @@ -2063,7 +2070,7 @@ namespace pTableView->RemoveTabWin(aIterTableMap->second); } - if ( eOk == (eErrorCode = FillOuterJoins(_pView,pParseTree->getChild(3)->getChild(0)->getChild(1))) ) + if ( eOk == (eErrorCode = FillOuterJoins(_pView,pTableExp->getChild(0)->getChild(1))) ) { // check if we have a distinct statement if(SQL_ISTOKEN(pParseTree->getChild(1),DISTINCT)) @@ -2405,9 +2412,10 @@ namespace { OQueryController& rController = static_cast<OQueryController&>(_pView->getController()); ::connectivity::OSQLParseNode* pGroupBy = pSelectRoot->getChild(3)->getChild(2)->getChild(2); - OTableFieldDescRef aDragInfo = new OTableFieldDesc(); + for( sal_uInt32 i=0 ; i < pGroupBy->count() && eOk == eErrorCode; ++i ) { + OTableFieldDescRef aDragInfo = new OTableFieldDesc(); ::connectivity::OSQLParseNode* pParamRef = NULL; ::connectivity::OSQLParseNode* pArgument = pGroupBy->getChild( i ); if(SQL_ISRULE(pArgument,column_ref)) diff --git a/dbaccess/source/ui/querydesign/query.src b/dbaccess/source/ui/querydesign/query.src index aae5a0754..e5d4b4d96 100644 --- a/dbaccess/source/ui/querydesign/query.src +++ b/dbaccess/source/ui/querydesign/query.src @@ -280,15 +280,7 @@ ErrorBox ERR_QRY_ORDERBY_ON_ASTERISK Message [ en-US ] = "[*] cannot be used as a sort criterion."; }; -String STR_QUERY_TRUE -{ - Text [ en-US ] = "TRUE" ; -}; -String STR_QUERY_FALSE -{ - Text [ en-US ] = "FALSE" ; -}; String STR_QRY_TOO_MANY_TABLES { diff --git a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx index 7f868b106..10aeb2f16 100644 --- a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx +++ b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx @@ -610,6 +610,7 @@ TOTypeInfoSP OFieldDescription::getSpecialTypeInfo() const *pSpecialType = *m_pType; pSpecialType->nPrecision = GetPrecision(); pSpecialType->nMaximumScale = static_cast<sal_Int16>(GetScale()); + pSpecialType->bAutoIncrement = IsAutoIncrement(); // http://dba.openoffice.org/issues/show_bug.cgi?id=115398 fixed by ludob return pSpecialType; } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index 2e83b6c8f..76bc93c3a 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -387,18 +387,14 @@ void OTableEditorCtrl::PaintCell(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const { DBG_CHKTHIS(OTableEditorCtrl,NULL); - String aText( GetCellText( m_nCurrentPos, nColumnId )); - Point aPos(rRect.TopLeft()); - Size TxtSize(GetDataWindow().GetTextWidth(aText), GetDataWindow().GetTextHeight()); + const String aText( GetCellText( m_nCurrentPos, nColumnId )); + const Point aPos(rRect.TopLeft()); + const Size TxtSize(GetDataWindow().GetTextWidth(aText), GetDataWindow().GetTextHeight()); - if (aPos.X() < rRect.Right() || aPos.X() + TxtSize.Width() > rRect.Right() || - aPos.Y() < rRect.Top() || aPos.Y() + TxtSize.Height() > rRect.Bottom()) - rDev.SetClipRegion( rRect ); - - rDev.DrawText(aPos, aText); - - if (rDev.IsClipRegion()) - rDev.SetClipRegion(); + rDev.Push( PUSH_CLIPREGION ); + rDev.SetClipRegion( rRect ); + rDev.DrawText( rRect, aText, TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER ); + rDev.Pop(); } //------------------------------------------------------------------------------ @@ -1529,7 +1525,7 @@ sal_Bool OTableEditorCtrl::IsPrimaryKeyAllowed( long /*nRow*/ ) Reference<XPropertySet> xTable = rController.getTable(); ////////////////////////////////////////////////////////////// // Key darf nicht veraendert werden - // Dies gilt jedoch nur, wenn die Tabelle nicht neu ist und keine ::com::sun::star::sdbcx::View. Ansonsten wird kein DROP ausgeführt + // Dies gilt jedoch nur, wenn die Tabelle nicht neu ist und keine ::com::sun::star::sdbcx::View. Ansonsten wird kein DROP ausgef�hrt if(xTable.is() && ::comphelper::getString(xTable->getPropertyValue(PROPERTY_TYPE)) == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW"))) return sal_False; @@ -1551,7 +1547,7 @@ sal_Bool OTableEditorCtrl::IsPrimaryKeyAllowed( long /*nRow*/ ) { ////////////////////////////////////////////////////////////// // Wenn Feldtyp Memo oder Image, kein PrimKey - // oder wenn Spalten nicht gedroped werden können und das Required Flag ist nicht gesetzt + // oder wenn Spalten nicht gedroped werden k�nnen und das Required Flag ist nicht gesetzt // oder wenn eine ::com::sun::star::sdbcx::View vorhanden ist und das Required Flag nicht gesetzt ist TOTypeInfoSP pTypeInfo = pFieldDescr->getTypeInfo(); if( pTypeInfo->nSearchType == ColumnSearch::NONE |