From 3112523858b18ce10f9fdca09bd3c7d0e84c0ce0 Mon Sep 17 00:00:00 2001 From: fasiondog Date: Wed, 7 Aug 2024 22:02:26 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20MySQLStatement::sub=5FgetColumnAsBlob?= =?UTF-8?q?=20=E6=9C=AA=E6=AD=A3=E7=A1=AE=E8=8E=B7=E5=8F=96=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hikyuu/utilities/db_connect/mysql/MySQLStatement.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hikyuu/utilities/db_connect/mysql/MySQLStatement.cpp b/hikyuu/utilities/db_connect/mysql/MySQLStatement.cpp index 400b6a5..8598f66 100755 --- a/hikyuu/utilities/db_connect/mysql/MySQLStatement.cpp +++ b/hikyuu/utilities/db_connect/mysql/MySQLStatement.cpp @@ -416,7 +416,11 @@ void MySQLStatement::sub_getColumnAsBlob(int idx, std::vector& item) { } try { - item = boost::any_cast>(m_result_buffer[idx]); + unsigned long len = m_result_length[idx]; + std::vector* p = boost::any_cast>(&m_result_buffer[idx]); + item.resize(len); + memcpy(item.data(), p->data(), len); + } catch (...) { HKU_THROW("Field type mismatch! idx: {}", idx); }