From 47bfcc7882f2332a3a2cbf9cf9a8988ced3694d0 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 7 Dec 2015 22:34:25 +0000 Subject: Use collated_key'd column names as utf8 comparisons are slow. --- libdbpp/column.cpp | 2 +- libdbpp/column.h | 2 +- libdbpp/selectcommand.cpp | 2 +- libdbpp/selectcommand.h | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libdbpp/column.cpp b/libdbpp/column.cpp index a29b80e..2bb29d8 100644 --- a/libdbpp/column.cpp +++ b/libdbpp/column.cpp @@ -6,7 +6,7 @@ namespace DB { Column::Column(const Glib::ustring & n, unsigned int i) : colNo(i), - name(n) + name(n.collate_key()) { } diff --git a/libdbpp/column.h b/libdbpp/column.h index d3475a3..8c86c51 100644 --- a/libdbpp/column.h +++ b/libdbpp/column.h @@ -81,7 +81,7 @@ namespace DB { /// This column's ordinal. const unsigned int colNo; /// This column's name. - const Glib::ustring name; + const std::string name; }; typedef boost::shared_ptr ColumnPtr; } diff --git a/libdbpp/selectcommand.cpp b/libdbpp/selectcommand.cpp index d904b35..7106fb6 100644 --- a/libdbpp/selectcommand.cpp +++ b/libdbpp/selectcommand.cpp @@ -46,7 +46,7 @@ const DB::Column& DB::SelectCommand::operator[](const Glib::ustring & n) const { typedef Columns::nth_index<1>::type CbyName; - CbyName::iterator i = columns->get<1>().find(n); + CbyName::iterator i = columns->get<1>().find(n.collate_key()); if (i != columns->get<1>().end()) { return **i; } diff --git a/libdbpp/selectcommand.h b/libdbpp/selectcommand.h index e82a532..1165de1 100644 --- a/libdbpp/selectcommand.h +++ b/libdbpp/selectcommand.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -59,7 +60,7 @@ namespace DB { /// Friendly typedef cos boost::multi_index_container definitions are massive. typedef boost::multi_index_container>, - boost::multi_index::ordered_unique> + boost::multi_index::ordered_unique> >> Columns; /// Columns in the result set. -- cgit v1.2.3