Closed yumingzhe1012 closed 3 months ago
I tried 4.0.1 and 4.0.3 , both have the same problem .
It can work when i changed it back to the MDd mode .
You need to build all the code using the same CRT settings, i.e. if you build your program with /MT
, you must build SOCI with /MT
too. This is not specific to SOCI, all code linked into your application absolutely must use the same CRT.
I got a problem when I use the following code to access my sqlite databse .
soci::connection_pool g_pool(15); for (int i = 0; i < 15; i++) { session & sql = g_pool.at(i); sql.open( "sqlite3", connString); } session sql(g_pool); int record_count; sql << "select count(*) from Event" , into (record_count);
It would crash every time after the sql <<....
It crashed here . size_type _Unused_capacity() const noexcept { // micro-optimization for capacity() - size() return (static_cast(this->_Myend() - this->_Mylast()));
}
This is the vector code . I think it's not the key point . Only reference
I develop on windows , vs2015 , muthithread mode(Use static library with MFC), It can't work if 'into(record_count)' is added, If only sql << "select count(*) from Event", without use and into , it can work well . I really have no idea how to deal with it .
Actually, the code is not so simple, I only post the important code here .
It can work when i changed it back to the MDd mode .
I try to add mutex lock to protect the session before it is called ,but still got the same problem.
I really need your help to fix this problem , I took 3 days to check this problems but failed.......
Thank you very much .