diff options
author | Tamas Bunth <tamas.bunth@collabora.co.uk> | 2017-12-27 20:25:33 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-03-20 12:26:27 +0100 |
commit | 6fb9ccd212130c890f93e27cf3a3b0743b42f45d (patch) | |
tree | 86b23804d55cd98e7cbbc896cb8d1c713f88d0bb /connectivity | |
parent | Firebird: use 32 bit (diff) | |
download | core-6fb9ccd212130c890f93e27cf3a3b0743b42f45d.tar.gz core-6fb9ccd212130c890f93e27cf3a3b0743b42f45d.zip |
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@gmail.com>
Tested-by: Tamás Bunth <btomi96@gmail.com>
(cherry picked from commit 0217031a98508731f15df9d361a6e5b584db5716)
Diffstat (limited to 'connectivity')
4 files changed, 19 insertions, 1 deletions
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 53c388f4e01c..b41ea4e2d21b 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 |