Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all articles
Browse latest Browse all 527

Microsoft C++ Exception std::out_of_range mysql-connector-c++-8.0.18-winx64 (no replies)

$
0
0
Visual Studio 2019 Pro
mysqld.exe 8.0.17 x64
I am using mysqlcppconn8-static.lib, downloaded from MySQL site.

This is not a fatal exception, the query result is correct. The exception appears to be thrown every time that the code reads the database. I have not seen the exception occur when writing to the database.

Code to reproduce the error:
MySQLTest()
{
mysqlx::Session session( DATABASE_URL );
mysqlx::RowResult result;
mysqlx::Row row;
mysqlx::Value value;
std::wstring path;
int id;

result = session.getSchema( DATABASE_SCHEMA_CONFIGURATION ) // Expands to L"schema_name"
.getTable( L"resource_paths" )
.select( L"id", L"path" )
.execute();
if( row_count > 0 )
{
row = result.fetchOne();
while( !row.isNull() )
{
size_t col_count = row.colCount();
value = row[0]; // throws std::out_of_range, value contains correct data
id = GetResourceIdFromDBString( static_cast<std::wstring>( value ) ); // Convert string id to numeric id
value = row[1]; // throws std::out_of_range, value contains correct data
path = static_cast<std::wstring>( value );
// Do some interesting stuff with the path
row = result.fetchOne();
}
}
}

It appears that the exception originates with mysqlx::Value& Row_detail::get_val(mysqlx::col_count_t pos) in result.cc but I do not have the pdb files to be able to trace it all the way. I have traced it to Value& get(col_count_t pos) in include\mysqlx\devapi\row.h

Thank you.

Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>