From a2c6112a4753347070608480be21066b6dab0bc7 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sat, 12 Nov 2016 01:11:42 +0100 Subject: Related tdf#70433: Use subtype to distinguish BLOB/CLOB for Firebird See http://www.firebirdfaq.org/faq48/ Change-Id: If233919daeb02b67d0b3bc42547fbd3030864c37 Reviewed-on: https://gerrit.libreoffice.org/30789 Reviewed-by: Julien Nabet Tested-by: Julien Nabet --- connectivity/source/drivers/firebird/Util.cxx | 12 +++++++++++- connectivity/source/drivers/firebird/Util.hxx | 8 ++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'connectivity') diff --git a/connectivity/source/drivers/firebird/Util.cxx b/connectivity/source/drivers/firebird/Util.cxx index 318aa6d839b0..114c4c811bd9 100644 --- a/connectivity/source/drivers/firebird/Util.cxx +++ b/connectivity/source/drivers/firebird/Util.cxx @@ -100,7 +100,17 @@ sal_Int32 firebird::getColumnTypeFromFBType(short aType, short aSubType) case SQL_TIMESTAMP: return DataType::TIMESTAMP; case SQL_BLOB: - return DataType::BLOB; + switch (static_cast(aSubType)) + { + case BlobSubtype::Blob: + return DataType::BLOB; + case BlobSubtype::Clob: + return DataType::CLOB; + default: + SAL_WARN("connectivity.firebird", "Unknown subtype for Blob type: " << aSubType); + assert(!"Unknown subtype for Blob type"); // Should never happen + return 0; + } case SQL_ARRAY: return DataType::ARRAY; case SQL_TYPE_TIME: diff --git a/connectivity/source/drivers/firebird/Util.hxx b/connectivity/source/drivers/firebird/Util.hxx index fa9af07c0b27..e8077e65596a 100644 --- a/connectivity/source/drivers/firebird/Util.hxx +++ b/connectivity/source/drivers/firebird/Util.hxx @@ -25,6 +25,14 @@ namespace connectivity namespace firebird { typedef ::std::vector< OString > OStringVector; + // Type Blob has 2 subtypes values + // 0 for BLOB, 1 for CLOB + // see http://www.firebirdfaq.org/faq48/ + enum class BlobSubtype { + Blob = 0, + Clob = 1 + }; + /** * Make sure an identifier is safe to use within the databse. Currently * firebird seems to return identifiers with 93 character (instead of -- cgit