diff --git a/common/database/database_connection.cpp b/common/database/database_connection.cpp index 4657e87e7f..33728d38ab 100644 --- a/common/database/database_connection.cpp +++ b/common/database/database_connection.cpp @@ -18,6 +18,7 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <boost/algorithm/string.hpp> #include <boost/locale.hpp> #include <fmt/core.h> #include <nanodbc/nanodbc.h> @@ -236,7 +237,7 @@ bool DATABASE_CONNECTION::CacheTableInfo( const std::string& aTable, { std::string columnKey = toUTF8( columns.column_name() ); - if( aColumns.count( columnKey ) ) + if( aColumns.count( boost::to_lower_copy( columnKey ) ) ) m_columnCache[key][columnKey] = columns.data_type(); } @@ -627,7 +628,13 @@ bool DATABASE_CONNECTION::selectAllAndCache( const std::string& aTable, const st } } - wxASSERT( result.count( aKey ) ); + if( !result.count( aKey ) ) + { + wxLogTrace( traceDatabase, + wxT( "selectAllAndCache: warning: key %s not found in result set" ), aKey ); + continue; + } + std::string keyStr = std::any_cast<std::string>( result.at( aKey ) ); cacheEntry[keyStr] = result; } diff --git a/eeschema/sch_io/database/sch_io_database.cpp b/eeschema/sch_io/database/sch_io_database.cpp index d32b82062e..af9b6a8f08 100644 --- a/eeschema/sch_io/database/sch_io_database.cpp +++ b/eeschema/sch_io/database/sch_io_database.cpp @@ -343,19 +343,19 @@ void SCH_IO_DATABASE::connect() { std::set<std::string> columns; - columns.insert( tableIter.key_col ); - columns.insert( tableIter.footprints_col ); - columns.insert( tableIter.symbols_col ); + columns.insert( boost::to_lower_copy( tableIter.key_col ) ); + columns.insert( boost::to_lower_copy( tableIter.footprints_col ) ); + columns.insert( boost::to_lower_copy( tableIter.symbols_col ) ); - columns.insert( tableIter.properties.description ); - columns.insert( tableIter.properties.footprint_filters ); - columns.insert( tableIter.properties.keywords ); - columns.insert( tableIter.properties.exclude_from_sim ); - columns.insert( tableIter.properties.exclude_from_bom ); - columns.insert( tableIter.properties.exclude_from_board ); + columns.insert( boost::to_lower_copy( tableIter.properties.description ) ); + columns.insert( boost::to_lower_copy( tableIter.properties.footprint_filters ) ); + columns.insert( boost::to_lower_copy( tableIter.properties.keywords ) ); + columns.insert( boost::to_lower_copy( tableIter.properties.exclude_from_sim ) ); + columns.insert( boost::to_lower_copy( tableIter.properties.exclude_from_bom ) ); + columns.insert( boost::to_lower_copy( tableIter.properties.exclude_from_board ) ); for( const DATABASE_FIELD_MAPPING& field : tableIter.fields ) - columns.insert( field.column ); + columns.insert( boost::to_lower_copy( field.column ) ); m_conn->CacheTableInfo( tableIter.table, columns ); }