diff options
author | Tamas Bunth <tamas.bunth@collabora.co.uk> | 2017-12-27 20:25:33 +0100 |
---|---|---|
committer | Tamás Bunth <btomi96@gmail.com> | 2017-12-28 16:19:37 +0100 |
commit | 0217031a98508731f15df9d361a6e5b584db5716 (patch) | |
tree | 688d255d306f8b8e06cff358fc9cbc988db1dabc | |
parent | 5877a3733c55d51f86edeb17c227fd89363154e4 (diff) |
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>
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 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 |