Kaydet (Commit) 0217031a authored tarafından Tamas Bunth's avatar Tamas Bunth Kaydeden (comit) Tamás Bunth

tdf#104734 Firebird: Add LONGVARBINARY/Image type

Implement it as a user-defined Blob subtype.

Change-Id: Ia369b6858e7d9191f34032445c1003931273e926
Reviewed-on: https://gerrit.libreoffice.org/47098Reviewed-by: 's avatarTamás Bunth <btomi96@gmail.com>
Tested-by: 's avatarTamás Bunth <btomi96@gmail.com>
üst 5877a373
...@@ -883,6 +883,11 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo() ...@@ -883,6 +883,11 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
aResults.push_back(aRow); 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 // Integer Types common
{ {
aRow[6] = new ORowSetValueDecorator(); // Create Params aRow[6] = new ORowSetValueDecorator(); // Create Params
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "Table.hxx" #include "Table.hxx"
#include "Tables.hxx" #include "Tables.hxx"
#include "Catalog.hxx" #include "Catalog.hxx"
#include "Util.hxx"
#include <TConnection.hxx> #include <TConnection.hxx>
...@@ -113,6 +114,12 @@ OUString Tables::createStandardColumnPart(const Reference< XPropertySet >& xColP ...@@ -113,6 +114,12 @@ OUString Tables::createStandardColumnPart(const Reference< XPropertySet >& xColP
aSql.append(" "); aSql.append(" ");
aSql.append("SUB_TYPE 1"); 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()) if ( bIsAutoIncrement && !sAutoIncrementValue.isEmpty())
......
...@@ -151,6 +151,8 @@ sal_Int32 firebird::ColumnTypeInfo::getSdbcType() const ...@@ -151,6 +151,8 @@ sal_Int32 firebird::ColumnTypeInfo::getSdbcType() const
return DataType::BLOB; return DataType::BLOB;
case BlobSubtype::Clob: case BlobSubtype::Clob:
return DataType::CLOB; return DataType::CLOB;
case BlobSubtype::Image:
return DataType::LONGVARBINARY;
default: default:
SAL_WARN("connectivity.firebird", "Unknown subtype for Blob type: " << aSubType); SAL_WARN("connectivity.firebird", "Unknown subtype for Blob type: " << aSubType);
assert(!"Unknown subtype for Blob type"); // Should never happen assert(!"Unknown subtype for Blob type"); // Should never happen
......
...@@ -28,9 +28,13 @@ namespace connectivity ...@@ -28,9 +28,13 @@ namespace connectivity
// Type Blob has 2 subtypes values // Type Blob has 2 subtypes values
// 0 for BLOB, 1 for CLOB // 0 for BLOB, 1 for CLOB
// see http://www.firebirdfaq.org/faq48/ // 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 { enum class BlobSubtype {
Blob = 0, Blob = 0,
Clob = 1 Clob = 1,
Image = -9546
}; };
// Numeric and decimal types can be identified by their subtype // Numeric and decimal types can be identified by their subtype
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment