[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 2 commits - dbaccess/source

2012-03-20 Thread Petr Mladek
 dbaccess/source/ui/querydesign/QueryDesignView.cxx|2 +-
 dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx |   12 ++--
 dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx |1 +
 3 files changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 1523e93bfc9a5d96fa519c801e904aab82a2b4d4
Author: Lionel Elie Mamane lio...@mamane.lu
Date:   Tue Mar 20 11:03:08 2012 +0100

fdo#47560 properly separate each new sorting column

Signed-off-by: Petr Mladek pmla...@suse.cz

diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx 
b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index c9c6092..1a18286 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -2325,9 +2325,9 @@ namespace
 
 OQueryController rController = 
static_castOQueryController(_pView-getController());
 EOrderDir eOrderDir;
-OTableFieldDescRef aDragLeft = new OTableFieldDesc();
 for( sal_uInt32 i=0 ; ipNode-count() ; i++ )
 {
+OTableFieldDescRef aDragLeft = new OTableFieldDesc();
 eOrderDir = ORDER_ASC;
 ::connectivity::OSQLParseNode*  pChild = pNode-getChild( i );
 
commit 7e0be5ebd688a5e8c2faa8f097f104c89139efeb
Author: Lionel Elie Mamane lio...@mamane.lu
Date:   Tue Mar 20 11:01:12 2012 +0100

fdo#47370 properly duplicate (invisible) out-of-order sort columns

Keep track of position of previous sorting column and use it to decide 
whether to duplicate invisible new sort column

Signed-off-by: Petr Mladek pmla...@suse.cz

diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx 
b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index d13d5f9..177313c 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -68,6 +68,7 @@ const String g_strZero = String::CreateFromAscii(0);
 #define CHECKBOX_SIZE   10
 #define HANDLE_ID0
 #define HANDLE_COLUMN_WITDH 70
+#define SORT_COLUMN_NONE0x
 
 // 
-
 namespace
@@ -113,6 +114,7 @@ OSelectionBrowseBox::OSelectionBrowseBox( Window* pParent )
   BROWSER_HIDECURSOR | BROWSER_HLINESFULL | 
BROWSER_VLINESFULL )
,m_aFunctionStrings(ModuleRes(STR_QUERY_FUNCTIONS))
,m_nVisibleCount(0)
+   ,m_nLastSortColumn(SORT_COLUMN_NONE)
,m_bOrderByUnRelated(sal_True)
,m_bGroupByUnRelated(sal_True)
,m_bStopTimer(sal_False)
@@ -418,6 +420,7 @@ void OSelectionBrowseBox::ClearAll()
 aIter = getFields().rbegin();
 }
 }
+m_nLastSortColumn = SORT_COLUMN_NONE;
 SetUpdateMode(sal_True);
 }
 
//--
@@ -1873,11 +1876,14 @@ void OSelectionBrowseBox::AddCondition( const 
OTableFieldDescRef rInfo, const S
 
//--
 void OSelectionBrowseBox::AddOrder( const OTableFieldDescRef rInfo, const 
EOrderDir eDir, sal_uInt32 _nCurrentPos)
 {
+if (_nCurrentPos == 0)
+m_nLastSortColumn = SORT_COLUMN_NONE;
+
 Reference XConnection xConnection = 
static_castOQueryController(getDesignView()-getController()).getConnection();
 if(!xConnection.is())
 return;
 DBG_CHKTHIS(OSelectionBrowseBox,NULL);
-OSL_ENSURE(!rInfo-IsEmpty(),AddOrder:: OTableFieldDescRef sollte nicht 
Empty sein!);
+OSL_ENSURE(!rInfo-IsEmpty(),AddOrder:: OTableFieldDescRef should not be 
Empty!);
 OTableFieldDescRef pEntry;
 ReferenceXDatabaseMetaData xMeta = xConnection-getMetaData();
 ::comphelper::UStringMixEqual bCase(xMeta.is()  
xMeta-supportsMixedCaseQuotedIdentifiers());
@@ -1896,7 +1902,7 @@ void OSelectionBrowseBox::AddOrder( const 
OTableFieldDescRef rInfo, const EOrde
 bCase(aAlias,rInfo-GetAlias()))
 {
 sal_uInt32 nPos = aIter - rFields.begin();
-bAppend = _nCurrentPos  nPos;
+bAppend = (m_nLastSortColumn != SORT_COLUMN_NONE)  (nPos = 
m_nLastSortColumn);
 if ( bAppend )
 aIter = rFields.end();
 else
@@ -1904,6 +1910,7 @@ void OSelectionBrowseBox::AddOrder( const 
OTableFieldDescRef rInfo, const EOrde
 if ( !m_bOrderByUnRelated )
 pEntry-SetVisible(sal_True);
 pEntry-SetOrderDir( eDir );
+m_nLastSortColumn = nPos;
 }
 break;
 }
@@ -1914,6 +1921,7 @@ void OSelectionBrowseBox::AddOrder( const 
OTableFieldDescRef rInfo, const EOrde
 OTableFieldDescRef pTmp = InsertField(rInfo, BROWSER_INVALIDID, 
sal_False, sal_False );
 if(pTmp.is())
 {
+

[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 2 commits - dbaccess/source

2012-01-18 Thread Lionel Elie Mamane
 dbaccess/source/core/api/CacheSet.cxx  |2 
 dbaccess/source/core/api/KeySet.cxx|   85 +++--
 dbaccess/source/core/api/KeySet.hxx|5 +
 dbaccess/source/core/api/OptimisticSet.cxx |2 
 4 files changed, 65 insertions(+), 29 deletions(-)

New commits:
commit dfcf55a9de3cc928e5612117d0f9f5f3783de2ff
Author: Lionel Elie Mamane lio...@mamane.lu
Date:   Wed Jan 18 12:30:36 2012 +0100

fdo#44813: make the refresh query filter NULL-safe

diff --git a/dbaccess/source/core/api/KeySet.cxx 
b/dbaccess/source/core/api/KeySet.cxx
index 17789ff..b41e68b 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -223,22 +223,56 @@ void OKeySet::findTableColumnsMatching_throw(   const 
Any i_aTable,
 }
 SAL_WNODEPRECATED_DECLARATIONS_POP
 
+namespace
+{
+void appendOneKeyColumnClause( const ::rtl::OUString tblName, const 
::rtl::OUString colName, ::rtl::OUStringBuffer o_buf )
+{
+static ::rtl::OUString s_sDot(RTL_CONSTASCII_USTRINGPARAM(.));
+static ::rtl::OUString s_sParam0(RTL_CONSTASCII_USTRINGPARAM( ( TRUE 
= ? AND ));
+static ::rtl::OUString s_sParam1(RTL_CONSTASCII_USTRINGPARAM( = ? OR 
TRUE = ? AND ));
+static ::rtl::OUString s_sParam2(RTL_CONSTASCII_USTRINGPARAM( IS NULL 
) ));
+o_buf.append(s_sParam0);
+o_buf.append(tblName);
+o_buf.append(s_sDot);
+o_buf.append(colName);
+o_buf.append(s_sParam1);
+o_buf.append(tblName);
+o_buf.append(s_sDot);
+o_buf.append(colName);
+o_buf.append(s_sParam2);
+}
+}
+
+void OKeySet::setOneKeyColumnParameter( sal_Int32 nPos, const Reference 
XParameters  _xParameter, const connectivity::ORowSetValue _rValue, 
sal_Int32 _nType, sal_Int32 _nScale ) const
+{
+if ( _rValue.isNull() )
+{
+_xParameter-setBoolean( nPos++, false );
+// We do the full call so that the right sqlType is passed to setNull
+setParameter( nPos++, _xParameter, _rValue, _nType, _nScale );
+_xParameter-setBoolean( nPos++, true );
+}
+else
+{
+_xParameter-setBoolean( nPos++, true );
+setParameter( nPos++, _xParameter, _rValue, _nType, _nScale );
+_xParameter-setBoolean( nPos++, false );
+}
+}
+
 ::rtl::OUStringBuffer OKeySet::createKeyFilter()
 {
 static ::rtl::OUString aAnd(RTL_CONSTASCII_USTRINGPARAM( AND ));
 const ::rtl::OUString aQuote= getIdentifierQuoteString();
 ::rtl::OUStringBuffer aFilter;
-static ::rtl::OUString s_sDot(RTL_CONSTASCII_USTRINGPARAM(.));
-static ::rtl::OUString s_sParam(RTL_CONSTASCII_USTRINGPARAM( = ?));
 // create the where clause
 ReferenceXDatabaseMetaData xMeta = m_xConnection-getMetaData();
 SelectColumnsMetaData::iterator aPosEnd = m_pKeyColumnNames-end();
 for(SelectColumnsMetaData::iterator aPosIter = 
m_pKeyColumnNames-begin();aPosIter != aPosEnd;)
 {
-aFilter.append(::dbtools::quoteTableName( 
xMeta,aPosIter-second.sTableName,::dbtools::eInDataManipulation));
-aFilter.append(s_sDot);
-aFilter.append(::dbtools::quoteName( 
aQuote,aPosIter-second.sRealName));
-aFilter.append(s_sParam);
+appendOneKeyColumnClause(::dbtools::quoteTableName( 
xMeta,aPosIter-second.sTableName,::dbtools::eInDataManipulation),
+ ::dbtools::quoteName( 
aQuote,aPosIter-second.sRealName),
+ aFilter);
 ++aPosIter;
 if(aPosIter != aPosEnd)
 aFilter.append(aAnd);
@@ -276,8 +310,6 @@ void OKeySet::construct(const Reference XResultSet 
_xDriverSet,const ::rtl::O
 {
 static ::rtl::OUString aAnd(RTL_CONSTASCII_USTRINGPARAM( AND ));
 const ::rtl::OUString aQuote= getIdentifierQuoteString();
-static ::rtl::OUString s_sDot(RTL_CONSTASCII_USTRINGPARAM(.));
-static ::rtl::OUString s_sParam(RTL_CONSTASCII_USTRINGPARAM( = ?));
 const ::rtl::OUString* pIter = aSeq.getConstArray();
 const ::rtl::OUString* pEnd   = pIter + aSeq.getLength();
 for(;pIter != pEnd;++pIter)
@@ -294,12 +326,11 @@ void OKeySet::construct(const Reference XResultSet 
_xDriverSet,const ::rtl::O
 for(SelectColumnsMetaData::iterator aPosIter = 
(*m_pForeignColumnNames).begin();aPosIter != aPosEnd;++aPosIter)
 {
 // look for columns not in the source columns to use them 
as filter as well
-if ( aFilter.getLength() )
-aFilter.append(aAnd);
-aFilter.append(::dbtools::quoteName( 
aQuote,sSelectTableName));
-aFilter.append(s_sDot);
-aFilter.append(::dbtools::quoteName( 
aQuote,aPosIter-second.sRealName));
-aFilter.append(s_sParam);
+if ( aFilter.getLength() )
+aFilter.append(aAnd);
+