From b8a3e51079203d6d9f46d5faf9e624d53b62a0ad Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 4 Feb 2019 20:20:34 +0000 Subject: Columns are unique, not shared --- libdbpp/column.h | 2 +- libdbpp/selectcommand.cpp | 4 ++-- libdbpp/selectcommand.h | 2 +- libdbpp/unittests/libdbpp-postgresql | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libdbpp/column.h b/libdbpp/column.h index ae7634f..94d597b 100644 --- a/libdbpp/column.h +++ b/libdbpp/column.h @@ -115,7 +115,7 @@ namespace DB { /// This column's name. const std::string name; }; - typedef std::shared_ptr ColumnPtr; + typedef std::unique_ptr ColumnPtr; } #endif diff --git a/libdbpp/selectcommand.cpp b/libdbpp/selectcommand.cpp index 1e67ce6..96b3276 100644 --- a/libdbpp/selectcommand.cpp +++ b/libdbpp/selectcommand.cpp @@ -73,10 +73,10 @@ DB::SelectCommand::columnCount() const return columns->size(); } -DB::ColumnPtr +const DB::ColumnPtr & DB::SelectCommand::insertColumn(ColumnPtr col) { - return *columns->insert(col).first; + return *columns->insert(std::move(col)).first; } DB::RowBase::RowBase(SelectCommand * s) : diff --git a/libdbpp/selectcommand.h b/libdbpp/selectcommand.h index 05ec2ce..2fb9253 100644 --- a/libdbpp/selectcommand.h +++ b/libdbpp/selectcommand.h @@ -128,7 +128,7 @@ namespace DB { protected: /// Helper function so clients need not know about boost::multi_index_container. - ColumnPtr insertColumn(ColumnPtr); + const ColumnPtr & insertColumn(ColumnPtr); class Columns; diff --git a/libdbpp/unittests/libdbpp-postgresql b/libdbpp/unittests/libdbpp-postgresql index 36d1ebb..a0ceddd 160000 --- a/libdbpp/unittests/libdbpp-postgresql +++ b/libdbpp/unittests/libdbpp-postgresql @@ -1 +1 @@ -Subproject commit 36d1ebb68359d7faa194a1f62c17011b462a3a1f +Subproject commit a0cedddde5ad16e2b885d3dd0b57b3e613a796a3 -- cgit v1.2.3