diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2022-07-11 21:09:24 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2022-07-11 22:45:29 +0200 |
commit | 44eac6530c9692eeaf51efdbd2f5f37180c9c214 (patch) | |
tree | e21b9e390eee6fabac11051f7f2b882432648749 /connectivity | |
parent | cf02b94bc513ee1b742b4c5d7174632b568e8b72 (diff) |
tdf#149951: MySQL/MariaDB (direct connection) save images in BLOB-fields
There were several pbs:
1) no size value was given to resetSqlVar whereas all BLOB or related need an explicit size so was 0
=> provide size value with x.getLength()
2) Type provided was Sequence instead of a sal_Int8 so unitSize was 8 instead of 1
=> provide "&x[0]" instead of "&x"
3) m_bindMetas[nIndex].length wasn't filled
=> initialize it with x.getLength()
Change-Id: Iaca6a8f8142601c224d6f7aabe4414e61586d29f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136964
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx index 6ec6a89f175c..3c1c6d88ec4a 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx @@ -493,9 +493,10 @@ void SAL_CALL OPreparedStatement::setBytes(sal_Int32 parameter, const Sequence<s checkParameterIndex(parameter); const sal_Int32 nIndex = parameter - 1; - m_binds[nIndex].buffer_type = MYSQL_TYPE_BLOB; // FIXME - mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, &x, MYSQL_TYPE_BLOB); + m_binds[nIndex].buffer_type = MYSQL_TYPE_BLOB; + mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, &x[0], MYSQL_TYPE_BLOB, x.getLength()); m_bindMetas[nIndex].is_null = false; + m_bindMetas[nIndex].length = x.getLength(); } void SAL_CALL OPreparedStatement::setCharacterStream(sal_Int32 parameter, |