[Libreoffice-commits] core.git: connectivity/source
Julien Nabet (via logerrit)
logerrit at kemper.freedesktop.org
Mon Nov 2 12:08:42 UTC 2020
connectivity/source/drivers/firebird/DatabaseMetaData.cxx | 12 ++++++-----
connectivity/source/drivers/firebird/Tables.cxx | 15 ++++++++++++++
connectivity/source/drivers/firebird/Util.cxx | 8 +++++--
3 files changed, 28 insertions(+), 7 deletions(-)
New commits:
commit 42899e8b4e1dfc872924f3488ff6e2070c93c06e
Author: Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Sun Nov 1 22:11:00 2020 +0100
Commit: Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Mon Nov 2 13:08:01 2020 +0100
Fix regression after aba06f2c3a39f33007a8f4e6e234254f42e01f0d
It generated requests like:
CHAR CHARACTER SET OCTETS (100)
instead of:
CHAR(100) CHARACTER SET OCTETS
Change-Id: If32723a99d1ca40c765d89b527ec633cc17cf72b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105157
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
index 487e201004e1..28880a378b0a 100644
--- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
@@ -861,9 +861,11 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
tmp.push_back(aRow);
- // Binary (CHAR)
- // It is distinguished from Text type by its character set
- aRow[1] = new ORowSetValueDecorator(OUString("CHAR CHARACTER SET OCTETS"));
+ // Binary (CHAR); we use the Firebird synonym CHARACTER
+ // to fool LO into seeing it as different types.
+ // It is distinguished from Text type by its character set OCTETS;
+ // that will be added by Tables::createStandardColumnPart
+ aRow[1] = new ORowSetValueDecorator(OUString("CHARACTER"));
aRow[2] = new ORowSetValueDecorator(DataType::BINARY);
aRow[3] = new ORowSetValueDecorator(sal_Int16(32765)); // Prevision = max length
aRow[6] = new ORowSetValueDecorator(OUString("length")); // Create Params
@@ -873,8 +875,8 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
tmp.push_back(aRow);
- // Varbinary (VARCHAR)
- aRow[1] = new ORowSetValueDecorator(OUString("VARCHAR CHARACTER SET OCTETS"));
+ // Varbinary (VARCHAR); see comment above about BINARY
+ aRow[1] = new ORowSetValueDecorator(OUString("CHARACTER VARYING"));
aRow[2] = new ORowSetValueDecorator(DataType::VARBINARY);
aRow[3] = new ORowSetValueDecorator(sal_Int16(32765)); // Prevision = max length
aRow[6] = new ORowSetValueDecorator(OUString("length")); // Create Params
diff --git a/connectivity/source/drivers/firebird/Tables.cxx b/connectivity/source/drivers/firebird/Tables.cxx
index 235baec83b3d..5acb391caeb5 100644
--- a/connectivity/source/drivers/firebird/Tables.cxx
+++ b/connectivity/source/drivers/firebird/Tables.cxx
@@ -93,6 +93,21 @@ OUString Tables::createStandardColumnPart(const Reference< XPropertySet >& xColP
aSql.append(" ");
aSql.append(dbtools::createStandardTypePart(xColProp, _xConnection));
+ // Add character set for (VAR)BINARY (fix) types:
+ // (VAR) BINARY is distinguished from other CHAR types by its character set.
+ // Octets is a special character set for binary data.
+ if ( xPropInfo.is() && xPropInfo->hasPropertyByName(rPropMap.getNameByIndex(
+ PROPERTY_ID_TYPE)) )
+ {
+ sal_Int32 aType = 0;
+ xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_TYPE))
+ >>= aType;
+ if(aType == DataType::BINARY || aType == DataType::VARBINARY)
+ {
+ aSql.append(" ");
+ aSql.append("CHARACTER SET OCTETS");
+ }
+ }
if ( bIsAutoIncrement && !sAutoIncrementValue.isEmpty())
{
diff --git a/connectivity/source/drivers/firebird/Util.cxx b/connectivity/source/drivers/firebird/Util.cxx
index b46c746e1b5a..64e3297235ea 100644
--- a/connectivity/source/drivers/firebird/Util.cxx
+++ b/connectivity/source/drivers/firebird/Util.cxx
@@ -217,9 +217,13 @@ OUString firebird::ColumnTypeInfo::getColumnTypeName() const
case DataType::TIMESTAMP:
return "TIMESTAMP";
case DataType::BINARY:
- return "CHAR CHARACTER SET OCTETS";
+ // in Firebird, that is the same datatype "CHAR" as DataType::CHAR,
+ // only with CHARACTER SET OCTETS; we use the synonym CHARACTER
+ // to fool LO into seeing it as different types.
+ return "CHARACTER";
case DataType::VARBINARY:
- return "VARCHAR CHARACTER SET OCTETS";
+ // see above comment about DataType::BINARY.
+ return "CHARACTER VARYING";
case DataType::LONGVARBINARY:
return "BLOB SUB_TYPE " + OUString::number(static_cast<short>(BlobSubtype::Image));
case DataType::ARRAY:
More information about the Libreoffice-commits
mailing list