summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorTamas Bunth <tamas.bunth@collabora.co.uk>2019-07-30 15:05:35 +0200
committerXisco Faulí <xiscofauli@libreoffice.org>2019-08-02 17:13:29 +0200
commit7b2fa9b757f0860d82a7bea9efa503a50a6b70a0 (patch)
tree94f83ea6251c55ec0e239bee550a04533fad362f /connectivity
parent8c32cc30dbba3ee466b75628436ab790d6561e36 (diff)
mysqlc: Support reading blob as string
Change-Id: I1ef0c3817bc255e7f0c38aca73c475b19d5d7d9b Reviewed-on: https://gerrit.libreoffice.org/76600 Tested-by: Jenkins Reviewed-by: Tamás Bunth <btomi96@gmail.com> (cherry picked from commit cc4c20d08fca59819e121c0678d1e595a97c92c9) Reviewed-on: https://gerrit.libreoffice.org/76746 Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index 6c4711f65c71..6146ff6a9816 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -309,7 +309,10 @@ template <> DateTime OPreparedResultSet::retrieveValue(sal_Int32 column)
template <> OUString OPreparedResultSet::retrieveValue(sal_Int32 column)
{
- if (getTypeFromMysqlType(m_aFields[column - 1].type) != std::type_index(typeid(OUString)))
+ // redirect call to the appropiate method if needed
+ // BLOB can be simply read out as string
+ if (getTypeFromMysqlType(m_aFields[column - 1].type) != std::type_index(typeid(OUString))
+ && m_aFields[column - 1].type != MYSQL_TYPE_BLOB)
return getRowSetValue(column);
const char* sStr = static_cast<const char*>(m_aData[column - 1].buffer);
@@ -345,6 +348,9 @@ ORowSetValue OPreparedResultSet::getRowSetValue(sal_Int32 nColumnIndex)
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL:
return getString(nColumnIndex);
+ case MYSQL_TYPE_BLOB:
+ throw SQLException("Column with type BLOB cannot be converted", *this, OUString(), 1,
+ Any());
default:
SAL_WARN("connectivity.mysqlc", "OPreparedResultSet::getRowSetValue: unknown type: "
<< m_aFields[nColumnIndex - 1].type);