connectivity/source/inc/parse/sqlbison_exports.hxx |   23 +++++++++++++
 connectivity/source/parse/sqlbison.y               |   35 +++++++++++++++------
 connectivity/source/parse/sqlnode.cxx              |    6 +--
 dbaccess/source/core/api/RowSetCache.cxx           |    2 -
 dbaccess/source/ui/dlg/queryfilter.cxx             |    2 -
 5 files changed, 53 insertions(+), 15 deletions(-)

New commits:
commit e8409cbd7227849fe446661011c8bc73acdca319
Author: Lionel Elie Mamane <lio...@mamane.lu>
Date:   Tue Aug 21 19:27:30 2012 +0200

    fdo#53887 ConvertLikeToken(): make escape character properly escape itself
    
    Change-Id: Ic2b79e78f95e298a08794fa11f227d76152244f5

diff --git a/connectivity/source/parse/sqlbison.y 
b/connectivity/source/parse/sqlbison.y
index a93b799..ce2d0e7 100644
--- a/connectivity/source/parse/sqlbison.y
+++ b/connectivity/source/parse/sqlbison.y
@@ -4511,7 +4511,7 @@ const double fMilliSecondsPerDay = 86400000.0;
 //------------------------------------------------------------------
 ::rtl::OUString ConvertLikeToken(const OSQLParseNode* pTokenNode, const 
OSQLParseNode* pEscapeNode, sal_Bool bInternational)
 {
-       ::rtl::OUStringBuffer aMatchStr;
+       ::rtl::OUStringBuffer aMatchStr(0);
        if (pTokenNode->isToken())
        {
                sal_Unicode cEscape = 0;
@@ -4533,18 +4533,34 @@ const double fMilliSecondsPerDay = 86400000.0;
                    sReplace.appendAscii("%_",2);
                }
 
+               bool wasEscape = false;
                for (sal_Int32 i = 0; i < nLen; i++)
                {
                        const sal_Unicode c = aMatchStr[i];
-                       if (c == sSearch[0] || c == sSearch[1])
+                       // SQL standard requires the escape to be followed
+                       // by a meta-character ('%', '_' or itself), else error
+                       // We are more lenient here and let it escape anything.
+                       // Especially since some databases (e.g. Microsoft SQL 
Server)
+                       // have more meta-characters than the standard, such as 
e.g. '[' and ']'
+                       if (wasEscape)
                        {
-                               if (i > 0 && aMatchStr[i - 1] == cEscape)
-                                       continue;
-                               else
-                               {
-                                       const sal_Unicode cCharacter = 
sReplace[(c == sSearch[0] ? 0 : 1)];
-                                       aMatchStr[i] = cCharacter;
-                               }
+                               wasEscape=false;
+                               continue;
+                       }
+                       if (c == cEscape)
+                       {
+                               wasEscape=true;
+                               continue;
+                       }
+                       int match = -1;
+                       if (c == sSearch[0])
+                               match=0;
+                       else if (c == sSearch[1])
+                               match=1;
+
+                       if (match != -1)
+                       {
+                               aMatchStr[i] = sReplace[match];
                        }
                }
        }
commit cc430308c38d106618189357364454230ff574d6
Author: Lionel Elie Mamane <lio...@mamane.lu>
Date:   Tue Aug 21 18:28:03 2012 +0200

    Put functions exported by sqlbison.hxx into a .hxx file
    
    Change-Id: Ibf4fed39e4d36cb03d079cf55a12d4ec37a70f2b

diff --git a/connectivity/source/inc/parse/sqlbison_exports.hxx 
b/connectivity/source/inc/parse/sqlbison_exports.hxx
new file mode 100644
index 0000000..abb47a3
--- /dev/null
+++ b/connectivity/source/inc/parse/sqlbison_exports.hxx
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright 2012 LibreOffice contributors.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef _CONNECTIVITY_PARSE_SQLBISON_HXX_
+#define _CONNECTIVITY_PARSE_SQLBISON_HXX_
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <connectivity/sqlnode.hxx>
+
+::rtl::OUString ConvertLikeToken(const ::connectivity::OSQLParseNode* 
pTokenNode, const ::connectivity::OSQLParseNode* pEscapeNode, sal_Bool 
bInternational);
+int SQLyyparse (void);
+void setParser( ::connectivity::OSQLParser* );
+
+#endif //_CONNECTIVITY_PARSE_SQLBISON_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/parse/sqlbison.y 
b/connectivity/source/parse/sqlbison.y
index d033778..a93b799 100644
--- a/connectivity/source/parse/sqlbison.y
+++ b/connectivity/source/parse/sqlbison.y
@@ -20,6 +20,7 @@
 
 #include <vector>
 #include <string.h>
+#include "parse/sqlbison_exports.hxx"
 
 #ifndef _CONNECTIVITY_SQLNODE_HXX
 #include <connectivity/sqlnode.hxx>
diff --git a/connectivity/source/parse/sqlnode.cxx 
b/connectivity/source/parse/sqlnode.cxx
index 6996638..9cc9101 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -17,6 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include "parse/sqlbison_exports.hxx"
+
 #include <sal/macros.h>
 #include <connectivity/sqlnode.hxx>
 #include <connectivity/sqlerror.hxx>
@@ -73,10 +75,6 @@ using namespace ::dbtools;
 using namespace ::comphelper;
 
 
-extern int SQLyyparse (void);
-extern ::rtl::OUString ConvertLikeToken(const ::connectivity::OSQLParseNode* 
pTokenNode, const ::connectivity::OSQLParseNode* pEscapeNode, sal_Bool 
bInternational);
-extern void setParser( ::connectivity::OSQLParser* );
-
 namespace
 {
     // 
-----------------------------------------------------------------------------
commit a598600a494b9fe9548a6cd909b453376ead0b04
Author: Lionel Elie Mamane <lio...@mamane.lu>
Date:   Tue Aug 21 17:23:34 2012 +0200

    fdo#46480 do not double-escape (e.g. date) literals as strings
    
    Change-Id: I50d3f1002468d41d5b5882de170699d44fe5223c

diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx 
b/dbaccess/source/ui/dlg/queryfilter.cxx
index cbcee0e..ed22f5a 100644
--- a/dbaccess/source/ui/dlg/queryfilter.cxx
+++ b/dbaccess/source/ui/dlg/queryfilter.cxx
@@ -357,7 +357,7 @@ sal_Bool DlgFilterCrit::getCondition(const ListBox& 
_rField,const ListBox& _rCom
     _rFilter.Handle = GetOSQLPredicateType( _rComp.GetSelectEntry() );
     if ( SQLFilterOperator::SQLNULL != _rFilter.Handle && _rFilter.Handle != 
SQLFilterOperator::NOT_SQLNULL )
     {
-        String sPredicateValue = m_aPredicateInput.getPredicateValue( 
_rValue.GetText(), getMatchingColumn( _rValue ), sal_True );
+        String sPredicateValue = m_aPredicateInput.getPredicateValue( 
_rValue.GetText(), getMatchingColumn( _rValue ), sal_False );
         ::Replace_OS_PlaceHolder( sPredicateValue );
         _rFilter.Value <<= ::rtl::OUString(sPredicateValue);
     }
commit 7f424c407687da063994155fcf390a1a8afed979
Author: Lionel Elie Mamane <lio...@mamane.lu>
Date:   Tue Aug 21 14:43:52 2012 +0200

    m_nEndPos==m_nStartPos is OK: empty window (for example, empty table)
    
    Change-Id: I5525eb750dfbed282fea272de4a736e6c70e51a9

diff --git a/dbaccess/source/core/api/RowSetCache.cxx 
b/dbaccess/source/core/api/RowSetCache.cxx
index f72f4ff..c178713 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -848,7 +848,7 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos, 
sal_Int32 &_nNewEndP
 sal_Bool ORowSetCache::moveWindow()
 {
     OSL_ENSURE(m_nStartPos >= 0,"ORowSetCache::moveWindow: m_nStartPos is less 
than 0!");
-    OSL_ENSURE(m_nEndPos > m_nStartPos,"ORowSetCache::moveWindow: m_nStartPos 
not smaller than m_nEndPos");
+    OSL_ENSURE(m_nEndPos >= m_nStartPos,"ORowSetCache::moveWindow: m_nStartPos 
not smaller than m_nEndPos");
     OSL_ENSURE(m_nEndPos-m_nStartPos <= 
m_nFetchSize,"ORowSetCache::moveWindow: m_nStartPos and m_nEndPos too far 
apart");
 
     if ( m_nStartPos < m_nPosition && m_nPosition <= m_nEndPos )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to