[odb-users] how to blob an array of float in mysql with odb 2.4.0?
不明真相
icewill9999 at vip.qq.com
Tue Jun 22 03:26:07 EDT 2021
Hi, Boris,
I have an array of float values and I need to store them into mysql BLOB column, I defined the mapping as below:
typedef std::vector<unsigned char> buffer; #pragma db value(buffer) type("BLOB")
#pragma db section(extras_) buffer log_data_; // use the section to load the BLOB data
I convert the array of float values into a vector of unsigned char and then store them into the BLOB column. When I read the stored BLOB and convert them back I found only the 64 float values from beginning are correct, which I think is the default size of details::buffer.
I dug into the odb generated file -odb.cxx, and found the size of buffer was never grown to meet the large size// log_data_ // if (t[11UL]) { i.log_data_value.capacity (i.log_data_size); grew = true; }so I add the code if(i.log_data_size >256) t[11UL] =1; it's worked, but all the converted values are wrong.
Is it a bug of ODB 2.4.0 or I did something wrong? please guide me with this, thanks.
Best Regards,Wang
More information about the odb-users
mailing list