Skip to content

Commit

Permalink
minor api change
Browse files Browse the repository at this point in the history
  • Loading branch information
burner committed Apr 18, 2015
1 parent 465ece5 commit dcd688a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sweetql.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ class SweetQL {
}

template<typename S>
S selectOne(const std::string& where = "") {
S selectOne(bool& wasSet, const std::string& where = "") {
auto its = this->select<S>(where);
if(its.first == its.second) {
throw std::out_of_range("Can't select one from empty range");
wasSet = false;
return S();
}

wasSet = true;
return *its.first;
}

Expand Down

0 comments on commit dcd688a

Please sign in to comment.