[Libreoffice-commits] core.git: connectivity/source

Lionel Elie Mamane lionel at mamane.lu
Sun Oct 18 09:46:41 PDT 2015


 connectivity/source/commontools/FValue.cxx |   70 ++++++++++++++++++++++++++++-
 1 file changed, 69 insertions(+), 1 deletion(-)

New commits:
commit b969f364ee773e3d202607f6bcddba2ac85c19c8
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sun Oct 18 18:43:06 2015 +0200

    tdf#72205 a VARCHAR and a LONGVARCHAR should compare equal
    
    Change-Id: Id20ceb22bb04570c9c52df4d8233a7afa8ba0168
    Reviewed-on: https://gerrit.libreoffice.org/19436
    Reviewed-by: Lionel Elie Mamane <lionel at mamane.lu>
    Tested-by: Lionel Elie Mamane <lionel at mamane.lu>

diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx
index 3318fc1..1b92f57 100644
--- a/connectivity/source/commontools/FValue.cxx
+++ b/connectivity/source/commontools/FValue.cxx
@@ -103,6 +103,74 @@ namespace {
         }
         return bIsCompatible;
     }
+
+    static bool isStorageComparable(sal_Int32 _eType1, sal_Int32 _eType2)
+    {
+        bool bIsComparable = true;
+
+        if (_eType1 != _eType2)
+        {
+            SAL_INFO( "connectivity.commontools", "ORowSetValue::isStorageCompatible _eType1 != _eType2" );
+            switch (_eType1)
+            {
+                case DataType::CHAR:
+                case DataType::VARCHAR:
+                case DataType::LONGVARCHAR:
+                    bIsComparable = (DataType::CHAR         == _eType2)
+                                ||  (DataType::VARCHAR      == _eType2)
+                                ||  (DataType::LONGVARCHAR  == _eType2);
+                    break;
+
+                case DataType::DECIMAL:
+                case DataType::NUMERIC:
+                    bIsComparable = (DataType::DECIMAL      == _eType2)
+                                ||  (DataType::NUMERIC      == _eType2);
+                    break;
+
+            case DataType::DOUBLE:
+                case DataType::REAL:
+                    bIsComparable = (DataType::DOUBLE   == _eType2)
+                                ||  (DataType::REAL     == _eType2);
+                    break;
+
+                case DataType::BINARY:
+                case DataType::VARBINARY:
+                case DataType::LONGVARBINARY:
+                    bIsComparable = (DataType::BINARY           == _eType2)
+                                ||  (DataType::VARBINARY        == _eType2)
+                                ||  (DataType::LONGVARBINARY    == _eType2);
+                    break;
+
+                case DataType::INTEGER:
+                    bIsComparable = (DataType::SMALLINT == _eType2)
+                                ||  (DataType::TINYINT  == _eType2)
+                                ||  (DataType::BIT      == _eType2)
+                                ||  (DataType::BOOLEAN  == _eType2);
+                    break;
+                case DataType::SMALLINT:
+                    bIsComparable = (DataType::TINYINT  == _eType2)
+                                ||  (DataType::BIT      == _eType2)
+                                ||  (DataType::BOOLEAN  == _eType2);
+                    break;
+                case DataType::TINYINT:
+                    bIsComparable = (DataType::BIT      == _eType2)
+                                ||  (DataType::BOOLEAN  == _eType2);
+                    break;
+
+                case DataType::BLOB:
+                case DataType::CLOB:
+                case DataType::OBJECT:
+                    bIsComparable = (DataType::BLOB     == _eType2)
+                                ||  (DataType::CLOB     == _eType2)
+                                ||  (DataType::OBJECT   == _eType2);
+                    break;
+
+                default:
+                    bIsComparable = false;
+            }
+        }
+        return bIsComparable;
+    }
 }
 
 
@@ -775,7 +843,7 @@ bool ORowSetValue::operator==(const ORowSetValue& _rRH) const
     if(m_bNull && _rRH.isNull())
         return true;
 
-    if ( m_eTypeKind != _rRH.m_eTypeKind )
+    if ( !isStorageComparable(m_eTypeKind, _rRH.m_eTypeKind ))
     {
         switch(m_eTypeKind)
         {


More information about the Libreoffice-commits mailing list