diff options
author | Tamas Bunth <tamas.bunth@collabora.co.uk> | 2017-12-18 14:47:40 +0100 |
---|---|---|
committer | Tamás Bunth <btomi96@gmail.com> | 2017-12-28 10:40:34 +0100 |
commit | e7a80ddb91c44711296aa996bf00242edbfba32d (patch) | |
tree | 503f72703f51a9103edb1eeb2489a017dd97e598 /connectivity/source/drivers/firebird | |
parent | bf662904c4b60e93c6b86e06288d41996eed12a2 (diff) |
tdf#104734 Firebird: Add VARBINARY type to driver
Change-Id: I9a1b3aa9bde855577078fe0db2e31a9c160031d7
Reviewed-on: https://gerrit.libreoffice.org/47092
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Bunth <btomi96@gmail.com>
Diffstat (limited to 'connectivity/source/drivers/firebird')
4 files changed, 19 insertions, 4 deletions
diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx index dcb617363692..614ccf7c2409 100644 --- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx +++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx @@ -863,6 +863,17 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo() aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale aResults.push_back(aRow); + // Varbinary (VARCHAR) + aRow[1] = new ORowSetValueDecorator(OUString("VARCHAR")); + aRow[2] = new ORowSetValueDecorator(DataType::VARBINARY); + aRow[3] = new ORowSetValueDecorator(sal_Int16(32765)); // Prevision = max length + aRow[6] = new ORowSetValueDecorator(OUString("length")); // Create Params + aRow[9] = new ORowSetValueDecorator( + sal_Int16(ColumnSearch::NONE)); // Searchable + aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale + aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale + aResults.push_back(aRow); + // Integer Types common { aRow[6] = new ORowSetValueDecorator(); // Create Params diff --git a/connectivity/source/drivers/firebird/ResultSetMetaData.cxx b/connectivity/source/drivers/firebird/ResultSetMetaData.cxx index 725ed288d00a..b598846545de 100644 --- a/connectivity/source/drivers/firebird/ResultSetMetaData.cxx +++ b/connectivity/source/drivers/firebird/ResultSetMetaData.cxx @@ -96,7 +96,8 @@ sal_Int32 SAL_CALL OResultSetMetaData::getColumnType(sal_Int32 column) short aType = m_pSqlda->sqlvar[column-1].sqltype & ~1; OUString sCharset; - if(aType == SQL_TEXT) + // do not query the character set unnecessarily + if(aType == SQL_TEXT || aType == SQL_VARYING) { sCharset = getCharacterSet(column); } diff --git a/connectivity/source/drivers/firebird/Tables.cxx b/connectivity/source/drivers/firebird/Tables.cxx index afc68fca93f5..ecb186600b86 100644 --- a/connectivity/source/drivers/firebird/Tables.cxx +++ b/connectivity/source/drivers/firebird/Tables.cxx @@ -101,7 +101,7 @@ OUString Tables::createStandardColumnPart(const Reference< XPropertySet >& xColP sal_Int32 aType = 0; xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_TYPE)) >>= aType; - if(aType == DataType::BINARY) + if(aType == DataType::BINARY || aType == DataType::VARBINARY) { aSql.append(" "); aSql.append("CHARACTER SET OCTETS"); diff --git a/connectivity/source/drivers/firebird/Util.cxx b/connectivity/source/drivers/firebird/Util.cxx index 20587e5172ba..e91e0da0bdf9 100644 --- a/connectivity/source/drivers/firebird/Util.cxx +++ b/connectivity/source/drivers/firebird/Util.cxx @@ -100,8 +100,11 @@ sal_Int32 lcl_getCharColumnType( short aType, const OUString& sCharset ) return DataType::BINARY; else return DataType::CHAR; - case SQL_VARYING: // TODO VARBINARY - return DataType::VARCHAR; + case SQL_VARYING: + if( sCharset == "OCTETS") + return DataType::VARBINARY; + else + return DataType::VARCHAR; default: assert(false); return 0; |