summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-12-07 22:34:25 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2015-12-07 22:34:25 +0000
commit47bfcc7882f2332a3a2cbf9cf9a8988ced3694d0 (patch)
treec1c69ed2e4ab6401cfa12fb69e802977ad21bcbb
parentSmart pointer things up for error handling during setup (diff)
downloadlibdbpp-0.10.2.tar.bz2
libdbpp-0.10.2.tar.xz
libdbpp-0.10.2.zip
Use collated_key'd column names as utf8 comparisons are slow.libdbpp-0.10.2
-rw-r--r--libdbpp/column.cpp2
-rw-r--r--libdbpp/column.h2
-rw-r--r--libdbpp/selectcommand.cpp2
-rw-r--r--libdbpp/selectcommand.h3
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<Column> 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 <boost/multi_index/indexed_by.hpp>
#include <boost/multi_index/ordered_index_fwd.hpp>
#include <boost/multi_index/member.hpp>
+#include <boost/multi_index/mem_fun.hpp>
#include <boost/function/function_fwd.hpp>
#include <boost/shared_ptr.hpp>
#include <visibility.h>
@@ -59,7 +60,7 @@ namespace DB {
/// Friendly typedef cos boost::multi_index_container definitions are massive.
typedef boost::multi_index_container<ColumnPtr, boost::multi_index::indexed_by<
boost::multi_index::ordered_unique<boost::multi_index::member<DB::Column, const unsigned int, &DB::Column::colNo>>,
- boost::multi_index::ordered_unique<boost::multi_index::member<DB::Column, const Glib::ustring, &DB::Column::name>>
+ boost::multi_index::ordered_unique<boost::multi_index::member<DB::Column, const std::string, &DB::Column::name>>
>> Columns;
/// Columns in the result set.