From 6fe046b01a896e7bd956bceedad7de8258637db2 Mon Sep 17 00:00:00 2001 From: randomdan Date: Fri, 11 Apr 2014 18:48:57 +0000 Subject: Store and use the collated column name in lookups --- project2/common/columns.cpp | 2 ++ project2/common/columns.h | 3 ++- project2/common/rowSet.cpp | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/project2/common/columns.cpp b/project2/common/columns.cpp index 198dd96..f98c4e5 100644 --- a/project2/common/columns.cpp +++ b/project2/common/columns.cpp @@ -5,6 +5,7 @@ Column::Column(unsigned int i, ScriptNodePtr p) : idx(i), name(p->get_name()), + key(name.collate_key()), defValue(p, "default", Null()) { } @@ -12,6 +13,7 @@ Column::Column(unsigned int i, ScriptNodePtr p) : Column::Column(unsigned int i, const Glib::ustring & n, const Variable & v) : idx(i), name(n), + key(name.collate_key()), defValue(v) { } diff --git a/project2/common/columns.h b/project2/common/columns.h index d0b62d9..bc62447 100644 --- a/project2/common/columns.h +++ b/project2/common/columns.h @@ -15,6 +15,7 @@ class Column : public IntrusivePtrBase { const unsigned int idx; const Glib::ustring name; + const std::string key; const Variable defValue; }; @@ -23,7 +24,7 @@ struct byColName {}; typedef boost::multi_index::multi_index_container, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< - boost::multi_index::tag, BOOST_MULTI_INDEX_MEMBER(Column, const Glib::ustring, name)>, + boost::multi_index::tag, BOOST_MULTI_INDEX_MEMBER(Column, const std::string, key)>, boost::multi_index::ordered_unique< boost::multi_index::tag, BOOST_MULTI_INDEX_MEMBER(Column, const unsigned int, idx)> > > Columns; diff --git a/project2/common/rowSet.cpp b/project2/common/rowSet.cpp index daa81b3..59fde70 100644 --- a/project2/common/rowSet.cpp +++ b/project2/common/rowSet.cpp @@ -72,7 +72,7 @@ VariableType RowState::getCurrentValue(ExecContext * ec, const Glib::ustring & col) const { const Columns & columns = getColumns(); - Columns::index::type::iterator di = columns.get().find(col); + Columns::index::type::iterator di = columns.get().find(col.collate_key()); if (di != columns.get().end()) { if (fields[(*di)->idx].isNull()) { return (*di)->defValue(ec); -- cgit v1.2.3