MySQL Forums
Forum List  »  Connector/C++

Microsoft C++ Exception std::out_of_range mysql-connector-c++-8.0.18-winx64
Posted by: Rand Olmsted
Date: November 19, 2019 04:09PM

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.

Options: ReplyQuote




Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.