Kaydet (Commit) 79ff7fc7 authored tarafından Kay Schenk's avatar Kay Schenk

#i121492

Patch by: hanya
Fixed date filter problems in table view. Now processes old style date format and "normal" for database as expected.
üst 638e87e8
...@@ -1507,7 +1507,44 @@ Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getOrderColumns( ...@@ -1507,7 +1507,44 @@ Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getOrderColumns(
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
namespace namespace
{ {
::rtl::OUString lcl_getCondition(const Sequence< Sequence< PropertyValue > >& filter,const OPredicateInputController& i_aPredicateInputController,const Reference< XNameAccess >& i_xSelectColumns) ::rtl::OUString lcl_getDecomposedColumnName( const ::rtl::OUString& rComposedName, const ::rtl::OUString& rQuoteString )
{
const sal_Int32 nQuoteLength = rQuoteString.getLength();
::rtl::OUString sName = rComposedName.trim();
::rtl::OUString sColumnName;
sal_Int32 nPos, nRPos = 0;
for (;;)
{
nPos = sName.indexOf( rQuoteString, nRPos );
if ( nPos >= 0 )
{
nRPos = sName.indexOf( rQuoteString, nPos + nQuoteLength );
if ( nRPos > nPos )
{
if ( nRPos + nQuoteLength < sName.getLength() )
{
nRPos += nQuoteLength; // -1 + 1 skip dot
}
else
{
sColumnName = sName.copy( nPos + nQuoteLength, nRPos - nPos - nQuoteLength );
break;
}
}
else
break;
}
else
break;
}
return sColumnName.isEmpty() ? rComposedName : sColumnName;
}
::rtl::OUString lcl_getCondition(const Sequence< Sequence< PropertyValue > >& filter,
const OPredicateInputController& i_aPredicateInputController,
const Reference< XNameAccess >& i_xSelectColumns,
const ::rtl::OUString& rQuoteString )
{ {
::rtl::OUStringBuffer sRet; ::rtl::OUStringBuffer sRet;
const Sequence< PropertyValue >* pOrIter = filter.getConstArray(); const Sequence< PropertyValue >* pOrIter = filter.getConstArray();
...@@ -1524,9 +1561,10 @@ namespace ...@@ -1524,9 +1561,10 @@ namespace
sRet.append(pAndIter->Name); sRet.append(pAndIter->Name);
::rtl::OUString sValue; ::rtl::OUString sValue;
pAndIter->Value >>= sValue; pAndIter->Value >>= sValue;
if ( i_xSelectColumns.is() && i_xSelectColumns->hasByName(pAndIter->Name) ) const ::rtl::OUString sColumnName = lcl_getDecomposedColumnName( pAndIter->Name, rQuoteString );
if ( i_xSelectColumns.is() && i_xSelectColumns->hasByName(sColumnName) )
{ {
Reference<XPropertySet> xColumn(i_xSelectColumns->getByName(pAndIter->Name),UNO_QUERY); Reference<XPropertySet> xColumn(i_xSelectColumns->getByName(sColumnName),UNO_QUERY);
sValue = i_aPredicateInputController.getPredicateValue(sValue,xColumn,sal_True); sValue = i_aPredicateInputController.getPredicateValue(sValue,xColumn,sal_True);
} }
else else
...@@ -1552,14 +1590,14 @@ void SAL_CALL OSingleSelectQueryComposer::setStructuredFilter( const Sequence< S ...@@ -1552,14 +1590,14 @@ void SAL_CALL OSingleSelectQueryComposer::setStructuredFilter( const Sequence< S
{ {
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setStructuredFilter" ); RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setStructuredFilter" );
OPredicateInputController aPredicateInput(m_aContext.getLegacyServiceFactory(),m_xConnection); OPredicateInputController aPredicateInput(m_aContext.getLegacyServiceFactory(),m_xConnection);
setFilter(lcl_getCondition(filter,aPredicateInput,getColumns())); setFilter(lcl_getCondition(filter,aPredicateInput,getColumns(), m_xMetaData->getIdentifierQuoteString()));
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void SAL_CALL OSingleSelectQueryComposer::setStructuredHavingClause( const Sequence< Sequence< PropertyValue > >& filter ) throw (SQLException, RuntimeException) 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" ); RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setStructuredHavingClause" );
OPredicateInputController aPredicateInput(m_aContext.getLegacyServiceFactory(),m_xConnection); OPredicateInputController aPredicateInput(m_aContext.getLegacyServiceFactory(),m_xConnection);
setHavingClause(lcl_getCondition(filter,aPredicateInput,getColumns())); setHavingClause(lcl_getCondition(filter,aPredicateInput,getColumns(), m_xMetaData->getIdentifierQuoteString()));
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropertySet >& column, sal_Bool andCriteria ,::std::mem_fun1_t<bool,OSingleSelectQueryComposer,::rtl::OUString>& _aSetFunctor,sal_Int32 filterOperator) void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropertySet >& column, sal_Bool andCriteria ,::std::mem_fun1_t<bool,OSingleSelectQueryComposer,::rtl::OUString>& _aSetFunctor,sal_Int32 filterOperator)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment