diff options
author | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2022-03-23 21:14:46 +0100 |
---|---|---|
committer | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2022-03-25 13:37:57 +0100 |
commit | 4590048952a9e62124641c512dc2d19122f7fb2d (patch) | |
tree | a4e785d7b2c85907808cfaba49946aee0ae23929 /connectivity/source/drivers | |
parent | a07e91a5a76546863ccf71462446e8d16d07d21b (diff) |
tdf#132924 - Firebird findColumn: return column alias if specified
The function findColumn in a Basic macro should also find aliases for
columns specified in an SQL query using a Firebird database.
Change-Id: I96adb2564da1e18cee58f1c6803526d8ff4deabb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131990
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'connectivity/source/drivers')
-rw-r--r-- | connectivity/source/drivers/firebird/ResultSetMetaData.cxx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/connectivity/source/drivers/firebird/ResultSetMetaData.cxx b/connectivity/source/drivers/firebird/ResultSetMetaData.cxx index 78d684a725a2..5653d29c4211 100644 --- a/connectivity/source/drivers/firebird/ResultSetMetaData.cxx +++ b/connectivity/source/drivers/firebird/ResultSetMetaData.cxx @@ -128,9 +128,15 @@ OUString SAL_CALL OResultSetMetaData::getSchemaName(sal_Int32) OUString SAL_CALL OResultSetMetaData::getColumnName(sal_Int32 column) { verifyValidColumn(column); - OUString sRet(m_pSqlda->sqlvar[column-1].sqlname, - m_pSqlda->sqlvar[column-1].sqlname_length, - RTL_TEXTENCODING_UTF8); + char* pColumnName = m_pSqlda->sqlvar[column - 1].sqlname; + sal_Int32 nColumnNameLength = m_pSqlda->sqlvar[column - 1].sqlname_length; + // tdf#132924 - return column alias if specified + if (m_pSqlda->sqlvar[column - 1].aliasname_length > 0) + { + pColumnName = m_pSqlda->sqlvar[column - 1].aliasname; + nColumnNameLength = m_pSqlda->sqlvar[column - 1].aliasname_length; + } + OUString sRet(pColumnName, nColumnNameLength, RTL_TEXTENCODING_UTF8); sanitizeIdentifier(sRet); return sRet; } |