Skip to content

Commit

Permalink
fixed MySQLStatement::sub_getColumnAsBlob 未正确获取缓存长度
Browse files Browse the repository at this point in the history
  • Loading branch information
fasiondog committed Aug 7, 2024
1 parent 2b6ffd8 commit 3112523
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hikyuu/utilities/db_connect/mysql/MySQLStatement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,11 @@ void MySQLStatement::sub_getColumnAsBlob(int idx, std::vector<char>& item) {
}

try {
item = boost::any_cast<std::vector<char>>(m_result_buffer[idx]);
unsigned long len = m_result_length[idx];
std::vector<char>* p = boost::any_cast<std::vector<char>>(&m_result_buffer[idx]);
item.resize(len);
memcpy(item.data(), p->data(), len);

} catch (...) {
HKU_THROW("Field type mismatch! idx: {}", idx);
}
Expand Down

0 comments on commit 3112523

Please sign in to comment.