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

Tamas Bunth tamas.bunth at collabora.co.uk
Thu Dec 28 15:20:00 UTC 2017


 connectivity/source/drivers/firebird/DatabaseMetaData.cxx |    5 +++++
 connectivity/source/drivers/firebird/Tables.cxx           |    7 +++++++
 connectivity/source/drivers/firebird/Util.cxx             |    2 ++
 connectivity/source/drivers/firebird/Util.hxx             |    6 +++++-
 4 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 0217031a98508731f15df9d361a6e5b584db5716
Author: Tamas Bunth <tamas.bunth at collabora.co.uk>
Date:   Wed Dec 27 20:25:33 2017 +0100

    tdf#104734 Firebird: Add LONGVARBINARY/Image type
    
    Implement it as a user-defined Blob subtype.
    
    Change-Id: Ia369b6858e7d9191f34032445c1003931273e926
    Reviewed-on: https://gerrit.libreoffice.org/47098
    Reviewed-by: Tamás Bunth <btomi96 at gmail.com>
    Tested-by: Tamás Bunth <btomi96 at gmail.com>

diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
index f18d903a7402..0015219d53eb 100644
--- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
@@ -883,6 +883,11 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
         aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
         aResults.push_back(aRow);
 
+        // Longvarbinary (SQL_BLOB)
+        // Distinguished from simple blob with a user-defined subtype.
+        aRow[2] = new ORowSetValueDecorator(DataType::LONGVARBINARY);
+        aResults.push_back(aRow);
+
         // Integer Types common
         {
             aRow[6] = new ORowSetValueDecorator(); // Create Params
diff --git a/connectivity/source/drivers/firebird/Tables.cxx b/connectivity/source/drivers/firebird/Tables.cxx
index ece895f82670..06d3033443c0 100644
--- a/connectivity/source/drivers/firebird/Tables.cxx
+++ b/connectivity/source/drivers/firebird/Tables.cxx
@@ -10,6 +10,7 @@
 #include "Table.hxx"
 #include "Tables.hxx"
 #include "Catalog.hxx"
+#include "Util.hxx"
 
 #include <TConnection.hxx>
 
@@ -113,6 +114,12 @@ OUString Tables::createStandardColumnPart(const Reference< XPropertySet >& xColP
             aSql.append(" ");
             aSql.append("SUB_TYPE 1");
         }
+        else if(aType == DataType::LONGVARBINARY)
+        {
+            aSql.append(" ");
+            aSql.append("SUB_TYPE ");
+            aSql.append(OUString::number(static_cast<short>(BlobSubtype::Image)));
+        }
     }
 
     if ( bIsAutoIncrement && !sAutoIncrementValue.isEmpty())
diff --git a/connectivity/source/drivers/firebird/Util.cxx b/connectivity/source/drivers/firebird/Util.cxx
index 4036566b88dd..dd1213238d56 100644
--- a/connectivity/source/drivers/firebird/Util.cxx
+++ b/connectivity/source/drivers/firebird/Util.cxx
@@ -151,6 +151,8 @@ sal_Int32 firebird::ColumnTypeInfo::getSdbcType() const
                 return DataType::BLOB;
             case BlobSubtype::Clob:
                 return DataType::CLOB;
+            case BlobSubtype::Image:
+                return DataType::LONGVARBINARY;
             default:
                 SAL_WARN("connectivity.firebird", "Unknown subtype for Blob type: " << aSubType);
                 assert(!"Unknown subtype for Blob type"); // Should never happen
diff --git a/connectivity/source/drivers/firebird/Util.hxx b/connectivity/source/drivers/firebird/Util.hxx
index 2bf242ff441b..e93d3b68f288 100644
--- a/connectivity/source/drivers/firebird/Util.hxx
+++ b/connectivity/source/drivers/firebird/Util.hxx
@@ -28,9 +28,13 @@ namespace connectivity
         // Type Blob has 2 subtypes values
         // 0 for BLOB, 1 for CLOB
         // see http://www.firebirdfaq.org/faq48/
+        // User-defined subtypes are negative.
+        // Use a number for image which is very unlikely to be defined by a
+        // user.
         enum class BlobSubtype {
             Blob = 0,
-            Clob = 1
+            Clob = 1,
+            Image = -9546
         };
 
         // Numeric and decimal types can be identified by their subtype


More information about the Libreoffice-commits mailing list