diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2020-10-31 17:00:25 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2020-10-31 22:16:53 +0100 |
commit | aba06f2c3a39f33007a8f4e6e234254f42e01f0d (patch) | |
tree | bd6fae129a3d188c6f6636ae3450f960079700bf /connectivity/source/drivers/firebird/Util.cxx | |
parent | Use ScDocument::GetSheetSeparator() (diff) | |
download | core-aba06f2c3a39f33007a8f4e6e234254f42e01f0d.tar.gz core-aba06f2c3a39f33007a8f4e6e234254f42e01f0d.zip |
tdf#121553: Firebird, fix datatypes management
In Firebird, BLOB and CLOB are both "BLOB" types but can be distinguished with SUB_TYPE
- BINARY for BLOB
- TEXT for CLOB ("C" = "Character" -> Text)
To deal with this, the enum "BlobSubtype" has been created in connectivity/source/drivers/firebird/Util.hxx
it contains:
- Blob = 0
- Clob = 1
but also
- Image = -9546
This last one is to deal with LONGVARBINARY which doesn't exist in Firebird
It has been added with:
see https://cgit.freedesktop.org/libreoffice/core/commit/?id=0217031a98508731f15df9d361a6e5b584db5716)
When creating a table, Tables::createStandardColumnPart was adding SUB_TYPE part in request part but only when creating table
not when altering table.
So let's deal with subtypes in the 2 mappings:
- ODatabaseMetaData::getTypeInfo from DatabaseMetaData.cxx
- ColumnTypeInfo::getColumnTypeName from Utils.cxx
and let's remove the SUB_TYPE wrong management part from Tables::createStandardColumnPart
Also, BINARY and VARBINARY were wrongly mapped since they should be respectively:
- CHAR CHARACTER SET OCTETS
- VARCHAR CHARACTER SET OCTETS
It also showed that DataType::VARBINARY was missing in ColumnTypeInfo::getColumnTypeName() change from my previous commit
see: https://cgit.freedesktop.org/libreoffice/core/commit/?id=5b33b1a6b0f251202e89cef436efd4719c3fc0c4
Change-Id: I5589fd4f781671076f534865cfe9d30943738fd2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105107
Reviewed-by: Lionel Mamane <lionel@mamane.lu>
Tested-by: Jenkins
Diffstat (limited to 'connectivity/source/drivers/firebird/Util.cxx')
-rw-r--r-- | connectivity/source/drivers/firebird/Util.cxx | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/connectivity/source/drivers/firebird/Util.cxx b/connectivity/source/drivers/firebird/Util.cxx index 7bdb12b8eb29..b46c746e1b5a 100644 --- a/connectivity/source/drivers/firebird/Util.cxx +++ b/connectivity/source/drivers/firebird/Util.cxx @@ -217,15 +217,17 @@ OUString firebird::ColumnTypeInfo::getColumnTypeName() const case DataType::TIMESTAMP: return "TIMESTAMP"; case DataType::BINARY: - return "BINARY"; + return "CHAR CHARACTER SET OCTETS"; + case DataType::VARBINARY: + return "VARCHAR CHARACTER SET OCTETS"; case DataType::LONGVARBINARY: - return "LONGVARBINARY"; + return "BLOB SUB_TYPE " + OUString::number(static_cast<short>(BlobSubtype::Image)); case DataType::ARRAY: return "ARRAY"; case DataType::BLOB: - return "BLOB"; + return "BLOB SUB_TYPE BINARY"; case DataType::CLOB: - return "CLOB"; + return "BLOB SUB_TYPE TEXT"; case DataType::BOOLEAN: return "BOOLEAN"; case DataType::SQLNULL: |