summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2014-04-11 18:48:57 +0000
committerrandomdan <randomdan@localhost>2014-04-11 18:48:57 +0000
commit900ebbdb176a7cd2105fec84bf57c14388fbaf9a (patch)
treecb4db1e41a6f32a7fe39b7960845c02d7407efb6
parentSupport getting all script nodes of a given name (diff)
downloadproject2-900ebbdb176a7cd2105fec84bf57c14388fbaf9a.tar.bz2
project2-900ebbdb176a7cd2105fec84bf57c14388fbaf9a.tar.xz
project2-900ebbdb176a7cd2105fec84bf57c14388fbaf9a.zip
Store and use the collated column name in lookups
-rw-r--r--project2/common/columns.cpp2
-rw-r--r--project2/common/columns.h3
-rw-r--r--project2/common/rowSet.cpp2
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::intrusive_ptr<Column>,
boost::multi_index::indexed_by<
boost::multi_index::ordered_unique<
- boost::multi_index::tag<byColName>, BOOST_MULTI_INDEX_MEMBER(Column, const Glib::ustring, name)>,
+ boost::multi_index::tag<byColName>, BOOST_MULTI_INDEX_MEMBER(Column, const std::string, key)>,
boost::multi_index::ordered_unique<
boost::multi_index::tag<byColIdx>, 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<byColName>::type::iterator di = columns.get<byColName>().find(col);
+ Columns::index<byColName>::type::iterator di = columns.get<byColName>().find(col.collate_key());
if (di != columns.get<byColName>().end()) {
if (fields[(*di)->idx].isNull()) {
return (*di)->defValue(ec);