diff options
author | Tamas Bunth <tamas.bunth@collabora.co.uk> | 2018-09-12 18:08:49 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-09-14 13:06:58 +0200 |
commit | 8bd58609f49179dd817b3833b7f0471616a9cf2f (patch) | |
tree | b46b75c07fedb81a5a425ec5d2a282fb3e463afa | |
parent | mysqlc: prep stmt: check if cursor out of range (diff) | |
download | core-8bd58609f49179dd817b3833b7f0471616a9cf2f.tar.gz core-8bd58609f49179dd817b3833b7f0471616a9cf2f.zip |
mysqlc: fix XPreparedStatement::setTimestamp
Change-Id: Ia0d0290517fdebd9a7700d52fa0e86de0e958b2d
Reviewed-on: https://gerrit.libreoffice.org/60406
Tested-by: Jenkins
Reviewed-by: Tamás Bunth <btomi96@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/60462
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r-- | connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx index d26eacb7ba7c..e9bcc1f76c37 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx @@ -301,6 +301,7 @@ void SAL_CALL OPreparedStatement::setTimestamp(sal_Int32 parameter, const DateTi checkParameterIndex(parameter); MYSQL_TIME my_time; + memset(&my_time, 0, sizeof(MYSQL_TIME)); my_time.hour = aVal.Hours; my_time.minute = aVal.Minutes; @@ -310,7 +311,7 @@ void SAL_CALL OPreparedStatement::setTimestamp(sal_Int32 parameter, const DateTi my_time.day = aVal.Day; const sal_Int32 nIndex = parameter - 1; - m_binds[nIndex].buffer_type = MYSQL_TYPE_TIME; + m_binds[nIndex].buffer_type = MYSQL_TYPE_DATETIME; mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, &my_time, MYSQL_TYPE_DATETIME); m_bindMetas[nIndex].is_null = 0; } |