pocoproject / poco

The POCO C++ Libraries are powerful cross-platform C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems.
https://pocoproject.org
Other
8.34k stars 2.15k forks source link

Poco::Data::MYSQL SELECT TEXT BUG? #3897

Open coolan2013 opened 1 year ago

coolan2013 commented 1 year ago

execute follow code,you will counter a assert

*_pSession << "CREATE TABLE IF NOT EXISTS test1( \
        id BIGINT NOT NULL, \
        cnt TEXT NOT NULL, \
        PRIMARY KEY (id));", now;

std::vector ids1; std::vector strs1;
for (size_t i = 0; i < 500; i++) { ids1.push_back(i); strs1.push_back("{\"7\":1,\"9\":133,\"p\":[{\"c\":\"梁辉细塔\",\"2\":0,\"r\":811}],\"n\":0,\"8\":41,\"o\":1670987322735601}"); }

*_pSession << "REPLACE INTO test1 VALUES(?,?)", use(ids1), use(strs1), now; 

std::vector ids2; std::vector strs2; *_pSession << "SELECT id,cnt FROM test1", into(ids2), into(strs2), now;

here is the callstack:

ntdll.dll!00007ffe9b0391f2()    unknown
ntdll.dll!00007ffe9b041622()    unknown
ntdll.dll!00007ffe9b04192a()    unknown
ntdll.dll!00007ffe9b04a8e9()    unknown
ntdll.dll!00007ffe9afe646d()    unknown
ntdll.dll!00007ffe9af7fc11()    unknown

test.exe!_free_base(void block) line 105 C++ test.exe!free_dbg_nolock(void const block, const int block_use) line 1003 C++ test.exe!_free_dbg(void block, int block_use) line 1030 C++ test.exe!free(void block) line 32 C++ test.exe!Poco::Data::MySQL::ResultMetadata::adjustColumnSizeToFit(unsigned int64 pos) line 270 C++ test.exe!Poco::Data::MySQL::Extractor::extractLongLOB(unsigned int64 pos) line 291 C++ test.exe!Poco::Data::MySQL::Extractor::extract(unsigned int64 pos, std::string & val) line 141 C++ test.exe!Poco::Data::TypeHandler::extract(unsigned int64 pos, std::string & obj, const std::string & defVal, Poco::SharedPtr<Poco::Data::AbstractExtractor,Poco::ReferenceCounter,Poco::ReleasePolicy> pExt) line 132 C++ test.exe!Poco::Data::Extraction<std::vector<std::string,std::allocator>>::extract(unsigned int64 pos) line 193 C++ test.exe!Poco::Data::MySQL::MySQLStatementImpl::next() line 95 C++ test.exe!Poco::Data::StatementImpl::executeWithoutLimit() line 170 C++ test.exe!Poco::Data::StatementImpl::execute(const bool & reset) line 88 C++ test.exe!Poco::Data::Statement::execute(bool reset) line 128 C++ test.exe!Poco::Data::Keywords::now(Poco::Data::Statement & statement) line 463 C++ test.exe!Poco::Data::Statement::operator,(void(*)(Poco::Data::Statement &) manip) line 207 C++ test.exe!SQLExecutor::f_tbTest1_select(std::vector<unsigned int64,std::allocator> ids, std::vector<std::string,std::allocator> & rt) line 195 C++ test.exe!test12(SQLExecutor & sqlE) line 184 C++ test.exe!test(int argc, wchar_t argv) line 194 C++ test.exe!wmain(int argc, wchar_t argv) line 14 C++

if
ALTER TABLE test1 MODIFY cnt VARCHAR(6383); then it's OK!!!

wurei commented 1 year ago

We have the same problem, please refer this.

github-actions[bot] commented 1 day ago

This issue is stale because it has been open for 365 days with no activity.