Skip to content
Snippets Groups Projects
Commit c5ddaf5f authored by mvelosob's avatar mvelosob
Browse files

fix OcciStmt::bindBlob failing depending on the blob content

parent e315befd
Branches
Tags
No related merge requests found
......@@ -139,7 +139,11 @@ void OcciStmt::bindUint64(const std::string &paramName, const optional<uint64_t>
//------------------------------------------------------------------------------
void OcciStmt::bindBlob(const std::string &paramName, const std::string &paramValue) {
try {
bindString(paramName, paramValue);
const unsigned paramIdx = getParamIdx(paramName);
std::unique_ptr<unsigned char> buffer = std::unique_ptr<unsigned char>(new unsigned char[paramValue.size()]);
memcpy(buffer.get(), paramValue.c_str(), paramValue.length());
oracle::occi::Bytes paramBytes(buffer.get(), paramValue.length(), 0);
m_stmt->setBytes(paramIdx, paramBytes);
} catch(exception::Exception &ex) {
throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment