summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2020-11-01 22:11:00 +0100
committerJulien Nabet <serval2412@yahoo.fr>2020-11-02 13:08:01 +0100
commit42899e8b4e1dfc872924f3488ff6e2070c93c06e (patch)
tree2eb2c170846adc8af757bd6b863e5bc5749656d9 /connectivity
parentff69401d8c941e5adaa662da81c6f02d9fe71955 (diff)
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@yahoo.fr>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/firebird/DatabaseMetaData.cxx12
-rw-r--r--connectivity/source/drivers/firebird/Tables.cxx15
-rw-r--r--connectivity/source/drivers/firebird/Util.cxx8
3 files changed, 28 insertions, 7 deletions
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: