connectivity/source/drivers/mysqlc/mysqlc_general.cxx |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 6bb6e59ca2b40958504ac176cab448de3fe0a2a9
Author:     Julien Nabet <[email protected]>
AuthorDate: Wed Nov 17 22:03:24 2021 +0100
Commit:     Lionel Mamane <[email protected]>
CommitDate: Thu Nov 18 10:47:43 2021 +0100

    tdf#145205: Mysql/MariaDB, display BIT instead of DATE when its a BIT field
    
    Beware, we just want to display the right info here, BIT management in 
Mysql/MariaDB
    needs some work
    
    There are 2 parts in this patch:
    1)
    -    if (sType.equalsIgnoreAsciiCase("bit") || 
sType.equalsIgnoreAsciiCase("bool")
    -        || sType.equalsIgnoreAsciiCase("boolean"))
    +    if (sType.equalsIgnoreAsciiCase("bit"))
    +        return css::sdbc::DataType::BIT;
    +    if (sType.equalsIgnoreAsciiCase("bool") || 
sType.equalsIgnoreAsciiCase("boolean"))
    allows to display BIT instead of DATE when editing the table
    
    2)
    -            return css::sdbc::DataType::VARCHAR;
    +            return css::sdbc::DataType::BIT;
    allows to show a checkbox instead of a field where you can type anything 
when opening the table
    
    Change-Id: Id50882bfab97cc43a1904bfc6eb7256904732bba
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125429
    Tested-by: Jenkins
    Reviewed-by: Lionel Mamane <[email protected]>

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx
index 878efdc3be24..e4b9040b8a1e 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx
@@ -125,7 +125,7 @@ sal_Int32 mysqlToOOOType(int eType, int charsetnr) noexcept
     switch (eType)
     {
         case MYSQL_TYPE_BIT:
-            return css::sdbc::DataType::VARCHAR;
+            return css::sdbc::DataType::BIT;
 
         case MYSQL_TYPE_TINY:
             return css::sdbc::DataType::TINYINT;
@@ -226,8 +226,9 @@ sal_Int32 mysqlStrToOOOType(const OUString& sType)
         return css::sdbc::DataType::REAL;
     if (sType.equalsIgnoreAsciiCase("double"))
         return css::sdbc::DataType::DOUBLE;
-    if (sType.equalsIgnoreAsciiCase("bit") || 
sType.equalsIgnoreAsciiCase("bool")
-        || sType.equalsIgnoreAsciiCase("boolean"))
+    if (sType.equalsIgnoreAsciiCase("bit"))
+        return css::sdbc::DataType::BIT;
+    if (sType.equalsIgnoreAsciiCase("bool") || 
sType.equalsIgnoreAsciiCase("boolean"))
         return css::sdbc::DataType::BOOLEAN;
     OSL_FAIL("Unknown type name from string, failing back to varchar.");
     return css::sdbc::DataType::VARCHAR;

Reply via email to