diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-06-28 17:22:11 +0200 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-06-28 17:22:11 +0200 |
commit | d97990327361fa5ab1fce4726a2c7a4d3b4a7813 (patch) | |
tree | 8e2f849bd0fef265879ca2371cd21800496b6474 | |
parent | 715ecfe3617cf13fd8d994e4322c3bbcc093e5cd (diff) |
odbc driver: let's not allocate the buffer twice for nothing
Change-Id: If5db845c856a9fb3adf8c4fcb883607e1cb9446e
-rw-r--r-- | connectivity/source/drivers/odbc/OPreparedStatement.cxx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/connectivity/source/drivers/odbc/OPreparedStatement.cxx b/connectivity/source/drivers/odbc/OPreparedStatement.cxx index c40c665da303..ec2c17230921 100644 --- a/connectivity/source/drivers/odbc/OPreparedStatement.cxx +++ b/connectivity/source/drivers/odbc/OPreparedStatement.cxx @@ -346,16 +346,15 @@ void OPreparedStatement::setParameter(const sal_Int32 parameterIndex, const sal_ } else { - std::vector<sal_uInt32> u; + pData = allocBindBuf(parameterIndex, _sData.getLength() * 4); + sal_uInt32* pCursor = (sal_uInt32*)pData; + nCharLen = 0; for (sal_Int32 i = 0; i != _sData.getLength();) { - u.push_back(_sData.iterateCodePoints(&i)); + *pCursor++ = _sData.iterateCodePoints(&i); + nCharLen += 1; } - nCharLen = u.size(); nByteLen = 4 * nCharLen; - pData = allocBindBuf(parameterIndex, nByteLen); - if (!u.empty()) - memcpy(pData, &u[0], nByteLen); } } else |