mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-03-30 05:46:55 +00:00
DbLib: Use case-insensitive lookup for column caching
This commit is contained in:
parent
48bb6b137c
commit
bdb2c3a025
@ -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;
|
||||
}
|
||||
|
@ -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 );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user