Skip to content

Commit dcd688a

Browse files
committed
minor api change
1 parent 465ece5 commit dcd688a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sweetql.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,14 @@ class SweetQL {
5757
}
5858

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

67+
wasSet = true;
6668
return *its.first;
6769
}
6870

0 commit comments

Comments
 (0)